예제 #1
0
        public async Task TestSymsSavingAndFetchingDocument()
        {
            SymsTestHelper.CheckSymsEnvironment();
            var symsAdapter = SymsTestHelper.CreateAdapterWithClientId();
            await SymsTestHelper.CleanDatabase(symsAdapter, SymsTestHelper.DatabaseName);

            var testInputPath     = TestHelper.GetInputFolderPath(testsSubpath, nameof(TestSymsSavingAndFetchingDocument));
            var testActOutputPath = TestHelper.GetActualOutputFolderPath(testsSubpath, nameof(TestSymsSavingAndFetchingDocument));
            var testExpOutputPath = TestHelper.GetExpectedOutputFolderPath(testsSubpath, nameof(TestSymsSavingAndFetchingDocument));

            CdmCorpusDefinition corpus = new CdmCorpusDefinition();

            corpus.SetEventCallback(new EventCallback {
                Invoke = CommonDataModelLoader.ConsoleStatusReport
            }, CdmStatusLevel.Warning);

            var adlsAdapter1 = SymsTestHelper.CreateADLSAdapterWithClientIdWithSharedKey(1);
            var adlsAdapter2 = SymsTestHelper.CreateADLSAdapterWithClientIdWithSharedKey(2);

            var localInputAdapter     = new LocalAdapter(testInputPath);
            var localActOutputAdapter = new LocalAdapter(testActOutputPath);
            var localExpOutputAdapter = new LocalAdapter(testExpOutputPath);

            corpus.Storage.Mount("adls1", adlsAdapter1);
            corpus.Storage.Mount("adls2", adlsAdapter2);
            corpus.Storage.Mount("syms", symsAdapter);
            corpus.Storage.Mount("localInput", localInputAdapter);
            corpus.Storage.Mount("localActOutput", localActOutputAdapter);
            corpus.Storage.Mount("localExpOutput", localExpOutputAdapter);

            corpus.Storage.Unmount("cdm");
            corpus.Storage.DefaultNamespace = "localInput";

            var manifest = await corpus.FetchObjectAsync <CdmManifestDefinition>("default.manifest.cdm.json");

            manifest.ManifestName = SymsTestHelper.DatabaseName;
            await TestSymsSaveManifest(manifest);
            await TestSymsFetchManifest(corpus, manifest, "default.manifest.cdm.json");
            await TestSymsFetchDocument(corpus, manifest);

            var manifestModified = await corpus.FetchObjectAsync <CdmManifestDefinition>("defaultmodified.manifest.cdm.json");

            manifestModified.ManifestName = SymsTestHelper.DatabaseName;
            manifestModified.Entities[0].LastFileModifiedTime = DateTimeOffset.UtcNow;
            await TestSymsSaveManifest(manifestModified);
            await TestSymsFetchManifest(corpus, manifestModified, "defaultmodified.manifest.cdm.json");
            await TestSymsFetchDocument(corpus, manifestModified);

            var tasks = new List <Func <Task> >
            {
                TestSymsSmartADLSAdapterMountLogic,
                TestSymsSmartADLSAdapterMountLogic,
                TestSymsSmartADLSAdapterMountLogic,
                TestSymsSmartADLSAdapterMountLogic
            };
            await Task.WhenAll(tasks.AsParallel().Select(async task => await task()));

            await SymsTestHelper.CleanDatabase(symsAdapter, SymsTestHelper.DatabaseName);
        }
예제 #2
0
 public async Task TestRunFetchAllFilesAsyncTestClientId()
 {
     SymsTestHelper.CheckSymsEnvironment();
     await RunFetchAllFilesAsyncTest(SymsTestHelper.CreateAdapterWithClientId());
 }
예제 #3
0
 public void TestCreateAdapterPathClientId()
 {
     SymsTestHelper.CheckSymsEnvironment();
     RunSymsCreateAdapterPathTest(SymsTestHelper.CreateAdapterWithClientId());
 }
예제 #4
0
 public async Task TestWriteReadClientId()
 {
     SymsTestHelper.CheckSymsEnvironment();
     await RunWriteReadTest(SymsTestHelper.CreateAdapterWithClientId());
 }