Search in sources :

Example 1 with CLITestContextBuilder

use of org.locationtech.geogig.cli.test.functional.general.CLITestContextBuilder in project GeoGig by boundlessgeo.

the class DataStoreConcurrencyTest method beforeTest.

@Before
public void beforeTest() throws Exception {
    File workingDirectory = tmp.newFolder("repo");
    File userHomeDirectory = tmp.newFolder("home");
    TestPlatform platform = new TestPlatform(workingDirectory);
    platform.setUserHome(userHomeDirectory);
    Context injector = new CLITestContextBuilder(platform).build();
    GeoGIG geogig = new GeoGIG(injector);
    geogig.command(InitOp.class).call();
    geogig.command(ConfigOp.class).setAction(ConfigAction.CONFIG_SET).setName("user.name").setValue("gabriel").call();
    geogig.command(ConfigOp.class).setAction(ConfigAction.CONFIG_SET).setName("user.email").setValue("gabriel@roldan.example.com").call();
    store = new GeoGigDataStore(geogig);
    store.createSchema(pointType);
    editThreads = Executors.newFixedThreadPool(writeThreadCount, new ThreadFactoryBuilder().setNameFormat("edit-thread-%d").build());
    readThreads = Executors.newFixedThreadPool(readThreadCount, new ThreadFactoryBuilder().setNameFormat("read-thread-%d").build());
    initialCommitCount = copyOf(store.getGeogig().command(LogOp.class).call()).size();
}
Also used : Context(org.locationtech.geogig.api.Context) InitOp(org.locationtech.geogig.api.porcelain.InitOp) TestPlatform(org.locationtech.geogig.api.TestPlatform) ThreadFactoryBuilder(com.google.common.util.concurrent.ThreadFactoryBuilder) GeoGigDataStore(org.locationtech.geogig.geotools.data.GeoGigDataStore) File(java.io.File) CLITestContextBuilder(org.locationtech.geogig.cli.test.functional.general.CLITestContextBuilder) GeoGIG(org.locationtech.geogig.api.GeoGIG) Before(org.junit.Before)

Example 2 with CLITestContextBuilder

use of org.locationtech.geogig.cli.test.functional.general.CLITestContextBuilder 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());
}
Also used : GeogigCLI(org.locationtech.geogig.cli.GeogigCLI) ConsoleReader(jline.console.ConsoleReader) UnsupportedTerminal(jline.UnsupportedTerminal) TestPlatform(org.locationtech.geogig.api.TestPlatform) File(java.io.File) CLITestContextBuilder(org.locationtech.geogig.cli.test.functional.general.CLITestContextBuilder) Before(org.junit.Before)

Example 3 with CLITestContextBuilder

use of org.locationtech.geogig.cli.test.functional.general.CLITestContextBuilder 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();
}
Also used : ConsoleReader(jline.console.ConsoleReader) UnsupportedTerminal(jline.UnsupportedTerminal) OSMImportOp(org.locationtech.geogig.osm.internal.OSMImportOp) GeogigCLI(org.locationtech.geogig.cli.GeogigCLI) RevFeature(org.locationtech.geogig.api.RevFeature) TestPlatform(org.locationtech.geogig.api.TestPlatform) File(java.io.File) CLITestContextBuilder(org.locationtech.geogig.cli.test.functional.general.CLITestContextBuilder) GeoGIG(org.locationtech.geogig.api.GeoGIG) RevTree(org.locationtech.geogig.api.RevTree) Before(org.junit.Before)

Example 4 with CLITestContextBuilder

use of org.locationtech.geogig.cli.test.functional.general.CLITestContextBuilder in project GeoGig by boundlessgeo.

the class GeogigPy4JEntryPointTest method setUpDirectories.

@Before
public void setUpDirectories() throws IOException {
    tempFolder = new TemporaryFolder();
    tempFolder.create();
    File homeDirectory = tempFolder.newFolder("fakeHomeDir").getCanonicalFile();
    File currentDirectory = tempFolder.newFolder("testrepo").getCanonicalFile();
    GlobalState.platform = new TestPlatform(currentDirectory, homeDirectory);
    GlobalContextBuilder.builder = new CLITestContextBuilder(platform);
}
Also used : TemporaryFolder(org.junit.rules.TemporaryFolder) TestPlatform(org.locationtech.geogig.api.TestPlatform) File(java.io.File) CLITestContextBuilder(org.locationtech.geogig.cli.test.functional.general.CLITestContextBuilder) Before(org.junit.Before)

Example 5 with CLITestContextBuilder

use of org.locationtech.geogig.cli.test.functional.general.CLITestContextBuilder in project GeoGig by boundlessgeo.

the class OSMHistoryImportTest method setUp.

@Before
public void setUp() throws Exception {
    ConsoleReader consoleReader = new ConsoleReader(System.in, System.out, new UnsupportedTerminal());
    cli = new GeogigCLI(consoleReader);
    fakeOsmApiUrl = getClass().getResource("../../internal/history/01_10").toExternalForm();
    File workingDirectory = tempFolder.getRoot();
    TestPlatform platform = new TestPlatform(workingDirectory);
    GlobalContextBuilder.builder = new CLITestContextBuilder(platform);
    cli.setPlatform(platform);
    cli.execute("init");
    assertTrue(new File(workingDirectory, ".geogig").exists());
}
Also used : GeogigCLI(org.locationtech.geogig.cli.GeogigCLI) ConsoleReader(jline.console.ConsoleReader) UnsupportedTerminal(jline.UnsupportedTerminal) TestPlatform(org.locationtech.geogig.api.TestPlatform) File(java.io.File) CLITestContextBuilder(org.locationtech.geogig.cli.test.functional.general.CLITestContextBuilder) Before(org.junit.Before)

Aggregations

File (java.io.File)9 Before (org.junit.Before)9 TestPlatform (org.locationtech.geogig.api.TestPlatform)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 GeoGIG (org.locationtech.geogig.api.GeoGIG)2 ThreadFactoryBuilder (com.google.common.util.concurrent.ThreadFactoryBuilder)1 Connection (java.sql.Connection)1 SQLException (java.sql.SQLException)1 Statement (java.sql.Statement)1 TemporaryFolder (org.junit.rules.TemporaryFolder)1 Context (org.locationtech.geogig.api.Context)1 RevFeature (org.locationtech.geogig.api.RevFeature)1 RevTree (org.locationtech.geogig.api.RevTree)1 InitOp (org.locationtech.geogig.api.porcelain.InitOp)1 GeoGigDataStore (org.locationtech.geogig.geotools.data.GeoGigDataStore)1 OSMImportOp (org.locationtech.geogig.osm.internal.OSMImportOp)1 SQLiteConfig (org.spatialite.SQLiteConfig)1