Permalink
Browse files

Merge pull request #571 from gcheng/dev

Dev
  • Loading branch information...
Albert Cheng
Albert Cheng committed Dec 20, 2012
2 parents 9a0115a + a882a64 commit 2fe936098e70ac0a97e0a9c9cd0bab571d93d972
@@ -35,8 +35,6 @@
/**
* Creates a block blob from a content stream.
*
- * @param container
- * A {@link String} containing the name of the container to create the blob in.
* @param blob
* A {@link String} containing the name of the blob to create. A blob name can contain any combination of
* characters, but reserved URL characters must be properly escaped. A blob name must be at least one
@@ -94,159 +94,179 @@ public String getId() {
return id;
}
- public void setId(String id) {
+ public TaskType setId(String id) {
this.id = id;
+ return this;
}
public String getConfiguration() {
return configuration;
}
- public void setConfiguration(String configuration) {
+ public TaskType setConfiguration(String configuration) {
this.configuration = configuration;
+ return this;
}
public Date getEndTime() {
return endTime;
}
- public void setEndTime(Date endTime) {
+ public TaskType setEndTime(Date endTime) {
this.endTime = endTime;
+ return this;
}
public List<ErrorDetailType> getErrorDetails() {
return errorDetails;
}
- public void setErrorDetails(List<ErrorDetailType> errorDetails) {
+ public TaskType setErrorDetails(List<ErrorDetailType> errorDetails) {
this.errorDetails = errorDetails;
+ return this;
}
public String getMediaProcessorId() {
return mediaProcessorId;
}
- public void setMediaProcessorId(String mediaProcessorId) {
+ public TaskType setMediaProcessorId(String mediaProcessorId) {
this.mediaProcessorId = mediaProcessorId;
+ return this;
}
public String getName() {
return name;
}
- public void setName(String name) {
+ public TaskType setName(String name) {
this.name = name;
+ return this;
}
public String getPerfMessage() {
return perfMessage;
}
- public void setPerfMessage(String perfMessage) {
+ public TaskType setPerfMessage(String perfMessage) {
this.perfMessage = perfMessage;
+ return this;
}
public Integer getPriority() {
return priority;
}
- public void setPriority(Integer priority) {
+ public TaskType setPriority(Integer priority) {
this.priority = priority;
+ return this;
}
public Double getProgress() {
return progress;
}
- public void setProgress(Double progress) {
+ public TaskType setProgress(Double progress) {
this.progress = progress;
+ return this;
}
public Double getRunningDuration() {
return runningDuration;
}
- public void setRunningDuration(Double runningDuration) {
+ public TaskType setRunningDuration(Double runningDuration) {
this.runningDuration = runningDuration;
+ return this;
}
public Date getStartTime() {
return startTime;
}
- public void setStartTime(Date startTime) {
+ public TaskType setStartTime(Date startTime) {
this.startTime = startTime;
+ return this;
}
public Integer getState() {
return state;
}
- public void setState(Integer state) {
+ public TaskType setState(Integer state) {
this.state = state;
+ return this;
}
public String getTaskBody() {
return taskBody;
}
- public void setTaskBody(String taskBody) {
+ public TaskType setTaskBody(String taskBody) {
this.taskBody = taskBody;
+ return this;
}
public Integer getOptions() {
return options;
}
- public void setOptions(Integer options) {
+ public TaskType setOptions(Integer options) {
this.options = options;
+ return this;
}
public String getEncryptionKeyId() {
return encryptionKeyId;
}
- public void setEncryptionKeyId(String encryptionKeyId) {
+ public TaskType setEncryptionKeyId(String encryptionKeyId) {
this.encryptionKeyId = encryptionKeyId;
+ return this;
}
public String getEncryptionScheme() {
return encryptionScheme;
}
- public void setEncryptionScheme(String encryptionScheme) {
+ public TaskType setEncryptionScheme(String encryptionScheme) {
this.encryptionScheme = encryptionScheme;
+ return this;
}
public String getEncryptionVersion() {
return encryptionVersion;
}
- public void setEncryptionVersion(String encryptionVersion) {
+ public TaskType setEncryptionVersion(String encryptionVersion) {
this.encryptionVersion = encryptionVersion;
+ return this;
}
public String getInitializationVector() {
return initializationVector;
}
- public void setInitializationVector(String initializationVector) {
+ public TaskType setInitializationVector(String initializationVector) {
this.initializationVector = initializationVector;
+ return this;
}
public List<String> getOutputMediaAssets() {
return outputMediaAssets;
}
- public void setOutputMediaAssets(List<String> outputMediaAssets) {
+ public TaskType setOutputMediaAssets(List<String> outputMediaAssets) {
this.outputMediaAssets = outputMediaAssets;
+ return this;
}
public List<String> getInputMediaAssets() {
return inputMediaAssets;
}
- public void setInputMediaAssets(List<String> inputMediaAssets) {
+ public TaskType setInputMediaAssets(List<String> inputMediaAssets) {
this.inputMediaAssets = inputMediaAssets;
+ return this;
}
}
@@ -25,6 +25,7 @@
* Supplies the current proxy information to the action.
*
* @param proxyData
+ * @return
*/
void setProxyData(EntityProxyData proxyData);
@@ -143,8 +143,6 @@ private void buildMimeMultipart(URI serviceUri) {
/**
* Instantiates a new creator.
*
- * @param serviceUri
- * the service uri
*/
public Creator() {
super(ENTITY_SET, JobInfo.class);
@@ -0,0 +1,89 @@
+/**
+ * Copyright 2012 Microsoft Corporation
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.microsoft.windowsazure.services.media.models;
+
+import static org.junit.Assert.*;
+
+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.implementation.entities.EntityListOperation;
+import com.microsoft.windowsazure.services.media.implementation.entities.EntityProxyData;
+import com.sun.jersey.core.util.MultivaluedMapImpl;
+
+/**
+ * Tests for the methods and factories of the Job entity.
+ */
+public class JobEntityTest {
+
+ private EntityProxyData createProxyData() {
+ return new EntityProxyData() {
+ @Override
+ public URI getServiceUri() {
+ return URI.create("http://contoso.com");
+ }
+ };
+ }
+
+ public JobEntityTest() throws Exception {
+ }
+
+ @Test
+ public void JobCreateReturnsDefaultCreatePayload() throws ServiceException {
+ Job.Creator jobCreator = Job.create();
+ jobCreator.setProxyData(createProxyData());
+ MimeMultipart payload = (MimeMultipart) jobCreator.getRequestContents();
+ assertNotNull(payload);
+ }
+
+ @Test
+ public void JobListReturnsExpectedUri() {
+ EntityListOperation<JobInfo> lister = Job.list();
+
+ assertEquals("Jobs", lister.getUri());
+ assertNotNull(lister.getQueryParameters());
+ assertEquals(0, lister.getQueryParameters().size());
+ }
+
+ @Test
+ public void JobListCanTakeQueryParameters() {
+ MultivaluedMap<String, String> queryParams = new MultivaluedMapImpl();
+ queryParams.add("$top", "10");
+ queryParams.add("$skip", "2");
+
+ EntityListOperation<JobInfo> lister = Job.list(queryParams);
+
+ assertEquals("10", lister.getQueryParameters().getFirst("$top"));
+ assertEquals("2", lister.getQueryParameters().getFirst("$skip"));
+ assertEquals(2, lister.getQueryParameters().size());
+ }
+
+ @Test
+ public void JobListCanTakeQueryParametersChained() {
+ EntityListOperation<JobInfo> lister = Job.list().setTop(10).setSkip(2).set("filter", "something");
+
+ assertEquals("10", lister.getQueryParameters().getFirst("$top"));
+ assertEquals("2", lister.getQueryParameters().getFirst("$skip"));
+ assertEquals("something", lister.getQueryParameters().getFirst("filter"));
+ assertEquals(3, lister.getQueryParameters().size());
+ }
+
+}
Oops, something went wrong.

0 comments on commit 2fe9360

Please sign in to comment.