Skip to content

Commit d1cf22a

Browse files
Cleaned up9 a few files and added the recordings to the csproj
1 parent 16c786f commit d1cf22a

File tree

8 files changed

+15
-64
lines changed

8 files changed

+15
-64
lines changed

src/ResourceManager/AzureBatch/Commands.Batch.Test/Applications/UploadBatchApplicationCommandTests.cs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ public void UploadBatchApplicationPackageTest()
4545

4646
PSApplicationPackage applicationPackageResponse = new PSApplicationPackage();
4747

48-
batchClientMock.Setup(b => b.AddAndUploadApplicationPackage(resourceGroup, accountName, applicationId, version, filePath, format)).Returns(applicationPackageResponse);
48+
batchClientMock.Setup(b => b.UploadApplicationPackage(resourceGroup, accountName, applicationId, version, filePath, format)).Returns(applicationPackageResponse);
4949

5050
cmdlet.AccountName = accountName;
5151
cmdlet.ResourceGroupName = resourceGroup;
@@ -54,10 +54,11 @@ public void UploadBatchApplicationPackageTest()
5454
cmdlet.ApplicationVersion = version;
5555
cmdlet.Format = format;
5656

57+
5758
commandRuntimeMock.Setup(f => f.ShouldProcess(It.IsAny<string>(), It.IsAny<string>())).Returns(true);
5859
cmdlet.ExecuteCmdlet();
5960

60-
batchClientMock.Verify(b => b.AddAndUploadApplicationPackage(resourceGroup, accountName, applicationId, version, filePath, format), Times.Once());
61+
batchClientMock.Verify(b => b.UploadApplicationPackage(resourceGroup, accountName, applicationId, version, filePath, format), Times.Once());
6162
}
6263
}
6364
}

src/ResourceManager/AzureBatch/Commands.Batch.Test/Commands.Batch.Test.csproj

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -344,6 +344,11 @@
344344
<None Include="SessionRecords\Microsoft.Azure.Commands.Batch.Test.ScenarioTests.BatchAccountTests\TestUpdatesExistingBatchAccount.json">
345345
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
346346
</None>
347+
<None Include="SessionRecords\Microsoft.Azure.Commands.Batch.Test.ScenarioTests.BatchApplicationTests\TestCreatePoolWithApplicationPackage.json" />
348+
<None Include="SessionRecords\Microsoft.Azure.Commands.Batch.Test.ScenarioTests.BatchApplicationTests\TestUpdateApplicationPackage.json" />
349+
<None Include="SessionRecords\Microsoft.Azure.Commands.Batch.Test.ScenarioTests.BatchApplicationTests\TestUpdatePoolWithApplicationPackage.json" />
350+
<None Include="SessionRecords\Microsoft.Azure.Commands.Batch.Test.ScenarioTests.BatchApplicationTests\TestUploadApplication.json" />
351+
<None Include="SessionRecords\Microsoft.Azure.Commands.Batch.Test.ScenarioTests.BatchApplicationTests\TestUploadApplicationPackage.json" />
347352
<None Include="SessionRecords\Microsoft.Azure.Commands.Batch.Test.ScenarioTests.CertificateTests\TestAddCertificate.json">
348353
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
349354
</None>
@@ -542,6 +547,7 @@
542547
<None Include="SessionRecords\Microsoft.Azure.Commands.Batch.Test.ScenarioTests.JobTests\TestGetJobById.json">
543548
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
544549
</None>
550+
<None Include="SessionRecords\Microsoft.Azure.Commands.Batch.Test.ScenarioTests.JobTests\TestJobWithTaskDependencies.json" />
545551
<None Include="SessionRecords\Microsoft.Azure.Commands.Batch.Test.ScenarioTests.JobTests\TestListAllJobs.json">
546552
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
547553
</None>

