Search in sources :

Example 16 with Platform

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);
}
Also used : TestPlatform(org.locationtech.geogig.api.TestPlatform) Platform(org.locationtech.geogig.api.Platform) TestPlatform(org.locationtech.geogig.api.TestPlatform) File(java.io.File) Before(org.junit.Before)

Example 17 with Platform

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();
}
Also used : Context(org.locationtech.geogig.api.Context) TestPlatform(org.locationtech.geogig.api.TestPlatform) Platform(org.locationtech.geogig.api.Platform) TestPlatform(org.locationtech.geogig.api.TestPlatform) RevTreeBuilder(org.locationtech.geogig.api.RevTreeBuilder) File(java.io.File) GeogigModule(org.locationtech.geogig.di.GeogigModule) MemoryModule(org.locationtech.geogig.api.MemoryModule) GeoGIG(org.locationtech.geogig.api.GeoGIG) RevTree(org.locationtech.geogig.api.RevTree) Before(org.junit.Before)

Example 18 with Platform

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);
}
Also used : Platform(org.locationtech.geogig.api.Platform) File(java.io.File) Before(org.junit.Before)

Example 19 with 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);
}
Also used : ObjectSerializingFactory(org.locationtech.geogig.storage.ObjectSerializingFactory) Context(org.locationtech.geogig.api.Context) TestPlatform(org.locationtech.geogig.api.TestPlatform) Platform(org.locationtech.geogig.api.Platform) DecoratorProvider(org.locationtech.geogig.di.DecoratorProvider) IniFileConfigDatabase(org.locationtech.geogig.storage.fs.IniFileConfigDatabase) ConfigDatabase(org.locationtech.geogig.storage.ConfigDatabase) HeapObjectDatabse(org.locationtech.geogig.storage.memory.HeapObjectDatabse) IniFileConfigDatabase(org.locationtech.geogig.storage.fs.IniFileConfigDatabase) AbstractModule(com.google.inject.AbstractModule) GuiceInjector(org.locationtech.geogig.di.GuiceInjector) TestPlatform(org.locationtech.geogig.api.TestPlatform) HeapStagingDatabase(org.locationtech.geogig.storage.memory.HeapStagingDatabase) Module(com.google.inject.Module) AbstractModule(com.google.inject.AbstractModule) DataStreamSerializationFactoryV1(org.locationtech.geogig.storage.datastream.DataStreamSerializationFactoryV1) File(java.io.File) Cache(com.google.common.cache.Cache) Before(org.junit.Before)

Example 20 with Platform

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);
}
Also used : Platform(org.locationtech.geogig.api.Platform) Test(org.junit.Test)

Aggregations

Platform (org.locationtech.geogig.api.Platform)41 File (java.io.File)27 TestPlatform (org.locationtech.geogig.api.TestPlatform)10 Before (org.junit.Before)7 Context (org.locationtech.geogig.api.Context)7 GeogigModule (org.locationtech.geogig.di.GeogigModule)6 GeoGIG (org.locationtech.geogig.api.GeoGIG)5 ObjectId (org.locationtech.geogig.api.ObjectId)5 Repository (org.locationtech.geogig.repository.Repository)5 IOException (java.io.IOException)4 UpdateRef (org.locationtech.geogig.api.plumbing.UpdateRef)4 UpdateSymRef (org.locationtech.geogig.api.plumbing.UpdateSymRef)4 CommitBuilder (org.locationtech.geogig.api.CommitBuilder)3 DefaultPlatform (org.locationtech.geogig.api.DefaultPlatform)3 MemoryModule (org.locationtech.geogig.api.MemoryModule)3 RevCommit (org.locationtech.geogig.api.RevCommit)3 RevTree (org.locationtech.geogig.api.RevTree)3 ByteArrayInputStream (java.io.ByteArrayInputStream)2 URL (java.net.URL)2 UnsupportedTerminal (jline.UnsupportedTerminal)2