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 - - com.rallydev.rest - rally-rest-api - 2.0.2 - -``` - -## Usage - -In your main method, instantiate a new [RallyRestApi](https://docs.rallydev.com/javarestapi/com/rallydev/rest/RallyRestApi.html): - -RallyRestApi restApi = new RallyRestApi(new URI("https://rally1.rallydev.com"), "user@company.com", "password"); - - -

The parameters for [RallyRestApi](https://docs.rallydev.com/javarestapi/com/rallydev/rest/RallyRestApi.html) are as follows: - - - - - - - - - - - - - - - - - - - - - - -
ParameterDescriptionExample
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"
-  * = required parameter - -## Public Methods - -[RallyRestApi](https://docs.rallydev.com/javarestapi/com/rallydev/rest/RallyRestApi.html) exposes the following public methods: - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Method NameParametersDescription
[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:** - - JsonObject newDefect = new JsonObject(); - newDefect.addProperty("Name", "Test Defect"); - CreateRequest createRequest = new CreateRequest("defect", newDefect); - CreateResponse createResponse = restApi.create(createRequest); - -
[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:** - - GetRequest getRequest = new GetRequest("/defect/1234.js"); - GetResponse getResponse = restApi.get(getRequest); - -
[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:** - - JsonObject updatedDefect = new JsonObject(); - updatedDefect.addProperty("State", "Fixed"); - UpdateRequest updateRequest = new UpdateRequest("/defect/1234.js", updatedDefect); - UpdateResponse updateResponse = restApi.update(updateRequest); - -
[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:** - - DeleteRequest deleteRequest = new DeleteRequest("/defect/1234.js"); - DeleteResponse deleteResponse = restApi.delete(deleteRequest); - -
[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:** - - QueryRequest defectRequest = new QueryRequest("defect"); - - defectRequest.setFetch(new Fetch("FormattedID", "Name", "State", "Priority")); - defectRequest.setQueryFilter(new QueryFilter("State", "=", "Fixed").and(new QueryFilter("Priority", "=", "Resolve Immediately"))); - defectRequest.setOrder("Priority ASC,FormattedID ASC"); - - defectRequest.setPageSize(25); - defectRequest.setLimit(100); - - QueryResponse queryResponse = restApi.query(defectRequest); - -
[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:** - - restApi.setWsapiVersion("1.29"); - -
[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:** - - String version = restApi.getWsapiVersion(); - -
[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:** - - restApi.setApplicationName("Universal Rally Data Extractor"); - -
[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:** - - restApi.setApplicationVersion("1.1"); - -
[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:** - - restApi.setApplicationVendor("My Company, Inc."); - -
[setProxy](https://docs.rallydev.com/javarestapi/com/rallydev/rest/RallyRestApi.html#setProxy(java.net.URI))java.net.URI proxy* -String userName -String passwordSet 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:** - - restApi.setProxy(new URI("http://myproxy.mycompany.com"), "MyProxyUsername", "MyProxyPassword"); - -
[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:** - - restApi.close(); - -
- -  * = required parameter - -## Examples - -The following code illustrates how to create, read, update, and delete a defect using the [RallyRestApi](https://docs.rallydev.com/javarestapi/com/rallydev/rest/RallyRestApi.html) object. -``` - -import com.google.gson.JsonObject; -import com.rallydev.rest.RallyRestApi; -import com.rallydev.rest.request.CreateRequest; -import com.rallydev.rest.request.DeleteRequest; -import com.rallydev.rest.request.GetRequest; -import com.rallydev.rest.request.UpdateRequest; -import com.rallydev.rest.response.CreateResponse; -import com.rallydev.rest.response.DeleteResponse; -import com.rallydev.rest.response.GetResponse; -import com.rallydev.rest.response.UpdateResponse; -import com.rallydev.rest.util.Ref; - -import java.io.IOException; -import java.net.URI; -import java.net.URISyntaxException; - -public class CrudExample { - - public static void main(String[] args) throws URISyntaxException, IOException { - - //Create and configure a new instance of RallyRestApi - RallyRestApi restApi = new RallyRestApi(new URI("https://rally1.rallydev.com"), "user@company.com", "password"); - restApi.setApplicationName("CrudExample"); - - try { - - //Create a defect - System.out.println("Creating defect..."); - JsonObject newDefect = new JsonObject(); - newDefect.addProperty("Name", "Test Defect"); - CreateRequest createRequest = new CreateRequest("defect", newDefect); - CreateResponse createResponse = restApi.create(createRequest); - System.out.println(String.format("Created %s", createResponse.getObject().get("_ref").getAsString())); - - //Read defect - String ref = Ref.getRelativeRef(createResponse.getObject().get("_ref").getAsString()); - System.out.println(String.format("\nReading defect %s...", ref)); - GetRequest getRequest = new GetRequest(ref); - GetResponse getResponse = restApi.get(getRequest); - JsonObject obj = getResponse.getObject(); - System.out.println(String.format("Read defect. Name = %s, State = %s", - obj.get("Name").getAsString(), obj.get("State").getAsString())); - - //Update defect - System.out.println("\nUpdating defect state..."); - JsonObject updatedDefect = new JsonObject(); - updatedDefect.addProperty("State", "Fixed"); - UpdateRequest updateRequest = new UpdateRequest(ref, updatedDefect); - UpdateResponse updateResponse = restApi.update(updateRequest); - obj = updateResponse.getObject(); - System.out.println(String.format("Updated defect. State = %s", obj.get("State").getAsString())); - - //Delete defect - System.out.println("\nDeleting defect..."); - DeleteRequest deleteRequest = new DeleteRequest(ref); - DeleteResponse deleteResponse = restApi.delete(deleteRequest); - if (deleteResponse.wasSuccessful()) { - System.out.println("Deleted defect."); - } - - } finally { - //Release all resources - restApi.close(); - } - } -} - -``` - -The following code illustrates how to query for the top 5 highest priority defects: -``` - -import com.google.gson.JsonElement; -import com.google.gson.JsonObject; -import com.rallydev.rest.RallyRestApi; -import com.rallydev.rest.request.QueryRequest; -import com.rallydev.rest.response.QueryResponse; -import com.rallydev.rest.util.Fetch; -import com.rallydev.rest.util.QueryFilter; - -import java.io.IOException; -import java.net.URI; -import java.net.URISyntaxException; - -public class QueryExample { - - public static void main(String[] args) throws URISyntaxException, IOException { - - //Create and configure a new instance of RallyRestApi - RallyRestApi restApi = new RallyRestApi(new URI("https://rally1.rallydev.com"), "user@company.com", "password"); - restApi.setApplicationName("QueryExample"); - - try { - - System.out.println("Querying for top 5 highest priority unfixed defects..."); - - QueryRequest defects = new QueryRequest("defect"); - - defects.setFetch(new Fetch("FormattedID", "Name", "State", "Priority")); - defects.setQueryFilter(new QueryFilter("State", "<", "Fixed")); - defects.setOrder("Priority ASC,FormattedID ASC"); - - //Return up to 5, 1 per page - defects.setPageSize(1); - defects.setLimit(5); - - QueryResponse queryResponse = restApi.query(defects); - if (queryResponse.wasSuccessful()) { - System.out.println(String.format("\nTotal results: %d", queryResponse.getTotalResultCount())); - System.out.println("Top 5:"); - for (JsonElement result : queryResponse.getResults()) { - JsonObject defect = result.getAsJsonObject(); - System.out.println(String.format("\t%s - %s: Priority=%s, State=%s", - defect.get("FormattedID").getAsString(), - defect.get("Name").getAsString(), - defect.get("Priority").getAsString(), - defect.get("State").getAsString())); - } - } else { - System.err.println("The following errors occurred: "); - for (String err : queryResponse.getErrors()) { - System.err.println("\t" + err); - } - } - - } finally { - //Release resources - restApi.close(); - } - } -} - -``` - -## Development -### Releasing to Maven central -#### One-time Setup -* Install Maven 3 -* Install gpg to sign the artifacts - -```bash -brew install gpg -``` -* Get a copy of the the gpg key pair archive from Matt Cholick, Kyle Morse, or Charles Ferentchak -* Place the contents of the key pair archive in ~/.gnupg -* Add login login information to Sonatype's repository to your ~/.m2/settings.xml (again getting the credentials from Matt, Kyle, or Charles) - -```xml - - - - sonatype-nexus-snapshots - user - password - - - sonatype-nexus-staging - user - password - - - -``` -#### Releasing to Sonatype OSS (central) -This is a stripped down version of a much, much longer guide https://docs.sonatype.org/display/Repository/Sonatype+OSS+Maven+Repository+Usage+Guide - -* Prepare the release (create tag & update pom) - -```bash -mvn release:clean -mvn release:prepare -``` -* Release! - -```bash -mvn release:perform -``` +[Examples](https://github.com/RallyCommunity/rally-java-rest-apps) -Finally, draft a Github release from the tag created by Maven. \ No newline at end of file +## Developer Guide +Please view the [Developer Guide](https://github.com/RallyTools/RallyRestToolkitForJava/wiki/Developer-Guide) in the attached wiki diff --git a/RallyRestToolkitForJava.iml b/RallyRestToolkitForJava.iml new file mode 100644 index 0000000..f6c27af --- /dev/null +++ b/RallyRestToolkitForJava.iml @@ -0,0 +1,29 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/RallyRestToolkitForJava.ipr b/RallyRestToolkitForJava.ipr new file mode 100644 index 0000000..9034498 --- /dev/null +++ b/RallyRestToolkitForJava.ipr @@ -0,0 +1,793 @@ + + + + + $PROJECT_DIR$/out/artifacts/rally_rest_api_2_2.1 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/pom.xml b/pom.xml index 23e0e50..8ec9fc6 100644 --- a/pom.xml +++ b/pom.xml @@ -1,6 +1,10 @@ 4.0.0 + + 8 + 8 + org.sonatype.oss oss-parent @@ -10,7 +14,7 @@ Rally Rest Toolkit For Java com.rallydev.rest rally-rest-api - 2.0.3-SNAPSHOT + 2.3.0 A java toolkit for interacting with the Rally Rest API @@ -23,13 +27,6 @@ - - - krmorse - Kyle Morse - - - scm:git:git@github.com:RallyTools/RallyRestToolkitForJava.git scm:git:git@github.com:RallyTools/RallyRestToolkitForJava.git @@ -77,7 +74,7 @@ org.sonatype.plugins nexus-staging-maven-plugin - 1.4.4 + 1.6.2 true sonatype-nexus-staging @@ -92,12 +89,12 @@ org.apache.httpcomponents httpclient - 4.2.5 + 4.5.14 com.google.code.gson gson - 2.1 + 2.8.9 org.testng diff --git a/src/main/java/META-INF/MANIFEST.MF b/src/main/java/META-INF/MANIFEST.MF index 04c03eb..e2ce639 100644 --- a/src/main/java/META-INF/MANIFEST.MF +++ b/src/main/java/META-INF/MANIFEST.MF @@ -1,9 +1,9 @@ Manifest-Version: "1.2" Implementation-Vendor: "Rally Software, Inc." -Implementation-Title: "com.rallydev.rest" -Implementation-Version: "2.0" +Implementation-Title: "com.rallydev.rest" +Implementation-Version: "2.2.1" Class-Path: "httpcore-4.2.4.jar httpclient-4.2.5.jar commons-logging-1.1.1.jar commons-codec-1.6.jar gson-2.2.4.jar" Specification-Vendor: "Rally Software, Inc." Name: "com/rallydev/rest/" -Specification-Title: "Rally Rest API for Java" -Specification-Version: "2.0" +Specification-Title: "Rally Rest API for Java" +Specification-Version: "2.2.1" diff --git a/src/main/java/com/rallydev/rest/RallyRestApi.java b/src/main/java/com/rallydev/rest/RallyRestApi.java index 1b4d87d..6a0eaa8 100644 --- a/src/main/java/com/rallydev/rest/RallyRestApi.java +++ b/src/main/java/com/rallydev/rest/RallyRestApi.java @@ -1,43 +1,15 @@ package com.rallydev.rest; import com.google.gson.JsonArray; -import com.google.gson.JsonObject; -import com.google.gson.JsonPrimitive; -import com.rallydev.rest.request.CreateRequest; -import com.rallydev.rest.request.DeleteRequest; -import com.rallydev.rest.request.GetRequest; -import com.rallydev.rest.request.QueryRequest; -import com.rallydev.rest.request.UpdateRequest; -import com.rallydev.rest.response.CreateResponse; -import com.rallydev.rest.response.DeleteResponse; -import com.rallydev.rest.response.GetResponse; -import com.rallydev.rest.response.QueryResponse; -import com.rallydev.rest.response.UpdateResponse; -import com.rallydev.rest.util.InvalidURLException; -import org.apache.http.HttpEntity; -import org.apache.http.HttpHost; -import org.apache.http.HttpResponse; -import org.apache.http.auth.AuthScope; -import org.apache.http.auth.UsernamePasswordCredentials; -import org.apache.http.client.methods.HttpDelete; -import org.apache.http.client.methods.HttpGet; -import org.apache.http.client.methods.HttpPost; -import org.apache.http.client.methods.HttpPut; -import org.apache.http.client.methods.HttpRequestBase; -import org.apache.http.client.utils.URIBuilder; -import org.apache.http.conn.BasicManagedEntity; -import org.apache.http.conn.params.ConnRoutePNames; -import org.apache.http.entity.StringEntity; -import org.apache.http.impl.auth.BasicScheme; -import org.apache.http.impl.client.DefaultHttpClient; -import org.apache.http.util.EntityUtils; +import com.rallydev.rest.client.ApiKeyClient; +import com.rallydev.rest.client.BasicAuthClient; +import com.rallydev.rest.client.HttpClient; +import com.rallydev.rest.request.*; +import com.rallydev.rest.response.*; import java.io.Closeable; import java.io.IOException; import java.net.URI; -import java.net.URISyntaxException; -import java.util.HashMap; -import java.util.Map; /** *

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 Map headers = new HashMap() { - { - put(Header.Library, "Rally Rest API for Java v2.0"); - put(Header.Name, "Rally Rest API for Java"); - put(Header.Vendor, "Rally Software, Inc."); - put(Header.Version, "2.0"); - } - }; + protected HttpClient client; /** * Creates a new instance for the specified server using the specified credentials. @@ -88,11 +25,24 @@ private enum Header { * @param server The server to connect to, e.g. {@code new URI("https://rally1.rallydev.com")} * @param userName The username to be used for authentication. * @param password The password to be used for authentication. + * @deprecated Use the api key constructor instead. */ public RallyRestApi(URI server, String userName, String password) { - this.server = server; - httpClient = new DefaultHttpClient(); - setClientCredentials(server, userName, password); + this(new BasicAuthClient(server, userName, password)); + } + + /** + * Creates a new instance for the specified server using the specified API Key. + * + * @param server The server to connect to, e.g. {@code new URI("https://rally1.rallydev.com")} + * @param apiKey The API Key to be used for authentication. + */ + public RallyRestApi(URI server, String apiKey) { + this(new ApiKeyClient(server, apiKey)); + } + + protected RallyRestApi(HttpClient httpClient) { + this.client = httpClient; } /** @@ -101,8 +51,7 @@ public RallyRestApi(URI server, String userName, String password) { * @param proxy The proxy server, e.g. {@code new URI("http://my.proxy.com:8000")} */ public void setProxy(URI proxy) { - this.proxy = proxy; - httpClient.getParams().setParameter(ConnRoutePNames.DEFAULT_PROXY, new HttpHost(proxy.getHost(), proxy.getPort(), proxy.getScheme())); + client.setProxy(proxy); } /** @@ -113,15 +62,7 @@ public void setProxy(URI proxy) { * @param password The password to be used for authentication. */ public void setProxy(URI proxy, String userName, String password) { - setProxy(proxy); - setClientCredentials(proxy, userName, password); - } - - private void setClientCredentials(URI server, String userName, String password) { - usernamePasswordCredentials = new UsernamePasswordCredentials(userName, password); - httpClient.getCredentialsProvider().setCredentials( - new AuthScope(server.getHost(), server.getPort()), - usernamePasswordCredentials); + client.setProxy(proxy, userName, password); } /** @@ -131,7 +72,7 @@ private void setClientCredentials(URI server, String userName, String password) * @param value The vendor header to be included on all requests. */ public void setApplicationVendor(String value) { - headers.put(Header.Vendor, value); + client.setApplicationVendor(value); } /** @@ -141,7 +82,7 @@ public void setApplicationVendor(String value) { * @param value The vendor header to be included on all requests. */ public void setApplicationVersion(String value) { - headers.put(Header.Version, value); + client.setApplicationVersion(value); } /** @@ -151,7 +92,26 @@ public void setApplicationVersion(String value) { * @param value The vendor header to be included on all requests. */ public void setApplicationName(String value) { - headers.put(Header.Name, value); + client.setApplicationName(value); + } + + /** + * Get the current version of the WSAPI being targeted. + * Defaults to v2.0 + * + * @return the current WSAPI version. + */ + public String getWsapiVersion() { + return client.getWsapiVersion(); + } + + /** + * Set the current version of the WSAPI being targeted. + * + * @param wsapiVersion the new version, e.g. {@code "1.30"} + */ + public void setWsapiVersion(String wsapiVersion) { + client.setWsapiVersion(wsapiVersion); } /** @@ -162,16 +122,7 @@ public void setApplicationName(String value) { * @throws IOException if an error occurs during the creation. */ public CreateResponse create(CreateRequest request) throws IOException { - return create(request, true); - } - - private CreateResponse create(CreateRequest request, boolean retryOnFail) throws IOException { - CreateResponse createResponse = new CreateResponse(doPost(buildWsapiUrl() + request.toUrl(), request.getBody())); - if (retryOnFail && createResponse.getErrors().length != 0) { - setSecurityToken(null); - return create(request, false); - } - return createResponse; + return new CreateResponse(client.doPost(request.toUrl(), request.getBody())); } /** @@ -182,16 +133,19 @@ private CreateResponse create(CreateRequest request, boolean retryOnFail) throws * @throws IOException if an error occurs during the update. */ public UpdateResponse update(UpdateRequest request) throws IOException { - return update(request, true); + return new UpdateResponse(client.doPost(request.toUrl(), request.getBody())); } - private UpdateResponse update(UpdateRequest request, boolean retryOnFail) throws IOException { - UpdateResponse updateResponse = new UpdateResponse(doPost(buildWsapiUrl() + request.toUrl(), request.getBody())); - if (retryOnFail && updateResponse.getErrors().length != 0) { - setSecurityToken(null); - return update(request, false); - } - return updateResponse; + /** + * Update the specified collection. + * Note that this method is only usable with WSAPI versions 2.0 and above. + * + * @param request the {@link CollectionUpdateRequest} specifying the collection to be updated. + * @return the resulting {@link CollectionUpdateResponse} + * @throws IOException if an error occurs during the update. + */ + public CollectionUpdateResponse updateCollection(CollectionUpdateRequest request) throws IOException { + return new CollectionUpdateResponse(client.doPost(request.toUrl(), request.getBody())); } /** @@ -202,16 +156,7 @@ private UpdateResponse update(UpdateRequest request, boolean retryOnFail) throws * @throws IOException if an error occurs during the deletion. */ public DeleteResponse delete(DeleteRequest request) throws IOException { - return delete(request, true); - } - - private DeleteResponse delete(DeleteRequest request, boolean retryOnFail) throws IOException { - DeleteResponse deleteResponse = new DeleteResponse(doDelete(buildWsapiUrl() + request.toUrl())); - if (retryOnFail && deleteResponse.getErrors().length != 0) { - setSecurityToken(null); - return delete(request, false); - } - return deleteResponse; + return new DeleteResponse(client.doDelete(request.toUrl())); } /** @@ -224,14 +169,14 @@ private DeleteResponse delete(DeleteRequest request, boolean retryOnFail) throws * @throws IOException if an error occurs during the query. */ public QueryResponse query(QueryRequest request) throws IOException { - QueryResponse queryResponse = new QueryResponse(doGet(buildWsapiUrl() + request.toUrl(), false)); + QueryResponse queryResponse = new QueryResponse(client.doGet(request.toUrl())); if (queryResponse.wasSuccessful()) { int receivedRecords = request.getPageSize(); while (receivedRecords < request.getLimit() && (receivedRecords + request.getStart() - 1) < queryResponse.getTotalResultCount()) { QueryRequest pageRequest = request.clone(); pageRequest.setStart(receivedRecords + request.getStart()); - QueryResponse pageResponse = new QueryResponse(doGet(buildWsapiUrl() + pageRequest.toUrl(), false)); + QueryResponse pageResponse = new QueryResponse(client.doGet(pageRequest.toUrl())); if (pageResponse.wasSuccessful()) { JsonArray results = queryResponse.getResults(); results.addAll(pageResponse.getResults()); @@ -251,19 +196,7 @@ public QueryResponse query(QueryRequest request) throws IOException { * @throws IOException if an error occurs during the retrieval. */ public GetResponse get(GetRequest request) throws IOException { - return get(request, false); - } - - /** - * Get the specified object. Forces basic auth as part of the request if specified - * - * @param request the {@link GetRequest} specifying the object to be retrieved. - * @param forceReauth boolean indicating if basic auth should be conducted as part of the request - * @return the resulting {@link GetResponse} - * @throws IOException if an error occurs during the retrieval. - */ - protected GetResponse get(GetRequest request, boolean forceReauth) throws IOException { - return new GetResponse(doGet(buildWsapiUrl() + request.toUrl(), forceReauth)); + return new GetResponse(client.doGet(request.toUrl())); } /** @@ -272,200 +205,17 @@ protected GetResponse get(GetRequest request, boolean forceReauth) throws IOExce * @throws IOException if an error occurs releasing resources */ public void close() throws IOException { - httpClient.getConnectionManager().shutdown(); - } - - /** - * Get the current version of the WSAPI being targeted. - * Defaults to {@link RallyRestApi#DEFAULT_WSAPI_VERSION} - * - * @return the current WSAPI version. - */ - public String getWsapiVersion() { - return wsapiVersion; - } - - /** - * Set the current version of the WSAPI being targeted. - * - * @param wsapiVersion the new version, e.g. {@code "1.30"} - */ - public void setWsapiVersion(String wsapiVersion) { - this.wsapiVersion = wsapiVersion; - } - - /** - * Execute a request against the WSAPI - * - * @param request the request to be executed - * @return the JSON encoded string response - * @throws IOException if a non-200 response code is returned or if some other - * problem occurs while executing the request - */ - protected String doRequest(HttpRequestBase request) throws IOException { - for (Map.Entry header : headers.entrySet()) { - request.setHeader("X-RallyIntegration" + header.getKey().name(), header.getValue()); - } - - HttpResponse response = httpClient.execute(request); - HttpEntity entity = response.getEntity(); - if (response.getStatusLine().getStatusCode() == 200) { - return EntityUtils.toString(entity, "utf-8"); - } else if (response.getStatusLine().getStatusCode() == 500) { - ((BasicManagedEntity) entity).releaseConnection(); - throw new InvalidURLException(request.getURI().toString() + " is an Invalid URL"); - } else { - throw new IOException(response.getStatusLine().toString()); - } - } - - /** - * Execute a request against the WSAPI with a basic auth header to force reauthorization - * - * @param request the request to be executed - * @return the JSON encoded string response - * @throws IOException if a non-200 response code is returned or if some other - * problem occurs while executing the request - */ - protected String doForceReauthRequest(HttpRequestBase request) throws IOException { - request.addHeader(BasicScheme.authenticate(usernamePasswordCredentials, "UTF-8", false)); - return doRequest(request); - } - - /** - * Execute a request against WSAPI that requires a security token due to data change/creation: - * 1. Post - * 2. Put - * 3. Delete - * - * @param request the request to be executed - * @return the JSON encoded string response - * @throws IOException if a non-200 response code is returned or if some other - * problem occurs while executing the request - */ - private String doSecuredRequest(HttpRequestBase request) throws IOException { - if (!request.getMethod().equals(HttpGet.METHOD_NAME) && - !this.getWsapiVersion().matches("^1[.]\\d+")) { - try { - attachSecurityInfo(request); - } catch (URISyntaxException e) { - throw new IOException("Unable to build URI with security token", e); - } - } - - return doRequest(request); - } - - /** - * Attach the security token parameter to the request. - *

- * Response Structure: - * {"OperationResult": {"SecurityToken": "UUID"}} - * - * @param request the request to be modified - * @throws IOException if a non-200 response code is returned or if some other - * problem occurs while executing the request - */ - protected void attachSecurityInfo(HttpRequestBase request) throws IOException, URISyntaxException { - if (!SECURITY_ENDPOINT_DOES_NOT_EXIST.equals(securityToken)) { - try { - if (securityToken == null) { - GetResponse getResponse = get(new GetRequest(SECURITY_TOKEN_URL), true); - JsonObject operationResult = getResponse.getObject(); - JsonPrimitive securityTokenPrimitive = operationResult.getAsJsonPrimitive(SECURITY_TOKEN_KEY); - securityToken = securityTokenPrimitive.getAsString(); - } - request.setURI(new URIBuilder(request.getURI()).addParameter(SECURITY_TOKEN_PARAM_KEY, securityToken).build()); - } catch (InvalidURLException e) { - //swallow the exception in this case as url does not exist indicates running and old version of - //ALM without the security endpoint - securityToken = SECURITY_ENDPOINT_DOES_NOT_EXIST; - } - } - } - - /** - * Sets the value on the security token for security enabled requests - * - * @param securityToken value fo the security token - */ - protected void setSecurityToken(String securityToken) { - this.securityToken = securityToken; - } - - /** - * Returns the current value of the security token. - * - * @return string value of security token - */ - protected String getSecurityToken() { - return securityToken; - } - - /** - * Perform a post against the WSAPI - * - * @param url the request url - * @param body the body of the post - * @return the JSON encoded string response - * @throws IOException if a non-200 response code is returned or if some other - * problem occurs while executing the request - */ - protected String doPost(String url, String body) throws IOException { - HttpPost httpPost = new HttpPost(url); - httpPost.setEntity(new StringEntity(body, "utf-8")); - return doSecuredRequest(httpPost); - } - - - /** - * Perform a put against the WSAPI - * - * @param url the request url - * @param body the body of the put - * @return the JSON encoded string response - * @throws IOException if a non-200 response code is returned or if some other - * problem occurs while executing the request - */ - protected String doPut(String url, String body) throws IOException { - HttpPut httpPut = new HttpPut(url); - httpPut.setEntity(new StringEntity(body, "utf-8")); - return doSecuredRequest(httpPut); - } - - /** - * Perform a delete against the WSAPI - * - * @param url the request url - * @return the JSON encoded string response - * @throws IOException if a non-200 response code is returned or if some other - * problem occurs while executing the request - */ - protected String doDelete(String url) throws IOException { - HttpDelete httpDelete = new HttpDelete(url); - return doSecuredRequest(httpDelete); - } - - /** - * Perform a get against the WSAPI - * - * @param url the request url - * @param forceReauth - * @return the JSON encoded string response - * @throws IOException if a non-200 response code is returned or if some other - * problem occurs while executing the request - */ - protected String doGet(String url, boolean forceReauth) throws IOException { - HttpGet httpGet = new HttpGet(url); - return forceReauth ? doForceReauthRequest(httpGet) : doRequest(httpGet); + client.close(); } /** - * Get the WSAPI base url based on the current server and WSAPI version + * Get the underlying http client implementation. + * This is exposed with the intent of providing the ability to supply additional configuration to the client. + * It should not be used to directly make i/o calls. * - * @return the fully qualified WSAPI base url, e.g. https://rally1.rallydev.com/slm/webservice/1.33 + * @return the raw http client */ - protected String buildWsapiUrl() { - return server.toString() + "/slm/webservice/" + wsapiVersion; + public HttpClient getClient() { + return client; } } \ No newline at end of file diff --git a/src/main/java/com/rallydev/rest/client/ApiKeyClient.java b/src/main/java/com/rallydev/rest/client/ApiKeyClient.java new file mode 100644 index 0000000..2295824 --- /dev/null +++ b/src/main/java/com/rallydev/rest/client/ApiKeyClient.java @@ -0,0 +1,39 @@ +package com.rallydev.rest.client; + +import org.apache.http.client.methods.HttpRequestBase; + +import java.io.IOException; +import java.net.URI; + +/** + * A HttpClient which authenticates using an API Key. + */ +public class ApiKeyClient extends HttpClient { + + protected String apiKey; + protected static final String API_KEY_HEADER = "zsessionid"; + + /** + * Construct a new client. + * @param server the server to connect to + * @param apiKey the key to be used for authentication + */ + public ApiKeyClient(URI server, String apiKey) { + super(server); + this.apiKey = apiKey; + } + + /** + * Execute a request against the WSAPI + * + * @param request the request to be executed + * @return the JSON encoded string response + * @throws java.io.IOException if a non-200 response code is returned or if some other + * problem occurs while executing the request + */ + @Override + protected String doRequest(HttpRequestBase request) throws IOException { + request.setHeader(API_KEY_HEADER, this.apiKey); + return super.doRequest(request); + } +} \ No newline at end of file diff --git a/src/main/java/com/rallydev/rest/client/BasicAuthClient.java b/src/main/java/com/rallydev/rest/client/BasicAuthClient.java new file mode 100644 index 0000000..d119ef3 --- /dev/null +++ b/src/main/java/com/rallydev/rest/client/BasicAuthClient.java @@ -0,0 +1,107 @@ +package com.rallydev.rest.client; + +import com.google.gson.JsonObject; +import com.google.gson.JsonPrimitive; +import com.rallydev.rest.response.GetResponse; +import org.apache.http.auth.Credentials; +import org.apache.http.auth.UsernamePasswordCredentials; +import org.apache.http.client.methods.HttpGet; +import org.apache.http.client.methods.HttpRequestBase; +import org.apache.http.client.utils.URIBuilder; +import org.apache.http.impl.auth.BasicScheme; +import java.io.IOException; +import java.net.URI; +import java.net.URISyntaxException; + +/** + * A HttpClient which authenticates using basic authentication (username/password). + */ +public class BasicAuthClient extends HttpClient { + + 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 String securityToken; + protected Credentials credentials; + + /** + * Construct a new client. + * @param server the server to connect to + * @param userName the username to be used for authentication + * @param password the password to be used for authentication + */ + public BasicAuthClient(URI server, String userName, String password) { + super(server, userName, password); + resetCredentials(userName, password); + } + + /** + * Execute a request against the WSAPI + * + * @param request the request to be executed + * @return the JSON encoded string response + * @throws java.io.IOException if a non-200 response code is returned or if some other + * problem occurs while executing the request + */ + @Override + protected String doRequest(HttpRequestBase request) throws IOException { + if(!request.getMethod().equals(HttpGet.METHOD_NAME) && + !this.getWsapiVersion().matches("^1[.]\\d+")) { + try { + attachSecurityInfo(request); + } catch (URISyntaxException e) { + throw new IOException("Unable to build URI with security token", e); + } + } + return super.doRequest(request); + } + + /** + * Attach the security token parameter to the request. + * + * Response Structure: + * {"OperationResult": {"SecurityToken": "UUID"}} + * + * @param request the request to be modified + * @throws IOException if a non-200 response code is returned or if some other + * problem occurs while executing the request + * @throws URISyntaxException if there is a problem with the url in the request + */ + protected void attachSecurityInfo(HttpRequestBase request) throws IOException, URISyntaxException { + if (!SECURITY_ENDPOINT_DOES_NOT_EXIST.equals(securityToken)) { + try { + if (securityToken == null) { + HttpGet httpGet = new HttpGet(getWsapiUrl() + SECURITY_TOKEN_URL); + httpGet.addHeader(BasicScheme.authenticate(credentials, "utf-8", false)); + GetResponse getResponse = new GetResponse(doRequest(httpGet)); + JsonObject operationResult = getResponse.getObject(); + JsonPrimitive securityTokenPrimitive = operationResult.getAsJsonPrimitive(SECURITY_TOKEN_KEY); + securityToken = securityTokenPrimitive.getAsString(); + } + request.setURI(new URIBuilder(request.getURI()).addParameter(SECURITY_TOKEN_PARAM_KEY, securityToken).build()); + } catch (IOException e) { + //swallow the exception in this case as url does not exist indicates running and old version of + //ALM without the security endpoint + securityToken = SECURITY_ENDPOINT_DOES_NOT_EXIST; + } + } + } + + /** + * Set the authenticated proxy server to use. By default no proxy is configured. + * + * @param proxy The proxy server, e.g. {@code new URI("http://my.proxy.com:8000")} + * @param userName The username to be used for authentication. + * @param password The password to be used for authentication. + */ + public void setProxy(URI proxy, String userName, String password) { + super.setProxy(proxy, userName, password); + resetCredentials(userName, password); + } + + private void resetCredentials(String userName, String password) { + this.credentials = new UsernamePasswordCredentials(userName, password); + securityToken = null; + } +} \ No newline at end of file diff --git a/src/main/java/com/rallydev/rest/client/HttpClient.java b/src/main/java/com/rallydev/rest/client/HttpClient.java new file mode 100644 index 0000000..4d830c0 --- /dev/null +++ b/src/main/java/com/rallydev/rest/client/HttpClient.java @@ -0,0 +1,298 @@ +package com.rallydev.rest.client; + +import org.apache.http.HttpEntity; +import org.apache.http.HttpHost; +import org.apache.http.auth.AuthScope; +import org.apache.http.auth.UsernamePasswordCredentials; +import org.apache.http.client.AuthenticationStrategy; +import org.apache.http.client.CredentialsProvider; +import org.apache.http.client.config.CookieSpecs; +import org.apache.http.client.config.RequestConfig; +import org.apache.http.client.methods.*; +import org.apache.http.conn.params.ConnRoutePNames; +import org.apache.http.entity.StringEntity; +import org.apache.http.impl.client.BasicCredentialsProvider; +import org.apache.http.impl.client.CloseableHttpClient; +import org.apache.http.impl.client.HttpClientBuilder; +import org.apache.http.impl.client.HttpClients; +import org.apache.http.impl.client.ProxyAuthenticationStrategy; +import org.apache.http.util.EntityUtils; + +import java.io.Closeable; +import java.io.IOException; +import java.net.URI; +import java.util.HashMap; +import java.util.Map; + +/** + * A HttpClient implementation providing connectivity to Rally. This class does not + * provide any authentication on its own but instead relies on a concrete subclass to do so. + */ +public class HttpClient + implements Closeable { + + protected final URI server; + protected String wsapiVersion = "v2.0"; + protected CloseableHttpClient client; + private String userName; + private String password; + private URI proxy; + + private enum Header { + Library, + Name, + Vendor, + Version + } + + private Map headers = new HashMap() { + { + put(Header.Library, "Rally Rest API for Java v2.2.1"); + put(Header.Name, "Rally Rest API for Java"); + put(Header.Vendor, "Rally Software, Inc."); + put(Header.Version, "2.2.1"); + } + }; + + protected HttpClient(URI server) { + this(server, null, null); + } + + protected HttpClient(URI server, String userName, String password) { + this.server = server; + this.userName = userName; + this.password = password; + this.client = buildClient(); + } + + protected CloseableHttpClient buildClient() { + HttpClientBuilder builder = HttpClients.custom(). + setDefaultRequestConfig(getRequestConfig()); + if (userName != null && password != null) { + builder.setDefaultCredentialsProvider(getCredentials(userName, password)); + } + if (proxy != null) { + builder.setProxy(new HttpHost(proxy.getHost(), proxy.getPort(), proxy.getScheme())); + } + return builder.build(); + } + + private RequestConfig getRequestConfig() { + return RequestConfig.custom(). + setCookieSpec(CookieSpecs.STANDARD). + build(); + } + + private CredentialsProvider getCredentials(String userName, String password) { + BasicCredentialsProvider provider = new BasicCredentialsProvider(); + UsernamePasswordCredentials credentials = new UsernamePasswordCredentials(userName, password); + provider.setCredentials( AuthScope.ANY, credentials); + return provider; + } + + /** + * Set the unauthenticated proxy server to use. By default no proxy is configured. + * + * @param proxy The proxy server, e.g. {@code new URI("http://my.proxy.com:8000")} + */ + public void setProxy(URI proxy) { + setProxy(proxy, null, null); + } + + /** + * Set the authenticated proxy server to use. By default no proxy is configured. + * + * @param proxy The proxy server, e.g. {@code new URI("http://my.proxy.com:8000")} + * @param userName The username to be used for authentication. + * @param password The password to be used for authentication. + */ + public void setProxy(URI proxy, String userName, String password) { + closeClient(); + this.proxy = proxy; + this.userName = userName; + this.password = password; + client = buildClient(); + } + + public URI getProxy() { + return proxy; + } + + private void closeClient() { + try { + client.close(); + } catch (Throwable t) { + throw new RuntimeException(t); + } + } + + /** + * Set the value of the X-RallyIntegrationVendor header included on all requests. + * This should be set to your company name. + * + * @param value The vendor header to be included on all requests. + */ + public void setApplicationVendor(String value) { + headers.put(Header.Vendor, value); + } + + /** + * Set the value of the X-RallyIntegrationVersion header included on all requests. + * This should be set to the version of your application. + * + * @param value The vendor header to be included on all requests. + */ + public void setApplicationVersion(String value) { + headers.put(Header.Version, value); + } + + /** + * Set the value of the X-RallyIntegrationName header included on all requests. + * This should be set to the name of your application. + * + * @param value The vendor header to be included on all requests. + */ + public void setApplicationName(String value) { + headers.put(Header.Name, value); + } + + /** + * Get the current server being targeted. + * + * @return the current server. + */ + public String getServer() { + return server.toString(); + } + + /** + * Get the current version of the WSAPI being targeted. + * + * @return the current WSAPI version. + */ + public String getWsapiVersion() { + return wsapiVersion; + } + + /** + * Set the current version of the WSAPI being targeted. + * + * @param wsapiVersion the new version, e.g. {@code "1.30"} + */ + public void setWsapiVersion(String wsapiVersion) { + this.wsapiVersion = wsapiVersion; + } + + /** + * Execute a request against the WSAPI + * + * @param request the request to be executed + * @return the JSON encoded string response + * @throws IOException if a non-200 response code is returned or if some other + * problem occurs while executing the request + */ + protected String doRequest(HttpRequestBase request) throws IOException { + for (Map.Entry header : headers.entrySet()) { + request.setHeader("X-RallyIntegration" + header.getKey().name(), header.getValue()); + } + + return this.executeRequest(request); + } + + /** + * Execute a request against the WSAPI + * + * @param request the request to be executed + * @return the JSON encoded string response + * @throws IOException if a non-200 response code is returned or if some other + * problem occurs while executing the request + */ + protected String executeRequest(HttpRequestBase request) throws IOException { + try (CloseableHttpResponse response = client.execute(request)) { + HttpEntity entity = response.getEntity(); + if (response.getStatusLine().getStatusCode() == 200) { + return EntityUtils.toString(entity, "utf-8"); + } else { + EntityUtils.consumeQuietly(entity); + throw new IOException(response.getStatusLine().toString()); + } + } + } + + /** + * Perform a post against the WSAPI + * + * @param url the request url + * @param body the body of the post + * @return the JSON encoded string response + * @throws IOException if a non-200 response code is returned or if some other + * problem occurs while executing the request + */ + public String doPost(String url, String body) throws IOException { + HttpPost httpPost = new HttpPost(getWsapiUrl() + url); + httpPost.setEntity(new StringEntity(body, "utf-8")); + return doRequest(httpPost); + } + + + /** + * Perform a put against the WSAPI + * + * @param url the request url + * @param body the body of the put + * @return the JSON encoded string response + * @throws IOException if a non-200 response code is returned or if some other + * problem occurs while executing the request + */ + public String doPut(String url, String body) throws IOException { + HttpPut httpPut = new HttpPut(getWsapiUrl() + url); + httpPut.setEntity(new StringEntity(body, "utf-8")); + return doRequest(httpPut); + } + + /** + * Perform a delete against the WSAPI + * + * @param url the request url + * @return the JSON encoded string response + * @throws IOException if a non-200 response code is returned or if some other + * problem occurs while executing the request + */ + public String doDelete(String url) throws IOException { + HttpDelete httpDelete = new HttpDelete(getWsapiUrl() + url); + return doRequest(httpDelete); + } + + /** + * Perform a get against the WSAPI + * + * @param url the request url + * @return the JSON encoded string response + * @throws IOException if a non-200 response code is returned or if some other + * problem occurs while executing the request + */ + public String doGet(String url) throws IOException { + HttpGet httpGet = new HttpGet(getWsapiUrl() + url); + return doRequest(httpGet); + } + + /** + * Release all resources associated with this instance. + */ + public void close() { + try { + client.close(); + } catch (Throwable t) { + throw new RuntimeException(t); + } + } + + /** + * Get the WSAPI base url based on the current server and WSAPI version + * + * @return the fully qualified WSAPI base url, e.g. https://rally1.rallydev.com/slm/webservice/1.33 + */ + public String getWsapiUrl() { + return getServer() + "/slm/webservice/" + getWsapiVersion(); + } +} diff --git a/src/main/java/com/rallydev/rest/client/package-info.java b/src/main/java/com/rallydev/rest/client/package-info.java new file mode 100644 index 0000000..2b38cbd --- /dev/null +++ b/src/main/java/com/rallydev/rest/client/package-info.java @@ -0,0 +1,4 @@ +/** + * Provides the underlying http client implementations. + */ +package com.rallydev.rest.client; \ No newline at end of file diff --git a/src/main/java/com/rallydev/rest/request/CollectionUpdateRequest.java b/src/main/java/com/rallydev/rest/request/CollectionUpdateRequest.java new file mode 100644 index 0000000..4b162b1 --- /dev/null +++ b/src/main/java/com/rallydev/rest/request/CollectionUpdateRequest.java @@ -0,0 +1,96 @@ +package com.rallydev.rest.request; + +import com.google.gson.JsonArray; +import com.google.gson.JsonObject; +import com.rallydev.rest.util.Fetch; +import com.rallydev.rest.util.Ref; +import org.apache.http.NameValuePair; +import org.apache.http.client.utils.URLEncodedUtils; +import org.apache.http.message.BasicNameValuePair; + +import java.util.ArrayList; +import java.util.List; + +/** + * Represents a WSAPI request to update a collection. + */ +public class CollectionUpdateRequest extends Request { + + private String ref; + private JsonArray items; + private boolean adding; + private Fetch fetch = new Fetch(); + + /** + * Create a new update request for the specified collection and values. + * Note that this class is only usable with WSAPI versions 2.0 and above. + * + * @param collection the collection to be updated + * @param items the items to be added or removed + * @param add true if adding, false if removing + */ + public CollectionUpdateRequest(JsonObject collection, JsonArray items, boolean add) { + this(collection.get("_ref").getAsString(), items, add); + } + + /** + * Create a new update request for the specified collection and values. + * + * @param collectionRef the ref of the collection to be updated. May be absolute or relative, e.g. "/defect/12345/tags" + * @param items the items to be added or removed + * @param adding true if adding, false if removing + */ + public CollectionUpdateRequest(String collectionRef, JsonArray items, boolean adding) { + this.ref = collectionRef; + this.items = items; + this.adding = adding; + } + + /** + * Get the JSON encoded string representation of the object to be updated. + * + * @return the JSON encoded object + */ + public String getBody() { + JsonObject wrapper = new JsonObject(); + wrapper.add("CollectionItems", items); + return gsonBuilder.create().toJson(wrapper); + } + + /** + *

Get 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() { + + List params = new ArrayList(getParams()); + + params.add(new BasicNameValuePair("fetch", getFetch().toString())); + + return String.format("%s/%s.js?%s", Ref.getRelativeRef(ref), + adding ? "add" : "remove", + URLEncodedUtils.format(params, "utf-8")); + } +} diff --git a/src/main/java/com/rallydev/rest/request/CreateRequest.java b/src/main/java/com/rallydev/rest/request/CreateRequest.java index f63318a..86aa554 100644 --- a/src/main/java/com/rallydev/rest/request/CreateRequest.java +++ b/src/main/java/com/rallydev/rest/request/CreateRequest.java @@ -1,15 +1,12 @@ 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; import org.apache.http.NameValuePair; import org.apache.http.client.utils.URLEncodedUtils; import org.apache.http.message.BasicNameValuePair; import java.util.ArrayList; -import java.util.HashMap; import java.util.List; /** @@ -40,7 +37,7 @@ public CreateRequest(String type, JsonObject obj) { public String getBody() { JsonObject wrapper = new JsonObject(); wrapper.add(type, obj); - return new Gson().toJson(wrapper); + return gsonBuilder.create().toJson(wrapper); } /** diff --git a/src/main/java/com/rallydev/rest/request/QueryRequest.java b/src/main/java/com/rallydev/rest/request/QueryRequest.java index b26e1c7..c013452 100644 --- a/src/main/java/com/rallydev/rest/request/QueryRequest.java +++ b/src/main/java/com/rallydev/rest/request/QueryRequest.java @@ -98,9 +98,8 @@ public String getWorkspace() { } /** - *

Specify 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 List params = new ArrayList(); + /** + * Gson Builder used for JSON serialization in this request. + */ + protected GsonBuilder gsonBuilder; + /** * Create a new request. */ public Request() { + this.gsonBuilder = new GsonBuilder().serializeNulls(); } /** @@ -48,6 +55,24 @@ public void addParam(String name, String value) { getParams().add(new BasicNameValuePair(name, value)); } + /** + * Get the Gson Builder used for JSON serialization in this request. + * + * @return The Gson Builder used for JSON serialization + */ + public GsonBuilder getGsonBuilder() { + return gsonBuilder; + } + + /** + * Set the Gson Builder used for JSON serialization in this request. + * + * @param gsonBuilder The Gson Builder used for JSON serialization + */ + public void setGsonBuilder(GsonBuilder gsonBuilder) { + this.gsonBuilder = gsonBuilder; + } + /** *

Convert 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 @@ - -All Classes (Rally Rest API for Java 2.0) - + +All Classes (Rally Rest API for Java 2.2) +

All Classes

    +
  • ApiKeyClient
  • +
  • BasicAuthClient
  • +
  • CollectionUpdateRequest
  • +
  • CollectionUpdateResponse
  • CreateRequest
  • CreateResponse
  • DeleteRequest
  • @@ -18,7 +22,7 @@

    All Classes

  • Fetch
  • GetRequest
  • GetResponse
  • -
  • InvalidURLException
  • +
  • HttpClient
  • QueryFilter
  • QueryRequest
  • QueryResponse
  • diff --git a/src/main/resources/doc/allclasses-noframe.html b/src/main/resources/doc/allclasses-noframe.html index 28857f4..5797e15 100644 --- a/src/main/resources/doc/allclasses-noframe.html +++ b/src/main/resources/doc/allclasses-noframe.html @@ -2,15 +2,19 @@ - -All Classes (Rally Rest API for Java 2.0) - + +All Classes (Rally Rest API for Java 2.2) +

    All Classes

      +
    • ApiKeyClient
    • +
    • BasicAuthClient
    • +
    • CollectionUpdateRequest
    • +
    • CollectionUpdateResponse
    • CreateRequest
    • CreateResponse
    • DeleteRequest
    • @@ -18,7 +22,7 @@

      All Classes

    • Fetch
    • GetRequest
    • GetResponse
    • -
    • InvalidURLException
    • +
    • HttpClient
    • QueryFilter
    • QueryRequest
    • QueryResponse
    • diff --git a/src/main/resources/doc/com/rallydev/rest/CollectionAddExample.html b/src/main/resources/doc/com/rallydev/rest/CollectionAddExample.html new file mode 100644 index 0000000..b2e95d8 --- /dev/null +++ b/src/main/resources/doc/com/rallydev/rest/CollectionAddExample.html @@ -0,0 +1,261 @@ + + + + + +CollectionAddExample (Rally Rest API for Java 2.2) + + + + + + + + + + + +
      +
      com.rallydev.rest
      +

      Class CollectionAddExample

      +
      +
      + +
      +
        +
      • +
        +
        +
        public class CollectionAddExample
        +extends Object
        +
      • +
      +
      +
      + +
      +
      + +
      +
      + + + + + + + diff --git a/src/main/resources/doc/com/rallydev/rest/CollectionQueryExample.html b/src/main/resources/doc/com/rallydev/rest/CollectionQueryExample.html new file mode 100644 index 0000000..fb0971c --- /dev/null +++ b/src/main/resources/doc/com/rallydev/rest/CollectionQueryExample.html @@ -0,0 +1,261 @@ + + + + + +CollectionQueryExample (Rally Rest API for Java 2.2) + + + + + + + + + + + +
      +
      com.rallydev.rest
      +

      Class CollectionQueryExample

      +
      +
      + +
      +
        +
      • +
        +
        +
        public class CollectionQueryExample
        +extends Object
        +
      • +
      +
      +
      + +
      +
      + +
      +
      + + + + + + + diff --git a/src/main/resources/doc/com/rallydev/rest/CollectionSummaryExample.html b/src/main/resources/doc/com/rallydev/rest/CollectionSummaryExample.html new file mode 100644 index 0000000..0edcc04 --- /dev/null +++ b/src/main/resources/doc/com/rallydev/rest/CollectionSummaryExample.html @@ -0,0 +1,261 @@ + + + + + +CollectionSummaryExample (Rally Rest API for Java 2.2) + + + + + + + + + + + +
      +
      com.rallydev.rest
      +

      Class CollectionSummaryExample

      +
      +
      + +
      +
        +
      • +
        +
        +
        public class CollectionSummaryExample
        +extends Object
        +
      • +
      +
      +
      + +
      +
      + +
      +
      + + + + + + + diff --git a/src/main/resources/doc/com/rallydev/rest/CrudExample.html b/src/main/resources/doc/com/rallydev/rest/CrudExample.html new file mode 100644 index 0000000..94c9c7a --- /dev/null +++ b/src/main/resources/doc/com/rallydev/rest/CrudExample.html @@ -0,0 +1,261 @@ + + + + + +CrudExample (Rally Rest API for Java 2.2) + + + + + + + + + + + +
      +
      com.rallydev.rest
      +

      Class CrudExample

      +
      +
      + +
      +
        +
      • +
        +
        +
        public class CrudExample
        +extends Object
        +
      • +
      +
      +
      + +
      +
      + +
      +
      + + + + + + + diff --git a/src/main/resources/doc/com/rallydev/rest/QueryExample.html b/src/main/resources/doc/com/rallydev/rest/QueryExample.html new file mode 100644 index 0000000..df7ba86 --- /dev/null +++ b/src/main/resources/doc/com/rallydev/rest/QueryExample.html @@ -0,0 +1,261 @@ + + + + + +QueryExample (Rally Rest API for Java 2.2) + + + + + + + + + + + +
      +
      com.rallydev.rest
      +

      Class QueryExample

      +
      +
      + +
      +
        +
      • +
        +
        +
        public class QueryExample
        +extends Object
        +
      • +
      +
      +
      + +
      +
      + +
      +
      + + + + + + + diff --git a/src/main/resources/doc/com/rallydev/rest/RallyRestApi.html b/src/main/resources/doc/com/rallydev/rest/RallyRestApi.html index c354c4f..3fe53db 100644 --- a/src/main/resources/doc/com/rallydev/rest/RallyRestApi.html +++ b/src/main/resources/doc/com/rallydev/rest/RallyRestApi.html @@ -2,15 +2,15 @@ - -RallyRestApi (Rally Rest API for Java 2.0) - + +RallyRestApi (Rally Rest API for Java 2.2) + @@ -62,13 +62,13 @@ @@ -111,39 +111,6 @@

      Class RallyRestApi

      • - -
        • @@ -156,10 +123,18 @@

          Constructor Summary

          Constructor and Description +
          RallyRestApi(URI server, + String apiKey) +
          Creates a new instance for the specified server using the specified API Key.
          + + + RallyRestApi(URI server, String userName, String password) -
          Creates a new instance for the specified server using the specified credentials.
          +
          Deprecated.  +
          Use the api key constructor instead.
          +
          @@ -202,42 +177,48 @@

          Method Summary

          +HttpClient +getClient() +
          Get the underlying http client implementation.
          + + + String getWsapiVersion()
          Get the current version of the WSAPI being targeted.
          - + QueryResponse query(QueryRequest request)
          Query for objects matching the specified request.
          - + 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, @@ -245,18 +226,24 @@

          Method Summary

          Set the authenticated proxy server to use.
          - + void setWsapiVersion(String wsapiVersion)
          Set the current version of the WSAPI being targeted.
          - + UpdateResponse update(UpdateRequest request)
          Update the specified object.
          + +CollectionUpdateResponse +updateCollection(CollectionUpdateRequest request) +
          Update the specified collection.
          + +
          • @@ -273,55 +260,6 @@

            Methods inherited from class java.lang.
            • - -
              • @@ -331,16 +269,29 @@

                Constructor Detail

                -
                  +
                  • RallyRestApi

                    public RallyRestApi(URI server,
                                 String userName,
                                 String password)
                    +
                    Deprecated. Use the api key constructor instead.
                    Creates a new instance for the specified server using the specified credentials.
                    Parameters:
                    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.
                  + + + +
                    +
                  • +

                    RallyRestApi

                    +
                    public RallyRestApi(URI server,
                    +            String apiKey)
                    +
                    Creates a new instance for the specified server using the specified API Key.
                    +
                    Parameters:
                    server - The server to connect to, e.g. new URI("https://rally1.rallydev.com")
                    apiKey - The API Key to be used for authentication.
                    +
                  • +
                @@ -409,6 +360,29 @@

                setApplicationName

                Parameters:
                value - The vendor header to be included on all requests.
              + + + +
                +
              • +

                getWsapiVersion

                +
                public String getWsapiVersion()
                +
                Get the current version of the WSAPI being targeted. + Defaults to v2.0
                +
                Returns:
                the current WSAPI version.
                +
              • +
              + + + +
                +
              • +

                setWsapiVersion

                +
                public void setWsapiVersion(String wsapiVersion)
                +
                Set the current version of the WSAPI being targeted.
                +
                Parameters:
                wsapiVersion - the new version, e.g. "1.30"
                +
              • +
              @@ -439,6 +413,22 @@

              update

              IOException - if an error occurs during the update.
            + + + + @@ -504,27 +494,17 @@

            close

            IOException - if an error occurs releasing resources
          - - - -
            -
          • -

            getWsapiVersion

            -
            public String getWsapiVersion()
            -
            Get the current version of the WSAPI being targeted. - Defaults to DEFAULT_WSAPI_VERSION
            -
            Returns:
            the current WSAPI version.
            -
          • -
          - +
          • -

            setWsapiVersion

            -
            public void setWsapiVersion(String wsapiVersion)
            -
            Set the current version of the WSAPI being targeted.
            -
            Parameters:
            wsapiVersion - the new version, e.g. "1.30"
            +

            getClient

            +
            public HttpClient getClient()
            +
            Get the underlying http client implementation. + This is exposed with the intent of providing the ability to supply additional configuration to the client. + It should not be used to directly make i/o calls.
            +
            Returns:
            the raw http client
        • @@ -579,13 +559,13 @@

          setWsapiVersion

          diff --git a/src/main/resources/doc/com/rallydev/rest/RallyRestApiTest.html b/src/main/resources/doc/com/rallydev/rest/RallyRestApiTest.html new file mode 100644 index 0000000..46f65b1 --- /dev/null +++ b/src/main/resources/doc/com/rallydev/rest/RallyRestApiTest.html @@ -0,0 +1,567 @@ + + + + + +RallyRestApiTest (Rally Rest API for Java 2.2) + + + + + + + + + + + +
          +
          com.rallydev.rest
          +

          Class RallyRestApiTest

          +
          +
          + +
          +
            +
          • +
            +
            +
            public class RallyRestApiTest
            +extends Object
            +
          • +
          +
          +
          + +
          +
          +
            +
          • + +
              +
            • + + +

              Constructor Detail

              + + + +
                +
              • +

                RallyRestApiTest

                +
                public RallyRestApiTest()
                +
              • +
              +
            • +
            + +
              +
            • + + +

              Method Detail

              + + + +
                +
              • +

                shouldInitializeBasicAuthClient

                +
                public void shouldInitializeBasicAuthClient()
                +
              • +
              + + + +
                +
              • +

                shouldInitializeApiKeyClient

                +
                public void shouldInitializeApiKeyClient()
                +
              • +
              + + + +
                +
              • +

                shouldSetProxy

                +
                public void shouldSetProxy()
                +                    throws Exception
                +
                Throws:
                +
                Exception
                +
              • +
              + + + +
                +
              • +

                shouldSetProxyWithCredentials

                +
                public void shouldSetProxyWithCredentials()
                +                                   throws Exception
                +
                Throws:
                +
                Exception
                +
              • +
              + + + +
                +
              • +

                shouldSetVendor

                +
                public void shouldSetVendor()
                +                     throws Exception
                +
                Throws:
                +
                Exception
                +
              • +
              + + + +
                +
              • +

                shouldSetVersion

                +
                public void shouldSetVersion()
                +                      throws Exception
                +
                Throws:
                +
                Exception
                +
              • +
              + + + +
                +
              • +

                shouldSetName

                +
                public void shouldSetName()
                +                   throws Exception
                +
                Throws:
                +
                Exception
                +
              • +
              + + + +
                +
              • +

                shouldGetWsapiVersion

                +
                public void shouldGetWsapiVersion()
                +
              • +
              + + + +
                +
              • +

                shouldSetWsapiVersion

                +
                public void shouldSetWsapiVersion()
                +
              • +
              + + + + + + + + + + + +
                +
              • +

                shouldUpdateCollection

                +
                public void shouldUpdateCollection()
                +                            throws Exception
                +
                Throws:
                +
                Exception
                +
              • +
              + + + + + + + + + + + +
                +
              • +

                shouldQueryOnePage

                +
                public void shouldQueryOnePage()
                +                        throws Exception
                +
                Throws:
                +
                Exception
                +
              • +
              + + + +
                +
              • +

                shouldQueryAllPages

                +
                public void shouldQueryAllPages()
                +                         throws Exception
                +
                Throws:
                +
                Exception
                +
              • +
              + + + +
                +
              • +

                shouldQuerySomePages

                +
                public void shouldQuerySomePages()
                +                          throws Exception
                +
                Throws:
                +
                Exception
                +
              • +
              + + + +
                +
              • +

                shouldQueryNoPages

                +
                public void shouldQueryNoPages()
                +                        throws Exception
                +
                Throws:
                +
                Exception
                +
              • +
              + + + +
                +
              • +

                shouldQuerySomePagesWithNonStandardStart

                +
                public void shouldQuerySomePagesWithNonStandardStart()
                +                                              throws Exception
                +
                Throws:
                +
                Exception
                +
              • +
              + + + +
                +
              • +

                shouldQueryAllPagesWithNonStandardStart

                +
                public void shouldQueryAllPagesWithNonStandardStart()
                +                                             throws Exception
                +
                Throws:
                +
                Exception
                +
              • +
              + + + + +
            • +
            +
          • +
          +
          +
          + + + + + + + diff --git a/src/main/resources/doc/com/rallydev/rest/RestApiFactory.html b/src/main/resources/doc/com/rallydev/rest/RestApiFactory.html new file mode 100644 index 0000000..f181a80 --- /dev/null +++ b/src/main/resources/doc/com/rallydev/rest/RestApiFactory.html @@ -0,0 +1,259 @@ + + + + + +RestApiFactory (Rally Rest API for Java 2.2) + + + + + + + + + + + +
          +
          com.rallydev.rest
          +

          Class RestApiFactory

          +
          +
          + +
          +
            +
          • +
            +
            +
            public class RestApiFactory
            +extends Object
            +
          • +
          +
          +
          + +
          +
          + +
          +
          + + + + + + + diff --git a/src/main/resources/doc/com/rallydev/rest/class-use/CollectionAddExample.html b/src/main/resources/doc/com/rallydev/rest/class-use/CollectionAddExample.html new file mode 100644 index 0000000..5651ee3 --- /dev/null +++ b/src/main/resources/doc/com/rallydev/rest/class-use/CollectionAddExample.html @@ -0,0 +1,115 @@ + + + + + +Uses of Class com.rallydev.rest.CollectionAddExample (Rally Rest API for Java 2.2) + + + + + + + + + + +
          +

          Uses of Class
          com.rallydev.rest.CollectionAddExample

          +
          +
          No usage of com.rallydev.rest.CollectionAddExample
          + + + + + + diff --git a/src/main/resources/doc/com/rallydev/rest/class-use/CollectionQueryExample.html b/src/main/resources/doc/com/rallydev/rest/class-use/CollectionQueryExample.html new file mode 100644 index 0000000..b8b2403 --- /dev/null +++ b/src/main/resources/doc/com/rallydev/rest/class-use/CollectionQueryExample.html @@ -0,0 +1,115 @@ + + + + + +Uses of Class com.rallydev.rest.CollectionQueryExample (Rally Rest API for Java 2.2) + + + + + + + + + + +
          +

          Uses of Class
          com.rallydev.rest.CollectionQueryExample

          +
          +
          No usage of com.rallydev.rest.CollectionQueryExample
          + + + + + + diff --git a/src/main/resources/doc/com/rallydev/rest/class-use/CollectionSummaryExample.html b/src/main/resources/doc/com/rallydev/rest/class-use/CollectionSummaryExample.html new file mode 100644 index 0000000..c7bf7fb --- /dev/null +++ b/src/main/resources/doc/com/rallydev/rest/class-use/CollectionSummaryExample.html @@ -0,0 +1,115 @@ + + + + + +Uses of Class com.rallydev.rest.CollectionSummaryExample (Rally Rest API for Java 2.2) + + + + + + + + + + +
          +

          Uses of Class
          com.rallydev.rest.CollectionSummaryExample

          +
          +
          No usage of com.rallydev.rest.CollectionSummaryExample
          + + + + + + diff --git a/src/main/resources/doc/com/rallydev/rest/class-use/CrudExample.html b/src/main/resources/doc/com/rallydev/rest/class-use/CrudExample.html new file mode 100644 index 0000000..d803248 --- /dev/null +++ b/src/main/resources/doc/com/rallydev/rest/class-use/CrudExample.html @@ -0,0 +1,115 @@ + + + + + +Uses of Class com.rallydev.rest.CrudExample (Rally Rest API for Java 2.2) + + + + + + + + + + +
          +

          Uses of Class
          com.rallydev.rest.CrudExample

          +
          +
          No usage of com.rallydev.rest.CrudExample
          + + + + + + diff --git a/src/main/resources/doc/com/rallydev/rest/class-use/QueryExample.html b/src/main/resources/doc/com/rallydev/rest/class-use/QueryExample.html new file mode 100644 index 0000000..1e4de46 --- /dev/null +++ b/src/main/resources/doc/com/rallydev/rest/class-use/QueryExample.html @@ -0,0 +1,115 @@ + + + + + +Uses of Class com.rallydev.rest.QueryExample (Rally Rest API for Java 2.2) + + + + + + + + + + +
          +

          Uses of Class
          com.rallydev.rest.QueryExample

          +
          +
          No usage of com.rallydev.rest.QueryExample
          + + + + + + diff --git a/src/main/resources/doc/com/rallydev/rest/class-use/RallyRestApi.html b/src/main/resources/doc/com/rallydev/rest/class-use/RallyRestApi.html index dbc54ca..d2d25e6 100644 --- a/src/main/resources/doc/com/rallydev/rest/class-use/RallyRestApi.html +++ b/src/main/resources/doc/com/rallydev/rest/class-use/RallyRestApi.html @@ -2,15 +2,15 @@ - -Uses of Class com.rallydev.rest.RallyRestApi (Rally Rest API for Java 2.0) - + +Uses of Class com.rallydev.rest.RallyRestApi (Rally Rest API for Java 2.2) + diff --git a/src/main/resources/doc/com/rallydev/rest/class-use/RallyRestApiTest.html b/src/main/resources/doc/com/rallydev/rest/class-use/RallyRestApiTest.html new file mode 100644 index 0000000..a1044f6 --- /dev/null +++ b/src/main/resources/doc/com/rallydev/rest/class-use/RallyRestApiTest.html @@ -0,0 +1,115 @@ + + + + + +Uses of Class com.rallydev.rest.RallyRestApiTest (Rally Rest API for Java 2.2) + + + + + + + + + + +
          +

          Uses of Class
          com.rallydev.rest.RallyRestApiTest

          +
          +
          No usage of com.rallydev.rest.RallyRestApiTest
          + + + + + + diff --git a/src/main/resources/doc/com/rallydev/rest/class-use/RestApiFactory.html b/src/main/resources/doc/com/rallydev/rest/class-use/RestApiFactory.html new file mode 100644 index 0000000..bfece53 --- /dev/null +++ b/src/main/resources/doc/com/rallydev/rest/class-use/RestApiFactory.html @@ -0,0 +1,115 @@ + + + + + +Uses of Class com.rallydev.rest.RestApiFactory (Rally Rest API for Java 2.2) + + + + + + + + + + +
          +

          Uses of Class
          com.rallydev.rest.RestApiFactory

          +
          +
          No usage of com.rallydev.rest.RestApiFactory
          + + + + + + diff --git a/src/main/resources/doc/com/rallydev/rest/client/ApiKeyClient.html b/src/main/resources/doc/com/rallydev/rest/client/ApiKeyClient.html new file mode 100644 index 0000000..2579642 --- /dev/null +++ b/src/main/resources/doc/com/rallydev/rest/client/ApiKeyClient.html @@ -0,0 +1,275 @@ + + + + + +ApiKeyClient (Rally Rest API for Java 2.2) + + + + + + + + + + + +
          +
          com.rallydev.rest.client
          +

          Class ApiKeyClient

          +
          +
          + +
          + +
          +
          + +
          +
          +
            +
          • + +
              +
            • + + +

              Constructor Detail

              + + + +
                +
              • +

                ApiKeyClient

                +
                public ApiKeyClient(URI server,
                +            String apiKey)
                +
                Construct a new client.
                +
                Parameters:
                server - the server to connect to
                apiKey - the key to be used for authentication
                +
              • +
              +
            • +
            +
          • +
          +
          +
          + + + + + + + diff --git a/src/main/resources/doc/com/rallydev/rest/client/ApiKeyClientTest.html b/src/main/resources/doc/com/rallydev/rest/client/ApiKeyClientTest.html new file mode 100644 index 0000000..5063ad9 --- /dev/null +++ b/src/main/resources/doc/com/rallydev/rest/client/ApiKeyClientTest.html @@ -0,0 +1,288 @@ + + + + + +ApiKeyClientTest (Rally Rest API for Java 2.2) + + + + + + + + + + + +
          +
          com.rallydev.rest.client
          +

          Class ApiKeyClientTest

          +
          +
          + +
          +
            +
          • +
            +
            +
            public class ApiKeyClientTest
            +extends Object
            +
          • +
          +
          +
          + +
          +
          +
            +
          • + +
              +
            • + + +

              Constructor Detail

              + + + +
                +
              • +

                ApiKeyClientTest

                +
                public ApiKeyClientTest()
                +
              • +
              +
            • +
            + + +
          • +
          +
          +
          + + + + + + + diff --git a/src/main/resources/doc/com/rallydev/rest/client/BasicAuthClient.html b/src/main/resources/doc/com/rallydev/rest/client/BasicAuthClient.html new file mode 100644 index 0000000..0c0a069 --- /dev/null +++ b/src/main/resources/doc/com/rallydev/rest/client/BasicAuthClient.html @@ -0,0 +1,277 @@ + + + + + +BasicAuthClient (Rally Rest API for Java 2.2) + + + + + + + + + + + +
          +
          com.rallydev.rest.client
          +

          Class BasicAuthClient

          +
          +
          + +
          +
            +
          • +
            +
            All Implemented Interfaces:
            +
            Closeable, AutoCloseable, HttpClient
            +
            +
            +
            +
            public class BasicAuthClient
            +extends HttpClient
            +
            A HttpClient which authenticates using basic authentication (username/password).
            +
          • +
          +
          +
          + +
          +
          +
            +
          • + +
              +
            • + + +

              Constructor Detail

              + + + +
                +
              • +

                BasicAuthClient

                +
                public BasicAuthClient(URI server,
                +               String userName,
                +               String password)
                +
                Construct a new client.
                +
                Parameters:
                server - the server to connect to
                userName - the username to be used for authentication
                password - the password to be used for authentication
                +
              • +
              +
            • +
            +
          • +
          +
          +
          + + + + + + + diff --git a/src/main/resources/doc/com/rallydev/rest/client/BasicAuthClientTest.html b/src/main/resources/doc/com/rallydev/rest/client/BasicAuthClientTest.html new file mode 100644 index 0000000..0195145 --- /dev/null +++ b/src/main/resources/doc/com/rallydev/rest/client/BasicAuthClientTest.html @@ -0,0 +1,368 @@ + + + + + +BasicAuthClientTest (Rally Rest API for Java 2.2) + + + + + + + + + + + +
          +
          com.rallydev.rest.client
          +

          Class BasicAuthClientTest

          +
          +
          + +
          +
            +
          • +
            +
            +
            public class BasicAuthClientTest
            +extends Object
            +
          • +
          +
          +
          + +
          +
          +
            +
          • + +
              +
            • + + +

              Constructor Detail

              + + + +
                +
              • +

                BasicAuthClientTest

                +
                public BasicAuthClientTest()
                +
              • +
              +
            • +
            + +
              +
            • + + +

              Method Detail

              + + + + + + + +
                +
              • +

                shouldIntialize

                +
                public void shouldIntialize()
                +
              • +
              + + + +
                +
              • +

                shouldNotIncludeCSRFTokenOnGet

                +
                public void shouldNotIncludeCSRFTokenOnGet()
                +                                    throws Exception
                +
                Throws:
                +
                Exception
                +
              • +
              + + + +
                +
              • +

                shouldNotIncludeCSRFTokenOnWsapiv1

                +
                public void shouldNotIncludeCSRFTokenOnWsapiv1()
                +                                        throws Exception
                +
                Throws:
                +
                Exception
                +
              • +
              + + + +
                +
              • +

                shouldRequestCSRFToken

                +
                public void shouldRequestCSRFToken()
                +                            throws Exception
                +
                Throws:
                +
                Exception
                +
              • +
              + + + +
                +
              • +

                shouldIncludeCSRFTokenOnPost

                +
                public void shouldIncludeCSRFTokenOnPost()
                +                                  throws Exception
                +
                Throws:
                +
                Exception
                +
              • +
              + + + +
                +
              • +

                shouldIncludeCSRFTokenOnPut

                +
                public void shouldIncludeCSRFTokenOnPut()
                +                                 throws Exception
                +
                Throws:
                +
                Exception
                +
              • +
              + + + +
                +
              • +

                shouldIncludeCSRFTokenOnDelete

                +
                public void shouldIncludeCSRFTokenOnDelete()
                +                                    throws Exception
                +
                Throws:
                +
                Exception
                +
              • +
              +
            • +
            +
          • +
          +
          +
          + + + + + + + diff --git a/src/main/resources/doc/com/rallydev/rest/client/HttpClient.html b/src/main/resources/doc/com/rallydev/rest/client/HttpClient.html new file mode 100644 index 0000000..be69a93 --- /dev/null +++ b/src/main/resources/doc/com/rallydev/rest/client/HttpClient.html @@ -0,0 +1,520 @@ + + + + + +HttpClient (Rally Rest API for Java 2.2) + + + + + + + + + + + +
          +
          com.rallydev.rest.client
          +

          Class HttpClient

          +
          +
          + +
          + +
          +
          + +
          +
          +
            +
          • + +
              +
            • + + +

              Method Detail

              + + + +
                +
              • +

                setProxy

                +
                public void setProxy(URI proxy)
                +
                Set the unauthenticated proxy server to use. By default no proxy is configured.
                +
                Parameters:
                proxy - The proxy server, e.g. new URI("http://my.proxy.com:8000")
                +
              • +
              + + + +
                +
              • +

                setProxy

                +
                public void setProxy(URI proxy,
                +            String userName,
                +            String password)
                +
                Set the authenticated proxy server to use. By default no proxy is configured.
                +
                Parameters:
                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.
                +
              • +
              + + + +
                +
              • +

                setApplicationVendor

                +
                public void setApplicationVendor(String value)
                +
                Set the value of the X-RallyIntegrationVendor header included on all requests. + This should be set to your company name.
                +
                Parameters:
                value - The vendor header to be included on all requests.
                +
              • +
              + + + +
                +
              • +

                setApplicationVersion

                +
                public void setApplicationVersion(String value)
                +
                Set the value of the X-RallyIntegrationVersion header included on all requests. + This should be set to the version of your application.
                +
                Parameters:
                value - The vendor header to be included on all requests.
                +
              • +
              + + + +
                +
              • +

                setApplicationName

                +
                public void setApplicationName(String value)
                +
                Set the value of the X-RallyIntegrationName header included on all requests. + This should be set to the name of your application.
                +
                Parameters:
                value - The vendor header to be included on all requests.
                +
              • +
              + + + +
                +
              • +

                getServer

                +
                public String getServer()
                +
                Get the current server being targeted.
                +
                Returns:
                the current server.
                +
              • +
              + + + +
                +
              • +

                getWsapiVersion

                +
                public String getWsapiVersion()
                +
                Get the current version of the WSAPI being targeted.
                +
                Returns:
                the current WSAPI version.
                +
              • +
              + + + +
                +
              • +

                setWsapiVersion

                +
                public void setWsapiVersion(String wsapiVersion)
                +
                Set the current version of the WSAPI being targeted.
                +
                Parameters:
                wsapiVersion - the new version, e.g. "1.30"
                +
              • +
              + + + +
                +
              • +

                doPost

                +
                public String doPost(String url,
                +            String body)
                +              throws IOException
                +
                Perform a post against the WSAPI
                +
                Parameters:
                url - the request url
                body - the body of the post
                +
                Returns:
                the JSON encoded string response
                +
                Throws:
                +
                IOException - if a non-200 response code is returned or if some other + problem occurs while executing the request
                +
              • +
              + + + +
                +
              • +

                doPut

                +
                public String doPut(String url,
                +           String body)
                +             throws IOException
                +
                Perform a put against the WSAPI
                +
                Parameters:
                url - the request url
                body - the body of the put
                +
                Returns:
                the JSON encoded string response
                +
                Throws:
                +
                IOException - if a non-200 response code is returned or if some other + problem occurs while executing the request
                +
              • +
              + + + +
                +
              • +

                doDelete

                +
                public String doDelete(String url)
                +                throws IOException
                +
                Perform a delete against the WSAPI
                +
                Parameters:
                url - the request url
                +
                Returns:
                the JSON encoded string response
                +
                Throws:
                +
                IOException - if a non-200 response code is returned or if some other + problem occurs while executing the request
                +
              • +
              + + + +
                +
              • +

                doGet

                +
                public String doGet(String url)
                +             throws IOException
                +
                Perform a get against the WSAPI
                +
                Parameters:
                url - the request url
                +
                Returns:
                the JSON encoded string response
                +
                Throws:
                +
                IOException - if a non-200 response code is returned or if some other + problem occurs while executing the request
                +
              • +
              + + + +
                +
              • +

                close

                +
                public void close()
                +           throws IOException
                +
                Release all resources associated with this instance.
                +
                +
                Specified by:
                +
                close in interface Closeable
                +
                Specified by:
                +
                close in interface AutoCloseable
                +
                Throws:
                +
                IOException - if an error occurs releasing resources
                +
              • +
              + + + +
                +
              • +

                getWsapiUrl

                +
                public String getWsapiUrl()
                +
                Get the WSAPI base url based on the current server and WSAPI version
                +
                Returns:
                the fully qualified WSAPI base url, e.g. https://rally1.rallydev.com/slm/webservice/1.33
                +
              • +
              +
            • +
            +
          • +
          +
          +
          + + + + + + + diff --git a/src/main/resources/doc/com/rallydev/rest/client/HttpClientTest.html b/src/main/resources/doc/com/rallydev/rest/client/HttpClientTest.html new file mode 100644 index 0000000..a5b7d0b --- /dev/null +++ b/src/main/resources/doc/com/rallydev/rest/client/HttpClientTest.html @@ -0,0 +1,490 @@ + + + + + +HttpClientTest (Rally Rest API for Java 2.2) + + + + + + + + + + + +
          +
          com.rallydev.rest.client
          +

          Class HttpClientTest

          +
          +
          + +
          +
            +
          • +
            +
            +
            public class HttpClientTest
            +extends Object
            +
          • +
          +
          +
          + +
          +
          +
            +
          • + +
              +
            • + + +

              Constructor Detail

              + + + +
                +
              • +

                HttpClientTest

                +
                public HttpClientTest()
                +
              • +
              +
            • +
            + +
              +
            • + + +

              Method Detail

              + + + + + + + +
                +
              • +

                shouldIntialize

                +
                public void shouldIntialize()
                +
              • +
              + + + +
                +
              • +

                shouldSetProxy

                +
                public void shouldSetProxy()
                +                    throws Exception
                +
                Throws:
                +
                Exception
                +
              • +
              + + + +
                +
              • +

                shouldSetProxyWithCredentials

                +
                public void shouldSetProxyWithCredentials()
                +                                   throws Exception
                +
                Throws:
                +
                Exception
                +
              • +
              + + + +
                +
              • +

                shouldSetApplicationVendor

                +
                public void shouldSetApplicationVendor()
                +                                throws Exception
                +
                Throws:
                +
                Exception
                +
              • +
              + + + +
                +
              • +

                shouldSetApplicationName

                +
                public void shouldSetApplicationName()
                +                              throws Exception
                +
                Throws:
                +
                Exception
                +
              • +
              + + + +
                +
              • +

                shouldSetApplicationVersion

                +
                public void shouldSetApplicationVersion()
                +                                 throws Exception
                +
                Throws:
                +
                Exception
                +
              • +
              + + + +
                +
              • +

                shouldUseDefaultWsapiVersion

                +
                public void shouldUseDefaultWsapiVersion()
                +
              • +
              + + + +
                +
              • +

                shouldSetWsapiVersion

                +
                public void shouldSetWsapiVersion()
                +
              • +
              + + + + + + + + + + + + + + + + + + + + + + + +
                +
              • +

                shouldReturnValidResponse

                +
                public void shouldReturnValidResponse()
                +                               throws Exception
                +
                Throws:
                +
                Exception
                +
              • +
              + + + +
                +
              • +

                shouldExplodeWithInvalidResponse

                +
                public void shouldExplodeWithInvalidResponse()
                +                                      throws Exception
                +
                Throws:
                +
                Exception
                +
              • +
              +
            • +
            +
          • +
          +
          +
          + + + + + + + diff --git a/src/main/resources/doc/com/rallydev/rest/client/class-use/ApiKeyClient.html b/src/main/resources/doc/com/rallydev/rest/client/class-use/ApiKeyClient.html new file mode 100644 index 0000000..0192075 --- /dev/null +++ b/src/main/resources/doc/com/rallydev/rest/client/class-use/ApiKeyClient.html @@ -0,0 +1,115 @@ + + + + + +Uses of Class com.rallydev.rest.client.ApiKeyClient (Rally Rest API for Java 2.2) + + + + + + + + + + +
          +

          Uses of Class
          com.rallydev.rest.client.ApiKeyClient

          +
          +
          No usage of com.rallydev.rest.client.ApiKeyClient
          + + + + + + diff --git a/src/main/resources/doc/com/rallydev/rest/client/class-use/ApiKeyClientTest.html b/src/main/resources/doc/com/rallydev/rest/client/class-use/ApiKeyClientTest.html new file mode 100644 index 0000000..ebb0f60 --- /dev/null +++ b/src/main/resources/doc/com/rallydev/rest/client/class-use/ApiKeyClientTest.html @@ -0,0 +1,115 @@ + + + + + +Uses of Class com.rallydev.rest.client.ApiKeyClientTest (Rally Rest API for Java 2.2) + + + + + + + + + + +
          +

          Uses of Class
          com.rallydev.rest.client.ApiKeyClientTest

          +
          +
          No usage of com.rallydev.rest.client.ApiKeyClientTest
          + + + + + + diff --git a/src/main/resources/doc/com/rallydev/rest/client/class-use/BasicAuthClient.html b/src/main/resources/doc/com/rallydev/rest/client/class-use/BasicAuthClient.html new file mode 100644 index 0000000..02b4cf1 --- /dev/null +++ b/src/main/resources/doc/com/rallydev/rest/client/class-use/BasicAuthClient.html @@ -0,0 +1,115 @@ + + + + + +Uses of Class com.rallydev.rest.client.BasicAuthClient (Rally Rest API for Java 2.2) + + + + + + + + + + +
          +

          Uses of Class
          com.rallydev.rest.client.BasicAuthClient

          +
          +
          No usage of com.rallydev.rest.client.BasicAuthClient
          + + + + + + diff --git a/src/main/resources/doc/com/rallydev/rest/client/class-use/BasicAuthClientTest.html b/src/main/resources/doc/com/rallydev/rest/client/class-use/BasicAuthClientTest.html new file mode 100644 index 0000000..2321610 --- /dev/null +++ b/src/main/resources/doc/com/rallydev/rest/client/class-use/BasicAuthClientTest.html @@ -0,0 +1,115 @@ + + + + + +Uses of Class com.rallydev.rest.client.BasicAuthClientTest (Rally Rest API for Java 2.2) + + + + + + + + + + +
          +

          Uses of Class
          com.rallydev.rest.client.BasicAuthClientTest

          +
          +
          No usage of com.rallydev.rest.client.BasicAuthClientTest
          + + + + + + diff --git a/src/main/resources/doc/com/rallydev/rest/client/class-use/HttpClient.html b/src/main/resources/doc/com/rallydev/rest/client/class-use/HttpClient.html new file mode 100644 index 0000000..0601e0e --- /dev/null +++ b/src/main/resources/doc/com/rallydev/rest/client/class-use/HttpClient.html @@ -0,0 +1,191 @@ + + + + + +Uses of Class com.rallydev.rest.client.HttpClient (Rally Rest API for Java 2.2) + + + + + + + + + + +
          +

          Uses of Class
          com.rallydev.rest.client.HttpClient

          +
          +
          + +
          + + + + + + diff --git a/src/main/resources/doc/com/rallydev/rest/client/class-use/HttpClientTest.html b/src/main/resources/doc/com/rallydev/rest/client/class-use/HttpClientTest.html new file mode 100644 index 0000000..333d33c --- /dev/null +++ b/src/main/resources/doc/com/rallydev/rest/client/class-use/HttpClientTest.html @@ -0,0 +1,115 @@ + + + + + +Uses of Class com.rallydev.rest.client.HttpClientTest (Rally Rest API for Java 2.2) + + + + + + + + + + +
          +

          Uses of Class
          com.rallydev.rest.client.HttpClientTest

          +
          +
          No usage of com.rallydev.rest.client.HttpClientTest
          + + + + + + diff --git a/src/main/resources/doc/com/rallydev/rest/client/package-frame.html b/src/main/resources/doc/com/rallydev/rest/client/package-frame.html new file mode 100644 index 0000000..b93778d --- /dev/null +++ b/src/main/resources/doc/com/rallydev/rest/client/package-frame.html @@ -0,0 +1,21 @@ + + + + + +com.rallydev.rest.client (Rally Rest API for Java 2.2) + + + + +

          com.rallydev.rest.client

          + + + diff --git a/src/main/resources/doc/com/rallydev/rest/client/package-summary.html b/src/main/resources/doc/com/rallydev/rest/client/package-summary.html new file mode 100644 index 0000000..07186d1 --- /dev/null +++ b/src/main/resources/doc/com/rallydev/rest/client/package-summary.html @@ -0,0 +1,156 @@ + + + + + +com.rallydev.rest.client (Rally Rest API for Java 2.2) + + + + + + + +
          + + + + + +
          + + +
          +

          Package com.rallydev.rest.client

          +
          +
          Provides the underlying http client implementations.
          +
          +

          See: Description

          +
          +
          +
            +
          • + + + + + + + + + + + + + + + + + + + + +
            Class Summary 
            ClassDescription
            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 com.rallydev.rest.client Description

          +
          Provides the underlying http client implementations.
          +
          + +
          + + + + + +
          + + + + diff --git a/src/main/resources/doc/com/rallydev/rest/client/package-tree.html b/src/main/resources/doc/com/rallydev/rest/client/package-tree.html new file mode 100644 index 0000000..79b7cb7 --- /dev/null +++ b/src/main/resources/doc/com/rallydev/rest/client/package-tree.html @@ -0,0 +1,141 @@ + + + + + +com.rallydev.rest.client Class Hierarchy (Rally Rest API for Java 2.2) + + + + + + + +
          + + + + + +
          + + +
          +

          Hierarchy For Package com.rallydev.rest.client

          +Package Hierarchies: + +
          +
          +

          Class Hierarchy

          + +
          + +
          + + + + + +
          + + + + diff --git a/src/main/resources/doc/com/rallydev/rest/client/package-use.html b/src/main/resources/doc/com/rallydev/rest/client/package-use.html new file mode 100644 index 0000000..a7acda1 --- /dev/null +++ b/src/main/resources/doc/com/rallydev/rest/client/package-use.html @@ -0,0 +1,175 @@ + + + + + +Uses of Package com.rallydev.rest.client (Rally Rest API for Java 2.2) + + + + + + + + + + +
          +

          Uses of Package
          com.rallydev.rest.client

          +
          +
          + +
          + + + + + + diff --git a/src/main/resources/doc/com/rallydev/rest/matchers/HttpRequestBodyMatcher.html b/src/main/resources/doc/com/rallydev/rest/matchers/HttpRequestBodyMatcher.html new file mode 100644 index 0000000..0b9e6f7 --- /dev/null +++ b/src/main/resources/doc/com/rallydev/rest/matchers/HttpRequestBodyMatcher.html @@ -0,0 +1,292 @@ + + + + + +HttpRequestBodyMatcher (Rally Rest API for Java 2.2) + + + + + + + + + + + +
          +
          com.rallydev.rest.matchers
          +

          Class HttpRequestBodyMatcher

          +
          +
          + +
          + +
          +
          +
            +
          • + + + +
              +
            • + + +

              Method Summary

              + + + + + + + + + + +
              Methods 
              Modifier and TypeMethod and Description
              booleanmatches(Object o) 
              +
                +
              • + + +

                Methods inherited from class org.mockito.ArgumentMatcher

                +describeTo
              • +
              +
                +
              • + + +

                Methods inherited from class org.hamcrest.BaseMatcher

                +_dont_implement_Matcher___instead_extend_BaseMatcher_, toString
              • +
              + +
            • +
            +
          • +
          +
          +
          + +
          +
          + + + + + + + diff --git a/src/main/resources/doc/com/rallydev/rest/matchers/HttpRequestHeaderMatcher.html b/src/main/resources/doc/com/rallydev/rest/matchers/HttpRequestHeaderMatcher.html new file mode 100644 index 0000000..6aa62c7 --- /dev/null +++ b/src/main/resources/doc/com/rallydev/rest/matchers/HttpRequestHeaderMatcher.html @@ -0,0 +1,292 @@ + + + + + +HttpRequestHeaderMatcher (Rally Rest API for Java 2.2) + + + + + + + + + + + +
          +
          com.rallydev.rest.matchers
          +

          Class HttpRequestHeaderMatcher

          +
          +
          +
            +
          • java.lang.Object
          • +
          • +
              +
            • org.hamcrest.BaseMatcher<T>
            • +
            • +
                +
              • org.mockito.ArgumentMatcher<HttpRequestBase>
              • +
              • +
                  +
                • com.rallydev.rest.matchers.HttpRequestHeaderMatcher
                • +
                +
              • +
              +
            • +
            +
          • +
          +
          +
            +
          • +
            +
            All Implemented Interfaces:
            +
            org.hamcrest.Matcher<HttpRequestBase>, org.hamcrest.SelfDescribing
            +
            +
            +
            +
            public class HttpRequestHeaderMatcher
            +extends org.mockito.ArgumentMatcher<HttpRequestBase>
            +
          • +
          +
          +
          + +
          +
          +
            +
          • + +
              +
            • + + +

              Constructor Detail

              + + + +
                +
              • +

                HttpRequestHeaderMatcher

                +
                public HttpRequestHeaderMatcher(String name,
                +                        String value)
                +
              • +
              +
            • +
            + +
              +
            • + + +

              Method Detail

              + + + +
                +
              • +

                matches

                +
                public boolean matches(Object o)
                +
                +
                Specified by:
                +
                matches in interface org.hamcrest.Matcher<HttpRequestBase>
                +
                Specified by:
                +
                matches in class org.mockito.ArgumentMatcher<HttpRequestBase>
                +
                +
              • +
              +
            • +
            +
          • +
          +
          +
          + + + + + + + diff --git a/src/main/resources/doc/com/rallydev/rest/matchers/HttpRequestUrlMatcher.html b/src/main/resources/doc/com/rallydev/rest/matchers/HttpRequestUrlMatcher.html new file mode 100644 index 0000000..f487b9b --- /dev/null +++ b/src/main/resources/doc/com/rallydev/rest/matchers/HttpRequestUrlMatcher.html @@ -0,0 +1,290 @@ + + + + + +HttpRequestUrlMatcher (Rally Rest API for Java 2.2) + + + + + + + + + + + +
          +
          com.rallydev.rest.matchers
          +

          Class HttpRequestUrlMatcher

          +
          +
          +
            +
          • java.lang.Object
          • +
          • +
              +
            • org.hamcrest.BaseMatcher<T>
            • +
            • +
                +
              • org.mockito.ArgumentMatcher<HttpRequestBase>
              • +
              • +
                  +
                • com.rallydev.rest.matchers.HttpRequestUrlMatcher
                • +
                +
              • +
              +
            • +
            +
          • +
          +
          +
            +
          • +
            +
            All Implemented Interfaces:
            +
            org.hamcrest.Matcher<HttpRequestBase>, org.hamcrest.SelfDescribing
            +
            +
            +
            +
            public class HttpRequestUrlMatcher
            +extends org.mockito.ArgumentMatcher<HttpRequestBase>
            +
          • +
          +
          +
          +
            +
          • + + + +
              +
            • + + +

              Method Summary

              + + + + + + + + + + +
              Methods 
              Modifier and TypeMethod and Description
              booleanmatches(Object o) 
              +
                +
              • + + +

                Methods inherited from class org.mockito.ArgumentMatcher

                +describeTo
              • +
              +
                +
              • + + +

                Methods inherited from class org.hamcrest.BaseMatcher

                +_dont_implement_Matcher___instead_extend_BaseMatcher_, toString
              • +
              + +
            • +
            +
          • +
          +
          +
          +
            +
          • + +
              +
            • + + +

              Constructor Detail

              + + + +
                +
              • +

                HttpRequestUrlMatcher

                +
                public HttpRequestUrlMatcher(String url)
                +
              • +
              +
            • +
            + +
              +
            • + + +

              Method Detail

              + + + +
                +
              • +

                matches

                +
                public boolean matches(Object o)
                +
                +
                Specified by:
                +
                matches in interface org.hamcrest.Matcher<HttpRequestBase>
                +
                Specified by:
                +
                matches in class org.mockito.ArgumentMatcher<HttpRequestBase>
                +
                +
              • +
              +
            • +
            +
          • +
          +
          +
          + + + + + + + diff --git a/src/main/resources/doc/com/rallydev/rest/matchers/class-use/HttpRequestBodyMatcher.html b/src/main/resources/doc/com/rallydev/rest/matchers/class-use/HttpRequestBodyMatcher.html new file mode 100644 index 0000000..ea1d659 --- /dev/null +++ b/src/main/resources/doc/com/rallydev/rest/matchers/class-use/HttpRequestBodyMatcher.html @@ -0,0 +1,115 @@ + + + + + +Uses of Class com.rallydev.rest.matchers.HttpRequestBodyMatcher (Rally Rest API for Java 2.2) + + + + + + + + + + +
          +

          Uses of Class
          com.rallydev.rest.matchers.HttpRequestBodyMatcher

          +
          +
          No usage of com.rallydev.rest.matchers.HttpRequestBodyMatcher
          + + + + + + diff --git a/src/main/resources/doc/com/rallydev/rest/matchers/class-use/HttpRequestHeaderMatcher.html b/src/main/resources/doc/com/rallydev/rest/matchers/class-use/HttpRequestHeaderMatcher.html new file mode 100644 index 0000000..2d0bb15 --- /dev/null +++ b/src/main/resources/doc/com/rallydev/rest/matchers/class-use/HttpRequestHeaderMatcher.html @@ -0,0 +1,115 @@ + + + + + +Uses of Class com.rallydev.rest.matchers.HttpRequestHeaderMatcher (Rally Rest API for Java 2.2) + + + + + + + + + + +
          +

          Uses of Class
          com.rallydev.rest.matchers.HttpRequestHeaderMatcher

          +
          +
          No usage of com.rallydev.rest.matchers.HttpRequestHeaderMatcher
          + + + + + + diff --git a/src/main/resources/doc/com/rallydev/rest/matchers/class-use/HttpRequestUrlMatcher.html b/src/main/resources/doc/com/rallydev/rest/matchers/class-use/HttpRequestUrlMatcher.html new file mode 100644 index 0000000..ae5f943 --- /dev/null +++ b/src/main/resources/doc/com/rallydev/rest/matchers/class-use/HttpRequestUrlMatcher.html @@ -0,0 +1,115 @@ + + + + + +Uses of Class com.rallydev.rest.matchers.HttpRequestUrlMatcher (Rally Rest API for Java 2.2) + + + + + + + + + + +
          +

          Uses of Class
          com.rallydev.rest.matchers.HttpRequestUrlMatcher

          +
          +
          No usage of com.rallydev.rest.matchers.HttpRequestUrlMatcher
          + + + + + + diff --git a/src/main/resources/doc/com/rallydev/rest/matchers/package-frame.html b/src/main/resources/doc/com/rallydev/rest/matchers/package-frame.html new file mode 100644 index 0000000..6b1481a --- /dev/null +++ b/src/main/resources/doc/com/rallydev/rest/matchers/package-frame.html @@ -0,0 +1,21 @@ + + + + + +com.rallydev.rest.matchers (Rally Rest API for Java 2.2) + + + + +

          com.rallydev.rest.matchers

          + + + diff --git a/src/main/resources/doc/com/rallydev/rest/matchers/package-summary.html b/src/main/resources/doc/com/rallydev/rest/matchers/package-summary.html new file mode 100644 index 0000000..4ac1875 --- /dev/null +++ b/src/main/resources/doc/com/rallydev/rest/matchers/package-summary.html @@ -0,0 +1,141 @@ + + + + + +com.rallydev.rest.matchers (Rally Rest API for Java 2.2) + + + + + + + +
          + + + + + +
          + + +
          +

          Package com.rallydev.rest.matchers

          +
          +
          + +
          + +
          + + + + + +
          + + + + diff --git a/src/main/resources/doc/com/rallydev/rest/matchers/package-tree.html b/src/main/resources/doc/com/rallydev/rest/matchers/package-tree.html new file mode 100644 index 0000000..644229c --- /dev/null +++ b/src/main/resources/doc/com/rallydev/rest/matchers/package-tree.html @@ -0,0 +1,138 @@ + + + + + +com.rallydev.rest.matchers Class Hierarchy (Rally Rest API for Java 2.2) + + + + + + + +
          + + + + + +
          + + +
          +

          Hierarchy For Package com.rallydev.rest.matchers

          +Package Hierarchies: + +
          +
          +

          Class Hierarchy

          + +
          + +
          + + + + + +
          + + + + diff --git a/src/main/resources/doc/com/rallydev/rest/matchers/package-use.html b/src/main/resources/doc/com/rallydev/rest/matchers/package-use.html new file mode 100644 index 0000000..e2746d6 --- /dev/null +++ b/src/main/resources/doc/com/rallydev/rest/matchers/package-use.html @@ -0,0 +1,115 @@ + + + + + +Uses of Package com.rallydev.rest.matchers (Rally Rest API for Java 2.2) + + + + + + + + + + +
          +

          Uses of Package
          com.rallydev.rest.matchers

          +
          +
          No usage of com.rallydev.rest.matchers
          + + + + + + diff --git a/src/main/resources/doc/com/rallydev/rest/package-frame.html b/src/main/resources/doc/com/rallydev/rest/package-frame.html index f8682b1..f5d6a58 100644 --- a/src/main/resources/doc/com/rallydev/rest/package-frame.html +++ b/src/main/resources/doc/com/rallydev/rest/package-frame.html @@ -2,9 +2,9 @@ - -com.rallydev.rest (Rally Rest API for Java 2.0) - + +com.rallydev.rest (Rally Rest API for Java 2.2) + diff --git a/src/main/resources/doc/com/rallydev/rest/package-summary.html b/src/main/resources/doc/com/rallydev/rest/package-summary.html index b891f77..541afa1 100644 --- a/src/main/resources/doc/com/rallydev/rest/package-summary.html +++ b/src/main/resources/doc/com/rallydev/rest/package-summary.html @@ -2,15 +2,15 @@ - -com.rallydev.rest (Rally Rest API for Java 2.0) - + +com.rallydev.rest (Rally Rest API for Java 2.2) + @@ -37,7 +37,7 @@
        @@ -484,8 +477,7 @@

        isScopedDown

        setScopedDown

        public void setScopedDown(boolean scopeDown)

        If a project has been specified, set whether to include matching objects in child projects in the result set.

        - Defaults to true. -

        + Defaults to true.
      Parameters:
      scopeDown - whether to include matching objects in child projects
    diff --git a/src/main/resources/doc/com/rallydev/rest/request/QueryRequestTest.html b/src/main/resources/doc/com/rallydev/rest/request/QueryRequestTest.html new file mode 100644 index 0000000..a04fc4a --- /dev/null +++ b/src/main/resources/doc/com/rallydev/rest/request/QueryRequestTest.html @@ -0,0 +1,451 @@ + + + + + +QueryRequestTest (Rally Rest API for Java 2.2) + + + + + + + + + + + +
    +
    com.rallydev.rest.request
    +

    Class QueryRequestTest

    +
    +
    + +
    +
      +
    • +
      +
      +
      public class QueryRequestTest
      +extends Object
      +
    • +
    +
    +
    + +
    +
    +
      +
    • + +
        +
      • + + +

        Constructor Detail

        + + + +
          +
        • +

          QueryRequestTest

          +
          public QueryRequestTest()
          +
        • +
        +
      • +
      + +
        +
      • + + +

        Method Detail

        + + + +
          +
        • +

          shouldCreateCorrectDefaultQuery

          +
          public void shouldCreateCorrectDefaultQuery()
          +
        • +
        + + + +
          +
        • +

          shouldCreateCorrectDefaultQueryWithExtraParam

          +
          public void shouldCreateCorrectDefaultQueryWithExtraParam()
          +
        • +
        + + + +
          +
        • +

          shouldEncodeParamsUsingUtf8

          +
          public void shouldEncodeParamsUsingUtf8()
          +
        • +
        + + + +
          +
        • +

          shouldCreateCorrectQueryWithFetch

          +
          public void shouldCreateCorrectQueryWithFetch()
          +
        • +
        + + + +
          +
        • +

          shouldCreateCorrectQueryWithDefaultOrder

          +
          public void shouldCreateCorrectQueryWithDefaultOrder()
          +
        • +
        + + + +
          +
        • +

          shouldCreateCorrectQueryWithSpecifiedOrder

          +
          public void shouldCreateCorrectQueryWithSpecifiedOrder()
          +
        • +
        + + + +
          +
        • +

          shouldCreateCorrectQueryWithPageSize

          +
          public void shouldCreateCorrectQueryWithPageSize()
          +
        • +
        + + + +
          +
        • +

          shouldCreateCorrectQueryWithStart

          +
          public void shouldCreateCorrectQueryWithStart()
          +
        • +
        + + + +
          +
        • +

          shouldCreateCorrectQueryWithQuery

          +
          public void shouldCreateCorrectQueryWithQuery()
          +
        • +
        + + + +
          +
        • +

          shouldCreateCorrectQueryWithWorkspace

          +
          public void shouldCreateCorrectQueryWithWorkspace()
          +
        • +
        + + + +
          +
        • +

          shouldCreateCorrectQueryWithProject

          +
          public void shouldCreateCorrectQueryWithProject()
          +
        • +
        + + + +
          +
        • +

          shouldCreateCorrectQueryWithNullProject

          +
          public void shouldCreateCorrectQueryWithNullProject()
          +
        • +
        + + + +
          +
        • +

          shouldCloneCorrectly

          +
          public void shouldCloneCorrectly()
          +
        • +
        + + + +
          +
        • +

          shouldCreateCorrectUrlForSubscription

          +
          public void shouldCreateCorrectUrlForSubscription()
          +
        • +
        + + + +
          +
        • +

          shouldCreateCorrectUrlForUser

          +
          public void shouldCreateCorrectUrlForUser()
          +
        • +
        + + + +
          +
        • +

          shouldCreateCorrectUrlForCollection

          +
          public void shouldCreateCorrectUrlForCollection()
          +
        • +
        +
      • +
      +
    • +
    +
    +
    + + + + + + + diff --git a/src/main/resources/doc/com/rallydev/rest/request/Request.html b/src/main/resources/doc/com/rallydev/rest/request/Request.html index ebea0a8..e44dc85 100644 --- a/src/main/resources/doc/com/rallydev/rest/request/Request.html +++ b/src/main/resources/doc/com/rallydev/rest/request/Request.html @@ -2,15 +2,15 @@ - -Request (Rally Rest API for Java 2.0) - + +Request (Rally Rest API for Java 2.2) + @@ -96,7 +96,7 @@

    Class Request

  • Direct Known Subclasses:
    -
    CreateRequest, DeleteRequest, GetRequest, QueryRequest, UpdateRequest
    +
    CollectionUpdateRequest, CreateRequest, DeleteRequest, GetRequest, QueryRequest, UpdateRequest


    @@ -149,14 +149,26 @@

    Method Summary

    -List<org.apache.http.NameValuePair> +GsonBuilder +getGsonBuilder() +
    Get the Gson Builder used for JSON serialization in this request.
    + + + +List<NameValuePair> getParams()
    Get the list of additional parameters included in this request.
    + +void +setGsonBuilder(GsonBuilder gsonBuilder) +
    Set the Gson Builder used for JSON serialization in this request.
    + + void -setParams(List<org.apache.http.NameValuePair> params) +setParams(List<NameValuePair> params)
    Set the list of additional parameters included in this request.
    @@ -212,7 +224,7 @@

    Method Detail

    • getParams

      -
      public List<org.apache.http.NameValuePair> getParams()
      +
      public List<NameValuePair> getParams()
      Get the list of additional parameters included in this request.
      Returns:
      The list of additional parameters
    • @@ -223,7 +235,7 @@

      getParams

      • setParams

        -
        public void setParams(List<org.apache.http.NameValuePair> params)
        +
        public void setParams(List<NameValuePair> params)
        Set the list of additional parameters included in this request.
        Parameters:
        params - The list of additional parameters
      • @@ -240,6 +252,28 @@

        addParam

        Parameters:
        name - the parameter name
        value - the parameter value
      + + + +
        +
      • +

        getGsonBuilder

        +
        public GsonBuilder getGsonBuilder()
        +
        Get the Gson Builder used for JSON serialization in this request.
        +
        Returns:
        The Gson Builder used for JSON serialization
        +
      • +
      + + + +
        +
      • +

        setGsonBuilder

        +
        public void setGsonBuilder(GsonBuilder gsonBuilder)
        +
        Set the Gson Builder used for JSON serialization in this request.
        +
        Parameters:
        gsonBuilder - The Gson Builder used for JSON serialization
        +
      • +
      diff --git a/src/main/resources/doc/com/rallydev/rest/request/RequestTest.html b/src/main/resources/doc/com/rallydev/rest/request/RequestTest.html new file mode 100644 index 0000000..ba0ccc0 --- /dev/null +++ b/src/main/resources/doc/com/rallydev/rest/request/RequestTest.html @@ -0,0 +1,282 @@ + + + + + +RequestTest (Rally Rest API for Java 2.2) + + + + + + + + + + + +
      +
      com.rallydev.rest.request
      +

      Class RequestTest

      +
      +
      + +
      +
        +
      • +
        +
        +
        public class RequestTest
        +extends Object
        +
      • +
      +
      +
      + +
      +
      +
        +
      • + +
          +
        • + + +

          Constructor Detail

          + + + +
            +
          • +

            RequestTest

            +
            public RequestTest()
            +
          • +
          +
        • +
        + +
          +
        • + + +

          Method Detail

          + + + +
            +
          • +

            shouldBeAbleToAddParams

            +
            public void shouldBeAbleToAddParams()
            +
          • +
          + + + +
            +
          • +

            shouldBeAbleToSetParams

            +
            public void shouldBeAbleToSetParams()
            +
          • +
          + + + +
            +
          • +

            shouldBeAbleToSetGsonBuilder

            +
            public void shouldBeAbleToSetGsonBuilder()
            +
          • +
          +
        • +
        +
      • +
      +
      +
      + + + + + + + diff --git a/src/main/resources/doc/com/rallydev/rest/request/UpdateRequest.html b/src/main/resources/doc/com/rallydev/rest/request/UpdateRequest.html index 94a880b..e200940 100644 --- a/src/main/resources/doc/com/rallydev/rest/request/UpdateRequest.html +++ b/src/main/resources/doc/com/rallydev/rest/request/UpdateRequest.html @@ -2,15 +2,15 @@ - -UpdateRequest (Rally Rest API for Java 2.0) - + +UpdateRequest (Rally Rest API for Java 2.2) + @@ -172,7 +172,7 @@

      Method Summary

      Methods inherited from class com.rallydev.rest.request.Request

      -addParam, getParams, setParams +addParam, getGsonBuilder, getParams, setGsonBuilder, setParams
    • diff --git a/src/main/resources/doc/com/rallydev/rest/request/UpdateRequestTest.html b/src/main/resources/doc/com/rallydev/rest/request/UpdateRequestTest.html new file mode 100644 index 0000000..e3b1a94 --- /dev/null +++ b/src/main/resources/doc/com/rallydev/rest/request/UpdateRequestTest.html @@ -0,0 +1,308 @@ + + + + + +UpdateRequestTest (Rally Rest API for Java 2.2) + + + + + + + + + + + +
      +
      com.rallydev.rest.request
      +

      Class UpdateRequestTest

      +
      +
      + +
      +
        +
      • +
        +
        +
        public class UpdateRequestTest
        +extends Object
        +
      • +
      +
      +
      + +
      +
      +
        +
      • + +
          +
        • + + +

          Constructor Detail

          + + + +
            +
          • +

            UpdateRequestTest

            +
            public UpdateRequestTest()
            +
          • +
          +
        • +
        + +
          +
        • + + +

          Method Detail

          + + + +
            +
          • +

            shouldCreateACorrectBody

            +
            public void shouldCreateACorrectBody()
            +
          • +
          + + + +
            +
          • +

            shouldCreateACorrectBodyWithNullFieldsByDefault

            +
            public void shouldCreateACorrectBodyWithNullFieldsByDefault()
            +
          • +
          + + + +
            +
          • +

            shouldConstructTheCorrectUrl

            +
            public void shouldConstructTheCorrectUrl()
            +
          • +
          + + + +
            +
          • +

            shouldConstructTheCorrectDefaultFetchUrl

            +
            public void shouldConstructTheCorrectDefaultFetchUrl()
            +
          • +
          + + + +
            +
          • +

            shouldConstructTheCorrectUrlWithExtraParam

            +
            public void shouldConstructTheCorrectUrlWithExtraParam()
            +
          • +
          +
        • +
        +
      • +
      +
      +
      + + + + + + + diff --git a/src/main/resources/doc/com/rallydev/rest/request/class-use/CollectionUpdateRequest.html b/src/main/resources/doc/com/rallydev/rest/request/class-use/CollectionUpdateRequest.html new file mode 100644 index 0000000..8a83788 --- /dev/null +++ b/src/main/resources/doc/com/rallydev/rest/request/class-use/CollectionUpdateRequest.html @@ -0,0 +1,159 @@ + + + + + +Uses of Class com.rallydev.rest.request.CollectionUpdateRequest (Rally Rest API for Java 2.2) + + + + + + + + + + +
      +

      Uses of Class
      com.rallydev.rest.request.CollectionUpdateRequest

      +
      +
      + +
      + + + + + + diff --git a/src/main/resources/doc/com/rallydev/rest/request/class-use/CollectionUpdateRequestTest.html b/src/main/resources/doc/com/rallydev/rest/request/class-use/CollectionUpdateRequestTest.html new file mode 100644 index 0000000..88c7a95 --- /dev/null +++ b/src/main/resources/doc/com/rallydev/rest/request/class-use/CollectionUpdateRequestTest.html @@ -0,0 +1,115 @@ + + + + + +Uses of Class com.rallydev.rest.request.CollectionUpdateRequestTest (Rally Rest API for Java 2.2) + + + + + + + + + + +
      +

      Uses of Class
      com.rallydev.rest.request.CollectionUpdateRequestTest

      +
      +
      No usage of com.rallydev.rest.request.CollectionUpdateRequestTest
      + + + + + + diff --git a/src/main/resources/doc/com/rallydev/rest/request/class-use/CreateRequest.html b/src/main/resources/doc/com/rallydev/rest/request/class-use/CreateRequest.html index 108ce27..3344800 100644 --- a/src/main/resources/doc/com/rallydev/rest/request/class-use/CreateRequest.html +++ b/src/main/resources/doc/com/rallydev/rest/request/class-use/CreateRequest.html @@ -2,15 +2,15 @@ - -Uses of Class com.rallydev.rest.request.CreateRequest (Rally Rest API for Java 2.0) - + +Uses of Class com.rallydev.rest.request.CreateRequest (Rally Rest API for Java 2.2) + diff --git a/src/main/resources/doc/com/rallydev/rest/request/class-use/CreateRequestTest.html b/src/main/resources/doc/com/rallydev/rest/request/class-use/CreateRequestTest.html new file mode 100644 index 0000000..73adbf2 --- /dev/null +++ b/src/main/resources/doc/com/rallydev/rest/request/class-use/CreateRequestTest.html @@ -0,0 +1,115 @@ + + + + + +Uses of Class com.rallydev.rest.request.CreateRequestTest (Rally Rest API for Java 2.2) + + + + + + + + + + +
      +

      Uses of Class
      com.rallydev.rest.request.CreateRequestTest

      +
      +
      No usage of com.rallydev.rest.request.CreateRequestTest
      + + + + + + diff --git a/src/main/resources/doc/com/rallydev/rest/request/class-use/DeleteRequest.html b/src/main/resources/doc/com/rallydev/rest/request/class-use/DeleteRequest.html index 782db6f..77bd178 100644 --- a/src/main/resources/doc/com/rallydev/rest/request/class-use/DeleteRequest.html +++ b/src/main/resources/doc/com/rallydev/rest/request/class-use/DeleteRequest.html @@ -2,15 +2,15 @@ - -Uses of Class com.rallydev.rest.request.DeleteRequest (Rally Rest API for Java 2.0) - + +Uses of Class com.rallydev.rest.request.DeleteRequest (Rally Rest API for Java 2.2) + diff --git a/src/main/resources/doc/com/rallydev/rest/request/class-use/DeleteRequestTest.html b/src/main/resources/doc/com/rallydev/rest/request/class-use/DeleteRequestTest.html new file mode 100644 index 0000000..7b46d2b --- /dev/null +++ b/src/main/resources/doc/com/rallydev/rest/request/class-use/DeleteRequestTest.html @@ -0,0 +1,115 @@ + + + + + +Uses of Class com.rallydev.rest.request.DeleteRequestTest (Rally Rest API for Java 2.2) + + + + + + + + + + +
      +

      Uses of Class
      com.rallydev.rest.request.DeleteRequestTest

      +
      +
      No usage of com.rallydev.rest.request.DeleteRequestTest
      + + + + + + diff --git a/src/main/resources/doc/com/rallydev/rest/request/class-use/GetRequest.html b/src/main/resources/doc/com/rallydev/rest/request/class-use/GetRequest.html index 7c82c17..6995415 100644 --- a/src/main/resources/doc/com/rallydev/rest/request/class-use/GetRequest.html +++ b/src/main/resources/doc/com/rallydev/rest/request/class-use/GetRequest.html @@ -2,15 +2,15 @@ - -Uses of Class com.rallydev.rest.request.GetRequest (Rally Rest API for Java 2.0) - + +Uses of Class com.rallydev.rest.request.GetRequest (Rally Rest API for Java 2.2) + diff --git a/src/main/resources/doc/com/rallydev/rest/request/class-use/GetRequestTest.html b/src/main/resources/doc/com/rallydev/rest/request/class-use/GetRequestTest.html new file mode 100644 index 0000000..de16a8e --- /dev/null +++ b/src/main/resources/doc/com/rallydev/rest/request/class-use/GetRequestTest.html @@ -0,0 +1,115 @@ + + + + + +Uses of Class com.rallydev.rest.request.GetRequestTest (Rally Rest API for Java 2.2) + + + + + + + + + + +
      +

      Uses of Class
      com.rallydev.rest.request.GetRequestTest

      +
      +
      No usage of com.rallydev.rest.request.GetRequestTest
      + + + + + + diff --git a/src/main/resources/doc/com/rallydev/rest/request/class-use/QueryRequest.html b/src/main/resources/doc/com/rallydev/rest/request/class-use/QueryRequest.html index 550cb87..0b8b28c 100644 --- a/src/main/resources/doc/com/rallydev/rest/request/class-use/QueryRequest.html +++ b/src/main/resources/doc/com/rallydev/rest/request/class-use/QueryRequest.html @@ -2,15 +2,15 @@ - -Uses of Class com.rallydev.rest.request.QueryRequest (Rally Rest API for Java 2.0) - + +Uses of Class com.rallydev.rest.request.QueryRequest (Rally Rest API for Java 2.2) + diff --git a/src/main/resources/doc/com/rallydev/rest/request/class-use/QueryRequestTest.html b/src/main/resources/doc/com/rallydev/rest/request/class-use/QueryRequestTest.html new file mode 100644 index 0000000..042b2a5 --- /dev/null +++ b/src/main/resources/doc/com/rallydev/rest/request/class-use/QueryRequestTest.html @@ -0,0 +1,115 @@ + + + + + +Uses of Class com.rallydev.rest.request.QueryRequestTest (Rally Rest API for Java 2.2) + + + + + + + + + + +
      +

      Uses of Class
      com.rallydev.rest.request.QueryRequestTest

      +
      +
      No usage of com.rallydev.rest.request.QueryRequestTest
      + + + + + + diff --git a/src/main/resources/doc/com/rallydev/rest/request/class-use/Request.html b/src/main/resources/doc/com/rallydev/rest/request/class-use/Request.html index 3ce354c..15da546 100644 --- a/src/main/resources/doc/com/rallydev/rest/request/class-use/Request.html +++ b/src/main/resources/doc/com/rallydev/rest/request/class-use/Request.html @@ -2,15 +2,15 @@ - -Uses of Class com.rallydev.rest.request.Request (Rally Rest API for Java 2.0) - + +Uses of Class com.rallydev.rest.request.Request (Rally Rest API for Java 2.2) + @@ -99,29 +99,35 @@

      Uses of class  +CollectionUpdateRequest +
      Represents a WSAPI request to update a collection.
      + + + +class  CreateRequest
      Represents a WSAPI request to create an object.
      - + class  DeleteRequest
      Represents a WSAPI request to delete an object.
      - + class  GetRequest
      Represents a WSAPI request to retrieve a specific object.
      - + class  QueryRequest
      Represents a WSAPI request to retrieve all objects matching specified criteria.
      - + class  UpdateRequest
      Represents a WSAPI request to update an object.
      diff --git a/src/main/resources/doc/com/rallydev/rest/request/class-use/RequestTest.html b/src/main/resources/doc/com/rallydev/rest/request/class-use/RequestTest.html new file mode 100644 index 0000000..a15c491 --- /dev/null +++ b/src/main/resources/doc/com/rallydev/rest/request/class-use/RequestTest.html @@ -0,0 +1,115 @@ + + + + + +Uses of Class com.rallydev.rest.request.RequestTest (Rally Rest API for Java 2.2) + + + + + + + + + + +
      +

      Uses of Class
      com.rallydev.rest.request.RequestTest

      +
      +
      No usage of com.rallydev.rest.request.RequestTest
      + + + + + + diff --git a/src/main/resources/doc/com/rallydev/rest/request/class-use/UpdateRequest.html b/src/main/resources/doc/com/rallydev/rest/request/class-use/UpdateRequest.html index d6b4897..34c4fae 100644 --- a/src/main/resources/doc/com/rallydev/rest/request/class-use/UpdateRequest.html +++ b/src/main/resources/doc/com/rallydev/rest/request/class-use/UpdateRequest.html @@ -2,15 +2,15 @@ - -Uses of Class com.rallydev.rest.request.UpdateRequest (Rally Rest API for Java 2.0) - + +Uses of Class com.rallydev.rest.request.UpdateRequest (Rally Rest API for Java 2.2) + diff --git a/src/main/resources/doc/com/rallydev/rest/request/class-use/UpdateRequestTest.html b/src/main/resources/doc/com/rallydev/rest/request/class-use/UpdateRequestTest.html new file mode 100644 index 0000000..6098124 --- /dev/null +++ b/src/main/resources/doc/com/rallydev/rest/request/class-use/UpdateRequestTest.html @@ -0,0 +1,115 @@ + + + + + +Uses of Class com.rallydev.rest.request.UpdateRequestTest (Rally Rest API for Java 2.2) + + + + + + + + + + +
      +

      Uses of Class
      com.rallydev.rest.request.UpdateRequestTest

      +
      +
      No usage of com.rallydev.rest.request.UpdateRequestTest
      + + + + + + diff --git a/src/main/resources/doc/com/rallydev/rest/request/package-frame.html b/src/main/resources/doc/com/rallydev/rest/request/package-frame.html index 8900f0e..777b7a3 100644 --- a/src/main/resources/doc/com/rallydev/rest/request/package-frame.html +++ b/src/main/resources/doc/com/rallydev/rest/request/package-frame.html @@ -2,9 +2,9 @@ - -com.rallydev.rest.request (Rally Rest API for Java 2.0) - + +com.rallydev.rest.request (Rally Rest API for Java 2.2) + @@ -12,6 +12,7 @@

      Classes

        +
      • CollectionUpdateRequest
      • CreateRequest
      • DeleteRequest
      • GetRequest
      • diff --git a/src/main/resources/doc/com/rallydev/rest/request/package-summary.html b/src/main/resources/doc/com/rallydev/rest/request/package-summary.html index 6ed0dbc..13d0548 100644 --- a/src/main/resources/doc/com/rallydev/rest/request/package-summary.html +++ b/src/main/resources/doc/com/rallydev/rest/request/package-summary.html @@ -2,15 +2,15 @@ - -com.rallydev.rest.request (Rally Rest API for Java 2.0) - + +com.rallydev.rest.request (Rally Rest API for Java 2.2) + @@ -36,7 +36,7 @@