Search in sources :

Example 6 with Given

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"));
}
Also used : File(java.io.File) Given(cucumber.annotation.en.Given)

Example 7 with Given

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);
}
Also used : File(java.io.File) Given(cucumber.annotation.en.Given)

Example 8 with Given

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();
}
Also used : File(java.io.File) BufferedWriter(java.io.BufferedWriter) Given(cucumber.annotation.en.Given)

Example 9 with Given

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);
}
Also used : File(java.io.File) Given(cucumber.annotation.en.Given)

Aggregations

Given (cucumber.annotation.en.Given)9 File (java.io.File)6 BufferedWriter (java.io.BufferedWriter)2 GeoGIG (org.locationtech.geogig.api.GeoGIG)1 NodeRef (org.locationtech.geogig.api.NodeRef)1 Ref (org.locationtech.geogig.api.Ref)1 RefParse (org.locationtech.geogig.api.plumbing.RefParse)1 UpdateRef (org.locationtech.geogig.api.plumbing.UpdateRef)1 AttributeDiff (org.locationtech.geogig.api.plumbing.diff.AttributeDiff)1 FeatureDiff (org.locationtech.geogig.api.plumbing.diff.FeatureDiff)1 GenericAttributeDiffImpl (org.locationtech.geogig.api.plumbing.diff.GenericAttributeDiffImpl)1 Patch (org.locationtech.geogig.api.plumbing.diff.Patch)1 MergeConflictsException (org.locationtech.geogig.api.porcelain.MergeConflictsException)1 WorkingTree (org.locationtech.geogig.repository.WorkingTree)1 Feature (org.opengis.feature.Feature)1 PropertyDescriptor (org.opengis.feature.type.PropertyDescriptor)1