Skip to content

Commit a1f12c8

Browse files
author
begoldsm
committed
Add catalog improvements to ADLA
This includes support for getting/listing packages as well as listing tables, TVFs, statistics and views from higher levels of catalog item paths as well as tests for these operations.
1 parent 800a45c commit a1f12c8

File tree

14 files changed

+9782
-12061
lines changed

14 files changed

+9782
-12061
lines changed

src/ResourceManager/DataLakeAnalytics/Commands.DataLakeAnalytics.Test/Commands.DataLakeAnalytics.Test.csproj

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<?xml version="1.0" encoding="utf-8"?>
2-
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
2+
<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
33
<Import Project="..\..\..\packages\xunit.runner.visualstudio.2.1.0\build\net20\xunit.runner.visualstudio.props" Condition="Exists('..\..\..\packages\xunit.runner.visualstudio.2.1.0\build\net20\xunit.runner.visualstudio.props')" />
44
<Import Project="..\..\..\packages\xunit.core.2.1.0\build\portable-net45+win8+wp8+wpa81\xunit.core.props" Condition="Exists('..\..\..\packages\xunit.core.2.1.0\build\portable-net45+win8+wp8+wpa81\xunit.core.props')" />
55
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
@@ -11,7 +11,7 @@
1111
<AppDesignerFolder>Properties</AppDesignerFolder>
1212
<RootNamespace>Microsoft.Azure.Commands.DataLakeAnalytics.Test</RootNamespace>
1313
<AssemblyName>Microsoft.Azure.Commands.DataLakeAnalytics.Test</AssemblyName>
14-
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
14+
<TargetFrameworkVersion>v4.5.2</TargetFrameworkVersion>
1515
<FileAlignment>512</FileAlignment>
1616
<SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\..\</SolutionDir>
1717
<RestorePackages>true</RestorePackages>
@@ -64,12 +64,12 @@
6464
</Reference>
6565
<Reference Include="Microsoft.Azure.Management.DataLake.Analytics, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
6666
<SpecificVersion>False</SpecificVersion>
67-
<HintPath>..\..\..\packages\Microsoft.Azure.Management.DataLake.Analytics.2.1.1-preview\lib\net45\Microsoft.Azure.Management.DataLake.Analytics.dll</HintPath>
67+
<HintPath>..\..\..\packages\Microsoft.Azure.Management.DataLake.Analytics.2.2.0-preview\lib\net452\Microsoft.Azure.Management.DataLake.Analytics.dll</HintPath>
6868
<Private>True</Private>
6969
</Reference>
7070
<Reference Include="Microsoft.Azure.Management.DataLake.Store, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
7171
<SpecificVersion>False</SpecificVersion>
72-
<HintPath>..\..\..\packages\Microsoft.Azure.Management.DataLake.Store.2.1.1-preview\lib\net45\Microsoft.Azure.Management.DataLake.Store.dll</HintPath>
72+
<HintPath>..\..\..\packages\Microsoft.Azure.Management.DataLake.Store.2.1.1-preview\lib\net452\Microsoft.Azure.Management.DataLake.Store.dll</HintPath>
7373
<Private>True</Private>
7474
</Reference>
7575
<Reference Include="Microsoft.Azure.Management.ResourceManager, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
@@ -104,7 +104,7 @@
104104
</Reference>
105105
<Reference Include="Microsoft.Rest.ClientRuntime, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
106106
<SpecificVersion>False</SpecificVersion>
107-
<HintPath>..\..\..\packages\Microsoft.Rest.ClientRuntime.2.3.5\lib\net45\Microsoft.Rest.ClientRuntime.dll</HintPath>
107+
<HintPath>..\..\..\packages\Microsoft.Rest.ClientRuntime.2.3.6\lib\net45\Microsoft.Rest.ClientRuntime.dll</HintPath>
108108
<Private>True</Private>
109109
</Reference>
110110
<Reference Include="Microsoft.Rest.ClientRuntime.Azure, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">

src/ResourceManager/DataLakeAnalytics/Commands.DataLakeAnalytics.Test/ScenarioTests/AdlaAliasTests.ps1

Lines changed: 55 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -358,9 +358,6 @@ function Test-DataLakeAnalyticsJob
358358
Assert-False {$i -eq 60} "dataLakeAnalytics accounts not in succeeded state even after 30 min."
359359
}
360360

