use of com.seleniumtests.connectors.bugtracker.jira.JiraConnector in project seleniumRobot by bhecquet.
the class TestJiraConnector method testCloseIssue.
@Test(groups = { "ut" })
public void testCloseIssue() {
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).transition(eq(issue1), transitionArgument.capture());
Assert.assertEquals(transitionArgument.getValue().getId(), 1);
}
use of com.seleniumtests.connectors.bugtracker.jira.JiraConnector in project seleniumRobot by bhecquet.
the class TestJiraConnector method testCreateIssue.
/**
* Test issue creation with all fields
* @throws URISyntaxException
*/
@Test(groups = { "ut" })
public void testCreateIssue() throws URISyntaxException {
ArgumentCaptor<IssueInput> issueArgument = ArgumentCaptor.forClass(IssueInput.class);
ArgumentCaptor<File> screenshotCaptor = ArgumentCaptor.forClass(File.class);
JiraConnector jiraConnector = new JiraConnector("http://foo/bar", PROJECT_KEY, "user", "password", jiraOptions);
Map<String, String> fields = new HashMap<>();
// field allowed by jira
fields.put("application", "myApp");
// field allowed by jira
fields.put("step", "step2");
JiraBean jiraBean = new JiraBean(null, "issue 1", "issue 1 descr", "P1", "Bug", "myTest", null, "me", "you", Arrays.asList(screenshot), detailedResult, fields, Arrays.asList("comp1"));
jiraConnector.createIssue(jiraBean);
Assert.assertEquals(jiraBean.getId(), "ISSUE-1");
verify(issueRestClient).createIssue(issueArgument.capture());
// check issue has all data defined in jiraBean
IssueInput issueInput = ((IssueInput) issueArgument.getValue());
Assert.assertEquals(issueInput.getField("summary").getValue(), "issue 1");
Assert.assertEquals(((ComplexIssueInputFieldValue) (issueInput.getField("issuetype").getValue())).getValuesMap().get("id"), "1");
Assert.assertEquals(ImmutableList.copyOf(((Iterable<ComplexIssueInputFieldValue>) (issueInput.getField("components").getValue()))).size(), 1);
Assert.assertEquals(ImmutableList.copyOf(((Iterable<ComplexIssueInputFieldValue>) (issueInput.getField("components").getValue()))).get(0).getValuesMap().get("name"), "comp1");
// Assert.assertEquals(issueInput.getField("duedate").getValue().toString().split("-")[0], Integer.toString(LocalDateTime.now().getYear()));
Assert.assertEquals(((ComplexIssueInputFieldValue) (issueInput.getField("project").getValue())).getValuesMap().get("key"), PROJECT_KEY);
Assert.assertEquals(issueInput.getField("description").getValue(), "issue 1 descr");
Assert.assertEquals(((ComplexIssueInputFieldValue) (issueInput.getField("reporter").getValue())).getValuesMap().get("name"), "you");
Assert.assertEquals(((ComplexIssueInputFieldValue) (issueInput.getField("assignee").getValue())).getValuesMap().get("name"), "user1");
Assert.assertEquals(((ComplexIssueInputFieldValue) (issueInput.getField("priority").getValue())).getValuesMap().get("id"), "1");
// custom field
Assert.assertEquals(issueInput.getField("13").getValue(), "myApp");
// custom field
Assert.assertEquals(((ComplexIssueInputFieldValue) (issueInput.getField("33").getValue())).getValuesMap().get("value"), "step2");
// check attachments have been added (screenshot + detailed results)
verify(issueRestClient, times(2)).addAttachments(eq(new URI("http://foo/bar/i/1/attachments")), screenshotCaptor.capture());
Assert.assertTrue(((File) screenshotCaptor.getAllValues().get(0)).getName().endsWith(".png"));
Assert.assertTrue(((File) screenshotCaptor.getAllValues().get(1)).getName().endsWith(".zip"));
}
use of com.seleniumtests.connectors.bugtracker.jira.JiraConnector in project seleniumRobot by bhecquet.
the class TestJiraConnector method testCreateIssueWrongIssueType.
/**
* Test issue creation with wrong issue type, unknown from jira
* @throws URISyntaxException
*/
@Test(groups = { "ut" }, expectedExceptions = ConfigurationException.class)
public void testCreateIssueWrongIssueType() {
JiraConnector jiraConnector = new JiraConnector("http://foo/bar", PROJECT_KEY, "user", "password", jiraOptions);
JiraBean jiraBean = new JiraBean(null, "issue 1", "issue 1 descr", null, "BigBug", null, null, "", null, new ArrayList<>(), null, new HashMap<>(), new ArrayList<>());
jiraConnector.createIssue(jiraBean);
}
Aggregations