Exemplo n.º 1
0
        internal static async Task <DataSet> CreateAsync(
            DataShareManagementClient client,
            string resourceGroupName,
            string accountName,
            string shareName,
            string dataSetName,
            DataSet expectedDataSet)
        {
            AzureOperationResponse <DataSet> createResponse =
                await client.DataSets.CreateWithHttpMessagesAsync(
                    resourceGroupName,
                    accountName,
                    shareName,
                    dataSetName,
                    expectedDataSet);

            AzureOperationResponse <DataSet> DataSet = await client.DataSets.GetWithHttpMessagesAsync(resourceGroupName, accountName, shareName, dataSetName);

            BlobDataSet blobDataSet = (BlobDataSet)DataSet.Body;

            dataSetId = blobDataSet.DataSetId;

            DataSetScenarioTests.ValidateDataSet(
                createResponse.Body,
                dataSetName);
            Assert.Equal(HttpStatusCode.Created, createResponse.Response.StatusCode);

            return(createResponse.Body);
        }
Exemplo n.º 2
0
        public async Task DataShareE2E()
        {
            Account expectedAccount = new Account(new Identity(), ScenarioTestBase <DataShareE2EScenarioTests> .AccountLocation);

            Func <DataShareManagementClient, Task> action = async(client) =>
            {
                await AccountScenarioTests.CreateAsync(
                    client,
                    this.ResourceGroupName,
                    this.AccountName,
                    expectedAccount);

                await ShareScenarioTests.CreateAsync(
                    client,
                    this.ResourceGroupName,
                    this.AccountName,
                    DataShareE2EScenarioTests.shareName,
                    ShareScenarioTests.GetShare());

                var synchronizationSetting = await SynchronizationSettingScenarioTests.CreateAsync(
                    client,
                    this.ResourceGroupName,
                    this.AccountName,
                    DataShareE2EScenarioTests.shareName,
                    DataShareE2EScenarioTests.synchronizationSettingName,
                    SynchronizationSettingScenarioTests.GetSynchronizationSetting()) as ScheduledSynchronizationSetting;

                DataSet dataSet = await DataSetScenarioTests.CreateAsync(
                    client,
                    this.ResourceGroupName,
                    this.AccountName,
                    DataShareE2EScenarioTests.shareName,
                    DataShareE2EScenarioTests.dataSetName,
                    DataSetScenarioTests.GetDataSet());

                Invitation invitation = await InvitationScenarioTests.CreateAsync(
                    client,
                    this.ResourceGroupName,
                    this.AccountName,
                    DataShareE2EScenarioTests.shareName,
                    DataShareE2EScenarioTests.invitationName,
                    InvitationScenarioTests.GetExpectedInvitation());

                await ShareSubscriptionScenarioTests.CreateAsync(
                    client,
                    this.ResourceGroupName,
                    this.AccountName,
                    DataShareE2EScenarioTests.shareSubscriptionName,
                    ShareSubscriptionScenarioTests.GetShareSubscription(invitation.InvitationId, DataShareE2EScenarioTests.sourceShareLocationName));

                await TriggerScenarioTests.CreateAsync(
                    client,
                    this.ResourceGroupName,
                    this.AccountName,
                    DataShareE2EScenarioTests.shareSubscriptionName,
                    DataShareE2EScenarioTests.triggerName,
                    TriggerScenarioTests.GetTrigger(
                        synchronizationSetting.RecurrenceInterval,
                        synchronizationSetting.SynchronizationTime));

                await DataSetMappingScenarioTests.CreateAsync(
                    client,
                    this.ResourceGroupName,
                    this.AccountName,
                    DataShareE2EScenarioTests.shareSubscriptionName,
                    DataShareE2EScenarioTests.dataSetMappingName,
                    DataSetMappingScenarioTests.GetDataSetMapping());

                ShareSubscriptionScenarioTests.Synchronize(
                    client,
                    this.ResourceGroupName,
                    this.AccountName,
                    DataShareE2EScenarioTests.shareSubscriptionName);
            };

            Func <DataShareManagementClient, Task> finallyAction = async(client) =>
            {
                await AccountScenarioTests.Delete(
                    client,
                    this.ResourceGroupName,
                    this.AccountName);
            };

            await this.RunTest(action, finallyAction);
        }
