Search in sources :

Example 1 with IssueField

use of com.atlassian.jira.rest.client.api.domain.IssueField in project staf by simpleworks-gmbh.

the class DebugTestFLOClientMojo method dumpIssue.

public void dumpIssue() {
    final Issue issue = client.getIssue(testPlanId).claim();
    DebugTestFLOClientMojo.logger.debug(String.format("key: '%s', issue: id: %d.", issue.getKey(), issue.getId()));
    final IssueType type = issue.getIssueType();
    DebugTestFLOClientMojo.logger.debug(String.format("issue type: id: %d, name: '%s'.", type.getId(), type.getName()));
    final Status status = issue.getStatus();
    DebugTestFLOClientMojo.logger.debug(String.format("status: id: %d, name: '%s'.", status.getId(), status.getName()));
    DebugTestFLOClientMojo.dumpFields("fields for issue.", issue.getFields());
    DebugTestFLOClientMojo.logger.debug("attachments:");
    for (final Attachment attachment : issue.getAttachments()) {
        DebugTestFLOClientMojo.logger.debug(String.format("attachment: '%s'.", attachment));
    }
    final IssueField field = issue.getField("Test Plan Iteration");
    Assert.assertNotNull("field \"Test Plan Iteration\" can't be null.", field);
    final Object obj = field.getValue();
    DebugTestFLOClientMojo.logger.debug(String.format("class for field: \"Iteration\" is: '%s'.", obj.getClass().getName()));
    {
        DebugTestFLOClientMojo.logger.debug("transition:");
        final Iterable<Transition> transitions = client.getTransitions(issue).claim();
        for (final Transition transition : transitions) {
            DebugTestFLOClientMojo.logger.debug(String.format("transition: name: '%s', id: %d.", transition.getName(), Integer.valueOf(transition.getId())));
        }
    }
    for (final Subtask subtask : issue.getSubtasks()) {
        final Issue i = client.getIssue(subtask.getIssueKey()).claim();
        final IssueField steps = i.getFieldByName("Steps");
        DebugTestFLOClientMojo.logger.debug(String.format("steps: '%s'.", steps.getValue()));
        final IssueField template = i.getFieldByName("TC Template");
        DebugTestFLOClientMojo.logger.debug(String.format("template: '%s'.", template.getValue()));
        final Iterable<Transition> transitions = client.getTransitions(i).claim();
        for (final Transition transition : transitions) {
            DebugTestFLOClientMojo.logger.debug(String.format("subtask: '%s', transition: name: '%s', id: %d.", subtask.getIssueKey(), transition.getName(), Integer.valueOf(transition.getId())));
        }
    }
}
Also used : Status(com.atlassian.jira.rest.client.api.domain.Status) Subtask(com.atlassian.jira.rest.client.api.domain.Subtask) Issue(com.atlassian.jira.rest.client.api.domain.Issue) IssueField(com.atlassian.jira.rest.client.api.domain.IssueField) IssueType(com.atlassian.jira.rest.client.api.domain.IssueType) Transition(com.atlassian.jira.rest.client.api.domain.Transition) Attachment(com.atlassian.jira.rest.client.api.domain.Attachment)

Example 2 with IssueField

use of com.atlassian.jira.rest.client.api.domain.IssueField in project jira-plugin by jenkinsci.

the class JiraIssueParameterDefResultTest method prepareMocks.

@Before
public void prepareMocks() {
    issueMock = mock(Issue.class);
    IssueField fieldMock1 = mock(IssueField.class);
    IssueField fieldMock2 = mock(IssueField.class);
    IssueField fieldMock3 = mock(IssueField.class);
    when(issueMock.getFieldByName("TestField1")).thenReturn(fieldMock1);
    when(issueMock.getFieldByName("TestField2")).thenReturn(fieldMock2);
    when(issueMock.getFieldByName("TestField3")).thenReturn(fieldMock3);
    when(issueMock.getFieldByName("TestField4")).thenReturn(null);
    when(issueMock.getSummary()).thenReturn("Summary");
    when(fieldMock1.getValue()).thenReturn("Field1");
    when(fieldMock2.getValue()).thenReturn("Field2");
    when(fieldMock3.getValue()).thenReturn("");
}
Also used : Issue(com.atlassian.jira.rest.client.api.domain.Issue) IssueField(com.atlassian.jira.rest.client.api.domain.IssueField) Before(org.junit.Before)

Example 3 with IssueField

use of com.atlassian.jira.rest.client.api.domain.IssueField in project mirrorgate-jira-stories-collector by BBVA.

the class JiraIssueUtils method getFieldValue.

private static Object getFieldValue(Issue issue, String field) {
    Object out = null;
    IssueField issueField = issue.getField(field);
    if (issueField != null) {
        out = issueField.getValue();
    }
    return out;
}
Also used : IssueField(com.atlassian.jira.rest.client.api.domain.IssueField) JSONObject(org.codehaus.jettison.json.JSONObject)

Example 4 with IssueField

use of com.atlassian.jira.rest.client.api.domain.IssueField in project staf by simpleworks-gmbh.

the class TestFloUtils method getField.

public static String getField(final Issue issue, final String name) {
    Assert.assertNotNull("issue can't be null.", issue);
    Assert.assertFalse("name can't be null.", Convert.isEmpty(name));
    final IssueField field = issue.getFieldByName(name);
    Assert.assertNotNull(String.format("test case '%s': can't get field '%s'.", issue.getKey(), name), field);
    Assert.assertNotNull(String.format("test case '%s': field '%s' without value.", issue.getKey(), name), field.getValue());
    final String result = field.getValue().toString();
    Assert.assertFalse(String.format("test case '%s': field '%s' has empty value.", issue.getKey(), name), Convert.isEmpty(result));
    return result;
}
Also used : IssueField(com.atlassian.jira.rest.client.api.domain.IssueField)

Aggregations

IssueField (com.atlassian.jira.rest.client.api.domain.IssueField)4 Issue (com.atlassian.jira.rest.client.api.domain.Issue)2 Attachment (com.atlassian.jira.rest.client.api.domain.Attachment)1 IssueType (com.atlassian.jira.rest.client.api.domain.IssueType)1 Status (com.atlassian.jira.rest.client.api.domain.Status)1 Subtask (com.atlassian.jira.rest.client.api.domain.Subtask)1 Transition (com.atlassian.jira.rest.client.api.domain.Transition)1 JSONObject (org.codehaus.jettison.json.JSONObject)1 Before (org.junit.Before)1