Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Remove TODO in JobIntegration test by adding validation for the numbe…

…r of tasks.

For #593
  • Loading branch information...
commit f86ea9cd49f9785dd79a5eae8704cb8d8acc2e7e 1 parent 1e0beaa
@jcookems jcookems authored
View
27 microsoft-azure-api/src/test/java/com/microsoft/windowsazure/services/media/JobIntegrationTest.java
@@ -31,6 +31,7 @@
import com.microsoft.windowsazure.services.media.models.Job;
import com.microsoft.windowsazure.services.media.models.JobInfo;
import com.microsoft.windowsazure.services.media.models.JobState;
+import com.microsoft.windowsazure.services.media.models.LinkInfo;
import com.microsoft.windowsazure.services.media.models.ListResult;
import com.microsoft.windowsazure.services.media.models.Task;
import com.microsoft.windowsazure.services.media.models.Task.CreateBatchOperation;
@@ -40,16 +41,16 @@
private static AssetInfo assetInfo;
- private void verifyJobInfoEqual(String message, JobInfo expected, JobInfo actual) {
+ private void verifyJobInfoEqual(String message, JobInfo expected, JobInfo actual) throws ServiceException {
verifyJobProperties(message, expected.getName(), expected.getPriority(), expected.getRunningDuration(),
expected.getState(), expected.getTemplateId(), expected.getCreated(), expected.getLastModified(),
- expected.getStartTime(), expected.getEndTime(), actual);
+ expected.getStartTime(), expected.getEndTime(), null, actual);
}
@SuppressWarnings("deprecation")
private void verifyJobProperties(String message, String testName, Integer priority, double runningDuration,
JobState state, String templateId, Date created, Date lastModified, Date startTime, Date endTime,
- JobInfo actualJob) {
+ Integer expectedTaskCount, JobInfo actualJob) throws ServiceException {
assertNotNull(message, actualJob);
assertNotNull(message + "Id", actualJob.getId());
@@ -66,8 +67,11 @@ private void verifyJobProperties(String message, String testName, Integer priori
assertDateApproxEquals(message + " StartTime", startTime, actualJob.getStartTime());
assertDateApproxEquals(message + " EndTime", endTime, actualJob.getEndTime());
- // TODO: Add test for accessing the tasks when fixed:
- // https://github.com/WindowsAzure/azure-sdk-for-java-pr/issues/531
+ if (expectedTaskCount != null) {
+ LinkInfo tasksLink = actualJob.getTasksLink();
+ ListResult<TaskInfo> actualTasks = service.list(Task.list(tasksLink));
+ assertEquals(message + " tasks size", expectedTaskCount.intValue(), actualTasks.size());
+ }
}
private JobInfo createJob(String name) throws ServiceException {
@@ -108,7 +112,7 @@ public void createJobSuccess() throws ServiceException {
// Assert
verifyJobProperties("actualJob", name, priority, duration, state, templateId, created, lastModified, stateTime,
- endTime, actualJob);
+ endTime, 1, actualJob);
}
@Test
@@ -133,7 +137,7 @@ public void createJobTwoTasksSuccess() throws ServiceException {
// Assert
verifyJobProperties("actualJob", name, priority, duration, state, templateId, created, lastModified, stateTime,
- endTime, actualJob);
+ endTime, 2, actualJob);
}
@Test
@@ -155,7 +159,7 @@ public void getJobSuccess() throws ServiceException {
// Assert
verifyJobProperties("actualJob", name, priority, duration, state, templateId, created, lastModified, stateTime,
- endTime, actualJob);
+ endTime, 1, actualJob);
}
@Test
@@ -180,7 +184,12 @@ public void listJobSuccess() throws ServiceException {
verifyListResultContains("listJobs", expectedListJobsResult, actualListJobResult, new ComponentDelegate() {
@Override
public void verifyEquals(String message, Object expected, Object actual) {
- verifyJobInfoEqual(message, (JobInfo) expected, (JobInfo) actual);
+ try {
+ verifyJobInfoEqual(message, (JobInfo) expected, (JobInfo) actual);
+ }
+ catch (ServiceException e) {
+ fail(e.getMessage());
+ }
}
});
}
Please sign in to comment.
Something went wrong with that request. Please try again.