当前位置: 首页>>代码示例>>PHP>>正文


PHP TestResources::getMediaServicesTask方法代码示例

本文整理汇总了PHP中Tests\Framework\TestResources::getMediaServicesTask方法的典型用法代码示例。如果您正苦于以下问题:PHP TestResources::getMediaServicesTask方法的具体用法?PHP TestResources::getMediaServicesTask怎么用?PHP TestResources::getMediaServicesTask使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Tests\Framework\TestResources的用法示例。


在下文中一共展示了TestResources::getMediaServicesTask方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: testMonitorProcessing

 /**
  * @covers WindowsAzure\MediaServices\MediaServicesRestProxy::createJob
  * @covers WindowsAzure\MediaServices\MediaServicesRestProxy::getLatestMediaProcessor
  * @covers WindowsAzure\MediaServices\MediaServicesRestProxy::getJobStatus
  */
 public function testMonitorProcessing()
 {
     // Setup
     $mediaProcessor = $this->restProxy->getLatestMediaProcessor(TestResources::MEDIA_SERVICES_PROCESSOR_NAME);
     $inputAsset = $this->createAssetWithFile();
     $taskBody = TestResources::getMediaServicesTask($this->getOutputAssetName());
     $configuration = TestResources::MEDIA_SERVICES_TASK_COFIGURATION;
     $name = TestResources::MEDIA_SERVICES_JOB_NAME . $this->createSuffix();
     $task = new Task($taskBody, $mediaProcessor->getId(), TaskOptions::NONE);
     $task->setConfiguration($configuration);
     $job = new Job();
     $job->setName($name);
     $jobWithTasks = $this->createJob($job, array($inputAsset), array($task));
     // Test
     $jobStatus = $this->restProxy->getJobStatus($jobWithTasks);
     // Assert
     $this->assertEquals($taskBody, $task->getTaskBody());
     $this->assertEquals($configuration, $task->getConfiguration());
     $this->assertContains(TestResources::MEDIA_SERVICES_PROCESSOR_ID_PREFIX, $task->getMediaProcessorId());
     $this->assertEquals($name, $job->getName());
     $this->assertLessThanOrEqual(6, $jobStatus);
     $this->assertGreaterThanOrEqual(0, $jobStatus);
 }
开发者ID:jdruid,项目名称:Microsoft-Azure-PHP-SDK-Storage,代码行数:28,代码来源:MediaServicesFunctionalTest.php

