@Override public List<IssueDetails> getIssues(Annotation annotation) { Jira jiraAnnotation = (Jira) annotation; String[] ids = jiraAnnotation.value(); List<IssueDetails> detailsList = new ArrayList<IssueDetails>(); for (String id : ids) { Set<IssueDetails> details = issueConnector.getIssue(id); detailsList.addAll(details); } return detailsList; }
@Test @Jira("GUVNOR-2542") public void testCreateProjectWithoutName() { CreateProjectRequest createProjectRequest = new CreateProjectRequest(); createProjectRequest.setGroupId(GROUP_ID); createProjectRequest.setVersion(VERSION); try { client.createProject(SPACE, createProjectRequest); } catch (NotSuccessException ex) { assertThat(ex.getJobResult().getStatus()).isEqualTo(JobStatus.BAD_REQUEST); assertThat(ex.getJobResult().getResult()).contains("name"); } }
@Test @Jira("GUVNOR-2542") public void testCreateProjectWithoutName() { CreateProjectRequest createProjectRequest = new CreateProjectRequest(); createProjectRequest.setGroupId(GROUP_ID); createProjectRequest.setVersion(VERSION); try { client.createProject(SPACE, createProjectRequest); } catch (NotSuccessException ex) { assertThat(ex.getJobResult().getStatus()).isEqualTo(JobStatus.BAD_REQUEST); assertThat(ex.getJobResult().getResult()).contains("name"); } }
@Jira("GUVNOR-2542") @Test(expected = NotFoundException.class) public void testDeleteNotExistingProject() { try { client.deleteProject(PROJECT, "notExistingProject"); } catch (NotSuccessException ex) { System.out.println(ex.getJobResult().getStatus() + ": " + ex.getJobResult().getResult()); } }
@Override public List<IssueDetails> getIssues(Annotation annotation) { Jira jiraAnnotation = (Jira) annotation; String[] ids = jiraAnnotation.value(); List<IssueDetails> detailsList = new ArrayList<IssueDetails>(); boolean cacheChanged = false; for (String id : ids) { for (ITrackerClient client : clients) { Set<IssueDetails> details = null; if (client.canHandle(annotation)) { issueConnector.setQuery(client.getQuery()); details = issueConnector.getIssue(id); if (details == null) { details = client.getIssueConnector().getIssue(id); if (details != null) { issueConnector.addIssueDetails(id, client.getQuery(), details); cacheChanged = true; } } } detailsList.addAll(details); } if (cacheChanged) { issueConnector.saveData(); } } return detailsList; }
@Jira("GUVNOR-2542") @Test(expected = NotFoundException.class) public void testDeleteNotExistingProject() { try { client.deleteProject(PROJECT, "notExistingProject"); } catch (NotSuccessException ex) { System.out.println(ex.getJobResult().getStatus() + ": " + ex.getJobResult().getResult()); } }
@Test @Jira("GUVNOR-2542") public void testCloneRepositoryNotExistingUrl() { final CloneProjectRequest cloneProjectRequest = new CloneProjectRequest(); cloneProjectRequest.setName("clonedRepoWithNotExistingUrl"); cloneProjectRequest.setGitURL(getLocalGitRepositoryUrl() + "xyz"); try { client.cloneRepository(SPACE, cloneProjectRequest); Assertions.fail("Operation should fail because of not valid Git URL"); } catch (NotSuccessException ex) { assertThat(ex.getJobResult().getStatus()).isEqualTo(JobStatus.BAD_REQUEST); } }
@Test @Jira("GUVNOR-2542") public void testCloneRepositoryNotExistingUrl() { final CloneProjectRequest cloneProjectRequest = new CloneProjectRequest(); cloneProjectRequest.setName("clonedRepoWithNotExistingUrl"); cloneProjectRequest.setGitURL(getLocalGitRepositoryUrl() + "xyz"); try { client.cloneRepository(SPACE, cloneProjectRequest); Assertions.fail("Operation should fail because of not valid Git URL"); } catch (NotSuccessException ex) { assertThat(ex.getJobResult().getStatus()).isEqualTo(JobStatus.BAD_REQUEST); } }
@Test @Jira("GUVNOR-2542") public void testCreateWithDescription() { final Space space = new Space(); space.setName("spaceWithDescription"); space.setOwner(OWNER); space.setDescription(DESCRIPTION); testCreate(space); }
@Test @Jira("GUVNOR-2542") public void testCreateWithDescription() { final Space space = new Space(); space.setName("spaceWithDescription"); space.setOwner(OWNER); space.setDescription(DESCRIPTION); testCreate(space); }