use of cucumber.annotation.en.Given in project GeoGig by boundlessgeo.
the class DefaultStepDefinitions method I_set_up_a_hook.
@Given("^I set up a hook$")
public void I_set_up_a_hook() throws Throwable {
File hooksDir = new File(platform.pwd(), ".geogig/hooks");
File hook = new File(hooksDir, "pre_commit.js");
String script = "exception = Packages.org.locationtech.geogig.api.hooks.CannotRunGeogigOperationException;\n" + "msg = params.get(\"message\");\n" + "if (msg.length() < 5){\n" + "\tthrow new exception(\"Commit messages must have at least 5 letters\");\n" + "}\n" + "params.put(\"message\", msg.toLowerCase());";
Files.write(script, hook, Charset.forName("UTF-8"));
}
use of cucumber.annotation.en.Given in project GeoGig by boundlessgeo.
the class DefaultStepDefinitions method I_have_a_repository_with_a_remote.
@Given("^I have a repository with a remote$")
public void I_have_a_repository_with_a_remote() throws Throwable {
there_is_a_remote_repository();
List<String> output = runAndParseCommand("init", "localrepo");
assertEquals(output.toString(), 1, output.size());
assertNotNull(output.get(0));
assertTrue(output.get(0), output.get(0).startsWith("Initialized"));
platform.setWorkingDir(new File(platform.pwd(), "localrepo"));
setupGeogig();
runCommand(true, "config", "--global", "user.name", "John Doe");
runCommand(true, "config", "--global", "user.email", "JohnDoe@example.com");
File remoteRepo = GlobalState.remoteRepo;
String remotePath = remoteRepo.getAbsolutePath();
runCommand(true, "remote", "add", "origin", remotePath);
}
use of cucumber.annotation.en.Given in project GeoGig by boundlessgeo.
the class DefaultStepDefinitions method I_have_an_insert_file.
@Given("^I have an insert file$")
public void I_have_an_insert_file() throws Throwable {
File file = new File(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();
}
use of cucumber.annotation.en.Given in project GeoGig by boundlessgeo.
the class DefaultStepDefinitions method I_am_inside_a_repository_subdirectory.
@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 = platform.pwd();
for (String subdir : subdirs) {
dir = new File(dir, subdir);
}
assertTrue(dir.mkdirs());
platform.setWorkingDir(dir);
}
Aggregations