Skip to content

Commit ce45b8c

Browse files
authored
Merge pull request Azure#9589 from gaurangisaxena/master
Data share
2 parents ac0c5a3 + 2bd5550 commit ce45b8c

File tree

172 files changed

+21888
-0
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

172 files changed

+21888
-0
lines changed
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
<Project Sdk="Microsoft.NET.Sdk">
2+
3+
<PropertyGroup>
4+
<PsModuleName>DataShare</PsModuleName>
5+
</PropertyGroup>
6+
7+
<Import Project="$(MSBuildThisFileDirectory)..\..\Az.Test.props" />
8+
9+
<PropertyGroup>
10+
<RootNamespace>$(LegacyAssemblyPrefix)$(PsModuleName)$(AzTestAssemblySuffix).ScenarioTests</RootNamespace>
11+
</PropertyGroup>
12+
13+
<ItemGroup>
14+
<PackageReference Include="Microsoft.Azure.Management.DataShare" Version="0.9.0-preview" />
15+
</ItemGroup>
16+
17+
</Project>
Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
// ----------------------------------------------------------------------------------
2+
//
3+
// Copyright Microsoft Corporation
4+
// Licensed under the Apache License, Version 2.0 (the "License");
5+
// you may not use this file except in compliance with the License.
6+
// You may obtain a copy of the License at
7+
// http://www.apache.org/licenses/LICENSE-2.0
8+
// Unless required by applicable law or agreed to in writing, software
9+
// distributed under the License is distributed on an "AS IS" BASIS,
10+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11+
// See the License for the specific language governing permissions and
12+
// limitations under the License.
13+
// ----------------------------------------------------------------------------------
14+
15+
using System.Reflection;
16+
using System.Runtime.InteropServices;
17+
using Xunit;
18+
19+
// General Information about an assembly is controlled through the following
20+
// set of attributes. Change these attribute values to modify the information
21+
// associated with an assembly.
22+
[assembly: AssemblyTitle("Microsoft.Azure.Commands.DataShare.Test")]
23+
[assembly: AssemblyDescription("")]
24+
[assembly: AssemblyConfiguration("")]
25+
[assembly: AssemblyCompany("")]
26+
[assembly: AssemblyProduct("Microsoft.Azure.Commands.DataShare.Test")]
27+
[assembly: AssemblyCopyright(Microsoft.WindowsAzure.Commands.Common.AzurePowerShell.AssemblyCopyright)]
28+
[assembly: AssemblyTrademark("")]
29+
[assembly: AssemblyCulture("")]
30+
31+
// Setting ComVisible to false makes the types in this assembly not visible
32+
// to COM components. If you need to access a type in this assembly from
33+
// COM, set the ComVisible attribute to true on that type.
34+
[assembly: ComVisible(false)]
35+
36+
// The following GUID is for the ID of the typelib if this project is exposed to COM
37+
[assembly: Guid("822d5889-438f-4c18-9c06-f5db728d417d")]
38+
39+
// Version information for an assembly consists of the following four values:
40+
//
41+
// Major Version
42+
// Minor Version
43+
// Build Number
44+
// Revision
45+
//
46+
// You can specify all the values or you can default the Build and Revision Numbers
47+
// by using the '*' as shown below:
48+
[assembly: AssemblyVersion("4.0.0")]
49+
[assembly: AssemblyFileVersion("4.0.0")]
50+
[assembly: CollectionBehavior(DisableTestParallelization = true)]
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
// ----------------------------------------------------------------------------------
2+
//
3+
// Copyright Microsoft Corporation
4+
// Licensed under the Apache License, Version 2.0 (the "License");
5+
// you may not use this file except in compliance with the License.
6+
// You may obtain a copy of the License at
7+
// http://www.apache.org/licenses/LICENSE-2.0
8+
// Unless required by applicable law or agreed to in writing, software
9+
// distributed under the License is distributed on an "AS IS" BASIS,
10+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11+
// See the License for the specific language governing permissions and
12+
// limitations under the License.
13+
// ----------------------------------------------------------------------------------
14+
15+
namespace Microsoft.Azure.Commands.DataShare.Test.ScenarioTests.ScenarioTest
16+
{
17+
using Microsoft.WindowsAzure.Commands.ScenarioTest;
18+
using Xunit;
19+
20+
public class AccountTests
21+
{
22+
private readonly ServiceManagement.Common.Models.XunitTracingInterceptor logger;
23+
24+
public AccountTests(Xunit.Abstractions.ITestOutputHelper output)
25+
{
26+
this.logger = new ServiceManagement.Common.Models.XunitTracingInterceptor(output);
27+
ServiceManagement.Common.Models.XunitTracingInterceptor.AddToContext(this.logger);
28+
}
29+
30+
[Fact]
31+
[Trait(Category.AcceptanceType, Category.CheckIn)]
32+
public void TestAccountCrud()
33+
{
34+
TestController.NewInstance.RunPowerShellTest(this.logger, "Test-AccountCrud");
35+
}
36+
}
37+
}
Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
# ----------------------------------------------------------------------------------
2+
#
3+
# Copyright Microsoft Corporation
4+
# Licensed under the Apache License, Version 2.0 (the "License");
5+
# you may not use this file except in compliance with the License.
6+
# You may obtain a copy of the License at
7+
# http://www.apache.org/licenses/LICENSE-2.0
8+
# Unless required by applicable law or agreed to in writing, software
9+
# distributed under the License is distributed on an "AS IS" BASIS,
10+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11+
# See the License for the specific language governing permissions and
12+
# limitations under the License.
13+
# ----------------------------------------------------------------------------------
14+
15+
<#
16+
.SYNOPSIS
17+
Full Account CRUD cycle
18+
#>
19+
function Test-AccountCrud
20+
{
21+
$resourceGroup = TestSetup-CreateResourceGroup
22+
23+
try{
24+
$AccountName = getAssetName
25+
$tags = @{"tag1" = "value1"; "tag2" = "value2"}
26+
$AccountLocation = Get-Location "Microsoft.DataShare" "accounts" "WEST US"
27+
$createdAccount = New-AzDataShareAccount -Name $AccountName -ResourceGroupName $resourceGroup.ResourceGroupName -Location $AccountLocation -Tag $tags
28+
29+
Assert-NotNull $createdAccount
30+
Assert-AreEqual $AccountName $createdAccount.Name
31+
Assert-AreEqual $AccountLocation $createdAccount.location
32+
Assert-Tags $tags $createdAccount.tags
33+
Assert-AreEqual "Succeeded" $createdAccount.ProvisioningState
34+
35+
$retrievedAccount = Get-AzDataShareAccount -Name $AccountName -ResourceGroupName $resourceGroup.ResourceGroupName
36+
37+
Assert-NotNull $retrievedAccount
38+
Assert-AreEqual $AccountName $retrievedAccount.Name
39+
Assert-AreEqual $AccountLocation $retrievedAccount.location
40+
Assert-AreEqual "Succeeded" $retrievedAccount.ProvisioningState
41+
42+
$removed = Remove-AzDataShareAccount -Name $AccountName -ResourceGroupName $resourceGroup.ResourceGroupName -PassThru -Force
43+
44+
Assert-True { $removed }
45+
Assert-ThrowsContains { Get-AzDataShareAccount -Name $AccountName -ResourceGroupName $resourceGroup.ResourceGroupName } "Resource 'sdktestingshareaccount9776' does not exist"
46+
}
47+
finally
48+
{
49+
Remove-AzResourceGroup -Name $resourceGroup.ResourceGroupName -Force
50+
}
51+
}
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
// ----------------------------------------------------------------------------------
2+
//
3+
// Copyright Microsoft Corporation
4+
// Licensed under the Apache License, Version 2.0 (the "License");
5+
// you may not use this file except in compliance with the License.
6+
// You may obtain a copy of the License at
7+
// http://www.apache.org/licenses/LICENSE-2.0
8+
// Unless required by applicable law or agreed to in writing, software
9+
// distributed under the License is distributed on an "AS IS" BASIS,
10+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11+
// See the License for the specific language governing permissions and
12+
// limitations under the License.
13+
// ----------------------------------------------------------------------------------
14+
15+
namespace Microsoft.Azure.Commands.DataShare.Test.ScenarioTests.ScenarioTest
16+
{
17+
using Microsoft.WindowsAzure.Commands.ScenarioTest;
18+
using Xunit;
19+
20+
public class AdlsGen1Tests
21+
{
22+
private readonly ServiceManagement.Common.Models.XunitTracingInterceptor logger;
23+
24+
public AdlsGen1Tests(Xunit.Abstractions.ITestOutputHelper output)
25+
{
26+
this.logger = new ServiceManagement.Common.Models.XunitTracingInterceptor(output);
27+
ServiceManagement.Common.Models.XunitTracingInterceptor.AddToContext(this.logger);
28+
}
29+
30+
[Fact]
31+
[Trait(Category.AcceptanceType, Category.CheckIn)]
32+
public void TestAdlsGen1Crud()
33+
{
34+
TestController.NewInstance.RunPowerShellTest(this.logger, "Test-AdlsGen1Crud");
35+
}
36+
}
37+
}
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2+
# See the License for the specific language governing permissions and
3+
# limitations under the License.
4+
# ----------------------------------------------------------------------------------
5+
6+
<#
7+
.SYNOPSIS
8+
Full DataSet ADLSGen1 CRUD cycle
9+
#>
10+
function Test-AdlsGen1Crud
11+
{
12+
$resourceGroup = getAssetName
13+
14+
try
15+
{
16+
$AccountName = getAssetName
17+
$ShareName = getAssetName
18+
$DataSetName = getAssetName
19+
$StorageAccountId = getAssetName
20+
$FolderPath = getAssetName
21+
$FileName = getAssetName
22+
$createdFolderDataset = New-AzDataShareDataSet -ResourceGroupName $resourceGroup -AccountName $AccountName -ShareName $ShareName -Name $DataSetName -StorageAccountResourceId $StorageAccountId -AdlsGen1FolderPath $FolderPath
23+
24+
Assert-NotNull $createdFolderDataset
25+
Assert-AreEqual $DataSetName $createdFolderDataset.Name
26+
27+
$createdFileDataset = New-AzDataShareDataSet -ResourceGroupName $resourceGroup -AccountName $AccountName -ShareName $ShareName -Name $DataSetName -StorageAccountResourceId $StorageAccountId -AdlsGen1FolderPath $FolderPath -FileName $FileName
28+
29+
Assert-NotNull $createdFileDataset
30+
Assert-AreEqual $DataSetName $createdFileDataset.Name
31+
}
32+
finally
33+
{
34+
Remove-AzResourceGroup -Name $resourceGroup -Force
35+
}
36+
}
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
// ----------------------------------------------------------------------------------
2+
//
3+
// Copyright Microsoft Corporation
4+
// Licensed under the Apache License, Version 2.0 (the "License");
5+
// you may not use this file except in compliance with the License.
6+
// You may obtain a copy of the License at
7+
// http://www.apache.org/licenses/LICENSE-2.0
8+
// Unless required by applicable law or agreed to in writing, software
9+
// distributed under the License is distributed on an "AS IS" BASIS,
10+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11+
// See the License for the specific language governing permissions and
12+
// limitations under the License.
13+
// ----------------------------------------------------------------------------------
14+
15+
namespace Microsoft.Azure.Commands.DataShare.Test.ScenarioTests.ScenarioTest
16+
{
17+
using Microsoft.WindowsAzure.Commands.ScenarioTest;
18+
using Xunit;
19+
20+
public class AdlsGen2Tests
21+
{
22+
private readonly ServiceManagement.Common.Models.XunitTracingInterceptor logger;
23+
24+
public AdlsGen2Tests(Xunit.Abstractions.ITestOutputHelper output)
25+
{
26+
this.logger = new ServiceManagement.Common.Models.XunitTracingInterceptor(output);
27+
ServiceManagement.Common.Models.XunitTracingInterceptor.AddToContext(this.logger);
28+
}
29+
30+
[Fact]
31+
[Trait(Category.AcceptanceType, Category.CheckIn)]
32+
public void TestAdlsGen2Crud()
33+
{
34+
TestController.NewInstance.RunPowerShellTest(this.logger, "Test-AdlsGen2Crud");
35+
}
36+
}
37+
}
Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2+
# See the License for the specific language governing permissions and
3+
# limitations under the License.
4+
# ----------------------------------------------------------------------------------
5+
6+
<#
7+
.SYNOPSIS
8+
Full DataSet ADLSGen2 CRUD cycle
9+
#>
10+
function Test-AdlsGen2Crud
11+
{
12+
$resourceGroup = getAssetName
13+
14+
try
15+
{
16+
$AccountName = getAssetName
17+
$ShareName = getAssetName
18+
$DataSetName = getAssetName
19+
$StorageAccountId = getAssetName
20+
$FileSystemName = getAssetName
21+
$createdFileSystemDataset = New-AzDataShareDataSet -ResourceGroupName $resourceGroup -AccountName $AccountName -ShareName $ShareName -Name $DataSetName -StorageAccountResourceId $StorageAccountId -FileSystem $FileSystemName
22+
23+
Assert-NotNull $createdFileSystemDataset
24+
Assert-AreEqual $DataSetName $createdFileSystemDataset.Name
25+
26+
$FolderPath = getAssetName
27+
$createdFolderDataset = New-AzDataShareDataSet -ResourceGroupName $resourceGroup -AccountName $AccountName -ShareName $ShareName -Name $DataSetName -StorageAccountResourceId $StorageAccountId -FileSystem $FileSystemName -FolderPath $FolderPath
28+
29+
Assert-NotNull $createdFolderDataset
30+
Assert-AreEqual $DataSetName $createdFolderDataset.Name
31+
32+
$FilePath = getAssetName
33+
$createdFileDataSet = New-AzDataShareDataSet -ResourceGroupName $resourceGroup -AccountName $AccountName -ShareName $ShareName -Name $DataSetName -StorageAccountResourceId $StorageAccountId -FileSystem $FileSystemName -FilePath $FilePath
34+
35+
Assert-NotNull $createdFileDataSet
36+
Assert-AreEqual $DataSetName $createdFileDataSet.Name
37+
}
38+
finally
39+
{
40+
Remove-AzResourceGroup -Name $resourceGroup -Force
41+
}
42+
}

0 commit comments

Comments
 (0)