Package com.microsoft.windowsazure.services.media.models

Examples of com.microsoft.windowsazure.services.media.models.AssetInfo


    public void linkAssetContentKeySuccess() throws ServiceException,
            URISyntaxException {
        // Arrange
        String originalTestName = testAssetPrefix
                + "linkAssetContentKeySuccess";
        AssetInfo assetInfo = service.create(Asset.create()
                .setName(originalTestName)
                .setOptions(AssetOption.StorageEncrypted));

        String protectionKeyId = service.action(ProtectionKey
                .getProtectionKeyId(ContentKeyType.StorageEncryption));
        String contentKeyId = String
                .format("nb:kid:UUID:%s", UUID.randomUUID());
        String encryptedContentKey = "dummyEncryptedContentKey";
        service.create(ContentKey.create(contentKeyId,
                ContentKeyType.StorageEncryption, encryptedContentKey)
                .setProtectionKeyId(protectionKeyId));

        // Act
        service.action(Asset.linkContentKey(assetInfo.getId(), contentKeyId));

        // Assert

        List<ContentKeyInfo> contentKeys = service.list(ContentKey
                .list(assetInfo.getContentKeysLink()));
        assertEquals(1, contentKeys.size());
        assertEquals(contentKeyId, contentKeys.get(0).getId());
    }
View Full Code Here


    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());
    }
View Full Code Here

    @Test
    public void canGetAssetFromLocator() throws Exception {
        LocatorInfo locator = service.create(Locator.create(
                accessPolicyInfo.getId(), assetInfo.getId(), LocatorType.SAS));

        AssetInfo asset = service.get(Asset.get(locator.getAssetLink()));

        assertEquals(assetInfo.getId(), asset.getId());
    }
View Full Code Here

        wrapper.removeAllJobWithPrefix(testJobPrefix);
    }

    @Test
    public void newAsset() throws Exception {
        AssetInfo asset = wrapper.createAsset(testAssetPrefix + "newAsset",
                AssetOption.None);
        validator.validateAsset(asset, testAssetPrefix + "newAsset",
                AssetOption.None);
    }
View Full Code Here

    }

    @Test
    public void uploadFiles() throws Exception {
        signalSetupStarting();
        AssetInfo asset = wrapper.createAsset(testAssetPrefix + "uploadFiles",
                AssetOption.None);
        signalSetupFinished();

        wrapper.uploadFilesToAsset(asset, 10, getTestAssetFiles());
        validator.validateAssetFiles(asset, getTestAssetFiles());
View Full Code Here

    @Test
    public void uploadEncryptedFiles() throws Exception {
        signalSetupStarting();
        byte[] aesKey = getNewAesKey();
        AssetInfo asset = wrapper.createAsset(testAssetPrefix
                + "uploadEncryptedFiles", AssetOption.StorageEncrypted);

        signalSetupFinished();

        wrapper.uploadFilesToAsset(asset, 10, getTestAssetFiles(), aesKey);
View Full Code Here

    }

    @Test
    public void downloadFiles() throws Exception {
        signalSetupStarting();
        AssetInfo asset = wrapper.createAsset(
                testAssetPrefix + "downloadFiles", AssetOption.None);
        wrapper.uploadFilesToAsset(asset, 10, getTestAssetFiles());
        signalSetupFinished();

        Hashtable<String, InputStream> actualFileStreams = wrapper
View Full Code Here

    }

    @Test
    public void createJob() throws Exception {
        signalSetupStarting();
        AssetInfo asset = wrapper.createAsset(testAssetPrefix + "createJob",
                AssetOption.None);
        wrapper.uploadFilesToAsset(asset, 10, getTestAssetFiles());
        signalSetupFinished();

        String jobName = testJobPrefix + UUID.randomUUID().toString();
View Full Code Here

    }

    @Test
    public void transformAsset() throws Exception {
        signalSetupStarting();
        AssetInfo asset = wrapper.createAsset(testAssetPrefix
                + "transformAsset", AssetOption.None);
        wrapper.uploadFilesToAsset(asset, 10, getTestAssetFiles());
        String jobName = testJobPrefix + UUID.randomUUID().toString();

        JobInfo job = wrapper.createJob(jobName, asset, wrapper
View Full Code Here

    @Test
    public void transformEncryptedAsset() throws Exception {
        signalSetupStarting();
        byte[] aesKey = getNewAesKey();
        AssetInfo asset = wrapper.createAsset(testAssetPrefix
                + "transformEncryptedAsset", AssetOption.StorageEncrypted);

        wrapper.uploadFilesToAsset(asset, 10, getTestAssetFiles(), aesKey);
        String jobName = "my job transformEncryptedAsset"
                + UUID.randomUUID().toString();
        JobInfo job = wrapper.createJob(jobName, asset, wrapper
                .createTaskOptions("Decode", 0, 0,
                        EncoderType.StorageDecryption));
        signalSetupFinished();

        waitForJobToFinish(job);
        List<AssetInfo> outputAssets = wrapper.getJobOutputMediaAssets(job);
        validator
                .validateOutputAssets(outputAssets, getTestAssetFiles().keys());

        // Verify output asset files.
        assertEquals("output assets count", 1, outputAssets.size());
        AssetInfo outputAsset = outputAssets.get(0);
        validator.validateAssetFiles(outputAsset, getTestAssetFiles());

        // Verify assets were decoded.
        Hashtable<String, InputStream> actualFileStreams = wrapper
                .downloadFilesFromAsset(outputAsset, 10);
View Full Code Here

TOP

Related Classes of com.microsoft.windowsazure.services.media.models.AssetInfo

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.