use of org.locationtech.geogig.api.TestPlatform 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);
}
use of org.locationtech.geogig.api.TestPlatform in project GeoGig by boundlessgeo.
the class GlobalState method setUpDirectories.
public static void setUpDirectories() throws IOException {
File homeDirectory = tempFolder.newFolder("fakeHomeDir").getCanonicalFile();
File currentDirectory = tempFolder.newFolder("testrepo").getCanonicalFile();
if (GlobalState.platform == null) {
GlobalState.platform = new TestPlatform(currentDirectory, homeDirectory);
} else {
GlobalState.platform.setWorkingDir(currentDirectory);
GlobalState.platform.setUserHome(homeDirectory);
}
}
use of org.locationtech.geogig.api.TestPlatform 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);
}
use of org.locationtech.geogig.api.TestPlatform in project GeoGig by boundlessgeo.
the class OSMMapTest method setUp.
@Before
public void setUp() throws Exception {
ConsoleReader consoleReader = new ConsoleReader(System.in, System.out, new UnsupportedTerminal());
cli = new GeogigCLI(consoleReader);
File workingDirectory = tempFolder.getRoot();
TestPlatform platform = new TestPlatform(workingDirectory);
GlobalContextBuilder.builder = new CLITestContextBuilder(platform);
cli.setPlatform(platform);
cli.execute("init");
cli.execute("config", "user.name", "Gabriel Roldan");
cli.execute("config", "user.email", "groldan@boundlessgeo.com");
assertTrue(new File(workingDirectory, ".geogig").exists());
}
use of org.locationtech.geogig.api.TestPlatform in project GeoGig by boundlessgeo.
the class OSMUnmapTest method setUp.
@Before
public void setUp() throws Exception {
ConsoleReader consoleReader = new ConsoleReader(System.in, System.out, new UnsupportedTerminal());
cli = new GeogigCLI(consoleReader);
File workingDirectory = tempFolder.getRoot();
TestPlatform platform = new TestPlatform(workingDirectory);
GlobalContextBuilder.builder = new CLITestContextBuilder(platform);
cli.setPlatform(platform);
cli.execute("init");
cli.execute("config", "user.name", "Gabriel Roldan");
cli.execute("config", "user.email", "groldan@boundlessgeo.com");
assertTrue(new File(workingDirectory, ".geogig").exists());
// import with mapping
String filename = OSMImportOp.class.getResource("nodes.xml").getFile();
File file = new File(filename);
String mappingFilename = OSMMap.class.getResource("nodes_mapping_with_aliases.json").getFile();
File mappingFile = new File(mappingFilename);
cli.execute("osm", "import", file.getAbsolutePath(), "--mapping", mappingFile.getAbsolutePath());
GeoGIG geogig = cli.newGeoGIG();
Optional<RevFeature> revFeature = geogig.command(RevObjectParse.class).setRefSpec("WORK_HEAD:busstops/507464799").call(RevFeature.class);
assertTrue(revFeature.isPresent());
geogig.getRepository().workingTree().delete("node");
Optional<RevTree> tree = geogig.command(RevObjectParse.class).setRefSpec("WORK_HEAD:node").call(RevTree.class);
assertFalse(tree.isPresent());
geogig.close();
}
Aggregations