Пример #1
0
        public async Task DataFlowCrud()
        {
            string dataFlowName      = "TestDataFlow";
            string powerQueryName    = "TestPowerQuery";
            string datasetName       = "TestDataFlowDataset";
            string linkedServiceName = "TestDataFlowLinkedService";

            Func <DataFactoryManagementClient, Task> action = async(client) =>
            {
                await DataFactoryScenarioTests.Create(client, this.ResourceGroupName, this.DataFactoryName, new Factory(location : FactoryLocation));

                var expectedLinkedService = LinkedServiceScenarioTests.GetLinkedServiceResource(null);
                await LinkedServiceScenarioTests.Create(client, this.ResourceGroupName, this.DataFactoryName, linkedServiceName, expectedLinkedService);

                var expectedDataset = DatasetScenarioTests.GetDatasetResource(null, linkedServiceName);
                await DatasetScenarioTests.Create(client, this.ResourceGroupName, this.DataFactoryName, datasetName, expectedDataset);

                DataFlowResource expectedDataFlow = GetDataFlowResource(null, datasetName);
                await Create(client, this.ResourceGroupName, this.DataFactoryName, dataFlowName, expectedDataFlow);
                await GetList(client, this.ResourceGroupName, this.DataFactoryName, dataFlowName, expectedDataFlow);

                DataFlowResource updatedDataFlow = GetDataFlowResource("data flow description", datasetName);
                await Update(client, this.ResourceGroupName, this.DataFactoryName, dataFlowName, updatedDataFlow);
                await GetList(client, this.ResourceGroupName, this.DataFactoryName, dataFlowName, updatedDataFlow);

                await Delete(client, this.ResourceGroupName, this.DataFactoryName, dataFlowName);

                // Power Query (Wrangling data flow)
                DataFlowResource expectedPowerQuery = GetPowerQueryResource(null, datasetName);
                await Create(client, this.ResourceGroupName, this.DataFactoryName, powerQueryName, expectedPowerQuery);
                await GetList(client, this.ResourceGroupName, this.DataFactoryName, powerQueryName, expectedPowerQuery);

                DataFlowResource updatedPowerQuery = GetPowerQueryResource("power query description", datasetName);
                await Update(client, this.ResourceGroupName, this.DataFactoryName, powerQueryName, updatedPowerQuery);
                await GetList(client, this.ResourceGroupName, this.DataFactoryName, powerQueryName, updatedPowerQuery);

                await Delete(client, this.ResourceGroupName, this.DataFactoryName, powerQueryName);

                await DatasetScenarioTests.Delete(client, this.ResourceGroupName, this.DataFactoryName, datasetName);

                await LinkedServiceScenarioTests.Delete(client, this.ResourceGroupName, this.DataFactoryName, linkedServiceName);
            };

            Func <DataFactoryManagementClient, Task> finallyAction = async(client) =>
            {
                await client.Factories.DeleteAsync(this.ResourceGroupName, this.DataFactoryName);
            };

            await this.RunTest(action, finallyAction);
        }
Пример #2
0
        public async Task DataFactoryE2E()
        {
            Factory expectedFactory = new Factory(location: FactoryLocation);

            Func <DataFactoryManagementClient, Task> action = async(client) =>
            {
                #region DataFactoryTests
                await DataFactoryScenarioTests.Create(client, this.ResourceGroupName, this.DataFactoryName, expectedFactory);

                var tags = new Dictionary <string, string>
                {
                    { "exampleTag", "exampleValue" }
                };
                await DataFactoryScenarioTests.Update(client, this.ResourceGroupName, this.DataFactoryName, expectedFactory, new FactoryUpdateParameters { Tags = tags });

                #endregion

                #region LinkedServiceTests
                var expectedLinkedService = LinkedServiceScenarioTests.GetLinkedServiceResource(null);
                await LinkedServiceScenarioTests.Create(client, this.ResourceGroupName, this.DataFactoryName, linkedServiceName, expectedLinkedService);

                var updatedLinkedService = LinkedServiceScenarioTests.GetLinkedServiceResource("linkedService description");
                await LinkedServiceScenarioTests.Update(client, this.ResourceGroupName, this.DataFactoryName, linkedServiceName, updatedLinkedService);

                await LinkedServiceScenarioTests.GetList(client, this.ResourceGroupName, this.DataFactoryName, linkedServiceName, updatedLinkedService);

                #endregion

                #region DatasetTests
                DatasetResource expectedDataset = DatasetScenarioTests.GetDatasetResource(null, linkedServiceName);
                await DatasetScenarioTests.Create(client, this.ResourceGroupName, this.DataFactoryName, datasetName, expectedDataset);

                await DatasetScenarioTests.GetList(client, this.ResourceGroupName, this.DataFactoryName, datasetName, expectedDataset);

                DatasetResource updatedDataset = DatasetScenarioTests.GetDatasetResource("dataset description", linkedServiceName);
                await DatasetScenarioTests.Update(client, this.ResourceGroupName, this.DataFactoryName, datasetName, updatedDataset);

                await DatasetScenarioTests.GetList(client, this.ResourceGroupName, this.DataFactoryName, datasetName, updatedDataset);

                #endregion

                #region PipelineTests
                PipelineResource expectedPipeline = PipelineScenarioTests.GetPipelineResource(null, datasetName);

                await PipelineScenarioTests.Create(client, this.ResourceGroupName, this.DataFactoryName, pipelineName, expectedPipeline);

                await PipelineScenarioTests.GetList(client, this.ResourceGroupName, this.DataFactoryName, pipelineName, expectedPipeline);

                PipelineResource updatedPipeline = PipelineScenarioTests.GetPipelineResource("pipeline description", datasetName);
                await PipelineScenarioTests.Update(client, this.ResourceGroupName, this.DataFactoryName, pipelineName, updatedPipeline);

                await PipelineScenarioTests.GetList(client, this.ResourceGroupName, this.DataFactoryName, pipelineName, updatedPipeline);

                #endregion

                #region TriggerTests
                TriggerResource expectedTrigger = TriggerScenarioTests.GetTriggerResource(null, pipelineName, outputBlobName);
                await TriggerScenarioTests.Create(client, this.ResourceGroupName, this.DataFactoryName, triggerName, expectedTrigger);

                await TriggerScenarioTests.GetList(client, this.ResourceGroupName, this.DataFactoryName, triggerName, expectedTrigger);

                TriggerResource updatedTrigger = TriggerScenarioTests.GetTriggerResource("trigger description", pipelineName, outputBlobName);
                await TriggerScenarioTests.Update(client, this.ResourceGroupName, this.DataFactoryName, triggerName, updatedTrigger);

                await TriggerScenarioTests.GetList(client, this.ResourceGroupName, this.DataFactoryName, triggerName, updatedTrigger);

                #endregion

                #region TestCleanup

                await TriggerScenarioTests.Delete(client, this.ResourceGroupName, this.DataFactoryName, triggerName);

                await PipelineScenarioTests.Delete(client, this.ResourceGroupName, this.DataFactoryName, pipelineName);

                await DatasetScenarioTests.Delete(client, this.ResourceGroupName, this.DataFactoryName, datasetName);

                await LinkedServiceScenarioTests.Delete(client, this.ResourceGroupName, this.DataFactoryName, linkedServiceName);

                await DataFactoryScenarioTests.Delete(client, this.ResourceGroupName, this.DataFactoryName);

                #endregion
            };

            Func <DataFactoryManagementClient, Task> finallyAction = async(client) =>
            {
            };

            await this.RunTest(action, finallyAction);
        }