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

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


        ListResult<AssetFileInfo> files = service.list(AssetFile.list(asset
                .getAssetFilesLink()));

        assertEquals(1, files.size());
        AssetFileInfo file = files.get(0);
        assertEquals(BLOB_NAME, file.getName());
    }
View Full Code Here


        createAndUploadBlob(blobWriter, "blob1.bin", firstPrimes);
        createAndUploadBlob(blobWriter, "blob2.bin", onesAndZeros);
        createAndUploadBlob(blobWriter, "blob3.bin", countingUp);

        AssetFileInfo file1 = service.create(AssetFile
                .create(asset.getId(), "blob1.bin").setIsPrimary(true)
                .setIsEncrypted(false)
                .setContentFileSize(new Long(firstPrimes.length)));

        AssetFileInfo file2 = service.create(AssetFile
                .create(asset.getId(), "blob2.bin").setIsPrimary(false)
                .setIsEncrypted(false)
                .setContentFileSize(new Long(onesAndZeros.length)));

        AssetFileInfo file3 = service.create(AssetFile
                .create(asset.getId(), "blob3.bin").setIsPrimary(false)
                .setIsEncrypted(false)
                .setContentFileSize(new Long(countingUp.length))
                .setContentChecksum("1234"));
View Full Code Here

        WritableBlobContainerContract blobWriter = service
                .createBlobWriter(locator);

        createAndUploadBlob(blobWriter, "toUpdate.bin", firstPrimes);

        AssetFileInfo file = service.create(AssetFile.create(asset.getId(),
                "toUpdate.bin"));

        service.update(AssetFile.update(file.getId()).setMimeType(
                "application/octet-stream"));

        AssetFileInfo fromServer = service.get(AssetFile.get(file.getId()));

        assertEquals("application/octet-stream", fromServer.getMimeType());
    }
View Full Code Here

            inputStream.close();
            byte[] md5hash = digest.digest();
            String md5 = Base64.encode(md5hash);

            AssetFileInfo fi = new AssetFileInfo(null, new AssetFileType()
                    .setContentChecksum(md5)
                    .setContentFileSize(countingStream.getCount())
                    .setIsPrimary(isFirst).setName(fileName)
                    .setInitializationVector(getIVString(iv)));
            infoToUpload.put(fileName, fi);

            isFirst = false;
        }

        service.action(AssetFile.createFileInfos(asset.getId()));
        for (AssetFileInfo assetFile : service.list(AssetFile.list(asset
                .getAssetFilesLink()))) {
            AssetFileInfo fileInfo = infoToUpload.get(assetFile.getName());
            Updater updateOp = AssetFile.update(assetFile.getId())
                    .setContentChecksum(fileInfo.getContentChecksum())
                    .setContentFileSize(fileInfo.getContentFileSize())
                    .setIsPrimary(fileInfo.getIsPrimary());

            if (aesKey != null) {
                updateOp.setIsEncrypted(true)
                        .setEncryptionKeyId(contentKeyId)
                        .setEncryptionScheme("StorageEncryption")
                        .setEncryptionVersion("1.0")
                        .setInitializationVector(
                                fileInfo.getInitializationVector());
            }

            service.update(updateOp);
        }
View Full Code Here

        // Compare the asset files with all files
        List<AssetFileInfo> allFiles = service.list(AssetFile.list());
        for (AssetFileInfo assetFile : assetFiles) {
            assertEquals("fi.getParentAssetId", asset.getId(),
                    assetFile.getParentAssetId());
            AssetFileInfo match = null;
            for (AssetFileInfo aFile : allFiles) {
                if (aFile.getId().equals(assetFile.getId())) {
                    match = aFile;
                    break;
                }
View Full Code Here

        assertEquals(1, outputAssets.size());
        AssetInfo outputAsset = outputAssets.get(0);
        ListResult<AssetFileInfo> assetFiles = service.list(AssetFile
                .list(assetInfo.getAssetFilesLink()));
        assertEquals(1, assetFiles.size());
        AssetFileInfo outputFile = assetFiles.get(0);

        InputStream actual = getFileContents(outputAsset.getId(),
                outputFile.getName(), durationInMinutes);
        assertStreamsEqual(expected, actual);
    }
View Full Code Here

        service.action(AssetFile.createFileInfos(asset.getId()));
        ListResult<AssetFileInfo> files = service.list(AssetFile.list(
                asset.getAssetFilesLink()).set("$filter",
                "Name eq '" + blobName + "'"));
        assertEquals(1, files.size());
        AssetFileInfo file = files.get(0);
        byte[] sub = new byte[9];
        // Offset bytes to ensure that the sign-bit is not set.
        // Media Services expects unsigned Int64 values.
        System.arraycopy(iv, 0, sub, 1, 8);
        BigInteger longIv = new BigInteger(sub);
        String initializationVector = longIv.toString();

        service.update(AssetFile.update(file.getId()).setIsEncrypted(true)
                .setEncryptionKeyId(encryptionKeyId)
                .setEncryptionScheme("StorageEncryption")
                .setEncryptionVersion("1.0")
                .setInitializationVector(initializationVector));
    }
View Full Code Here

TOP

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

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.