Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Merge pull request #554 from gcheng/dev

Dev
  • Loading branch information...
commit dfba5097c6f3f0f1e587bee5766183bfb81ec752 2 parents 3da3751 + b8dec02
Albert Cheng authored
View
118 microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/media/models/Task.java
@@ -44,10 +44,16 @@ private Task() {
/**
* Creates the.
*
+ * @param mediaProcessorId
+ * the media processor id
+ * @param taskBody
+ * the task body
+ * @param options
+ * the options
* @return the creates the batch operation
*/
- public static CreateBatchOperation create() {
- return new CreateBatchOperation();
+ public static CreateBatchOperation create(String mediaProcessorId, String taskBody) {
+ return new CreateBatchOperation(mediaProcessorId, taskBody);
}
/**
@@ -82,32 +88,44 @@ public static CreateBatchOperation create() {
/**
* Instantiates a new creates the batch operation.
+ *
+ * @param mediaProcessorId
+ * the media processor id
+ * @param taskBody
+ * the task body
+ * @param options
+ * the options
*/
- public CreateBatchOperation() {
+ public CreateBatchOperation(String mediaProcessorId, String taskBody) {
this.verb = "POST";
taskType = new TaskType();
addContentObject(taskType);
+ this.taskType.setMediaProcessorId(mediaProcessorId);
+ this.taskType.setTaskBody(taskBody);
}
/**
- * Sets the configuration.
+ * Sets the options.
*
- * @param configuration
- * the configuration
+ * @param options
+ * the options
* @return the creates the batch operation
*/
- public CreateBatchOperation setConfiguration(String configuration) {
- this.taskType.setConfiguration(configuration);
+ public CreateBatchOperation setOptions(int options) {
+ this.taskType.setOptions(options);
return this;
}
/**
- * Gets the configuration.
+ * Sets the configuration.
*
- * @return the configuration
+ * @param configuration
+ * the configuration
+ * @return the creates the batch operation
*/
- public String getConfiguration() {
- return this.taskType.getConfiguration();
+ public CreateBatchOperation setConfiguration(String configuration) {
+ this.taskType.setConfiguration(configuration);
+ return this;
}
/**
@@ -123,15 +141,6 @@ public CreateBatchOperation setName(String name) {
}
/**
- * Gets the name.
- *
- * @return the name
- */
- public String getName() {
- return this.taskType.getName();
- }
-
- /**
* Sets the task body.
*
* @param taskBody
@@ -144,35 +153,76 @@ public CreateBatchOperation setTaskBody(String taskBody) {
}
/**
- * Gets the task body.
+ * Sets the media processor id.
+ *
+ * @param mediaProcessorId
+ * the media processor id
+ * @return the creates the batch operation
+ */
+ public CreateBatchOperation setMediaProcessorId(String mediaProcessorId) {
+ this.taskType.setMediaProcessorId(mediaProcessorId);
+ return this;
+ }
+
+ /**
+ * Sets the priority.
*
- * @return the task body
+ * @param priority
+ * the priority
+ * @return the creates the batch operation
*/
- public String getTaskBody() {
- return this.taskType.getTaskBody();
+ public CreateBatchOperation setPriority(int priority) {
+ this.taskType.setPriority(priority);
+ return this;
}
/**
- * Gets the media processor id.
+ * Sets the encryption key id.
*
- * @return the media processor id
+ * @param encryptionKeyId
+ * the encryption key id
+ * @return the creates the batch operation
*/
- public String getMediaProcessorId() {
- return this.taskType.getMediaProcessorId();
+ public CreateBatchOperation setEncryptionKeyId(String encryptionKeyId) {
+ this.taskType.setEncryptionKeyId(encryptionKeyId);
+ return this;
}
/**
- * Sets the media processor id.
+ * Sets the encryption scheme.
*
- * @param mediaProcessorId
- * the media processor id
+ * @param encryptionScheme
+ * the encryption scheme
* @return the creates the batch operation
*/
- public CreateBatchOperation setMediaProcessorId(String mediaProcessorId) {
- this.taskType.setMediaProcessorId(mediaProcessorId);
+ public CreateBatchOperation setEncryptionScheme(String encryptionScheme) {
+ this.taskType.setEncryptionScheme(encryptionScheme);
+ return this;
+ }
+
+ /**
+ * Sets the encryption version.
+ *
+ * @param encryptionVersion
+ * the encryption version
+ * @return the creates the batch operation
+ */
+ public CreateBatchOperation setEncryptionVersion(String encryptionVersion) {
+ this.taskType.setEncryptionVersion(encryptionVersion);
return this;
}
+ /**
+ * Sets the initialization vector.
+ *
+ * @param initializationVector
+ * the initialization vector
+ * @return the creates the batch operation
+ */
+ public CreateBatchOperation setInitializationVector(String initializationVector) {
+ this.taskType.setInitializationVector(initializationVector);
+ return this;
+ }
}
/**
View
9 microsoft-azure-api/src/test/java/com/microsoft/windowsazure/services/media/JobIntegrationTest.java
@@ -96,13 +96,10 @@ private JobInfo createJob(String name) throws ServiceException {
private CreateBatchOperation getTaskCreator(int outputAssetPosition) {
return Task
- .create()
- .setConfiguration("H.264 256k DSL CBR")
- .setMediaProcessorId("nb:mpid:UUID:2f381738-c504-4e4a-a38e-d199e207fcd5")
- .setName("My encoding Task")
- .setTaskBody(
+ .create("nb:mpid:UUID:2f381738-c504-4e4a-a38e-d199e207fcd5",
"<taskBody>" + "<inputAsset>JobInputAsset(0)</inputAsset>" + "<outputAsset>JobOutputAsset("
- + outputAssetPosition + ")</outputAsset>" + "</taskBody>");
+ + outputAssetPosition + ")</outputAsset>" + "</taskBody>")
+ .setConfiguration("H.264 256k DSL CBR").setName("My encoding Task");
}
@BeforeClass
View
9 ...api/src/test/java/com/microsoft/windowsazure/services/media/implementation/MediaBatchOperationsTest.java
@@ -80,7 +80,10 @@ public void addCreateTaskOperationToMediaBatchOperationsSuccess() throws JAXBExc
ParserConfigurationException {
// Arrange
URI serviceUri = UriBuilder.fromPath("http://www.contoso.com/media").build();
- Task.CreateBatchOperation taskCreateBatchOperation = new Task.CreateBatchOperation();
+ String mediaProcessorId = "testMediaProcessorId";
+ String taskBody = "testTaskBody";
+
+ Task.CreateBatchOperation taskCreateBatchOperation = new Task.CreateBatchOperation(mediaProcessorId, taskBody);
// Act
MediaBatchOperations mediaBatchOperations = new MediaBatchOperations(serviceUri);
@@ -95,8 +98,10 @@ public void addCreateTaskOperationToMediaBatchOperationsSuccess() throws JAXBExc
public void getMimeMultipartSuccess() throws JAXBException, ParserConfigurationException, MessagingException,
IOException {
// Arrange
+ String mediaProcessorId = "testMediaProcessorId";
+ String taskBody = "testTaskBody";
URI serviceUri = UriBuilder.fromPath("http://www.contoso.com/media").build();
- Task.CreateBatchOperation taskCreateBatchOperation = new Task.CreateBatchOperation();
+ Task.CreateBatchOperation taskCreateBatchOperation = new Task.CreateBatchOperation(mediaProcessorId, taskBody);
Job.CreateBatchOperation jobCreateBatchOperation = new Job.CreateBatchOperation(serviceUri);
// Act
View
36 microsoft-azure-api/src/test/java/com/microsoft/windowsazure/services/scenarios/MediaServiceWrapper.java
@@ -215,51 +215,53 @@ public JobInfo createJob(String jobName, AssetInfo inputAsset, List<Task.CreateB
// Process
public Task.CreateBatchOperation createTaskOptionsWindowsAzureMediaEncoder(String taskName, int inputAssetId,
int outputAssetId) throws ServiceException {
- Task.CreateBatchOperation taskCreate = Task.create().setName(taskName)
- .setMediaProcessorId(getMediaProcessorIdByName(MEDIA_PROCESSOR_WINDOWS_AZURE_MEDIA_ENCODER))
- .setConfiguration("H.264 256k DSL CBR");
- setTaskBody(taskCreate, inputAssetId, outputAssetId);
+ String taskBody = getTaskBody(inputAssetId, outputAssetId);
+ Task.CreateBatchOperation taskCreate = Task
+ .create(getMediaProcessorIdByName(MEDIA_PROCESSOR_WINDOWS_AZURE_MEDIA_ENCODER), taskBody)
+ .setName(taskName).setConfiguration("H.264 256k DSL CBR");
+
return taskCreate;
}
// Process
public Task.CreateBatchOperation createTaskOptionsPlayReadyProtection(String taskName,
String playReadyConfiguration, int inputAssetId, int outputAssetId) throws ServiceException {
+ String taskBody = getTaskBody(inputAssetId, outputAssetId);
Task.CreateBatchOperation taskCreate = Task
- .create()
- .setName(taskName)
+ .create(getMediaProcessorIdByName(MEDIA_PROCESSOR_PLAYREADY_PROTECTION), taskBody).setName(taskName)
// TODO: Re-enable
// https://github.com/WindowsAzure/azure-sdk-for-java-pr/issues/499
// .setTaskCreationOptions(TaskCreationOptions.ProtectedConfiguration)
- .setMediaProcessorId(getMediaProcessorIdByName(MEDIA_PROCESSOR_PLAYREADY_PROTECTION))
.setConfiguration(playReadyConfiguration);
- setTaskBody(taskCreate, inputAssetId, outputAssetId);
+
return taskCreate;
}
// Process
public Task.CreateBatchOperation createTaskOptionsMp4ToSmoothStreams(String taskName, int inputAssetId,
int outputAssetId) throws ServiceException {
- Task.CreateBatchOperation taskCreate = Task.create().setName(taskName)
- .setMediaProcessorId(getMediaProcessorIdByName(MEDIA_PROCESSOR_MP4_TO_SMOOTH_STREAMS))
+ String taskBody = getTaskBody(inputAssetId, outputAssetId);
+ Task.CreateBatchOperation taskCreate = Task
+ .create(getMediaProcessorIdByName(MEDIA_PROCESSOR_MP4_TO_SMOOTH_STREAMS), taskBody).setName(taskName)
.setConfiguration(configMp4ToSmoothStreams);
- setTaskBody(taskCreate, inputAssetId, outputAssetId);
+
return taskCreate;
}
// Process
public Task.CreateBatchOperation createTaskOptionsSmoothStreamsToHls(String taskName, int inputAssetId,
int outputAssetId) throws ServiceException {
- Task.CreateBatchOperation taskCreate = Task.create().setName(taskName)
- .setMediaProcessorId(getMediaProcessorIdByName(MEDIA_PROCESSOR_SMOOTH_STREAMS_TO_HLS))
+ String taskBody = getTaskBody(inputAssetId, outputAssetId);
+ Task.CreateBatchOperation taskCreate = Task
+ .create(getMediaProcessorIdByName(MEDIA_PROCESSOR_SMOOTH_STREAMS_TO_HLS), taskBody).setName(taskName)
.setConfiguration(configSmoothStreamsToAppleHttpLiveStreams);
- setTaskBody(taskCreate, inputAssetId, outputAssetId);
+
return taskCreate;
}
- private void setTaskBody(Task.CreateBatchOperation taskCreate, int inputAssetId, int outputAssetId) {
- taskCreate.setTaskBody("<taskBody><inputAsset>JobInputAsset(" + inputAssetId + ")</inputAsset>"
- + "<outputAsset>JobOutputAsset(" + outputAssetId + ")</outputAsset></taskBody>");
+ private String getTaskBody(int inputAssetId, int outputAssetId) {
+ return "<taskBody><inputAsset>JobInputAsset(" + inputAssetId + ")</inputAsset>"
+ + "<outputAsset>JobOutputAsset(" + outputAssetId + ")</outputAsset></taskBody>";
}
private String getMediaProcessorIdByName(String processorName) throws ServiceException {
Please sign in to comment.
Something went wrong with that request. Please try again.