361-
# For now, all Job related tests just ensure that they have a valid response and do not throw.
362-
# Wait for two minutes and 30 seconds prior to attempting to submit the job in the freshly created account.
363-
[Microsoft.Rest.ClientRuntime.Azure.TestFramework.TestUtilities]::Wait(150000)
364361
# submit a job
365362
$guidForJob = [Microsoft.Rest.ClientRuntime.Azure.TestFramework.TestUtilities]::GenerateGuid("jobTest02")
366363
[Microsoft.Azure.Commands.DataLakeAnalytics.Models.DataLakeAnalyticsClient]::JobIdQueue.Enqueue($guidForJob)
@@ -603,10 +600,6 @@ function Test-DataLakeAnalyticsCatalog
603600
Assert-False {$i -eq 60} "dataLakeAnalytics accounts not in succeeded state even after 30 min."
604601
}
605602

606-
# For now, all Job related tests just ensure that they have a valid response and do not throw.
607-
# Wait for two minutes prior to attempting to submit the job in the freshly created account.
608-
[Microsoft.Rest.ClientRuntime.Azure.TestFramework.TestUtilities]::Wait(120000)
609-
610603
# Run a job to create the catalog items (except secret and credential)
611604
$scriptTemplate = @"
612605
DROP DATABASE IF EXISTS {0}; CREATE DATABASE {0};
@@ -747,7 +740,24 @@ function Test-DataLakeAnalyticsCatalog
747740
}
748741

749742
Assert-True {$found} "Could not find the table $tableName in the table list"
750-
743+
# retrieve the list in the database (no schema)
744+
$itemList = Get-AdlCatalogItem -AccountName $accountName -ItemType Table -Path "$databaseName"
745+
746+
Assert-NotNull $itemList "The table list is null"
747+
748+
Assert-True {$itemList.count -gt 0} "The table list is empty"
749+
$found = $false
750+
foreach($item in $itemList)
751+
{
752+
if($item.Name -eq $tableName)
753+
{
754+
$found = $true
755+
break
756+
}
757+
}
758+
759+
Assert-True {$found} "Could not find the table $tableName in the table list"
760+
751761
# retrieve the specific table
752762
$specificItem = Get-AdlCatalogItem -AccountName $accountName -ItemType Table -Path "$databaseName.dbo.$tableName"
753763
Assert-NotNull $specificItem "Could not retrieve the table by name"
@@ -785,6 +795,24 @@ function Test-DataLakeAnalyticsCatalog
785795

786796
Assert-True {$found} "Could not find the TVF $tvfName in the TVF list"
787797

798+
# get the items from just the database (no schema)
799+
$itemList = Get-AdlCatalogItem -AccountName $accountName -ItemType TableValuedFunction -Path "$databaseName"
800+
801+
Assert-NotNull $itemList "The TVF list is null"
802+
803+
Assert-True {$itemList.count -gt 0} "The TVF list is empty"
804+
$found = $false
805+
foreach($item in $itemList)
806+
{
807+
if($item.Name -eq $tvfName)
808+
{
809+
$found = $true
810+
break
811+
}
812+
}
813+
814+
Assert-True {$found} "Could not find the TVF $tvfName in the TVF list"
815+
788816
# retrieve the specific TVF
789817
$specificItem = Get-AdlCatalogItem -AccountName $accountName -ItemType TableValuedFunction -Path "$databaseName.dbo.$tvfName"
790818
Assert-NotNull $specificItem "Could not retrieve the TVF by name"
@@ -831,6 +859,25 @@ function Test-DataLakeAnalyticsCatalog
831859

832860
Assert-True {$found} "Could not find the view $viewName in the view list"
833861

862+
# get views in database only (no schema)
863+
$itemList = Get-AdlCatalogItem -AccountName $accountName -ItemType View -Path "$databaseName"
864+
865+
Assert-NotNull $itemList "The view list is null"
866+
867+
Assert-True {$itemList.count -gt 0} "The view list is empty"
868+
$found = $false
869+
foreach($item in $itemList)
870+
{
871+
if($item.Name -eq $viewName)
872+
{
873+
$found = $true
874+
break
875+
}
876+
}
877+
878+
Assert-True {$found} "Could not find the view $viewName in the view list"
879+
880+
834881
# retrieve the specific view
835882
$specificItem = Get-AdlCatalogItem -AccountName $accountName -ItemType View -Path "$databaseName.dbo.$viewName"
836883
Assert-NotNull $specificItem "Could not retrieve the view by name"

src/ResourceManager/DataLakeAnalytics/Commands.DataLakeAnalytics.Test/ScenarioTests/AdlaTests.ps1

Lines changed: 55 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -358,9 +358,6 @@ function Test-DataLakeAnalyticsJob
358358
Assert-False {$i -eq 60} "dataLakeAnalytics accounts not in succeeded state even after 30 min."
359359
}
360360

