@When("^I run the command \"([^\"]*)\" on an existing GeoPackage file$") public void I_run_the_command_on_an_existing_GeoPackage_file(String commandSpec) throws Throwable { GeoPackageTestSupport support = new GeoPackageTestSupport(); commandSpec += " --database "; commandSpec += support.createDefaultTestData().getPath(); String[] args = commandSpec.split(" "); localRepo.runCommand(args); }
@When("^I run the command \"([^\"]*)\" on an existing GeoPackage file$") public void I_run_the_command_on_an_existing_GeoPackage_file(String commandSpec) throws Throwable { GeoPackageTestSupport support = new GeoPackageTestSupport(); commandSpec += " --database "; commandSpec += support.createDefaultTestData().getPath(); String[] args = commandSpec.split(" "); localRepo.runCommand(args); }
@Test public void testDescribe() throws Exception { GeopkgDescribe describeCommand = new GeopkgDescribe(); describeCommand.commonArgs.database = support.createDefaultTestData().getAbsolutePath(); describeCommand.table = "table1"; describeCommand.support.dataStoreFactory = TestHelper.createTestFactory(); describeCommand.run(cli); }
@Test public void testList() throws Exception { GeopkgList listCommand = new GeopkgList(); listCommand.commonArgs.database = support.createDefaultTestData().getAbsolutePath(); listCommand.support.dataStoreFactory = TestHelper.createTestFactory(); listCommand.run(cli); }
@Test public void testDescribe() throws Exception { GeopkgDescribe describeCommand = new GeopkgDescribe(); describeCommand.commonArgs.database = support.createDefaultTestData().getAbsolutePath(); describeCommand.table = "table1"; describeCommand.support.dataStoreFactory = TestHelper.createTestFactory(); describeCommand.run(cli); }
@Test public void testList() throws Exception { GeopkgList listCommand = new GeopkgList(); listCommand.commonArgs.database = support.createDefaultTestData().getAbsolutePath(); listCommand.support.dataStoreFactory = TestHelper.createTestFactory(); listCommand.run(cli); }
@Test public void testDescribeNonexistentTable() throws Exception { GeopkgDescribe describeCommand = new GeopkgDescribe(); describeCommand.commonArgs.database = support.createDefaultTestData().getAbsolutePath(); describeCommand.table = "nonexistent"; describeCommand.support.dataStoreFactory = TestHelper.createTestFactory(); exception.expect(CommandFailedException.class); describeCommand.run(cli); }
@Test public void testDescribeNonexistentTable() throws Exception { GeopkgDescribe describeCommand = new GeopkgDescribe(); describeCommand.commonArgs.database = support.createDefaultTestData().getAbsolutePath(); describeCommand.table = "nonexistent"; describeCommand.support.dataStoreFactory = TestHelper.createTestFactory(); exception.expect(CommandFailedException.class); describeCommand.run(cli); }
@Test public void testImportTable() throws Exception { GeopkgImport importCommand = new GeopkgImport(); importCommand.commonArgs.database = support.createDefaultTestData().getAbsolutePath(); importCommand.table = "Points"; importCommand.run(cli); Iterator<NodeRef> nodeIterator = cli.getGeogig().command(LsTreeOp.class) .setStrategy(Strategy.DEPTHFIRST).call(); assertTrue("Expected repo to have some nodes, but was empty", nodeIterator.hasNext()); List<String> nodeList = Lists.transform(Lists.newArrayList(nodeIterator), (nr) -> nr.name()); assertTrue(nodeList.contains("Points")); assertTrue(nodeList.contains("1")); assertTrue(nodeList.contains("2")); assertTrue(nodeList.contains("3")); assertFalse(nodeList.contains("Lines")); }
@Test public void testImportAll() throws Exception { GeopkgImport importCommand = new GeopkgImport(); importCommand.commonArgs.database = support.createDefaultTestData().getAbsolutePath(); importCommand.all = true; importCommand.run(cli); Iterator<NodeRef> nodeIterator = cli.getGeogig().command(LsTreeOp.class) .setStrategy(Strategy.DEPTHFIRST).call(); assertTrue("Expected repo to have some nodes, but was empty", nodeIterator.hasNext()); List<String> nodeList = Lists.transform(Lists.newArrayList(nodeIterator), (nr) -> nr.name()); // Since there are Lines/1 and Points/1 etc, 1, 2, and 3 should be in the list twice. Remove // one after checking the first time. assertTrue(nodeList.contains("Points")); assertTrue(nodeList.contains("1")); nodeList.remove("1"); assertTrue(nodeList.contains("2")); nodeList.remove("2"); assertTrue(nodeList.contains("3")); nodeList.remove("3"); assertTrue(nodeList.contains("Lines")); assertTrue(nodeList.contains("1")); assertTrue(nodeList.contains("2")); assertTrue(nodeList.contains("3")); }
@Test public void testImportTable() throws Exception { GeopkgImport importCommand = new GeopkgImport(); importCommand.commonArgs.database = support.createDefaultTestData().getAbsolutePath(); importCommand.table = "Points"; importCommand.run(cli); Iterator<NodeRef> nodeIterator = cli.getGeogig().command(LsTreeOp.class) .setStrategy(Strategy.DEPTHFIRST).call(); assertTrue("Expected repo to have some nodes, but was empty", nodeIterator.hasNext()); List<String> nodeList = Lists.transform(Lists.newArrayList(nodeIterator), (nr) -> nr.name()); assertTrue(nodeList.contains("Points")); assertTrue(nodeList.contains("1")); assertTrue(nodeList.contains("2")); assertTrue(nodeList.contains("3")); assertFalse(nodeList.contains("Lines")); }
@Test public void testImportAll() throws Exception { GeopkgImport importCommand = new GeopkgImport(); importCommand.commonArgs.database = support.createDefaultTestData().getAbsolutePath(); importCommand.all = true; importCommand.run(cli); Iterator<NodeRef> nodeIterator = cli.getGeogig().command(LsTreeOp.class) .setStrategy(Strategy.DEPTHFIRST).call(); assertTrue("Expected repo to have some nodes, but was empty", nodeIterator.hasNext()); List<String> nodeList = Lists.transform(Lists.newArrayList(nodeIterator), (nr) -> nr.name()); // Since there are Lines/1 and Points/1 etc, 1, 2, and 3 should be in the list twice. Remove // one after checking the first time. assertTrue(nodeList.contains("Points")); assertTrue(nodeList.contains("1")); nodeList.remove("1"); assertTrue(nodeList.contains("2")); nodeList.remove("2"); assertTrue(nodeList.contains("3")); nodeList.remove("3"); assertTrue(nodeList.contains("Lines")); assertTrue(nodeList.contains("1")); assertTrue(nodeList.contains("2")); assertTrue(nodeList.contains("3")); }