Search in sources :

Example 1 with HeapObjectDatabse

use of org.locationtech.geogig.storage.memory.HeapObjectDatabse in project GeoGig by boundlessgeo.

the class MutableTreeTest method testBuild.

@Test
@Ignore
public void testBuild() {
    ObjectDatabase origin = new HeapObjectDatabse();
    origin.open();
    ObjectDatabase target = new HeapObjectDatabse();
    target.open();
    RevTree tree = root.build(origin, target);
    Iterator<NodeRef> treeRefs = new DepthTreeIterator("", ObjectId.NULL, tree, target, Strategy.RECURSIVE_TREES_ONLY);
    MutableTree createFromRefs = MutableTree.createFromRefs(root.getNode().getObjectId(), treeRefs);
// TODO finish
}
Also used : NodeRef(org.locationtech.geogig.api.NodeRef) ObjectDatabase(org.locationtech.geogig.storage.ObjectDatabase) HeapObjectDatabse(org.locationtech.geogig.storage.memory.HeapObjectDatabse) RevTree(org.locationtech.geogig.api.RevTree) Ignore(org.junit.Ignore) Test(org.junit.Test)

Example 2 with HeapObjectDatabse

use of org.locationtech.geogig.storage.memory.HeapObjectDatabse in project GeoGig by boundlessgeo.

the class PreOrderDiffWalkTest method beforeTest.

@Before
public void beforeTest() {
    leftSource = new HeapObjectDatabse();
    rightSource = new HeapObjectDatabse();
    leftSource.open();
    rightSource.open();
    consumer = mock(Consumer.class);
}
Also used : Consumer(org.locationtech.geogig.api.plumbing.diff.PreOrderDiffWalk.Consumer) HeapObjectDatabse(org.locationtech.geogig.storage.memory.HeapObjectDatabse) Before(org.junit.Before)

Example 3 with HeapObjectDatabse

use of org.locationtech.geogig.storage.memory.HeapObjectDatabse in project GeoGig by boundlessgeo.

the class InitOpTest method setUp.

@Before
public void setUp() throws IOException, RepositoryConnectionException {
    injector = mock(Context.class);
    mockRefParse = mock(RefParse.class);
    when(mockRefParse.setName(anyString())).thenReturn(mockRefParse);
    mockUpdateRef = mock(UpdateRef.class);
    when(mockUpdateRef.setName(anyString())).thenReturn(mockUpdateRef);
    when(mockUpdateRef.setDelete(anyBoolean())).thenReturn(mockUpdateRef);
    when(mockUpdateRef.setNewValue((ObjectId) anyObject())).thenReturn(mockUpdateRef);
    when(mockUpdateRef.setOldValue((ObjectId) anyObject())).thenReturn(mockUpdateRef);
    when(mockUpdateRef.setReason(anyString())).thenReturn(mockUpdateRef);
    mockUpdateSymRef = mock(UpdateSymRef.class);
    when(mockUpdateSymRef.setName(anyString())).thenReturn(mockUpdateSymRef);
    when(mockUpdateSymRef.setDelete(anyBoolean())).thenReturn(mockUpdateSymRef);
    when(mockUpdateSymRef.setNewValue(anyString())).thenReturn(mockUpdateSymRef);
    when(mockUpdateSymRef.setOldValue(anyString())).thenReturn(mockUpdateSymRef);
    when(mockUpdateSymRef.setReason(anyString())).thenReturn(mockUpdateSymRef);
    when(injector.command(eq(RefParse.class))).thenReturn(mockRefParse);
    when(injector.command(eq(UpdateRef.class))).thenReturn(mockUpdateRef);
    when(injector.command(eq(UpdateSymRef.class))).thenReturn(mockUpdateSymRef);
    platform = mock(Platform.class);
    when(injector.platform()).thenReturn(platform);
    defaults = PluginDefaults.NO_PLUGINS;
    init = new InitOp(defaults);
    init.setContext(injector);
    mockRepo = mock(Repository.class);
    objectDatabase = new HeapObjectDatabse();
    when(mockRepo.objectDatabase()).thenReturn(objectDatabase);
    Mockito.doAnswer(new Answer<Void>() {

        @Override
        public Void answer(InvocationOnMock invocation) throws Throwable {
            objectDatabase.open();
            return null;
        }
    }).when(mockRepo).open();
    workingDir = tempFolder.getRoot();
    when(platform.pwd()).thenReturn(workingDir);
}
Also used : Context(org.locationtech.geogig.api.Context) Platform(org.locationtech.geogig.api.Platform) HeapObjectDatabse(org.locationtech.geogig.storage.memory.HeapObjectDatabse) UpdateRef(org.locationtech.geogig.api.plumbing.UpdateRef) UpdateSymRef(org.locationtech.geogig.api.plumbing.UpdateSymRef) Repository(org.locationtech.geogig.repository.Repository) InvocationOnMock(org.mockito.invocation.InvocationOnMock) RefParse(org.locationtech.geogig.api.plumbing.RefParse) Before(org.junit.Before)

