@Given("^there is a remote repository with blank spaces$") public void there_is_a_remote_repository_with_blank_spaces() throws Throwable { createRemote("remote repo"); }
public String getVariable(String name) { return getVariable(name, this.variables); }
@Then("^the response should contain \"([^\"]*)\"$") public void the_response_should_contain(String expected) throws Throwable { expected = replaceKnownVariables(expected); String actual = localRepo.stdOut.toString().replaceAll(LINE_SEPARATOR, "") .replaceAll("\\\\", "/"); System.err.println(actual); assertTrue("'" + actual + "' does not contain '" + expected + "'", actual.contains(expected)); }
@Then("^the repository's \"([^\"]*)\" index on the \"([^\"]*)\" attribute should have the following features:$") public void verifyIndexContents(String headRef, String attributeName, DataTable expectedFeatures) throws Throwable { Optional<ObjectId> indexTreeId = resolveIndexTreeId(headRef, attributeName); assertTrue(indexTreeId.isPresent()); verifyRepositoryContents(indexTreeId.get().toString(), expectedFeatures, true); }
@Then("^the repository at \"([^\"]*)\" shall exist$") public void the_repository_at_shall_exist(String repoUri) throws Throwable { repoUri = replaceKnownVariables(repoUri); URI uri = resolveURI(repoUri); boolean exists = RepositoryResolver.lookup(uri).repoExists(uri); assertTrue("Repository does not exist: " + uri, exists); }
String replaceVariables(final String text, Map<String, String> variables) { return replaceVariables(text, variables, null); } }
@Given("^I have a repository with a remote$") public void I_have_a_repository_with_a_remote() throws Throwable { I_have_an_unconfigured_repository(); CLIContext remoteRepo = createRemote("remoterepo"); final URI remoteURI = remoteRepo.repositoryURI; localRepo.runCommand(true, "config", "--global", "user.name", "John Doe"); localRepo.runCommand(true, "config", "--global", "user.email", "JohnDoe@example.com"); String uriArg = remoteURI.toString(); localRepo.runCommand(true, "remote", "add", "origin", uriArg); }
@Then("^the repository's \"([^\"]*)\" should not have an index$") public void noIndexAtCommit(String headRef) throws Throwable { Optional<ObjectId> indexTreeId = resolveIndexTreeId(headRef, null); assertFalse(indexTreeId.isPresent()); }
@Given("^I clone a remote repository$") public void i_clone_a_remote_repository() throws Throwable { there_is_a_remote_repository(); CLIContext remoteRepo = contextProvider.getRepositoryContext("remoterepo"); URI remote = remoteRepo.repositoryURI; URI local = localRepo.repositoryURI; localRepo.runCommand(true, "clone", remote.toString(), local.toString()); localRepo.runCommand(true, "config", "--global", "user.name", "John Doe"); localRepo.runCommand(true, "config", "--global", "user.email", "JohnDoe@example.com"); }
@Given("^I have a repository$") public void I_have_a_repository() throws Throwable { I_have_an_unconfigured_repository(); localRepo.runCommand(true, "config", "--global", "user.name", "John Doe"); localRepo.runCommand(true, "config", "--global", "user.email", "JohnDoe@example.com"); }
@Given("^I have a merge conflict state$") public void I_have_a_merge_conflict_state() throws Throwable { I_have_conflicting_branches(); Ref branch = localRepo.geogigCLI.getGeogig(Hints.readOnly()).command(RefParse.class) .setName("branch1").call().get(); try { localRepo.geogigCLI.getGeogig(Hints.readWrite()).command(MergeOp.class) .addCommit(branch.getObjectId()).call(); fail(); } catch (MergeConflictsException e) { } }
@Then("^the repository shall exist$") public void the_repository_shall_exist() throws Throwable { List<String> output = localRepo.runAndParseCommand(true, "rev-parse", "--resolve-geogig-uri"); assertEquals(output.toString(), 1, output.size()); String location = output.get(0); assertNotNull(location); URI repoURI = resolveURI(location); boolean repoExists = RepositoryResolver.lookup(repoURI).repoExists(repoURI); assertTrue("Repository not found: " + repoURI, repoExists); }
@cucumber.api.java.Before(order = 1000) // order = 1000 to make sure it runs the latest if the // @Before annotated methods public void before(Scenario scenario) throws Throwable { contextProvider = CLIContextProvider.get(); if (contextProvider.getURIBuilder() == null) { contextProvider.setURIBuilder(TestRepoURIBuilder.createDefault()); } LOG.info("'{}': Using URIBuilder {}", scenario.getName(), contextProvider.getURIBuilder().getClass().getSimpleName()); contextProvider.before(); this.localRepo = contextProvider.getOrCreateRepositoryContext("localrepo"); RevFeatureType rft = RevFeatureTypeBuilder.build(TestFeatures.pointsType); setVariable("@PointsTypeID", rft.getId().toString()); rft = RevFeatureTypeBuilder.build(TestFeatures.linesType); setVariable("@LinesTypeID", rft.getId().toString()); }
@Then("^the repository at \"([^\"]*)\" shall not exist$") public void the_repository_at_shall_not_exist(String repoUri) throws Throwable { repoUri = replaceKnownVariables(repoUri); URI uri = resolveURI(repoUri); boolean exists = RepositoryResolver.lookup(uri).repoExists(uri); assertFalse("Repository exists: " + uri, exists); }
public String replaceVariables(final String text) { return replaceVariables(text, this.variables, this); }
@Then("^the repository's \"([^\"]*)\" index on the \"([^\"]*)\" attribute should have the following features:$") public void verifyIndexContents(String headRef, String attributeName, DataTable expectedFeatures) throws Throwable { Optional<ObjectId> indexTreeId = resolveIndexTreeId(headRef, attributeName); assertTrue(indexTreeId.isPresent()); verifyRepositoryContents(indexTreeId.get().toString(), expectedFeatures, true); }
@Given("^I have a repository with a remote$") public void I_have_a_repository_with_a_remote() throws Throwable { I_have_an_unconfigured_repository(); CLIContext remoteRepo = createRemote("remoterepo"); final URI remoteURI = remoteRepo.repositoryURI; localRepo.runCommand(true, "config", "--global", "user.name", "John Doe"); localRepo.runCommand(true, "config", "--global", "user.email", "JohnDoe@example.com"); String uriArg = remoteURI.toString(); localRepo.runCommand(true, "remote", "add", "origin", uriArg); }
@Then("^the repository's \"([^\"]*)\" should not have an index$") public void noIndexAtCommit(String headRef) throws Throwable { Optional<ObjectId> indexTreeId = resolveIndexTreeId(headRef, null); assertFalse(indexTreeId.isPresent()); }
@Given("^I clone a remote repository$") public void i_clone_a_remote_repository() throws Throwable { there_is_a_remote_repository(); CLIContext remoteRepo = contextProvider.getRepositoryContext("remoterepo"); URI remote = remoteRepo.repositoryURI; URI local = localRepo.repositoryURI; localRepo.runCommand(true, "clone", remote.toString(), local.toString()); localRepo.runCommand(true, "config", "--global", "user.name", "John Doe"); localRepo.runCommand(true, "config", "--global", "user.email", "JohnDoe@example.com"); }
@Given("^I have a repository$") public void I_have_a_repository() throws Throwable { I_have_an_unconfigured_repository(); localRepo.runCommand(true, "config", "--global", "user.name", "John Doe"); localRepo.runCommand(true, "config", "--global", "user.email", "JohnDoe@example.com"); }