Exemplo n.º 3
0
        public async Task DataShareE2E()
        {
            Account expectedAccount   = new Account(identity, "DataShareId", shareName, default(SystemData), "Microsoft.DataShare", ScenarioTestBase <DataShareE2EScenarioTests> .AccountLocation);
            string  subscriptionIdVal = Environment.GetEnvironmentVariable(subscriptionId);

            Func <DataShareManagementClient, Task> action = async(client) =>
            {
                await AccountScenarioTests.CreateAsync(
                    client,
                    this.ResourceGroupName,
                    this.AccountName,
                    expectedAccount);

                await ShareScenarioTests.CreateAsync(
                    client,
                    this.ResourceGroupName,
                    this.AccountName,
                    DataShareE2EScenarioTests.shareName,
                    ShareScenarioTests.GetShare());

                var synchronizationSetting = await SynchronizationSettingScenarioTests.CreateAsync(
                    client,
                    this.ResourceGroupName,
                    this.AccountName,
                    DataShareE2EScenarioTests.shareName,
                    DataShareE2EScenarioTests.synchronizationSettingName,
                    SynchronizationSettingScenarioTests.GetSynchronizationSetting()) as ScheduledSynchronizationSetting;

                DataSet dataSet = await DataSetScenarioTests.CreateAsync(
                    client,
                    this.ResourceGroupName,
                    this.AccountName,
                    DataShareE2EScenarioTests.shareName,
                    DataShareE2EScenarioTests.dataSetName,
                    DataSetScenarioTests.GetDataSet(containerName, DataSetScenarioTests.filepath, this.ResourceGroupName, ScenarioTestBase <DataShareE2EScenarioTests> .storageActName, subscriptionIdVal));

                Invitation invitation = await InvitationScenarioTests.CreateAsync(
                    client,
                    this.ResourceGroupName,
                    this.AccountName,
                    DataShareE2EScenarioTests.shareName,
                    DataShareE2EScenarioTests.invitationName,
                    InvitationScenarioTests.GetExpectedInvitation());

                EmailRegistration emailRegistration =
                    await EmailRegistrationScenarioTests.RegisterEmailAsync(client, locationOfDatabase);

                await EmailRegistrationScenarioTests.ActivateEmailAsync(client, locationOfDatabase, emailRegistration);

                await ShareSubscriptionScenarioTests.CreateAsync(
                    client,
                    this.ResourceGroupName,
                    this.AccountName,
                    DataShareE2EScenarioTests.shareSubscriptionName,
                    ShareSubscriptionScenarioTests.GetShareSubscription(invitation.InvitationId, DataShareE2EScenarioTests.sourceShareLocationName));

                await TriggerScenarioTests.CreateAsync(
                    client,
                    this.ResourceGroupName,
                    this.AccountName,
                    DataShareE2EScenarioTests.shareSubscriptionName,
                    DataShareE2EScenarioTests.triggerName,
                    TriggerScenarioTests.GetTrigger(
                        synchronizationSetting.RecurrenceInterval,
                        synchronizationSetting.SynchronizationTime));

                await DataSetMappingScenarioTests.CreateAsync(
                    client,
                    this.ResourceGroupName,
                    this.AccountName,
                    DataShareE2EScenarioTests.shareSubscriptionName,
                    DataShareE2EScenarioTests.dataSetMappingName,
                    DataSetMappingScenarioTests.GetDataSetMapping(containerName, DataSetScenarioTests.dataSetId, DataSetScenarioTests.filepath, this.ResourceGroupName, storageActName, subscriptionIdVal));

                ShareSubscriptionScenarioTests.Synchronize(
                    client,
                    this.ResourceGroupName,
                    this.AccountName,
                    DataShareE2EScenarioTests.shareSubscriptionName);
            };

            Func <DataShareManagementClient, Task> finallyAction = async(client) =>
            {
                await AccountScenarioTests.Delete(
                    client,
                    this.ResourceGroupName,
                    this.AccountName);
            };

            await this.RunTest(action, finallyAction);
        }