use of org.locationtech.geogig.api.NodeRef in project GeoGig by boundlessgeo.
the class WriteTree2Test method testDeletes.
@Test
public void testDeletes() {
leftTree = createHeadTree(//
repoTree("roads", EMPTY_ID, null, 0), //
repoTree("roads/highways", "a2", "d1", 10), //
repoTree("roads/streets", "a3", "d2", 10), //
repoTree("buildings", EMPTY_ID, null, 0), //
repoTree("buildings/stores", "a5", "d3", 5), //
repoTree("buildings/unknown", "a6", "d4", 5), //
repoTree("buildings/towers", "a7", "d5", 5));
rightTree = createStageHeadTree(//
indexTree("roads", EMPTY_ID, null, 0), //
indexTree("roads/highways", "a2", "d1", 10), //
indexTree("buildings", EMPTY_ID, null, 0), //
indexTree("buildings/stores", "a5", "d31", 5));
final ObjectId newRepoRoot = command.call();
assertNotNull(newRepoRoot);
// check all blobs have been moved from the index to the object database
verifyRepositoryTree(NodeRef.ROOT, newRepoRoot);
ImmutableMap<String, NodeRef> refsByPath = getTreeRefsByPath(newRepoRoot);
assertEquals(set("roads", "roads/highways", "buildings", "buildings/stores"), refsByPath.keySet());
}
use of org.locationtech.geogig.api.NodeRef in project GeoGig by boundlessgeo.
the class WriteBackTest method testPreserveMetadataId.
@Test
public void testPreserveMetadataId() {
RevTreeBuilder oldRoot = new RevTreeBuilder(odb);
RevTree tree = new RevTreeBuilder(odb).put(blob("blob")).build();
final ObjectId treeMetadataId = ObjectId.forString("fakeMdId");
ObjectId newRootId = writeBack.setAncestor(oldRoot).setChildPath("level1/level2").setTree(tree).setMetadataId(treeMetadataId).call();
Optional<NodeRef> ref;
DepthSearch depthSearch = new DepthSearch(odb);
ref = depthSearch.find(newRootId, "level1/level2");
assertTrue(ref.isPresent());
assertTrue(ref.get().getNode().getMetadataId().isPresent());
assertFalse(ref.get().getNode().getMetadataId().get().isNull());
assertEquals(treeMetadataId, ref.get().getNode().getMetadataId().get());
}
use of org.locationtech.geogig.api.NodeRef in project GeoGig by boundlessgeo.
the class WriteTree2Test method testNoChanges.
@Test
public void testNoChanges() {
leftTree = createHeadTree(//
repoTree("buildings", EMPTY_ID, null, 0), //
repoTree("buildings/stores", "a5", "d3", 5), //
repoTree("buildings/unknown", "a6", "d4", 5), //
repoTree("buildings/towers", "a7", "d5", 5));
rightTree = createStageHeadTree(//
repoTree("buildings", EMPTY_ID, null, 0), //
repoTree("buildings/stores", "a5", "d3", 5), //
repoTree("buildings/unknown", "a6", "d4", 5), //
repoTree("buildings/towers", "a7", "d5", 5));
ObjectId newRepoRoot = command.call();
assertNotNull(newRepoRoot);
// check all blobs have been moved from the index to the object database
verifyRepositoryTree(NodeRef.ROOT, newRepoRoot);
ImmutableMap<String, NodeRef> refsByPath = getTreeRefsByPath(newRepoRoot);
assertEquals(4, refsByPath.size());
Set<String> expected = set("buildings", "buildings/stores", "buildings/unknown", "buildings/towers");
assertEquals(expected, refsByPath.keySet());
}
use of org.locationtech.geogig.api.NodeRef in project GeoGig by boundlessgeo.
the class WriteTree2Test method testMetadataIdChangeOnly.
@Test
public void testMetadataIdChangeOnly() {
leftTree = createHeadTree(//
repoTree("buildings", EMPTY_ID, null, 0), // old md id is d3
repoTree("buildings/stores", "a5", "d3", 5));
rightTree = createStageHeadTree(//
indexTree("buildings", EMPTY_ID, null, 0), // new md id is d31
indexTree("buildings/stores", "a5", "d31", 5));
ObjectId newRepoRoot = command.call();
assertNotNull(newRepoRoot);
// check all blobs have been moved from the index to the object database
verifyRepositoryTree(NodeRef.ROOT, newRepoRoot);
ImmutableMap<String, NodeRef> refsByPath = getTreeRefsByPath(newRepoRoot);
assertEquals(set("buildings", "buildings/stores"), refsByPath.keySet());
assertEquals(id("d31"), refsByPath.get("buildings/stores").getMetadataId());
}
use of org.locationtech.geogig.api.NodeRef in project GeoGig by boundlessgeo.
the class WriteTree2Test method testRename.
@Test
public void testRename() {
leftTree = createHeadTree(//
repoTree("roads", EMPTY_ID, null, 0));
rightTree = createStageHeadTree(//
indexTree("roadsRenamed", EMPTY_ID, null, 0));
ObjectId newRepoRoot = command.call();
assertNotNull(newRepoRoot);
// check all blobs have been moved from the index to the object database
verifyRepositoryTree(NodeRef.ROOT, newRepoRoot);
ImmutableMap<String, NodeRef> refsByPath = getTreeRefsByPath(newRepoRoot);
assertEquals(1, refsByPath.size());
assertTrue(refsByPath.containsKey("roadsRenamed"));
}
Aggregations