Search in sources :

Example 1 with GeogigModule

use of org.locationtech.geogig.di.GeogigModule in project GeoGig by boundlessgeo.

the class JECommitOpTest method createInjector.

@Override
protected Context createInjector() {
    File workingDirectory;
    try {
        workingDirectory = mockWorkingDirTempFolder.getRoot();
    } catch (Exception e) {
        throw Throwables.propagate(e);
    }
    Platform testPlatform = new TestPlatform(workingDirectory);
    return Guice.createInjector(Modules.override(new GeogigModule()).with(new JETestStorageModule(), new TestModule(testPlatform))).getInstance(Context.class);
}
Also used : TestPlatform(org.locationtech.geogig.api.TestPlatform) Platform(org.locationtech.geogig.api.Platform) TestPlatform(org.locationtech.geogig.api.TestPlatform) File(java.io.File) GeogigModule(org.locationtech.geogig.di.GeogigModule)

Example 2 with GeogigModule

use of org.locationtech.geogig.di.GeogigModule in project GeoGig by boundlessgeo.

the class ParseTimestampTest method setUp.

@Before
public void setUp() {
    File workingDirectory = tempFolder.newFolder("mockWorkingDir");
    Platform testPlatform = new TestPlatform(workingDirectory) {

        @Override
        public long currentTimeMillis() {
            return REFERENCE_DATE.getTime();
        }
    };
    Context injector = Guice.createInjector(Modules.override(new GeogigModule()).with(new MemoryModule(testPlatform))).getInstance(Context.class);
    fakeGeogig = new GeoGIG(injector, workingDirectory);
    assertNotNull(fakeGeogig.getOrCreateRepository());
    command = fakeGeogig.command(ParseTimestamp.class);
}
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) 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)

Example 3 with GeogigModule

use of org.locationtech.geogig.di.GeogigModule 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 4 with GeogigModule

use of org.locationtech.geogig.di.GeogigModule 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)

Example 5 with GeogigModule

use of org.locationtech.geogig.di.GeogigModule in project GeoGig by boundlessgeo.

the class WriteBackTest method setUp.

@Before
public void setUp() {
    Context injector = Guice.createInjector(Modules.override(new GeogigModule()).with(new MemoryModule(null))).getInstance(Context.class);
    odb = injector.objectDatabase();
    indexDb = injector.stagingDatabase();
    odb.open();
    indexDb.open();
    writeBack = injector.command(WriteBack.class);
}
Also used : Context(org.locationtech.geogig.api.Context) GeogigModule(org.locationtech.geogig.di.GeogigModule) MemoryModule(org.locationtech.geogig.api.MemoryModule) Before(org.junit.Before)

Aggregations

GeogigModule (org.locationtech.geogig.di.GeogigModule)8 File (java.io.File)6 Platform (org.locationtech.geogig.api.Platform)6 TestPlatform (org.locationtech.geogig.api.TestPlatform)6 Context (org.locationtech.geogig.api.Context)5 Before (org.junit.Before)4 MemoryModule (org.locationtech.geogig.api.MemoryModule)4 GeoGIG (org.locationtech.geogig.api.GeoGIG)3 RevTree (org.locationtech.geogig.api.RevTree)1 RevTreeBuilder (org.locationtech.geogig.api.RevTreeBuilder)1 CLIContextBuilder (org.locationtech.geogig.cli.CLIContextBuilder)1 PluginsModule (org.locationtech.geogig.di.PluginsModule)1 CachingModule (org.locationtech.geogig.di.caching.CachingModule)1 SimpleFeatureType (org.opengis.feature.simple.SimpleFeatureType)1