diff --git a/.gitignore b/.gitignore
index 9a5d438..c745262 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,6 +1,5 @@
out/
.DS_Store
-RallyRestApiJava.iws
/target
-
.idea
+*.iws
diff --git a/README.md b/README.md
index 6e118c5..7194c58 100644
--- a/README.md
+++ b/README.md
@@ -1,6 +1,6 @@
## License
-Copyright (c) 2002-2013 Rally Software Development Corp. All Rights Reserved. Your use of this Software is governed by the terms and conditions of the applicable Subscription Agreement between your company and Rally Software Development Corp.
+Copyright (c) Rally Software Development Corp. 2013 Distributed under the MIT License.
## Warranty
@@ -8,471 +8,21 @@ The Java Toolkit for Rally REST API is available on an as-is basis.
## Support
-Rally Software does not actively maintain this toolkit. If you have a question or problem, we recommend posting it to Stack Overflow: http://stackoverflow.com/questions/ask?tags=rally
+Rally Software does not actively maintain or support this toolkit. If you have a question or problem, we recommend posting it to Stack Overflow: http://stackoverflow.com/questions/ask?tags=rally
-##Introduction
+## Download
-The Java Toolkit for Rally REST API provides an intuitive Java API for accessing your Rally Data.
+[Download REST API jar and dependencies](https://github.com/RallyTools/RallyRestToolkitForJava/wiki/User-Guide#setup)
-It provides a rich set of capabilities for querying, along with methods for creating, reading, updating, and deleting individual items.
+## User Guide
-[Java 7 Download](http://people.rallydev.com/connector/RallyRestApiJava/1.0.7/java7/rally-rest-api-1.0.7.jar)
+Please view the [Java Toolkit for Rally REST API User Guide](https://github.com/RallyTools/RallyRestToolkitForJava/wiki/User-Guide) in the attached wiki
-[Java 6 Download](http://people.rallydev.com/connector/RallyRestApiJava/1.0.7/java6/rally-rest-api-1.0.7.jar)
-
-[Full API documentation](https://docs.rallydev.com/javarestapi/index.html)
+[Java Toolkit for Rally REST API javadocs](http://rallytools.github.io/RallyRestToolkitForJava/)
[Web Services API documentation](https://rally1.rallydev.com/slm/doc/webservice)
-## Setup
-
-Create a new Java project in your favorite IDE.
-
-#### Manual
-Add rally-rest-api-2.0.2.jar appropriate to your version of JDK to your classpath.
-
-You will also need to add the following jars:
-
-* httpcore-4.2.1.jar
-* httpclient-4.2.1.jar
-* httpclient-cache-4.2.1.jar
-* commons-logging-1.1.1.jar
-* commons-codec-1.6.jar
-* gson-2.1.jar
-
-All the jars except gson-2.1.jar can be found in [httpcomponents-client-4.2.1-bin.zip](http://archive.apache.org/dist/httpcomponents/httpclient/binary/httpcomponents-client-4.2.1-bin.zip) in the archives for the Apache httpcomponents project.
-
-The gson-2.1.jar file can be found in [google-gson-2.1-release.zip](http://google-gson.googlecode.com/files/google-gson-2.1-release.zip) on Google Code.
-
-#### Managed (Maven)
-Add the rally-rest-api dependency to your pom.xml
-
-```xml
-
The parameters for [RallyRestApi](https://docs.rallydev.com/javarestapi/com/rallydev/rest/RallyRestApi.html) are as follows: - -
| Parameter | -Description | -Example | -
|---|---|---|
| server* | -The Rally server to connect to. | -"https://rally1.rallydev.com" | -
| userName* | -The username to connect to Rally with. | -"user@company.com" | -
| password* | -The password to connect to Rally with. | -"password" | -
| Method Name | -Parameters | -Description | -
|---|---|---|
| [create](https://docs.rallydev.com/javarestapi/com/rallydev/rest/RallyRestApi.html#create(com.rallydev.rest.request.CreateRequest)) | -[CreateRequest](https://docs.rallydev.com/javarestapi/com/rallydev/rest/request/CreateRequest.html) request* | -Create the object described by the request parameter. Returns a [CreateResponse](https://docs.rallydev.com/javarestapi/com/rallydev/rest/response/CreateResponse.html) object containing the results of the request. | -
| **Example:**
- |
-||
| [get](https://docs.rallydev.com/javarestapi/com/rallydev/rest/RallyRestApi.html#get(com.rallydev.rest.request.GetRequest)) | -[GetRequest](https://docs.rallydev.com/javarestapi/com/rallydev/rest/request/GetRequest.html) request* | -Retrieve the object described by the request parameter. Returns a [GetResponse](https://docs.rallydev.com/javarestapi/com/rallydev/rest/response/GetResponse.html) object containing the results of the request. | -
| **Example:**
- |
-||
| [update](https://docs.rallydev.com/javarestapi/com/rallydev/rest/RallyRestApi.html#update(com.rallydev.rest.request.UpdateRequest)) | -[UpdateRequest](https://docs.rallydev.com/javarestapi/com/rallydev/rest/request/UpdateRequest.html) request* | -Update the object described by the request parameter. Returns a [UpdateResponse](https://docs.rallydev.com/javarestapi/com/rallydev/rest/response/UpdateResponse.html) object containing the results of the request. | -
| **Example:**
- |
-||
| [delete](https://docs.rallydev.com/javarestapi/com/rallydev/rest/RallyRestApi.html#delete(com.rallydev.rest.request.DeleteRequest)) | -[DeleteRequest](https://docs.rallydev.com/javarestapi/com/rallydev/rest/request/DeleteRequest.html) request* | -Delete the object described by the request parameter. Returns a [DeleteResponse](https://docs.rallydev.com/javarestapi/com/rallydev/rest/response/DeleteResponse.html) object containing the results of the request. | -
| **Example:**
- |
-||
| [query](https://docs.rallydev.com/javarestapi/com/rallydev/rest/RallyRestApi.html#query(com.rallydev.rest.request.QueryRequest)) | -[QueryRequest](https://docs.rallydev.com/javarestapi/com/rallydev/rest/request/QueryRequest.html) request* | -Query for objects matching the specified request. By default one page of data will be returned. Paging will automatically be performed if a limit is set on the request. Returns a [QueryResponse](https://docs.rallydev.com/javarestapi/com/rallydev/rest/response/QueryResponse.html) object containing the results of the request. | -
| **Example:**
- |
-||
| [setWsapiVersion](https://docs.rallydev.com/javarestapi/com/rallydev/rest/RallyRestApi.html#setWsapiVersion(java.lang.String)) | -String wsapiVersion* | -Specifies the version of Rally's web services API to use. Defaults to 1.33 | -
| **Example:**
- |
-||
| [getWsapiVersion](https://docs.rallydev.com/javarestapi/com/rallydev/rest/RallyRestApi.html#getWsapiVersion()) | -- | Gets the version of Rally's web services that the Toolkit is configured to use. | -
| **Example:**
- |
-||
| [setApplicationName](https://docs.rallydev.com/javarestapi/com/rallydev/rest/RallyRestApi.html#setApplicationName(java.lang.String)) | -String name* | -Set the name of your application. This name can be whatever you wish, and is added to the request headers of any web service requests your application makes. We encourage you to set this value, as it helps track usage of the toolkit. | -
| **Example:**
- |
-||
| [setApplicationVersion](https://docs.rallydev.com/javarestapi/com/rallydev/rest/RallyRestApi.html#setApplicationVersion(java.lang.String)) | -String version* | -Set the version of the application using the Java Toolkit. This version can be whatever you wish, and is added to the request headers of any web service requests your application makes. | -
| **Example:**
- |
-||
| [setApplicationVendor](https://docs.rallydev.com/javarestapi/com/rallydev/rest/RallyRestApi.html#setApplicationVendor(java.lang.String)l) | -String vendor* | -Set the vendor of the application using the Java Toolkit. This name can be whatever you wish (usually your company name), and is added to the request headers of any web service requests your application makes. | -
| **Example:**
- |
-||
| [setProxy](https://docs.rallydev.com/javarestapi/com/rallydev/rest/RallyRestApi.html#setProxy(java.net.URI)) | -java.net.URI proxy* -String userName -String password | -Set the proxy server to use, if you connect to Rally through a proxy server. By default, no proxy is configured. The userName and password parameters are optional, and are used if your proxy server requires authentication. | -
| **Example:**
- |
-||
| [close](https://docs.rallydev.com/javarestapi/com/rallydev/rest/RallyRestApi.html#close()) | -- | Closes open connections and releases resources. You should always call this method before your application exits. | -
| **Example:**
- |
-||
The main interface to the Rest API.
@@ -45,42 +17,7 @@ */ public class RallyRestApi implements Closeable { - private enum Header { - Library, - Name, - Vendor, - Version - } - - /** - * The default version of the WSAPI to target. - */ - public static final String DEFAULT_WSAPI_VERSION = "v2.0"; - public static final String CREATE_RESULT_KEY = "CreateResult"; - public static final String OPERATION_RESULT_KEY = "OperationResult"; - public static final String QUERY_RESULT_KEY = "QueryResult"; - - protected static final String SECURITY_ENDPOINT_DOES_NOT_EXIST = "SECURITY_ENDPOINT_DOES_NOT_EXIST"; - protected static final String SECURITY_TOKEN_PARAM_KEY = "key"; - private static final String SECURITY_TOKEN_URL = "/security/authorize"; - protected static final String SECURITY_TOKEN_KEY = "SecurityToken"; - - protected URI server; - protected URI proxy; - - protected String wsapiVersion = DEFAULT_WSAPI_VERSION; - protected DefaultHttpClient httpClient; - private UsernamePasswordCredentials usernamePasswordCredentials; - private String securityToken; - - protected MapGet the current list of fields to be returned on the updated object.
+ * By default all fields will be returned in the response (fetch=true). + * + * @return the current list of fields. + */ + public Fetch getFetch() { + return fetch; + } + + /** + * Set the current list of fields to be returned on the updated object. + * + * @param fetch the list of fields to be returned. + */ + public void setFetch(Fetch fetch) { + this.fetch = fetch; + } + + /** + *Convert this request into a url compatible with the WSAPI.
+ * The current fetch and any other parameters will be included. + * + * @return the url representing this request. + */ + @Override + public String toUrl() { + + ListSpecify the workspace which the result set should be scoped to.
+ *Specify the workspace which the result set should be scoped to.
* The default is the user's default workspace. - * * * @param workspaceRef the ref of the workspace to scope to. May be an absolute or relative ref, e.g. /workspace/1234 */ @@ -118,10 +117,9 @@ public String getProject() { } /** - *Specify the project which the result set should be scoped to.
+ *Specify the project which the result set should be scoped to.
* The default is the user's default project. * Specifying null will cause the result to be scoped to the entire specified workspace. - * * * @param projectRef the ref of the project to scope to. May be null or an absolute or relative ref, e.g. /project/1234 */ @@ -131,7 +129,6 @@ public void setProject(String projectRef) { /** * If a project has been specified, get whether to include matching objects in parent projects in the result set. - * * * @return whether to include matching objects in parent projects. */ @@ -142,7 +139,6 @@ public boolean isScopedUp() { /** *If a project has been specified, set whether to include matching objects in parent projects in the result set.
* Defaults to false. - * * * @param scopeUp whether to include matching objects in parent projects */ @@ -152,7 +148,6 @@ public void setScopedUp(boolean scopeUp) { /** * If a project has been specified, get whether to include matching objects in child projects in the result set. - * * * @return whether to include matching objects in child projects. */ @@ -163,7 +158,6 @@ public boolean isScopedDown() { /** *If a project has been specified, set whether to include matching objects in child projects in the result set.
* Defaults to true. - * * * @param scopeDown whether to include matching objects in child projects */ diff --git a/src/main/java/com/rallydev/rest/request/Request.java b/src/main/java/com/rallydev/rest/request/Request.java index 3a37b91..9e86066 100644 --- a/src/main/java/com/rallydev/rest/request/Request.java +++ b/src/main/java/com/rallydev/rest/request/Request.java @@ -1,5 +1,6 @@ package com.rallydev.rest.request; +import com.google.gson.GsonBuilder; import org.apache.http.NameValuePair; import org.apache.http.message.BasicNameValuePair; @@ -14,10 +15,16 @@ public abstract class Request { private ListConvert this request into a url compatible with the WSAPI.
* Must be implemented by subclasses. diff --git a/src/main/java/com/rallydev/rest/request/UpdateRequest.java b/src/main/java/com/rallydev/rest/request/UpdateRequest.java index 758db49..e0f3a7d 100644 --- a/src/main/java/com/rallydev/rest/request/UpdateRequest.java +++ b/src/main/java/com/rallydev/rest/request/UpdateRequest.java @@ -1,6 +1,5 @@ package com.rallydev.rest.request; -import com.google.gson.Gson; import com.google.gson.JsonObject; import com.rallydev.rest.util.Fetch; import com.rallydev.rest.util.Ref; @@ -27,7 +26,7 @@ public class UpdateRequest extends Request { * @param obj the JSON representation of the values of the object */ public UpdateRequest(String ref, JsonObject obj) { - this.ref= ref; + this.ref = ref; this.obj = obj; } @@ -39,7 +38,7 @@ public UpdateRequest(String ref, JsonObject obj) { public String getBody() { JsonObject wrapper = new JsonObject(); wrapper.add(Ref.getTypeFromRef(ref), obj); - return new Gson().toJson(wrapper); + return gsonBuilder.create().toJson(wrapper); } /** diff --git a/src/main/java/com/rallydev/rest/response/CollectionUpdateResponse.java b/src/main/java/com/rallydev/rest/response/CollectionUpdateResponse.java new file mode 100644 index 0000000..6a42b3f --- /dev/null +++ b/src/main/java/com/rallydev/rest/response/CollectionUpdateResponse.java @@ -0,0 +1,37 @@ +package com.rallydev.rest.response; + +import com.google.gson.JsonArray; + +/** + * Represents a WSAPI response from updating a collection. + */ +public class CollectionUpdateResponse extends Response { + + /** + * Create a new collection update response from the specified JSON encoded string. + * Note that this class is only usable with WSAPI versions 2.0 and above. + * + * @param updateResponse the JSON encoded string + */ + public CollectionUpdateResponse(String updateResponse) { + super(updateResponse); + } + + /** + * Get the name of the root JSON result + * + * @return the root element name + */ + @Override + protected String getRoot() { + return "OperationResult"; + } + + /** + * Get the results of the collection update + * @return the results + */ + public JsonArray getResults() { + return result.getAsJsonArray("Results"); + } +} diff --git a/src/main/java/com/rallydev/rest/response/CreateResponse.java b/src/main/java/com/rallydev/rest/response/CreateResponse.java index 373797a..1a60045 100644 --- a/src/main/java/com/rallydev/rest/response/CreateResponse.java +++ b/src/main/java/com/rallydev/rest/response/CreateResponse.java @@ -4,13 +4,13 @@ import com.rallydev.rest.RallyRestApi; /** - * Represents a WSAPI response from creating an object + * Represents a WSAPI response from creating an object */ public class CreateResponse extends Response { /** * Create a new create response from the specified JSON encoded string. - * + * * @param createResponse the JSON encoded string */ public CreateResponse(String createResponse) { @@ -19,17 +19,17 @@ public CreateResponse(String createResponse) { /** * Get the name of the root JSON result - * + * * @return the root element name */ @Override protected String getRoot() { - return RallyRestApi.CREATE_RESULT_KEY; + return "CreateResult"; } /** * Get the created object. - *Returns null if the operation was not successful
+ *Returns null if the operation was not successful
* @return the created object */ public JsonObject getObject() { diff --git a/src/main/java/com/rallydev/rest/response/DeleteResponse.java b/src/main/java/com/rallydev/rest/response/DeleteResponse.java index a4e98c7..477efff 100644 --- a/src/main/java/com/rallydev/rest/response/DeleteResponse.java +++ b/src/main/java/com/rallydev/rest/response/DeleteResponse.java @@ -1,7 +1,5 @@ package com.rallydev.rest.response; -import static com.rallydev.rest.RallyRestApi.OPERATION_RESULT_KEY; - /** * Represents a WSAPI response from deleting an object */ @@ -23,6 +21,6 @@ public DeleteResponse(String deleteResponse) { */ @Override protected String getRoot() { - return OPERATION_RESULT_KEY; + return "OperationResult"; } } diff --git a/src/main/java/com/rallydev/rest/response/QueryResponse.java b/src/main/java/com/rallydev/rest/response/QueryResponse.java index 8dfecd3..148f92e 100644 --- a/src/main/java/com/rallydev/rest/response/QueryResponse.java +++ b/src/main/java/com/rallydev/rest/response/QueryResponse.java @@ -2,8 +2,6 @@ import com.google.gson.JsonArray; -import static com.rallydev.rest.RallyRestApi.QUERY_RESULT_KEY; - /** * Represents a WSAPI response from querying for objects. */ @@ -25,12 +23,12 @@ public QueryResponse(String queryResponse) { */ @Override protected String getRoot() { - return QUERY_RESULT_KEY; + return "QueryResult"; } /** * Get the total number of objects that matched the query - * + * * @return the total number of objects */ public int getTotalResultCount() { @@ -40,7 +38,7 @@ public int getTotalResultCount() { /** * Get the results of the query *Depending on the limit of the original request this may include one or more pages.
- * + * * @return the results */ public JsonArray getResults() { @@ -49,7 +47,7 @@ public JsonArray getResults() { /** * Get the page size of the results - * + * * @return the page size */ public int getPageSize() { @@ -58,7 +56,7 @@ public int getPageSize() { /** * Get the start index of the results - * + * * @return the start index */ public int getStart() { diff --git a/src/main/java/com/rallydev/rest/response/UpdateResponse.java b/src/main/java/com/rallydev/rest/response/UpdateResponse.java index df4043e..0e12292 100644 --- a/src/main/java/com/rallydev/rest/response/UpdateResponse.java +++ b/src/main/java/com/rallydev/rest/response/UpdateResponse.java @@ -2,8 +2,6 @@ import com.google.gson.JsonObject; -import static com.rallydev.rest.RallyRestApi.OPERATION_RESULT_KEY; - /** * Represents a WSAPI response from updating an object. */ @@ -25,12 +23,12 @@ public UpdateResponse(String updateResponse) { */ @Override protected String getRoot() { - return OPERATION_RESULT_KEY; + return "OperationResult"; } /** * Get the updated object. - *Returns null if the operation was not successful
+ *Returns null if the operation was not successful
* @return the updated object */ public JsonObject getObject() { diff --git a/src/main/java/com/rallydev/rest/util/InvalidURLException.java b/src/main/java/com/rallydev/rest/util/InvalidURLException.java deleted file mode 100644 index ccd341b..0000000 --- a/src/main/java/com/rallydev/rest/util/InvalidURLException.java +++ /dev/null @@ -1,7 +0,0 @@ -package com.rallydev.rest.util; - -public class InvalidURLException extends RuntimeException { - public InvalidURLException(String msg) { - super(msg); - } -} diff --git a/src/main/java/com/rallydev/rest/util/Ref.java b/src/main/java/com/rallydev/rest/util/Ref.java index 7d56fba..2463787 100644 --- a/src/main/java/com/rallydev/rest/util/Ref.java +++ b/src/main/java/com/rallydev/rest/util/Ref.java @@ -23,10 +23,24 @@ public class Ref { Pattern.compile(".*?/(\\w+/-?\\d+)/(\\w+)(?:\\.js\\??.*)*$"), //basic ref (/defect/1234) - Pattern.compile(".*?/(\\w+)/(\\d+)(?:\\.js\\??.*)*$"), + Pattern.compile(".*?/(\\w+)/(-?\\d+)(?:\\.js\\??.*)*$"), //permission ref (/workspacepermission/123u456w1) - Pattern.compile(".*?/(\\w+)/(\\d+u\\d+[pw]\\d+)(?:\\.js\\??.*)*$") + Pattern.compile(".*?/(\\w+)/(\\d+u\\d+[pw]\\d+)(?:\\.js\\??.*)*$"), + + //adding UUID regex support in the ref urls + + //dynatype collection ref (/portfolioitem/feature/81348db8-aacd-447e-8678-2fb910ae9dc3 + Pattern.compile(".*?/(\\w{2,}/\\w+)/([0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}/\\w+)(?:\\.js\\??.*)*$"), + + //dynatype ref (/portfolioitem/feature/81348db8-aacd-447e-8678-2fb910ae9dc3 + Pattern.compile(".*?/(\\w{2,}/\\w+)/([0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12})(?:\\.js\\??.*)*$"), + + //collection ref (/defect/81348db8-aacd-447e-8678-2fb910ae9dc3/tasks) + Pattern.compile(".*?/(\\w+/-?[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12})/(\\w+)(?:\\.js\\??.*)*$"), + + //basic ref (/defect/81348db8-aacd-447e-8678-2fb910ae9dc3) + Pattern.compile(".*?/(\\w+)/([0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12})(?:\\.js\\??.*)*$") )); private static Matcher match(String ref) { diff --git a/src/main/resources/doc/allclasses-frame.html b/src/main/resources/doc/allclasses-frame.html index 95c9880..85b129b 100644 --- a/src/main/resources/doc/allclasses-frame.html +++ b/src/main/resources/doc/allclasses-frame.html @@ -2,15 +2,19 @@ - -public class CollectionAddExample +extends Object+
| Constructor and Description | +
|---|
CollectionAddExample() |
+
public static void main(String[] args) + throws URISyntaxException, + IOException+
URISyntaxExceptionIOExceptionpublic class CollectionQueryExample +extends Object+
| Constructor and Description | +
|---|
CollectionQueryExample() |
+
public CollectionQueryExample()+
public static void main(String[] args) + throws URISyntaxException, + IOException+
URISyntaxExceptionIOExceptionpublic class CollectionSummaryExample +extends Object+
| Constructor and Description | +
|---|
CollectionSummaryExample() |
+
public CollectionSummaryExample()+
public static void main(String[] args) + throws URISyntaxException, + IOException+
URISyntaxExceptionIOExceptionpublic class CrudExample +extends Object+
| Constructor and Description | +
|---|
CrudExample() |
+
public static void main(String[] args) + throws URISyntaxException, + IOException+
URISyntaxExceptionIOExceptionpublic class QueryExample +extends Object+
| Constructor and Description | +
|---|
QueryExample() |
+
public static void main(String[] args) + throws URISyntaxException, + IOException+
URISyntaxExceptionIOException| Modifier and Type | -Field and Description | -
|---|---|
static String |
-CREATE_RESULT_KEY |
-
static String |
-DEFAULT_WSAPI_VERSION
-The default version of the WSAPI to target.
- |
-
static String |
-OPERATION_RESULT_KEY |
-
static String |
-QUERY_RESULT_KEY |
-
RallyRestApi(URI server,
+ String apiKey)
+RallyRestApi(URI server,
String userName,
String password)
-HttpClientgetClient()
+StringgetWsapiVersion()
QueryResponsequery(QueryRequest request)
voidsetApplicationName(String value)
voidsetApplicationVendor(String value)
voidsetApplicationVersion(String value)
voidsetProxy(URI proxy)
voidsetProxy(URI proxy,
String userName,
@@ -245,18 +226,24 @@ Method Summary
Set the authenticated proxy server to use.
voidsetWsapiVersion(String wsapiVersion)
UpdateResponseupdate(UpdateRequest request)
CollectionUpdateResponseupdateCollection(CollectionUpdateRequest request)
+public static final String DEFAULT_WSAPI_VERSION-
public static final String CREATE_RESULT_KEY-
public static final String OPERATION_RESULT_KEY-
public static final String QUERY_RESULT_KEY-
public RallyRestApi(URI server, String userName, String password)+
server - The server to connect to, e.g. new URI("https://rally1.rallydev.com")userName - The username to be used for authentication.password - The password to be used for authentication.value - The vendor header to be included on all requests.public String getWsapiVersion()+
public void setWsapiVersion(String wsapiVersion)+
wsapiVersion - the new version, e.g. "1.30"IOException - if an error occurs during the update.public CollectionUpdateResponse updateCollection(CollectionUpdateRequest request) + throws IOException+
request - the CollectionUpdateRequest specifying the collection to be updated.CollectionUpdateResponseIOException - if an error occurs during the update.IOException - if an error occurs releasing resourcespublic String getWsapiVersion()-
DEFAULT_WSAPI_VERSIONpublic void setWsapiVersion(String wsapiVersion)-
wsapiVersion - the new version, e.g. "1.30"public HttpClient getClient()+
public class RallyRestApiTest +extends Object+
| Constructor and Description | +
|---|
RallyRestApiTest() |
+
| Modifier and Type | +Method and Description | +
|---|---|
void |
+shouldClose() |
+
void |
+shouldCreate() |
+
void |
+shouldDelete() |
+
void |
+shouldGet() |
+
void |
+shouldGetWsapiVersion() |
+
void |
+shouldInitializeApiKeyClient() |
+
void |
+shouldInitializeBasicAuthClient() |
+
void |
+shouldQueryAllPages() |
+
void |
+shouldQueryAllPagesWithNonStandardStart() |
+
void |
+shouldQueryNoPages() |
+
void |
+shouldQueryOnePage() |
+
void |
+shouldQuerySomePages() |
+
void |
+shouldQuerySomePagesWithNonStandardStart() |
+
void |
+shouldSetName() |
+
void |
+shouldSetProxy() |
+
void |
+shouldSetProxyWithCredentials() |
+
void |
+shouldSetVendor() |
+
void |
+shouldSetVersion() |
+
void |
+shouldSetWsapiVersion() |
+
void |
+shouldUpdate() |
+
void |
+shouldUpdateCollection() |
+
public void shouldInitializeBasicAuthClient()+
public void shouldInitializeApiKeyClient()+
public void shouldSetProxyWithCredentials() + throws Exception+
Exceptionpublic void shouldGetWsapiVersion()+
public void shouldSetWsapiVersion()+
public void shouldUpdateCollection() + throws Exception+
Exceptionpublic void shouldQueryAllPages() + throws Exception+
Exceptionpublic void shouldQuerySomePages() + throws Exception+
Exceptionpublic void shouldQuerySomePagesWithNonStandardStart() + throws Exception+
Exceptionpublic void shouldQueryAllPagesWithNonStandardStart() + throws Exception+
Exceptionpublic class RestApiFactory +extends Object+
| Constructor and Description | +
|---|
RestApiFactory() |
+
public static RallyRestApi getRestApi() + throws URISyntaxException+
URISyntaxExceptionpublic class ApiKeyClient +extends HttpClient+
| Constructor and Description | +
|---|
ApiKeyClient(URI server,
+ String apiKey)
+Construct a new client.
+ |
+
close, doDelete, doGet, doPost, doPut, getServer, getWsapiUrl, getWsapiVersion, setApplicationName, setApplicationVendor, setApplicationVersion, setProxy, setProxy, setWsapiVersionsetDefaultHttpParamsaddRequestInterceptor, addRequestInterceptor, addResponseInterceptor, addResponseInterceptor, clearRequestInterceptors, clearResponseInterceptors, execute, execute, execute, execute, execute, execute, execute, execute, getAuthSchemes, getBackoffManager, getConnectionBackoffStrategy, getConnectionKeepAliveStrategy, getConnectionManager, getConnectionReuseStrategy, getCookieSpecs, getCookieStore, getCredentialsProvider, getHttpRequestRetryHandler, getParams, getProxyAuthenticationHandler, getProxyAuthenticationStrategy, getRedirectHandler, getRedirectStrategy, getRequestExecutor, getRequestInterceptor, getRequestInterceptorCount, getResponseInterceptor, getResponseInterceptorCount, getRoutePlanner, getTargetAuthenticationHandler, getTargetAuthenticationStrategy, getUserTokenHandler, removeRequestInterceptorByClass, removeResponseInterceptorByClass, setAuthSchemes, setBackoffManager, setConnectionBackoffStrategy, setCookieSpecs, setCookieStore, setCredentialsProvider, setHttpRequestRetryHandler, setKeepAliveStrategy, setParams, setProxyAuthenticationHandler, setProxyAuthenticationStrategy, setRedirectHandler, setRedirectStrategy, setReuseStrategy, setRoutePlanner, setTargetAuthenticationHandler, setTargetAuthenticationStrategy, setUserTokenHandlerpublic class ApiKeyClientTest +extends Object+
| Constructor and Description | +
|---|
ApiKeyClientTest() |
+
| Modifier and Type | +Method and Description | +
|---|---|
void |
+setUp() |
+
void |
+shouldIncludeApiKeyOnRequest() |
+
void |
+shouldIntialize() |
+
public void setUp() + throws URISyntaxException+
URISyntaxExceptionpublic void shouldIntialize()+
public class BasicAuthClient +extends HttpClient+
| Constructor and Description | +
|---|
BasicAuthClient(URI server,
+ String userName,
+ String password)
+Construct a new client.
+ |
+
close, doDelete, doGet, doPost, doPut, getServer, getWsapiUrl, getWsapiVersion, setApplicationName, setApplicationVendor, setApplicationVersion, setProxy, setProxy, setWsapiVersionsetDefaultHttpParamsaddRequestInterceptor, addRequestInterceptor, addResponseInterceptor, addResponseInterceptor, clearRequestInterceptors, clearResponseInterceptors, execute, execute, execute, execute, execute, execute, execute, execute, getAuthSchemes, getBackoffManager, getConnectionBackoffStrategy, getConnectionKeepAliveStrategy, getConnectionManager, getConnectionReuseStrategy, getCookieSpecs, getCookieStore, getCredentialsProvider, getHttpRequestRetryHandler, getParams, getProxyAuthenticationHandler, getProxyAuthenticationStrategy, getRedirectHandler, getRedirectStrategy, getRequestExecutor, getRequestInterceptor, getRequestInterceptorCount, getResponseInterceptor, getResponseInterceptorCount, getRoutePlanner, getTargetAuthenticationHandler, getTargetAuthenticationStrategy, getUserTokenHandler, removeRequestInterceptorByClass, removeResponseInterceptorByClass, setAuthSchemes, setBackoffManager, setConnectionBackoffStrategy, setCookieSpecs, setCookieStore, setCredentialsProvider, setHttpRequestRetryHandler, setKeepAliveStrategy, setParams, setProxyAuthenticationHandler, setProxyAuthenticationStrategy, setRedirectHandler, setRedirectStrategy, setReuseStrategy, setRoutePlanner, setTargetAuthenticationHandler, setTargetAuthenticationStrategy, setUserTokenHandlerpublic class BasicAuthClientTest +extends Object+
| Constructor and Description | +
|---|
BasicAuthClientTest() |
+
| Modifier and Type | +Method and Description | +
|---|---|
void |
+setUp() |
+
void |
+shouldIncludeCSRFTokenOnDelete() |
+
void |
+shouldIncludeCSRFTokenOnPost() |
+
void |
+shouldIncludeCSRFTokenOnPut() |
+
void |
+shouldIntialize() |
+
void |
+shouldNotIncludeCSRFTokenOnGet() |
+
void |
+shouldNotIncludeCSRFTokenOnWsapiv1() |
+
void |
+shouldRequestCSRFToken() |
+
public void setUp() + throws URISyntaxException+
URISyntaxExceptionpublic void shouldIntialize()+
public void shouldNotIncludeCSRFTokenOnGet() + throws Exception+
Exceptionpublic void shouldNotIncludeCSRFTokenOnWsapiv1() + throws Exception+
Exceptionpublic void shouldRequestCSRFToken() + throws Exception+
Exceptionpublic void shouldIncludeCSRFTokenOnPost() + throws Exception+
Exceptionpublic void shouldIncludeCSRFTokenOnPut() + throws Exception+
Exceptionpublic class HttpClient +extends DefaultHttpClient +implements Closeable+
| Modifier and Type | +Method and Description | +
|---|---|
void |
+close()
+Release all resources associated with this instance.
+ |
+
String |
+doDelete(String url)
+Perform a delete against the WSAPI
+ |
+
String |
+doGet(String url)
+Perform a get against the WSAPI
+ |
+
String |
+doPost(String url,
+ String body)
+Perform a post against the WSAPI
+ |
+
String |
+doPut(String url,
+ String body)
+Perform a put against the WSAPI
+ |
+
String |
+getServer()
+Get the current server being targeted.
+ |
+
String |
+getWsapiUrl()
+Get the WSAPI base url based on the current server and WSAPI version
+ |
+
String |
+getWsapiVersion()
+Get the current version of the WSAPI being targeted.
+ |
+
void |
+setApplicationName(String value)
+Set the value of the X-RallyIntegrationName header included on all requests.
+ |
+
void |
+setApplicationVendor(String value)
+Set the value of the X-RallyIntegrationVendor header included on all requests.
+ |
+
void |
+setApplicationVersion(String value)
+Set the value of the X-RallyIntegrationVersion header included on all requests.
+ |
+
void |
+setProxy(URI proxy)
+Set the unauthenticated proxy server to use.
+ |
+
void |
+setProxy(URI proxy,
+ String userName,
+ String password)
+Set the authenticated proxy server to use.
+ |
+
void |
+setWsapiVersion(String wsapiVersion)
+Set the current version of the WSAPI being targeted.
+ |
+
setDefaultHttpParamsaddRequestInterceptor, addRequestInterceptor, addResponseInterceptor, addResponseInterceptor, clearRequestInterceptors, clearResponseInterceptors, execute, execute, execute, execute, execute, execute, execute, execute, getAuthSchemes, getBackoffManager, getConnectionBackoffStrategy, getConnectionKeepAliveStrategy, getConnectionManager, getConnectionReuseStrategy, getCookieSpecs, getCookieStore, getCredentialsProvider, getHttpRequestRetryHandler, getParams, getProxyAuthenticationHandler, getProxyAuthenticationStrategy, getRedirectHandler, getRedirectStrategy, getRequestExecutor, getRequestInterceptor, getRequestInterceptorCount, getResponseInterceptor, getResponseInterceptorCount, getRoutePlanner, getTargetAuthenticationHandler, getTargetAuthenticationStrategy, getUserTokenHandler, removeRequestInterceptorByClass, removeResponseInterceptorByClass, setAuthSchemes, setBackoffManager, setConnectionBackoffStrategy, setCookieSpecs, setCookieStore, setCredentialsProvider, setHttpRequestRetryHandler, setKeepAliveStrategy, setParams, setProxyAuthenticationHandler, setProxyAuthenticationStrategy, setRedirectHandler, setRedirectStrategy, setReuseStrategy, setRoutePlanner, setTargetAuthenticationHandler, setTargetAuthenticationStrategy, setUserTokenHandlerpublic void setProxy(URI proxy)+
proxy - The proxy server, e.g. new URI("http://my.proxy.com:8000")public void setProxy(URI proxy, + String userName, + String password)+
proxy - The proxy server, e.g. new URI("http://my.proxy.com:8000")userName - The username to be used for authentication.password - The password to be used for authentication.public void setApplicationVendor(String value)+
value - The vendor header to be included on all requests.public void setApplicationVersion(String value)+
value - The vendor header to be included on all requests.public void setApplicationName(String value)+
value - The vendor header to be included on all requests.public String getServer()+
public String getWsapiVersion()+
public void setWsapiVersion(String wsapiVersion)+
wsapiVersion - the new version, e.g. "1.30"public String doPost(String url, + String body) + throws IOException+
url - the request urlbody - the body of the postIOException - if a non-200 response code is returned or if some other
+ problem occurs while executing the requestpublic String doPut(String url, + String body) + throws IOException+
url - the request urlbody - the body of the putIOException - if a non-200 response code is returned or if some other
+ problem occurs while executing the requestpublic String doDelete(String url) + throws IOException+
url - the request urlIOException - if a non-200 response code is returned or if some other
+ problem occurs while executing the requestpublic String doGet(String url) + throws IOException+
url - the request urlIOException - if a non-200 response code is returned or if some other
+ problem occurs while executing the requestpublic void close() + throws IOException+
close in interface Closeableclose in interface AutoCloseableIOException - if an error occurs releasing resourcespublic String getWsapiUrl()+
public class HttpClientTest +extends Object+
| Constructor and Description | +
|---|
HttpClientTest() |
+
| Modifier and Type | +Method and Description | +
|---|---|
void |
+setUp() |
+
void |
+shouldDelete() |
+
void |
+shouldExplodeWithInvalidResponse() |
+
void |
+shouldGet() |
+
void |
+shouldGzip() |
+
void |
+shouldIntialize() |
+
void |
+shouldPost() |
+
void |
+shouldPut() |
+
void |
+shouldReturnValidResponse() |
+
void |
+shouldSetApplicationName() |
+
void |
+shouldSetApplicationVendor() |
+
void |
+shouldSetApplicationVersion() |
+
void |
+shouldSetProxy() |
+
void |
+shouldSetProxyWithCredentials() |
+
void |
+shouldSetWsapiVersion() |
+
void |
+shouldUseDefaultWsapiVersion() |
+
public void setUp() + throws URISyntaxException+
URISyntaxExceptionpublic void shouldIntialize()+
public void shouldSetProxyWithCredentials() + throws Exception+
Exceptionpublic void shouldSetApplicationVendor() + throws Exception+
Exceptionpublic void shouldSetApplicationName() + throws Exception+
Exceptionpublic void shouldSetApplicationVersion() + throws Exception+
Exceptionpublic void shouldUseDefaultWsapiVersion()+
public void shouldSetWsapiVersion()+
public void shouldReturnValidResponse() + throws Exception+
Exception| Package | +Description | +
|---|---|
| com.rallydev.rest | +
+ Provides the main interface to the Rest API.
+ |
+
| com.rallydev.rest.client | +
+ Provides the underlying http client implementations.
+ |
+
| Modifier and Type | +Method and Description | +
|---|---|
HttpClient |
+RallyRestApi.getClient()
+Get the underlying http client implementation.
+ |
+
| Modifier and Type | +Class and Description | +
|---|---|
class |
+ApiKeyClient
+A HttpClient which authenticates using an API Key.
+ |
+
class |
+BasicAuthClient
+A HttpClient which authenticates using basic authentication (username/password).
+ |
+
See: Description
+| Class | +Description | +
|---|---|
| ApiKeyClient | +
+ A HttpClient which authenticates using an API Key.
+ |
+
| BasicAuthClient | +
+ A HttpClient which authenticates using basic authentication (username/password).
+ |
+
| HttpClient | +
+ A HttpClient implementation providing connectivity to Rally.
+ |
+
| Package | +Description | +
|---|---|
| com.rallydev.rest | +
+ Provides the main interface to the Rest API.
+ |
+
| com.rallydev.rest.client | +
+ Provides the underlying http client implementations.
+ |
+
| Class and Description | +
|---|
| HttpClient
+ A HttpClient implementation providing connectivity to Rally.
+ |
+
| Class and Description | +
|---|
| HttpClient
+ A HttpClient implementation providing connectivity to Rally.
+ |
+
public class HttpRequestBodyMatcher +extends org.mockito.ArgumentMatcher<HttpEntityEnclosingRequestBase>+
| Constructor and Description | +
|---|
HttpRequestBodyMatcher(String url,
+ String body) |
+
| Modifier and Type | +Method and Description | +
|---|---|
boolean |
+matches(Object o) |
+
describeTo_dont_implement_Matcher___instead_extend_BaseMatcher_, toStringpublic boolean matches(Object o)+
matches in interface org.hamcrest.Matcher<HttpEntityEnclosingRequestBase>matches in class org.mockito.ArgumentMatcher<HttpEntityEnclosingRequestBase>public class HttpRequestHeaderMatcher +extends org.mockito.ArgumentMatcher<HttpRequestBase>+
| Constructor and Description | +
|---|
HttpRequestHeaderMatcher(String name,
+ String value) |
+
| Modifier and Type | +Method and Description | +
|---|---|
boolean |
+matches(Object o) |
+
describeTo_dont_implement_Matcher___instead_extend_BaseMatcher_, toStringpublic boolean matches(Object o)+
matches in interface org.hamcrest.Matcher<HttpRequestBase>matches in class org.mockito.ArgumentMatcher<HttpRequestBase>public class HttpRequestUrlMatcher +extends org.mockito.ArgumentMatcher<HttpRequestBase>+
| Constructor and Description | +
|---|
HttpRequestUrlMatcher(String url) |
+
| Modifier and Type | +Method and Description | +
|---|---|
boolean |
+matches(Object o) |
+
describeTo_dont_implement_Matcher___instead_extend_BaseMatcher_, toStringpublic HttpRequestUrlMatcher(String url)+
public boolean matches(Object o)+
matches in interface org.hamcrest.Matcher<HttpRequestBase>matches in class org.mockito.ArgumentMatcher<HttpRequestBase>| Class | +Description | +
|---|---|
| HttpRequestBodyMatcher | ++ |
| HttpRequestHeaderMatcher | ++ |
| HttpRequestUrlMatcher | ++ |