use of org.opengis.feature.Feature in project GeoGig by boundlessgeo.
the class WriteTree2Test method feature.
private Node feature(ObjectDatabase db, String idPrefix, int index) {
final String id = idPrefix + "." + index;
final Feature feature;
try {
feature = super.feature(pointsType, id, id, index, point(index));
} catch (ParseException e) {
throw Throwables.propagate(e);
}
RevFeature revFeature = RevFeatureBuilder.build(feature);
db.put(revFeature);
Envelope bounds = (Envelope) feature.getBounds();
return Node.create(id, revFeature.getId(), ObjectId.NULL, TYPE.FEATURE, bounds);
}
use of org.opengis.feature.Feature in project GeoGig by boundlessgeo.
the class ReportMergeConflictsOpTest method testModifiedSameFeatureIncompatible.
@Test
public void testModifiedSameFeatureIncompatible() throws Exception {
insertAndAdd(points1);
geogig.command(CommitOp.class).call();
geogig.command(BranchCreateOp.class).setName("TestBranch").call();
Feature points1Modified = feature(pointsType, idP1, "StringProp1_2", new Integer(1000), "POINT(1 1)");
insertAndAdd(points1Modified);
RevCommit masterCommit = geogig.command(CommitOp.class).call();
geogig.command(CheckoutOp.class).setSource("TestBranch").call();
Feature points1ModifiedB = feature(pointsType, idP1, "StringProp1_3", new Integer(1000), "POINT(1 1)");
insertAndAdd(points1ModifiedB);
RevCommit branchCommit = geogig.command(CommitOp.class).call();
MergeScenarioReport conflicts = geogig.command(ReportMergeScenarioOp.class).setMergeIntoCommit(masterCommit).setToMergeCommit(branchCommit).call();
assertEquals(1, conflicts.getConflicts().size());
assertEquals(0, conflicts.getUnconflicted().size());
Boolean hasConflicts = geogig.command(CheckMergeScenarioOp.class).setCommits(Lists.newArrayList(masterCommit, branchCommit)).call();
assertTrue(hasConflicts.booleanValue());
}
use of org.opengis.feature.Feature in project GeoGig by boundlessgeo.
the class ResetOpTest method testResetPathToHeadVersionFixesConflict.
@Test
public void testResetPathToHeadVersionFixesConflict() throws Exception {
Feature points1Modified = feature(pointsType, idP1, "StringProp1_2", new Integer(1000), "POINT(1 1)");
Feature points1ModifiedB = feature(pointsType, idP1, "StringProp1_3", new Integer(2000), "POINT(1 1)");
insertAndAdd(points1);
geogig.command(CommitOp.class).call();
geogig.command(BranchCreateOp.class).setName("TestBranch").call();
insertAndAdd(points1Modified);
geogig.command(CommitOp.class).call();
geogig.command(CheckoutOp.class).setSource("TestBranch").call();
insertAndAdd(points1ModifiedB);
insertAndAdd(points2);
geogig.command(CommitOp.class).call();
geogig.command(CheckoutOp.class).setSource("master").call();
Ref branch = geogig.command(RefParse.class).setName("TestBranch").call().get();
try {
geogig.command(MergeOp.class).addCommit(Suppliers.ofInstance(branch.getObjectId())).call();
fail();
} catch (MergeConflictsException e) {
assertTrue(e.getMessage().contains("conflict"));
}
geogig.command(ResetOp.class).addPattern(pointsName + "/" + idP1).call();
List<Conflict> conflicts = geogig.getRepository().stagingDatabase().getConflicts(null, null);
assertTrue(conflicts.isEmpty());
}
use of org.opengis.feature.Feature in project GeoGig by boundlessgeo.
the class ResetOpTest method testResetPathFixesConflict.
@Test
public void testResetPathFixesConflict() throws Exception {
Feature points1Modified = feature(pointsType, idP1, "StringProp1_2", new Integer(1000), "POINT(1 1)");
Feature points1ModifiedB = feature(pointsType, idP1, "StringProp1_3", new Integer(2000), "POINT(1 1)");
insertAndAdd(points1);
RevCommit resetCommit = geogig.command(CommitOp.class).call();
geogig.command(BranchCreateOp.class).setName("TestBranch").call();
insertAndAdd(points1Modified);
geogig.command(CommitOp.class).call();
geogig.command(CheckoutOp.class).setSource("TestBranch").call();
insertAndAdd(points1ModifiedB);
insertAndAdd(points2);
geogig.command(CommitOp.class).call();
geogig.command(CheckoutOp.class).setSource("master").call();
Ref branch = geogig.command(RefParse.class).setName("TestBranch").call().get();
try {
geogig.command(MergeOp.class).addCommit(Suppliers.ofInstance(branch.getObjectId())).call();
fail();
} catch (MergeConflictsException e) {
assertTrue(e.getMessage().contains("conflict"));
}
geogig.command(ResetOp.class).addPattern(pointsName + "/" + idP1).setCommit(Suppliers.ofInstance(resetCommit.getId())).call();
List<Conflict> conflicts = geogig.getRepository().stagingDatabase().getConflicts(null, null);
assertTrue(conflicts.isEmpty());
}
use of org.opengis.feature.Feature in project GeoGig by boundlessgeo.
the class RepositoryTestCase method populate.
protected List<RevCommit> populate(boolean oneCommitPerFeature, List<Feature> features) throws Exception {
List<RevCommit> commits = new ArrayList<RevCommit>();
for (Feature f : features) {
insertAndAdd(f);
if (oneCommitPerFeature) {
RevCommit commit = geogig.command(CommitOp.class).call();
commits.add(commit);
}
}
if (!oneCommitPerFeature) {
RevCommit commit = geogig.command(CommitOp.class).call();
commits.add(commit);
}
return commits;
}
Aggregations