use of org.locationtech.geogig.cli.CommandFailedException in project GeoGig by boundlessgeo.
the class PGList method runInternal.
/**
* Executes the list command using the provided options.
*/
@Override
protected void runInternal(GeogigCLI cli) throws IOException {
DataStore dataStore = getDataStore();
try {
cli.getConsole().println("Fetching feature types...");
Optional<List<String>> features = cli.getGeogig().command(ListOp.class).setDataStore(dataStore).call();
if (features.isPresent()) {
for (String featureType : features.get()) {
cli.getConsole().println(" - " + featureType);
}
} else {
cli.getConsole().println("No features types were found in the specified database.");
}
} catch (GeoToolsOpException e) {
throw new CommandFailedException("Unable to get feature types from the database.", e);
} finally {
dataStore.dispose();
cli.getConsole().flush();
}
}
use of org.locationtech.geogig.cli.CommandFailedException in project GeoGig by boundlessgeo.
the class GeoJsonExportTest method testExportToFileThatAlreadyExists.
@Test
public void testExportToFileThatAlreadyExists() throws Exception {
GeoJsonExport exportCommand = new GeoJsonExport();
String geoJsonFileName = new File(geogig.getPlatform().pwd(), "TestPoints.geojson").getAbsolutePath();
exportCommand.args = Arrays.asList("WORK_HEAD:Points", geoJsonFileName);
exportCommand.run(cli);
exportCommand.args = Arrays.asList("Lines", geoJsonFileName);
try {
exportCommand.run(cli);
fail();
} catch (CommandFailedException e) {
} finally {
deleteGeoJson(geoJsonFileName);
}
}
use of org.locationtech.geogig.cli.CommandFailedException in project GeoGig by boundlessgeo.
the class ShpExportTest method testExportToFileThatAlreadyExists.
@Test
public void testExportToFileThatAlreadyExists() throws Exception {
ShpExport exportCommand = new ShpExport();
String shapeFileName = new File(geogig.getPlatform().pwd(), "TestPoints.shp").getAbsolutePath();
;
exportCommand.args = Arrays.asList("WORK_HEAD:Points", shapeFileName);
exportCommand.dataStoreFactory = TestHelper.createTestFactory();
exportCommand.run(cli);
exportCommand.args = Arrays.asList("Lines", shapeFileName);
try {
exportCommand.run(cli);
fail();
} catch (CommandFailedException e) {
} finally {
deleteShapeFile(shapeFileName);
}
}
Aggregations