Permalink
Browse files

Merge pull request #611 from gcheng/dev

Dev
  • Loading branch information...
2 parents 6f0f8bd + 5c2a242 commit 0c279ea7417a10b4137d41a8ea5f673a9fa9e3e0 Albert Cheng committed Jan 11, 2013
Showing with 10 additions and 140 deletions.
  1. +0 −14 microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/media/models/AccessPolicy.java
  2. +0 −14 microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/media/models/Asset.java
  3. +0 −14 microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/media/models/ContentKey.java
  4. +0 −13 microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/media/models/Job.java
  5. +0 −14 microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/media/models/Locator.java
  6. +0 −14 ...soft-azure-api/src/main/java/com/microsoft/windowsazure/services/media/models/MediaProcessor.java
  7. +0 −14 microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/media/models/Task.java
  8. +4 −9 microsoft-azure-api/src/test/java/com/microsoft/windowsazure/services/media/TaskIntegrationTest.java
  9. +1 −3 ...re-api/src/test/java/com/microsoft/windowsazure/services/media/models/AccessPolicyEntityTest.java
  10. +1 −1 ...oft-azure-api/src/test/java/com/microsoft/windowsazure/services/media/models/AssetEntityTest.java
  11. +1 −7 ...zure-api/src/test/java/com/microsoft/windowsazure/services/media/models/ContentKeyEntityTest.java
  12. +1 −7 ...osoft-azure-api/src/test/java/com/microsoft/windowsazure/services/media/models/JobEntityTest.java
  13. +1 −7 ...t-azure-api/src/test/java/com/microsoft/windowsazure/services/media/models/LocatorEntityTest.java
  14. +1 −9 ...-api/src/test/java/com/microsoft/windowsazure/services/media/models/MediaProcessorEntityTest.java
