Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
…o dev
  • Loading branch information
unknown committed Feb 6, 2015
2 parents 48ef3b6 + 64a9488 commit e536f87
Show file tree
Hide file tree
Showing 35 changed files with 416 additions and 98 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@
<HintPath>..\..\packages\Microsoft.WindowsAzure.Management.4.0.0\lib\net40\Microsoft.WindowsAzure.Management.dll</HintPath>
</Reference>
<Reference Include="Microsoft.WindowsAzure.Management.Compute">
<HintPath>..\..\packages\Microsoft.WindowsAzure.Management.Compute.8.0.0\lib\net40\Microsoft.WindowsAzure.Management.Compute.dll</HintPath>
<HintPath>..\..\packages\Microsoft.WindowsAzure.Management.Compute.9.0.0\lib\net40\Microsoft.WindowsAzure.Management.Compute.dll</HintPath>
</Reference>
<Reference Include="Microsoft.WindowsAzure.Management.Storage">
<HintPath>..\..\packages\Microsoft.WindowsAzure.Management.Storage.5.0.0\lib\net40\Microsoft.WindowsAzure.Management.Storage.dll</HintPath>
Expand Down
2 changes: 1 addition & 1 deletion src/Common/Commands.Common.Test/packages.config
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
<package id="Microsoft.Net.Http" version="2.2.28" targetFramework="net45" />
<package id="Microsoft.WindowsAzure.ConfigurationManager" version="2.0.3" targetFramework="net45" />
<package id="Microsoft.WindowsAzure.Management" version="4.0.0" targetFramework="net45" />
<package id="Microsoft.WindowsAzure.Management.Compute" version="8.0.0" targetFramework="net45" />
<package id="Microsoft.WindowsAzure.Management.Compute" version="9.0.0" targetFramework="net45" />
<package id="Microsoft.WindowsAzure.Management.Storage" version="5.0.0" targetFramework="net45" />
<package id="Moq" version="4.2.1402.2112" targetFramework="net45" />
<package id="Newtonsoft.Json" version="6.0.4" targetFramework="net45" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@
<HintPath>..\..\packages\Microsoft.WindowsAzure.Management.4.0.0\lib\net40\Microsoft.WindowsAzure.Management.dll</HintPath>
</Reference>
<Reference Include="Microsoft.WindowsAzure.Management.Compute">
<HintPath>..\..\packages\Microsoft.WindowsAzure.Management.Compute.8.0.0\lib\net40\Microsoft.WindowsAzure.Management.Compute.dll</HintPath>
<HintPath>..\..\packages\Microsoft.WindowsAzure.Management.Compute.9.0.0\lib\net40\Microsoft.WindowsAzure.Management.Compute.dll</HintPath>
</Reference>
<Reference Include="Microsoft.WindowsAzure.Management.Storage">
<HintPath>..\..\packages\Microsoft.WindowsAzure.Management.Storage.5.0.0\lib\net40\Microsoft.WindowsAzure.Management.Storage.dll</HintPath>
Expand Down
2 changes: 1 addition & 1 deletion src/Common/Commands.ScenarioTest/packages.config
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
<package id="Microsoft.Net.Http" version="2.2.28" targetFramework="net45" />
<package id="Microsoft.WindowsAzure.ConfigurationManager" version="2.0.3" targetFramework="net45" />
<package id="Microsoft.WindowsAzure.Management" version="4.0.0" targetFramework="net45" />
<package id="Microsoft.WindowsAzure.Management.Compute" version="8.0.0" targetFramework="net45" />
<package id="Microsoft.WindowsAzure.Management.Compute" version="9.0.0" targetFramework="net45" />
<package id="Microsoft.WindowsAzure.Management.Storage" version="5.0.0" targetFramework="net45" />
<package id="Microsoft.WindowsAzure.Management.WebSites" version="4.4.0-prerelease" targetFramework="net45" />
<package id="Newtonsoft.Json" version="6.0.4" targetFramework="net45" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -111,9 +111,8 @@
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\..\packages\Microsoft.WindowsAzure.Management.4.0.0\lib\net40\Microsoft.WindowsAzure.Management.dll</HintPath>
</Reference>
<Reference Include="Microsoft.WindowsAzure.Management.Compute, Version=8.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\..\packages\Microsoft.WindowsAzure.Management.Compute.8.0.0\lib\net40\Microsoft.WindowsAzure.Management.Compute.dll</HintPath>
<Reference Include="Microsoft.WindowsAzure.Management.Compute">
<HintPath>..\..\..\packages\Microsoft.WindowsAzure.Management.Compute.9.0.0\lib\net40\Microsoft.WindowsAzure.Management.Compute.dll</HintPath>
</Reference>
<Reference Include="Microsoft.WindowsAzure.Management.Storage, Version=5.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
<package id="Microsoft.Net.Http" version="2.2.28" targetFramework="net45" />
<package id="Microsoft.WindowsAzure.ConfigurationManager" version="2.0.3" targetFramework="net45" />
<package id="Microsoft.WindowsAzure.Management" version="4.0.0" targetFramework="net45" />
<package id="Microsoft.WindowsAzure.Management.Compute" version="8.0.0" targetFramework="net45" />
<package id="Microsoft.WindowsAzure.Management.Compute" version="9.0.0" targetFramework="net45" />
<package id="Microsoft.WindowsAzure.Management.Storage" version="5.0.0" targetFramework="net45" />
<package id="Newtonsoft.Json" version="6.0.4" targetFramework="net45" />
<package id="System.Spatial" version="5.6.0" targetFramework="net45" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -111,9 +111,8 @@
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\..\packages\Microsoft.WindowsAzure.Management.4.0.0\lib\net40\Microsoft.WindowsAzure.Management.dll</HintPath>
</Reference>
<Reference Include="Microsoft.WindowsAzure.Management.Compute, Version=8.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\..\packages\Microsoft.WindowsAzure.Management.Compute.8.0.0\lib\net40\Microsoft.WindowsAzure.Management.Compute.dll</HintPath>
<Reference Include="Microsoft.WindowsAzure.Management.Compute">
<HintPath>..\..\..\packages\Microsoft.WindowsAzure.Management.Compute.9.0.0\lib\net40\Microsoft.WindowsAzure.Management.Compute.dll</HintPath>
</Reference>
<Reference Include="Microsoft.WindowsAzure.Management.Network, Version=6.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
<package id="Microsoft.Net.Http" version="2.2.28" targetFramework="net45" />
<package id="Microsoft.WindowsAzure.ConfigurationManager" version="2.0.3" targetFramework="net45" />
<package id="Microsoft.WindowsAzure.Management" version="4.0.0" targetFramework="net45" />
<package id="Microsoft.WindowsAzure.Management.Compute" version="8.0.0" targetFramework="net45" />
<package id="Microsoft.WindowsAzure.Management.Compute" version="9.0.0" targetFramework="net45" />
<package id="Microsoft.WindowsAzure.Management.Network" version="6.0.0" targetFramework="net45" />
<package id="Microsoft.WindowsAzure.Management.Storage" version="5.0.0" targetFramework="net45" />
<package id="Newtonsoft.Json" version="6.0.4" targetFramework="net45" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@
<HintPath>..\..\..\packages\Microsoft.WindowsAzure.Management.4.0.0\lib\net40\Microsoft.WindowsAzure.Management.dll</HintPath>
</Reference>
<Reference Include="Microsoft.WindowsAzure.Management.Compute">
<HintPath>..\..\..\packages\Microsoft.WindowsAzure.Management.Compute.8.0.0\lib\net40\Microsoft.WindowsAzure.Management.Compute.dll</HintPath>
<HintPath>..\..\..\packages\Microsoft.WindowsAzure.Management.Compute.9.0.0\lib\net40\Microsoft.WindowsAzure.Management.Compute.dll</HintPath>
</Reference>
<Reference Include="Microsoft.WindowsAzure.Management.Network">
<HintPath>..\..\..\packages\Microsoft.WindowsAzure.Management.Network.6.0.0\lib\net40\Microsoft.WindowsAzure.Management.Network.dll</HintPath>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -239,7 +239,7 @@ public static string DefaultStorageName
}
}

