use of org.locationtech.geogig.api.Platform in project GeoGig by boundlessgeo.
the class AbstractNodeIndexTest method before.
@Before
public void before() {
tempFolder.newFolder(".geogig");
File workingDirectory = tempFolder.getRoot();
Platform platform = new TestPlatform(workingDirectory);
executorService = Executors.newFixedThreadPool(4);
index = createIndex(platform, executorService);
}
use of org.locationtech.geogig.api.Platform 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.Platform in project GeoGig by boundlessgeo.
the class ConfigDatabaseTest method setUp.
@Before
public final void setUp() {
final File userhome = tempFolder.newFolder("mockUserHomeDir");
final File workingDir = tempFolder.newFolder("mockWorkingDir");
tempFolder.newFolder("mockWorkingDir", ".geogig");
final Platform platform = mock(Platform.class);
when(platform.getUserHome()).thenReturn(userhome);
when(platform.pwd()).thenReturn(workingDir);
config = createDatabase(platform);
}
use of org.locationtech.geogig.api.Platform in project GeoGig by boundlessgeo.
the class CachingModuleTest method setUp.
@Before
public void setUp() throws Exception {
odbCache = mock(Cache.class);
indexCache = mock(Cache.class);
final ObjectDatabaseCacheFactory odbCacheFac = mock(ObjectDatabaseCacheFactory.class);
when(odbCacheFac.get()).thenReturn(odbCache);
final StagingDatabaseCacheFactory indexCacheFac = mock(StagingDatabaseCacheFactory.class);
when(indexCacheFac.get()).thenReturn(indexCache);
File workingDirectory = tmpFolder.getRoot();
final Platform platform = new TestPlatform(workingDirectory);
Module module = new AbstractModule() {
@Override
protected void configure() {
bind(Context.class).to(GuiceInjector.class).in(Scopes.SINGLETON);
Multibinder.newSetBinder(binder(), Decorator.class);
bind(DecoratorProvider.class).in(Scopes.SINGLETON);
DataStreamSerializationFactoryV1 sfac = DataStreamSerializationFactoryV1.INSTANCE;
bind(ObjectSerializingFactory.class).toInstance(sfac);
bind(ObjectDatabase.class).to(HeapObjectDatabse.class).in(Scopes.SINGLETON);
bind(StagingDatabase.class).to(HeapStagingDatabase.class).in(Scopes.SINGLETON);
ConfigDatabase config = new IniFileConfigDatabase(platform);
bind(ConfigDatabase.class).toInstance(config);
bind(ObjectDatabaseCacheFactory.class).toInstance(odbCacheFac);
bind(StagingDatabaseCacheFactory.class).toInstance(indexCacheFac);
}
};
Context injector = Guice.createInjector(Modules.override(new CachingModule()).with(module)).getInstance(org.locationtech.geogig.api.Context.class);
odb = injector.objectDatabase();
index = injector.stagingDatabase();
odb.open();
index.open();
odb.put(o1);
odb.put(o2);
odb.put(o3);
index.put(s1);
index.put(s2);
index.put(s3);
}
use of org.locationtech.geogig.api.Platform in project GeoGig by boundlessgeo.
the class ConfigDatabaseTest method testNoUserHome.
@Test
public void testNoUserHome() {
final Platform platform = mock(Platform.class);
when(platform.getUserHome()).thenReturn(null);
final ConfigDatabase config = createDatabase(platform);
exception.expect(ConfigException.class);
config.putGlobal("section.int", 1);
}
Aggregations