@@ -17,8 +17,6 @@
import java.util.EnumSet;
-import javax.ws.rs.core.MultivaluedMap;
-
import com.microsoft.windowsazure.services.media.entityoperations.DefaultDeleteOperation;
import com.microsoft.windowsazure.services.media.entityoperations.DefaultGetOperation;
import com.microsoft.windowsazure.services.media.entityoperations.DefaultListOperation;
@@ -112,18 +110,6 @@ public Object getRequestContents() {
}
/**
- * Create an operation that will retrieve all access policies that match the given query parameters
- *
- * @param queryParameters
- * query parameters to add to the request
- * @return the operation
- */
- public static DefaultListOperation<AccessPolicyInfo> list(MultivaluedMap<String, String> queryParameters) {
- return new DefaultListOperation<AccessPolicyInfo>(ENTITY_SET, new GenericType<ListResult<AccessPolicyInfo>>() {
- }, queryParameters);
- }
-
- /**
* Create an operation to delete the given access policy
*
* @param accessPolicyId
@@ -20,8 +20,6 @@
import java.net.URLEncoder;
import java.security.InvalidParameterException;
-import javax.ws.rs.core.MultivaluedMap;
-
import com.microsoft.windowsazure.services.media.entityoperations.DefaultDeleteOperation;
import com.microsoft.windowsazure.services.media.entityoperations.DefaultGetOperation;
import com.microsoft.windowsazure.services.media.entityoperations.DefaultListOperation;
@@ -186,18 +184,6 @@ public Creator setState(AssetState state) {
}
/**
- * Create an operation that will list all the assets which match the given query parameters.
- *
- * @param queryParameters
- * query parameters to pass to the server.
- * @return the list operation.
- */
- public static DefaultListOperation<AssetInfo> list(MultivaluedMap<String, String> queryParameters) {
- return new DefaultListOperation<AssetInfo>(ENTITY_SET, new GenericType<ListResult<AssetInfo>>() {
- }, queryParameters);
- }
-
- /**
* Create an operation that will list all the assets at the given link.
*
* @param link
@@ -15,8 +15,6 @@
package com.microsoft.windowsazure.services.media.models;
-import javax.ws.rs.core.MultivaluedMap;
-
import com.microsoft.windowsazure.services.media.entityoperations.DefaultDeleteOperation;
import com.microsoft.windowsazure.services.media.entityoperations.DefaultGetOperation;
import com.microsoft.windowsazure.services.media.entityoperations.DefaultListOperation;
@@ -193,18 +191,6 @@ public Creator setProtectionKeyType(ProtectionKeyType protectionKeyType) {
}
/**
- * Create an operation that will retrieve all access policies that match the given query parameters.
- *
- * @param queryParameters
- * query parameters to add to the request
- * @return the operation
- */
- public static DefaultListOperation<ContentKeyInfo> list(MultivaluedMap<String, String> queryParameters) {
- return new DefaultListOperation<ContentKeyInfo>(ENTITY_SET, new GenericType<ListResult<ContentKeyInfo>>() {
- }, queryParameters);
- }
-
- /**
* Create an operation that will list all the content keys at the given link.
*
* @param link
@@ -23,7 +23,6 @@
import javax.mail.MessagingException;
import javax.mail.internet.MimeMultipart;
import javax.ws.rs.core.MediaType;
-import javax.ws.rs.core.MultivaluedMap;
import javax.xml.bind.JAXBException;
import javax.xml.parsers.ParserConfigurationException;
@@ -400,18 +399,6 @@ public JobInfo getJobInfo() {
}
/**
- * Create an operation that will list all the jobs which match the given query parameters.
- *
- * @param queryParameters
- * query parameters to pass to the server.
- * @return the list operation.
- */
- public static DefaultListOperation<JobInfo> list(MultivaluedMap<String, String> queryParameters) {
- return new DefaultListOperation<JobInfo>(ENTITY_SET, new GenericType<ListResult<JobInfo>>() {
- }, queryParameters);
- }
-
- /**
* Create an operation to delete the given job.
*
* @param jobId
@@ -16,8 +16,6 @@
import java.util.Date;
-import javax.ws.rs.core.MultivaluedMap;
-
import com.microsoft.windowsazure.services.media.entityoperations.DefaultDeleteOperation;
import com.microsoft.windowsazure.services.media.entityoperations.DefaultGetOperation;
import com.microsoft.windowsazure.services.media.entityoperations.DefaultListOperation;
@@ -200,18 +198,6 @@ public Creator setContentAccessComponent(String contentAccessComponent) {
}
/**
- * Create an operation to list all locators matching the given query parameters.
- *
- * @param queryParameters
- * query parameters to send with the request
- * @return the list operation
- */
- public static DefaultListOperation<LocatorInfo> list(MultivaluedMap<String, String> queryParameters) {
- return new DefaultListOperation<LocatorInfo>(ENTITY_SET, new GenericType<ListResult<LocatorInfo>>() {
- }, queryParameters);
- }
-
- /**
* Create an operation that will list all the locators at the given link.
*
* @param link
@@ -15,8 +15,6 @@
package com.microsoft.windowsazure.services.media.models;
-import javax.ws.rs.core.MultivaluedMap;
-
import com.microsoft.windowsazure.services.media.entityoperations.DefaultListOperation;
import com.sun.jersey.api.client.GenericType;
@@ -42,16 +40,4 @@ private MediaProcessor() {
});
}
- /**
- * Create an operation to list all media processors that satisfy the given query parameters
- *
- * @param queryParameters
- * query parameters to pass with the request
- * @return the list operation
- */
- public static DefaultListOperation<MediaProcessorInfo> list(MultivaluedMap<String, String> queryParameters) {
- return new DefaultListOperation<MediaProcessorInfo>(ENTITY_SET,
- new GenericType<ListResult<MediaProcessorInfo>>() {
- }, queryParameters);
- }
}
@@ -15,8 +15,6 @@
package com.microsoft.windowsazure.services.media.models;
-import javax.ws.rs.core.MultivaluedMap;
-
import com.microsoft.windowsazure.services.media.entityoperations.DefaultListOperation;
import com.microsoft.windowsazure.services.media.entityoperations.EntityBatchOperation;
import com.microsoft.windowsazure.services.media.implementation.content.TaskType;
@@ -62,18 +60,6 @@ public static CreateBatchOperation create(String mediaProcessorId, String taskBo
}
/**
- * Create an operation that will list all the tasks which match the given query parameters.
- *
- * @param queryParameters
- * query parameters to pass to the server.
- * @return the list operation.
- */
- public static DefaultListOperation<TaskInfo> list(MultivaluedMap<String, String> queryParameters) {
- return new DefaultListOperation<TaskInfo>(ENTITY_SET, new GenericType<ListResult<TaskInfo>>() {
- }, queryParameters);
- }
-
- /**
* Create an operation that will list the tasks pointed to by the given link.
*
* @param link
@@ -23,8 +23,6 @@
import java.util.List;
import java.util.UUID;
-import javax.ws.rs.core.MultivaluedMap;
-
import org.junit.Before;
import org.junit.BeforeClass;
import org.junit.Test;
@@ -43,7 +41,6 @@
import com.microsoft.windowsazure.services.media.models.TaskOption;
import com.microsoft.windowsazure.services.media.models.TaskState;
import com.sun.jersey.core.util.Base64;
-import com.sun.jersey.core.util.MultivaluedMapImpl;
public class TaskIntegrationTest extends IntegrationTestBase {
private static AssetInfo assetInfo;
@@ -153,12 +150,10 @@ public void canListTasksWithOptions() throws ServiceException {
service.create(jobCreator);
// Act
- MultivaluedMap<String, String> queryParameters = new MultivaluedMapImpl();
- queryParameters.add("$filter", "startswith(Name, '" + baseName + "') eq true");
- ListResult<TaskInfo> listTaskResult1 = service.list(Task.list(queryParameters));
-
- queryParameters.add("$top", "2");
- ListResult<TaskInfo> listTaskResult2 = service.list(Task.list(queryParameters));
+ ListResult<TaskInfo> listTaskResult1 = service.list(Task.list().set("$filter",
+ "startswith(Name, '" + baseName + "') eq true"));
+ ListResult<TaskInfo> listTaskResult2 = service.list(Task.list()
+ .set("$filter", "startswith(Name, '" + baseName + "') eq true").setTop(2));
// Assert
assertEquals("listTaskResult1.size", 4, listTaskResult1.size());
@@ -75,10 +75,8 @@ public void listReturnsExpectedUri() throws Exception {
@Test
public void listWithQueryParametersReturnsThem() throws Exception {
MultivaluedMap<String, String> queryParams = new MultivaluedMapImpl();
- queryParams.add("$top", "10");
- queryParams.add("$skip", "2");
- EntityListOperation<AccessPolicyInfo> lister = AccessPolicy.list(queryParams);
+ EntityListOperation<AccessPolicyInfo> lister = AccessPolicy.list().setTop(10).setSkip(2);
assertEquals("10", lister.getQueryParameters().getFirst("$top"));
assertEquals("2", lister.getQueryParameters().getFirst("$skip"));
@@ -103,7 +103,7 @@ public void assetListCanTakeQueryParameters() {
queryParams.add("$top", "10");
queryParams.add("$skip", "2");
- EntityListOperation<AssetInfo> lister = Asset.list(queryParams);
+ EntityListOperation<AssetInfo> lister = Asset.list().setTop(10).setSkip(2);
assertEquals("10", lister.getQueryParameters().getFirst("$top"));
assertEquals("2", lister.getQueryParameters().getFirst("$skip"));
@@ -19,15 +19,12 @@
import java.net.URLEncoder;
-import javax.ws.rs.core.MultivaluedMap;
-
import org.junit.Test;
import com.microsoft.windowsazure.services.media.entityoperations.EntityCreateOperation;
import com.microsoft.windowsazure.services.media.entityoperations.EntityDeleteOperation;
import com.microsoft.windowsazure.services.media.entityoperations.EntityListOperation;
import com.microsoft.windowsazure.services.media.implementation.content.ContentKeyRestType;
-import com.sun.jersey.core.util.MultivaluedMapImpl;
/**
* Tests for the ContentKey entity
@@ -84,11 +81,8 @@ public void listContentKeyReturnsExpectedUri() {
@Test
public void listContentKeyCanTakeQueryParameters() {
- MultivaluedMap<String, String> queryParams = new MultivaluedMapImpl();
- queryParams.add("$top", "10");
- queryParams.add("$skip", "2");
- EntityListOperation<ContentKeyInfo> lister = ContentKey.list(queryParams);
+ EntityListOperation<ContentKeyInfo> lister = ContentKey.list().setTop(10).setSkip(2);
assertEquals("10", lister.getQueryParameters().getFirst("$top"));
assertEquals("2", lister.getQueryParameters().getFirst("$skip"));
@@ -20,14 +20,12 @@
import java.net.URI;
import javax.mail.internet.MimeMultipart;
-import javax.ws.rs.core.MultivaluedMap;
import org.junit.Test;
import com.microsoft.windowsazure.services.core.ServiceException;
import com.microsoft.windowsazure.services.media.entityoperations.EntityListOperation;
import com.microsoft.windowsazure.services.media.entityoperations.EntityProxyData;
-import com.sun.jersey.core.util.MultivaluedMapImpl;
/**
* Tests for the methods and factories of the Job entity.
@@ -65,11 +63,7 @@ public void JobListReturnsExpectedUri() {
@Test
public void JobListCanTakeQueryParameters() {
- MultivaluedMap<String, String> queryParams = new MultivaluedMapImpl();
- queryParams.add("$top", "10");
- queryParams.add("$skip", "2");
-
- EntityListOperation<JobInfo> lister = Job.list(queryParams);
+ EntityListOperation<JobInfo> lister = Job.list().setTop(10).setSkip(2);
assertEquals("10", lister.getQueryParameters().getFirst("$top"));
assertEquals("2", lister.getQueryParameters().getFirst("$skip"));
@@ -20,16 +20,13 @@
import java.net.URLEncoder;
import java.util.Date;
-import javax.ws.rs.core.MultivaluedMap;
-
import org.junit.Test;
import com.microsoft.windowsazure.services.media.entityoperations.EntityCreateOperation;
import com.microsoft.windowsazure.services.media.entityoperations.EntityDeleteOperation;
import com.microsoft.windowsazure.services.media.entityoperations.EntityListOperation;
import com.microsoft.windowsazure.services.media.entityoperations.EntityUpdateOperation;
import com.microsoft.windowsazure.services.media.implementation.content.LocatorRestType;
-import com.sun.jersey.core.util.MultivaluedMapImpl;
/**
* Tests for the Locator entity
@@ -139,11 +136,8 @@ public void listLocatorReturnsExpectedUri() {
@Test
public void listLocatorCanTakeQueryParameters() {
- MultivaluedMap<String, String> queryParams = new MultivaluedMapImpl();
- queryParams.add("$top", "10");
- queryParams.add("$skip", "2");
- EntityListOperation<LocatorInfo> lister = Locator.list(queryParams);
+ EntityListOperation<LocatorInfo> lister = Locator.list().setTop(10).setSkip(2);
assertEquals("10", lister.getQueryParameters().getFirst("$top"));
assertEquals("2", lister.getQueryParameters().getFirst("$skip"));
@@ -17,14 +17,9 @@
import static org.junit.Assert.*;
-import javax.ws.rs.core.MultivaluedMap;
-
import org.junit.Test;
import com.microsoft.windowsazure.services.media.entityoperations.EntityListOperation;
-import com.microsoft.windowsazure.services.media.models.MediaProcessor;
-import com.microsoft.windowsazure.services.media.models.MediaProcessorInfo;
-import com.sun.jersey.core.util.MultivaluedMapImpl;
/**
* Tests for the MediaProcessor entity
@@ -39,11 +34,8 @@ public void listMediaProcessorsReturnsExpectedUri() {
@Test
public void listMediaProcessorsCanTakeQueryParmeters() {
- MultivaluedMap<String, String> queryParams = new MultivaluedMapImpl();
- queryParams.add("$top", "10");
- queryParams.add("$skip", "2");
- EntityListOperation<MediaProcessorInfo> lister = MediaProcessor.list(queryParams);
+ EntityListOperation<MediaProcessorInfo> lister = MediaProcessor.list().setTop(10).setSkip(2);
assertEquals("10", lister.getQueryParameters().getFirst("$top"));
assertEquals("2", lister.getQueryParameters().getFirst("$skip"));

0 comments on commit 0c279ea

Please sign in to comment.