Commit 2b455d82adc3e32c401f4494a18ad8df2f573bdf

Authored by bernard
1 parent 4bd2f591

Code reformat.

@@ -14,14 +14,17 @@ public class Issue implements Serializable { @@ -14,14 +14,17 @@ public class Issue implements Serializable {
14 // ------------------------------ FIELDS ------------------------------ 14 // ------------------------------ FIELDS ------------------------------
15 15
16 private static final Log log = LogFactory.getLog(Issue.class); 16 private static final Log log = LogFactory.getLog(Issue.class);
  17 +
17 private List<Issues.Issue.Comment> comments; 18 private List<Issues.Issue.Comment> comments;
  19 +
18 private Map<String, Issues.Issue.Field> fieldMap; 20 private Map<String, Issues.Issue.Field> fieldMap;
19 21
20 private Issues.Issue issue; 22 private Issues.Issue issue;
21 23
22 // --------------------------- CONSTRUCTORS --------------------------- 24 // --------------------------- CONSTRUCTORS ---------------------------
23 25
24 - public Issue(Issues.Issue issue) { 26 + public Issue(Issues.Issue issue)
  27 + {
25 this.issue = issue; 28 this.issue = issue;
26 fieldMap = new HashMap<String, Issues.Issue.Field>(); 29 fieldMap = new HashMap<String, Issues.Issue.Field>();
27 comments = new ArrayList<Issues.Issue.Comment>(); 30 comments = new ArrayList<Issues.Issue.Comment>();
@@ -39,11 +42,13 @@ public class Issue implements Serializable { @@ -39,11 +42,13 @@ public class Issue implements Serializable {
39 42
40 // -------------------------- OTHER METHODS -------------------------- 43 // -------------------------- OTHER METHODS --------------------------
41 44
42 - public Issues.Issue.Field getField(String field) { 45 + public Issues.Issue.Field getField(String field)
  46 + {
43 return fieldMap.get(field); 47 return fieldMap.get(field);
44 } 48 }
45 49
46 - public String getFieldValue(String fieldName) { 50 + public String getFieldValue(String fieldName)
  51 + {
47 Issues.Issue.Field field = fieldMap.get(fieldName); 52 Issues.Issue.Field field = fieldMap.get(fieldName);
48 if (field == null) { 53 if (field == null) {
49 return null; 54 return null;
@@ -52,9 +57,11 @@ public class Issue implements Serializable { @@ -52,9 +57,11 @@ public class Issue implements Serializable {
52 return values.isEmpty() ? null : values.get(0).getContent(); 57 return values.isEmpty() ? null : values.get(0).getContent();
53 } 58 }
54 59
55 - public String getFieldValue(Fields fieldName) { 60 + public String getFieldValue(Fields fieldName)
  61 + {
56 return getFieldValue(fieldName.name()); 62 return getFieldValue(fieldName.name());
57 } 63 }
  64 +
58 // -------------------------- ENUMERATIONS -------------------------- 65 // -------------------------- ENUMERATIONS --------------------------
59 66
60 public enum Fields { 67 public enum Fields {
1 -package pl.com.it_crowd.youtrack.api.rest; 1 +package pl.com.it_crowd.youtrack.api;
2 2
3 import com.gargoylesoftware.htmlunit.BrowserVersion; 3 import com.gargoylesoftware.htmlunit.BrowserVersion;
4 import com.gargoylesoftware.htmlunit.FailingHttpStatusCodeException; 4 import com.gargoylesoftware.htmlunit.FailingHttpStatusCodeException;
@@ -11,8 +11,7 @@ import com.gargoylesoftware.htmlunit.html.DomNode; @@ -11,8 +11,7 @@ import com.gargoylesoftware.htmlunit.html.DomNode;
11 import com.gargoylesoftware.htmlunit.util.NameValuePair; 11 import com.gargoylesoftware.htmlunit.util.NameValuePair;
12 import com.gargoylesoftware.htmlunit.xml.XmlPage; 12 import com.gargoylesoftware.htmlunit.xml.XmlPage;
13 import org.apache.http.auth.AuthenticationException; 13 import org.apache.http.auth.AuthenticationException;
14 -import pl.com.it_crowd.youtrack.api.Issue;  
15 -import pl.com.it_crowd.youtrack.api.IssuesUnmarshaller; 14 +import pl.com.it_crowd.youtrack.api.rest.Issues;
16 15
17 import javax.xml.bind.JAXBException; 16 import javax.xml.bind.JAXBException;
18 import java.io.IOException; 17 import java.io.IOException;
@@ -29,27 +28,31 @@ public class YoutrackAPI { @@ -29,27 +28,31 @@ public class YoutrackAPI {
29 28
30 // --------------------------- CONSTRUCTORS --------------------------- 29 // --------------------------- CONSTRUCTORS ---------------------------
31 30
32 - public YoutrackAPI(String serviceLocation) { 31 + public YoutrackAPI(String serviceLocation)
  32 + {
33 this.serviceLocation = serviceLocation; 33 this.serviceLocation = serviceLocation;
34 this.webClient = new WebClient(BrowserVersion.FIREFOX_3_6); 34 this.webClient = new WebClient(BrowserVersion.FIREFOX_3_6);
35 this.webClient.setJavaScriptEnabled(false); 35 this.webClient.setJavaScriptEnabled(false);
36 this.webClient.setCssEnabled(false); 36 this.webClient.setCssEnabled(false);
37 } 37 }
38 38
39 - public YoutrackAPI(String serviceLocation, String username, String password) throws IOException, AuthenticationException { 39 + public YoutrackAPI(String serviceLocation, String username, String password) throws IOException, AuthenticationException
  40 + {
40 this(serviceLocation); 41 this(serviceLocation);
41 login(username, password); 42 login(username, password);
42 } 43 }
43 44
44 // --------------------- GETTER / SETTER METHODS --------------------- 45 // --------------------- GETTER / SETTER METHODS ---------------------
45 46
46 - public String getServiceLocation() { 47 + public String getServiceLocation()
  48 + {
47 return serviceLocation; 49 return serviceLocation;
48 } 50 }
49 51
50 // -------------------------- OTHER METHODS -------------------------- 52 // -------------------------- OTHER METHODS --------------------------
51 53
52 - public void login(String username, String password) throws IOException, AuthenticationException { 54 + public void login(String username, String password) throws IOException, AuthenticationException
  55 + {
53 ArrayList<NameValuePair> requestParameters = new ArrayList<NameValuePair>(); 56 ArrayList<NameValuePair> requestParameters = new ArrayList<NameValuePair>();
54 requestParameters.add(new NameValuePair("login", username)); 57 requestParameters.add(new NameValuePair("login", username));
55 requestParameters.add(new NameValuePair("password", password)); 58 requestParameters.add(new NameValuePair("password", password));
@@ -68,7 +71,8 @@ public class YoutrackAPI { @@ -68,7 +71,8 @@ public class YoutrackAPI {
68 } 71 }
69 } 72 }
70 73
71 - public List<Issue> searchIssuesByProject(String project, String filter) throws JAXBException, IOException { 74 + public List<Issue> searchIssuesByProject(String project, String filter) throws JAXBException, IOException
  75 + {
72 String url = serviceLocation + "/rest/issue/byproject/" + project + "?filter=" + filter; 76 String url = serviceLocation + "/rest/issue/byproject/" + project + "?filter=" + filter;
73 WebResponse webResponse = webClient.<Page>getPage(url).getWebResponse(); 77 WebResponse webResponse = webClient.<Page>getPage(url).getWebResponse();
74 // System.out.println(webResponse.getContentAsString()); 78 // System.out.println(webResponse.getContentAsString());
@@ -2,7 +2,7 @@ @@ -2,7 +2,7 @@
2 // This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, vhudson-jaxb-ri-2.1-833 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> 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. 4 // Any modifications to this file will be lost upon recompilation of the source schema.
5 -// Generated on: 2011.12.16 at 09:34:48 AM CET 5 +// Generated on: 2011.12.16 at 10:06:20 AM CET
6 // 6 //
7 7
8 package pl.com.it_crowd.youtrack.api.rest; 8 package pl.com.it_crowd.youtrack.api.rest;
@@ -96,9 +96,7 @@ import java.util.List; @@ -96,9 +96,7 @@ import java.util.List;
96 * </pre> 96 * </pre>
97 */ 97 */
98 @XmlAccessorType(XmlAccessType.FIELD) 98 @XmlAccessorType(XmlAccessType.FIELD)
99 -@XmlType(name = "", propOrder = {  
100 - "issue"  
101 -}) 99 +@XmlType(name = "", propOrder = {"issue"})
102 @XmlRootElement(name = "issues") 100 @XmlRootElement(name = "issues")
103 public class Issues { 101 public class Issues {
104 102
@@ -124,7 +122,8 @@ public class Issues { @@ -124,7 +122,8 @@ public class Issues {
124 * Objects of the following type(s) are allowed in the list 122 * Objects of the following type(s) are allowed in the list
125 * {@link Issues.Issue } 123 * {@link Issues.Issue }
126 */ 124 */
127 - public List<Issues.Issue> getIssue() { 125 + public List<Issues.Issue> getIssue()
  126 + {
128 if (issue == null) { 127 if (issue == null) {
129 issue = new ArrayList<Issues.Issue>(); 128 issue = new ArrayList<Issues.Issue>();
130 } 129 }
@@ -199,16 +198,12 @@ public class Issues { @@ -199,16 +198,12 @@ public class Issues {
199 * </pre> 198 * </pre>
200 */ 199 */
201 @XmlAccessorType(XmlAccessType.FIELD) 200 @XmlAccessorType(XmlAccessType.FIELD)
202 - @XmlType(name = "", propOrder = {  
203 - "fieldOrComment"  
204 - }) 201 + @XmlType(name = "", propOrder = {"fieldOrComment"})
205 public static class Issue { 202 public static class Issue {
206 203
207 - @XmlElements({  
208 - @XmlElement(name = "field", type = Issues.Issue.Field.class),  
209 - @XmlElement(name = "comment", type = Issues.Issue.Comment.class)  
210 - }) 204 + @XmlElements({@XmlElement(name = "field", type = Issues.Issue.Field.class), @XmlElement(name = "comment", type = Issues.Issue.Comment.class)})
211 protected List<Object> fieldOrComment; 205 protected List<Object> fieldOrComment;
  206 +
212 @XmlAttribute 207 @XmlAttribute
213 protected String id; 208 protected String id;
214 209
@@ -233,7 +228,8 @@ public class Issues { @@ -233,7 +228,8 @@ public class Issues {
233 * {@link Issues.Issue.Field } 228 * {@link Issues.Issue.Field }
234 * {@link Issues.Issue.Comment } 229 * {@link Issues.Issue.Comment }
235 */ 230 */
236 - public List<Object> getFieldOrComment() { 231 + public List<Object> getFieldOrComment()
  232 + {
237 if (fieldOrComment == null) { 233 if (fieldOrComment == null) {
238 fieldOrComment = new ArrayList<Object>(); 234 fieldOrComment = new ArrayList<Object>();
239 } 235 }
@@ -246,7 +242,8 @@ public class Issues { @@ -246,7 +242,8 @@ public class Issues {
246 * @return possible object is 242 * @return possible object is
247 * {@link String } 243 * {@link String }
248 */ 244 */
249 - public String getId() { 245 + public String getId()
  246 + {
250 return id; 247 return id;
251 } 248 }
252 249
@@ -256,7 +253,8 @@ public class Issues { @@ -256,7 +253,8 @@ public class Issues {
256 * @param value allowed object is 253 * @param value allowed object is
257 * {@link String } 254 * {@link String }
258 */ 255 */
259 - public void setId(String value) { 256 + public void setId(String value)
  257 + {
260 this.id = value; 258 this.id = value;
261 } 259 }
262 260
@@ -296,28 +294,34 @@ public class Issues { @@ -296,28 +294,34 @@ public class Issues {
296 * </pre> 294 * </pre>
297 */ 295 */
298 @XmlAccessorType(XmlAccessType.FIELD) 296 @XmlAccessorType(XmlAccessType.FIELD)
299 - @XmlType(name = "", propOrder = {  
300 - "replies",  
301 - "value"  
302 - }) 297 + @XmlType(name = "", propOrder = {"replies", "value"})
303 public static class Comment { 298 public static class Comment {
304 299
305 protected String replies; 300 protected String replies;
  301 +
306 protected Issues.Issue.Comment.Value value; 302 protected Issues.Issue.Comment.Value value;
  303 +
307 @XmlAttribute 304 @XmlAttribute
308 protected String id; 305 protected String id;
  306 +
309 @XmlAttribute 307 @XmlAttribute
310 protected String author; 308 protected String author;
  309 +
311 @XmlAttribute 310 @XmlAttribute
312 protected String issueId; 311 protected String issueId;
  312 +
313 @XmlAttribute 313 @XmlAttribute
314 protected String deleted; 314 protected String deleted;
  315 +
315 @XmlAttribute 316 @XmlAttribute
316 protected String text; 317 protected String text;
  318 +
317 @XmlAttribute 319 @XmlAttribute
318 protected String shownForIssueAuthor; 320 protected String shownForIssueAuthor;
  321 +
319 @XmlAttribute 322 @XmlAttribute
320 protected String created; 323 protected String created;
  324 +
321 @XmlAttribute 325 @XmlAttribute
322 protected String name; 326 protected String name;
323 327
@@ -327,7 +331,8 @@ public class Issues { @@ -327,7 +331,8 @@ public class Issues {
327 * @return possible object is 331 * @return possible object is
328 * {@link String } 332 * {@link String }
329 */ 333 */
330 - public String getReplies() { 334 + public String getReplies()
  335 + {
331 return replies; 336 return replies;
332 } 337 }
333 338
@@ -337,7 +342,8 @@ public class Issues { @@ -337,7 +342,8 @@ public class Issues {
337 * @param value allowed object is 342 * @param value allowed object is
338 * {@link String } 343 * {@link String }
339 */ 344 */
340 - public void setReplies(String value) { 345 + public void setReplies(String value)
  346 + {
341 this.replies = value; 347 this.replies = value;
342 } 348 }
343 349
@@ -347,7 +353,8 @@ public class Issues { @@ -347,7 +353,8 @@ public class Issues {
347 * @return possible object is 353 * @return possible object is
348 * {@link Issues.Issue.Comment.Value } 354 * {@link Issues.Issue.Comment.Value }
349 */ 355 */
350 - public Issues.Issue.Comment.Value getValue() { 356 + public Issues.Issue.Comment.Value getValue()
  357 + {
351 return value; 358 return value;
352 } 359 }
353 360
@@ -357,7 +364,8 @@ public class Issues { @@ -357,7 +364,8 @@ public class Issues {
357 * @param value allowed object is 364 * @param value allowed object is
358 * {@link Issues.Issue.Comment.Value } 365 * {@link Issues.Issue.Comment.Value }
359 */ 366 */
360 - public void setValue(Issues.Issue.Comment.Value value) { 367 + public void setValue(Issues.Issue.Comment.Value value)
  368 + {
361 this.value = value; 369 this.value = value;
362 } 370 }
363 371
@@ -367,7 +375,8 @@ public class Issues { @@ -367,7 +375,8 @@ public class Issues {
367 * @return possible object is 375 * @return possible object is
368 * {@link String } 376 * {@link String }
369 */ 377 */
370 - public String getId() { 378 + public String getId()
  379 + {
371 return id; 380 return id;
372 } 381 }
373 382
@@ -377,7 +386,8 @@ public class Issues { @@ -377,7 +386,8 @@ public class Issues {
377 * @param value allowed object is 386 * @param value allowed object is
378 * {@link String } 387 * {@link String }
379 */ 388 */
380 - public void setId(String value) { 389 + public void setId(String value)
  390 + {
381 this.id = value; 391 this.id = value;
382 } 392 }
383 393
@@ -387,7 +397,8 @@ public class Issues { @@ -387,7 +397,8 @@ public class Issues {
387 * @return possible object is 397 * @return possible object is
388 * {@link String } 398 * {@link String }
389 */ 399 */
390 - public String getAuthor() { 400 + public String getAuthor()
  401 + {
391 return author; 402 return author;
392 } 403 }
393 404
@@ -397,7 +408,8 @@ public class Issues { @@ -397,7 +408,8 @@ public class Issues {
397 * @param value allowed object is 408 * @param value allowed object is
398 * {@link String } 409 * {@link String }
399 */ 410 */
400 - public void setAuthor(String value) { 411 + public void setAuthor(String value)
  412 + {
401 this.author = value; 413 this.author = value;
402 } 414 }
403 415
@@ -407,7 +419,8 @@ public class Issues { @@ -407,7 +419,8 @@ public class Issues {
407 * @return possible object is 419 * @return possible object is
408 * {@link String } 420 * {@link String }
409 */ 421 */
410 - public String getIssueId() { 422 + public String getIssueId()
  423 + {
411 return issueId; 424 return issueId;
412 } 425 }
413 426
@@ -417,7 +430,8 @@ public class Issues { @@ -417,7 +430,8 @@ public class Issues {
417 * @param value allowed object is 430 * @param value allowed object is
418 * {@link String } 431 * {@link String }
419 */ 432 */
420 - public void setIssueId(String value) { 433 + public void setIssueId(String value)
  434 + {
421 this.issueId = value; 435 this.issueId = value;
422 } 436 }
423 437
@@ -427,7 +441,8 @@ public class Issues { @@ -427,7 +441,8 @@ public class Issues {
427 * @return possible object is 441 * @return possible object is
428 * {@link String } 442 * {@link String }
429 */ 443 */
430 - public String getDeleted() { 444 + public String getDeleted()
  445 + {
431 return deleted; 446 return deleted;
432 } 447 }
433 448
@@ -437,7 +452,8 @@ public class Issues { @@ -437,7 +452,8 @@ public class Issues {
437 * @param value allowed object is 452 * @param value allowed object is
438 * {@link String } 453 * {@link String }
439 */ 454 */
440 - public void setDeleted(String value) { 455 + public void setDeleted(String value)
  456 + {
441 this.deleted = value; 457 this.deleted = value;
442 } 458 }
443 459
@@ -447,7 +463,8 @@ public class Issues { @@ -447,7 +463,8 @@ public class Issues {
447 * @return possible object is 463 * @return possible object is
448 * {@link String } 464 * {@link String }
449 */ 465 */
450 - public String getText() { 466 + public String getText()
  467 + {
451 return text; 468 return text;
452 } 469 }
453 470
@@ -457,7 +474,8 @@ public class Issues { @@ -457,7 +474,8 @@ public class Issues {
457 * @param value allowed object is 474 * @param value allowed object is
458 * {@link String } 475 * {@link String }
459 */ 476 */
460 - public void setText(String value) { 477 + public void setText(String value)
  478 + {
461 this.text = value; 479 this.text = value;
462 } 480 }
463 481
@@ -467,7 +485,8 @@ public class Issues { @@ -467,7 +485,8 @@ public class Issues {
467 * @return possible object is 485 * @return possible object is
468 * {@link String } 486 * {@link String }
469 */ 487 */
470 - public String getShownForIssueAuthor() { 488 + public String getShownForIssueAuthor()
  489 + {
471 return shownForIssueAuthor; 490 return shownForIssueAuthor;
472 } 491 }
473 492
@@ -477,7 +496,8 @@ public class Issues { @@ -477,7 +496,8 @@ public class Issues {
477 * @param value allowed object is 496 * @param value allowed object is
478 * {@link String } 497 * {@link String }
479 */ 498 */
480 - public void setShownForIssueAuthor(String value) { 499 + public void setShownForIssueAuthor(String value)
  500 + {
481 this.shownForIssueAuthor = value; 501 this.shownForIssueAuthor = value;
482 } 502 }
483 503
@@ -487,7 +507,8 @@ public class Issues { @@ -487,7 +507,8 @@ public class Issues {
487 * @return possible object is 507 * @return possible object is
488 * {@link String } 508 * {@link String }
489 */ 509 */
490 - public String getCreated() { 510 + public String getCreated()
  511 + {
491 return created; 512 return created;
492 } 513 }
493 514
@@ -497,7 +518,8 @@ public class Issues { @@ -497,7 +518,8 @@ public class Issues {
497 * @param value allowed object is 518 * @param value allowed object is
498 * {@link String } 519 * {@link String }
499 */ 520 */
500 - public void setCreated(String value) { 521 + public void setCreated(String value)
  522 + {
501 this.created = value; 523 this.created = value;
502 } 524 }
503 525
@@ -507,7 +529,8 @@ public class Issues { @@ -507,7 +529,8 @@ public class Issues {
507 * @return possible object is 529 * @return possible object is
508 * {@link String } 530 * {@link String }
509 */ 531 */
510 - public String getName() { 532 + public String getName()
  533 + {
511 return name; 534 return name;
512 } 535 }
513 536
@@ -517,7 +540,8 @@ public class Issues { @@ -517,7 +540,8 @@ public class Issues {
517 * @param value allowed object is 540 * @param value allowed object is
518 * {@link String } 541 * {@link String }
519 */ 542 */
520 - public void setName(String value) { 543 + public void setName(String value)
  544 + {
521 this.name = value; 545 this.name = value;
522 } 546 }
523 547
@@ -538,15 +562,15 @@ public class Issues { @@ -538,15 +562,15 @@ public class Issues {
538 * </pre> 562 * </pre>
539 */ 563 */
540 @XmlAccessorType(XmlAccessType.FIELD) 564 @XmlAccessorType(XmlAccessType.FIELD)
541 - @XmlType(name = "", propOrder = {  
542 - "value"  
543 - }) 565 + @XmlType(name = "", propOrder = {"value"})
544 public static class Value { 566 public static class Value {
545 567
546 @XmlValue 568 @XmlValue
547 protected String value; 569 protected String value;
  570 +
548 @XmlAttribute 571 @XmlAttribute
549 protected String type; 572 protected String type;
  573 +
550 @XmlAttribute 574 @XmlAttribute
551 protected String role; 575 protected String role;
552 576
@@ -556,7 +580,8 @@ public class Issues { @@ -556,7 +580,8 @@ public class Issues {
556 * @return possible object is 580 * @return possible object is
557 * {@link String } 581 * {@link String }
558 */ 582 */
559 - public String getValue() { 583 + public String getValue()
  584 + {
560 return value; 585 return value;
561 } 586 }
562 587
@@ -566,7 +591,8 @@ public class Issues { @@ -566,7 +591,8 @@ public class Issues {
566 * @param value allowed object is 591 * @param value allowed object is
567 * {@link String } 592 * {@link String }
568 */ 593 */
569 - public void setValue(String value) { 594 + public void setValue(String value)
  595 + {
570 this.value = value; 596 this.value = value;
571 } 597 }
572 598
@@ -576,7 +602,8 @@ public class Issues { @@ -576,7 +602,8 @@ public class Issues {
576 * @return possible object is 602 * @return possible object is
577 * {@link String } 603 * {@link String }
578 */ 604 */
579 - public String getType() { 605 + public String getType()
  606 + {
580 return type; 607 return type;
581 } 608 }
582 609
@@ -586,7 +613,8 @@ public class Issues { @@ -586,7 +613,8 @@ public class Issues {
586 * @param value allowed object is 613 * @param value allowed object is
587 * {@link String } 614 * {@link String }
588 */ 615 */
589 - public void setType(String value) { 616 + public void setType(String value)
  617 + {
590 this.type = value; 618 this.type = value;
591 } 619 }
592 620
@@ -596,7 +624,8 @@ public class Issues { @@ -596,7 +624,8 @@ public class Issues {
596 * @return possible object is 624 * @return possible object is
597 * {@link String } 625 * {@link String }
598 */ 626 */
599 - public String getRole() { 627 + public String getRole()
  628 + {
600 return role; 629 return role;
601 } 630 }
602 631
@@ -606,12 +635,11 @@ public class Issues { @@ -606,12 +635,11 @@ public class Issues {
606 * @param value allowed object is 635 * @param value allowed object is
607 * {@link String } 636 * {@link String }
608 */ 637 */
609 - public void setRole(String value) { 638 + public void setRole(String value)
  639 + {
610 this.role = value; 640 this.role = value;
611 } 641 }
612 -  
613 } 642 }
614 -  
615 } 643 }
616 644
617 /** 645 /**
@@ -642,13 +670,12 @@ public class Issues { @@ -642,13 +670,12 @@ public class Issues {
642 * </pre> 670 * </pre>
643 */ 671 */
644 @XmlAccessorType(XmlAccessType.FIELD) 672 @XmlAccessorType(XmlAccessType.FIELD)
645 - @XmlType(name = "", propOrder = {  
646 - "values"  
647 - }) 673 + @XmlType(name = "", propOrder = {"values"})
648 public static class Field { 674 public static class Field {
649 675
650 @XmlElement(name = "value") 676 @XmlElement(name = "value")
651 protected List<Issues.Issue.Field.Value> values; 677 protected List<Issues.Issue.Field.Value> values;
  678 +
652 @XmlAttribute 679 @XmlAttribute
653 protected String name; 680 protected String name;
654 681
@@ -672,7 +699,8 @@ public class Issues { @@ -672,7 +699,8 @@ public class Issues {
672 * Objects of the following type(s) are allowed in the list 699 * Objects of the following type(s) are allowed in the list
673 * {@link Issues.Issue.Field.Value } 700 * {@link Issues.Issue.Field.Value }
674 */ 701 */
675 - public List<Issues.Issue.Field.Value> getValues() { 702 + public List<Issues.Issue.Field.Value> getValues()
  703 + {
676 if (values == null) { 704 if (values == null) {
677 values = new ArrayList<Issues.Issue.Field.Value>(); 705 values = new ArrayList<Issues.Issue.Field.Value>();
678 } 706 }
@@ -685,7 +713,8 @@ public class Issues { @@ -685,7 +713,8 @@ public class Issues {
685 * @return possible object is 713 * @return possible object is
686 * {@link String } 714 * {@link String }
687 */ 715 */
688 - public String getName() { 716 + public String getName()
  717 + {
689 return name; 718 return name;
690 } 719 }
691 720
@@ -695,7 +724,8 @@ public class Issues { @@ -695,7 +724,8 @@ public class Issues {
695 * @param value allowed object is 724 * @param value allowed object is
696 * {@link String } 725 * {@link String }
697 */ 726 */
698 - public void setName(String value) { 727 + public void setName(String value)
  728 + {
699 this.name = value; 729 this.name = value;
700 } 730 }
701 731
@@ -716,15 +746,15 @@ public class Issues { @@ -716,15 +746,15 @@ public class Issues {
716 * </pre> 746 * </pre>
717 */ 747 */
718 @XmlAccessorType(XmlAccessType.FIELD) 748 @XmlAccessorType(XmlAccessType.FIELD)
719 - @XmlType(name = "", propOrder = {  
720 - "content"  
721 - }) 749 + @XmlType(name = "", propOrder = {"content"})
722 public static class Value { 750 public static class Value {
723 751
724 @XmlValue 752 @XmlValue
725 protected String content; 753 protected String content;
  754 +
726 @XmlAttribute 755 @XmlAttribute
727 protected String type; 756 protected String type;
  757 +
728 @XmlAttribute 758 @XmlAttribute
729 protected String role; 759 protected String role;
730 760
@@ -734,7 +764,8 @@ public class Issues { @@ -734,7 +764,8 @@ public class Issues {
734 * @return possible object is 764 * @return possible object is
735 * {@link String } 765 * {@link String }
736 */ 766 */
737 - public String getContent() { 767 + public String getContent()
  768 + {
738 return content; 769 return content;
739 } 770 }
740 771
@@ -744,7 +775,8 @@ public class Issues { @@ -744,7 +775,8 @@ public class Issues {
744 * @param value allowed object is 775 * @param value allowed object is
745 * {@link String } 776 * {@link String }
746 */ 777 */
747 - public void setContent(String value) { 778 + public void setContent(String value)
  779 + {
748 this.content = value; 780 this.content = value;
749 } 781 }
750 782
@@ -754,7 +786,8 @@ public class Issues { @@ -754,7 +786,8 @@ public class Issues {
754 * @return possible object is 786 * @return possible object is
755 * {@link String } 787 * {@link String }
756 */ 788 */
757 - public String getType() { 789 + public String getType()
  790 + {
758 return type; 791 return type;
759 } 792 }
760 793
@@ -764,7 +797,8 @@ public class Issues { @@ -764,7 +797,8 @@ public class Issues {
764 * @param value allowed object is 797 * @param value allowed object is
765 * {@link String } 798 * {@link String }
766 */ 799 */
767 - public void setType(String value) { 800 + public void setType(String value)
  801 + {
768 this.type = value; 802 this.type = value;
769 } 803 }
770 804
@@ -774,7 +808,8 @@ public class Issues { @@ -774,7 +808,8 @@ public class Issues {
774 * @return possible object is 808 * @return possible object is
775 * {@link String } 809 * {@link String }
776 */ 810 */
777 - public String getRole() { 811 + public String getRole()
  812 + {
778 return role; 813 return role;
779 } 814 }
780 815
@@ -784,14 +819,11 @@ public class Issues { @@ -784,14 +819,11 @@ public class Issues {
784 * @param value allowed object is 819 * @param value allowed object is
785 * {@link String } 820 * {@link String }
786 */ 821 */
787 - public void setRole(String value) { 822 + public void setRole(String value)
  823 + {
788 this.role = value; 824 this.role = value;
789 } 825 }
790 -  
791 } 826 }
792 -  
793 } 827 }
794 -  
795 } 828 }
796 -  
797 } 829 }
@@ -2,7 +2,7 @@ @@ -2,7 +2,7 @@
2 // This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, vhudson-jaxb-ri-2.1-833 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> 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. 4 // Any modifications to this file will be lost upon recompilation of the source schema.
5 -// Generated on: 2011.12.16 at 09:34:48 AM CET 5 +// Generated on: 2011.12.16 at 10:06:20 AM CET
6 // 6 //
7 7
8 package pl.com.it_crowd.youtrack.api.rest; 8 package pl.com.it_crowd.youtrack.api.rest;
@@ -28,49 +28,55 @@ public class ObjectFactory { @@ -28,49 +28,55 @@ public class ObjectFactory {
28 /** 28 /**
29 * 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 29 * 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
30 */ 30 */
31 - public ObjectFactory() { 31 + public ObjectFactory()
  32 + {
32 } 33 }
33 34
34 /** 35 /**
35 - * Create an instance of {@link Issues.Issue.Comment.Value } 36 + * Create an instance of {@link Issues.Issue }
36 */ 37 */
37 - public Issues.Issue.Comment.Value createIssuesIssueCommentValue() {  
38 - return new Issues.Issue.Comment.Value(); 38 + public Issues.Issue createIssuesIssue()
  39 + {
  40 + return new Issues.Issue();
39 } 41 }
40 42
41 /** 43 /**
42 - * Create an instance of {@link Issues.Issue.Field } 44 + * Create an instance of {@link Issues.Issue.Comment }
43 */ 45 */
44 - public Issues.Issue.Field createIssuesIssueField() {  
45 - return new Issues.Issue.Field(); 46 + public Issues.Issue.Comment createIssuesIssueComment()
  47 + {
  48 + return new Issues.Issue.Comment();
46 } 49 }
47 50
48 /** 51 /**
49 * Create an instance of {@link Issues } 52 * Create an instance of {@link Issues }
50 */ 53 */
51 - public Issues createIssues() { 54 + public Issues createIssues()
  55 + {
52 return new Issues(); 56 return new Issues();
53 } 57 }
54 58
55 /** 59 /**
56 - * Create an instance of {@link Issues.Issue.Field.Value } 60 + * Create an instance of {@link Issues.Issue.Comment.Value }
57 */ 61 */
58 - public Issues.Issue.Field.Value createIssuesIssueFieldValue() {  
59 - return new Issues.Issue.Field.Value(); 62 + public Issues.Issue.Comment.Value createIssuesIssueCommentValue()
  63 + {
  64 + return new Issues.Issue.Comment.Value();
60 } 65 }
61 66
62 /** 67 /**
63 - * Create an instance of {@link Issues.Issue.Comment } 68 + * Create an instance of {@link Issues.Issue.Field.Value }
64 */ 69 */
65 - public Issues.Issue.Comment createIssuesIssueComment() {  
66 - return new Issues.Issue.Comment(); 70 + public Issues.Issue.Field.Value createIssuesIssueFieldValue()
  71 + {
  72 + return new Issues.Issue.Field.Value();
67 } 73 }
68 74
69 /** 75 /**
70 - * Create an instance of {@link Issues.Issue } 76 + * Create an instance of {@link Issues.Issue.Field }
71 */ 77 */
72 - public Issues.Issue createIssuesIssue() {  
73 - return new Issues.Issue(); 78 + public Issues.Issue.Field createIssuesIssueField()
  79 + {
  80 + return new Issues.Issue.Field();
74 } 81 }
75 -  
76 } 82 }
@@ -4,6 +4,7 @@ import junit.framework.Assert; @@ -4,6 +4,7 @@ import junit.framework.Assert;
4 import org.apache.http.auth.AuthenticationException; 4 import org.apache.http.auth.AuthenticationException;
5 import org.junit.Test; 5 import org.junit.Test;
6 import pl.com.it_crowd.youtrack.api.Issue; 6 import pl.com.it_crowd.youtrack.api.Issue;
  7 +import pl.com.it_crowd.youtrack.api.YoutrackAPI;
7 8
8 import javax.xml.bind.JAXBException; 9 import javax.xml.bind.JAXBException;
9 import java.io.IOException; 10 import java.io.IOException;
@@ -16,14 +17,16 @@ public class YoutrackAPITest { @@ -16,14 +17,16 @@ public class YoutrackAPITest {
16 // -------------------------- OTHER METHODS -------------------------- 17 // -------------------------- OTHER METHODS --------------------------
17 18
18 @Test(expected = AuthenticationException.class) 19 @Test(expected = AuthenticationException.class)
19 - public void loginFailureTest() throws IOException, AuthenticationException { 20 + public void loginFailureTest() throws IOException, AuthenticationException
  21 + {
20 final String username = "someFakeLogin"; 22 final String username = "someFakeLogin";
21 final String password = "someFakePassword"; 23 final String password = "someFakePassword";
22 new YoutrackAPI("http://youtrack.it-crowd.com.pl", username, password); 24 new YoutrackAPI("http://youtrack.it-crowd.com.pl", username, password);
23 } 25 }
24 26
25 @Test 27 @Test
26 - public void loginTest() throws IOException, AuthenticationException { 28 + public void loginTest() throws IOException, AuthenticationException
  29 + {
27 final String username = getUsername(); 30 final String username = getUsername();
28 final String password = getPassword(); 31 final String password = getPassword();
29 new YoutrackAPI("http://youtrack.it-crowd.com.pl", username, password); 32 new YoutrackAPI("http://youtrack.it-crowd.com.pl", username, password);
@@ -32,7 +35,8 @@ public class YoutrackAPITest { @@ -32,7 +35,8 @@ public class YoutrackAPITest {
32 } 35 }
33 36
34 @Test 37 @Test
35 - public void searchIssuesByProjectTest() throws IOException, AuthenticationException, JAXBException { 38 + public void searchIssuesByProjectTest() throws IOException, AuthenticationException, JAXBException
  39 + {
36 YoutrackAPI api = new YoutrackAPI("http://youtrack.it-crowd.com.pl", getUsername(), getPassword()); 40 YoutrackAPI api = new YoutrackAPI("http://youtrack.it-crowd.com.pl", getUsername(), getPassword());
37 List<Issue> issues = api.searchIssuesByProject("SM", null); 41 List<Issue> issues = api.searchIssuesByProject("SM", null);
38 Assert.assertTrue(!issues.isEmpty()); 42 Assert.assertTrue(!issues.isEmpty());
@@ -43,11 +47,13 @@ public class YoutrackAPITest { @@ -43,11 +47,13 @@ public class YoutrackAPITest {
43 } 47 }
44 } 48 }
45 49
46 - private String getPassword() { 50 + private String getPassword()
  51 + {
47 return System.getProperty("youtrackPassword"); 52 return System.getProperty("youtrackPassword");
48 } 53 }
49 54
50 - private String getUsername() { 55 + private String getUsername()
  56 + {
51 return System.getProperty("youtrackUsername"); 57 return System.getProperty("youtrackUsername");
52 } 58 }
53 } 59 }
Please register or login to post a comment