Skip to content
This repository was archived by the owner on Feb 23, 2024. It is now read-only.

Commit 76e7b5e

Browse files
odaibertnzthiago
authored andcommitted
Extractor features (#101)
* add schemas to readme * cleanup readme, include space for extractor * fix table of contents routing * extract diagnostic resource and add to template * update to version 2018-06-01-preview, update creator config values * remove name property from creator diagnostic * extract loggers, enable logger and diagnostic iterative deployment * update creator readme * pull named values and substitute them for previously hidden credentials * add validation on additional creator config properties, write tests * refactor - update file structure, namespaces, remove dup classes, * comment out representations on req/res operation schema until schema templates are extracted * Odaibert/operations policies and products (#100) * Added Products extractor to [APIM-NAME]-products.json file * Finished: - [Extractor] Relationship/Association between APIs and products are not extracted #85 - [Extractor] Allow users to specify if they want to extract all APIs or a single API (using apiId) #78 - [Extractor] Extract policies at the operation level #80 - [Extractor] Split APIs into multiple API templates #77
1 parent 7edbe81 commit 76e7b5e

File tree

81 files changed

+1513
-860
lines changed

Some content is hidden

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

81 files changed

+1513
-860
lines changed

src/APIM_ARMTemplate/.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,3 +37,6 @@ msbuild.wrn
3737

3838
# Visual Studio 2015
3939
.vs/
40+
41+
# Local Testing
42+
*validTesting.yml

src/APIM_ARMTemplate/README.md

Lines changed: 181 additions & 61 deletions
Large diffs are not rendered by default.

src/APIM_ARMTemplate/apimtemplate.test/CmdLine/CreateTests.cs

Lines changed: 38 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,9 @@
22
using Xunit;
33
using McMaster.Extensions.CommandLineUtils;
44
using System.IO;
5+
using Microsoft.Azure.Management.ApiManagement.ArmTemplates.Create;
56

6-
namespace Microsoft.Azure.Management.ApiManagement.ArmTemplates
7+
namespace Microsoft.Azure.Management.ApiManagement.ArmTemplates.Test
78
{
89
public class CreateTests
910
{
@@ -110,5 +111,41 @@ public void ShouldFailWithInvalidLinking()
110111
var ex = Assert.ThrowsAny<CommandParsingException>(() => createCommand.Execute(args));
111112
Assert.Contains("LinkTemplatesBaseUrl is required for linked templates", ex.Message);
112113
}
114+
115+
[Fact]
116+
public void ShouldFailWithInvalidVersionSetDisplayName()
117+
{
118+
var createCommand = new CreateCommand();
119+
string[] args = new string[] { "--configFile", String.Concat(this.configExamplesFolder, "invalidVersionSetDisplayName.yml") };
120+
var ex = Assert.ThrowsAny<CommandParsingException>(() => createCommand.Execute(args));
121+
Assert.Contains("Display name is required if an API Version Set is provided", ex.Message);
122+
}
123+
124+
[Fact]
125+
public void ShouldFailWithInvalidVersionSetVersioningScheme()
126+
{
127+
var createCommand = new CreateCommand();
128+
string[] args = new string[] { "--configFile", String.Concat(this.configExamplesFolder, "invalidVersionSetVersioningScheme.yml") };
129+
var ex = Assert.ThrowsAny<CommandParsingException>(() => createCommand.Execute(args));
130+
Assert.Contains("Versioning scheme is required if an API Version Set is provided", ex.Message);
131+
}
132+
133+
[Fact]
134+
public void ShouldFailWithInvalidOperationPolicy()
135+
{
136+
var createCommand = new CreateCommand();
137+
string[] args = new string[] { "--configFile", String.Concat(this.configExamplesFolder, "invalidOperationPolicy.yml") };
138+
var ex = Assert.ThrowsAny<CommandParsingException>(() => createCommand.Execute(args));
139+
Assert.Contains("Policy XML is required if an API operation is provided", ex.Message);
140+
}
141+
142+
[Fact]
143+
public void ShouldFailWithInvalidDiagnosticLoggerId()
144+
{
145+
var createCommand = new CreateCommand();
146+
string[] args = new string[] { "--configFile", String.Concat(this.configExamplesFolder, "invalidDiagnosticLoggerId.yml") };
147+
var ex = Assert.ThrowsAny<CommandParsingException>(() => createCommand.Execute(args));
148+
Assert.Contains("LoggerId is required if an API diagnostic is provided", ex.Message);
149+
}
113150
}
114151
}

src/APIM_ARMTemplate/apimtemplate.test/CmdLine/ExtractTests.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
using McMaster.Extensions.CommandLineUtils;
44

55

6-
namespace Microsoft.Azure.Management.ApiManagement.ArmTemplates
6+
namespace Microsoft.Azure.Management.ApiManagement.ArmTemplates.Test
77
{
88
public class ExtractTests
99
{

src/APIM_ARMTemplate/apimtemplate.test/Creator/FileHandlerTests/FileWriterTests.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@
22
using Xunit;
33
using Newtonsoft.Json.Linq;
44
using System;
5-
using Microsoft.Azure.Management.ApiManagement.ArmTemplates.Create;
5+
using Microsoft.Azure.Management.ApiManagement.ArmTemplates.Common;
66

7-
namespace Microsoft.Azure.Management.ApiManagement.ArmTemplates
7+
namespace Microsoft.Azure.Management.ApiManagement.ArmTemplates.Test
88
{
99
public class FileWriterTests
1010
{

src/APIM_ARMTemplate/apimtemplate.test/Creator/FileHandlerTests/OpenAPISpecReaderTests.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
using Xunit;
2-
using Microsoft.Azure.Management.ApiManagement.ArmTemplates.Create;
32
using Microsoft.OpenApi.Models;
3+
using Microsoft.Azure.Management.ApiManagement.ArmTemplates.Common;
44

5-
namespace Microsoft.Azure.Management.ApiManagement.ArmTemplates
5+
namespace Microsoft.Azure.Management.ApiManagement.ArmTemplates.Test
66
{
77
public class OpenAPISpecReaderTests
88
{

src/APIM_ARMTemplate/apimtemplate.test/Creator/TemplateCreatorFactories/APITemplateCreatorFactory.cs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
1-

2-
namespace Microsoft.Azure.Management.ApiManagement.ArmTemplates.Create
1+
using Microsoft.Azure.Management.ApiManagement.ArmTemplates.Common;
2+
using Microsoft.Azure.Management.ApiManagement.ArmTemplates.Create;
3+
4+
namespace Microsoft.Azure.Management.ApiManagement.ArmTemplates.Test
35
{
46
public class APITemplateCreatorFactory
57
{

src/APIM_ARMTemplate/apimtemplate.test/Creator/TemplateCreatorFactories/APIVersionSetTemplateCreatorFactory.cs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
1-

2-
namespace Microsoft.Azure.Management.ApiManagement.ArmTemplates.Create
1+
using Microsoft.Azure.Management.ApiManagement.ArmTemplates.Create;
2+
3+
namespace Microsoft.Azure.Management.ApiManagement.ArmTemplates.Test
34
{
45
public class APIVersionSetTemplateCreatorFactory
56
{

src/APIM_ARMTemplate/apimtemplate.test/Creator/TemplateCreatorFactories/MasterTemplateCreatorFactory.cs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
1-

2-
namespace Microsoft.Azure.Management.ApiManagement.ArmTemplates.Create
1+
using Microsoft.Azure.Management.ApiManagement.ArmTemplates.Create;
2+
3+
namespace Microsoft.Azure.Management.ApiManagement.ArmTemplates.Test
34
{
45
public class MasterTemplateCreatorFactory
56
{

src/APIM_ARMTemplate/apimtemplate.test/Creator/TemplateCreatorFactories/PolicyTemplateCreatorFactory.cs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
1-

2-
namespace Microsoft.Azure.Management.ApiManagement.ArmTemplates.Create
1+
using Microsoft.Azure.Management.ApiManagement.ArmTemplates.Common;
2+
using Microsoft.Azure.Management.ApiManagement.ArmTemplates.Create;
3+
4+
namespace Microsoft.Azure.Management.ApiManagement.ArmTemplates.Test
35
{
46
public class PolicyTemplateCreatorFactory
57
{

0 commit comments

Comments
 (0)