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

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


                .getAssetFilesLink()));

        assertNotNull("assetFiles", assetFiles);
        assertEquals("assetFiles.size", inputFiles.size(), assetFiles.size());

        ContentKeyInfo contentKey = null;
        if (asset.getOptions() == AssetOption.StorageEncrypted) {
            ListResult<ContentKeyInfo> contentKeys = service.list(ContentKey
                    .list(asset.getContentKeysLink()));
            assertEquals("contentKeys size", 1, contentKeys.size());
            contentKey = contentKeys.get(0);
        }

        // Compare encryption info for asset files
        for (AssetFileInfo assetFile : assetFiles) {
            if (asset.getOptions() == AssetOption.StorageEncrypted) {
                assertEquals("assetFile.getIsEncrypted", true,
                        assetFile.getIsEncrypted());
                assertEquals("assetFile.getEncryptionKeyId",
                        contentKey.getId(), assetFile.getEncryptionKeyId());
                assertNotNullOrEmpty("assetFile.getEncryptionScheme",
                        assetFile.getEncryptionScheme());
                assertNotNullOrEmpty("assetFile.getEncryptionVersion",
                        assetFile.getEncryptionVersion());
                assertNotNullOrEmpty("assetFile.getInitializationVector",
View Full Code Here


                protectionKey, aesKey);
        String encryptedContentKeyString = Base64.encode(encryptedContentKey);
        String checksum = EncryptionHelper.calculateContentKeyChecksum(
                contentKeyIdUuid, aesKey);

        ContentKeyInfo contentKeyInfo = service.create(ContentKey
                .create(contentKeyId, ContentKeyType.StorageEncryption,
                        encryptedContentKeyString).setChecksum(checksum)
                .setProtectionKeyId(protectionKeyId));
        return contentKeyInfo.getId();
    }
View Full Code Here

    private ContentKeyInfo createTestContentKey(String contentKeyNameSuffix)
            throws ServiceException {
        String testContentKeyId = createRandomContentKeyId();
        String testContentKeyName = testContentKeyPrefix + contentKeyNameSuffix;

        ContentKeyInfo contentKeyInfo = service.create(ContentKey.create(
                testContentKeyId, testContentKeyType, testEncryptedContentKey)
                .setName(testContentKeyName));
        return contentKeyInfo;
    }
View Full Code Here

                protectionKey, aesKey);
        String encryptedContentKeyString = Base64.encode(encryptedContentKey);
        String checksum = EncryptionHelper.calculateContentKeyChecksum(
                testContentKeyIdUuid, aesKey);

        ContentKeyInfo contentKeyInfo = service.create(ContentKey
                .create(testContentKeyId, ContentKeyType.StorageEncryption,
                        encryptedContentKeyString).setChecksum(checksum)
                .setProtectionKeyId(protectionKeyId)
                .setName(testContnetKeyName));
View Full Code Here

                + "testCanCreateContentKey";
        String protectionKeyId = service.action(ProtectionKey
                .getProtectionKeyId(testContentKeyType));

        // Act
        ContentKeyInfo contentKeyInfo = service.create(ContentKey
                .create(testCanCreateContentKeyId, testContentKeyType,
                        testEncryptedContentKey)
                .setName(testCanCreateContentKeyName)
                .setProtectionKeyId(protectionKeyId));
View Full Code Here

        // Arrange
        String expectedName = testContentKeyPrefix + "GetOne";
        String testGetSingleContentKeyByIdId = createRandomContentKeyId();
        String protectionKeyId = service.action(ProtectionKey
                .getProtectionKeyId(testContentKeyType));
        ContentKeyInfo ContentKeyToGet = service.create(ContentKey
                .create(testGetSingleContentKeyByIdId, testContentKeyType,
                        testEncryptedContentKey).setName(expectedName)
                .setProtectionKeyId(protectionKeyId));

        // Act
        ContentKeyInfo retrievedContentKeyInfo = service.get(ContentKey
                .get(ContentKeyToGet.getId()));

        // Assert
        assertEquals(ContentKeyToGet.getId(), retrievedContentKeyInfo.getId());
        verifyContentKeyProperties("ContentKey", testGetSingleContentKeyByIdId,
                testContentKeyType, testEncryptedContentKey, expectedName,
                protectionKeyId, ProtectionKeyType.fromCode(0), "",
                retrievedContentKeyInfo);
    }
View Full Code Here

                .getProtectionKeyId(testContentKeyType));

        List<ContentKeyInfo> expectedContentKeys = new ArrayList<ContentKeyInfo>();
        for (int i = 0; i < ContentKeyNames.length; i++) {
            String testCanRetrieveListOfContentKeysId = createRandomContentKeyId();
            ContentKeyInfo contentKey = service.create(ContentKey.create(
                    testCanRetrieveListOfContentKeysId, testContentKeyType,
                    testEncryptedContentKey)
                    .setProtectionKeyId(protectionKeyId));
            expectedContentKeys.add(contentKey);
        }
View Full Code Here

        String protectionKeyId = service.action(ProtectionKey
                .getProtectionKeyId(testContentKeyType));

        List<ContentKeyInfo> expectedContentKeys = new ArrayList<ContentKeyInfo>();
        for (int i = 0; i < ContentKeyNames.length; i++) {
            ContentKeyInfo contentKeyInfo = service.create(ContentKey.create(
                    createRandomContentKeyId(), testContentKeyType,
                    testEncryptedContentKey)
                    .setProtectionKeyId(protectionKeyId));
            expectedContentKeys.add(contentKeyInfo);
        }
View Full Code Here

    public void canDeleteContentKeyById() throws Exception {
        // Arrange
        String protectionKeyId = service.action(ProtectionKey
                .getProtectionKeyId(testContentKeyType));
        String contentKeyName = testContentKeyPrefix + "ToDelete";
        ContentKeyInfo contentKeyToDelete = service.create(ContentKey
                .create(createRandomContentKeyId(), testContentKeyType,
                        testEncryptedContentKey).setName(contentKeyName)
                .setProtectionKeyId(protectionKeyId));
        List<ContentKeyInfo> listContentKeysResult = service.list(ContentKey
                .list());
        int ContentKeyCountBaseline = listContentKeysResult.size();

        // Act
        service.delete(ContentKey.delete(contentKeyToDelete.getId()));

        // Assert
        listContentKeysResult = service.list(ContentKey.list());
        assertEquals("listPoliciesResult.size", ContentKeyCountBaseline - 1,
                listContentKeysResult.size());

        for (ContentKeyInfo contentKey : service.list(ContentKey.list())) {
            assertFalse(contentKeyToDelete.getId().equals(contentKey.getId()));
        }

        expectedException.expect(ServiceException.class);
        expectedException.expect(new ServiceExceptionMatcher(404));
        service.get(ContentKey.get(contentKeyToDelete.getId()));
    }
View Full Code Here

    }

    @Test
    public void rebindContentKeyNoX509CertificateSuccess() throws Exception {

        ContentKeyInfo contentKeyInfo = createValidTestContentKey("rebindContentKeyNoX509Success");

        String contentKey = service.action(ContentKey.rebind(contentKeyInfo
                .getId()));
        assertNotNull(contentKey);

    }
View Full Code Here

TOP

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

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.