use of cucumber.annotation.en.Given in project GeoGig by boundlessgeo.
the class DefaultStepDefinitions method I_have_a_patch_file.
@Given("^I have a patch file$")
public void I_have_a_patch_file() throws Throwable {
Patch patch = new Patch();
String path = NodeRef.appendChild(pointsName, points1.getIdentifier().getID());
Map<PropertyDescriptor, AttributeDiff> map = Maps.newHashMap();
Optional<?> oldValue = Optional.fromNullable(points1.getProperty("sp").getValue());
GenericAttributeDiffImpl diff = new GenericAttributeDiffImpl(oldValue, Optional.of("new"));
map.put(pointsType.getDescriptor("sp"), diff);
FeatureDiff feaureDiff = new FeatureDiff(path, map, RevFeatureTypeImpl.build(pointsType), RevFeatureTypeImpl.build(pointsType));
patch.addModifiedFeature(feaureDiff);
File file = new File(platform.pwd(), "test.patch");
BufferedWriter writer = Files.newWriter(file, Charsets.UTF_8);
PatchSerializer.write(writer, patch);
writer.flush();
writer.close();
}
use of cucumber.annotation.en.Given in project GeoGig by boundlessgeo.
the class DefaultStepDefinitions method there_is_a_remote_repository_with_a_tag_named.
@Given("^there is a remote repository with a tag named \"([^\"]*)\"$")
public void there_is_a_remote_repository_with_a_tag_named(String tagName) throws Throwable {
I_am_in_an_empty_directory();
final File currDir = platform.pwd();
List<String> output = runAndParseCommand(true, "init", "remoterepo");
assertEquals(output.toString(), 1, output.size());
assertNotNull(output.get(0));
assertTrue(output.get(0), output.get(0).startsWith("Initialized"));
final File remoteRepo = new File(currDir, "remoterepo");
GlobalState.remoteRepo = remoteRepo;
platform.setWorkingDir(remoteRepo);
setupGeogig();
runCommand(true, "config", "--global", "user.name", "John Doe");
runCommand(true, "config", "--global", "user.email", "JohnDoe@example.com");
insertAndAdd(points1);
runCommand(true, "commit -m Commit1");
runCommand(true, "branch -c branch1");
insertAndAdd(points2);
runCommand(true, "commit -m Commit2");
insertAndAdd(points3);
runCommand(true, "commit -m Commit3");
runCommand(true, "checkout master");
insertAndAdd(lines1);
runCommand(true, "commit -m Commit4");
insertAndAdd(lines2);
runCommand(true, "commit -m Commit5");
runCommand(true, "tag " + tagName + " -m Created_" + tagName + "");
String actual = stdOut.toString().replaceAll(LINE_SEPARATOR, "").replaceAll("\\\\", "/").trim().toLowerCase();
assertTrue(actual, actual.startsWith("created tag " + tagName));
platform.setWorkingDir(currDir);
setupGeogig();
}
use of cucumber.annotation.en.Given in project GeoGig by boundlessgeo.
the class DefaultStepDefinitions method I_have_a_merge_conflict_state.
@Given("^I have a merge conflict state$")
public void I_have_a_merge_conflict_state() throws Throwable {
I_have_conflicting_branches();
Ref branch = geogigCLI.getGeogig(Hints.readOnly()).command(RefParse.class).setName("branch1").call().get();
try {
geogigCLI.getGeogig(Hints.readWrite()).command(MergeOp.class).addCommit(Suppliers.ofInstance(branch.getObjectId())).call();
fail();
} catch (MergeConflictsException e) {
}
}
use of cucumber.annotation.en.Given in project GeoGig by boundlessgeo.
the class DefaultStepDefinitions method I_have_conflicting_branches.
@Given("^I have conflicting branches$")
public void I_have_conflicting_branches() throws Throwable {
// Create the following revision graph
// ............o
// ............|
// ............o - Points 1 added
// .........../|\
// branch2 - o | o - branch1 - Points 1 modifiedB and points 2 added
// ............|
// ............o - points 1 modified
// ............|
// ............o - master - HEAD - Lines 1 modified
// branch1 and master are conflicting
Feature points1ModifiedB = feature(pointsType, idP1, "StringProp1_3", new Integer(2000), "POINT(1 1)");
Feature points1Modified = feature(pointsType, idP1, "StringProp1_2", new Integer(1000), "POINT(1 1)");
insertAndAdd(points1);
runCommand(true, "commit -m Commit1");
runCommand(true, "branch branch1");
runCommand(true, "branch branch2");
insertAndAdd(points1Modified);
runCommand(true, "commit -m Commit2");
insertAndAdd(lines1);
runCommand(true, "commit -m Commit3");
runCommand(true, "checkout branch1");
insertAndAdd(points1ModifiedB);
insertAndAdd(points2);
runCommand(true, "commit -m Commit4");
runCommand(true, "checkout branch2");
insertAndAdd(points3);
runCommand(true, "commit -m Commit5");
runCommand(true, "checkout master");
}
use of cucumber.annotation.en.Given in project GeoGig by boundlessgeo.
the class DefaultStepDefinitions method I_have_unstaged_an_empty_feature_type.
@Given("^I have unstaged an empty feature type$")
public void I_have_unstaged_an_empty_feature_type() throws Throwable {
insert(points1);
GeoGIG geogig = geogigCLI.newGeoGIG();
final WorkingTree workTree = geogig.getRepository().workingTree();
workTree.delete(pointsName, idP1);
geogig.close();
}
Aggregations