JobRequestHelper { public JobResult cloneProject(final String jobId, final String spaceName, final CloneProjectRequest cloneProjectRequest) { JobResult result = new JobResult(); result.setJobId(jobId); final String scheme = "git"; OrganizationalUnit orgUnit = organizationalUnitService.getOrganizationalUnit(spaceName); if (orgUnit == null) { result.setStatus(JobStatus.BAD_REQUEST); result.setResult("Space '" + spaceName + "' does not exist!"); return result; } if (cloneProjectRequest.getName() == null || "".equals(cloneProjectRequest.getName()) || cloneProjectRequest.getGitURL() == null || "".equals(cloneProjectRequest.getGitURL())) { result.setStatus(JobStatus.BAD_REQUEST); result.setResult("Repository name and GitURL must be provided"); } final RepositoryEnvironmentConfigurations configuration = new RepositoryEnvironmentConfigurations(); if (cloneProjectRequest.getUserName() != null && !"".equals(cloneProjectRequest.getUserName())) { configuration.setUserName(cloneProjectRequest.getUserName()); } if (cloneProjectRequest.getPassword() != null && !"".equals(cloneProjectRequest.getPassword())) { configuration.setPassword(cloneProjectRequest.getPassword()); } configuration.setInit(false); configuration.setMirror(false); configuration.setOrigin(cloneProjectRequest.getGitURL()); org.guvnor.structure.repositories.Repository newlyCreatedRepo = repositoryService.createRepository( orgUnit, scheme, cloneProjectRequest.getName(), configuration); if (newlyCreatedRepo != null) { result.setStatus(JobStatus.SUCCESS); result.setResult("Alias: " + newlyCreatedRepo.getAlias() + ", Scheme: " + newlyCreatedRepo.getScheme() + ", Uri: " + newlyCreatedRepo.getUri()); } else { result.setStatus(JobStatus.FAIL); } return result; }  JobResult cloneProject(final String jobId,
                                  final String spaceName,
                                  final CloneProjectRequest cloneProjectRequest); JobResult createProject(final String jobId,
                                   final String spaceName,
                                   final String projectName,
                                   String projectGroupId,
                                   String projectVersion,
                                   String projectDescription); JobResult deleteProject(final String jobId,
                                   final String spaceName,
                                   final String projectName); JobResult compileProject(final String jobId,
                                    final String spaceName,
                                    final String projectName,
                                    final String branchName); JobResult installProject(final String jobId,
                                    final String spaceName,
                                    final String projectName,
                                    final String branchName); JobResult testProject(final String jobId,
                                 final String spaceName,
                                 final String projectName,
                                 final String branchName); JobResult deployProject(final String jobId,
                                   final String spaceName,
                                   final String projectName,
                                   final String branchName); JobResult removeSpace(final String jobId,
                                 final String spaceName); JobResult createSpace(final String jobId,
                                 final String spaceName,
                                 final String spaceDescription,
                                 final String spaceOwner,
                                 final String defaultGroupId); JobResult updateSpace(final String jobId,
                                 final String spaceName,
                                 final String spaceDescription,
                                 final String spaceOwner,
                                 final String defaultGroupId); JobResult addBranch(final String jobId,
                               final String spaceName,
                               final String projectName,
                               final String newBranchName,
                               final String baseBranchName,
                               final String userIdentifier); JobResult removeBranch(final String jobId,
                                  final String spaceName,
                                  final String projectName,
                                  final String branchName,
                                  final String userIdentifier); JobResult addProjectToSpace(final String jobId,
                                       final String spaceName,
                                       final String projectName);  }
@Test public void cloneProject() throws Exception { doReturn(mock(OrganizationalUnit.class)).when(organizationalUnitService).getOrganizationalUnit("space"); final CloneProjectRequest cloneProjectRequest = new CloneProjectRequest(); cloneProjectRequest.setName("myName"); helper.cloneProject("jobId", "space", cloneProjectRequest); verify(repositoryService).createRepository( any(), eq("git"), eq("myName"), repositoryEnvironmentConfigurationsCaptor.capture() ); RepositoryEnvironmentConfigurations config = repositoryEnvironmentConfigurationsCaptor.getValue(); assertEquals(false, config.getMirror()); assertEquals(false, config.getInit()); }