@cucumber.api.java.Before public void before() throws Throwable { contextProvider = CLIContextProvider.get(); contextProvider.before(); this.localRepo = contextProvider.getOrCreateRepositoryContext("localrepo"); }
@cucumber.api.java.After public void after() { contextProvider.after(); }
@cucumber.api.java.Before(order = 1) public void before() throws Throwable { contextProvider = CLIContextProvider.get(); contextProvider.setURIBuilder(new PGTestRepoURIBuilder()); // don't call before, let DfaultStepDefinitions do it // contextProvider.before(); }
@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()); }
@Given("^the remote repository has changes") public void the_remote_repository_has_changes() throws Throwable { CLIContext remoteRepo = contextProvider.getOrCreateRepositoryContext("remoterepo"); remoteRepo.insertAndAdd(lines3); remoteRepo.runCommand(true, "commit -m Commit10"); }
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; }
@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"); }
@Override protected CLIContextProvider initialValue() { return new CLIContextProvider(); } };
@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()); }
@Given("^the remote repository has changes") public void the_remote_repository_has_changes() throws Throwable { CLIContext remoteRepo = contextProvider.getOrCreateRepositoryContext("remoterepo"); remoteRepo.insertAndAdd(lines3); remoteRepo.runCommand(true, "commit -m Commit10"); }
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; }
@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"); }
@Override protected CLIContextProvider initialValue() { return new CLIContextProvider(); } };
@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 = RevFeatureType.builder().type(TestFeatures.pointsType).build(); setVariable("@PointsTypeID", rft.getId().toString()); rft = RevFeatureType.builder().type(TestFeatures.linesType).build(); setVariable("@LinesTypeID", rft.getId().toString()); }
@cucumber.api.java.Before public void before() throws Throwable { contextProvider = CLIContextProvider.get(); contextProvider.before(); this.localRepo = contextProvider.getOrCreateRepositoryContext("localrepo"); }
/** * Initialized method for cucumber tests/scenarios annotated with {@code @FileSystemReposOnly}; * runs after {@link #before()} and replaces the {@link TestRepoURIBuilder} potentially * overwritten by another steps definition class by the default one that sets up {@code file://} * URI's. */ @cucumber.api.java.Before(value = "@FileSystemReposOnly", order = 2) public void beforeFileOnlyTest() throws Throwable { // force using file based repos only CLIContextProvider provider = CLIContextProvider.get(); provider.setURIBuilder(TestRepoURIBuilder.createDefault()); }
@Given("^the remote repository has changes") public void the_remote_repository_has_changes() throws Throwable { CLIContext remoteRepo = contextProvider.getOrCreateRepositoryContext("remoterepo"); remoteRepo.insertAndAdd(lines3); remoteRepo.runCommand(true, "commit -m Commit10"); }
@cucumber.api.java.After public void after() { contextProvider.after(); }
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; }
@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"); }