Search in sources :

Example 1 with DataStreamSerializationFactoryV1

use of org.locationtech.geogig.storage.datastream.DataStreamSerializationFactoryV1 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)

Aggregations

Cache (com.google.common.cache.Cache)1 AbstractModule (com.google.inject.AbstractModule)1 Module (com.google.inject.Module)1 File (java.io.File)1 Before (org.junit.Before)1 Context (org.locationtech.geogig.api.Context)1 Platform (org.locationtech.geogig.api.Platform)1 TestPlatform (org.locationtech.geogig.api.TestPlatform)1 DecoratorProvider (org.locationtech.geogig.di.DecoratorProvider)1 GuiceInjector (org.locationtech.geogig.di.GuiceInjector)1 ConfigDatabase (org.locationtech.geogig.storage.ConfigDatabase)1 ObjectSerializingFactory (org.locationtech.geogig.storage.ObjectSerializingFactory)1 DataStreamSerializationFactoryV1 (org.locationtech.geogig.storage.datastream.DataStreamSerializationFactoryV1)1 IniFileConfigDatabase (org.locationtech.geogig.storage.fs.IniFileConfigDatabase)1 HeapObjectDatabse (org.locationtech.geogig.storage.memory.HeapObjectDatabse)1 HeapStagingDatabase (org.locationtech.geogig.storage.memory.HeapStagingDatabase)1