99import org .testng .annotations .BeforeClass ;
1010import org .testng .annotations .Test ;
1111
12+ import com .axway .apim .adapter .APIManagerAdapter ;
1213import com .axway .apim .api .definition .APISpecification ;
1314import com .axway .apim .api .definition .APISpecificationFactory ;
1415import com .axway .apim .lib .CommandParameters ;
1718import com .fasterxml .jackson .databind .JsonNode ;
1819import com .fasterxml .jackson .databind .ObjectMapper ;
1920import com .fasterxml .jackson .databind .node .ArrayNode ;
21+ import com .fasterxml .jackson .dataformat .yaml .YAMLFactory ;
2022
2123public class APISpecificationOpenAPI3xTest {
2224
2325 private static final String testPackage = "/com/axway/apim/api/definition" ;
2426
2527 ObjectMapper mapper = new ObjectMapper ();
28+ ObjectMapper ymlMapper = new ObjectMapper (new YAMLFactory ());
2629
2730 @ BeforeClass
2831 private void initTestIndicator () {
@@ -35,7 +38,7 @@ private void initTestIndicator() {
3538 public void backendHostAndBasePath () throws AppException , IOException {
3639
3740 byte [] content = getSwaggerContent (testPackage + "/openapi30.json" );
38- APISpecification apiDefinition = APISpecificationFactory .getAPISpecification (content , "teststore.json" , "https://myhost.customer.com:8767/api/v1/myAPI" , "TesAPI " );
41+ APISpecification apiDefinition = APISpecificationFactory .getAPISpecification (content , "teststore.json" , "https://myhost.customer.com:8767/api/v1/myAPI" , "TestAPI " );
3942
4043 // Check if the Swagger-File has been changed
4144 Assert .assertTrue (apiDefinition instanceof OAS3xSpecification );
@@ -44,6 +47,19 @@ public void backendHostAndBasePath() throws AppException, IOException {
4447 Assert .assertEquals ( ((ArrayNode ) swagger .get ("servers" )).get (0 ).get ("url" ).asText (), "https://myhost.customer.com:8767/api/v1/myAPI" );
4548 }
4649
50+ @ Test
51+ public void testBerlinGroupYAM_API () throws AppException , IOException {
52+ APIManagerAdapter .apiManagerVersion ="7.7.0" ;
53+ byte [] content = getSwaggerContent (testPackage + "/psd2-api_1.3.6_errata20200327.yaml" );
54+ APISpecification apiDefinition = APISpecificationFactory .getAPISpecification (content , "teststore.json" , "https://myhost.customer.com:8767/api/v1/myAPI" , "TestAPI" );
55+
56+ // Check if the Swagger-File has been changed
57+ Assert .assertTrue (apiDefinition instanceof OAS3xSpecification );
58+ JsonNode swagger = ymlMapper .readTree (apiDefinition .getApiSpecificationContent ());
59+ Assert .assertEquals ( ((ArrayNode ) swagger .get ("servers" )).size (), 1 , "Expected to get only one server url" );
60+ Assert .assertEquals ( ((ArrayNode ) swagger .get ("servers" )).get (0 ).get ("url" ).asText (), "https://myhost.customer.com:8767/api/v1/myAPI" );
61+ }
62+
4763
4864 private byte [] getSwaggerContent (String swaggerFile ) throws AppException {
4965 try {
0 commit comments