protected function tearDown()
 {
     parent::tearDown();
     foreach ($this->_createdQueues as $value) {
         $this->safeDeleteQueue($value);
     }
 }
 protected function tearDown()
 {
     parent::tearDown();
     foreach ($this->_createdContainers as $value) {
         try {
             $this->deleteContainer($value);
         } catch (\Exception $e) {
             // Ignore exception and continue, will assume that this container doesn't exist in the sotrage account
             error_log($e->getMessage());
         }
     }
 }
 protected function tearDown()
 {
     parent::tearDown();
     foreach ($this->locator as $loc) {
         $this->restProxy->deleteLocator($loc);
     }
     foreach ($this->assets as $asset) {
         $this->restProxy->deleteAsset($asset);
     }
     foreach ($this->accessPolicy as $access) {
         $this->restProxy->deleteAccessPolicy($access);
     }
     foreach ($this->jobTemplate as $jobTemplate) {
         $this->restProxy->deleteJobTemplate($jobTemplate);
     }
     foreach ($this->job as $job) {
         $this->deleteJob($job);
     }
     $assets = $this->restProxy->getAssetList();
     foreach ($assets as $asset) {
         if (in_array($asset->getName(), $this->outputAssets)) {
             $this->restProxy->deleteAsset($asset);
         }
     }
 }
 protected function tearDown()
 {
     parent::tearDown();
     $channels = $this->restProxy->getChannelList();
     foreach ($channels as $ch) {
         if ($this->startsWith($ch->getName(), TestResources::MEDIA_SERVICES_CHANNEL_NAME)) {
             $programs = $this->restProxy->getProgramList($ch);
             foreach ($programs as $prog) {
                 if ($prog->getState() == ProgramState::Running) {
                     $this->restProxy->stopProgram($prog);
                 }
                 $this->restProxy->deleteProgram($prog);
             }
             if ($ch->getState() == ChannelState::Running) {
                 $this->restProxy->stopChannel($ch);
             }
             $this->restProxy->deleteChannel($ch);
         }
     }
     foreach ($this->ingestManifestFiles as $ingestManifestFile) {
         $this->restProxy->deleteIngestManifestFile($ingestManifestFile);
     }
     foreach ($this->ingestManifestAssets as $ingestManifestAsset) {
         $this->restProxy->deleteIngestManifestAsset($ingestManifestAsset);
     }
     foreach ($this->ingestManifests as $ingestManifest) {
         $this->restProxy->deleteIngestManifest($ingestManifest);
     }
     foreach ($this->locator as $loc) {
         $this->restProxy->deleteLocator($loc);
     }
     foreach ($this->contentKeyAuthorizationPolicies as $contentKeyAuthorizationPolicy) {
         $this->restProxy->deleteContentKeyAuthorizationPolicy($contentKeyAuthorizationPolicy);
     }
     foreach ($this->contentKeyAuthorizationOptions as $contentKeyAuthorizationOption) {
         $this->restProxy->deleteContentKeyAuthorizationPolicyOption($contentKeyAuthorizationOption);
     }
     foreach ($this->assets as $asset) {
         $assetDeliveryPolicies = $this->restProxy->getAssetLinkedDeliveryPolicy($asset);
         foreach ($assetDeliveryPolicies as $dp) {
             $this->restProxy->removeDeliveryPolicyFromAsset($asset, $dp);
         }
     }
     foreach ($this->assetDeliveryPolicies as $assetDeliveryPolicy) {
         $this->restProxy->deleteAssetDeliveryPolicy($assetDeliveryPolicy);
     }
     foreach ($this->assets as $asset) {
         $contentKeyList = $this->restProxy->getAssetContentKeys($asset);
         foreach ($contentKeyList as $contentKey) {
             unset($this->contentKeys[$contentKey->getId()]);
         }
         $this->restProxy->deleteAsset($asset);
     }
     // $this->restProxy can be empty here
     if (is_object($this->restProxy)) {
         $availableContentKeyList = $this->restProxy->getContentKeyList();
     }
     $availableContentKeyIds = array();
     foreach ($availableContentKeyList as $availableContentKey) {
         $availableContentKeyIds[] = $availableContentKey->getId();
     }
     foreach ($this->contentKeys as $contentKey) {
         if (in_array($contentKey->getId(), $availableContentKeyIds)) {
             $this->restProxy->deleteContentKey($contentKey);
         }
     }
     foreach ($this->accessPolicy as $access) {
         $this->restProxy->deleteAccessPolicy($access);
     }
     foreach ($this->jobTemplate as $jobTemplate) {
         $this->restProxy->deleteJobTemplate($jobTemplate);
     }
     foreach ($this->job as $job) {
         $this->deleteJob($job);
     }
     $assets = $this->restProxy->getAssetList();
     foreach ($assets as $asset) {
         if (in_array($asset->getName(), $this->outputAssets)) {
             $this->restProxy->deleteAsset($asset);
         }
     }
 }
 protected function tearDown()
 {
     parent::tearDown();
     foreach ($this->ingestManifestFiles as $ingestManifestFile) {
         $this->restProxy->deleteIngestManifestFile($ingestManifestFile);
     }
     foreach ($this->ingestManifestAssets as $ingestManifestAsset) {
         $this->restProxy->deleteIngestManifestAsset($ingestManifestAsset);
     }
     foreach ($this->ingestManifests as $ingestManifest) {
         $this->restProxy->deleteIngestManifest($ingestManifest);
     }
     foreach ($this->locator as $loc) {
         $this->restProxy->deleteLocator($loc);
     }
     foreach ($this->contentKeyAuthorizationPolicies as $contentKeyAuthorizationPolicy) {
         $this->restProxy->deleteContentKeyAuthorizationPolicy($contentKeyAuthorizationPolicy);
     }
     foreach ($this->contentKeyAuthorizationOptions as $contentKeyAuthorizationOption) {
         $this->restProxy->deleteContentKeyAuthorizationPolicyOption($contentKeyAuthorizationOption);
     }
     foreach ($this->assetDeliveryPolicies as $assetDeliveryPolicy) {
         $this->restProxy->deleteAssetDeliveryPolicy($assetDeliveryPolicy);
     }
     foreach ($this->assets as $asset) {
         $contentKeyList = $this->restProxy->getAssetContentKeys($asset);
         foreach ($contentKeyList as $contentKey) {
             unset($this->contentKeys[$contentKey->getId()]);
         }
         $this->restProxy->deleteAsset($asset);
     }
     $availableContentKeyList = $this->restProxy->getContentKeyList();
     $availableContentKeyIds = array();
     foreach ($availableContentKeyList as $availableContentKey) {
         $availableContentKeyIds[] = $availableContentKey->getId();
     }
     foreach ($this->contentKeys as $contentKey) {
         if (in_array($contentKey->getId(), $availableContentKeyIds)) {
             $this->restProxy->deleteContentKey($contentKey);
         }
     }
     foreach ($this->accessPolicy as $access) {
         $this->restProxy->deleteAccessPolicy($access);
     }
     foreach ($this->jobTemplate as $jobTemplate) {
         $this->restProxy->deleteJobTemplate($jobTemplate);
     }
     foreach ($this->job as $job) {
         $this->deleteJob($job);
     }
     $assets = $this->restProxy->getAssetList();
     foreach ($assets as $asset) {
         if (in_array($asset->getName(), $this->outputAssets)) {
             $this->restProxy->deleteAsset($asset);
         }
     }
 }
 protected function tearDown()
 {
     parent::tearDown();
     foreach ($this->_createdRules as $topicSubscriptionRuleName) {
         $topicSubscriptionRuleNameArray = explode('::', $topicSubscriptionRuleName);
         $topicName = $topicSubscriptionRuleNameArray[0];
         $subscriptionName = $topicSubscriptionRuleNameArray[1];
         $ruleName = $topicSubscriptionRuleNameArray[2];
         $this->safeDeleteRule($topicName, $subscriptionName, $ruleName);
     }
     foreach ($this->_createdSubscriptions as $topicSubscriptionName) {
         $topicSubscriptionNameArray = explode('::', $topicSubscriptionName);
         $topicName = $topicSubscriptionNameArray[0];
         $subscriptionName = $topicSubscriptionNameArray[1];
         $this->safeDeleteSubscription($topicName, $subscriptionName);
     }
     foreach ($this->_createdTopics as $topicName) {
         $this->safeDeleteTopic($topicName);
     }
     foreach ($this->_createdQueues as $queueName) {
         $this->safeDeleteQueue($queueName);
     }
 }
 protected function tearDown()
 {
     parent::tearDown();
     foreach ($this->createdStorageServices as $value) {
         $this->safeDeleteStorageService($value);
     }
     foreach ($this->createdAffinityGroups as $value) {
         $this->safeDeleteAffinityGroup($value);
     }
     foreach ($this->createdDeployments as $value) {
         $this->safeDeleteDeployment($value, $this->defaultSlot);
         $this->safeDeleteHostedService($value);
     }
     foreach ($this->createdHostedServices as $value) {
         $this->safeDeleteHostedService($value);
     }
 }