use of org.opengis.feature.Feature in project GeoGig by boundlessgeo.
the class SquashOpTest method testSquashwithSameSinceAndUntilCommit.
@Test
public void testSquashwithSameSinceAndUntilCommit() throws Exception {
List<Feature> features = Arrays.asList(points1, lines1, points2, lines2, points3, lines3);
List<RevCommit> commits = Lists.newArrayList();
for (Feature f : features) {
insertAndAdd(f);
final RevCommit commit = geogig.command(CommitOp.class).setMessage(f.getIdentifier().getID()).call();
commits.add(commit);
}
geogig.command(SquashOp.class).setSince(commits.get(1)).setUntil(commits.get(1)).setMessage("squashed").call();
Iterator<RevCommit> log = geogig.command(LogOp.class).call();
ArrayList<RevCommit> logentries = Lists.newArrayList(log);
assertEquals(6, logentries.size());
RevCommit squashedCommit = logentries.get(4);
assertEquals(commits.get(1).getTreeId(), squashedCommit.getTreeId());
assertEquals("squashed", squashedCommit.getMessage());
}
use of org.opengis.feature.Feature in project GeoGig by boundlessgeo.
the class WorkingTreeTest method testInsertCollection.
@Test
public void testInsertCollection() throws Exception {
List<Feature> featureList = new LinkedList<Feature>();
featureList.add(points1);
featureList.add(points2);
featureList.add(points3);
List<Node> targetList = new LinkedList<Node>();
workTree.insert(pointsName, featureList.iterator(), LISTENER, targetList, 3);
assertEquals(3, targetList.size());
Node ref1 = targetList.get(0);
Node ref2 = targetList.get(1);
Node ref3 = targetList.get(2);
assertEquals(ref1.getObjectId(), workTree.findUnstaged(appendChild(pointsName, idP1)).get().getObjectId());
assertEquals(ref2.getObjectId(), workTree.findUnstaged(appendChild(pointsName, idP2)).get().getObjectId());
assertEquals(ref3.getObjectId(), workTree.findUnstaged(appendChild(pointsName, idP3)).get().getObjectId());
}
use of org.opengis.feature.Feature in project GeoGig by boundlessgeo.
the class WorkingTreeTest method testUpdateFeaturesNullCollectionSize.
@Test
public void testUpdateFeaturesNullCollectionSize() throws Exception {
List<Feature> featureList = new LinkedList<Feature>();
featureList.add(points1);
featureList.add(points2);
featureList.add(points3);
workTree.insert(pointsName, featureList.iterator(), LISTENER, null, 3);
ObjectId oID1 = workTree.findUnstaged(appendChild(pointsName, idP1)).get().getObjectId();
List<Feature> modifiedFeatures = new LinkedList<Feature>();
modifiedFeatures.add(points1_modified);
workTree.update(pointsName, modifiedFeatures.iterator(), LISTENER, null);
assertFalse(workTree.findUnstaged(appendChild(pointsName, idP1)).get().getObjectId().equals(oID1));
}
use of org.opengis.feature.Feature in project GeoGig by boundlessgeo.
the class WorkingTreeTest method testDeleteCollectionOfFeaturesNotPresent.
@Test
public void testDeleteCollectionOfFeaturesNotPresent() throws Exception {
List<Feature> featureList = new LinkedList<Feature>();
featureList.add(points1);
featureList.add(points2);
workTree.insert(pointsName, featureList.iterator(), LISTENER, null, 3);
assertTrue(workTree.findUnstaged(appendChild(pointsName, idP1)).isPresent());
assertTrue(workTree.findUnstaged(appendChild(pointsName, idP2)).isPresent());
assertFalse(workTree.findUnstaged(appendChild(pointsName, idP3)).isPresent());
List<Feature> deleteFeatures = new LinkedList<Feature>();
deleteFeatures.add(points3);
Name typeName = points1.getName();
workTree.delete(typeName, null, deleteFeatures.iterator());
assertTrue(workTree.findUnstaged(appendChild(pointsName, idP1)).isPresent());
assertTrue(workTree.findUnstaged(appendChild(pointsName, idP2)).isPresent());
assertFalse(workTree.findUnstaged(appendChild(pointsName, idP3)).isPresent());
}
use of org.opengis.feature.Feature in project GeoGig by boundlessgeo.
the class SquashOpTest method testSquashAtBranchTip.
@Test
public void testSquashAtBranchTip() throws Exception {
List<Feature> features = Arrays.asList(points1, lines1, points2, lines2, points3, lines3);
List<RevCommit> commits = Lists.newArrayList();
for (Feature f : features) {
insertAndAdd(f);
final RevCommit commit = geogig.command(CommitOp.class).call();
commits.add(commit);
}
geogig.command(SquashOp.class).setSince(commits.get(1)).setUntil(commits.get(5)).call();
Iterator<RevCommit> log = geogig.command(LogOp.class).call();
ArrayList<RevCommit> logentries = Lists.newArrayList(log);
assertEquals(2, logentries.size());
RevCommit squashedCommit = logentries.get(0);
RevCommit presquashCommit = logentries.get(1);
assertEquals(commits.get(5).getTreeId(), squashedCommit.getTreeId());
assertEquals(commits.get(1).getMessage(), squashedCommit.getMessage());
assertEquals(commits.get(5).getAuthor().getTimestamp(), squashedCommit.getAuthor().getTimestamp());
assertEquals(commits.get(0).getTreeId(), presquashCommit.getTreeId());
}
Aggregations