use of com.seleniumtests.connectors.bugtracker.jira.JiraConnector in project seleniumRobot by bhecquet.
the class BugTracker method closeIssue.
/**
* Close issue if it exists
* @param application
* @param environment
* @param testNgName
* @param testName
*/
public void closeIssue(String application, String environment, String testNgName, String testName) {
String summary = createIssueSummary(application, environment, testNgName, testName);
IssueBean issueBean;
if (this instanceof JiraConnector) {
issueBean = new JiraBean("", summary, "", "", "");
} else {
issueBean = new IssueBean(summary, "", "", null, null, null, null, null);
}
// Close issue if it exists
IssueBean currentIssue = issueAlreadyExists(issueBean);
if (currentIssue != null) {
closeIssue(currentIssue.getId(), "Test is now OK");
}
}
use of com.seleniumtests.connectors.bugtracker.jira.JiraConnector in project seleniumRobot by bhecquet.
the class TestJiraConnector method testIssueAlreadyExistsIssueBean.
/**
* Test JiraConnector only accepts JiraBean instances
*/
@Test(groups = { "ut" }, expectedExceptions = ClassCastException.class)
public void testIssueAlreadyExistsIssueBean() {
when(promiseSearch.claim()).thenReturn(new SearchResult(0, 2, 2, Arrays.asList(issue1, issue2)));
IssueBean jiraBean = new IssueBean(null, "issue 1", "issue 1");
JiraConnector jiraConnector = new JiraConnector("http://foo/bar", PROJECT_KEY, "user", "password", jiraOptions);
jiraConnector.issueAlreadyExists(jiraBean);
}
use of com.seleniumtests.connectors.bugtracker.jira.JiraConnector in project seleniumRobot by bhecquet.
the class TestJiraConnector method testCreateIssueNoIssueType.
/**
* Test issue creation without issue type
* @throws URISyntaxException
*/
@Test(groups = { "ut" }, expectedExceptions = ConfigurationException.class)
public void testCreateIssueNoIssueType() {
JiraConnector jiraConnector = new JiraConnector("http://foo/bar", PROJECT_KEY, "user", "password", jiraOptions);
JiraBean jiraBean = new JiraBean(null, "issue 1", "issue 1 descr", null, null, null, null, "", null, new ArrayList<>(), null, new HashMap<>(), new ArrayList<>());
jiraConnector.createIssue(jiraBean);
}
use of com.seleniumtests.connectors.bugtracker.jira.JiraConnector in project seleniumRobot by bhecquet.
the class TestJiraConnector method testCreateIssueUnknownField.
/**
* Test issue creation with wrong field. No error should be raised (but issue may not be created if field is mandatory)
* @throws URISyntaxException
*/
@Test(groups = { "ut" })
public void testCreateIssueUnknownField() {
JiraConnector jiraConnector = new JiraConnector("http://foo/bar", PROJECT_KEY, "user", "password", jiraOptions);
Map<String, String> fields = new HashMap<>();
// field not allowed by jira
fields.put("myfield", "myApp");
JiraBean jiraBean = new JiraBean(null, "issue 1", "issue 1 descr", "P1", "Bug", null, null, null, null, new ArrayList<>(), null, fields, new ArrayList<>());
jiraConnector.createIssue(jiraBean);
}
use of com.seleniumtests.connectors.bugtracker.jira.JiraConnector in project seleniumRobot by bhecquet.
the class TestJiraConnector method testCreateIssueMissingScreenshotFile.
/**
* Test the case where the attachment file (file of snapshot is not present)
* @throws URISyntaxException
*/
@Test(groups = { "ut" })
public void testCreateIssueMissingScreenshotFile() throws URISyntaxException {
JiraConnector jiraConnector = new JiraConnector("http://foo/bar", PROJECT_KEY, "user", "password", jiraOptions);
// simulate screenshot file not present
new File(screenshot.getFullImagePath()).delete();
JiraBean jiraBean = new JiraBean(null, "issue 1", "issue 1 descr", "P1", "Bug", null, null, null, null, Arrays.asList(screenshot), null, new HashMap<>(), new ArrayList<>());
jiraConnector.createIssue(jiraBean);
// check attachments (screenshots) have not been added because screenshot file was not available
verify(issueRestClient, never()).addAttachments(eq(new URI("http://foo/bar/i/1/attachments")), any(File.class));
}
Aggregations