use of com.seleniumtests.connectors.bugtracker.jira.JiraConnector in project seleniumRobot by bhecquet.
the class TestJiraConnector method testCloseUnknownIssue.
/**
* Error raised when not
* @throws URISyntaxException
*/
@Test(groups = { "ut" }, expectedExceptions = ScenarioException.class)
public void testCloseUnknownIssue() {
JiraConnector jiraConnector = new JiraConnector("http://foo/bar", PROJECT_KEY, "user", "password", jiraOptions);
jiraConnector.closeIssue("ISSUE-2", "closed");
}
use of com.seleniumtests.connectors.bugtracker.jira.JiraConnector in project seleniumRobot by bhecquet.
the class TestJiraConnector method testUpdateUnknownIssue.
@Test(groups = { "ut" }, expectedExceptions = ScenarioException.class)
public void testUpdateUnknownIssue() throws URISyntaxException {
JiraConnector jiraConnector = new JiraConnector("http://foo/bar", PROJECT_KEY, "user", "password", jiraOptions);
jiraConnector.updateIssue("ISSUE-2", "update", Arrays.asList(screenshot));
}
use of com.seleniumtests.connectors.bugtracker.jira.JiraConnector in project seleniumRobot by bhecquet.
the class TestJiraConnector method testIssueAlreadyExists.
/**
* The issue already exists on Jira
*/
@Test(groups = { "ut" })
public void testIssueAlreadyExists() {
when(promiseSearch.claim()).thenReturn(new SearchResult(0, 2, 2, Arrays.asList(issue1, issue2)));
DateTime issueDate = DateTime.now().minusDays(1);
when(issue1.getCreationDate()).thenReturn(issueDate);
JiraBean jiraBean = new JiraBean(null, "issue 1", "issue 1", "Bug", "P1");
JiraConnector jiraConnector = new JiraConnector("http://foo/bar", PROJECT_KEY, "user", "password", jiraOptions);
IssueBean newJiraBean = jiraConnector.issueAlreadyExists(jiraBean);
// check issue exists and has been updated with the first found issue
Assert.assertNotNull(newJiraBean);
Assert.assertEquals(newJiraBean.getId(), "ISSUE-1");
Assert.assertEquals(newJiraBean.getSummary(), jiraBean.getSummary());
Assert.assertEquals(newJiraBean.getDescription(), "jira issue 1");
Assert.assertEquals(newJiraBean.getDate(), issueDate.toString("yyyy-MM-dd'T'HH:mmZZ"));
}
use of com.seleniumtests.connectors.bugtracker.jira.JiraConnector in project seleniumRobot by bhecquet.
the class TestJiraConnector method testUpdateIssue.
@Test(groups = { "ut" })
public void testUpdateIssue() throws URISyntaxException {
ArgumentCaptor<Comment> commentArgument = ArgumentCaptor.forClass(Comment.class);
ArgumentCaptor<File> screenshotCaptor = ArgumentCaptor.forClass(File.class);
JiraConnector jiraConnector = new JiraConnector("http://foo/bar", PROJECT_KEY, "user", "password", jiraOptions);
jiraConnector.updateIssue("ISSUE-1", "update", Arrays.asList(screenshot));
verify(issueRestClient).addComment(any(URI.class), commentArgument.capture());
Assert.assertEquals(commentArgument.getValue().getBody(), "update\n" + "!N-A_0-2_Test_end--123456.png|thumbnail!\n");
// check attachments have been added (screenshot)
verify(issueRestClient).addAttachments(eq(new URI("http://foo/bar/i/1/attachments")), screenshotCaptor.capture());
Assert.assertTrue(((File) screenshotCaptor.getAllValues().get(0)).getName().endsWith(".png"));
}
use of com.seleniumtests.connectors.bugtracker.jira.JiraConnector in project seleniumRobot by bhecquet.
the class TestJiraConnector method testCloseIssueMultipleTransitionsSlow.
/**
* issue #470: When closing issue with multiple transition, check the case where jira do not update the transitions of the issue immediately
* We need to retry
*/
@Test(groups = { "ut" })
public void testCloseIssueMultipleTransitionsSlow() {
// initial state
when(promiseTransitions.claim()).thenReturn(Arrays.asList(transition3)).thenReturn(// state not updated
Arrays.asList(transition3)).thenReturn(// state updated
Arrays.asList(transition1, transition2));
jiraOptions.put("jira.closeTransition", "review/close");
ArgumentCaptor<TransitionInput> transitionArgument = ArgumentCaptor.forClass(TransitionInput.class);
JiraConnector jiraConnector = new JiraConnector("http://foo/bar", PROJECT_KEY, "user", "password", jiraOptions);
jiraConnector.closeIssue("ISSUE-1", "closed");
verify(issueRestClient, times(2)).transition(eq(issue1), transitionArgument.capture());
// transition to review state
Assert.assertEquals(transitionArgument.getAllValues().get(0).getId(), 3);
// transition to closed state
Assert.assertEquals(transitionArgument.getAllValues().get(1).getId(), 1);
}
Aggregations