Permalink
Browse files

Can now get tasks from job

  • Loading branch information...
1 parent ab3a2ab commit 809002d6acc037b4fc5b6e8f0e189f163add3d02 @christav christav committed Dec 14, 2012
@@ -77,6 +77,18 @@ public static CreateBatchOperation create(String mediaProcessorId, String taskBo
}, queryParameters);
}
+ /**
+ * Create an operation that will list the tasks pointed to by the given link
+ *
+ * @param link
+ * link to tasks
+ * @return the list operation.
+ */
+ public static DefaultListOperation<TaskInfo> list(LinkInfo link) {
+ return new DefaultListOperation<TaskInfo>(link.getHref(), new GenericType<ListResult<TaskInfo>>() {
+ });
+ }
+
/**
* The Class CreateBatchOperation.
*/
@@ -42,6 +42,7 @@
import com.microsoft.windowsazure.services.media.models.LocatorInfo;
import com.microsoft.windowsazure.services.media.models.Task;
import com.microsoft.windowsazure.services.media.models.Task.CreateBatchOperation;
+import com.microsoft.windowsazure.services.media.models.TaskInfo;
public class JobIntegrationTest extends IntegrationTestBase {
@@ -289,13 +290,6 @@ public void deleteJobInvalidIdFail() throws ServiceException {
public void canGetInputOutputAssetsFromJob() throws Exception {
String name = testJobPrefix + "canGetInputOutputAssetsFromJob";
int priority = 3;
- double duration = 0.0;
- JobState state = JobState.Queued;
- String templateId = null;
- Date created = new Date();
- Date lastModified = new Date();
- Date stateTime = null;
- Date endTime = null;
JobInfo actualJob = service.create(Job.create().setName(name).setPriority(priority)
.addInputMediaAsset(assetInfo.getId()).addTaskCreator(getTaskCreator(0)));
@@ -309,4 +303,17 @@ public void canGetInputOutputAssetsFromJob() throws Exception {
assertEquals(1, outputs.size());
assertTrue(outputs.get(0).getName().contains(name));
}
+
+ @Test
+ public void canGetTasksFromJob() throws Exception {
+ String name = testJobPrefix + "canGetTaskAssetsFromJob";
+ int priority = 3;
+
+ JobInfo actualJob = service.create(Job.create().setName(name).setPriority(priority)
+ .addInputMediaAsset(assetInfo.getId()).addTaskCreator(getTaskCreator(0)));
+
+ ListResult<TaskInfo> tasks = service.list(Task.list(actualJob.getTasksLink()));
+
+ assertEquals(1, tasks.size());
+ }
}

0 comments on commit 809002d

Please sign in to comment.