public static void CopyTestData(string srcContainer, string srcBlob, string destContainer, string destBlob)
public static void CopyTestData(string srcContainer, string srcBlob, string destContainer, string destBlob = null)
{
ServiceManagementCmdletTestHelper vmPowershellCmdlets = new ServiceManagementCmdletTestHelper();
Process currentProcess = Process.GetCurrentProcess();
Expand All @@ -262,7 +262,15 @@ public static void CopyTestData(string srcContainer, string srcBlob, string dest
// Make SAS Uri for the source blob.
string srcSasUri = Utilities.GenerateSasUri(CredentialHelper.CredentialBlobUriFormat, storageAccount, storageAccountKey, srcContainer, srcBlob);

vmPowershellCmdlets.RunPSScript(string.Format("Start-AzureStorageBlobCopy -SrcUri \"{0}\" -DestContainer {1} -DestBlob {2} -Force", srcSasUri, destContainer, destBlob));
if (string.IsNullOrEmpty(destBlob))
{
vmPowershellCmdlets.RunPSScript(string.Format("Start-AzureStorageBlobCopy -SrcContainer {0} -SrcBlob {1} -DestContainer {2} -Force", srcContainer, srcBlob, destContainer));
destBlob = srcBlob;
}
else
{
vmPowershellCmdlets.RunPSScript(string.Format("Start-AzureStorageBlobCopy -SrcUri \"{0}\" -DestContainer {1} -DestBlob {2} -Force", srcSasUri, destContainer, destBlob));
}

for (int i = 0; i < 60; i++)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -155,6 +155,7 @@ public void AzureVMImageTest()

try
{
// BVT Tests for OS Images
OSImageContext result = vmPowershellCmdlets.AddAzureVMImage(newImageName, mediaLocation, OS.Windows, oldLabel, vmSize, iconUri, smallIconUri, showInGui);

OSImageContext resultReturned = vmPowershellCmdlets.GetAzureVMImage(newImageName)[0];
Expand All @@ -174,6 +175,97 @@ public void AzureVMImageTest()
vmPowershellCmdlets.RemoveAzureVMImage(newImageName, false);
Assert.IsTrue(Utilities.CheckRemove(vmPowershellCmdlets.GetAzureVMImage, newImageName));

// BVT Tests for VM Images
// Unique Container Prefix
var containerPrefix = Utilities.GetUniqueShortName("vmimg");

// Disk Blobs
var srcVhdName = "os1.vhd";
var srcVhdContainer = vhdContainerName;
var dstOSVhdContainer = containerPrefix.ToLower() + "os" + vhdContainerName;
CredentialHelper.CopyTestData(srcVhdContainer, srcVhdName, dstOSVhdContainer);
string osVhdLink = string.Format("{0}{1}/{2}", blobUrlRoot, dstOSVhdContainer, srcVhdName);

var dstDataVhdContainer = containerPrefix.ToLower() + "data" + vhdContainerName;
CredentialHelper.CopyTestData(srcVhdContainer, srcVhdName, dstDataVhdContainer);
string dataVhdLink = string.Format("{0}{1}/{2}", blobUrlRoot, dstDataVhdContainer, srcVhdName);

// VM Image OS/Data Disk Configuration
var addVMImageName = containerPrefix + "Image";
var diskConfig = new VirtualMachineImageDiskConfigSet
{
OSDiskConfiguration = new OSDiskConfiguration
{
HostCaching = HostCaching.ReadWrite.ToString(),
OS = OSType.Windows.ToString(),
OSState = "Generalized",
MediaLink = new Uri(osVhdLink)
},
DataDiskConfigurations = new DataDiskConfigurationList
{
new DataDiskConfiguration
{
HostCaching = HostCaching.ReadOnly.ToString(),
Lun = 0,
MediaLink = new Uri(dataVhdLink)
}
}
};

// Add-AzureVMImage
string label = addVMImageName;
string description = "test";
string eula = "http://www.bing.com/";
string imageFamily = "Windows";
DateTime? publishedDate = new DateTime(2015, 1, 1);
string privacyUri = "http://www.bing.com/";
string recommendedVMSize = vmSize;
string iconName = "iconName";
string smallIconName = "smallIconName";

vmPowershellCmdlets.AddAzureVMImage(
addVMImageName,
label,
diskConfig,
description,
eula,
imageFamily,
publishedDate,
privacyUri,
recommendedVMSize,
iconName,
smallIconName,
showInGui);

// Get-AzureVMImage
var vmImage = vmPowershellCmdlets.GetAzureVMImageReturningVMImages(addVMImageName).First();

Assert.IsTrue(vmImage.ImageName == addVMImageName);
Assert.IsTrue(vmImage.Label == label);
Assert.IsTrue(vmImage.Description == description);
Assert.IsTrue(vmImage.Eula == eula);
Assert.IsTrue(vmImage.ImageFamily == imageFamily);
Assert.IsTrue(vmImage.PublishedDate.Value.Year == publishedDate.Value.Year);
Assert.IsTrue(vmImage.PublishedDate.Value.Month == publishedDate.Value.Month);
Assert.IsTrue(vmImage.PublishedDate.Value.Day == publishedDate.Value.Day);
Assert.IsTrue(vmImage.PrivacyUri.AbsoluteUri.ToString() == privacyUri);
Assert.IsTrue(vmImage.RecommendedVMSize == recommendedVMSize);
Assert.IsTrue(vmImage.IconName == iconName);
Assert.IsTrue(vmImage.IconUri == iconName);
Assert.IsTrue(vmImage.SmallIconName == smallIconName);
Assert.IsTrue(vmImage.SmallIconUri == smallIconName);
Assert.IsTrue(vmImage.ShowInGui == showInGui);
Assert.IsTrue(vmImage.OSDiskConfiguration.HostCaching == diskConfig.OSDiskConfiguration.HostCaching);
Assert.IsTrue(vmImage.OSDiskConfiguration.OS == diskConfig.OSDiskConfiguration.OS);
Assert.IsTrue(vmImage.OSDiskConfiguration.OSState == diskConfig.OSDiskConfiguration.OSState);
Assert.IsTrue(vmImage.OSDiskConfiguration.MediaLink == diskConfig.OSDiskConfiguration.MediaLink);
Assert.IsTrue(vmImage.DataDiskConfigurations.First().HostCaching == diskConfig.DataDiskConfigurations.First().HostCaching);
Assert.IsTrue(vmImage.DataDiskConfigurations.First().Lun == diskConfig.DataDiskConfigurations.First().Lun);
Assert.IsTrue(vmImage.DataDiskConfigurations.First().MediaLink == diskConfig.DataDiskConfigurations.First().MediaLink);

// Remove-AzureVMImage
vmPowershellCmdlets.RemoveAzureVMImage(addVMImageName);

pass = true;
}
catch (Exception e)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
using System;
using Microsoft.WindowsAzure.Commands.ServiceManagement.Test.FunctionalTests.ConfigDataInfo;
using Microsoft.WindowsAzure.Commands.ServiceManagement.Test.FunctionalTests.PowershellCore;
using Microsoft.WindowsAzure.Commands.ServiceManagement.Model;

namespace Microsoft.WindowsAzure.Commands.ServiceManagement.Test.FunctionalTests.IaasCmdletInfo
{
Expand Down Expand Up @@ -96,5 +97,76 @@ public AddAzureVMImageCmdletInfo(
cmdletParams.Add(new CmdletParam("PublishedDate", publishedDate.ToString()));
}
}

public AddAzureVMImageCmdletInfo(
string imageName,
string label,
VirtualMachineImageDiskConfigSet diskConfig,
string description,
string eula,
string imageFamily,
DateTime? publishedDate,
string privacyUri,
string recommendedVMSize,
string iconName,
string smallIconName,
bool? showInGui)
{
cmdletName = Utilities.AddAzureVMImageCmdletName;

cmdletParams.Add(new CmdletParam("ImageName", imageName));

cmdletParams.Add(new CmdletParam("Label", label));

if (diskConfig != null)
{
cmdletParams.Add(new CmdletParam("DiskConfig", diskConfig));
}

if (!string.IsNullOrEmpty(description))
{
cmdletParams.Add(new CmdletParam("Description", description));
}

if (!string.IsNullOrEmpty(eula))
{
cmdletParams.Add(new CmdletParam("Eula", eula));
}

if (!string.IsNullOrEmpty(imageFamily))
{
cmdletParams.Add(new CmdletParam("ImageFamily", imageFamily));
}

if (publishedDate != null)
{
cmdletParams.Add(new CmdletParam("PublishedDate", publishedDate));
}

if (!string.IsNullOrEmpty(privacyUri))
{
cmdletParams.Add(new CmdletParam("PrivacyUri", privacyUri));
}

if (!string.IsNullOrEmpty(recommendedVMSize))
{
cmdletParams.Add(new CmdletParam("RecommendedVMSize", recommendedVMSize));
}

if (!string.IsNullOrEmpty(iconName))
{
cmdletParams.Add(new CmdletParam("IconName", iconName));
}

if (!string.IsNullOrEmpty(smallIconName))
{
cmdletParams.Add(new CmdletParam("SmallIconName", smallIconName));
}

if (showInGui != null)
{
cmdletParams.Add(new CmdletParam("ShowInGui", showInGui));
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,8 @@ public UpdateAzureVMImageCmdletInfo(
Uri privacyUri,
DateTime publishedDate,
string language,
Uri iconUri,
Uri smallIconUri,
string iconName,
string smallIconName,
bool showInGui)
: this(imageName, label, recommendedSize, null, !showInGui)
{
Expand Down Expand Up @@ -81,13 +81,13 @@ public UpdateAzureVMImageCmdletInfo(
{
cmdletParams.Add(new CmdletParam("Language", language));
}
if (iconUri != null)
if (!string.IsNullOrEmpty(iconName))
{
cmdletParams.Add(new CmdletParam("IconUri", iconUri));
cmdletParams.Add(new CmdletParam("IconName", iconName));
}
if (smallIconUri != null)
if (!string.IsNullOrEmpty(smallIconName))
{
cmdletParams.Add(new CmdletParam("SmallIconUri", smallIconUri));
cmdletParams.Add(new CmdletParam("SmallIconName", smallIconName));
}
}
}
Expand Down
Loading

0 comments on commit e536f87

Please sign in to comment.