public async Task SubmitTestRequests() { var jobOutputStatusStorageService = new JobOutputStatusStorageService(jobOutputStatusTableStorageService); var mediaServiceInstanceHealthStorageService = new MediaServiceInstanceHealthStorageService(mediaServiceInstanceHealthTableStorageService); var mediaServiceInstanceHealthService = new MediaServiceInstanceHealthService(mediaServiceInstanceHealthStorageService, jobOutputStatusStorageService, mediaServiceCallHistoryStorageService, configService); var mediaServiceInstanceFactory = new MediaServiceInstanceFactory(mediaServiceCallHistoryStorageService, configService); foreach (var config in configService.MediaServiceInstanceConfiguration) { var client = mediaServiceInstanceFactory.GetMediaServiceInstance(config.Value.AccountName, Mock.Of <ILogger>()); client.LongRunningOperationRetryTimeout = 2; await MediaServicesHelper.EnsureTransformExists( client, config.Value.ResourceGroup, config.Value.AccountName, transformName, new BuiltInStandardEncoderPreset(EncoderNamedPreset.AdaptiveStreaming)).ConfigureAwait(false); await mediaServiceInstanceHealthService.CreateOrUpdateAsync(new MediaServiceInstanceHealthModel { MediaServiceAccountName = config.Value.AccountName, HealthState = InstanceHealthState.Healthy, LastUpdated = DateTime.UtcNow, IsEnabled = true }, Mock.Of <ILogger>()).ConfigureAwait(false); await MediaServicesHelper.EnsureContentKeyPolicyExists( client, config.Value.ResourceGroup, config.Value.AccountName, configService.ContentKeyPolicyName, configService.GetClearKeyStreamingKey(), configService.TokenIssuer, configService.TokenAudience).ConfigureAwait(false); } var target = new JobRequestStorageService(jobRequestQueue); var uniqueness = Guid.NewGuid().ToString().Substring(0, 13); for (var i = 0; i < 10; i++) { Assert.IsNotNull(await target.CreateAsync(GenerateJobRequestModel(i, uniqueness), Mock.Of <ILogger>()).ConfigureAwait(false)); } }
public async Task CleanupAssets() { var configuration = configService.MediaServiceInstanceConfiguration; var mediaServiceInstanceFactory = new MediaServiceInstanceFactory(mediaServiceCallHistoryStorageService, configService); foreach (var config in configuration.Values) { var client = mediaServiceInstanceFactory.GetMediaServiceInstance(config.AccountName, Mock.Of <ILogger>()); var assets = await client.Assets.ListAsync(config.ResourceGroup, config.AccountName).ConfigureAwait(false); foreach (var asset in assets) { await client.Assets.DeleteAsync(config.ResourceGroup, config.AccountName, asset.Name).ConfigureAwait(false); } var transforms = await client.Transforms.ListAsync(config.ResourceGroup, config.AccountName).ConfigureAwait(false); foreach (var transform in transforms) { await client.Transforms.DeleteAsync(config.ResourceGroup, config.AccountName, transform.Name).ConfigureAwait(false); } } }