public void canGetParentBackFromAsset() throws ServiceException,
InterruptedException {
// Arrange
String originalAssetName = testAssetPrefix
+ "canGetParentBackFromAsset";
AssetInfo originalAsset = service.create(Asset.create().setName(
originalAssetName));
int durationInMinutes = 10;
AccessPolicyInfo accessPolicyInfo = service.create(AccessPolicy.create(
testPolicyPrefix + "uploadAesPortectedAssetSuccess",
durationInMinutes, EnumSet.of(AccessPolicyPermission.WRITE)));
LocatorInfo locatorInfo = service.create(Locator.create(
accessPolicyInfo.getId(), originalAsset.getId(),
LocatorType.SAS));
WritableBlobContainerContract blobWriter = service
.createBlobWriter(locatorInfo);
InputStream mpeg4H264InputStream = getClass().getResourceAsStream(
"/media/MPEG4-H264.mp4");
blobWriter.createBlockBlob("MPEG4-H264.mp4", mpeg4H264InputStream);
service.action(AssetFile.createFileInfos(originalAsset.getId()));
String jobName = testJobPrefix + "createJobSuccess";
CreateBatchOperation taskCreator = Task
.create(MEDIA_ENCODER_MEDIA_PROCESSOR_ID,
"<taskBody>"
+ "<inputAsset>JobInputAsset(0)</inputAsset>"
+ "<outputAsset>JobOutputAsset(0)</outputAsset>"
+ "</taskBody>")
.setConfiguration("H.264 256k DSL CBR")
.setName("My encoding Task");
JobInfo jobInfo = service.create(Job.create().setName(jobName)
.addInputMediaAsset(originalAsset.getId())
.addTaskCreator(taskCreator));
// Act
ListResult<AssetInfo> outputAssets = service.list(Asset.list(jobInfo
.getOutputAssetsLink()));
assertEquals(1, outputAssets.size());
AssetInfo childAsset = outputAssets.get(0);
LinkInfo<AssetInfo> parentAssetLink = childAsset.getParentAssetsLink();
AssetInfo parentAsset = service.get(Asset.get(parentAssetLink));
// Assert
assertEquals(originalAsset.getId(), parentAsset.getId());
}