Search in sources :

Example 11 with TestPlatform

use of org.locationtech.geogig.api.TestPlatform 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 12 with TestPlatform

use of org.locationtech.geogig.api.TestPlatform in project GeoGig by boundlessgeo.

the class RepositoryTestCase method createInjector.

protected Context createInjector() {
    Platform testPlatform = createPlatform();
    GlobalContextBuilder.builder = new TestContextBuilder(testPlatform);
    return GlobalContextBuilder.builder.build();
}
Also used : TestPlatform(org.locationtech.geogig.api.TestPlatform) Platform(org.locationtech.geogig.api.Platform)

Example 13 with TestPlatform

use of org.locationtech.geogig.api.TestPlatform in project GeoGig by boundlessgeo.

the class JEObjectDatabaseTest method setUp.

@Before
public void setUp() {
    File root = folder.getRoot();
    folder.newFolder(".geogig");
    File home = folder.newFolder("home");
    platform = new TestPlatform(root);
    platform.setUserHome(home);
    hints = new Hints();
    envProvider = new EnvironmentBuilder(platform);
}
Also used : Hints(org.locationtech.geogig.repository.Hints) TestPlatform(org.locationtech.geogig.api.TestPlatform) File(java.io.File) Before(org.junit.Before)

Example 14 with TestPlatform

use of org.locationtech.geogig.api.TestPlatform in project GeoGig by boundlessgeo.

the class PointCacheTest method before.

@Before
public void before() {
    tmpFolder.newFolder(".geogig");
    TestPlatform platform = new TestPlatform(tmpFolder.getRoot());
    platform.setUserHome(tmpFolder.newFolder("fakeHome"));
    cache = createCache(platform);
}
Also used : TestPlatform(org.locationtech.geogig.api.TestPlatform) Before(org.junit.Before)

Example 15 with TestPlatform

use of org.locationtech.geogig.api.TestPlatform in project GeoGig by boundlessgeo.

the class DiffTreeTest method setUp.

@Before
public void setUp() throws Exception {
    File workingDirectory = tempFolder.newFolder("mockWorkingDir");
    Platform testPlatform = new TestPlatform(workingDirectory);
    Context injector = Guice.createInjector(Modules.override(new GeogigModule()).with(new MemoryModule(testPlatform))).getInstance(Context.class);
    geogit = new GeoGIG(injector);
    assertNotNull(geogit.getOrCreateRepository());
    diffTree = geogit.command(DiffTree.class);
    SimpleFeatureType ft = DataUtilities.createType("points", "sp:String,ip:Integer,pp:Point:srid=3857");
    revtype = RevFeatureTypeImpl.build(ft);
    metadataId = revtype.getId();
    geogit.getContext().objectDatabase().put(revtype);
}
Also used : Context(org.locationtech.geogig.api.Context) TestPlatform(org.locationtech.geogig.api.TestPlatform) Platform(org.locationtech.geogig.api.Platform) SimpleFeatureType(org.opengis.feature.simple.SimpleFeatureType) TestPlatform(org.locationtech.geogig.api.TestPlatform) File(java.io.File) GeogigModule(org.locationtech.geogig.di.GeogigModule) MemoryModule(org.locationtech.geogig.api.MemoryModule) GeoGIG(org.locationtech.geogig.api.GeoGIG) Before(org.junit.Before)

Aggregations

TestPlatform (org.locationtech.geogig.api.TestPlatform)23 File (java.io.File)21 Before (org.junit.Before)18 Platform (org.locationtech.geogig.api.Platform)9 CLITestContextBuilder (org.locationtech.geogig.cli.test.functional.general.CLITestContextBuilder)9 UnsupportedTerminal (jline.UnsupportedTerminal)7 ConsoleReader (jline.console.ConsoleReader)7 GeogigCLI (org.locationtech.geogig.cli.GeogigCLI)7 GeogigModule (org.locationtech.geogig.di.GeogigModule)6 Context (org.locationtech.geogig.api.Context)5 GeoGIG (org.locationtech.geogig.api.GeoGIG)5 MemoryModule (org.locationtech.geogig.api.MemoryModule)3 RevTree (org.locationtech.geogig.api.RevTree)2 Cache (com.google.common.cache.Cache)1 ThreadFactoryBuilder (com.google.common.util.concurrent.ThreadFactoryBuilder)1 AbstractModule (com.google.inject.AbstractModule)1 Module (com.google.inject.Module)1 Connection (java.sql.Connection)1 SQLException (java.sql.SQLException)1 Statement (java.sql.Statement)1