Exemplo n.º 1
0
        public void CanWriteHiveQueryFile()
        {
            this.ApplyIndividualTestMockingOnly();
            var    wellKnownStorageAccount = IntegrationTestBase.GetWellKnownStorageAccounts().First();
            var    wabsStorageClient       = new AzureHDInsightStorageHandler(wellKnownStorageAccount);
            string hiveQueryFilePath       = string.Format(CultureInfo.InvariantCulture,
                                                           "http://{0}/{1}/user/{2}/{3}.hql",
                                                           wellKnownStorageAccount.Name,
                                                           wellKnownStorageAccount.Container,
                                                           IntegrationTestBase.TestCredentials.HadoopUserName,
                                                           Guid.NewGuid().ToString("N"));
            var testFilePath = new Uri(hiveQueryFilePath, UriKind.RelativeOrAbsolute);
            var bytes        = Encoding.UTF8.GetBytes("Select * from hivesampletable where name like '%bat%'");

            using (var stream = new MemoryStream(bytes, 0, bytes.Length))
            {
                wabsStorageClient.UploadFile(testFilePath, stream);
            }
        }