use of org.opengis.feature.Feature in project GeoGig by boundlessgeo.
the class GeogigAPITest method testGetFeatureFromWorkingTree.
@Test
public void testGetFeatureFromWorkingTree() throws Exception {
insert(points1);
Feature feature = geogigAPI.getFeatureFromWorkingTree(NodeRef.appendChild(pointsName, idP1));
assertNotNull(feature);
}
use of org.opengis.feature.Feature in project GeoGig by boundlessgeo.
the class MergeOpTest method testMergeWithFeatureMerge.
@Test
public void testMergeWithFeatureMerge() throws Exception {
// Create the following revision graph
// o
// |
// o - Points 1 added
// |\
// | o - TestBranch - Points 1 modified and points 2 added
// |
// o - master - HEAD - Points 1 modifiedB
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);
geogig.command(CommitOp.class).call();
geogig.command(CheckoutOp.class).setSource("TestBranch").call();
Feature points1ModifiedB = feature(pointsType, idP1, "StringProp1_1", new Integer(2000), "POINT(1 1)");
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();
geogig.command(MergeOp.class).addCommit(Suppliers.ofInstance(branch.getObjectId())).call();
String path = appendChild(pointsName, points1.getIdentifier().getID());
Optional<RevFeature> feature = repo.command(RevObjectParse.class).setRefSpec(/*
* mergeCommit. getId ().toString () + ":" +
*/
"WORK_HEAD" + ":" + path).call(RevFeature.class);
assertTrue(feature.isPresent());
Feature mergedFeature = feature(pointsType, idP1, "StringProp1_2", new Integer(2000), "POINT(1 1)");
RevFeature expected = RevFeatureBuilder.build(mergedFeature);
assertEquals(expected, feature.get());
}
use of org.opengis.feature.Feature in project GeoGig by boundlessgeo.
the class LogOpTest method testPathFilterSingleFeature.
@Test
public void testPathFilterSingleFeature() throws Exception {
List<Feature> features = Arrays.asList(points1, lines1, points2, lines2, points3, lines3);
List<RevCommit> allCommits = Lists.newArrayList();
RevCommit expectedCommit = null;
for (Feature f : features) {
insertAndAdd(f);
String id = f.getIdentifier().getID();
final RevCommit commit = geogig.command(CommitOp.class).call();
if (id.equals(lines1.getIdentifier().getID())) {
expectedCommit = commit;
}
allCommits.add(commit);
}
String path = NodeRef.appendChild(linesName, lines1.getIdentifier().getID());
List<RevCommit> feature2_1Commits = toList(logOp.addPath(path).call());
assertEquals(1, feature2_1Commits.size());
assertEquals(Collections.singletonList(expectedCommit), feature2_1Commits);
}
use of org.opengis.feature.Feature in project GeoGig by boundlessgeo.
the class LogOpTest method testSkip.
@Test
public void testSkip() throws Exception {
List<Feature> features = Arrays.asList(points1, lines1, points2, lines2, points3, lines3);
for (Feature f : features) {
insertAndAdd(f);
geogig.command(CommitOp.class).call();
}
logOp.setSkip(2).call();
exception.expect(IllegalArgumentException.class);
logOp.setSkip(-1).call();
}
use of org.opengis.feature.Feature in project GeoGig by boundlessgeo.
the class LogOpTest method testTemporalConstraint.
@Test
public void testTemporalConstraint() throws Exception {
List<Feature> features = Arrays.asList(points1, lines1, points2, lines2, points3, lines3);
List<Long> timestamps = Arrays.asList(Long.valueOf(1000), Long.valueOf(2000), Long.valueOf(3000), Long.valueOf(4000), Long.valueOf(5000), Long.valueOf(6000));
LinkedList<RevCommit> allCommits = new LinkedList<RevCommit>();
for (int i = 0; i < features.size(); i++) {
Feature f = features.get(i);
Long timestamp = timestamps.get(i);
insertAndAdd(f);
final RevCommit commit = geogig.command(CommitOp.class).setCommitterTimestamp(timestamp).call();
allCommits.addFirst(commit);
}
// test time range exclusive
boolean minInclusive = false;
boolean maxInclusive = false;
Range<Date> commitRange = new Range<Date>(Date.class, new Date(2000), minInclusive, new Date(5000), maxInclusive);
logOp.setTimeRange(commitRange);
List<RevCommit> logged = toList(logOp.call());
List<RevCommit> expected = allCommits.subList(2, 4);
assertEquals(expected, logged);
// test time range inclusive
minInclusive = true;
maxInclusive = true;
commitRange = new Range<Date>(Date.class, new Date(2000), minInclusive, new Date(5000), maxInclusive);
logOp = geogig.command(LogOp.class).setTimeRange(commitRange);
logged = toList(logOp.call());
expected = allCommits.subList(1, 5);
assertEquals(expected, logged);
// test reset time range
logOp = geogig.command(LogOp.class).setTimeRange(commitRange).setTimeRange(null);
logged = toList(logOp.call());
expected = allCommits;
assertEquals(expected, logged);
}
Aggregations