Commit f15e87e9f00ef31561cb9bfbb7ca478266248fe8

Authored by bernard
1 parent f8151328

Substituted htmlunit with httpclient.

Added method to get issue by id.
Added method to create.
Reorganized XSD schemas and JAXB bindings so that they are reusable for different REST methods.
... ... @@ -5,19 +5,24 @@
5 5
6 6 <groupId>pl.com.it-crowd</groupId>
7 7 <artifactId>youtrack-rest-api</artifactId>
8   - <version>1.0.2-SNAPSHOT</version>
  8 + <version>1.1.0-SNAPSHOT</version>
9 9
10 10 <dependencies>
11 11 <dependency>
12 12 <groupId>junit</groupId>
13 13 <artifactId>junit</artifactId>
14 14 <version>4.8.2</version>
  15 + <scope>test</scope>
  16 + </dependency>
  17 + <dependency>
  18 + <groupId>org.apache.httpcomponents</groupId>
  19 + <artifactId>httpclient</artifactId>
  20 + <version>4.2-beta1</version>
15 21 </dependency>
16   -
17 22 <dependency>
18   - <groupId>net.sourceforge.htmlunit</groupId>
19   - <artifactId>htmlunit</artifactId>
20   - <version>2.8</version>
  23 + <groupId>commons-io</groupId>
  24 + <artifactId>commons-io</artifactId>
  25 + <version>2.3</version>
21 26 </dependency>
22 27 </dependencies>
23 28
... ...
1 1 package pl.com.it_crowd.youtrack.api;
2 2
3 3 import org.apache.commons.io.IOUtils;
4   -import pl.com.it_crowd.youtrack.api.rest.Issues;
  4 +import pl.com.it_crowd.youtrack.api.rest.ObjectFactory;
5 5
6 6 import javax.xml.bind.JAXBContext;
  7 +import javax.xml.bind.JAXBElement;
