@Given("^I have an insert file$") public void I_have_an_insert_file() throws Throwable { File file = new File(localRepo.platform.pwd(), "insert"); BufferedWriter writer = Files.newWriter(file, Charsets.UTF_8); writer.write("Points/Points.1\n"); writer.write("sp\tNew_String\n"); writer.write("ip\t1001\n"); writer.write("pp\tPOINT(2 2)\n"); writer.flush(); writer.close(); }
@Given("^I have an insert file$") public void I_have_an_insert_file() throws Throwable { File file = new File(localRepo.platform.pwd(), "insert"); BufferedWriter writer = Files.newWriter(file, Charsets.UTF_8); writer.write("Points/Points.1\n"); writer.write("sp\tNew_String\n"); writer.write("ip\t1001\n"); writer.write("pp\tPOINT(2 2)\n"); writer.flush(); writer.close(); }
@Given("^I have an insert file$") public void I_have_an_insert_file() throws Throwable { File file = new File(localRepo.platform.pwd(), "insert"); BufferedWriter writer = Files.newWriter(file, Charsets.UTF_8); writer.write("Points/Points.1\n"); writer.write("sp\tNew_String\n"); writer.write("ip\t1001\n"); writer.write("pp\tPOINT(2 2)\n"); writer.flush(); writer.close(); }
@Given("^I am in an empty directory$") public void I_am_in_an_empty_directory() throws Throwable { File wd = localRepo.platform.pwd(); assertEquals(String.format("directory %s is not empty: %s", wd, Arrays.toString(wd.list())), 0, wd.list().length); }
@Given("^I am in an empty directory$") public void I_am_in_an_empty_directory() throws Throwable { File wd = localRepo.platform.pwd(); assertEquals(String.format("directory %s is not empty: %s", wd, Arrays.toString(wd.list())), 0, wd.list().length); }
@Given("^I am in an empty directory$") public void I_am_in_an_empty_directory() throws Throwable { File wd = localRepo.platform.pwd(); assertEquals(String.format("directory %s is not empty: %s", wd, Arrays.toString(wd.list())), 0, wd.list().length); }
@Given("^I am inside a repository subdirectory \"([^\"]*)\"$") public void I_am_inside_a_repository_subdirectory(String subdirSpec) throws Throwable { String[] subdirs = subdirSpec.split("/"); File dir = localRepo.platform.pwd(); for (String subdir : subdirs) { dir = new File(dir, subdir); } assertTrue(dir.mkdirs()); localRepo.platform.setWorkingDir(dir); }
@Given("^I am inside a repository subdirectory \"([^\"]*)\"$") public void I_am_inside_a_repository_subdirectory(String subdirSpec) throws Throwable { String[] subdirs = subdirSpec.split("/"); File dir = localRepo.platform.pwd(); for (String subdir : subdirs) { dir = new File(dir, subdir); } assertTrue(dir.mkdirs()); localRepo.platform.setWorkingDir(dir); }
@Given("^I am inside a repository subdirectory \"([^\"]*)\"$") public void I_am_inside_a_repository_subdirectory(String subdirSpec) throws Throwable { String[] subdirs = subdirSpec.split("/"); File dir = localRepo.platform.pwd(); for (String subdir : subdirs) { dir = new File(dir, subdir); } assertTrue(dir.mkdirs()); localRepo.platform.setWorkingDir(dir); }
@Then("^if I change to the respository subdirectory \"([^\"]*)\"$") public void if_I_change_to_the_respository_subdirectory(String subdirSpec) throws Throwable { String[] subdirs = subdirSpec.split("/"); File dir = localRepo.platform.pwd(); for (String subdir : subdirs) { dir = new File(dir, subdir); } assertTrue(dir.exists()); localRepo.platform.setWorkingDir(dir); localRepo.geogigCLI.close(); localRepo.geogigCLI.setRepositoryURI(dir.toURI().toString()); }
@Then("^if I change to the respository subdirectory \"([^\"]*)\"$") public void if_I_change_to_the_respository_subdirectory(String subdirSpec) throws Throwable { String[] subdirs = subdirSpec.split("/"); File dir = localRepo.platform.pwd(); for (String subdir : subdirs) { dir = new File(dir, subdir); } assertTrue(dir.exists()); localRepo.platform.setWorkingDir(dir); localRepo.geogigCLI.close(); localRepo.geogigCLI.setRepositoryURI(dir.toURI().toString()); }
@Override public TestPlatform clone() { return new TestPlatform(pwd(), getUserHome()); }
@Then("^if I change to the respository subdirectory \"([^\"]*)\"$") public void if_I_change_to_the_respository_subdirectory(String subdirSpec) throws Throwable { String[] subdirs = subdirSpec.split("/"); File dir = localRepo.platform.pwd(); for (String subdir : subdirs) { dir = new File(dir, subdir); } assertTrue(dir.exists()); localRepo.platform.setWorkingDir(dir); localRepo.geogigCLI.close(); localRepo.geogigCLI.setRepositoryURI(dir.toURI().toString()); }
@Override public TestPlatform clone() { return new TestPlatform(pwd(), getUserHome()); }
private String replaceKnownVariables(String s) throws IOException { if (s.contains("${currentdir}")) { File pwd = localRepo.platform.pwd(); s = s.replace("${currentdir}", pwd.getCanonicalPath().replace("\\", "/")); s = s.replace("\"", ""); } if (s.contains("${repoURI}")) { URI uri = localRepo.repositoryURI; s = s.replace("${repoURI}", uri.toString()); } if (s.contains("${localrepo}")) { URI uri = localRepo.repositoryURI; s = s.replace("${localrepo}", uri.toString()); } if (s.contains("${remoterepo}")) { CLIContext remote = contextProvider.getRepositoryContext("remoterepo"); URI remoteURI = remote.repositoryURI; s = s.replace("${remoterepo}", remoteURI.toString()); } if (s.contains("${remote repo}")) { CLIContext remote = contextProvider.getRepositoryContext("remote repo"); URI remoteURI = remote.repositoryURI; s = s.replace("${remote repo}", remoteURI.toString()); } if (s.contains("${rootRepoURI}")) { URI rootRepoURI = contextProvider.getURIBuilder().buildRootURI(localRepo.platform); s = s.replace("${rootRepoURI}", rootRepoURI.toString()); } return s; }
@Override protected GraphDatabase createDatabase(TestPlatform platform) { File root = platform.pwd(); Preconditions.checkState(new File(root, ".geogig").exists()); envProvider = new EnvironmentBuilder(platform, null); ConfigDatabase configDB = new IniFileConfigDatabase(platform); return new JEGraphDatabase_v0_1(configDB, envProvider, new Hints()); }
@Override protected GraphDatabase createDatabase(TestPlatform platform) { File root = platform.pwd(); Preconditions.checkState(new File(root, ".geogig").exists()); envProvider = new EnvironmentBuilder(platform, null); ConfigDatabase configDB = new IniFileConfigDatabase(platform); return new JEGraphDatabase_v0_1(configDB, envProvider, new Hints()); }
@Given("^I have a patch file$") public void I_have_a_patch_file() throws Throwable { Patch patch = new Patch(); String path = NodeRef.appendChild(pointsName, points1.getIdentifier().getID()); Map<PropertyDescriptor, AttributeDiff> map = Maps.newHashMap(); Object oldValue = points1.getProperty("sp").getValue(); GenericAttributeDiffImpl diff = new GenericAttributeDiffImpl(oldValue, "new"); map.put(pointsType.getDescriptor("sp"), diff); FeatureDiff feaureDiff = new FeatureDiff(path, map, RevFeatureTypeBuilder.build(pointsType), RevFeatureTypeBuilder.build(pointsType)); patch.addModifiedFeature(feaureDiff); File file = new File(localRepo.platform.pwd(), "test.patch"); BufferedWriter writer = Files.newWriter(file, Charsets.UTF_8); PatchSerializer.write(writer, patch); writer.flush(); writer.close(); }
@Given("^I have a patch file$") public void I_have_a_patch_file() throws Throwable { Patch patch = new Patch(); String path = NodeRef.appendChild(pointsName, points1.getIdentifier().getID()); Map<PropertyDescriptor, AttributeDiff> map = Maps.newHashMap(); Object oldValue = points1.getProperty("sp").getValue(); GenericAttributeDiffImpl diff = new GenericAttributeDiffImpl(oldValue, "new"); map.put(pointsType.getDescriptor("sp"), diff); FeatureDiff feaureDiff = new FeatureDiff(path, map, RevFeatureTypeBuilder.build(pointsType), RevFeatureTypeBuilder.build(pointsType)); patch.addModifiedFeature(feaureDiff); File file = new File(localRepo.platform.pwd(), "test.patch"); BufferedWriter writer = Files.newWriter(file, Charsets.UTF_8); PatchSerializer.write(writer, patch); writer.flush(); writer.close(); }
@Given("^I have a patch file$") public void I_have_a_patch_file() throws Throwable { Patch patch = new Patch(); String path = NodeRef.appendChild(pointsName, points1.getIdentifier().getID()); Map<PropertyDescriptor, AttributeDiff> map = Maps.newHashMap(); Object oldValue = points1.getProperty("sp").getValue(); GenericAttributeDiffImpl diff = new GenericAttributeDiffImpl(oldValue, "new"); map.put(pointsType.getDescriptor("sp"), diff); FeatureDiff feaureDiff = new FeatureDiff(path, map, RevFeatureType.builder().type(pointsType).build(), RevFeatureType.builder().type(pointsType).build()); patch.addModifiedFeature(feaureDiff); File file = new File(localRepo.platform.pwd(), "test.patch"); BufferedWriter writer = Files.newWriter(file, Charsets.UTF_8); PatchSerializer.write(writer, patch); writer.flush(); writer.close(); }