Example #1
0
        public async Task TestAvoidRetryCodes()
        {
            AdlsTestHelper.CheckADLSEnvironment();
            var adlsAdapter = AdlsTestHelper.CreateAdapterWithSharedKey();

            adlsAdapter.NumberOfRetries = 3;

            var corpus = new CdmCorpusDefinition();

            corpus.Storage.Mount("adls", adlsAdapter);
            var count = 0;

            corpus.SetEventCallback(new EventCallback
            {
                Invoke = (status, message) =>
                {
                    if (message.Contains("Response for request "))
                    {
                        count++;
                    }
                }
            }, CdmStatusLevel.Progress);

            await corpus.FetchObjectAsync <CdmDocumentDefinition>("adls:/inexistentFile.cdm.json");

            Assert.AreEqual(1, count);
        }
Example #2
0
        public async Task ADLSWriteClientIdLargeFileContentsNoEmptyFileLeft()
        {
            AdlsTestHelper.CheckADLSEnvironment();
            string      filename      = "largefilecheck_CSharp.txt";
            string      writeContents = new string('A', 100000000);
            ADLSAdapter adapter       = AdlsTestHelper.CreateAdapterWithClientId();

            adapter.Ctx = new ResolveContext(null, null);
            adapter.Ctx.FeatureFlags.Add("ADLSAdapter_deleteEmptyFile", true);

            try
            {
                await adapter.WriteAsync(filename, writeContents);
            }
            catch (Exception e)
            { }

            try
            {
                await adapter.ReadAsync(filename);
            }
            catch (Exception e)
            {
                Assert.IsTrue(e.Message.Contains("The specified path does not exist"));
            }
        }
Example #3
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);
        }
Example #4
0
        public void CheckSampleRunTestsFlag()
        {
            // Check if ADLS_RUNTESTS flag is set.
            AdlsTestHelper.CheckADLSEnvironment();

            // Check if SAMPLE_RUNTESTS flag is set.
            if (Environment.GetEnvironmentVariable("SAMPLE_RUNTESTS") != "1")
            {
                // this will cause tests to appear as "Skipped" in the final result
                Assert.Inconclusive("SAMPLE_RUNTESTS environment variable not set.");
            }
        }
Example #5
0
        public async Task TestHttpsHostname()
        {
            AdlsTestHelper.CheckADLSEnvironment();
            string filename    = $"HTTPSWriteTest/{Environment.GetEnvironmentVariable("USERNAME")}_{Environment.GetEnvironmentVariable("COMPUTERNAME")}_CSharp.txt";
            var    adlsAdapter = AdlsTestHelper.CreateAdapterWithSharedKey(null, false, true);

            try
            {
                await adlsAdapter.ReadAsync(filename);

                await adlsAdapter.ComputeLastModifiedTimeAsync(filename);
            }
            catch (UriFormatException ex)
            {
                Assert.Fail(ex.Message);
            }
            catch (Exception)
            {
            }
        }
Example #6
0
        public async Task ADLSWriteClientIdEmptyContentsNoEmptyFileLeft()
        {
            AdlsTestHelper.CheckADLSEnvironment();
            string filename      = "emptycheck_CSharp.txt";
            string writeContents = "";

            ADLSAdapter adapter = AdlsTestHelper.CreateAdapterWithClientId();

            try
            {
                await adapter.WriteAsync(filename, writeContents);
            }
            catch (Exception e)
            {}

            try
            {
                await adapter.ReadAsync(filename);
            }
            catch (Exception e)
            {
                Assert.IsTrue(e.Message.Contains("The specified path does not exist"));
            }
        }
Example #7
0
 public async Task ADLSSpecialCharactersTest()
 {
     AdlsTestHelper.CheckADLSEnvironment();
     await RunSpecialCharactersTest(AdlsTestHelper.CreateAdapterWithClientId("PathWithSpecialCharactersAndUnescapedStringTest/Root-With=Special Characters:"));
 }
Example #8
0
 public async Task ADLSFileEnumClientId()
 {
     AdlsTestHelper.CheckADLSEnvironment();
     await RunFileEnumTest(AdlsTestHelper.CreateAdapterWithClientId());
 }
Example #9
0
 public async Task ADLSFileEnumSharedKey()
 {
     AdlsTestHelper.CheckADLSEnvironment();
     await RunFileEnumTest(AdlsTestHelper.CreateAdapterWithSharedKey());
 }
Example #10
0
 public async Task ADLSCheckFileTimeClientId()
 {
     AdlsTestHelper.CheckADLSEnvironment();
     await RunCheckFileTimeTest(AdlsTestHelper.CreateAdapterWithClientId());
 }
Example #11
0
 public async Task ADLSWriteReadWithBlobHostName()
 {
     AdlsTestHelper.CheckADLSEnvironment();
     await RunWriteReadTest(AdlsTestHelper.CreateAdapterWithSharedKey(testBlobHostName: true));
     await RunWriteReadTest(AdlsTestHelper.CreateAdapterWithClientId(testBlobHostName: true));
 }
Example #12
0
 public async Task ADLSWriteReadClientIdWithEndpoint()
 {
     AdlsTestHelper.CheckADLSEnvironment();
     await RunWriteReadTest(AdlsTestHelper.CreateAdapterWithClientId(specifyEndpoint: true));
 }
Example #13
0
 public async Task ADLSWriteReadClientId()
 {
     AdlsTestHelper.CheckADLSEnvironment();
     await RunWriteReadTest(AdlsTestHelper.CreateAdapterWithClientId());
 }