Exemplo n.º 1
0
        private CdmCorpusDefinition SetupCdmCorpus()
        {
            // ------------------------------------------------------------------------------------------------------------
            // Instantiate corpus and set up the default namespace to be local
            var cdmCorpus = new CdmCorpusDefinition();

            cdmCorpus.Storage.DefaultNamespace = "local";

            // ------------------------------------------------------------------------------------------------------------
            // Set up adapters for managing access to different files-system locations c

            // Fake cdm, normaly use the CDM Standards adapter
            // Mount it as the 'cdm' device, not the default so must use "cdm:/folder" to get there
            cdmCorpus.Storage.Mount("cdm", new LocalAdapter(TestHelper.SampleSchemaFolderPath));

            cdmCorpus.Storage.Mount(
                "local",
                new LocalAdapter(AdlsModelJsonTestHelper.GetActualSubFolderPath(testsSubpath, nameof(TestReadLocalSaveAdls), AdlsModelJsonTestHelper.inputFolderName))
                );

            // Example how to mount to the ADLS - make sure the hostname and root entered here are also changed
            // in the example.model.json file we load in the next section
            cdmCorpus.Storage.Mount(
                "adls",
                AdlsTestHelper.CreateAdapterWithClientId(rootRelativePath)
                );

            return(cdmCorpus);
        }
Exemplo n.º 2
0
        public async Task TestReadLocalSaveAdls()
        {
            TestHelper.DeleteFilesFromActualOutput(TestHelper.GetActualOutputFolderPath(testsSubpath, nameof(TestReadLocalSaveAdls)));
            rootRelativePath = $"Samples/TestReadLocalSaveAdls/{Environment.GetEnvironmentVariable("USERNAME")}_{Environment.GetEnvironmentVariable("COMPUTERNAME")}_CSharp";

            // Modify partition.location in model.json and save it into actual output
            AdlsModelJsonTestHelper.UpdateInputAndExpectedAndSaveToActualSubFolder(
                testsSubpath,
                nameof(TestReadLocalSaveAdls),
                rootRelativePath,
                "model.json",
                "OrdersProductsCustomersLinked",
                DateTimeOffset.Now.ToString()
                );

            CdmCorpusDefinition cdmCorpus = this.SetupCdmCorpus();

            await this.ReadLocalSaveAdls(cdmCorpus);

            // Check the model.json file in ADLS and delete it.
            string actualContent = await cdmCorpus.Storage.FetchAdapter("adls").ReadAsync("model.json");

            AdlsModelJsonTestHelper.SaveModelJsonToActualOutput(testsSubpath, nameof(TestReadLocalSaveAdls), "model.json", actualContent);

            string expectedContent = AdlsModelJsonTestHelper.GetExpectedFileContent(testsSubpath, nameof(TestReadLocalSaveAdls), "model.json");

            TestHelper.AssertSameObjectWasSerialized(expectedContent, actualContent);
        }