Example 4 with HeapObjectDatabse

use of org.locationtech.geogig.storage.memory.HeapObjectDatabse in project GeoGig by boundlessgeo.

the class PostOrderDiffWalkTest method beforeTest.

@Before
public void beforeTest() {
    leftSource = new HeapObjectDatabse();
    rightSource = new HeapObjectDatabse();
    leftSource.open();
    rightSource.open();
    testConsumer = new TestConsumer();
}
Also used : HeapObjectDatabse(org.locationtech.geogig.storage.memory.HeapObjectDatabse) Before(org.junit.Before)

Example 5 with HeapObjectDatabse

use of org.locationtech.geogig.storage.memory.HeapObjectDatabse in project GeoGig by boundlessgeo.

the class DepthTreeIteratorTest method setUp.

@Before
public void setUp() {
    source = new HeapObjectDatabse();
    source.open();
    metadataId = ObjectId.forString("fake id");
    treePath = "";
    emptyTree = RevTree.EMPTY;
    featuresLeafTree = createFeaturesTree(source, "featuresLeafTree", 100).build();
    assertTrue(featuresLeafTree.features().isPresent());
    treesLeafTree = createTreesTree(source, 100, 10, metadataId).build();
    assertTrue(treesLeafTree.trees().isPresent());
    RevTreeBuilder builder = createTreesTree(source, 10, 10, metadataId);
    for (int i = 0; i < 100; i++) {
        builder.put(featureNode("feature.", i));
    }
    mixedLeafTree = builder.build();
    featuresBucketsTree = createFeaturesTree(source, "feature.", 25000).build();
}
Also used : HeapObjectDatabse(org.locationtech.geogig.storage.memory.HeapObjectDatabse) RevTreeBuilder(org.locationtech.geogig.api.RevTreeBuilder) Before(org.junit.Before)

Aggregations

HeapObjectDatabse (org.locationtech.geogig.storage.memory.HeapObjectDatabse)6 Before (org.junit.Before)5 RevTreeBuilder (org.locationtech.geogig.api.RevTreeBuilder)2 Ignore (org.junit.Ignore)1 Test (org.junit.Test)1 Context (org.locationtech.geogig.api.Context)1 NodeRef (org.locationtech.geogig.api.NodeRef)1 Platform (org.locationtech.geogig.api.Platform)1 RevTree (org.locationtech.geogig.api.RevTree)1 RefParse (org.locationtech.geogig.api.plumbing.RefParse)1 UpdateRef (org.locationtech.geogig.api.plumbing.UpdateRef)1 UpdateSymRef (org.locationtech.geogig.api.plumbing.UpdateSymRef)1 Consumer (org.locationtech.geogig.api.plumbing.diff.PreOrderDiffWalk.Consumer)1 Repository (org.locationtech.geogig.repository.Repository)1 ObjectDatabase (org.locationtech.geogig.storage.ObjectDatabase)1 InvocationOnMock (org.mockito.invocation.InvocationOnMock)1