Showing
14 changed files
with
271 additions
and
26 deletions
| @@ -29,13 +29,15 @@ import pl.com.it_crowd.youtrack.api.exceptions.YoutrackAPIException; | @@ -29,13 +29,15 @@ import pl.com.it_crowd.youtrack.api.exceptions.YoutrackAPIException; | ||
| 29 | import pl.com.it_crowd.youtrack.api.exceptions.YoutrackErrorException; | 29 | import pl.com.it_crowd.youtrack.api.exceptions.YoutrackErrorException; |
| 30 | import pl.com.it_crowd.youtrack.api.rest.Issue; | 30 | import pl.com.it_crowd.youtrack.api.rest.Issue; |
| 31 | import pl.com.it_crowd.youtrack.api.rest.Issues; | 31 | import pl.com.it_crowd.youtrack.api.rest.Issues; |
| 32 | -import pl.com.it_crowd.youtrack.api.rest.ObjectFactory; | 32 | +import pl.com.it_crowd.youtrack.api.rest.User; |
| 33 | +import pl.com.it_crowd.youtrack.api.rest.UserRefs; | ||
| 33 | 34 | ||
| 34 | import javax.net.ssl.SSLContext; | 35 | import javax.net.ssl.SSLContext; |
| 35 | import javax.net.ssl.TrustManager; | 36 | import javax.net.ssl.TrustManager; |
| 36 | import javax.net.ssl.X509TrustManager; | 37 | import javax.net.ssl.X509TrustManager; |
| 37 | import javax.xml.bind.JAXBElement; | 38 | import javax.xml.bind.JAXBElement; |
| 38 | import javax.xml.bind.JAXBException; | 39 | import javax.xml.bind.JAXBException; |
| 40 | +import javax.xml.namespace.QName; | ||
| 39 | import java.io.IOException; | 41 | import java.io.IOException; |
| 40 | import java.net.URI; | 42 | import java.net.URI; |
| 41 | import java.net.URISyntaxException; | 43 | import java.net.URISyntaxException; |
| @@ -53,6 +55,10 @@ import java.util.regex.Pattern; | @@ -53,6 +55,10 @@ import java.util.regex.Pattern; | ||
| 53 | public class YoutrackAPI { | 55 | public class YoutrackAPI { |
| 54 | // ------------------------------ FIELDS ------------------------------ | 56 | // ------------------------------ FIELDS ------------------------------ |
| 55 | 57 | ||
| 58 | + private final static QName Error_QNAME = new QName("", "error"); | ||
| 59 | + | ||
| 60 | + private final static QName Issue_QNAME = new QName("", "issue"); | ||
| 61 | + | ||
| 56 | private HttpClient httpClient; | 62 | private HttpClient httpClient; |
| 57 | 63 | ||
| 58 | private String serviceLocation; | 64 | private String serviceLocation; |
| @@ -201,6 +207,23 @@ public class YoutrackAPI { | @@ -201,6 +207,23 @@ public class YoutrackAPI { | ||
| 201 | return matcher.group(1); | 207 | return matcher.group(1); |
| 202 | } | 208 | } |
| 203 | 209 | ||
| 210 | + public List<User> getIndividualAssignees(String project) throws IOException, JAXBException | ||
| 211 | + { | ||
| 212 | + final URI uri; | ||
| 213 | + try { | ||
| 214 | + uri = new URIBuilder(serviceLocation + "/rest/admin/project/" + project + "/assignee/individual").build(); | ||
| 215 | + } catch (URISyntaxException e) { | ||
| 216 | + throw new RuntimeException(e); | ||
| 217 | + } | ||
| 218 | + final String responseString = execute(new HttpGet(uri)); | ||
| 219 | + final Object result = YoutrackUnmarshaller.unmarshall(responseString); | ||
| 220 | + if (result instanceof UserRefs) { | ||
| 221 | + return ((UserRefs) result).getUsers(); | ||
| 222 | + } else { | ||
| 223 | + throw new YoutrackAPIException("Unexpected type: " + result); | ||
| 224 | + } | ||
| 225 | + } | ||
| 226 | + | ||
| 204 | public IssueWrapper getIssue(String issueId) throws IOException, JAXBException | 227 | public IssueWrapper getIssue(String issueId) throws IOException, JAXBException |
| 205 | { | 228 | { |
| 206 | final URI uri; | 229 | final URI uri; |
| @@ -224,15 +247,13 @@ public class YoutrackAPI { | @@ -224,15 +247,13 @@ public class YoutrackAPI { | ||
| 224 | return new IssueWrapper((Issue) result); | 247 | return new IssueWrapper((Issue) result); |
| 225 | } else if (result instanceof JAXBElement) { | 248 | } else if (result instanceof JAXBElement) { |
| 226 | final JAXBElement jaxbElement = (JAXBElement) result; | 249 | final JAXBElement jaxbElement = (JAXBElement) result; |
| 227 | - if (ObjectFactory._Error_QNAME.equals(jaxbElement.getName())) { | ||
| 228 | - throw new RuntimeException("Unexpected type: " + jaxbElement.getValue()); | ||
| 229 | - } else if (ObjectFactory._Issue_QNAME.equals(jaxbElement.getName())) { | 250 | + if (Issue_QNAME.equals(jaxbElement.getName())) { |
| 230 | return new IssueWrapper((Issue) jaxbElement.getValue()); | 251 | return new IssueWrapper((Issue) jaxbElement.getValue()); |
| 231 | } else { | 252 | } else { |
| 232 | - throw new RuntimeException(jaxbElement.getValue() + ""); | 253 | + throw new YoutrackAPIException("Unexpected type: " + jaxbElement.getValue()); |
| 233 | } | 254 | } |
| 234 | } else { | 255 | } else { |
| 235 | - throw new RuntimeException("Unexpected type " + result); | 256 | + throw new YoutrackAPIException("Unexpected type " + result); |
| 236 | } | 257 | } |
| 237 | } | 258 | } |
| 238 | 259 |
| @@ -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: 2012.07.02 at 11:11:34 PM CEST | 5 | +// Generated on: 2012.07.03 at 12:32:28 PM CEST |
| 6 | // | 6 | // |
| 7 | 7 | ||
| 8 | package pl.com.it_crowd.youtrack.api.rest; | 8 | package pl.com.it_crowd.youtrack.api.rest; |
| @@ -63,7 +63,7 @@ public class Comment { | @@ -63,7 +63,7 @@ public class Comment { | ||
| 63 | @XmlAttribute | 63 | @XmlAttribute |
| 64 | protected String author; | 64 | protected String author; |
| 65 | 65 | ||
| 66 | - @XmlElementRefs({@XmlElementRef(name = "value", type = JAXBElement.class), @XmlElementRef(name = "replies", type = JAXBElement.class)}) | 66 | + @XmlElementRefs({@XmlElementRef(name = "replies", type = JAXBElement.class), @XmlElementRef(name = "value", type = JAXBElement.class)}) |
| 67 | @XmlMixed | 67 | @XmlMixed |
| 68 | protected List<Serializable> content; | 68 | protected List<Serializable> content; |
| 69 | 69 |
| @@ -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: 2012.07.02 at 11:11:34 PM CEST | 5 | +// Generated on: 2012.07.03 at 12:32:28 PM CEST |
| 6 | // | 6 | // |
| 7 | 7 | ||
| 8 | package pl.com.it_crowd.youtrack.api.rest; | 8 | package pl.com.it_crowd.youtrack.api.rest; |
| @@ -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: 2012.07.02 at 11:11:34 PM CEST | 5 | +// Generated on: 2012.07.03 at 12:32:28 PM CEST |
| 6 | // | 6 | // |
| 7 | 7 | ||
| 8 | package pl.com.it_crowd.youtrack.api.rest; | 8 | package pl.com.it_crowd.youtrack.api.rest; |
| @@ -40,7 +40,7 @@ import java.util.List; | @@ -40,7 +40,7 @@ import java.util.List; | ||
| 40 | public class Issue { | 40 | public class Issue { |
| 41 | // ------------------------------ FIELDS ------------------------------ | 41 | // ------------------------------ FIELDS ------------------------------ |
| 42 | 42 | ||
| 43 | - @XmlElements({@XmlElement(name = "comment", type = Comment.class), @XmlElement(name = "field", type = Field.class)}) | 43 | + @XmlElements({@XmlElement(name = "field", type = Field.class), @XmlElement(name = "comment", type = Comment.class)}) |
| 44 | protected List<Object> fieldOrComment; | 44 | protected List<Object> fieldOrComment; |
| 45 | 45 | ||
| 46 | @XmlAttribute | 46 | @XmlAttribute |
| @@ -66,8 +66,8 @@ public class Issue { | @@ -66,8 +66,8 @@ public class Issue { | ||
| 66 | * <p/> | 66 | * <p/> |
| 67 | * <p/> | 67 | * <p/> |
| 68 | * Objects of the following type(s) are allowed in the list | 68 | * Objects of the following type(s) are allowed in the list |
| 69 | - * {@link Comment } | ||
| 70 | * {@link Field } | 69 | * {@link Field } |
| 70 | + * {@link Comment } | ||
| 71 | */ | 71 | */ |
| 72 | public List<Object> getFieldOrComment() | 72 | public List<Object> getFieldOrComment() |
| 73 | { | 73 | { |
| @@ -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: 2012.07.02 at 11:11:34 PM CEST | 5 | +// Generated on: 2012.07.03 at 12:32:28 PM CEST |
| 6 | // | 6 | // |
| 7 | 7 | ||
| 8 | package pl.com.it_crowd.youtrack.api.rest; | 8 | package pl.com.it_crowd.youtrack.api.rest; |
| @@ -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: 2012.07.02 at 11:11:34 PM CEST | 5 | +// Generated on: 2012.07.03 at 12:32:28 PM CEST |
| 6 | // | 6 | // |
| 7 | 7 | ||
| 8 | package pl.com.it_crowd.youtrack.api.rest; | 8 | package pl.com.it_crowd.youtrack.api.rest; |
| @@ -29,14 +29,14 @@ import javax.xml.namespace.QName; | @@ -29,14 +29,14 @@ import javax.xml.namespace.QName; | ||
| 29 | public class ObjectFactory { | 29 | public class ObjectFactory { |
| 30 | // ------------------------------ FIELDS ------------------------------ | 30 | // ------------------------------ FIELDS ------------------------------ |
| 31 | 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"); | 32 | private final static QName _CommentReplies_QNAME = new QName("", "replies"); |
| 37 | 33 | ||
| 38 | private final static QName _CommentValue_QNAME = new QName("", "value"); | 34 | private final static QName _CommentValue_QNAME = new QName("", "value"); |
| 39 | 35 | ||
| 36 | + private final static QName _Error_QNAME = new QName("", "error"); | ||
| 37 | + | ||
| 38 | + private final static QName _Issue_QNAME = new QName("", "issue"); | ||
| 39 | + | ||
| 40 | // --------------------------- CONSTRUCTORS --------------------------- | 40 | // --------------------------- CONSTRUCTORS --------------------------- |
| 41 | 41 | ||
| 42 | /** | 42 | /** |
| @@ -131,4 +131,20 @@ public class ObjectFactory { | @@ -131,4 +131,20 @@ public class ObjectFactory { | ||
| 131 | { | 131 | { |
| 132 | return new Issues(); | 132 | return new Issues(); |
| 133 | } | 133 | } |
| 134 | + | ||
| 135 | + /** | ||
| 136 | + * Create an instance of {@link User } | ||
| 137 | + */ | ||
| 138 | + public User createUser() | ||
| 139 | + { | ||
| 140 | + return new User(); | ||
| 141 | + } | ||
| 142 | + | ||
| 143 | + /** | ||
| 144 | + * Create an instance of {@link UserRefs } | ||
| 145 | + */ | ||
| 146 | + public UserRefs createUserRefs() | ||
| 147 | + { | ||
| 148 | + return new UserRefs(); | ||
| 149 | + } | ||
| 134 | } | 150 | } |
| 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.03 at 12:32:28 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.XmlSchemaType; | ||
| 14 | +import javax.xml.bind.annotation.XmlType; | ||
| 15 | + | ||
| 16 | +/** | ||
| 17 | + * <p>Java class for userType complex type. | ||
| 18 | + * <p/> | ||
| 19 | + * <p>The following schema fragment specifies the expected content contained within this class. | ||
| 20 | + * <p/> | ||
| 21 | + * <pre> | ||
| 22 | + * <complexType name="userType"> | ||
| 23 | + * <complexContent> | ||
| 24 | + * <restriction base="{http://www.w3.org/2001/XMLSchema}anyType"> | ||
| 25 | + * <attribute name="login" use="required" type="{http://www.w3.org/2001/XMLSchema}string" /> | ||
| 26 | + * <attribute name="url" type="{http://www.w3.org/2001/XMLSchema}anyURI" /> | ||
| 27 | + * </restriction> | ||
| 28 | + * </complexContent> | ||
| 29 | + * </complexType> | ||
| 30 | + * </pre> | ||
| 31 | + */ | ||
| 32 | +@XmlAccessorType(XmlAccessType.FIELD) | ||
| 33 | +@XmlType(name = "userType") | ||
| 34 | +public class User { | ||
| 35 | +// ------------------------------ FIELDS ------------------------------ | ||
| 36 | + | ||
| 37 | + @XmlAttribute(required = true) | ||
| 38 | + protected String login; | ||
| 39 | + | ||
| 40 | + @XmlAttribute | ||
| 41 | + @XmlSchemaType(name = "anyURI") | ||
| 42 | + protected String url; | ||
| 43 | + | ||
| 44 | +// --------------------- GETTER / SETTER METHODS --------------------- | ||
| 45 | + | ||
| 46 | + /** | ||
| 47 | + * Gets the value of the login property. | ||
| 48 | + * | ||
| 49 | + * @return possible object is | ||
| 50 | + * {@link String } | ||
| 51 | + */ | ||
| 52 | + public String getLogin() | ||
| 53 | + { | ||
| 54 | + return login; | ||
| 55 | + } | ||
| 56 | + | ||
| 57 | + /** | ||
| 58 | + * Sets the value of the login property. | ||
| 59 | + * | ||
| 60 | + * @param value allowed object is | ||
| 61 | + * {@link String } | ||
| 62 | + */ | ||
| 63 | + public void setLogin(String value) | ||
| 64 | + { | ||
| 65 | + this.login = value; | ||
| 66 | + } | ||
| 67 | + | ||
| 68 | + /** | ||
| 69 | + * Gets the value of the url property. | ||
| 70 | + * | ||
| 71 | + * @return possible object is | ||
| 72 | + * {@link String } | ||
| 73 | + */ | ||
| 74 | + public String getUrl() | ||
| 75 | + { | ||
| 76 | + return url; | ||
| 77 | + } | ||
| 78 | + | ||
| 79 | + /** | ||
| 80 | + * Sets the value of the url property. | ||
| 81 | + * | ||
| 82 | + * @param value allowed object is | ||
| 83 | + * {@link String } | ||
| 84 | + */ | ||
| 85 | + public void setUrl(String value) | ||
| 86 | + { | ||
| 87 | + this.url = value; | ||
| 88 | + } | ||
| 89 | +} |
| 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.03 at 12:32:28 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.XmlElement; | ||
| 13 | +import javax.xml.bind.annotation.XmlRootElement; | ||
| 14 | +import javax.xml.bind.annotation.XmlType; | ||
| 15 | +import java.util.ArrayList; | ||
| 16 | +import java.util.List; | ||
| 17 | + | ||
| 18 | +/** | ||
| 19 | + * <p>Java class for anonymous complex type. | ||
| 20 | + * <p/> | ||
| 21 | + * <p>The following schema fragment specifies the expected content contained within this class. | ||
| 22 | + * <p/> | ||
| 23 | + * <pre> | ||
| 24 | + * <complexType> | ||
| 25 | + * <complexContent> | ||
| 26 | + * <restriction base="{http://www.w3.org/2001/XMLSchema}anyType"> | ||
| 27 | + * <sequence> | ||
| 28 | + * <element name="user" type="{}userType" maxOccurs="unbounded" minOccurs="0"/> | ||
| 29 | + * </sequence> | ||
| 30 | + * </restriction> | ||
| 31 | + * </complexContent> | ||
| 32 | + * </complexType> | ||
| 33 | + * </pre> | ||
| 34 | + */ | ||
| 35 | +@XmlAccessorType(XmlAccessType.FIELD) | ||
| 36 | +@XmlType(name = "", propOrder = {"users"}) | ||
| 37 | +@XmlRootElement(name = "userRefs") | ||
| 38 | +public class UserRefs { | ||
| 39 | +// ------------------------------ FIELDS ------------------------------ | ||
| 40 | + | ||
| 41 | + @XmlElement(name = "user") | ||
| 42 | + protected List<User> users; | ||
| 43 | + | ||
| 44 | +// --------------------- GETTER / SETTER METHODS --------------------- | ||
| 45 | + | ||
| 46 | + /** | ||
| 47 | + * Gets the value of the users property. | ||
| 48 | + * <p/> | ||
| 49 | + * <p/> | ||
| 50 | + * This accessor method returns a reference to the live list, | ||
| 51 | + * not a snapshot. Therefore any modification you make to the | ||
| 52 | + * returned list will be present inside the JAXB object. | ||
| 53 | + * This is why there is not a <CODE>set</CODE> method for the users property. | ||
| 54 | + * <p/> | ||
| 55 | + * <p/> | ||
| 56 | + * For example, to add a new item, do as follows: | ||
| 57 | + * <pre> | ||
| 58 | + * getUsers().add(newItem); | ||
| 59 | + * </pre> | ||
| 60 | + * <p/> | ||
| 61 | + * <p/> | ||
| 62 | + * <p/> | ||
| 63 | + * Objects of the following type(s) are allowed in the list | ||
| 64 | + * {@link User } | ||
| 65 | + */ | ||
| 66 | + public List<User> getUsers() | ||
| 67 | + { | ||
| 68 | + if (users == null) { | ||
| 69 | + users = new ArrayList<User>(); | ||
| 70 | + } | ||
| 71 | + return this.users; | ||
| 72 | + } | ||
| 73 | +} |
| @@ -9,6 +9,12 @@ | @@ -9,6 +9,12 @@ | ||
| 9 | </jxb:bindings> | 9 | </jxb:bindings> |
| 10 | </jxb:bindings> | 10 | </jxb:bindings> |
| 11 | 11 | ||
| 12 | + <jxb:bindings schemaLocation="../xsd/individualAssignees.xsd" node="/xs:schema"> | ||
| 13 | + <jxb:bindings node=".//xs:element[@name='userRefs']//xs:sequence[@id='users']"> | ||
| 14 | + <jxb:property name="users"/> | ||
| 15 | + </jxb:bindings> | ||
| 16 | + </jxb:bindings> | ||
| 17 | + | ||
| 12 | <jxb:bindings schemaLocation="../xsd/types.xsd" node="/xs:schema"> | 18 | <jxb:bindings schemaLocation="../xsd/types.xsd" node="/xs:schema"> |
| 13 | 19 | ||
| 14 | <jxb:globalBindings localScoping="nested"/> | 20 | <jxb:globalBindings localScoping="nested"/> |
| @@ -28,6 +34,10 @@ | @@ -28,6 +34,10 @@ | ||
| 28 | <jxb:class name="Comment"/> | 34 | <jxb:class name="Comment"/> |
| 29 | </jxb:bindings> | 35 | </jxb:bindings> |
| 30 | 36 | ||
| 37 | + <jxb:bindings node=".//xs:complexType[@name='userType']"> | ||
| 38 | + <jxb:class name="User"/> | ||
| 39 | + </jxb:bindings> | ||
| 40 | + | ||
| 31 | </jxb:bindings> | 41 | </jxb:bindings> |
| 32 | 42 | ||
| 33 | </jxb:bindings> | 43 | </jxb:bindings> |
| 1 | <?xml version="1.0" encoding="UTF-8"?> | 1 | <?xml version="1.0" encoding="UTF-8"?> |
| 2 | -<xs:schema attributeFormDefault="unqualified" elementFormDefault="qualified" xmlns:xs="http://www.w3.org/2001/XMLSchema"> | 2 | +<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"> |
| 3 | <xs:element name="error" type="xs:string"/> | 3 | <xs:element name="error" type="xs:string"/> |
| 4 | </xs:schema> | 4 | </xs:schema> |
src/main/xsd/individualAssignees.xml
0 → 100644
src/main/xsd/individualAssignees.xsd
0 → 100644
| 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="userRefs"> | ||
| 7 | + <xs:complexType> | ||
| 8 | + <xs:sequence id="users"> | ||
| 9 | + <xs:element name="user" type="userType" maxOccurs="unbounded" minOccurs="0"/> | ||
| 10 | + </xs:sequence> | ||
| 11 | + </xs:complexType> | ||
| 12 | + </xs:element> | ||
| 13 | +</xs:schema> |
| @@ -21,6 +21,7 @@ | @@ -21,6 +21,7 @@ | ||
| 21 | </xs:choice> | 21 | </xs:choice> |
| 22 | <xs:attribute type="xs:string" name="id" use="optional"/> | 22 | <xs:attribute type="xs:string" name="id" use="optional"/> |
| 23 | </xs:complexType> | 23 | </xs:complexType> |
| 24 | + | ||
| 24 | <xs:complexType name="commentType" mixed="true"> | 25 | <xs:complexType name="commentType" mixed="true"> |
| 25 | <xs:sequence> | 26 | <xs:sequence> |
| 26 | <xs:element type="xs:string" name="replies" minOccurs="0"/> | 27 | <xs:element type="xs:string" name="replies" minOccurs="0"/> |
| @@ -44,4 +45,10 @@ | @@ -44,4 +45,10 @@ | ||
| 44 | <xs:attribute type="xs:long" name="created" use="optional"/> | 45 | <xs:attribute type="xs:long" name="created" use="optional"/> |
| 45 | <xs:attribute type="xs:string" name="name" use="optional"/> | 46 | <xs:attribute type="xs:string" name="name" use="optional"/> |
| 46 | </xs:complexType> | 47 | </xs:complexType> |
| 48 | + | ||
| 49 | + <xs:complexType name="userType"> | ||
| 50 | + <xs:attribute type="xs:string" name="login" use="required"/> | ||
| 51 | + <xs:attribute type="xs:anyURI" name="url" use="optional"/> | ||
| 52 | + </xs:complexType> | ||
| 53 | + | ||
| 47 | </xs:schema> | 54 | </xs:schema> |
| @@ -27,7 +27,7 @@ public class YoutrackAPITest { | @@ -27,7 +27,7 @@ public class YoutrackAPITest { | ||
| 27 | // -------------------------- OTHER METHODS -------------------------- | 27 | // -------------------------- OTHER METHODS -------------------------- |
| 28 | 28 | ||
| 29 | @Test | 29 | @Test |
| 30 | - public void commandAllStatesTest() throws IOException, JAXBException | 30 | + public void commandAllStates() throws IOException, JAXBException |
| 31 | { | 31 | { |
| 32 | final YoutrackAPI api = new YoutrackAPI(getServiceLocation(), getUsername(), getPassword()); | 32 | final YoutrackAPI api = new YoutrackAPI(getServiceLocation(), getUsername(), getPassword()); |
| 33 | final String issueId = "TST-1"; | 33 | final String issueId = "TST-1"; |
| @@ -44,7 +44,19 @@ public class YoutrackAPITest { | @@ -44,7 +44,19 @@ public class YoutrackAPITest { | ||
| 44 | } | 44 | } |
| 45 | 45 | ||
| 46 | @Test | 46 | @Test |
| 47 | - public void commandTest() throws IOException, JAXBException | 47 | + public void getIndividualAssignees() throws IOException, JAXBException |
| 48 | + { | ||
| 49 | + final YoutrackAPI api = new YoutrackAPI(getServiceLocation(), getUsername(), getPassword()); | ||
| 50 | + final List<User> assignees = api.getIndividualAssignees("TST"); | ||
| 51 | + Assert.assertNotNull(assignees); | ||
| 52 | + Assert.assertEquals(2, assignees.size()); | ||
| 53 | + for (User user : assignees) { | ||
| 54 | + Assert.assertTrue("bernard".equals(user.getLogin()) || "root".equals(user.getLogin())); | ||
| 55 | + } | ||
| 56 | + } | ||
| 57 | + | ||
| 58 | + @Test | ||
| 59 | + public void command() throws IOException, JAXBException | ||
| 48 | { | 60 | { |
| 49 | final YoutrackAPI api = new YoutrackAPI(getServiceLocation(), getUsername(), getPassword()); | 61 | final YoutrackAPI api = new YoutrackAPI(getServiceLocation(), getUsername(), getPassword()); |
| 50 | final String issueId = "TST-1"; | 62 | final String issueId = "TST-1"; |
| @@ -85,7 +97,7 @@ public class YoutrackAPITest { | @@ -85,7 +97,7 @@ public class YoutrackAPITest { | ||
| 85 | } | 97 | } |
| 86 | 98 | ||
| 87 | @Test | 99 | @Test |
| 88 | - public void createIssueTest() throws IOException, AuthenticationException, JAXBException | 100 | + public void createIssue() throws IOException, AuthenticationException, JAXBException |
| 89 | { | 101 | { |
| 90 | YoutrackAPI api = new YoutrackAPI(getServiceLocation(), getUsername(), getPassword()); | 102 | YoutrackAPI api = new YoutrackAPI(getServiceLocation(), getUsername(), getPassword()); |
| 91 | final String issueId = api.createIssue("TST", "Test summary", "Test description"); | 103 | final String issueId = api.createIssue("TST", "Test summary", "Test description"); |
| @@ -94,7 +106,7 @@ public class YoutrackAPITest { | @@ -94,7 +106,7 @@ public class YoutrackAPITest { | ||
| 94 | } | 106 | } |
| 95 | 107 | ||
| 96 | @Test | 108 | @Test |
| 97 | - public void getIssueTest() throws IOException, AuthenticationException, JAXBException | 109 | + public void getIssue() throws IOException, AuthenticationException, JAXBException |
| 98 | { | 110 | { |
| 99 | YoutrackAPI api = new YoutrackAPI(getServiceLocation(), getUsername(), getPassword()); | 111 | YoutrackAPI api = new YoutrackAPI(getServiceLocation(), getUsername(), getPassword()); |
| 100 | final IssueWrapper issue = api.getIssue("TST-1"); | 112 | final IssueWrapper issue = api.getIssue("TST-1"); |
| @@ -116,7 +128,7 @@ public class YoutrackAPITest { | @@ -116,7 +128,7 @@ public class YoutrackAPITest { | ||
| 116 | } | 128 | } |
| 117 | 129 | ||
| 118 | @Test(expected = YoutrackErrorException.class) | 130 | @Test(expected = YoutrackErrorException.class) |
| 119 | - public void loginFailureTest() throws IOException, JAXBException | 131 | + public void loginFailure() throws IOException, JAXBException |
| 120 | { | 132 | { |
| 121 | final String username = "someFakeLogin"; | 133 | final String username = "someFakeLogin"; |
| 122 | final String password = "someFakePassword"; | 134 | final String password = "someFakePassword"; |
| @@ -130,7 +142,7 @@ public class YoutrackAPITest { | @@ -130,7 +142,7 @@ public class YoutrackAPITest { | ||
| 130 | } | 142 | } |
| 131 | 143 | ||
| 132 | @Test | 144 | @Test |
| 133 | - public void loginTest() throws IOException, AuthenticationException, JAXBException | 145 | + public void loginSuccess() throws IOException, AuthenticationException, JAXBException |
| 134 | { | 146 | { |
| 135 | final String username = getUsername(); | 147 | final String username = getUsername(); |
| 136 | final String password = getPassword(); | 148 | final String password = getPassword(); |
| @@ -140,7 +152,7 @@ public class YoutrackAPITest { | @@ -140,7 +152,7 @@ public class YoutrackAPITest { | ||
| 140 | } | 152 | } |
| 141 | 153 | ||
| 142 | @Test | 154 | @Test |
| 143 | - public void searchIssuesByProjectTest() throws IOException, AuthenticationException, JAXBException | 155 | + public void searchIssuesByProject() throws IOException, AuthenticationException, JAXBException |
| 144 | { | 156 | { |
| 145 | YoutrackAPI api = new YoutrackAPI(getServiceLocation(), getUsername(), getPassword()); | 157 | YoutrackAPI api = new YoutrackAPI(getServiceLocation(), getUsername(), getPassword()); |
| 146 | List<IssueWrapper> issues = api.searchIssuesByProject("TST", null); | 158 | List<IssueWrapper> issues = api.searchIssuesByProject("TST", null); |
Please
register
or
login
to post a comment