Search in sources :

Example 21 with JiraConnector

use of com.seleniumtests.connectors.bugtracker.jira.JiraConnector in project seleniumRobot by bhecquet.

the class TestJiraConnector method testCloseIssueInvalidTransitionInSecondPosition.

@Test(groups = { "ut" }, expectedExceptions = ConfigurationException.class, expectedExceptionsMessageRegExp = "'bugtracker.jira.closeTransition': value \\[closeQuickly\\] is invalid for this issue in its current state, allowed transitions are \\[reopen, close\\]")
public void testCloseIssueInvalidTransitionInSecondPosition() {
    when(promiseTransitions.claim()).thenReturn(Arrays.asList(transition3)).thenReturn(Arrays.asList(transition1, transition2));
    jiraOptions.put("jira.closeTransition", "review/closeQuickly");
    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);
}
Also used : TransitionInput(com.atlassian.jira.rest.client.api.domain.input.TransitionInput) JiraConnector(com.seleniumtests.connectors.bugtracker.jira.JiraConnector) Test(org.testng.annotations.Test) MockitoTest(com.seleniumtests.MockitoTest) PrepareForTest(org.powermock.core.classloader.annotations.PrepareForTest)

Example 22 with JiraConnector

use of com.seleniumtests.connectors.bugtracker.jira.JiraConnector in project seleniumRobot by bhecquet.

the class TestJiraConnector method testCreateJiraBeanNoFailedSteps.

@Test(groups = { "ut" })
public void testCreateJiraBeanNoFailedSteps() throws Exception {
    jiraOptions.put("priority", "P1");
    jiraOptions.put("assignee", "me");
    jiraOptions.put("reporter", "you");
    jiraOptions.put("jira.issueType", "Bug");
    jiraOptions.put("jira.components", "comp1,comp2");
    jiraOptions.put("jira.field.foo", "bar");
    JiraConnector jiraConnector = new JiraConnector("http://foo/bar", PROJECT_KEY, "user", "password", jiraOptions);
    IssueBean issueBean = jiraConnector.createIssueBean("[Selenium][selenium][DEV][ngName] test myTest KO", "testCreateJiraBean", "some description", Arrays.asList(step1, stepEnd), jiraOptions);
    // that when no failed step exist, (this should not happen), this is not a problem for connector
    Assert.assertNull(issueBean);
}
Also used : IssueBean(com.seleniumtests.connectors.bugtracker.IssueBean) JiraConnector(com.seleniumtests.connectors.bugtracker.jira.JiraConnector) Test(org.testng.annotations.Test) MockitoTest(com.seleniumtests.MockitoTest) PrepareForTest(org.powermock.core.classloader.annotations.PrepareForTest)

Example 23 with JiraConnector

use of com.seleniumtests.connectors.bugtracker.jira.JiraConnector in project seleniumRobot by bhecquet.

the class TestJiraConnector method testCreateIssueWrongUser.

/**
 * Test issue creation with wrong user
 * @throws URISyntaxException
 */
@Test(groups = { "ut" }, expectedExceptions = ConfigurationException.class)
public void testCreateIssueWrongUser() {
    JiraConnector jiraConnector = new JiraConnector("http://foo/bar", PROJECT_KEY, "user", "password", jiraOptions);
    JiraBean jiraBean = new JiraBean(null, "issue 1", "issue 1 descr", null, "Bug", null, null, "notme", null, new ArrayList<>(), null, new HashMap<>(), new ArrayList<>());
    jiraConnector.createIssue(jiraBean);
}
Also used : JiraBean(com.seleniumtests.connectors.bugtracker.jira.JiraBean) JiraConnector(com.seleniumtests.connectors.bugtracker.jira.JiraConnector) Test(org.testng.annotations.Test) MockitoTest(com.seleniumtests.MockitoTest) PrepareForTest(org.powermock.core.classloader.annotations.PrepareForTest)

Example 24 with JiraConnector

use of com.seleniumtests.connectors.bugtracker.jira.JiraConnector in project seleniumRobot by bhecquet.

the class TestJiraConnector method testCloseIssueMultipleTransitions.

@Test(groups = { "ut" })
public void testCloseIssueMultipleTransitions() {
    when(promiseTransitions.claim()).thenReturn(Arrays.asList(transition3)).thenReturn(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);
}
Also used : TransitionInput(com.atlassian.jira.rest.client.api.domain.input.TransitionInput) JiraConnector(com.seleniumtests.connectors.bugtracker.jira.JiraConnector) Test(org.testng.annotations.Test) MockitoTest(com.seleniumtests.MockitoTest) PrepareForTest(org.powermock.core.classloader.annotations.PrepareForTest)

Example 25 with JiraConnector

use of com.seleniumtests.connectors.bugtracker.jira.JiraConnector in project seleniumRobot by bhecquet.

the class TestJiraConnector method testCreateIssueWrongPriority.

/**
 * Test issue creation with wrong priority
 * @throws URISyntaxException
 */
@Test(groups = { "ut" }, expectedExceptions = ConfigurationException.class)
public void testCreateIssueWrongPriority() {
    JiraConnector jiraConnector = new JiraConnector("http://foo/bar", PROJECT_KEY, "user", "password", jiraOptions);
    JiraBean jiraBean = new JiraBean(null, "issue 1", "issue 1 descr", "P10", "Bug", null, null, null, null, new ArrayList<>(), null, new HashMap<>(), new ArrayList<>());
    jiraConnector.createIssue(jiraBean);
}
Also used : JiraBean(com.seleniumtests.connectors.bugtracker.jira.JiraBean) JiraConnector(com.seleniumtests.connectors.bugtracker.jira.JiraConnector) Test(org.testng.annotations.Test) MockitoTest(com.seleniumtests.MockitoTest) PrepareForTest(org.powermock.core.classloader.annotations.PrepareForTest)

Aggregations

JiraConnector (com.seleniumtests.connectors.bugtracker.jira.JiraConnector)33 Test (org.testng.annotations.Test)32 MockitoTest (com.seleniumtests.MockitoTest)31 PrepareForTest (org.powermock.core.classloader.annotations.PrepareForTest)31 JiraBean (com.seleniumtests.connectors.bugtracker.jira.JiraBean)19 IssueBean (com.seleniumtests.connectors.bugtracker.IssueBean)9 File (java.io.File)6 URI (java.net.URI)6 TransitionInput (com.atlassian.jira.rest.client.api.domain.input.TransitionInput)5 OptionalIterable (com.atlassian.jira.rest.client.api.OptionalIterable)4 IssueInput (com.atlassian.jira.rest.client.api.domain.input.IssueInput)4 HashMap (java.util.HashMap)4 SearchResult (com.atlassian.jira.rest.client.api.domain.SearchResult)3 ComplexIssueInputFieldValue (com.atlassian.jira.rest.client.api.domain.input.ComplexIssueInputFieldValue)3 ArgumentMatchers.anyString (org.mockito.ArgumentMatchers.anyString)3 Comment (com.atlassian.jira.rest.client.api.domain.Comment)1 GenericTest (com.seleniumtests.GenericTest)1 BugTracker (com.seleniumtests.connectors.bugtracker.BugTracker)1 FakeBugTracker (com.seleniumtests.connectors.bugtracker.FakeBugTracker)1 ZonedDateTime (java.time.ZonedDateTime)1