示例2: testIngestEncryptedAssetAndDecryptAtAzure

 public function testIngestEncryptedAssetAndDecryptAtAzure()
 {
     // Setup
     $content = TestResources::MEDIA_SERVICES_DUMMY_FILE_CONTENT;
     $aesKey = Utilities::generateCryptoKey(32);
     $protectionKeyId = $this->restProxy->getProtectionKeyId(ProtectionKeyTypes::X509_CERTIFICATE_THUMBPRINT);
     $protectionKey = $this->restProxy->getProtectionKey($protectionKeyId);
     $contentKey = new ContentKey();
     $contentKey->setContentKey($aesKey, $protectionKey);
     $contentKey->setProtectionKeyId($protectionKeyId);
     $contentKey->setProtectionKeyType(ProtectionKeyTypes::X509_CERTIFICATE_THUMBPRINT);
     $contentKey->setContentKeyType(ContentKeyTypes::STORAGE_ENCRYPTION);
     $contentKey = $this->createContentKey($contentKey);
     $asset = new Asset(Asset::OPTIONS_STORAGE_ENCRYPTED);
     $asset->setName(TestResources::MEDIA_SERVICES_ASSET_NAME . $this->createSuffix());
     $asset = $this->createAsset($asset);
     $this->restProxy->linkContentKeyToAsset($asset, $contentKey);
     $initializationVector = Utilities::generateCryptoKey(8);
     $encrypted = Utilities::ctrCrypt($content, $aesKey, str_pad($initializationVector, 16, chr(0)));
     // Test
     $access = new AccessPolicy(TestResources::MEDIA_SERVICES_ACCESS_POLICY_NAME . $this->createSuffix());
     $access->setDurationInMinutes(30);
     $access->setPermissions(AccessPolicy::PERMISSIONS_WRITE);
     $access = $this->createAccessPolicy($access);
     $locator = new Locator($asset, $access, Locator::TYPE_SAS);
     $locator->setName(TestResources::MEDIA_SERVICES_LOCATOR_NAME . $this->createSuffix());
     $locator->setStartTime(new \DateTime('now -5 minutes'));
     $locator = $this->createLocator($locator);
     $fileName = TestResources::MEDIA_SERVICES_DUMMY_FILE_NAME;
     $this->restProxy->uploadAssetFile($locator, $fileName, $encrypted);
     $this->restProxy->createFileInfos($asset);
     $files = $this->restProxy->getAssetAssetFileList($asset);
     $files[0]->setIsEncrypted(true);
     $files[0]->setEncryptionKeyId($contentKey->getId());
     $files[0]->setEncryptionScheme(EncryptionSchemes::STORAGE_ENCRYPTION);
     $files[0]->setEncryptionVersion(Resources::MEDIA_SERVICES_ENCRYPTION_VERSION);
     $files[0]->setInitializationVector(Utilities::base256ToDec($initializationVector));
     $this->restProxy->updateAssetFile($files[0]);
     $decodeProcessor = $this->restProxy->getLatestMediaProcessor(TestResources::MEDIA_SERVICES_DECODE_PROCESSOR_NAME);
     $task = new Task(TestResources::getMediaServicesTask($this->getOutputAssetName()), $decodeProcessor->getId(), TaskOptions::NONE);
     $job = new Job();
     $job->setName(TestResources::MEDIA_SERVICES_JOB_NAME . $this->createSuffix());
     $job = $this->createJob($job, array($asset), array($task));
     $this->waitJobStatus($job, array(Job::STATE_FINISHED, Job::STATE_ERROR));
     $this->assertEquals($this->restProxy->getJobStatus($job), Job::STATE_FINISHED);
     $outputAssets = $this->restProxy->getJobOutputMediaAssets($job);
     $this->assertCount(1, $outputAssets);
     $accessPolicy = new AccessPolicy(TestResources::MEDIA_SERVICES_ACCESS_POLICY_NAME . $this->createSuffix());
     $accessPolicy->setDurationInMinutes(300);
     $accessPolicy->setPermissions(AccessPolicy::PERMISSIONS_READ);
     $accessPolicy = $this->createAccessPolicy($accessPolicy);
     $locator = new Locator($outputAssets[0], $accessPolicy, Locator::TYPE_SAS);
     $locator->setName(TestResources::MEDIA_SERVICES_LOCATOR_NAME . $this->createSuffix());
     $locator->setStartTime(new \DateTime('now -5 minutes'));
     $locator = $this->createLocator($locator);
     // without sleep() Locator hasn't enough time to create URL, so that's why we have to use at least sleep(30)
     sleep(40);
     $method = Resources::HTTP_GET;
     $url = new Url($locator->getBaseUri() . '/' . TestResources::MEDIA_SERVICES_DUMMY_FILE_NAME . $locator->getContentAccessComponent());
     $filters = array();
     $statusCode = Resources::STATUS_OK;
     $httpClient = new HttpClient();
     $httpClient->setMethod($method);
     $httpClient->setExpectedStatusCode($statusCode);
     $actual = $httpClient->send($filters, $url);
     $this->assertEquals($content, $actual);
 }
开发者ID:bitmovin,项目名称:azure-sdk-for-php,代码行数:67,代码来源:MediaServicesFunctionalTest.php

示例3: createJobWithTasks

 public function createJobWithTasks($name)
 {
     $mediaProcessor = $this->restProxy->getLatestMediaProcessor(TestResources::MEDIA_SERVICES_PROCESSOR_NAME);
     $inputAsset = $this->createAssetWithFile();
     $taskBody = TestResources::getMediaServicesTask($this->getOutputAssetName());
     $task = new Task($taskBody, $mediaProcessor->getId(), TaskOptions::NONE);
     $task->setConfiguration(TestResources::MEDIA_SERVICES_TASK_COFIGURATION);
     $job = new Job();
     $job->setName($name);
     $jobResult = $this->createJob($job, array($inputAsset), array($task));
     $this->job[$jobResult->getId()] = $jobResult;
     return $jobResult;
 }
开发者ID:jdruid,项目名称:Microsoft-Azure-PHP-SDK-Storage,代码行数:13,代码来源:MediaServicesRestProxyTestBase.php


注:本文中的Tests\Framework\TestResources::getMediaServicesTask方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。