Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
37 commits
Select commit Hold shift + click to select a range
8a143d8
update the unit tests so that the job integration tests have the right
Jan 14, 2013
624cfa2
add TaskHistoricalEvent to the queue.
Jan 14, 2013
84c6bd5
partial checkin for task historical event
Jan 15, 2013
76d9ecc
initial check in to add task historical event type.
Jan 15, 2013
8e9fdcf
Merge pull request #101 from WindowsAzure/dev
Jan 15, 2013
7d5b4b6
second checkin to support task historical events.
Jan 16, 2013
2cebbbd
Merge pull request #99 from gcheng/bettertests
Jan 21, 2013
c3cfb9f
Merge pull request #626 from gcheng/dev
Jan 21, 2013
6760316
Merge pull request #104 from WindowsAzure/dev
Jan 22, 2013
b76886a
Merge pull request #105 from gcheng/dev
Jan 22, 2013
466c43b
add job integration test for taskhistorical event
Jan 23, 2013
cc327c0
Merge branch 'dev' of https://github.com/WindowsAzure/azure-sdk-for-j…
jcookems Jan 24, 2013
455f906
Merge pull request #631 from jcookems/dev
jcookems Jan 24, 2013
f7dce4b
code review feedback.
Jan 25, 2013
0ef9985
Merge pull request #100 from gcheng/historicalevents
Jan 25, 2013
6db3cad
a missed unit test.
Jan 25, 2013
3531068
Merge pull request #106 from gcheng/historicalevents
Jan 25, 2013
04160b9
Merge pull request #632 from gcheng/dev
Jan 25, 2013
78067fc
Minor changes to address the compile-time warnings
jcookems Jan 28, 2013
7a8812e
Remove trivial TODO comments from tests
jcookems Jan 29, 2013
dda240d
Removing trivial TODO Auto-generated comments
jcookems Jan 29, 2013
40bd3e5
Replace trivial *if* statement with more useful Assert
jcookems Jan 29, 2013
269db3f
Remove "catch (InterruptedException e)" that could obscure unexpected…
jcookems Jan 29, 2013
da209fe
Merge pull request #32 from jcookems/fixWarnings
jcookems Jan 29, 2013
0413d38
Merge pull request #634 from jcookems/dev
jcookems Jan 29, 2013
4bf887e
Remove hard-coded Fiddler code in tests
jcookems Jan 29, 2013
277921f
Adding deltas to assertEquals for Date and Double, which are likely t…
jcookems Jan 29, 2013
614e96e
Merge pull request #33 from jcookems/fix205
jcookems Feb 6, 2013
eaf464c
Merge pull request #639 from jcookems/dev
jcookems Feb 6, 2013
19ef20c
fix the broken unit test due to nimbus server upgrade.
Feb 26, 2013
4f692bb
fix another unit test due to nimbus server upgrade.
Feb 26, 2013
77c9477
Merge pull request #107 from gcheng/unittestclean
Feb 26, 2013
ce4a3bf
Merge pull request #644 from gcheng/dev
Feb 26, 2013
22961d2
Merge branch 'release' of github.com:WindowsAzure/azure-sdk-for-java …
jcookems Mar 8, 2013
0145416
Merge pull request #34 from jcookems/int
jcookems Mar 8, 2013
7f614ec
Merge pull request #651 from jcookems/dev
jcookems Mar 8, 2013
48ca51e
Merge pull request #9 from jcookems/int
jcookems Mar 8, 2013
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,107 @@
/**
* Copyright 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.implementation.content;

import java.util.Date;

import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlElement;

/**
* This type maps the XML returned in the odata ATOM serialization
* for ErrorDetail entities.
*
*/
@XmlAccessorType(XmlAccessType.FIELD)
public class TaskHistoricalEventType implements MediaServiceDTO {

/** The code. */
@XmlElement(name = "Code", namespace = Constants.ODATA_DATA_NS)
protected String code;

/** The message. */
@XmlElement(name = "Message", namespace = Constants.ODATA_DATA_NS)
protected String message;

/** The time stamp. */
@XmlElement(name = "TimeStamp", namespace = Constants.ODATA_DATA_NS)
protected Date timeStamp;

/**
* Gets the code.
*
* @return the code
*/
public String getCode() {
return code;
}

/**
* Sets the code.
*
* @param code
* the id to set
* @return the error detail type
*/
public TaskHistoricalEventType setCode(String code) {
this.code = code;
return this;
}

/**
* Gets the message.
*
* @return the message
*/
public String getMessage() {
return message;
}

/**
* Sets the message.
*
* @param message
* the message to set
* @return the error detail type
*/
public TaskHistoricalEventType setMessage(String message) {
this.message = message;
return this;
}

/**
* Gets the time stamp.
*
* @return the time stamp
*/
public Date getTimeStamp() {
return timeStamp;
}

/**
* Sets the time stamp.
*
* @param timeStamp
* the time stamp
* @return the task historical event type
*/
public TaskHistoricalEventType setTimeStamp(Date timeStamp) {
this.timeStamp = timeStamp;
return this;
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,10 @@ public class TaskType implements MediaServiceDTO {
@XmlElement(name = "element", namespace = Constants.ODATA_DATA_NS)
protected List<ErrorDetailType> errorDetails;

@XmlElementWrapper(name = "HistoricalEvents", namespace = Constants.ODATA_DATA_NS)
@XmlElement(name = "element", namespace = Constants.ODATA_DATA_NS)
protected List<TaskHistoricalEventType> historicalEventTypes;

@XmlElement(name = "MediaProcessorId", namespace = Constants.ODATA_DATA_NS)
protected String mediaProcessorId;

Expand Down Expand Up @@ -269,4 +273,13 @@ public TaskType setInputMediaAssets(List<String> inputMediaAssets) {
this.inputMediaAssets = inputMediaAssets;
return this;
}

public List<TaskHistoricalEventType> getHistoricalEventTypes() {
return historicalEventTypes;
}

public TaskType setHistoricalEventTypes(List<TaskHistoricalEventType> historicalEventTypes) {
this.historicalEventTypes = historicalEventTypes;
return this;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
/*
* Copyright 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 java.util.Date;

/**
* The Class TaskHistoricalEvent.
*/
public class TaskHistoricalEvent {

/** The code. */
private final String code;

/** The message. */
private final String message;

/** The time stamp. */
private final Date timeStamp;

/**
* Instantiates a new error detail.
*
* @param code
* the code
* @param message
* the message
* @param timeStamp
* the time stamp
*/
public TaskHistoricalEvent(String code, String message, Date timeStamp) {
this.code = code;
this.message = message;
this.timeStamp = timeStamp;
}

/**
* Gets the code.
*
* @return the code
*/
public String getCode() {
return this.code;
}

/**
* Gets the message.
*
* @return the message
*/
public String getMessage() {
return this.message;
}

/**
* Gets the time stamp.
*
* @return the time stamp
*/
public Date getTimeStamp() {
return this.timeStamp;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
import com.microsoft.windowsazure.services.media.implementation.ODataEntity;
import com.microsoft.windowsazure.services.media.implementation.atom.EntryType;
import com.microsoft.windowsazure.services.media.implementation.content.ErrorDetailType;
import com.microsoft.windowsazure.services.media.implementation.content.TaskHistoricalEventType;
import com.microsoft.windowsazure.services.media.implementation.content.TaskType;

/**
Expand Down Expand Up @@ -86,6 +87,30 @@ public List<ErrorDetail> getErrorDetails() {
return null;
}

/**
* Gets the task historical events.
*
* @return the task historical events
*/
public List<TaskHistoricalEvent> getHistoricalEvents() {
List<TaskHistoricalEvent> result = new ArrayList<TaskHistoricalEvent>();
List<TaskHistoricalEventType> historicalEventTypes = getContent().getHistoricalEventTypes();

if (historicalEventTypes != null) {
for (TaskHistoricalEventType taskHistoricalEventType : historicalEventTypes) {
String message = taskHistoricalEventType.getMessage();
if ((message != null) && (message.isEmpty())) {
message = null;
}
TaskHistoricalEvent taskHistoricalEvent = new TaskHistoricalEvent(taskHistoricalEventType.getCode(),
message, taskHistoricalEventType.getTimeStamp());
result.add(taskHistoricalEvent);
}
}

return result;
}

/**
* Gets the media processor id.
*
Expand Down Expand Up @@ -213,7 +238,7 @@ public String getInitializationVector() {
}

/**
* Gets link to the task's input assets
* Gets link to the task's input assets.
*
* @return the link
*/
Expand All @@ -222,7 +247,7 @@ public LinkInfo<AssetInfo> getInputAssetsLink() {
}

/**
* Gets link to the task's output assets
* Gets link to the task's output assets.
*
* @return the link
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ public void uploadAesProtectedAssetAndDownloadSuccess() throws Exception {
uploadEncryptedAssetFile(assetInfo, blobWriter, "MPEG4-H264.mp4", encryptedContent, contentKeyId, iv);

// submit and execute the decoding job.
JobInfo jobInfo = decodeAsset("uploadAesProtectedAssetSuccess", assetInfo.getId());
JobInfo jobInfo = decodeAsset(testJobPrefix + "uploadAesProtectedAssetSuccess", assetInfo.getId());

// assert
LinkInfo<TaskInfo> taskLinkInfo = jobInfo.getTasksLink();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -101,8 +101,8 @@ protected static void cleanupEnvironment() {
removeAllTestLocators();
removeAllTestAssets();
removeAllTestAccessPolicies();
removeAllTestContentKeys();
removeAllTestJobs();
removeAllTestContentKeys();
}

private static void removeAllTestContentKeys() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@
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;
import com.microsoft.windowsazure.services.media.models.TaskHistoricalEvent;
import com.microsoft.windowsazure.services.media.models.TaskInfo;

public class JobIntegrationTest extends IntegrationTestBase {
Expand Down Expand Up @@ -343,4 +344,32 @@ public void canGetInputOutputAssetsFromTask() throws Exception {
assertTrue(outputs.get(0).getName().contains(name));
}

@Test
public void canGetTaskHistoricalEventsFromTask() throws Exception {
// Arrange
String jobName = testJobPrefix + "canGetTaskHistoricalEventsFromTask";
int priority = 3;
int retryCounter = 0;

// Act
JobInfo actualJobInfo = service.create(Job.create().setName(jobName).setPriority(priority)
.addInputMediaAsset(assetInfo.getId()).addTaskCreator(getTaskCreator(0)));

while (actualJobInfo.getState().getCode() < 3 && retryCounter < 30) {
Thread.sleep(10000);
actualJobInfo = service.get(Job.get(actualJobInfo.getId()));
retryCounter++;
}
ListResult<TaskInfo> tasks = service.list(Task.list(actualJobInfo.getTasksLink()));
TaskInfo taskInfo = tasks.get(0);
List<TaskHistoricalEvent> historicalEvents = taskInfo.getHistoricalEvents();
TaskHistoricalEvent historicalEvent = historicalEvents.get(0);

// Assert
assertTrue(historicalEvents.size() >= 5);
assertNotNull(historicalEvent.getCode());
assertNotNull(historicalEvent.getTimeStamp());
assertNull(historicalEvent.getMessage());
}

}