Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
srsiva committed Oct 27, 2016
2 parents 2f5af9e + 822386a commit ab48d96
Show file tree
Hide file tree
Showing 11 changed files with 65 additions and 12 deletions.
34 changes: 34 additions & 0 deletions src/Common/Configuration.Tests/CloudConfigurationManagerTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@
// limitations under the License.
//

using System;
using System.Configuration;
using Microsoft.Azure;
using Xunit;
namespace Microsoft.WindowsAzure.Configuration.Test
Expand All @@ -28,5 +30,37 @@ public void TestGetSettingWithNonExistingSettings()

Assert.Null(actual);
}

[Fact]
public void TestGetSettingWithNullParamThrowsArgumentNullException()
{
Assert.Throws<ArgumentNullException>(() =>
{
string actual = CloudConfigurationManager.GetSetting(null);
});
}

[Fact]
public void TestGetSettingWithEmptyStringThrowsArgumentException()
{
Assert.Throws<ArgumentException>(() =>
{
string actual = CloudConfigurationManager.GetSetting("");
});
}

[Fact]
public void TestGetSettingOverloadThatRequiresGettingSettingFromServiceRuntimeWithNonExistingSettingThrowsException()
{
Assert.Throws<SettingsPropertyNotFoundException>(() =>
{
string actual = CloudConfigurationManager
.GetSetting(
name: "notExistingSettingName",
outputResultsToTrace: true,
throwIfNotFoundInRuntime: true);
}
);
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
Microsoft.WindowsAzure.ConfigurationManager
-->
<SdkNuGetPackage Include="Microsoft.WindowsAzure.ConfigurationManager">
<PackageVersion>3.2.2</PackageVersion>
<PackageVersion>3.2.3</PackageVersion>

<Folder>$(MSBuildThisFileDirectory)</Folder>
</SdkNuGetPackage>
Expand Down
2 changes: 1 addition & 1 deletion src/Common/Configuration/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -32,5 +32,5 @@
[assembly: Guid("3a4d8eda-db18-4c6f-9f84-4576bb255f30")]

[assembly: AssemblyVersion("3.0.0.0")]
[assembly: AssemblyFileVersion("3.2.2.0")]
[assembly: AssemblyFileVersion("3.2.3.0")]
[assembly: NeutralResourcesLanguageAttribute("en")]
2 changes: 1 addition & 1 deletion src/Common/Configuration/Properties/Resources.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ public void TestScriptActionsOnRunningCluster()
var result = client.Clusters.ExecuteScriptActions(resourceGroup, dnsName, executeScriptActionParams);
Assert.Equal(result.StatusCode, HttpStatusCode.OK);
Assert.Equal(result.State, AsyncOperationState.Failed);
// Assert.Equal(result.ErrorInfo.Message, "ScriptExecutionFailed");
Assert.Equal(result.ErrorInfo.Message, "ScriptExecutionFailed");

var scriptActionParams = GetExecuteScriptActionParams(true, "script" + Guid.NewGuid().ToString().Substring(0, 10), InstallGiraph);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -693,9 +693,10 @@ private static string Convert(Stream stream)

private IStorageAccess GetStorageAccessObject(bool IsWindowsCluster = false)
{
return new AzureStorageAccess(IsWindowsCluster ? TestUtils.WinStorageAccountName : TestUtils.StorageAccountName,
IsWindowsCluster ? TestUtils.WinStorageAccountKey : TestUtils.StorageAccountKey,
IsWindowsCluster ? TestUtils.WinDefaultContainer : TestUtils.DefaultContainer);
return new AzureStorageAccess(IsWindowsCluster ? TestUtils.WinStorageAccountName : TestUtils.StorageAccountName,
IsWindowsCluster ? TestUtils.WinStorageAccountKey : TestUtils.StorageAccountKey,
IsWindowsCluster ? TestUtils.WinDefaultContainer : TestUtils.DefaultContainer, TestUtils.storageAccountSuffix);

}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,8 @@ public static class TestUtils
public static string WinDefaultContainer = "pattipakawin33";
public static string WinUserName = "admin";
public static string WinPassword = "";
//set storage account suffix appropriately for different environments, for example:core.chinacloudapi.cn
public static string storageAccountSuffix = "";

public static string SQLServerUserName = "";
public static string SQLServerPassword = "";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
// See the License for the specific language governing permissions and
// limitations under the License.
//

using System;
using System.IO;
using System.Net;
using Hyak.Common;
Expand All @@ -34,6 +34,7 @@ public class AzureStorageAccess : IStorageAccess

private string DefaultStorageContainer { get; set; }

private string storageAccountSuffix { get; set; }
/// <summary>
/// Initializes a new instance of the AzureStorageAccess class.
/// </summary>
Expand All @@ -46,18 +47,23 @@ public class AzureStorageAccess : IStorageAccess
/// <param name='defaultStorageContainer'>
/// Required. The default storage container name.
/// </param>
public AzureStorageAccess(string storageAccountName, string storageAccountKey, string defaultStorageContainer)
/// <param name='storageAccountSuffix'>
/// Optional. The storage account URI suffix. For example, "core.chinacloudapi.cn".
/// </param>

public AzureStorageAccess(string storageAccountName, string storageAccountKey, string defaultStorageContainer, string storageAccountSuffix = null)
{
this.StorageAccountName = storageAccountName;
this.StorageAccountKey = storageAccountKey;
this.DefaultStorageContainer = defaultStorageContainer;
this.storageAccountSuffix = storageAccountSuffix;
}

private CloudBlobClient GetStorageClient()
{
var accountName = StorageAccountName.Contains(".") ? StorageAccountName.Substring(0, StorageAccountName.IndexOf('.')) : StorageAccountName;
var storageCredentials = new StorageCredentials(accountName, StorageAccountKey);
var storageAccount = new CloudStorageAccount(storageCredentials, true);
var storageAccount = new CloudStorageAccount(storageCredentials, storageAccountSuffix, true);
return storageAccount.CreateCloudBlobClient();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup>
<SdkNuGetPackage Include="Microsoft.Azure.Management.HDInsight.Job">
<PackageVersion>2.0.3</PackageVersion>
<PackageVersion>2.0.4</PackageVersion>
<Folder>$(MSBuildThisFileDirectory)</Folder>
</SdkNuGetPackage>
</ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,16 @@
<id>Microsoft.Azure.Management.HDInsight.Job</id>
<title>Microsoft Azure HDInsight Job Management Library</title>
<releaseNotes><![CDATA[
2.0.4
* Added support for new environments.
The following API has changed
public AzureStorageAccess(string storageAccountName, string storageAccountKey, string defaultStorageContainer, string storageAccountSuffix = null)
Users can optionally specify the storage account URI suffix, for example : "core.chinacloudapi.cn"
users can now use the GetJobOutput() and GetJobErrorLogs() APIs for the new environments
2.0.3
* Added new API WaitForJobCompletion(string jobId, TimeSpan duration, TimeSpan waitInterval) to wait for completion of a job.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,4 +32,4 @@
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
[assembly: AssemblyVersion("2.0.0.0")]
[assembly: AssemblyFileVersion("2.0.3.0")]
[assembly: AssemblyFileVersion("2.0.4.0")]

0 comments on commit ab48d96

Please sign in to comment.