1
0
Fork 0

JQL returns timeTracking data as flat attributes in Issue

master
Gabriel Such 2014-02-05 14:51:04 -08:00 committed by Bob Carroll
parent 5cb2b580ae
commit 4a747c337e
5 changed files with 34 additions and 12 deletions

View File

@ -138,6 +138,8 @@ public final class Field {
public static final String VOTES = "votes";
public static final String WATCHES = "watches";
public static final String WORKLOG = "worklog";
public static final String TIME_ESTIMATE = "timeestimate";
public static final String TIME_SPENT = "timespent";
public static final String DATE_FORMAT = "yyyy-MM-dd";

View File

@ -377,6 +377,8 @@ public class Issue extends Resource {
private Votes votes = null;
private Watches watches = null;
private List<WorkLog> workLogs = null;
private Integer timeEstimate = null;
private Integer timeSpent = null;
/**
* Creates an issue from a JSON payload.
@ -423,6 +425,8 @@ public class Issue extends Resource {
votes = Field.getResource(Votes.class, fields.get(Field.VOTES), restclient);
watches = Field.getResource(Watches.class, fields.get(Field.WATCHES), restclient);
workLogs = Field.getWorkLogs(fields.get(Field.WORKLOG), restclient);
timeEstimate = Field.getInteger(fields.get(Field.TIME_ESTIMATE));
timeSpent = Field.getInteger(fields.get(Field.TIME_SPENT));
}
private static String getRestUri(String key) {
@ -1068,5 +1072,13 @@ public class Issue extends Resource {
public List<WorkLog> getWorkLogs() {
return workLogs;
}
public Integer getTimeSpent() {
return timeSpent;
}
public Integer getTimeEstimate() {
return timeEstimate;
}
}

View File

@ -31,9 +31,9 @@ public class TimeTracking {
private String originalEstimate = null;
private String remainingEstimate = null;
private String timeSpent = null;
private int originalEstimateSeconds = 0;
private int remainingEstimateSeconds = 0;
private int timeSpentSeconds = 0;
private Integer originalEstimateSeconds = null;
private Integer remainingEstimateSeconds = null;
private Integer timeSpentSeconds = null;
/**
* Creates a time tracking structure from a JSON payload.
@ -74,5 +74,4 @@ public class TimeTracking {
public int getTimeSpentSeconds() {
return timeSpentSeconds;
}
}

View File

@ -1,14 +1,15 @@
package net.rcarz.jiraclient;
import org.junit.Assert;
import org.junit.Test;
import static junit.framework.Assert.assertEquals;
import static junit.framework.Assert.assertTrue;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertNotNull;
import java.util.List;
import java.util.Map;
import static junit.framework.Assert.*;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertNotNull;
import org.junit.Assert;
import org.junit.Test;
public class IssueTest {
@ -17,7 +18,7 @@ public class IssueTest {
*/
@Test
public void testCreateIssue() {
Issue issue = new Issue(null, Utils.getTestIssue());
new Issue(null, Utils.getTestIssue());
}
@Test
@ -112,4 +113,12 @@ public class IssueTest {
Assert.assertEquals(version.getReleaseDate(), "2013-12-01");
Assert.assertEquals(version.getDescription(), "First Full Functional Build");
}
@Test
public void testPlainTimeTracking() {
Issue issue = new Issue(null,Utils.getTestIssue());
assertEquals(new Integer(144000), issue.getTimeEstimate());
assertEquals(new Integer(86400), issue.getTimeSpent());
}
}

View File

@ -51,7 +51,7 @@ public class Utils {
" }\n" +
" ],\n" +
" \"resolutiondate\": null,\n" +
" \"timespent\": null,\n" +
" \"timespent\": 86400,\n" +
" \"reporter\": {\n" +
" \"self\": \"https://brainbubble.atlassian.net/rest/api/2/user?username=joseph\",\n" +
" \"name\": \"joseph\",\n" +
@ -136,7 +136,7 @@ public class Utils {
" \n" +
" ],\n" +
" \"environment\": null,\n" +
" \"timeestimate\": null,\n" +
" \"timeestimate\": 144000,\n" +
" \"lastViewed\": \"2013-11-24T16:37:50.358+0000\",\n" +
" \"aggregateprogress\": {\n" +
" \"progress\": 0,\n" +