7 8 import javax.xml.bind.JAXBException;
8 9 import java.io.IOException;
9   -import java.io.InputStream;
10   -import java.io.InputStreamReader;
11 10 import java.io.Reader;
12 11 import java.io.StringReader;
13   -import java.net.URL;
14 12
15   -public class IssuesUnmarshaller {
  13 +//TODO methods from this class should be probably merged with YoutrackUnmarshaller
  14 +public final class ErrorUnmarshaller {
  15 +// -------------------------- STATIC METHODS --------------------------
16 16
17   - public static Issues unmarshal(String url) throws JAXBException, IOException
  17 + public static String unmarshal(String string) throws JAXBException, IOException
18 18 {
19   - return unmarshal(new URL(url).openStream());
  19 + return unmarshal(new StringReader(string));
20 20 }
21 21
22   - public static Issues unmarshal(InputStream stream) throws JAXBException, IOException
23   - {
24   - return unmarshal(new InputStreamReader(stream));
25   - }
26   -
27   - public static Issues unmarshal(Reader reader) throws JAXBException, IOException
  22 + public static String unmarshal(Reader reader) throws JAXBException, IOException
28 23 {
29 24 String content = IOUtils.toString(reader);
30 25 try {
31   - JAXBContext jaxbContext = JAXBContext.newInstance(Issues.class.getPackage().getName());
32   - return (Issues) jaxbContext.createUnmarshaller().unmarshal(new StringReader(content));
  26 + JAXBContext jaxbContext = JAXBContext.newInstance(ObjectFactory.class);
  27 + @SuppressWarnings("unchecked")
  28 + final JAXBElement<String> element = (JAXBElement<String>) jaxbContext.createUnmarshaller().unmarshal(new StringReader(content));
  29 + return element.getValue();
33 30 } catch (JAXBException e) {
  31 +// TODO we need logging here
34 32 System.err.println("Cannot unmarshal input stream.\n" + content + e);
35 33 throw e;
36 34 }
37 35 }
  36 +
  37 +// --------------------------- CONSTRUCTORS ---------------------------
  38 +
  39 + private ErrorUnmarshaller()
  40 + {
  41 + }
38 42 }
... ...
... ... @@ -2,7 +2,9 @@ package pl.com.it_crowd.youtrack.api;
2 2
3 3 import org.apache.commons.logging.Log;
4 4 import org.apache.commons.logging.LogFactory;
5   -import pl.com.it_crowd.youtrack.api.rest.Issues;
  5 +import pl.com.it_crowd.youtrack.api.rest.Comment;
  6 +import pl.com.it_crowd.youtrack.api.rest.Field;
  7 +import pl.com.it_crowd.youtrack.api.rest.Issue;
6 8
7 9 import java.io.Serializable;
8 10 import java.util.ArrayList;
... ... @@ -10,30 +12,30 @@ import java.util.HashMap;
10 12 import java.util.List;
11 13 import java.util.Map;
12 14
13   -public class Issue implements Serializable {
  15 +public class IssueWrapper implements Serializable {
14 16 // ------------------------------ FIELDS ------------------------------
15 17
16   - private static final Log log = LogFactory.getLog(Issue.class);
  18 + private static final Log log = LogFactory.getLog(IssueWrapper.class);
17 19
18   - private List<Issues.Issue.Comment> comments;
  20 + private List<Comment> comments;
19 21
20   - private Map<String, Issues.Issue.Field> fieldMap;
  22 + private Map<String, Field> fieldMap;
21 23
22   - private Issues.Issue issue;
  24 + private Issue issue;
23 25
24 26 // --------------------------- CONSTRUCTORS ---------------------------
25 27
26   - public Issue(Issues.Issue issue)
  28 + public IssueWrapper(Issue issue)
27 29 {
28 30 this.issue = issue;
29   - fieldMap = new HashMap<String, Issues.Issue.Field>();
30   - comments = new ArrayList<Issues.Issue.Comment>();
  31 + fieldMap = new HashMap<String, Field>();
  32 + comments = new ArrayList<Comment>();
31 33 for (Object o : issue.getFieldOrComment()) {
32   - if (o instanceof Issues.Issue.Field) {
33   - Issues.Issue.Field field = (Issues.Issue.Field) o;
  34 + if (o instanceof Field) {
  35 + Field field = (Field) o;
34 36 fieldMap.put(field.getName(), field);
35   - } else if (o instanceof Issues.Issue.Comment) {
36   - comments.add((Issues.Issue.Comment) o);
  37 + } else if (o instanceof Comment) {
  38 + comments.add((Comment) o);
37 39 } else {
38 40 log.warn("Object " + o + " is not Field nor Coment");
39 41 }
... ... @@ -42,18 +44,18 @@ public class Issue implements Serializable {
42 44
43 45 // -------------------------- OTHER METHODS --------------------------
44 46
45   - public Issues.Issue.Field getField(String field)
  47 + public Field getField(String field)
46 48 {
47 49 return fieldMap.get(field);
48 50 }
49 51
50 52 public String getFieldValue(String fieldName)
51 53 {
52   - Issues.Issue.Field field = fieldMap.get(fieldName);
  54 + Field field = getField(fieldName);
53 55 if (field == null) {
54 56 return null;
55 57 }
56   - List<Issues.Issue.Field.Value> values = field.getValues();
  58 + List<Field.Value> values = field.getValues();
57 59 return values.isEmpty() ? null : values.get(0).getContent();
58 60 }
59 61
... ...
1 1 package pl.com.it_crowd.youtrack.api;
2 2
3   -import com.gargoylesoftware.htmlunit.BrowserVersion;
4   -import com.gargoylesoftware.htmlunit.FailingHttpStatusCodeException;
5   -import com.gargoylesoftware.htmlunit.HttpMethod;
6   -import com.gargoylesoftware.htmlunit.Page;
7   -import com.gargoylesoftware.htmlunit.WebClient;
8   -import com.gargoylesoftware.htmlunit.WebRequest;
9   -import com.gargoylesoftware.htmlunit.WebResponse;
10   -import com.gargoylesoftware.htmlunit.html.DomNode;
11   -import com.gargoylesoftware.htmlunit.util.NameValuePair;
12   -import com.gargoylesoftware.htmlunit.xml.XmlPage;
13   -import org.apache.http.auth.AuthenticationException;
  3 +import org.apache.http.Header;
  4 +import org.apache.http.HttpEntity;
  5 +import org.apache.http.HttpHeaders;
  6 +import org.apache.http.HttpResponse;
  7 +import org.apache.http.HttpStatus;
  8 +import org.apache.http.StatusLine;
  9 +import org.apache.http.client.ClientProtocolException;
  10 +import org.apache.http.client.HttpClient;
  11 +import org.apache.http.client.HttpResponseException;
  12 +import org.apache.http.client.entity.UrlEncodedFormEntity;
  13 +import org.apache.http.client.methods.HttpGet;
  14 +import org.apache.http.client.methods.HttpPost;
  15 +import org.apache.http.client.methods.HttpPut;
  16 +import org.apache.http.client.methods.HttpUriRequest;
  17 +import org.apache.http.client.utils.URIBuilder;
  18 +import org.apache.http.conn.ClientConnectionManager;
  19 +import org.apache.http.conn.scheme.Scheme;
  20 +import org.apache.http.conn.scheme.SchemeRegistry;
  21 +import org.apache.http.conn.ssl.SSLSocketFactory;
  22 +import org.apache.http.impl.client.DefaultHttpClient;
  23 +import org.apache.http.impl.conn.PoolingClientConnectionManager;
  24 +import org.apache.http.impl.conn.SchemeRegistryFactory;
  25 +import org.apache.http.message.BasicNameValuePair;
  26 +import org.apache.http.util.EntityUtils;
  27 +import pl.com.it_crowd.youtrack.api.exceptions.NoResultFoundException;
  28 +import pl.com.it_crowd.youtrack.api.exceptions.YoutrackAPIException;
  29 +import pl.com.it_crowd.youtrack.api.exceptions.YoutrackErrorException;
  30 +import pl.com.it_crowd.youtrack.api.rest.Issue;
14 31 import pl.com.it_crowd.youtrack.api.rest.Issues;
  32 +import pl.com.it_crowd.youtrack.api.rest.ObjectFactory;
15 33
  34 +import javax.net.ssl.SSLContext;
  35 +import javax.net.ssl.TrustManager;
  36 +import javax.net.ssl.X509TrustManager;
  37 +import javax.xml.bind.JAXBElement;
16 38 import javax.xml.bind.JAXBException;
17 39 import java.io.IOException;
18   -import java.net.MalformedURLException;
19   -import java.net.URL;
20   -import java.security.GeneralSecurityException;
  40 +import java.net.URI;
  41 +import java.net.URISyntaxException;
  42 +import java.security.KeyManagementException;
  43 +import java.security.NoSuchAlgorithmException;
  44 +import java.security.SecureRandom;
  45 +import java.security.cert.CertificateException;
  46 +import java.security.cert.X509Certificate;
21 47 import java.util.ArrayList;
  48 +import java.util.Arrays;
22 49 import java.util.List;
  50 +import java.util.regex.Matcher;
  51 +import java.util.regex.Pattern;
23 52
24 53 public class YoutrackAPI {
25 54 // ------------------------------ FIELDS ------------------------------
26 55
  56 + private HttpClient httpClient;
  57 +
27 58 private String serviceLocation;
28 59
29   - private WebClient webClient;
  60 +// -------------------------- STATIC METHODS --------------------------
  61 +
  62 + private static HttpClient getDefaultHttpClient()
  63 + {
  64 + SSLContext sslContext;
  65 + try {
  66 + sslContext = SSLContext.getInstance("SSL");
  67 + } catch (NoSuchAlgorithmException e) {
  68 + throw new RuntimeException(e);
  69 + }
  70 + // set up a TrustManager that trusts everything
  71 + try {
  72 + sslContext.init(null, new TrustManager[]{new X509TrustManager() {
  73 + public void checkClientTrusted(X509Certificate[] x509Certificates, String s) throws CertificateException
  74 + {
  75 + }
  76 +
  77 + public void checkServerTrusted(X509Certificate[] x509Certificates, String s) throws CertificateException
  78 + {
  79 + }
  80 +
  81 + public X509Certificate[] getAcceptedIssuers()
  82 + {
  83 + return new X509Certificate[0];
  84 + }
  85 + }}, new SecureRandom());
  86 + } catch (KeyManagementException e) {
  87 + throw new RuntimeException(e);
  88 + }
  89 +
  90 + SSLSocketFactory sf = new SSLSocketFactory(sslContext);
  91 + Scheme httpsScheme = new Scheme("https", 443, sf);
  92 + SchemeRegistry schemeRegistry = SchemeRegistryFactory.createDefault();
  93 + schemeRegistry.register(schemeRegistry.unregister("https"));
  94 + schemeRegistry.register(httpsScheme);
  95 +
  96 + ClientConnectionManager cm = new PoolingClientConnectionManager(schemeRegistry);
  97 + return new DefaultHttpClient(cm);
  98 + }
30 99
31 100 // --------------------------- CONSTRUCTORS ---------------------------
32 101
33 102 public YoutrackAPI(String serviceLocation)
34 103 {
  104 + this(serviceLocation, getDefaultHttpClient());
  105 + }
  106 +
  107 + public YoutrackAPI(String serviceLocation, HttpClient httpClient)
  108 + {
35 109 this.serviceLocation = serviceLocation;
36   - this.webClient = new WebClient(BrowserVersion.FIREFOX_3_6);
37   - this.webClient.setJavaScriptEnabled(false);
38   - this.webClient.setCssEnabled(false);
39   - try {
40   - this.webClient.setUseInsecureSSL(true);
41   - } catch (GeneralSecurityException e) {
42   - throw new RuntimeException("Cannot turn on 'Use insecure SSL'", e);
43   - }
  110 + this.httpClient = httpClient;
44 111 }
45 112
46   - public YoutrackAPI(String serviceLocation, String username, String password) throws IOException, AuthenticationException
  113 + public YoutrackAPI(String serviceLocation, String username, String password) throws IOException, JAXBException
47 114 {
48 115 this(serviceLocation);
49 116 login(username, password);
... ... @@ -58,68 +125,184 @@ public class YoutrackAPI {
58 125
59 126 // -------------------------- OTHER METHODS --------------------------
60 127
61   - public void login(String username, String password) throws IOException, AuthenticationException
  128 + /**
  129 + * Creates new issue on Youtrack.
  130 + *
  131 + * @param project project to create issue in
  132 + * @param summary summary of the issue
  133 + * @param description longer description of the issue
  134 + *
  135 + * @return issue id of created issue
  136 + *
  137 + * @throws IOException in case of communication problems
  138 + */
  139 + public String createIssue(String project, String summary, String description) throws IOException
  140 + {
  141 + final URI uri;
  142 + try {
  143 + uri = new URIBuilder(serviceLocation + "/rest/issue").addParameter("project", project)
  144 + .addParameter("summary", summary)
  145 + .addParameter("description", description)
  146 + .build();
  147 + } catch (URISyntaxException e) {
  148 + throw new RuntimeException(e);
  149 + }
  150 + final HttpResponse response = httpClient.execute(new HttpPut(uri));
  151 + final StatusLine statusLine = response.getStatusLine();
  152 + final HttpEntity entity = response.getEntity();
  153 + final String responseText = entity == null ? null : EntityUtils.toString(entity);
  154 + throwExceptionsIfNeeded(statusLine, responseText);
  155 +
  156 + final Header header = response.getFirstHeader(HttpHeaders.LOCATION);
  157 + if (header == null) {
  158 + throw new YoutrackAPIException("Missing location header despite positive status code: " + statusLine.getStatusCode());
  159 + }
  160 + final String issueURL = header.getValue();
  161 + final Matcher matcher = Pattern.compile(".*(" + project + "-\\d+)").matcher(issueURL);
  162 + if (!matcher.find() || matcher.groupCount() < 1) {
  163 + throw new YoutrackAPIException("Cannot extract issue id from issue URL: " + issueURL);
  164 + }
  165 + return matcher.group(1);
  166 + }
  167 +
  168 + public IssueWrapper getIssue(String issueId) throws IOException, JAXBException
62 169 {
63   - ArrayList<NameValuePair> requestParameters = new ArrayList<NameValuePair>();
64   - requestParameters.add(new NameValuePair("login", username));
65   - requestParameters.add(new NameValuePair("password", password));
66   - WebRequest request = new WebRequest(new URL(serviceLocation + "/rest/user/login"), HttpMethod.POST);
67   - request.setRequestParameters(requestParameters);
  170 + final URI uri;
  171 + try {
  172 + uri = new URIBuilder(serviceLocation + "/rest/issue/" + issueId).build();
  173 + } catch (URISyntaxException e) {
  174 + throw new RuntimeException(e);
  175 + }
  176 + final String responseString;
68 177 try {
69   - webClient.getPage(request);
70   - } catch (FailingHttpStatusCodeException e) {
71   - if (e.getStatusCode() == 403) {
72   - DomNode error = ((XmlPage) webClient.getCurrentWindow().getEnclosedPage()).getFirstChild();
73   - if (error != null) {
74   - throw new AuthenticationException(error.getTextContent());
  178 + responseString = execute(new HttpGet(uri));
  179 + } catch (HttpResponseException e) {
  180 + if (e.getStatusCode() == HttpStatus.SC_NOT_FOUND) {
  181 + try {
  182 + final String error = ErrorUnmarshaller.unmarshal(e.getMessage());
  183 + throw new NoResultFoundException(error);
  184 + } catch (JAXBException e1) {
  185 + // TODO we should log on debug level the JAXBException
  186 + throw e;
75 187 }
  188 + } else {
  189 + throw e;
76 190 }
77   - throw e;
  191 + }
  192 + final Object result = YoutrackUnmarshaller.unmarshall(responseString);
  193 + if (result instanceof pl.com.it_crowd.youtrack.api.rest.Issue) {
  194 + return new IssueWrapper((Issue) result);
  195 + } else if (result instanceof JAXBElement) {
  196 + final JAXBElement jaxbElement = (JAXBElement) result;
  197 + if (ObjectFactory._Error_QNAME.equals(jaxbElement.getName())) {
  198 + throw new RuntimeException("Unexpected type: " + jaxbElement.getValue());
  199 + } else if (ObjectFactory._Issue_QNAME.equals(jaxbElement.getName())) {
  200 + return new IssueWrapper((Issue) jaxbElement.getValue());
  201 + } else {
  202 + throw new RuntimeException(jaxbElement.getValue() + "");
  203 + }
  204 + } else {
  205 + throw new RuntimeException("Unexpected type " + result);
78 206 }
79 207 }
80 208
81   - public List<Issue> searchIssuesByProject(String project, Object filter) throws JAXBException, IOException
  209 + public void login(String username, String password) throws IOException, JAXBException
82 210 {
83   - String url = serviceLocation + "/rest/issue/byproject/" + project + "?filter=" + filter;
84   - WebResponse webResponse = webClient.<Page>getPage(url).getWebResponse();
  211 + final HttpPost request = new HttpPost(serviceLocation + "/rest/user/login");
  212 + request.setEntity(new UrlEncodedFormEntity(Arrays.asList(new BasicNameValuePair("login", username), new BasicNameValuePair("password", password))));
  213 + try {
  214 + execute(request);
  215 + } catch (HttpResponseException e) {
  216 + if (e.getStatusCode() == HttpStatus.SC_FORBIDDEN) {
  217 + try {
  218 + final String error = ErrorUnmarshaller.unmarshal(e.getMessage());
  219 + throw new YoutrackErrorException(error, e.getStatusCode());
  220 + } catch (JAXBException e1) {
  221 + // TODO we should log on debug level the JAXBException
  222 + throw e;
  223 + }
  224 + } else {
  225 + throw e;
  226 + }
  227 + }
  228 + }
85 229
86   - List<Issues.Issue> issues = IssuesUnmarshaller.unmarshal(webResponse.getContentAsStream()).getIssue();
87   - List<Issue> result = new ArrayList<Issue>();
88   - for (Issues.Issue issue : issues) {
89   - result.add(new Issue(issue));
  230 + public List<IssueWrapper> searchIssuesByProject(String project, Object filter) throws JAXBException, IOException
  231 + {
  232 + final URI uri;
  233 + try {
  234 + uri = new URIBuilder(serviceLocation + "/rest/issue/byproject/" + project).addParameter("filter", filter == null ? null : filter.toString())
  235 + .build();
  236 + } catch (URISyntaxException e) {
  237 + throw new RuntimeException(e);
  238 + }
  239 + final Object result = YoutrackUnmarshaller.unmarshall(execute(new HttpGet(uri)));
  240 + if (!(result instanceof Issues)) {
  241 + throw new YoutrackAPIException("Unmarshalling problem. Expected Issues, received: " + result.getClass() + " " + result);
  242 + }
  243 + List<Issue> issues = ((Issues) result).getIssues();
  244 + List<IssueWrapper> wrappedIssues = new ArrayList<IssueWrapper>();
  245 + for (Issue issue : issues) {
  246 + wrappedIssues.add(new IssueWrapper(issue));
90 247 }
91   - return result;
  248 + return wrappedIssues;
92 249 }
93 250
94 251 public void setTotalBilledHours(String issueSignature, Long billedHours)
95 252 {
96   - String url = serviceLocation + "/rest/issue/" + issueSignature + "/execute";
97   - ArrayList<NameValuePair> requestParameters = new ArrayList<NameValuePair>();
98   - requestParameters.add(new NameValuePair("command", "Billed hours " + billedHours));
  253 + //QA-SUGGESTION this method should not be in this project, remove it from this class
  254 + final URI uri;
99 255 try {
100   - WebRequest request = new WebRequest(new URL(url), HttpMethod.POST);
101   - request.setRequestParameters(requestParameters);
102   - webClient.getPage(request);
103   - } catch (MalformedURLException e) {
104   - e.printStackTrace();
  256 + uri = new URIBuilder(serviceLocation + "/rest/issue/" + issueSignature + "/execute").build();
  257 + } catch (URISyntaxException e) {
  258 + throw new RuntimeException(e);
  259 + }
  260 + try {
  261 + final HttpPost request = new HttpPost(uri);
  262 + request.getParams().setParameter("command", "Billed hours " + billedHours);
  263 + execute(request);
105 264 } catch (IOException e) {
106   - e.printStackTrace();
  265 + throw new RuntimeException(e);
107 266 }
108 267 }
109 268
110 269 public void setTotalIssueDuration(String issueSignature, Long issueTotalDuration)
111 270 {
112   - String url = serviceLocation + "/rest/issue/" + issueSignature + "/execute";
113   - ArrayList<NameValuePair> requestParameters = new ArrayList<NameValuePair>();
114   - requestParameters.add(new NameValuePair("command", "Real completion time " + issueTotalDuration));
  271 + //QA-SUGGESTION this method should not be in this project, remove it from this class
  272 + final URI uri;
  273 + try {
  274 + uri = new URIBuilder(serviceLocation + "/rest/issue/" + issueSignature + "/execute").build();
  275 + } catch (URISyntaxException e) {
  276 + throw new RuntimeException(e);
  277 + }
115 278 try {
116   - WebRequest request = new WebRequest(new URL(url), HttpMethod.POST);
117   - request.setRequestParameters(requestParameters);
118   - webClient.getPage(request);
119   - } catch (MalformedURLException e) {
120   - e.printStackTrace();
  279 + final HttpPost request = new HttpPost(uri);
  280 + request.getParams().setParameter("command", "Real completion time " + issueTotalDuration);
  281 + execute(request);
121 282 } catch (IOException e) {
122   - e.printStackTrace();
  283 + throw new RuntimeException(e);
  284 + }
  285 + }
  286 +
  287 + private String execute(HttpUriRequest request) throws IOException
  288 + {
  289 + final HttpResponse response = httpClient.execute(request);
  290 + final StatusLine statusLine = response.getStatusLine();
  291 + final HttpEntity entity = response.getEntity();
  292 + String responseText = entity == null ? null : EntityUtils.toString(entity);
  293 + if (statusLine.getStatusCode() >= 300) {
  294 + throw new HttpResponseException(statusLine.getStatusCode(), responseText);
  295 + }
  296 + if (entity == null) {
  297 + throw new ClientProtocolException("Response contains no content");
  298 + }
  299 + return responseText;
  300 + }
  301 +
  302 + private void throwExceptionsIfNeeded(StatusLine statusLine, String responseText) throws IOException
  303 + {
  304 + if (statusLine.getStatusCode() >= 300) {
  305 + throw new HttpResponseException(statusLine.getStatusCode(), responseText);
123 306 }
124 307 }
125 308 }
\ No newline at end of file
... ...
  1 +package pl.com.it_crowd.youtrack.api;
  2 +
  3 +import pl.com.it_crowd.youtrack.api.rest.ObjectFactory;
  4 +
  5 +import javax.xml.bind.JAXBContext;
  6 +import javax.xml.bind.JAXBException;
  7 +import java.io.Reader;
  8 +import java.io.StringReader;
  9 +
  10 +public final class YoutrackUnmarshaller {
  11 +// -------------------------- STATIC METHODS --------------------------
  12 +
  13 + public static Object unmarshall(String string) throws JAXBException
  14 + {
  15 + return unmarshall(new StringReader(string));
  16 + }
  17 +
  18 + public static Object unmarshall(Reader reader) throws JAXBException
  19 + {
  20 + return JAXBContext.newInstance(ObjectFactory.class).createUnmarshaller().unmarshal(reader);
  21 + }
  22 +
  23 +// --------------------------- CONSTRUCTORS ---------------------------
  24 +
  25 + private YoutrackUnmarshaller()
  26 + {
  27 + }
  28 +}
... ...
  1 +package pl.com.it_crowd.youtrack.api.exceptions;
  2 +
  3 +public class NoResultFoundException extends RuntimeException {
  4 +// --------------------------- CONSTRUCTORS ---------------------------
  5 +
  6 + public NoResultFoundException()
  7 + {
  8 + }
  9 +
  10 + public NoResultFoundException(String message)
  11 + {
  12 + super(message);
  13 + }
  14 +}
... ...
  1 +package pl.com.it_crowd.youtrack.api.exceptions;
  2 +
  3 +public class YoutrackAPIException extends RuntimeException {
  4 +// --------------------------- CONSTRUCTORS ---------------------------
  5 +
  6 + public YoutrackAPIException()
  7 + {
  8 + }
  9 +
  10 + public YoutrackAPIException(String message)
  11 + {
  12 + super(message);
  13 + }
  14 +}
... ...
  1 +package pl.com.it_crowd.youtrack.api.exceptions;
  2 +
  3 +public class YoutrackErrorException extends RuntimeException {
  4 +// ------------------------------ FIELDS ------------------------------
  5 +
  6 + private int statusCode;
  7 +
  8 +// --------------------------- CONSTRUCTORS ---------------------------
  9 +
  10 + public YoutrackErrorException(String message, int statusCode)
  11 + {
  12 + super(message);
  13 + this.statusCode = statusCode;
  14 + }
  15 +
  16 +// --------------------- GETTER / SETTER METHODS ---------------------
  17 +
  18 + public int getStatusCode()
  19 + {
  20 + return statusCode;
  21 + }
  22 +}
... ...
  1 +//
  2 +// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, vhudson-jaxb-ri-2.1-833
  3 +// See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a>
  4 +// Any modifications to this file will be lost upon recompilation of the source schema.
  5 +// Generated on: 2012.07.02 at 11:11:34 PM CEST
  6 +//
  7 +
  8 +package pl.com.it_crowd.youtrack.api.rest;
  9 +
  10 +import javax.xml.bind.JAXBElement;
  11 +import javax.xml.bind.annotation.XmlAccessType;
  12 +import javax.xml.bind.annotation.XmlAccessorType;
  13 +import javax.xml.bind.annotation.XmlAttribute;
  14 +import javax.xml.bind.annotation.XmlElementRef;
  15 +import javax.xml.bind.annotation.XmlElementRefs;
  16 +import javax.xml.bind.annotation.XmlMixed;
  17 +import javax.xml.bind.annotation.XmlType;
  18 +import javax.xml.bind.annotation.XmlValue;
  19 +import java.io.Serializable;
  20 +import java.util.ArrayList;
  21 +import java.util.List;
  22 +
  23 +/**
  24 + * <p>Java class for commentType complex type.
  25 + * <p/>
  26 + * <p>The following schema fragment specifies the expected content contained within this class.
  27 + * <p/>
  28 + * <pre>
  29 + * &lt;complexType name="commentType">
  30 + * &lt;complexContent>
  31 + * &lt;restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
  32 + * &lt;sequence>
  33 + * &lt;element name="replies" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
  34 + * &lt;element name="value" maxOccurs="unbounded" minOccurs="0">
  35 + * &lt;complexType>
  36 + * &lt;simpleContent>
  37 + * &lt;extension base="&lt;http://www.w3.org/2001/XMLSchema>string">
  38 + * &lt;attribute name="type" type="{http://www.w3.org/2001/XMLSchema}string" />
  39 + * &lt;attribute name="role" type="{http://www.w3.org/2001/XMLSchema}string" />
  40 + * &lt;/extension>
  41 + * &lt;/simpleContent>
  42 + * &lt;/complexType>
  43 + * &lt;/element>
  44 + * &lt;/sequence>
  45 + * &lt;attribute name="id" type="{http://www.w3.org/2001/XMLSchema}string" />
  46 + * &lt;attribute name="author" type="{http://www.w3.org/2001/XMLSchema}string" />
  47 + * &lt;attribute name="issueId" type="{http://www.w3.org/2001/XMLSchema}string" />
  48 + * &lt;attribute name="deleted" type="{http://www.w3.org/2001/XMLSchema}string" />
  49 + * &lt;attribute name="text" type="{http://www.w3.org/2001/XMLSchema}string" />
  50 + * &lt;attribute name="shownForIssueAuthor" type="{http://www.w3.org/2001/XMLSchema}string" />
  51 + * &lt;attribute name="created" type="{http://www.w3.org/2001/XMLSchema}long" />
  52 + * &lt;attribute name="name" type="{http://www.w3.org/2001/XMLSchema}string" />
  53 + * &lt;/restriction>
  54 + * &lt;/complexContent>
  55 + * &lt;/complexType>
  56 + * </pre>
  57 + */
  58 +@XmlAccessorType(XmlAccessType.FIELD)
  59 +@XmlType(name = "commentType", propOrder = {"content"})
  60 +public class Comment {
  61 +// ------------------------------ FIELDS ------------------------------
  62 +
  63 + @XmlAttribute
  64 + protected String author;
  65 +
  66 + @XmlElementRefs({@XmlElementRef(name = "value", type = JAXBElement.class), @XmlElementRef(name = "replies", type = JAXBElement.class)})
  67 + @XmlMixed
  68 + protected List<Serializable> content;
  69 +
  70 + @XmlAttribute
  71 + protected Long created;
  72 +
  73 + @XmlAttribute
  74 + protected String deleted;
  75 +
  76 + @XmlAttribute
  77 + protected String id;
  78 +
  79 + @XmlAttribute
  80 + protected String issueId;
  81 +
  82 + @XmlAttribute
  83 + protected String name;
  84 +
  85 + @XmlAttribute
  86 + protected String shownForIssueAuthor;
  87 +
  88 + @XmlAttribute
  89 + protected String text;
  90 +
  91 +// --------------------- GETTER / SETTER METHODS ---------------------
  92 +
  93 + /**
  94 + * Gets the value of the author property.
  95 + *
  96 + * @return possible object is
  97 + * {@link String }
  98 + */
  99 + public String getAuthor()
  100 + {
  101 + return author;
  102 + }
  103 +
  104 + /**
  105 + * Sets the value of the author property.
  106 + *
  107 + * @param value allowed object is
  108 + * {@link String }
  109 + */
  110 + public void setAuthor(String value)
  111 + {
  112 + this.author = value;
  113 + }
  114 +
  115 + /**
  116 + * Gets the value of the content property.
  117 + * <p/>
  118 + * <p/>
  119 + * This accessor method returns a reference to the live list,
  120 + * not a snapshot. Therefore any modification you make to the
  121 + * returned list will be present inside the JAXB object.
  122 + * This is why there is not a <CODE>set</CODE> method for the content property.
  123 + * <p/>
  124 + * <p/>
  125 + * For example, to add a new item, do as follows:
  126 + * <pre>
  127 + * getContent().add(newItem);
  128 + * </pre>
  129 + * <p/>
  130 + * <p/>
  131 + * <p/>
  132 + * Objects of the following type(s) are allowed in the list
  133 + * {@link JAXBElement }{@code <}{@link String }{@code >}
  134 + * {@link JAXBElement }{@code <}{@link Comment.Value }{@code >}
  135 + * {@link String }
  136 + */
  137 + public List<Serializable> getContent()
  138 + {
  139 + if (content == null) {
  140 + content = new ArrayList<Serializable>();
  141 + }
  142 + return this.content;
  143 + }
  144 +
  145 + /**
  146 + * Gets the value of the created property.
  147 + *
  148 + * @return possible object is
  149 + * {@link Long }
  150 + */
  151 + public Long getCreated()
  152 + {
  153 + return created;
  154 + }
  155 +
  156 + /**
  157 + * Sets the value of the created property.
  158 + *
  159 + * @param value allowed object is
  160 + * {@link Long }
  161 + */
  162 + public void setCreated(Long value)
  163 + {
  164 + this.created = value;
  165 + }
  166 +
  167 + /**
  168 + * Gets the value of the deleted property.
  169 + *
  170 + * @return possible object is
  171 + * {@link String }
  172 + */
  173 + public String getDeleted()
  174 + {
  175 + return deleted;
  176 + }
  177 +
  178 + /**
  179 + * Sets the value of the deleted property.
  180 + *
  181 + * @param value allowed object is
  182 + * {@link String }
  183 + */
  184 + public void setDeleted(String value)
  185 + {
  186 + this.deleted = value;
  187 + }
  188 +
  189 + /**
  190 + * Gets the value of the id property.
  191 + *
  192 + * @return possible object is
  193 + * {@link String }
  194 + */
  195 + public String getId()
  196 + {
  197 + return id;
  198 + }
  199 +
  200 + /**
  201 + * Sets the value of the id property.
  202 + *
  203 + * @param value allowed object is
  204 + * {@link String }
  205 + */
  206 + public void setId(String value)
  207 + {
  208 + this.id = value;
  209 + }
  210 +
  211 + /**
  212 + * Gets the value of the issueId property.
  213 + *
  214 + * @return possible object is
  215 + * {@link String }
  216 + */
  217 + public String getIssueId()
  218 + {
  219 + return issueId;
  220 + }
  221 +
  222 + /**
  223 + * Sets the value of the issueId property.
  224 + *
  225 + * @param value allowed object is
  226 + * {@link String }
  227 + */
  228 + public void setIssueId(String value)
  229 + {
  230 + this.issueId = value;
  231 + }
  232 +
  233 + /**
  234 + * Gets the value of the name property.
  235 + *
  236 + * @return possible object is
  237 + * {@link String }
  238 + */
  239 + public String getName()
  240 + {
  241 + return name;
  242 + }
  243 +
  244 + /**
  245 + * Sets the value of the name property.
  246 + *
  247 + * @param value allowed object is
  248 + * {@link String }
  249 + */
  250 + public void setName(String value)
  251 + {
  252 + this.name = value;
  253 + }
  254 +
  255 + /**
  256 + * Gets the value of the shownForIssueAuthor property.
  257 + *
  258 + * @return possible object is
  259 + * {@link String }
  260 + */
  261 + public String getShownForIssueAuthor()
  262 + {
  263 + return shownForIssueAuthor;
  264 + }
  265 +
  266 + /**
  267 + * Sets the value of the shownForIssueAuthor property.
  268 + *
  269 + * @param value allowed object is
  270 + * {@link String }
  271 + */
  272 + public void setShownForIssueAuthor(String value)
  273 + {
  274 + this.shownForIssueAuthor = value;
  275 + }
  276 +
  277 + /**
  278 + * Gets the value of the text property.
  279 + *
  280 + * @return possible object is
  281 + * {@link String }
  282 + */
  283 + public String getText()
  284 + {
  285 + return text;
  286 + }
  287 +
  288 + /**
  289 + * Sets the value of the text property.
  290 + *
  291 + * @param value allowed object is
  292 + * {@link String }
  293 + */
  294 + public void setText(String value)
  295 + {
  296 + this.text = value;
  297 + }
  298 +
  299 +// -------------------------- INNER CLASSES --------------------------
  300 +
  301 + /**
  302 + * <p>Java class for anonymous complex type.
  303 + * <p/>
  304 + * <p>The following schema fragment specifies the expected content contained within this class.
  305 + * <p/>
  306 + * <pre>
  307 + * &lt;complexType>
  308 + * &lt;simpleContent>
  309 + * &lt;extension base="&lt;http://www.w3.org/2001/XMLSchema>string">
  310 + * &lt;attribute name="type" type="{http://www.w3.org/2001/XMLSchema}string" />
  311 + * &lt;attribute name="role" type="{http://www.w3.org/2001/XMLSchema}string" />
  312 + * &lt;/extension>
  313 + * &lt;/simpleContent>
  314 + * &lt;/complexType>
  315 + * </pre>
  316 + */
  317 + @XmlAccessorType(XmlAccessType.FIELD)
  318 + @XmlType(name = "", propOrder = {"value"})
  319 + public static class Value {
  320 +// ------------------------------ FIELDS ------------------------------
  321 +
  322 + @XmlAttribute
  323 + protected String role;
  324 +
  325 + @XmlAttribute
  326 + protected String type;
  327 +
  328 + @XmlValue
  329 + protected String value;
  330 +
  331 +// --------------------- GETTER / SETTER METHODS ---------------------
  332 +
  333 + /**
  334 + * Gets the value of the role property.
  335 + *
  336 + * @return possible object is
  337 + * {@link String }
  338 + */
  339 + public String getRole()
  340 + {
  341 + return role;
  342 + }
  343 +
  344 + /**
  345 + * Sets the value of the role property.
  346 + *
  347 + * @param value allowed object is
  348 + * {@link String }
  349 + */
  350 + public void setRole(String value)
  351 + {
  352 + this.role = value;
  353 + }
  354 +
  355 + /**
  356 + * Gets the value of the type property.
  357 + *
  358 + * @return possible object is
  359 + * {@link String }
  360 + */
  361 + public String getType()
  362 + {
  363 + return type;
  364 + }
  365 +
  366 + /**
  367 + * Sets the value of the type property.
  368 + *
  369 + * @param value allowed object is
  370 + * {@link String }
  371 + */
  372 + public void setType(String value)
  373 + {
  374 + this.type = value;
  375 + }
  376 +
  377 + /**
  378 + * Gets the value of the value property.
  379 + *
  380 + * @return possible object is
  381 + * {@link String }
  382 + */
  383 + public String getValue()
  384 + {
  385 + return value;
  386 + }
  387 +
  388 + /**
  389 + * Sets the value of the value property.
  390 + *
  391 + * @param value allowed object is
  392 + * {@link String }
  393 + */
  394 + public void setValue(String value)
  395 + {
  396 + this.value = value;
  397 + }
  398 + }
  399 +}
... ...
  1 +//
  2 +// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, vhudson-jaxb-ri-2.1-833
  3 +// See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a>
  4 +// Any modifications to this file will be lost upon recompilation of the source schema.
  5 +// Generated on: 2012.07.02 at 11:11:34 PM CEST
  6 +//
  7 +
  8 +package pl.com.it_crowd.youtrack.api.rest;
  9 +
  10 +import javax.xml.bind.annotation.XmlAccessType;
  11 +import javax.xml.bind.annotation.XmlAccessorType;
  12 +import javax.xml.bind.annotation.XmlAttribute;
  13 +import javax.xml.bind.annotation.XmlElement;
  14 +import javax.xml.bind.annotation.XmlType;
  15 +import javax.xml.bind.annotation.XmlValue;
  16 +import java.util.ArrayList;
  17 +import java.util.List;
  18 +
  19 +/**
  20 + * <p>Java class for fieldType complex type.
  21 + * <p/>
  22 + * <p>The following schema fragment specifies the expected content contained within this class.
  23 + * <p/>
  24 + * <pre>
  25 + * &lt;complexType name="fieldType">
  26 + * &lt;complexContent>
  27 + * &lt;restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
  28 + * &lt;sequence maxOccurs="unbounded" minOccurs="0">
  29 + * &lt;element name="value">
  30 + * &lt;complexType>
  31 + * &lt;complexContent>
  32 + * &lt;restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
  33 + * &lt;attribute name="type" type="{http://www.w3.org/2001/XMLSchema}string" />
  34 + * &lt;attribute name="role" type="{http://www.w3.org/2001/XMLSchema}string" />
  35 + * &lt;/restriction>
  36 + * &lt;/complexContent>
  37 + * &lt;/complexType>
  38 + * &lt;/element>
  39 + * &lt;/sequence>
  40 + * &lt;attribute name="name" type="{http://www.w3.org/2001/XMLSchema}string" />
  41 + * &lt;/restriction>
  42 + * &lt;/complexContent>
  43 + * &lt;/complexType>
  44 + * </pre>
  45 + */
  46 +@XmlAccessorType(XmlAccessType.FIELD)
  47 +@XmlType(name = "fieldType", propOrder = {"values"})
  48 +public class Field {
  49 +// ------------------------------ FIELDS ------------------------------
  50 +
  51 + @XmlAttribute
  52 + protected String name;
  53 +
  54 + @XmlElement(name = "value")
  55 + protected List<Field.Value> values;
  56 +
  57 +// --------------------- GETTER / SETTER METHODS ---------------------
  58 +
  59 + /**
  60 + * Gets the value of the name property.
  61 + *
  62 + * @return possible object is
  63 + * {@link String }
  64 + */
  65 + public String getName()
  66 + {
  67 + return name;
  68 + }
  69 +
  70 + /**
  71 + * Sets the value of the name property.
  72 + *
  73 + * @param value allowed object is
  74 + * {@link String }
  75 + */
  76 + public void setName(String value)
  77 + {
  78 + this.name = value;
  79 + }
  80 +
  81 + /**
  82 + * Gets the value of the values property.
  83 + * <p/>
  84 + * <p/>
  85 + * This accessor method returns a reference to the live list,
  86 + * not a snapshot. Therefore any modification you make to the
  87 + * returned list will be present inside the JAXB object.
  88 + * This is why there is not a <CODE>set</CODE> method for the values property.
  89 + * <p/>
  90 + * <p/>
  91 + * For example, to add a new item, do as follows:
  92 + * <pre>
  93 + * getValues().add(newItem);
  94 + * </pre>
  95 + * <p/>
  96 + * <p/>
  97 + * <p/>
  98 + * Objects of the following type(s) are allowed in the list
  99 + * {@link Field.Value }
  100 + */
  101 + public List<Field.Value> getValues()
  102 + {
  103 + if (values == null) {
  104 + values = new ArrayList<Field.Value>();
  105 + }
  106 + return this.values;
  107 + }
  108 +
  109 +// -------------------------- INNER CLASSES --------------------------
  110 +
  111 + /**
  112 + * <p>Java class for anonymous complex type.
  113 + * <p/>
  114 + * <p>The following schema fragment specifies the expected content contained within this class.
  115 + * <p/>
  116 + * <pre>
  117 + * &lt;complexType>
  118 + * &lt;complexContent>
  119 + * &lt;restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
  120 + * &lt;attribute name="type" type="{http://www.w3.org/2001/XMLSchema}string" />
  121 + * &lt;attribute name="role" type="{http://www.w3.org/2001/XMLSchema}string" />
  122 + * &lt;/restriction>
  123 + * &lt;/complexContent>
  124 + * &lt;/complexType>
  125 + * </pre>
  126 + */
  127 + @XmlAccessorType(XmlAccessType.FIELD)
  128 + @XmlType(name = "", propOrder = {"content"})
  129 + public static class Value {
  130 +// ------------------------------ FIELDS ------------------------------
  131 +
  132 + @XmlValue
  133 + protected String content;
  134 +
  135 + @XmlAttribute
  136 + protected String role;
  137 +
  138 + @XmlAttribute
  139 + protected String type;
  140 +
  141 +// --------------------- GETTER / SETTER METHODS ---------------------
  142 +
  143 + /**
  144 + * Gets the value of the content property.
  145 + *
  146 + * @return possible object is
  147 + * {@link String }
  148 + */
  149 + public String getContent()
  150 + {
  151 + return content;
  152 + }
  153 +
  154 + /**
  155 + * Sets the value of the content property.
  156 + *
  157 + * @param value allowed object is
  158 + * {@link String }
  159 + */
  160 + public void setContent(String value)
  161 + {
  162 + this.content = value;
  163 + }
  164 +
  165 + /**
  166 + * Gets the value of the role property.
  167 + *
  168 + * @return possible object is
  169 + * {@link String }
  170 + */
  171 + public String getRole()
  172 + {
  173 + return role;
  174 + }
  175 +
  176 + /**
  177 + * Sets the value of the role property.
  178 + *
  179 + * @param value allowed object is
  180 + * {@link String }
  181 + */
  182 + public void setRole(String value)
  183 + {
  184 + this.role = value;
  185 + }
  186 +
  187 + /**
  188 + * Gets the value of the type property.
  189 + *
  190 + * @return possible object is
  191 + * {@link String }
  192 + */
  193 + public String getType()
  194 + {
  195 + return type;
  196 + }
  197 +
  198 + /**
  199 + * Sets the value of the type property.
  200 + *
  201 + * @param value allowed object is
  202 + * {@link String }
  203 + */
  204 + public void setType(String value)
  205 + {
  206 + this.type = value;
  207 + }
  208 + }
  209 +}
... ...
  1 +//
  2 +// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, vhudson-jaxb-ri-2.1-833
  3 +// See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a>
  4 +// Any modifications to this file will be lost upon recompilation of the source schema.
  5 +// Generated on: 2012.07.02 at 11:11:34 PM CEST
  6 +//
  7 +
  8 +package pl.com.it_crowd.youtrack.api.rest;
  9 +
  10 +import javax.xml.bind.annotation.XmlAccessType;
  11 +import javax.xml.bind.annotation.XmlAccessorType;
  12 +import javax.xml.bind.annotation.XmlAttribute;
  13 +import javax.xml.bind.annotation.XmlElement;
  14 +import javax.xml.bind.annotation.XmlElements;
  15 +import javax.xml.bind.annotation.XmlType;
  16 +import java.util.ArrayList;
  17 +import java.util.List;
  18 +
  19 +/**
  20 + * <p>Java class for issueType complex type.
  21 + * <p/>
  22 + * <p>The following schema fragment specifies the expected content contained within this class.
  23 + * <p/>
  24 + * <pre>
  25 + * &lt;complexType name="issueType">
  26 + * &lt;complexContent>
  27 + * &lt;restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
  28 + * &lt;choice maxOccurs="unbounded" minOccurs="0">
  29 + * &lt;element name="field" type="{}fieldType"/>
  30 + * &lt;element name="comment" type="{}commentType"/>
  31 + * &lt;/choice>
  32 + * &lt;attribute name="id" type="{http://www.w3.org/2001/XMLSchema}string" />
  33 + * &lt;/restriction>
  34 + * &lt;/complexContent>
  35 + * &lt;/complexType>
  36 + * </pre>
  37 + */
  38 +@XmlAccessorType(XmlAccessType.FIELD)
  39 +@XmlType(name = "issueType", propOrder = {"fieldOrComment"})
  40 +public class Issue {
  41 +// ------------------------------ FIELDS ------------------------------
  42 +
  43 + @XmlElements({@XmlElement(name = "comment", type = Comment.class), @XmlElement(name = "field", type = Field.class)})
  44 + protected List<Object> fieldOrComment;
  45 +
  46 + @XmlAttribute
  47 + protected String id;
  48 +
  49 +// --------------------- GETTER / SETTER METHODS ---------------------
  50 +
  51 + /**
  52 + * Gets the value of the fieldOrComment property.
  53 + * <p/>
  54 + * <p/>
  55 + * This accessor method returns a reference to the live list,
  56 + * not a snapshot. Therefore any modification you make to the
  57 + * returned list will be present inside the JAXB object.
  58 + * This is why there is not a <CODE>set</CODE> method for the fieldOrComment property.
  59 + * <p/>
  60 + * <p/>
  61 + * For example, to add a new item, do as follows:
  62 + * <pre>
  63 + * getFieldOrComment().add(newItem);
  64 + * </pre>
  65 + * <p/>
  66 + * <p/>
  67 + * <p/>
  68 + * Objects of the following type(s) are allowed in the list
  69 + * {@link Comment }
  70 + * {@link Field }
  71 + */
  72 + public List<Object> getFieldOrComment()
  73 + {
  74 + if (fieldOrComment == null) {
  75 + fieldOrComment = new ArrayList<Object>();
  76 + }
  77 + return this.fieldOrComment;
  78 + }
  79 +
  80 + /**
  81 + * Gets the value of the id property.
  82 + *
  83 + * @return possible object is
  84 + * {@link String }
  85 + */
  86 + public String getId()
  87 + {
  88 + return id;
  89 + }
  90 +
  91 + /**
  92 + * Sets the value of the id property.
  93 + *
  94 + * @param value allowed object is
  95 + * {@link String }
  96 + */
  97 + public void setId(String value)
  98 + {
  99 + this.id = value;
  100 + }
  101 +}
... ...
... ... @@ -2,19 +2,16 @@
2 2 // This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, vhudson-jaxb-ri-2.1-833
3 3 // See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a>
4 4 // Any modifications to this file will be lost upon recompilation of the source schema.
5   -// Generated on: 2011.12.16 at 10:06:20 AM CET
  5 +// Generated on: 2012.07.02 at 11:11:34 PM CEST
6 6 //
7 7
8 8 package pl.com.it_crowd.youtrack.api.rest;
9 9
10 10 import javax.xml.bind.annotation.XmlAccessType;
11 11 import javax.xml.bind.annotation.XmlAccessorType;
12   -import javax.xml.bind.annotation.XmlAttribute;
13 12 import javax.xml.bind.annotation.XmlElement;
14   -import javax.xml.bind.annotation.XmlElements;
15 13 import javax.xml.bind.annotation.XmlRootElement;
16 14 import javax.xml.bind.annotation.XmlType;
17   -import javax.xml.bind.annotation.XmlValue;
18 15 import java.util.ArrayList;
19 16 import java.util.List;
20 17
... ... @@ -27,68 +24,8 @@ import java.util.List;
27 24 * &lt;complexType>
28 25 * &lt;complexContent>
29 26 * &lt;restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
30   - * &lt;sequence>
31   - * &lt;element name="issue" maxOccurs="unbounded" minOccurs="0">
32   - * &lt;complexType>
33   - * &lt;complexContent>
34   - * &lt;restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
35   - * &lt;choice maxOccurs="unbounded" minOccurs="0">
36   - * &lt;element name="field">
37   - * &lt;complexType>
38   - * &lt;complexContent>
39   - * &lt;restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
40   - * &lt;sequence>
41   - * &lt;element name="value" maxOccurs="unbounded" minOccurs="0">
42   - * &lt;complexType>
43   - * &lt;complexContent>
44   - * &lt;restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
45   - * &lt;attribute name="type" type="{http://www.w3.org/2001/XMLSchema}string" />
46   - * &lt;attribute name="role" type="{http://www.w3.org/2001/XMLSchema}string" />
47   - * &lt;/restriction>
48   - * &lt;/complexContent>
49   - * &lt;/complexType>
50   - * &lt;/element>
51   - * &lt;/sequence>
52   - * &lt;attribute name="name" type="{http://www.w3.org/2001/XMLSchema}string" />
53   - * &lt;/restriction>
54   - * &lt;/complexContent>
55   - * &lt;/complexType>
56   - * &lt;/element>
57   - * &lt;element name="comment">
58   - * &lt;complexType>
59   - * &lt;complexContent>
60   - * &lt;restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
61   - * &lt;sequence>
62   - * &lt;element name="replies" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
63   - * &lt;element name="value" minOccurs="0">
64   - * &lt;complexType>
65   - * &lt;simpleContent>
66   - * &lt;extension base="&lt;http://www.w3.org/2001/XMLSchema>string">
67   - * &lt;attribute name="type" type="{http://www.w3.org/2001/XMLSchema}string" />
68   - * &lt;attribute name="role" type="{http://www.w3.org/2001/XMLSchema}string" />
69   - * &lt;/extension>
70   - * &lt;/simpleContent>
71   - * &lt;/complexType>
72   - * &lt;/element>
73   - * &lt;/sequence>
74   - * &lt;attribute name="id" type="{http://www.w3.org/2001/XMLSchema}string" />
75   - * &lt;attribute name="author" type="{http://www.w3.org/2001/XMLSchema}string" />
76   - * &lt;attribute name="issueId" type="{http://www.w3.org/2001/XMLSchema}string" />
77   - * &lt;attribute name="deleted" type="{http://www.w3.org/2001/XMLSchema}string" />
78   - * &lt;attribute name="text" type="{http://www.w3.org/2001/XMLSchema}string" />
79   - * &lt;attribute name="shownForIssueAuthor" type="{http://www.w3.org/2001/XMLSchema}string" />
80   - * &lt;attribute name="created" type="{http://www.w3.org/2001/XMLSchema}string" />
81   - * &lt;attribute name="name" type="{http://www.w3.org/2001/XMLSchema}string" />
82   - * &lt;/restriction>
83   - * &lt;/complexContent>
84   - * &lt;/complexType>
85   - * &lt;/element>
86   - * &lt;/choice>
87   - * &lt;attribute name="id" type="{http://www.w3.org/2001/XMLSchema}string" />
88   - * &lt;/restriction>
89   - * &lt;/complexContent>
90   - * &lt;/complexType>
91   - * &lt;/element>
  27 + * &lt;sequence maxOccurs="unbounded" minOccurs="0">
  28 + * &lt;element name="issue" type="{}issueType"/>
92 29 * &lt;/sequence>
93 30 * &lt;/restriction>
94 31 * &lt;/complexContent>
... ... @@ -96,734 +33,41 @@ import java.util.List;
96 33 * </pre>
97 34 */
98 35 @XmlAccessorType(XmlAccessType.FIELD)
99   -@XmlType(name = "", propOrder = {"issue"})
  36 +@XmlType(name = "", propOrder = {"issues"})
100 37 @XmlRootElement(name = "issues")
101 38 public class Issues {
  39 +// ------------------------------ FIELDS ------------------------------
102 40
103   - protected List<Issues.Issue> issue;
  41 + @XmlElement(name = "issue")
  42 + protected List<Issue> issues;
  43 +
  44 +// --------------------- GETTER / SETTER METHODS ---------------------
104 45
105 46 /**
106   - * Gets the value of the issue property.
  47 + * Gets the value of the issues property.
107 48 * <p/>
108 49 * <p/>
109 50 * This accessor method returns a reference to the live list,
110 51 * not a snapshot. Therefore any modification you make to the
111 52 * returned list will be present inside the JAXB object.
112   - * This is why there is not a <CODE>set</CODE> method for the issue property.
  53 + * This is why there is not a <CODE>set</CODE> method for the issues property.
113 54 * <p/>
114 55 * <p/>
115 56 * For example, to add a new item, do as follows:
116 57 * <pre>
117   - * getIssue().add(newItem);
  58 + * getIssues().add(newItem);
118 59 * </pre>
119 60 * <p/>
120 61 * <p/>
121 62 * <p/>
122 63 * Objects of the following type(s) are allowed in the list
123   - * {@link Issues.Issue }
  64 + * {@link Issue }
124 65 */
125   - public List<Issues.Issue> getIssue()
  66 + public List<Issue> getIssues()
126 67 {
127   - if (issue == null) {
128   - issue = new ArrayList<Issues.Issue>();
129   - }
130   - return this.issue;
131   - }
132   -
133   - /**
134   - * <p>Java class for anonymous complex type.
135   - * <p/>
136   - * <p>The following schema fragment specifies the expected content contained within this class.
137   - * <p/>
138   - * <pre>
139   - * &lt;complexType>
140   - * &lt;complexContent>
141   - * &lt;restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
142   - * &lt;choice maxOccurs="unbounded" minOccurs="0">
143   - * &lt;element name="field">
144   - * &lt;complexType>
145   - * &lt;complexContent>
146   - * &lt;restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
147   - * &lt;sequence>
148   - * &lt;element name="value" maxOccurs="unbounded" minOccurs="0">
149   - * &lt;complexType>
150   - * &lt;complexContent>
151   - * &lt;restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
152   - * &lt;attribute name="type" type="{http://www.w3.org/2001/XMLSchema}string" />
153   - * &lt;attribute name="role" type="{http://www.w3.org/2001/XMLSchema}string" />
154   - * &lt;/restriction>
155   - * &lt;/complexContent>
156   - * &lt;/complexType>
157   - * &lt;/element>
158   - * &lt;/sequence>
159   - * &lt;attribute name="name" type="{http://www.w3.org/2001/XMLSchema}string" />
160   - * &lt;/restriction>
161   - * &lt;/complexContent>
162   - * &lt;/complexType>
163   - * &lt;/element>
164   - * &lt;element name="comment">
165   - * &lt;complexType>
166   - * &lt;complexContent>
167   - * &lt;restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
168   - * &lt;sequence>
169   - * &lt;element name="replies" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
170   - * &lt;element name="value" minOccurs="0">
171   - * &lt;complexType>
172   - * &lt;simpleContent>
173   - * &lt;extension base="&lt;http://www.w3.org/2001/XMLSchema>string">
174   - * &lt;attribute name="type" type="{http://www.w3.org/2001/XMLSchema}string" />
175   - * &lt;attribute name="role" type="{http://www.w3.org/2001/XMLSchema}string" />
176   - * &lt;/extension>
177   - * &lt;/simpleContent>
178   - * &lt;/complexType>
179   - * &lt;/element>
180   - * &lt;/sequence>
181   - * &lt;attribute name="id" type="{http://www.w3.org/2001/XMLSchema}string" />
182   - * &lt;attribute name="author" type="{http://www.w3.org/2001/XMLSchema}string" />
183   - * &lt;attribute name="issueId" type="{http://www.w3.org/2001/XMLSchema}string" />
184   - * &lt;attribute name="deleted" type="{http://www.w3.org/2001/XMLSchema}string" />
185   - * &lt;attribute name="text" type="{http://www.w3.org/2001/XMLSchema}string" />
186   - * &lt;attribute name="shownForIssueAuthor" type="{http://www.w3.org/2001/XMLSchema}string" />
187   - * &lt;attribute name="created" type="{http://www.w3.org/2001/XMLSchema}string" />
188   - * &lt;attribute name="name" type="{http://www.w3.org/2001/XMLSchema}string" />
189   - * &lt;/restriction>
190   - * &lt;/complexContent>
191   - * &lt;/complexType>
192   - * &lt;/element>
193   - * &lt;/choice>
194   - * &lt;attribute name="id" type="{http://www.w3.org/2001/XMLSchema}string" />
195   - * &lt;/restriction>
196   - * &lt;/complexContent>
197   - * &lt;/complexType>
198   - * </pre>
199   - */
200   - @XmlAccessorType(XmlAccessType.FIELD)
201   - @XmlType(name = "", propOrder = {"fieldOrComment"})
202   - public static class Issue {
203   -
204   - @XmlElements({@XmlElement(name = "field", type = Issues.Issue.Field.class), @XmlElement(name = "comment", type = Issues.Issue.Comment.class)})
205   - protected List<Object> fieldOrComment;
206   -
207   - @XmlAttribute
208   - protected String id;
209   -
210   - /**
211   - * Gets the value of the fieldOrComment property.
212   - * <p/>
213   - * <p/>
214   - * This accessor method returns a reference to the live list,
215   - * not a snapshot. Therefore any modification you make to the
216   - * returned list will be present inside the JAXB object.
217   - * This is why there is not a <CODE>set</CODE> method for the fieldOrComment property.
218   - * <p/>
219   - * <p/>
220   - * For example, to add a new item, do as follows:
221   - * <pre>
222   - * getFieldOrComment().add(newItem);
223   - * </pre>
224   - * <p/>
225   - * <p/>
226   - * <p/>
227   - * Objects of the following type(s) are allowed in the list
228   - * {@link Issues.Issue.Field }
229   - * {@link Issues.Issue.Comment }
230   - */
231   - public List<Object> getFieldOrComment()
232   - {
233   - if (fieldOrComment == null) {
234   - fieldOrComment = new ArrayList<Object>();
235   - }
236   - return this.fieldOrComment;
237   - }
238   -
239   - /**
240   - * Gets the value of the id property.
241   - *
242   - * @return possible object is
243   - * {@link String }
244   - */
245   - public String getId()
246   - {
247   - return id;
248   - }
249   -
250   - /**
251   - * Sets the value of the id property.
252   - *
253   - * @param value allowed object is
254   - * {@link String }
255   - */
256   - public void setId(String value)
257   - {
258   - this.id = value;
259   - }
260   -
261   - /**
262   - * <p>Java class for anonymous complex type.
263   - * <p/>
264   - * <p>The following schema fragment specifies the expected content contained within this class.
265   - * <p/>
266   - * <pre>
267   - * &lt;complexType>
268   - * &lt;complexContent>
269   - * &lt;restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
270   - * &lt;sequence>
271   - * &lt;element name="replies" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
272   - * &lt;element name="value" minOccurs="0">
273   - * &lt;complexType>
274   - * &lt;simpleContent>
275   - * &lt;extension base="&lt;http://www.w3.org/2001/XMLSchema>string">
276   - * &lt;attribute name="type" type="{http://www.w3.org/2001/XMLSchema}string" />
277   - * &lt;attribute name="role" type="{http://www.w3.org/2001/XMLSchema}string" />
278   - * &lt;/extension>
279   - * &lt;/simpleContent>
280   - * &lt;/complexType>
281   - * &lt;/element>
282   - * &lt;/sequence>
283   - * &lt;attribute name="id" type="{http://www.w3.org/2001/XMLSchema}string" />
284   - * &lt;attribute name="author" type="{http://www.w3.org/2001/XMLSchema}string" />
285   - * &lt;attribute name="issueId" type="{http://www.w3.org/2001/XMLSchema}string" />
286   - * &lt;attribute name="deleted" type="{http://www.w3.org/2001/XMLSchema}string" />
287   - * &lt;attribute name="text" type="{http://www.w3.org/2001/XMLSchema}string" />
288   - * &lt;attribute name="shownForIssueAuthor" type="{http://www.w3.org/2001/XMLSchema}string" />
289   - * &lt;attribute name="created" type="{http://www.w3.org/2001/XMLSchema}string" />
290   - * &lt;attribute name="name" type="{http://www.w3.org/2001/XMLSchema}string" />
291   - * &lt;/restriction>
292   - * &lt;/complexContent>
293   - * &lt;/complexType>
294   - * </pre>
295   - */
296   - @XmlAccessorType(XmlAccessType.FIELD)
297   - @XmlType(name = "", propOrder = {"replies", "value"})
298   - public static class Comment {
299   -
300   - protected String replies;
301   -
302   - protected Issues.Issue.Comment.Value value;
303   -
304   - @XmlAttribute
305   - protected String id;
306   -
307   - @XmlAttribute
308   - protected String author;
309   -
310   - @XmlAttribute
311   - protected String issueId;
312   -
313   - @XmlAttribute
314   - protected String deleted;
315   -
316   - @XmlAttribute
317   - protected String text;
318   -
319   - @XmlAttribute
320   - protected String shownForIssueAuthor;
321   -
322   - @XmlAttribute
323   - protected String created;
324   -
325   - @XmlAttribute
326   - protected String name;
327   -
328   - /**
329   - * Gets the value of the replies property.
330   - *
331   - * @return possible object is
332   - * {@link String }
333   - */
334   - public String getReplies()
335   - {
336   - return replies;
337   - }
338   -
339   - /**
340   - * Sets the value of the replies property.
341   - *
342   - * @param value allowed object is
343   - * {@link String }
344   - */
345   - public void setReplies(String value)
346   - {
347   - this.replies = value;
348   - }
349   -
350   - /**
351   - * Gets the value of the value property.
352   - *
353   - * @return possible object is
354   - * {@link Issues.Issue.Comment.Value }
355   - */
356   - public Issues.Issue.Comment.Value getValue()
357   - {
358   - return value;
359   - }
360   -
361   - /**
362   - * Sets the value of the value property.
363   - *
364   - * @param value allowed object is
365   - * {@link Issues.Issue.Comment.Value }
366   - */
367   - public void setValue(Issues.Issue.Comment.Value value)
368   - {
369   - this.value = value;
370   - }
371   -
372   - /**
373   - * Gets the value of the id property.
374   - *
375   - * @return possible object is
376   - * {@link String }
377   - */
378   - public String getId()
379   - {
380   - return id;
381   - }
382   -
383   - /**
384   - * Sets the value of the id property.
385   - *
386   - * @param value allowed object is
387   - * {@link String }
388   - */
389   - public void setId(String value)
390   - {
391   - this.id = value;
392   - }
393   -
394   - /**
395   - * Gets the value of the author property.
396   - *
397   - * @return possible object is
398   - * {@link String }
399   - */
400   - public String getAuthor()
401   - {
402   - return author;
403   - }
404   -
405   - /**
406   - * Sets the value of the author property.
407   - *
408   - * @param value allowed object is
409   - * {@link String }
410   - */
411   - public void setAuthor(String value)
412   - {
413   - this.author = value;
414   - }
415   -
416   - /**
417   - * Gets the value of the issueId property.
418   - *
419   - * @return possible object is
420   - * {@link String }
421   - */
422   - public String getIssueId()
423   - {
424   - return issueId;
425   - }
426   -
427   - /**
428   - * Sets the value of the issueId property.
429   - *
430   - * @param value allowed object is
431   - * {@link String }
432   - */
433   - public void setIssueId(String value)
434   - {
435   - this.issueId = value;
436   - }
437   -
438   - /**
439   - * Gets the value of the deleted property.
440   - *
441   - * @return possible object is
442   - * {@link String }
443   - */
444   - public String getDeleted()
445   - {
446   - return deleted;
447   - }
448   -
449   - /**
450   - * Sets the value of the deleted property.
451   - *
452   - * @param value allowed object is
453   - * {@link String }
454   - */
455   - public void setDeleted(String value)
456   - {
457   - this.deleted = value;
458   - }
459   -
460   - /**
461   - * Gets the value of the text property.
462   - *
463   - * @return possible object is
464   - * {@link String }
465   - */
466   - public String getText()
467   - {
468   - return text;
469   - }
470   -
471   - /**
472   - * Sets the value of the text property.
473   - *
474   - * @param value allowed object is
475   - * {@link String }
476   - */
477   - public void setText(String value)
478   - {
479   - this.text = value;
480   - }
481   -
482   - /**
483   - * Gets the value of the shownForIssueAuthor property.
484   - *
485   - * @return possible object is
486   - * {@link String }
487   - */
488   - public String getShownForIssueAuthor()
489   - {
490   - return shownForIssueAuthor;
491   - }
492   -
493   - /**
494   - * Sets the value of the shownForIssueAuthor property.
495   - *
496   - * @param value allowed object is
497   - * {@link String }
498   - */
499   - public void setShownForIssueAuthor(String value)
500   - {
501   - this.shownForIssueAuthor = value;
502   - }
503   -
504   - /**
505   - * Gets the value of the created property.
506   - *
507   - * @return possible object is
508   - * {@link String }
509   - */
510   - public String getCreated()
511   - {
512   - return created;
513   - }
514   -
515   - /**
516   - * Sets the value of the created property.
517   - *
518   - * @param value allowed object is
519   - * {@link String }
520   - */
521   - public void setCreated(String value)
522   - {
523   - this.created = value;
524   - }
525   -
526   - /**
527   - * Gets the value of the name property.
528   - *
529   - * @return possible object is
530   - * {@link String }
531   - */
532   - public String getName()
533   - {
534   - return name;
535   - }
536   -
537   - /**
538   - * Sets the value of the name property.
539   - *
540   - * @param value allowed object is
541   - * {@link String }
542   - */
543   - public void setName(String value)
544   - {
545   - this.name = value;
546   - }
547   -
548   - /**
549   - * <p>Java class for anonymous complex type.
550   - * <p/>
551   - * <p>The following schema fragment specifies the expected content contained within this class.
552   - * <p/>
553   - * <pre>
554   - * &lt;complexType>
555   - * &lt;simpleContent>
556   - * &lt;extension base="&lt;http://www.w3.org/2001/XMLSchema>string">
557   - * &lt;attribute name="type" type="{http://www.w3.org/2001/XMLSchema}string" />
558   - * &lt;attribute name="role" type="{http://www.w3.org/2001/XMLSchema}string" />
559   - * &lt;/extension>
560   - * &lt;/simpleContent>
561   - * &lt;/complexType>
562   - * </pre>
563   - */
564   - @XmlAccessorType(XmlAccessType.FIELD)
565   - @XmlType(name = "", propOrder = {"value"})
566   - public static class Value {
567   -
568   - @XmlValue
569   - protected String value;
570   -
571   - @XmlAttribute
572   - protected String type;
573   -
574   - @XmlAttribute
575   - protected String role;
576   -
577   - /**
578   - * Gets the value of the value property.
579   - *
580   - * @return possible object is
581   - * {@link String }
582   - */
583   - public String getValue()
584   - {
585   - return value;
586   - }
587   -
588   - /**
589   - * Sets the value of the value property.
590   - *
591   - * @param value allowed object is
592   - * {@link String }
593   - */
594   - public void setValue(String value)
595   - {
596   - this.value = value;
597   - }
598   -
599   - /**
600   - * Gets the value of the type property.
601   - *
602   - * @return possible object is
603   - * {@link String }
604   - */
605   - public String getType()
606   - {
607   - return type;
608   - }
609   -
610   - /**
611   - * Sets the value of the type property.
612   - *
613   - * @param value allowed object is
614   - * {@link String }
615   - */
616   - public void setType(String value)
617   - {
618   - this.type = value;
619   - }
620   -
621   - /**
622   - * Gets the value of the role property.
623   - *
624   - * @return possible object is
625   - * {@link String }
626   - */
627   - public String getRole()
628   - {
629   - return role;
630   - }
631   -
632   - /**
633   - * Sets the value of the role property.
634   - *
635   - * @param value allowed object is
636   - * {@link String }
637   - */
638   - public void setRole(String value)
639   - {
640   - this.role = value;
641   - }
642   - }
643   - }
644   -
645   - /**
646   - * <p>Java class for anonymous complex type.
647   - * <p/>
648   - * <p>The following schema fragment specifies the expected content contained within this class.
649   - * <p/>
650   - * <pre>
651   - * &lt;complexType>
652   - * &lt;complexContent>
653   - * &lt;restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
654   - * &lt;sequence>
655   - * &lt;element name="value" maxOccurs="unbounded" minOccurs="0">
656   - * &lt;complexType>
657   - * &lt;complexContent>
658   - * &lt;restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
659   - * &lt;attribute name="type" type="{http://www.w3.org/2001/XMLSchema}string" />
660   - * &lt;attribute name="role" type="{http://www.w3.org/2001/XMLSchema}string" />
661   - * &lt;/restriction>
662   - * &lt;/complexContent>
663   - * &lt;/complexType>
664   - * &lt;/element>
665   - * &lt;/sequence>
666   - * &lt;attribute name="name" type="{http://www.w3.org/2001/XMLSchema}string" />
667   - * &lt;/restriction>
668   - * &lt;/complexContent>
669   - * &lt;/complexType>
670   - * </pre>
671   - */
672   - @XmlAccessorType(XmlAccessType.FIELD)
673   - @XmlType(name = "", propOrder = {"values"})
674   - public static class Field {
675   -
676   - @XmlElement(name = "value")
677   - protected List<Issues.Issue.Field.Value> values;
678   -
679   - @XmlAttribute
680   - protected String name;
681   -
682   - /**
683   - * Gets the value of the values property.
684   - * <p/>
685   - * <p/>
686   - * This accessor method returns a reference to the live list,
687   - * not a snapshot. Therefore any modification you make to the
688   - * returned list will be present inside the JAXB object.
689   - * This is why there is not a <CODE>set</CODE> method for the values property.
690   - * <p/>
691   - * <p/>
692   - * For example, to add a new item, do as follows:
693   - * <pre>
694   - * getValues().add(newItem);
695   - * </pre>
696   - * <p/>
697   - * <p/>
698   - * <p/>
699   - * Objects of the following type(s) are allowed in the list
700   - * {@link Issues.Issue.Field.Value }
701   - */
702   - public List<Issues.Issue.Field.Value> getValues()
703   - {
704   - if (values == null) {
705   - values = new ArrayList<Issues.Issue.Field.Value>();
706   - }
707   - return this.values;
708   - }
709   -
710   - /**
711   - * Gets the value of the name property.
712   - *
713   - * @return possible object is
714   - * {@link String }
715   - */
716   - public String getName()
717   - {
718   - return name;
719   - }
720   -
721   - /**
722   - * Sets the value of the name property.
723   - *
724   - * @param value allowed object is
725   - * {@link String }
726   - */
727   - public void setName(String value)
728   - {
729   - this.name = value;
730   - }
731   -
732   - /**
733   - * <p>Java class for anonymous complex type.
734   - * <p/>
735   - * <p>The following schema fragment specifies the expected content contained within this class.
736   - * <p/>
737   - * <pre>
738   - * &lt;complexType>
739   - * &lt;complexContent>
740   - * &lt;restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
741   - * &lt;attribute name="type" type="{http://www.w3.org/2001/XMLSchema}string" />
742   - * &lt;attribute name="role" type="{http://www.w3.org/2001/XMLSchema}string" />
743   - * &lt;/restriction>
744   - * &lt;/complexContent>
745   - * &lt;/complexType>
746   - * </pre>
747   - */
748   - @XmlAccessorType(XmlAccessType.FIELD)
749   - @XmlType(name = "", propOrder = {"content"})
750   - public static class Value {
751   -
752   - @XmlValue
753   - protected String content;
754   -
755   - @XmlAttribute
756   - protected String type;
757   -
758   - @XmlAttribute
759   - protected String role;
760   -
761   - /**
762   - * Gets the value of the content property.
763   - *
764   - * @return possible object is
765   - * {@link String }
766   - */
767   - public String getContent()
768   - {
769   - return content;
770   - }
771   -
772   - /**
773   - * Sets the value of the content property.
774   - *
775   - * @param value allowed object is
776   - * {@link String }
777   - */
778   - public void setContent(String value)
779   - {
780   - this.content = value;
781   - }
782   -
783   - /**
784   - * Gets the value of the type property.
785   - *
786   - * @return possible object is
787   - * {@link String }
788   - */
789   - public String getType()
790   - {
791   - return type;
792   - }
793   -
794   - /**
795   - * Sets the value of the type property.
796   - *
797   - * @param value allowed object is
798   - * {@link String }
799   - */
800   - public void setType(String value)
801   - {
802   - this.type = value;
803   - }
804   -
805   - /**
806   - * Gets the value of the role property.
807   - *
808   - * @return possible object is
809   - * {@link String }
810   - */
811   - public String getRole()
812   - {
813   - return role;
814   - }
815   -
816   - /**
817   - * Sets the value of the role property.
818   - *
819   - * @param value allowed object is
820   - * {@link String }
821   - */
822   - public void setRole(String value)
823   - {
824   - this.role = value;
825   - }
826   - }
  68 + if (issues == null) {
  69 + issues = new ArrayList<Issue>();
827 70 }
  71 + return this.issues;
828 72 }
829 73 }
... ...
... ... @@ -2,12 +2,15 @@
2 2 // This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, vhudson-jaxb-ri-2.1-833
3 3 // See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a>
4 4 // Any modifications to this file will be lost upon recompilation of the source schema.
5   -// Generated on: 2011.12.16 at 10:06:20 AM CET
  5 +// Generated on: 2012.07.02 at 11:11:34 PM CEST
6 6 //
7 7
8 8 package pl.com.it_crowd.youtrack.api.rest;
9 9
  10 +import javax.xml.bind.JAXBElement;
  11 +import javax.xml.bind.annotation.XmlElementDecl;
10 12 import javax.xml.bind.annotation.XmlRegistry;
  13 +import javax.xml.namespace.QName;
11 14
12 15 /**
13 16 * This object contains factory methods for each
... ... @@ -24,6 +27,17 @@ import javax.xml.bind.annotation.XmlRegistry;
24 27 */
25 28 @XmlRegistry
26 29 public class ObjectFactory {
  30 +// ------------------------------ FIELDS ------------------------------
  31 +
  32 + public final static QName _Error_QNAME = new QName("", "error");
  33 +
  34 + public final static QName _Issue_QNAME = new QName("", "issue");
  35 +
  36 + private final static QName _CommentReplies_QNAME = new QName("", "replies");
  37 +
  38 + private final static QName _CommentValue_QNAME = new QName("", "value");
  39 +
  40 +// --------------------------- CONSTRUCTORS ---------------------------
27 41
28 42 /**
29 43 * Create a new ObjectFactory that can be used to create new instances of schema derived classes for package: pl.com.it_crowd.youtrack.api.rest
... ... @@ -32,51 +46,89 @@ public class ObjectFactory {
32 46 {
33 47 }
34 48
  49 +// -------------------------- OTHER METHODS --------------------------
  50 +
35 51 /**
36   - * Create an instance of {@link Issues.Issue }
  52 + * Create an instance of {@link Comment }
37 53 */
38   - public Issues.Issue createIssuesIssue()
  54 + public Comment createComment()
39 55 {
40   - return new Issues.Issue();
  56 + return new Comment();
41 57 }
42 58
43 59 /**
44   - * Create an instance of {@link Issues.Issue.Comment }
  60 + * Create an instance of {@link JAXBElement }{@code <}{@link String }{@code >}}
45 61 */
46   - public Issues.Issue.Comment createIssuesIssueComment()
  62 + @XmlElementDecl(namespace = "", name = "replies", scope = Comment.class)
  63 + public JAXBElement<String> createCommentReplies(String value)
47 64 {
48   - return new Issues.Issue.Comment();
  65 + return new JAXBElement<String>(_CommentReplies_QNAME, String.class, Comment.class, value);
49 66 }
50 67
51 68 /**
52   - * Create an instance of {@link Issues }
  69 + * Create an instance of {@link Comment.Value }
53 70 */
54   - public Issues createIssues()
  71 + public Comment.Value createCommentValue()
55 72 {
56   - return new Issues();
  73 + return new Comment.Value();
  74 + }
  75 +
  76 + /**
  77 + * Create an instance of {@link JAXBElement }{@code <}{@link Comment.Value }{@code >}}
  78 + */
  79 + @XmlElementDecl(namespace = "", name = "value", scope = Comment.class)
  80 + public JAXBElement<Comment.Value> createCommentValue(Comment.Value value)
  81 + {
  82 + return new JAXBElement<Comment.Value>(_CommentValue_QNAME, Comment.Value.class, Comment.class, value);
  83 + }
  84 +
  85 + /**
  86 + * Create an instance of {@link JAXBElement }{@code <}{@link String }{@code >}}
  87 + */
  88 + @XmlElementDecl(namespace = "", name = "error")
  89 + public JAXBElement<String> createError(String value)
  90 + {
  91 + return new JAXBElement<String>(_Error_QNAME, String.class, null, value);
  92 + }
  93 +
  94 + /**
  95 + * Create an instance of {@link Field }
  96 + */
  97 + public Field createField()
  98 + {
  99 + return new Field();
57 100 }
58 101
59 102 /**
60   - * Create an instance of {@link Issues.Issue.Comment.Value }
  103 + * Create an instance of {@link Field.Value }
61 104 */
62   - public Issues.Issue.Comment.Value createIssuesIssueCommentValue()
  105 + public Field.Value createFieldValue()
63 106 {
64   - return new Issues.Issue.Comment.Value();
  107 + return new Field.Value();
65 108 }
66 109
67 110 /**
68   - * Create an instance of {@link Issues.Issue.Field.Value }
  111 + * Create an instance of {@link Issue }
69 112 */
70   - public Issues.Issue.Field.Value createIssuesIssueFieldValue()
  113 + public Issue createIssue()
71 114 {
72   - return new Issues.Issue.Field.Value();
  115 + return new Issue();
73 116 }
74 117
75 118 /**
76   - * Create an instance of {@link Issues.Issue.Field }
  119 + * Create an instance of {@link JAXBElement }{@code <}{@link Issue }{@code >}}
77 120 */
78   - public Issues.Issue.Field createIssuesIssueField()
  121 + @XmlElementDecl(namespace = "", name = "issue")
  122 + public JAXBElement<Issue> createIssue(Issue value)
79 123 {
80   - return new Issues.Issue.Field();
  124 + return new JAXBElement<Issue>(_Issue_QNAME, Issue.class, null, value);
  125 + }
  126 +
  127 + /**
  128 + * Create an instance of {@link Issues }
  129 + */
  130 + public Issues createIssues()
  131 + {
  132 + return new Issues();
81 133 }
82 134 }
... ...
1   -<jxb:bindings version="1.0"
2   - xmlns:jxb="http://java.sun.com/xml/ns/jaxb"
3   - xmlns:xs="http://www.w3.org/2001/XMLSchema"
  1 +<jxb:bindings version="1.0" xmlns:jxb="http://java.sun.com/xml/ns/jaxb" xmlns:xs="http://www.w3.org/2001/XMLSchema"
4 2 xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
5   - xsi:schemaLocation="http://java.sun.com/xml/ns/jaxb http://java.sun.com/xml/ns/jaxb/bindingschema_2_0.xsd"
6   - >
  3 + xsi:schemaLocation="http://java.sun.com/xml/ns/jaxb http://java.sun.com/xml/ns/jaxb/bindingschema_2_0.xsd">
  4 +
  5 +
7 6 <jxb:bindings schemaLocation="../xsd/issuesByProject.xsd" node="/xs:schema">
  7 + <jxb:bindings node=".//xs:element[@name='issues']//xs:sequence[@id='issues']">
  8 + <jxb:property name="issues"/>
  9 + </jxb:bindings>
  10 + </jxb:bindings>
  11 +
  12 + <jxb:bindings schemaLocation="../xsd/types.xsd" node="/xs:schema">
8 13
9 14 <jxb:globalBindings localScoping="nested"/>
10   - <jxb:bindings node="//xs:element[@name='issues']">
11   - <jxb:bindings node=".//xs:element[@name='field']">
12   - <jxb:bindings node=".//xs:element[@name='value']">
13   - <jxb:property name="values"/>
14   - </jxb:bindings>
  15 +
  16 + <jxb:bindings node=".//xs:complexType[@name='fieldType']">
  17 + <jxb:bindings node="./xs:sequence[@id='value']">
  18 + <jxb:property name="values"/>
15 19 </jxb:bindings>
  20 + <jxb:class name="Field"/>
16 21 </jxb:bindings>
  22 +
  23 + <jxb:bindings node=".//xs:complexType[@name='issueType']">
  24 + <jxb:class name="Issue"/>
  25 + </jxb:bindings>
  26 +
  27 + <jxb:bindings node=".//xs:complexType[@name='commentType']">
  28 + <jxb:class name="Comment"/>
  29 + </jxb:bindings>
  30 +
17 31 </jxb:bindings>
  32 +
18 33 </jxb:bindings>
\ No newline at end of file
... ...
  1 +<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
  2 +<error xsi:noNamespaceSchemaLocation="error.xsd" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">Incorrect login or password.</error>
\ No newline at end of file
... ...
  1 +<?xml version="1.0" encoding="UTF-8"?>
  2 +<xs:schema attributeFormDefault="unqualified" elementFormDefault="qualified" xmlns:xs="http://www.w3.org/2001/XMLSchema">
  3 + <xs:element name="error" type="xs:string"/>
  4 +</xs:schema>
\ No newline at end of file
... ...
  1 +<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
  2 +<issue xsi:noNamespaceSchemaLocation="issue.xsd" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" id="TST-1">
  3 + <field xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="SingleField" name="projectShortName">
  4 + <value>TST</value>
  5 + </field>
  6 + <field xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="SingleField" name="numberInProject">
  7 + <value>1</value>
  8 + </field>
  9 + <field xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="SingleField" name="summary">
  10 + <value>Example bug</value>
  11 + </field>
  12 + <field xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="SingleField" name="description">
  13 + <value>This is some example bug</value>
  14 + </field>
  15 + <field xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="SingleField" name="created">
  16 + <value>1341232706054</value>
  17 + </field>
  18 + <field xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="SingleField" name="updated">
  19 + <value>1341232706054</value>
  20 + </field>
  21 + <field xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="SingleField" name="updaterName">
  22 + <value>root</value>
  23 + </field>
  24 + <field xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="SingleField" name="updaterFullName">
  25 + <value>root</value>
  26 + </field>
  27 + <field xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="SingleField" name="reporterName">
  28 + <value>root</value>
  29 + </field>
  30 + <field xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="SingleField" name="reporterFullName">
  31 + <value>root</value>
  32 + </field>
  33 + <field xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="SingleField" name="commentsCount">
  34 + <value>0</value>
  35 + </field>
  36 + <field xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="SingleField" name="votes">
  37 + <value>0</value>
  38 + </field>
  39 + <field xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="CustomField" name="Priority">
  40 + <value>Normal</value>
  41 + </field>
  42 + <field xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="CustomField" name="Type">
  43 + <value>Bug</value>
  44 + </field>
  45 + <field xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="CustomField" name="State">
  46 + <value>Submitted</value>
  47 + </field>
  48 + <field xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="CustomField" name="Subsystem">
  49 + <value>No subsystem</value>
  50 + </field>
  51 +</issue>
\ No newline at end of file
... ...
  1 +<?xml version="1.0" encoding="UTF-8"?>
  2 +<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
  3 +
  4 + <xs:include schemaLocation="types.xsd"/>
  5 +
  6 + <xs:element name="issue" type="issueType"/>
  7 +
  8 +</xs:schema>
\ No newline at end of file
... ...
1 1 <?xml version="1.0" encoding="UTF-8" standalone="yes"?>
2   -<issues>
  2 +<issues xsi:noNamespaceSchemaLocation="issuesByProject.xsd" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
  3 +
3 4 <issue id="SM-1">
4 5 <field name="voterName"/>
5 6 <field name="Priority">
... ...
1 1 <?xml version="1.0" encoding="UTF-8"?>
2 2 <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
  3 + <xs:include schemaLocation="types.xsd"/>
3 4 <xs:element name="issues">
4 5 <xs:complexType>
5   - <xs:sequence>
6   - <xs:element name="issue" maxOccurs="unbounded" minOccurs="0">
7   - <xs:complexType>
8   - <xs:choice maxOccurs="unbounded" minOccurs="0">
9   - <xs:element name="field">
10   - <xs:complexType>
11   - <xs:sequence>
12   - <xs:element name="value" maxOccurs="unbounded" minOccurs="0">
13   - <xs:complexType mixed="true">
14   - <xs:attribute type="xs:string" name="type" use="optional"/>
15   - <xs:attribute type="xs:string" name="role" use="optional"/>
16   - </xs:complexType>
17   - </xs:element>
18   - </xs:sequence>
19   - <xs:attribute type="xs:string" name="name" use="optional"/>
20   - </xs:complexType>
21   - </xs:element>
22   - <xs:element name="comment">
23   - <xs:complexType>
24   - <xs:sequence>
25   - <xs:element type="xs:string" name="replies" minOccurs="0"/>
26   - <xs:element name="value" minOccurs="0">
27   - <xs:complexType>
28   - <xs:simpleContent>
29   - <xs:extension base="xs:string">
30   - <xs:attribute type="xs:string" name="type" use="optional"/>
31   - <xs:attribute type="xs:string" name="role" use="optional"/>
32   - </xs:extension>
33   - </xs:simpleContent>
34   - </xs:complexType>
35   - </xs:element>
36   - </xs:sequence>
37   - <xs:attribute type="xs:string" name="id" use="optional"/>
38   - <xs:attribute type="xs:string" name="author" use="optional"/>
39   - <xs:attribute type="xs:string" name="issueId" use="optional"/>
40   - <xs:attribute type="xs:string" name="deleted" use="optional"/>
41   - <xs:attribute type="xs:string" name="text" use="optional"/>
42   - <xs:attribute type="xs:string" name="shownForIssueAuthor" use="optional"/>
43   - <xs:attribute type="xs:string" name="created" use="optional"/>
44   - <xs:attribute type="xs:string" name="name" use="optional"/>
45   - </xs:complexType>
46   - </xs:element>
47   - </xs:choice>
48   - <xs:attribute type="xs:string" name="id" use="optional"/>
49   - </xs:complexType>
50   - </xs:element>
  6 + <xs:sequence id="issues" minOccurs="0" maxOccurs="unbounded">
  7 + <xs:element name="issue" type="issueType"/>
51 8 </xs:sequence>
52 9 </xs:complexType>
53 10 </xs:element>
... ...
  1 +<?xml version="1.0" encoding="UTF-8"?>
  2 +<xs:schema attributeFormDefault="unqualified" elementFormDefault="unqualified" xmlns:xs="http://www.w3.org/2001/XMLSchema" version="1.1.0">
  3 +
  4 +
  5 + <xs:complexType name="fieldType">
  6 + <xs:sequence id="value" maxOccurs="unbounded" minOccurs="0">
  7 + <xs:element name="value">
  8 + <xs:complexType mixed="true">
  9 + <xs:attribute type="xs:string" name="type" use="optional"/>
  10 + <xs:attribute type="xs:string" name="role" use="optional"/>
  11 + </xs:complexType>
  12 + </xs:element>
  13 + </xs:sequence>
  14 + <xs:attribute type="xs:string" name="name" use="optional"/>
  15 + </xs:complexType>
  16 +
  17 + <xs:complexType name="issueType">
  18 + <xs:choice maxOccurs="unbounded" minOccurs="0">
  19 + <xs:element type="fieldType" name="field"/>
  20 + <xs:element type="commentType" name="comment"/>
  21 + </xs:choice>
  22 + <xs:attribute type="xs:string" name="id" use="optional"/>
  23 + </xs:complexType>
  24 + <xs:complexType name="commentType" mixed="true">
  25 + <xs:sequence>
  26 + <xs:element type="xs:string" name="replies" minOccurs="0"/>
  27 + <xs:element name="value" maxOccurs="unbounded" minOccurs="0">
  28 + <xs:complexType>
  29 + <xs:simpleContent>
  30 + <xs:extension base="xs:string">
  31 + <xs:attribute type="xs:string" name="type" use="optional"/>
  32 + <xs:attribute type="xs:string" name="role" use="optional"/>
  33 + </xs:extension>
  34 + </xs:simpleContent>
  35 + </xs:complexType>
  36 + </xs:element>
  37 + </xs:sequence>
  38 + <xs:attribute type="xs:string" name="id" use="optional"/>
  39 + <xs:attribute type="xs:string" name="author" use="optional"/>
  40 + <xs:attribute type="xs:string" name="issueId" use="optional"/>
  41 + <xs:attribute type="xs:string" name="deleted" use="optional"/>
  42 + <xs:attribute type="xs:string" name="text" use="optional"/>
  43 + <xs:attribute type="xs:string" name="shownForIssueAuthor" use="optional"/>
  44 + <xs:attribute type="xs:long" name="created" use="optional"/>
  45 + <xs:attribute type="xs:string" name="name" use="optional"/>
  46 + </xs:complexType>
  47 +</xs:schema>
\ No newline at end of file
... ...
1 1 package pl.com.it_crowd.youtrack.api.rest;
2 2
3 3 import junit.framework.Assert;
  4 +import org.apache.http.HttpStatus;
4 5 import org.apache.http.auth.AuthenticationException;
5 6 import org.junit.Test;
6   -import pl.com.it_crowd.youtrack.api.Issue;
  7 +import pl.com.it_crowd.youtrack.api.IssueWrapper;
7 8 import pl.com.it_crowd.youtrack.api.YoutrackAPI;
  9 +import pl.com.it_crowd.youtrack.api.exceptions.NoResultFoundException;
  10 +import pl.com.it_crowd.youtrack.api.exceptions.YoutrackErrorException;
8 11
9 12 import javax.xml.bind.JAXBException;
10 13 import java.io.IOException;
11 14 import java.util.List;
12 15
13 16 /**
14   - * This test requires setting JVM params youtrackUsername and youtrackPassword.
  17 + * This test requires Youtrack instance with "Test(TST)" project to be running and expects following JVM params:
  18 + * youtrackLocation, youtrackUsername and youtrackPassword.
15 19 */
16 20 public class YoutrackAPITest {
17 21 // -------------------------- OTHER METHODS --------------------------
18 22
19   - @Test(expected = AuthenticationException.class)
20   - public void loginFailureTest() throws IOException, AuthenticationException
  23 + @Test
  24 + public void createIssueTest() throws IOException, AuthenticationException, JAXBException
  25 + {
  26 + YoutrackAPI api = new YoutrackAPI(getServiceLocation(), getUsername(), getPassword());
  27 + final String issueId = api.createIssue("TST", "Test summary", "Test description");
  28 + Assert.assertNotNull(issueId);
  29 + Assert.assertTrue(issueId.startsWith("TST"));
  30 + }
  31 +
  32 + @Test
  33 + public void getIssueTest() throws IOException, AuthenticationException, JAXBException
  34 + {
  35 + YoutrackAPI api = new YoutrackAPI(getServiceLocation(), getUsername(), getPassword());
  36 + final IssueWrapper issue = api.getIssue("TST-1");
  37 + Assert.assertNotNull(issue);
  38 +
  39 + try {
  40 + api.getIssue("TST-2");
  41 + Assert.fail("YoutrackErrorException expected");
  42 + } catch (NoResultFoundException e) {
  43 + Assert.assertEquals("Issue not found.", e.getMessage());
  44 + }
  45 + try {
  46 + api.getIssue("TSTX-1");
  47 + Assert.fail("YoutrackErrorException expected");
  48 + } catch (NoResultFoundException e) {
  49 + Assert.assertEquals("Issue not found.", e.getMessage());
  50 + }
  51 + }
  52 +
  53 + @Test(expected = YoutrackErrorException.class)
  54 + public void loginFailureTest() throws IOException, JAXBException
21 55 {
22 56 final String username = "someFakeLogin";
23 57 final String password = "someFakePassword";
24   - new YoutrackAPI("http://youtrack.it-crowd.com.pl", username, password);
  58 + try {
  59 + new YoutrackAPI(getServiceLocation(), username, password);
  60 + } catch (YoutrackErrorException e) {
  61 + Assert.assertEquals("Incorrect login or password.", e.getMessage());
  62 + Assert.assertEquals(HttpStatus.SC_FORBIDDEN, e.getStatusCode());
  63 + throw e;
  64 + }
25 65 }
26 66
27 67 @Test
28   - public void loginTest() throws IOException, AuthenticationException
  68 + public void loginTest() throws IOException, AuthenticationException, JAXBException
29 69 {
30 70 final String username = getUsername();
31 71 final String password = getPassword();
32   - new YoutrackAPI("http://youtrack.it-crowd.com.pl", username, password);
33   - YoutrackAPI api = new YoutrackAPI("http://youtrack.it-crowd.com.pl");
  72 + new YoutrackAPI(getServiceLocation(), username, password);
  73 + YoutrackAPI api = new YoutrackAPI(getServiceLocation());
34 74 api.login(username, password);
35 75 }
36 76
37 77 @Test
38 78 public void searchIssuesByProjectTest() throws IOException, AuthenticationException, JAXBException
39 79 {
40   - YoutrackAPI api = new YoutrackAPI("http://youtrack.it-crowd.com.pl", getUsername(), getPassword());
41   - List<Issue> issues = api.searchIssuesByProject("SM", null);
  80 + YoutrackAPI api = new YoutrackAPI(getServiceLocation(), getUsername(), getPassword());
  81 + List<IssueWrapper> issues = api.searchIssuesByProject("TST", null);
42 82 Assert.assertTrue(!issues.isEmpty());
43   - for (Issue issue : issues) {
44   - String summary = issue.getFieldValue(Issue.Fields.summary);
  83 + for (IssueWrapper issue : issues) {
  84 + String summary = issue.getFieldValue(IssueWrapper.Fields.summary);
45 85 Assert.assertNotNull(summary);
46 86 Assert.assertTrue(!"".equals(summary.trim()));
47 87 }
... ... @@ -52,6 +92,11 @@ public class YoutrackAPITest {
52 92 return System.getProperty("youtrackPassword");
53 93 }
54 94
  95 + private String getServiceLocation()
  96 + {
  97 + return System.getProperty("youtrackLocation");
  98 + }
  99 +
55 100 private String getUsername()
56 101 {
57 102 return System.getProperty("youtrackUsername");
... ...
Please register or login to post a comment