@When("^I run the command \"([^\"]*)\" on a new GeoPackage file$") public void I_run_the_command_on_a_new_GeoPackage_file(String commandSpec) throws Throwable { GeoPackageTestSupport support = new GeoPackageTestSupport(); commandSpec += " --database "; commandSpec += support.newFile().getPath(); String[] args = commandSpec.split(" "); localRepo.runCommand(args); }
@When("^I run the command \"([^\"]*)\" on a new GeoPackage file$") public void I_run_the_command_on_a_new_GeoPackage_file(String commandSpec) throws Throwable { GeoPackageTestSupport support = new GeoPackageTestSupport(); commandSpec += " --database "; commandSpec += support.newFile().getPath(); String[] args = commandSpec.split(" "); localRepo.runCommand(args); }
@Test public void testDescribeHelp() throws Exception { GeopkgDescribe describeCommand = new GeopkgDescribe(); describeCommand.commonArgs.database = support.newFile().getAbsolutePath(); describeCommand.help = true; describeCommand.run(cli); }
@Test public void testDescribeHelp() throws Exception { GeopkgDescribe describeCommand = new GeopkgDescribe(); describeCommand.commonArgs.database = support.newFile().getAbsolutePath(); describeCommand.help = true; describeCommand.run(cli); }
@Test public void testExportWithInvalidFeatureType() throws Exception { GeopkgExport exportCommand = new GeopkgExport(); String geoPkgFileName = support.newFile().getAbsolutePath(); exportCommand.args = Arrays.asList("invalidType", "Points"); exportCommand.commonArgs.database = geoPkgFileName; exception.expect(InvalidParameterException.class); exportCommand.run(cli); }
@Test public void testExportWithNullFeatureType() throws Exception { GeopkgExport exportCommand = new GeopkgExport(); String geoPkgFileName = support.newFile().getAbsolutePath(); exportCommand.args = Arrays.asList(null, "Points"); exportCommand.commonArgs.database = geoPkgFileName; exception.expect(InvalidParameterException.class); exportCommand.run(cli); }
@Test public void testExportWithNullFeatureType() throws Exception { GeopkgExport exportCommand = new GeopkgExport(); String geoPkgFileName = support.newFile().getAbsolutePath(); exportCommand.args = Arrays.asList(null, "Points"); exportCommand.commonArgs.database = geoPkgFileName; exception.expect(InvalidParameterException.class); exportCommand.run(cli); }
@Test public void testExportWithInvalidFeatureType() throws Exception { GeopkgExport exportCommand = new GeopkgExport(); String geoPkgFileName = support.newFile().getAbsolutePath(); exportCommand.args = Arrays.asList("invalidType", "Points"); exportCommand.commonArgs.database = geoPkgFileName; exception.expect(InvalidParameterException.class); exportCommand.run(cli); }
@Test public void testFlushException() throws Exception { doThrow(new IOException("Exception")).when(consoleReader).flush(); GeopkgDescribe describeCommand = new GeopkgDescribe(); describeCommand.commonArgs.database = support.newFile().getAbsolutePath(); describeCommand.table = "table1"; describeCommand.support.dataStoreFactory = TestHelper.createTestFactory(); exception.expect(Exception.class); describeCommand.run(cli); }
@Test public void testFlushException() throws Exception { doThrow(new IOException("Exception")).when(consoleReader).flush(); GeopkgDescribe describeCommand = new GeopkgDescribe(); describeCommand.commonArgs.database = support.newFile().getAbsolutePath(); describeCommand.table = "table1"; describeCommand.support.dataStoreFactory = TestHelper.createTestFactory(); exception.expect(Exception.class); describeCommand.run(cli); }
public File createEmptyDatabase() throws Exception { File file = newFile(); GeoPackage geoPackage = new GeoPackage(file); try { geoPackage.init(); } finally { geoPackage.close(); } return file; }
public File createEmptyDatabase() throws Exception { File file = newFile(); GeoPackage geoPackage = new GeoPackage(file); try { geoPackage.init(); } finally { geoPackage.close(); } return file; }
@Test public void testDescribeException() throws Exception { when(cli.getConsole()).thenThrow(new MockitoException("Exception")); GeopkgDescribe describeCommand = new GeopkgDescribe(); describeCommand.commonArgs.database = support.newFile().getAbsolutePath(); describeCommand.table = "table1"; describeCommand.support.dataStoreFactory = TestHelper.createTestFactory(); exception.expect(MockitoException.class); describeCommand.run(cli); }
@Test public void testListException() throws Exception { when(cli.getConsole()).thenThrow(new MockitoException("Exception")); GeopkgList listCommand = new GeopkgList(); listCommand.commonArgs.database = support.newFile().getAbsolutePath(); listCommand.support.dataStoreFactory = TestHelper.createTestFactory(); exception.expect(MockitoException.class); listCommand.run(cli); } }
@Test public void testNoTable() throws Exception { GeopkgDescribe describeCommand = new GeopkgDescribe(); describeCommand.commonArgs.database = support.newFile().getAbsolutePath(); describeCommand.table = ""; describeCommand.support.dataStoreFactory = TestHelper.createTestFactory(); exception.expect(CommandFailedException.class); describeCommand.run(cli); }
@Test public void testNullDataStore() throws Exception { GeopkgList listCommand = new GeopkgList(); listCommand.commonArgs.database = support.newFile().getAbsolutePath(); listCommand.support.dataStoreFactory = TestHelper.createNullTestFactory(); exception.expect(CommandFailedException.class); listCommand.run(cli); }
@Test public void testEmptyDataStore() throws Exception { GeopkgList listCommand = new GeopkgList(); listCommand.commonArgs.database = support.newFile().getAbsolutePath(); listCommand.support.dataStoreFactory = TestHelper.createEmptyTestFactory(); exception.expect(CommandFailedException.class); listCommand.run(cli); }
@Test public void testGetNamesException() throws Exception { GeopkgList listCommand = new GeopkgList(); listCommand.commonArgs.database = support.newFile().getAbsolutePath(); listCommand.support.dataStoreFactory = TestHelper.createFactoryWithGetNamesException(); exception.expect(CommandFailedException.class); listCommand.run(cli); }
@Test public void testGetNamesException() throws Exception { GeopkgList listCommand = new GeopkgList(); listCommand.commonArgs.database = support.newFile().getAbsolutePath(); listCommand.support.dataStoreFactory = TestHelper.createFactoryWithGetNamesException(); exception.expect(CommandFailedException.class); listCommand.run(cli); }
@Test public void testNullDataStore() throws Exception { GeopkgDescribe describeCommand = new GeopkgDescribe(); describeCommand.commonArgs.database = support.newFile().getAbsolutePath(); describeCommand.table = "table1"; describeCommand.support.dataStoreFactory = TestHelper.createNullTestFactory(); exception.expect(CommandFailedException.class); describeCommand.run(cli); }