use of org.locationtech.geogig.api.RevTreeBuilder in project GeoGig by boundlessgeo.
the class DepthTreeIteratorTest method testTrees.
@Test
public void testTrees() {
assertEquals(0, list(emptyTree, Strategy.TREES_ONLY).size());
assertEquals(0, list(featuresLeafTree, Strategy.TREES_ONLY).size());
assertEquals(100, list(treesLeafTree, Strategy.TREES_ONLY).size());
assertEquals(10, list(mixedLeafTree, Strategy.TREES_ONLY).size());
assertEquals(0, list(featuresBucketsTree, Strategy.TREES_ONLY).size());
int numSubTrees = RevTree.NORMALIZED_SIZE_LIMIT + 1;
int featuresPerTree = RevTree.NORMALIZED_SIZE_LIMIT + 1;
RevTreeBuilder builder = createTreesTree(source, numSubTrees, featuresPerTree, metadataId);
for (int i = 0; i < 25000; i++) {
builder.put(featureNode("f", i));
}
RevTree mixedBucketsTree = builder.build();
assertEquals(numSubTrees, list(mixedBucketsTree, Strategy.TREES_ONLY).size());
}
use of org.locationtech.geogig.api.RevTreeBuilder in project GeoGig by boundlessgeo.
the class RevTreeBuilderTest method testNodeOrderPassSplitThreshold.
@Test
public void testNodeOrderPassSplitThreshold() {
final int splitThreshold = RevTree.NORMALIZED_SIZE_LIMIT;
List<Node> expectedOrder = nodes(splitThreshold + 1);
Collections.sort(expectedOrder, new NodeStorageOrder());
final List<Node> flat = expectedOrder.subList(0, splitThreshold);
RevTreeBuilder flatTreeBuilder = new RevTreeBuilder(odb);
RevTreeBuilder bucketTreeBuilder = new RevTreeBuilder(odb);
for (Node n : flat) {
flatTreeBuilder.put(n);
bucketTreeBuilder.put(n);
}
bucketTreeBuilder.put(expectedOrder.get(expectedOrder.size() - 1));
RevTree flatTree = flatTreeBuilder.build();
RevTree bucketTree = bucketTreeBuilder.build();
assertFalse(flatTree.buckets().isPresent());
assertTrue(bucketTree.buckets().isPresent());
odb.put(flatTree);
odb.put(bucketTree);
List<Node> flatNodes = lstree(flatTree);
assertEquals(flat, flatNodes);
List<Node> splitNodes = lstree(bucketTree);
assertEquals(expectedOrder, splitNodes);
}
use of org.locationtech.geogig.api.RevTreeBuilder in project GeoGig by boundlessgeo.
the class DepthSearchTest method setUp.
@Before
public void setUp() throws IOException {
File envHome = tempFolder.getRoot();
Platform testPlatform = new TestPlatform(envHome);
Context injector = Guice.createInjector(Modules.override(new GeogigModule()).with(new MemoryModule(testPlatform))).getInstance(Context.class);
fakeGeogig = new GeoGIG(injector);
Repository fakeRepo = fakeGeogig.getOrCreateRepository();
odb = fakeRepo.objectDatabase();
search = new DepthSearch(odb);
RevTreeBuilder root = new RevTreeBuilder(odb);
root = addTree(root, "path/to/tree1", "node11", "node12", "node13");
root = addTree(root, "path/to/tree2", "node21", "node22", "node23");
root = addTree(root, "tree3", "node31", "node32", "node33");
RevTree rootTree = root.build();
odb.put(rootTree);
rootTreeId = rootTree.getId();
}
use of org.locationtech.geogig.api.RevTreeBuilder in project GeoGig by boundlessgeo.
the class RevTreeBuilderPerformanceTest method testInsertUnordered.
@Test
public void testInsertUnordered() {
System.err.println("testInsertUnordered...");
createTree(nodes, new RevTreeBuilder(odb), true);
// createTree(nodes, new RevTreeBuilder(odb), true);
}
use of org.locationtech.geogig.api.RevTreeBuilder in project GeoGig by boundlessgeo.
the class RevTreeBuilderPerformanceTest method testInsertPartitioned.
private void testInsertPartitioned(int partitionSize) {
UnmodifiableIterator<List<Node>> partitions = Iterators.partition(nodes.iterator(), partitionSize);
RevTreeBuilder builder = new RevTreeBuilder(odb);
Stopwatch sw = Stopwatch.createStarted();
while (partitions.hasNext()) {
List<Node> partition = new ArrayList<Node>(partitions.next());
Collections.sort(partition, new NodeStorageOrder());
createTree(partition, builder, false);
}
System.err.println("Calling RevTreeBuilder.build()...");
builder.build();
sw.stop();
System.err.printf("-- Created tree with %d sorted partitioned size in %s\n", partitionSize, sw);
}
Aggregations