src/ResourceManager/AzureBatch/Commands.Batch/Applications/GetBatchApplicationCommand.cs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@ namespace Microsoft.Azure.Commands.Batch
2424
[Cmdlet(VerbsCommon.Get, Constants.AzureRmBatchApplication), OutputType(typeof(PSApplication))]
2525
public class GetBatchApplicationCommand : BatchCmdletBase
2626
{
27-
[Alias("Name")]
2827
[Parameter(Position = 0, ValueFromPipelineByPropertyName = true, Mandatory = true, HelpMessage = "TODO")]
2928
[ValidateNotNullOrEmpty]
3029
public string AccountName { get; set; }

src/ResourceManager/AzureBatch/Commands.Batch/Applications/RemoveBatchApplicationCommand.cs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,8 @@ namespace Microsoft.Azure.Commands.Batch
2121
[Cmdlet(VerbsCommon.Remove, Constants.AzureRmBatchApplication)]
2222
public class RemoveBatchApplicationCommand : BatchCmdletBase
2323
{
24-
private static string mamlCall = "DeleteApplication";
24+
private static string mamlCall = "RemoveApplication";
2525

26-
[Alias("Name")]
2726
[Parameter(Position = 0, ValueFromPipelineByPropertyName = true, Mandatory = true, HelpMessage = "TODO")]
2827
[ValidateNotNullOrEmpty]
2928
public string AccountName { get; set; }

src/ResourceManager/AzureBatch/Commands.Batch/Applications/RemoveBatchApplicationPackageCommand.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,9 @@ namespace Microsoft.Azure.Commands.Batch
2121
[Cmdlet(VerbsCommon.Remove, Constants.AzureRmBatchApplicationPackage)]
2222
public class RemoveBatchApplicationPackageCommand : BatchCmdletBase
2323
{
24-
private static string mamlCall = "DeleteApplicationPackage";
24+
private static string mamlCall = "RemoveApplicationPackage";
25+
2526

26-
[Alias("Name")]
2727
[Parameter(Position = 0, ValueFromPipelineByPropertyName = true, Mandatory = true, HelpMessage = "TODO")]
2828
[ValidateNotNullOrEmpty]
2929
public string AccountName { get; set; }

src/ResourceManager/AzureBatch/Commands.Batch/Applications/SetBatchApplicationCommand.cs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,8 @@ namespace Microsoft.Azure.Commands.Batch
2121
[Cmdlet(VerbsCommon.Set, Constants.AzureRmBatchApplication)]
2222
public class SetBatchApplicationCommand : BatchCmdletBase
2323
{
24-
private static string mamlCall = "UpdateApplication";
24+
private static string mamlCall = "SetApplication";
2525

26-
[Alias("Name")]
2726
[Parameter(Position = 0, ValueFromPipelineByPropertyName = true, Mandatory = true, HelpMessage = "TODO")]
2827
[ValidateNotNullOrEmpty]
2928
public string AccountName { get; set; }

src/ResourceManager/AzureBatch/Commands.Batch/Models/BatchAccountContext.cs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -215,7 +215,6 @@ internal void ConvertAccountResourceToAccountContext(AccountResource resource)
215215
this.ResourceGroupName = idParts[4];
216216
}
217217

218-
219218
/// <summary>
220219
/// Create a new BAC and fill it in
221220
/// </summary>

src/ResourceManager/AzureBatch/Commands.Batch/Models/BatchClient.Applications.cs

Lines changed: 2 additions & 54 deletions
Original file line numberDiff line numberDiff line change
@@ -104,9 +104,7 @@ public virtual PSApplicationPackage GetApplicationPackage(string resourceGroupNa
104104
applicationId,
105105
version);
106106

107-
108-
PSApplicationPackage applicationPackage = this.ConvertGetApplicationPackageResponseToApplicationPackage(response);
109-
return applicationPackage;
107+
return this.ConvertGetApplicationPackageResponseToApplicationPackage(response);
110108
}
111109

112110
public virtual IEnumerable<PSApplication> ListApplications(string resourceGroupName, string accountName)
@@ -164,56 +162,6 @@ public virtual AzureOperationResponse UpdateApplication(
164162
uap);
165163
}
166164

167-
public virtual PSApplicationPackage AddAndUploadApplicationPackage(
168-
string resourceGroupName,
169-
string accountName,
170-
string applicationId,
171-
string version,
172-
string filePath,
173-
string format)
174-
{
175-
if (!File.Exists(filePath))
176-
{
177-
throw new FileNotFoundException("File not found: " + filePath);
178-
}
179-
180-
if (string.IsNullOrEmpty(resourceGroupName))
181-
{
182-
// use resource mgr to see if account exists and then use resource group name to do the actual lookup
183-
resourceGroupName = GetGroupForAccount(accountName);
184-
}
185-
186-
AddApplicationPackageResponse response = BatchManagementClient.Applications.AddApplicationPackage(
187-
resourceGroupName,
188-
accountName,
189-
applicationId,
190-
version);
191-
192-
CloudBlockBlob blob = new CloudBlockBlob(new Uri(response.StorageUrl));
193-
194-
try
195-
{
196-
blob.UploadFromFile(filePath, FileMode.Open);
197-
198-
BatchManagementClient.Applications.ActivateApplicationPackage(
199-
resourceGroupName,
200-
accountName,
201-
applicationId,
202-
version,
203-
new ActivateApplicationPackageParameters { Format = format });
204-
}
205-
catch
206-
{
207-
this.DeleteApplicationPackage(resourceGroupName, accountName, applicationId, version);
208-
throw;
209-
}
210-
211-
PSApplicationPackage getResponse = this.GetApplicationPackage(resourceGroupName, accountName, applicationId, version);
212-
213-
return getResponse;
214-
}
215-
216-
217165
public virtual PSApplicationPackage UploadApplicationPackage(
218166
string resourceGroupName,
219167
string accountName,
@@ -232,7 +180,7 @@ public virtual PSApplicationPackage UploadApplicationPackage(
232180
// use resource mgr to see if account exists and then use resource group name to do the actual lookup
233181
resourceGroupName = GetGroupForAccount(accountName);
234182
}
235-
183+
236184
bool needToCreateAnApplicationPackage;
237185
var storageUrl = GetStorageUrl(resourceGroupName, accountName, applicationId, version, out needToCreateAnApplicationPackage);
238186

0 commit comments

Comments
 (0)