361-
# For now, all Job related tests just ensure that they have a valid response and do not throw.
362-
# Wait for two minutes and 30 seconds prior to attempting to submit the job in the freshly created account.
363-
[Microsoft.Rest.ClientRuntime.Azure.TestFramework.TestUtilities]::Wait(150000)
364361
# submit a job
365362
$guidForJob = [Microsoft.Rest.ClientRuntime.Azure.TestFramework.TestUtilities]::GenerateGuid("jobTest01")
366363
[Microsoft.Azure.Commands.DataLakeAnalytics.Models.DataLakeAnalyticsClient]::JobIdQueue.Enqueue($guidForJob)
@@ -601,10 +598,6 @@ function Test-DataLakeAnalyticsCatalog
601598
Assert-False {$i -eq 60} "dataLakeAnalytics accounts not in succeeded state even after 30 min."
602599
}
603600

604-
# For now, all Job related tests just ensure that they have a valid response and do not throw.
605-
# Wait for two minutes prior to attempting to submit the job in the freshly created account.
606-
[Microsoft.Rest.ClientRuntime.Azure.TestFramework.TestUtilities]::Wait(120000)
607-
608601
# Run a job to create the catalog items (except secret and credential)
609602
$scriptTemplate = @"
610603
DROP DATABASE IF EXISTS {0}; CREATE DATABASE {0};
@@ -748,6 +741,24 @@ function Test-DataLakeAnalyticsCatalog
748741

749742
Assert-True {$found} "Could not find the table $tableName in the table list"
750743

744+
# retrieve tables from the db (no schema)
745+
$itemList = Get-AzureRMDataLakeAnalyticsCatalogItem -AccountName $accountName -ItemType Table -Path "$databaseName"
746+
747+
Assert-NotNull $itemList "The table list is null"
748+
749+
Assert-True {$itemList.count -gt 0} "The table list is empty"
750+
$found = $false
751+
foreach($item in $itemList)
752+
{
753+
if($item.Name -eq $tableName)
754+
{
755+
$found = $true
756+
break
757+
}
758+
}
759+
760+
Assert-True {$found} "Could not find the table $tableName in the table list"
761+
751762
# retrieve the specific table
752763
$specificItem = Get-AzureRMDataLakeAnalyticsCatalogItem -AccountName $accountName -ItemType Table -Path "$databaseName.dbo.$tableName"
753764
Assert-NotNull $specificItem "Could not retrieve the table by name"
@@ -785,6 +796,24 @@ function Test-DataLakeAnalyticsCatalog
785796

786797
Assert-True {$found} "Could not find the TVF $tvfName in the TVF list"
787798

799+
# retrieve the TVF list from the db (no schema)
800+
$itemList = Get-AzureRMDataLakeAnalyticsCatalogItem -AccountName $accountName -ItemType TableValuedFunction -Path "$databaseName"
801+
802+
Assert-NotNull $itemList "The TVF list is null"
803+
804+
Assert-True {$itemList.count -gt 0} "The TVF list is empty"
805+
$found = $false
806+
foreach($item in $itemList)
807+
{
808+
if($item.Name -eq $tvfName)
809+
{
810+
$found = $true
811+
break
812+
}
813+
}
814+
815+
Assert-True {$found} "Could not find the TVF $tvfName in the TVF list"
816+
788817
# retrieve the specific TVF
789818
$specificItem = Get-AzureRMDataLakeAnalyticsCatalogItem -AccountName $accountName -ItemType TableValuedFunction -Path "$databaseName.dbo.$tvfName"
790819
Assert-NotNull $specificItem "Could not retrieve the TVF by name"
@@ -831,6 +860,25 @@ function Test-DataLakeAnalyticsCatalog
831860

832861
Assert-True {$found} "Could not find the view $viewName in the view list"
833862

863+
# get the views from the db only (no schema)
864+
$itemList = Get-AzureRMDataLakeAnalyticsCatalogItem -AccountName $accountName -ItemType View -Path "$databaseName"
865+
866+
Assert-NotNull $itemList "The view list is null"
867+
868+
Assert-True {$itemList.count -gt 0} "The view list is empty"
869+
$found = $false
870+
foreach($item in $itemList)
871+
{
872+
if($item.Name -eq $viewName)
873+
{
874+
$found = $true
875+
break
876+
}
877+
}
878+
879+
Assert-True {$found} "Could not find the view $viewName in the view list"
880+
881+
834882
# retrieve the specific view
835883
$specificItem = Get-AzureRMDataLakeAnalyticsCatalogItem -AccountName $accountName -ItemType View -Path "$databaseName.dbo.$viewName"
836884
Assert-NotNull $specificItem "Could not retrieve the view by name"

0 commit comments

Comments
 (0)