GitWorkflowRepository extends FileBasedWorkflowRepository implements WorkflowRepository, FileBasedWorkflowRepositoryMXBean { public synchronized void setBranch(String branch) throws IOException, GitAPIException { this.branch = branch; if (isUp()) { updateLocalGitRepositories(); } }  synchronized void setGitRepositoryDir(File gitRepositoryDir); synchronized void setGitRepositoryDir(String gitRepositoryDir); synchronized File getGitRepositoryDir(); synchronized String getOriginUri(); synchronized String getBranch(); synchronized void setOriginURI(String originUri); synchronized void setCredentials(String username, char[] password); synchronized void setBranch(String branch); @Override synchronized void setCheckIntervalMSec(int checkIntervalMSec); @Override synchronized void start(); @Override synchronized void shutdown(); synchronized boolean isUp(); static final String ORIGIN; static final String DEFAULT_BRANCH; }
@Test(expected = RefNotAdvertisedException.class) public void changeToTagTest() throws IOException, GitAPIException { wfRepo.setBranch("2.0.0"); }
@Test public void change2BranchesTest() throws CopperException, InterruptedException, IOException, GitAPIException { wfRepo.setBranch("1.0"); LockSupport.parkNanos(1000000000 + CHECK_INTERVAL_M_SEC * 1000000); engine.run("Workflow1", "foo"); String result1 = (String) channel.wait("correlationId", 1000, TimeUnit.MILLISECONDS); assertEquals("V1.0", result1); wfRepo.setBranch("2.0"); LockSupport.parkNanos(1000000000 + CHECK_INTERVAL_M_SEC * 1000000); engine.run("Workflow1", "foo"); String result2 = (String) channel.wait("correlationId", 1000, TimeUnit.MILLISECONDS); assertEquals("V2.0", result2); }