Java Code Examples for com.consol.citrus.context.TestContext#getVariable()

The following examples show how to use com.consol.citrus.context.TestContext#getVariable() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: WebSocketPushEventsListener.java    From citrus-admin with Apache License 2.0 5 votes vote down vote up
/**
 * Extract process id from test context when available.
 * @param testContext
 * @return
 */
private String getProcessId(TestContext testContext) {
    if (testContext != null && testContext.getVariables().containsKey(Citrus.TEST_NAME_VARIABLE)) {
        return testContext.getVariable(Citrus.TEST_NAME_VARIABLE);
    } else {
        return "";
    }
}
 
Example 2
Source File: CalculateIban.java    From citrus-simulator with Apache License 2.0 5 votes vote down vote up
private TestAction calculateIban() {
    return new AbstractTestAction() {
        @Override
        public void doExecute(TestContext context) {
            final String queryParams = context.getVariable(QUERY_PARAMS.name(), String.class);
            final String sortCode = queryParameterService.getSortCode(queryParams);
            final String bankAccountNumber = queryParameterService.getBankAccountNumber(queryParams);
            final String jsonResponse = bankService.calculate(sortCode, bankAccountNumber).asJson();
            context.setVariable(JSON_RESPONSE.name(), jsonResponse);
        }
    };
}
 
Example 3
Source File: ValidateIban.java    From citrus-simulator with Apache License 2.0 5 votes vote down vote up
private TestAction validateIban() {
    return new AbstractTestAction() {
        @Override
        public void doExecute(TestContext context) {
            final String queryParams = context.getVariable(QUERY_PARAMS.name(), String.class);
            final String iban = queryParameterService.getIban(queryParams);
            final String jsonResponse = bankService.validate(iban).asJson();
            context.setVariable(JSON_RESPONSE.name(), jsonResponse);
        }
    };
}
 
Example 4
Source File: ApplicationExportTestIT.java    From apimanager-swagger-promote with Apache License 2.0 4 votes vote down vote up
@CitrusTest
@Test @Parameters("context")
public void run(@Optional @CitrusResource TestContext context) throws IOException {		
	ObjectMapper mapper = new ObjectMapper();

	swaggerExport = new ExportTestAction();
	swaggerImport = new ImportTestAction();
	description("Import an API including applications to export it afterwards");

	variable("apiNumber", RandomNumberFunction.getRandomNumber(3, true));
	variable("apiPath", "/api/test/"+this.getClass().getSimpleName()+"-${apiNumber}");
	variable("apiName", this.getClass().getSimpleName()+"-${apiNumber}");
	variable("state", "published");
	variable("exportLocation", "citrus:systemProperty('java.io.tmpdir')");
	variable(ExportTestAction.EXPORT_API,  "${apiPath}");
	
	// These are the folder and filenames generated by the export tool 
	variable("exportFolder", "api-test-${apiName}");
	variable("exportAPIName", "${apiName}.json");
	
	// ############## Creating Test-Application 1 #################
	createVariable("app1Name", "Consuming Test App 1 ${orgNumber}");
	http(builder -> builder.client("apiManager").send().post("/applications").header("Content-Type", "application/json")
		.payload("{\"name\":\"${app1Name}\",\"apis\":[],\"organizationId\":\"${orgId}\"}"));

	http(builder -> builder.client("apiManager").receive().response(HttpStatus.CREATED).messageType(MessageType.JSON)
		.extractFromPayload("$.id", "consumingTestApp1Id")
		.extractFromPayload("$.name", "consumingTestApp1Name"));
	
	echo("####### Created Test-Application 1: '${consumingTestApp1Name}' with id: '${consumingTestApp1Id}' #######");

	echo("####### Importing the API including applications, which should exported in the second step #######");
	createVariable(ImportTestAction.API_DEFINITION,  "/test/export/files/basic/petstore.json");
	createVariable(ImportTestAction.API_CONFIG,  "/test/export/files/applications/1_api-with-0-org-1-app.json");
	createVariable("consumingTestAppName", "${consumingTestApp1Name}");
	createVariable("expectedReturnCode", "0");
	swaggerImport.doExecute(context);

	echo("####### Export the API including applications from the API-Manager #######");
	createVariable("expectedReturnCode", "0");
	swaggerExport.doExecute(context);
	
	String exportedAPIConfigFile = context.getVariable("exportLocation")+"/"+context.getVariable("exportFolder")+"/api-config.json";
	
	echo("####### Reading exported API-Config file: '"+exportedAPIConfigFile+"' #######");
	JsonNode exportedAPIConfig = mapper.readTree(new FileInputStream(new File(exportedAPIConfigFile)));
	
	assertEquals(exportedAPIConfig.get("version").asText(), 			"1.0.1");
	assertEquals(exportedAPIConfig.get("organization").asText(),		"API Development "+context.getVariable("orgNumber"));
	//assertEquals(exportedAPIConfig.get("backendBasepath").asText(), 	"https://petstore.swagger.io");
	assertEquals(exportedAPIConfig.get("state").asText(), 				"published");
	assertEquals(exportedAPIConfig.get("path").asText(), 				context.getVariable("apiPath"));
	assertEquals(exportedAPIConfig.get("name").asText(), 				context.getVariable("apiName"));
	assertEquals(exportedAPIConfig.get("caCerts").size(), 				3);
	
	assertEquals(exportedAPIConfig.get("caCerts").get(0).get("certFile").asText(), 				"swagger.io.crt");
	assertEquals(exportedAPIConfig.get("caCerts").get(0).get("inbound").asBoolean(), 			false);
	assertEquals(exportedAPIConfig.get("caCerts").get(0).get("outbound").asBoolean(), 			true);
	
	List<ClientApplication> exportedApps = mapper.convertValue(exportedAPIConfig.get("applications"), new TypeReference<List<ClientApplication>>(){});
	assertEquals(exportedApps.size(), 1, "Number of exported apps not correct");
	ClientApplication app = exportedApps.get(0);
	assertNull(app.getApiAccess(), "Exported Apps should not contains API-Access");
	assertNull(app.getId(), "The ID of an application shouldn't be exported.");
	assertNull(app.getOrganizationId(), "The Org-ID of an application shouldn't be exported.");
	assertNull(app.getAppQuota(), "The application quota should not be exported. It's not supported by the export!");
	
	assertTrue(new File(context.getVariable("exportLocation")+"/"+context.getVariable("exportFolder")+"/swagger.io.crt").exists(), "Certificate swagger.io.crt is missing");
	assertTrue(new File(context.getVariable("exportLocation")+"/"+context.getVariable("exportFolder")+"/GoDaddySecureCertificateAuthority-G2.crt").exists(), "Certificate GoDaddySecureCertificateAuthority-G2.crt is missing");
	assertTrue(new File(context.getVariable("exportLocation")+"/"+context.getVariable("exportFolder")+"/GoDaddyRootCertificateAuthority-G2.crt").exists(), "Certificate GoDaddyRootCertificateAuthority-G2.crt is missing");
	
	assertTrue(new File(context.getVariable("exportLocation")+"/"+context.getVariable("exportFolder")+"/"+context.getVariable("exportAPIName")).exists(), "Exported Swagger-File is missing");
}
 
Example 5
Source File: MethodLevelExportTestIT.java    From apimanager-swagger-promote with Apache License 2.0 4 votes vote down vote up
@CitrusTest
@Test @Parameters("context")
public void run(@Optional @CitrusResource TestContext context) throws IOException {		
	ObjectMapper mapper = new ObjectMapper();

	swaggerExport = new ExportTestAction();
	swaggerImport = new ImportTestAction();
	description("Import an API with method level settings to export it afterwards");

	variable("apiNumber", RandomNumberFunction.getRandomNumber(3, true));
	variable("apiPath", "/api/test/"+this.getClass().getSimpleName()+"-${apiNumber}");
	variable("apiName", this.getClass().getSimpleName()+"-${apiNumber}");
	variable("state", "published");
	variable("exportLocation", "citrus:systemProperty('java.io.tmpdir')");
	variable(ExportTestAction.EXPORT_API,  "${apiPath}");
	
	// These are the folder and filenames generated by the export tool 
	variable("exportFolder", "api-test-${apiName}");
	variable("exportAPIName", "${apiName}.json");

	echo("####### Importing the API with method level setting, which should exported in the second step #######");
	createVariable(ImportTestAction.API_DEFINITION,  "/test/export/files/basic/petstore.json");
	createVariable(ImportTestAction.API_CONFIG,  "/test/export/files/methodLevel/inbound-api-key-and-cors.json");
	createVariable("backendBasepath", "http://petstore.swagger.io/v3");
	createVariable("expectedReturnCode", "0");
	swaggerImport.doExecute(context);

	echo("####### Export the API from the API-Manager #######");
	createVariable("expectedReturnCode", "0");
	swaggerExport.doExecute(context);
	
	String exportedAPIConfigFile = context.getVariable("exportLocation")+"/"+context.getVariable("exportFolder")+"/api-config.json";
	
	echo("####### Reading exported API-Config file: '"+exportedAPIConfigFile+"' #######");
	JsonNode exportedAPIConfig = mapper.readTree(new FileInputStream(new File(exportedAPIConfigFile)));
	JsonNode importedAPIConfig = mapper.readTree(this.getClass().getResourceAsStream("/test/export/files/methodLevel/inbound-api-key-and-cors.json"));
	
	

	assertEquals(exportedAPIConfig.get("path").asText(), 				context.getVariable("apiPath"));
	assertEquals(exportedAPIConfig.get("name").asText(), 				context.getVariable("apiName"));
	assertEquals(exportedAPIConfig.get("state").asText(), 				context.getVariable("state"));
	assertEquals(exportedAPIConfig.get("version").asText(), 			"1.0.7");
	assertEquals(exportedAPIConfig.get("organization").asText(),		"API Development "+context.getVariable("orgNumber"));
	//assertEquals(exportedAPIConfig.get("backendBasepath").asText(), 	context.getVariable("backendBasepath"));
	
	Map<String, InboundProfile> importedInboundProfiles = mapper.convertValue(importedAPIConfig.get("inboundProfiles"), new TypeReference<Map<String, InboundProfile>>(){});
	Map<String, InboundProfile> exportedInboundProfiles = mapper.convertValue(exportedAPIConfig.get("inboundProfiles"), new TypeReference<Map<String, InboundProfile>>(){});
	assertEquals(importedInboundProfiles, exportedInboundProfiles, "InboundProfiles are not equal.");
	
	Map<String, OutboundProfile> importedOutboundProfiles = mapper.convertValue(importedAPIConfig.get("outboundProfiles"), new TypeReference<Map<String, OutboundProfile>>(){});
	Map<String, OutboundProfile> exportedOutboundProfiles = mapper.convertValue(exportedAPIConfig.get("outboundProfiles"), new TypeReference<Map<String, OutboundProfile>>(){});
	assertEquals(importedOutboundProfiles, exportedOutboundProfiles, "OutboundProfiles are not equal.");
	
	List<SecurityProfile> importedSecurityProfiles = mapper.convertValue(importedAPIConfig.get("securityProfiles"), new TypeReference<List<SecurityProfile>>(){});
	List<SecurityProfile> exportedSecurityProfiles = mapper.convertValue(exportedAPIConfig.get("securityProfiles"), new TypeReference<List<SecurityProfile>>(){});
	assertEquals(importedSecurityProfiles, exportedSecurityProfiles, "SecurityProfiles are not equal.");
	
	List<SecurityProfile> importedAuthenticationProfiles = mapper.convertValue(importedAPIConfig.get("authenticationProfiles"), new TypeReference<List<AuthenticationProfile>>(){});
	List<SecurityProfile> exportedAuthenticationProfiles = mapper.convertValue(exportedAPIConfig.get("authenticationProfiles"), new TypeReference<List<AuthenticationProfile>>(){});
	assertEquals(importedAuthenticationProfiles, exportedAuthenticationProfiles, "AuthenticationProfiles are not equal.");
	
	TagMap<String, String[]> importedTags = mapper.convertValue(importedAPIConfig.get("tags"), new TypeReference<TagMap<String, String[]>>(){});
	TagMap<String, String[]> exportedTags = mapper.convertValue(exportedAPIConfig.get("tags"), new TypeReference<TagMap<String, String[]>>(){});
	assertEquals(importedTags, exportedTags, "Tags are not equal.");
	
	List<CorsProfile> importedCorsProfiles = mapper.convertValue(importedAPIConfig.get("corsProfiles"), new TypeReference<List<CorsProfile>>(){});
	List<CorsProfile> exportedCorsProfiles = mapper.convertValue(exportedAPIConfig.get("corsProfiles"), new TypeReference<List<CorsProfile>>(){});
	assertEquals(importedCorsProfiles, exportedCorsProfiles, "CorsProfiles are not equal.");
	
	assertTrue(new File(context.getVariable("exportLocation")+"/"+context.getVariable("exportFolder")+"/"+context.getVariable("exportAPIName")).exists(), "Exported Swagger-File is missing");
}
 
Example 6
Source File: DifferentVHostExportTestIT.java    From apimanager-swagger-promote with Apache License 2.0 4 votes vote down vote up
@CitrusTest
@Test @Parameters("context")
public void run(@Optional @CitrusResource TestContext context) throws IOException {		
	ObjectMapper mapper = new ObjectMapper();

	swaggerExport = new ExportTestAction();
	swaggerImport = new ImportTestAction();
	description("Import two APIs each with a different V-Host and export it afterwards");

	variable("apiNumber", RandomNumberFunction.getRandomNumber(3, true));
	variable("apiPath", "/api/test/"+this.getClass().getSimpleName()+"-${apiNumber}");
	variable("apiName", this.getClass().getSimpleName()+"-${apiNumber}");
	variable("state", "published");
	variable("exportLocation", "citrus:systemProperty('java.io.tmpdir')");
	variable(ExportTestAction.EXPORT_API,  "${apiPath}");
	
	// These are the folder and filenames generated by the export tool 
	variable("exportFolder", "api-test-${apiName}");
	variable("exportAPIName", "${apiName}.json");

	echo("####### Importing both APIs, which should exported in the second step #######");
	createVariable(ImportTestAction.API_DEFINITION,  "/test/export/files/basic/petstore.json");
	createVariable(ImportTestAction.API_CONFIG,  "/test/export/files/basic/flex-vhost-config.json");
	createVariable("vhost", "vhost1.customer.com");
	createVariable("version", "1.0.0");
	createVariable("expectedReturnCode", "0");
	swaggerImport.doExecute(context);
	createVariable("enforce", "true");
	createVariable("vhost", "vhost2.customer.com");
	createVariable("version", "2.0.0");
	swaggerImport.doExecute(context);

	echo("####### Export the API with vhost1.customer.com from the API-Manager #######");
	createVariable("expectedReturnCode", "0");
	createVariable("vhostToExport", "vhost1.customer.com");
	swaggerExport.doExecute(context);
	
	String exportedAPIConfigFile = context.getVariable("exportLocation")+"/vhost1.customer.com/"+context.getVariable("exportFolder")+"/api-config.json";
	
	echo("####### Reading exported API-Config file: '"+exportedAPIConfigFile+"' #######");
	JsonNode exportedAPIConfig = mapper.readTree(new FileInputStream(new File(exportedAPIConfigFile)));
	
	assertEquals(exportedAPIConfig.get("version").asText(), 		"1.0.0");
	assertEquals(exportedAPIConfig.get("vhost").asText(), 			"vhost1.customer.com");

	
	echo("####### Export the API with vhost2.customer.com from the API-Manager #######");
	createVariable("expectedReturnCode", "0");
	createVariable("vhostToExport", "vhost2.customer.com");
	swaggerExport.doExecute(context);
	
	exportedAPIConfigFile = context.getVariable("exportLocation")+"/vhost2.customer.com/"+context.getVariable("exportFolder")+"/api-config.json";
	
	echo("####### Reading exported API-Config file: '"+exportedAPIConfigFile+"' #######");
	exportedAPIConfig = mapper.readTree(new FileInputStream(new File(exportedAPIConfigFile)));
	
	assertEquals(exportedAPIConfig.get("version").asText(), 		"2.0.0");
	assertEquals(exportedAPIConfig.get("vhost").asText(), 			"vhost2.customer.com");
}
 
Example 7
Source File: SimpleAPIExportTestIT.java    From apimanager-swagger-promote with Apache License 2.0 4 votes vote down vote up
@CitrusTest
@Test @Parameters("context")
public void run(@Optional @CitrusResource TestContext context) throws IOException {		
	ObjectMapper mapper = new ObjectMapper();

	swaggerExport = new ExportTestAction();
	swaggerImport = new ImportTestAction();
	description("Import an API to export it afterwards");

	variable("apiNumber", RandomNumberFunction.getRandomNumber(3, true));
	variable("apiPath", "/api/test/"+this.getClass().getSimpleName()+"-${apiNumber}");
	variable("apiName", this.getClass().getSimpleName()+"-${apiNumber}");
	variable("state", "unpublished");
	variable("exportLocation", "citrus:systemProperty('java.io.tmpdir')");
	variable(ExportTestAction.EXPORT_API,  "${apiPath}");
	
	// These are the folder and filenames generated by the export tool 
	variable("exportFolder", "api-test-${apiName}");
	variable("exportAPIName", "${apiName}.json");

	echo("####### Importing the API, which should exported in the second step #######");
	createVariable(ImportTestAction.API_DEFINITION,  "/test/export/files/basic/petstore.json");
	createVariable(ImportTestAction.API_CONFIG,  "/test/export/files/basic/minimal-config.json");
	createVariable("expectedReturnCode", "0");
	swaggerImport.doExecute(context);

	echo("####### Export the API from the API-Manager #######");
	createVariable("expectedReturnCode", "0");
	swaggerExport.doExecute(context);
	
	String exportedAPIConfigFile = context.getVariable("exportLocation")+"/"+context.getVariable("exportFolder")+"/api-config.json";
	
	echo("####### Reading exported API-Config file: '"+exportedAPIConfigFile+"' #######");
	JsonNode exportedAPIConfig = mapper.readTree(new FileInputStream(new File(exportedAPIConfigFile)));
	
	assertEquals(exportedAPIConfig.get("version").asText(), 			"2.0.0");
	assertEquals(exportedAPIConfig.get("organization").asText(),		"API Development "+context.getVariable("orgNumber"));
	//assertEquals(exportedAPIConfig.get("backendBasepath").asText(), 	"https://petstore.swagger.io");
	assertEquals(exportedAPIConfig.get("state").asText(), 				"unpublished");
	assertEquals(exportedAPIConfig.get("path").asText(), 				context.getVariable("apiPath"));
	assertEquals(exportedAPIConfig.get("name").asText(), 				context.getVariable("apiName"));
	assertEquals(exportedAPIConfig.get("caCerts").size(), 				3);
	
	assertEquals(exportedAPIConfig.get("caCerts").get(0).get("certFile").asText(), 				"swagger.io.crt");
	assertEquals(exportedAPIConfig.get("caCerts").get(0).get("inbound").asBoolean(), 			false);
	assertEquals(exportedAPIConfig.get("caCerts").get(0).get("outbound").asBoolean(), 			true);
	
	assertTrue(new File(context.getVariable("exportLocation")+"/"+context.getVariable("exportFolder")+"/swagger.io.crt").exists(), "Certificate swagger.io.crt is missing");
	assertTrue(new File(context.getVariable("exportLocation")+"/"+context.getVariable("exportFolder")+"/GoDaddySecureCertificateAuthority-G2.crt").exists(), "Certificate GoDaddySecureCertificateAuthority-G2.crt is missing");
	assertTrue(new File(context.getVariable("exportLocation")+"/"+context.getVariable("exportFolder")+"/GoDaddyRootCertificateAuthority-G2.crt").exists(), "Certificate GoDaddyRootCertificateAuthority-G2.crt is missing");
	
	assertTrue(new File(context.getVariable("exportLocation")+"/"+context.getVariable("exportFolder")+"/"+context.getVariable("exportAPIName")).exists(), "Exported Swagger-File is missing");
}
 
Example 8
Source File: ImageAPIExportTestIT.java    From apimanager-swagger-promote with Apache License 2.0 4 votes vote down vote up
@CitrusTest
@Test @Parameters("context")
public void run(@Optional @CitrusResource TestContext context) throws IOException {		
	ObjectMapper mapper = new ObjectMapper();

	swaggerExport = new ExportTestAction();
	swaggerImport = new ImportTestAction();
	description("Import an API to export it afterwards");

	variable("apiNumber", RandomNumberFunction.getRandomNumber(3, true));
	variable("apiPath", "/api/test/"+this.getClass().getSimpleName()+"-${apiNumber}");
	variable("apiName", this.getClass().getSimpleName()+"-${apiNumber}");
	variable("state", "unpublished");
	variable("exportLocation", "citrus:systemProperty('java.io.tmpdir')");
	variable(ExportTestAction.EXPORT_API,  "${apiPath}");
	
	// These are the folder and filenames generated by the export tool 
	variable("exportFolder", "api-test-${apiName}");
	variable("exportAPIName", "${apiName}.json");

	echo("####### Importing the API, which should exported in the second step #######");
	createVariable(ImportTestAction.API_DEFINITION,  "/test/export/files/basic/petstore.json");
	createVariable(ImportTestAction.API_CONFIG,  "/test/export/files/basic/api-with-image.json");
	createVariable("image", "/com/axway/apim/test/files/basic/API-Logo.jpg");
	createVariable("expectedReturnCode", "0");
	swaggerImport.doExecute(context);

	echo("####### Export the API from the API-Manager, we expect the image to be present and referenced #######");
	createVariable("expectedReturnCode", "0");
	swaggerExport.doExecute(context);
	
	String exportedAPIConfigFile = context.getVariable("exportLocation")+"/"+context.getVariable("exportFolder")+"/api-config.json";
	
	echo("####### Reading exported API-Config file: '"+exportedAPIConfigFile+"' #######");
	JsonNode exportedAPIConfig = mapper.readTree(new FileInputStream(new File(exportedAPIConfigFile)));
	
	assertEquals(exportedAPIConfig.get("version").asText(), 			"1.0.0");
	assertEquals(exportedAPIConfig.get("organization").asText(),		"API Development "+context.getVariable("orgNumber"));
	//assertEquals(exportedAPIConfig.get("backendBasepath").asText(), 	"https://petstore.swagger.io");
	assertEquals(exportedAPIConfig.get("state").asText(), 				"unpublished");
	assertEquals(exportedAPIConfig.get("path").asText(), 				context.getVariable("apiPath"));
	assertEquals(exportedAPIConfig.get("name").asText(), 				context.getVariable("apiName"));
	assertEquals(exportedAPIConfig.get("caCerts").size(), 				3);
	assertEquals(exportedAPIConfig.get("image").asText(), 				"api-image.jpg");
	
	assertEquals(exportedAPIConfig.get("caCerts").get(0).get("certFile").asText(), 				"swagger.io.crt");
	assertEquals(exportedAPIConfig.get("caCerts").get(0).get("inbound").asBoolean(), 			false);
	assertEquals(exportedAPIConfig.get("caCerts").get(0).get("outbound").asBoolean(), 			true);
	
	assertTrue(new File(context.getVariable("exportLocation")+"/"+context.getVariable("exportFolder")+"/swagger.io.crt").exists(), "Certificate swagger.io.crt is missing");
	assertTrue(new File(context.getVariable("exportLocation")+"/"+context.getVariable("exportFolder")+"/GoDaddySecureCertificateAuthority-G2.crt").exists(), "Certificate GoDaddySecureCertificateAuthority-G2.crt is missing");
	assertTrue(new File(context.getVariable("exportLocation")+"/"+context.getVariable("exportFolder")+"/GoDaddyRootCertificateAuthority-G2.crt").exists(), "Certificate GoDaddyRootCertificateAuthority-G2.crt is missing");
	
	assertTrue(new File(context.getVariable("exportLocation")+"/"+context.getVariable("exportFolder")+"/"+context.getVariable("exportAPIName")).exists(), "Exported Swagger-File is missing");
	
	assertTrue(new File(context.getVariable("exportLocation")+"/"+context.getVariable("exportFolder")+"/api-image.jpg").exists(), "Exported Swagger-File is missing");
}
 
Example 9
Source File: WildcardAPIExportTestIT.java    From apimanager-swagger-promote with Apache License 2.0 4 votes vote down vote up
@CitrusTest
@Test @Parameters("context")
public void run(@Optional @CitrusResource TestContext context) throws IOException {		
	ObjectMapper mapper = new ObjectMapper();

	swaggerExport = new ExportTestAction();
	swaggerImport = new ImportTestAction();
	description("Import two APIs to export them afterwards");

	variable("apiNumber", RandomNumberFunction.getRandomNumber(3, true));
	variable("apiPath1", "/api/test/"+this.getClass().getSimpleName()+"-${apiNumber}/1");
	variable("apiPath2", "/api/test/"+this.getClass().getSimpleName()+"-${apiNumber}/2");
	variable("apiName1", this.getClass().getSimpleName()+"-${apiNumber}-1");
	variable("apiName2", this.getClass().getSimpleName()+"-${apiNumber}-2");
	variable("state", "unpublished");
	variable("exportLocation", "citrus:systemProperty('java.io.tmpdir')/"+this.getClass().getSimpleName()+"-${apiNumber}");
	
	// These are the folder and filenames generated by the export tool 
	variable("exportFolder1", "api-test-${apiName1}");
	variable("exportFolder2", "api-test-${apiName2}");
	variable("exportAPIName1", "${apiName1}.json");
	variable("exportAPIName2", "${apiName2}.json");

	echo("####### Importing the API 1, which should exported in the second step #######");
	createVariable(ImportTestAction.API_DEFINITION,  "/test/export/files/basic/petstore.json");
	createVariable(ImportTestAction.API_CONFIG,  "/test/export/files/basic/minimal-config.json");
	createVariable("apiPath", "${apiPath1}");
	createVariable("apiName", "${apiName1}");
	createVariable("expectedReturnCode", "0");
	swaggerImport.doExecute(context);
	
	echo("####### Importing the API 2, which should exported in the second step #######");
	createVariable(ImportTestAction.API_DEFINITION,  "/test/export/files/basic/petstore.json");
	createVariable(ImportTestAction.API_CONFIG,  "/test/export/files/basic/minimal-config.json");
	createVariable("apiPath", "${apiPath2}");
	createVariable("apiName", "${apiName2}");
	createVariable("expectedReturnCode", "0");
	swaggerImport.doExecute(context);

	echo("####### Export the API2 from the API-Manager #######");
	createVariable(ExportTestAction.EXPORT_API,  "/api/test/"+this.getClass().getSimpleName()+"-${apiNumber}*");
	createVariable("expectedReturnCode", "0");
	swaggerExport.doExecute(context);
	
	String exportedAPIConfigFile = context.getVariable("exportLocation")+"/"+context.getVariable("exportFolder1")+"/api-config.json";
	
	echo("####### Reading exported API-Config file: '"+exportedAPIConfigFile+"' #######");
	JsonNode exportedAPIConfig = mapper.readTree(new FileInputStream(new File(exportedAPIConfigFile)));
	
	assertEquals(exportedAPIConfig.get("version").asText(), 			"2.0.0");
	assertEquals(exportedAPIConfig.get("organization").asText(),		"API Development "+context.getVariable("orgNumber"));
	//assertEquals(exportedAPIConfig.get("backendBasepath").asText(), 	"https://petstore.swagger.io");
	assertEquals(exportedAPIConfig.get("state").asText(), 				"unpublished");
	assertEquals(exportedAPIConfig.get("path").asText(), 				context.getVariable("apiPath1"));
	assertEquals(exportedAPIConfig.get("name").asText(), 				context.getVariable("apiName1"));
	assertEquals(exportedAPIConfig.get("caCerts").size(), 				3);
	
	assertEquals(exportedAPIConfig.get("caCerts").get(0).get("certFile").asText(), 				"swagger.io.crt");
	assertEquals(exportedAPIConfig.get("caCerts").get(0).get("inbound").asBoolean(), 			false);
	assertEquals(exportedAPIConfig.get("caCerts").get(0).get("outbound").asBoolean(), 			true);
	
	assertTrue(new File(context.getVariable("exportLocation")+"/"+context.getVariable("exportFolder1")+"/swagger.io.crt").exists(), "Certificate swagger.io.crt is missing");
	assertTrue(new File(context.getVariable("exportLocation")+"/"+context.getVariable("exportFolder1")+"/GoDaddySecureCertificateAuthority-G2.crt").exists(), "Certificate GoDaddySecureCertificateAuthority-G2.crt is missing");
	assertTrue(new File(context.getVariable("exportLocation")+"/"+context.getVariable("exportFolder1")+"/GoDaddyRootCertificateAuthority-G2.crt").exists(), "Certificate GoDaddyRootCertificateAuthority-G2.crt is missing");
	
	assertTrue(new File(context.getVariable("exportLocation")+"/"+context.getVariable("exportFolder1")+"/"+context.getVariable("exportAPIName1")).exists(), "Exported Swagger-File is missing");
	
	exportedAPIConfigFile = context.getVariable("exportLocation")+"/"+context.getVariable("exportFolder2")+"/api-config.json";
	
	echo("####### Reading exported API-Config file: '"+exportedAPIConfigFile+"' #######");
	exportedAPIConfig = mapper.readTree(new FileInputStream(new File(exportedAPIConfigFile)));
	
	assertEquals(exportedAPIConfig.get("version").asText(), 			"2.0.0");
	assertEquals(exportedAPIConfig.get("organization").asText(),		"API Development "+context.getVariable("orgNumber"));
	//assertEquals(exportedAPIConfig.get("backendBasepath").asText(), 	"https://petstore.swagger.io");
	assertEquals(exportedAPIConfig.get("state").asText(), 				"unpublished");
	assertEquals(exportedAPIConfig.get("path").asText(), 				context.getVariable("apiPath2"));
	assertEquals(exportedAPIConfig.get("name").asText(), 				context.getVariable("apiName2"));
	assertEquals(exportedAPIConfig.get("caCerts").size(), 				3);
	
	assertEquals(exportedAPIConfig.get("caCerts").get(0).get("certFile").asText(), 				"swagger.io.crt");
	assertEquals(exportedAPIConfig.get("caCerts").get(0).get("inbound").asBoolean(), 			false);
	assertEquals(exportedAPIConfig.get("caCerts").get(0).get("outbound").asBoolean(), 			true);
	
	assertTrue(new File(context.getVariable("exportLocation")+"/"+context.getVariable("exportFolder2")+"/swagger.io.crt").exists(), "Certificate swagger.io.crt is missing");
	assertTrue(new File(context.getVariable("exportLocation")+"/"+context.getVariable("exportFolder2")+"/GoDaddySecureCertificateAuthority-G2.crt").exists(), "Certificate GoDaddySecureCertificateAuthority-G2.crt is missing");
	assertTrue(new File(context.getVariable("exportLocation")+"/"+context.getVariable("exportFolder2")+"/GoDaddyRootCertificateAuthority-G2.crt").exists(), "Certificate GoDaddyRootCertificateAuthority-G2.crt is missing");
	
	assertTrue(new File(context.getVariable("exportLocation")+"/"+context.getVariable("exportFolder2")+"/"+context.getVariable("exportAPIName2")).exists(), "Exported Swagger-File is missing");
}
 
Example 10
Source File: CompleteAPIExportTestIT.java    From apimanager-swagger-promote with Apache License 2.0 4 votes vote down vote up
private void exportAPI(TestContext context, boolean ignoreAdminAccount) throws FileNotFoundException, IOException {
	variable("exportLocation", "citrus:systemProperty('java.io.tmpdir')");
	variable(ExportTestAction.EXPORT_API,  "${apiPath}");

	// These are the folder and filenames generated by the export tool 
	createVariable("exportFolder", "api-test-${apiName}");
	createVariable("exportAPIName", "${apiName}.json");
	
	if(ignoreAdminAccount) {
		echo("####### Exporting the API with Org-Admin permissions only #######");
		createVariable("exportLocation", "${exportLocation}/orgAdmin");
		createVariable("apiManagerUser", "${oadminUsername1}"); // This is an org-admin user
		createVariable("apiManagerPass", "${oadminPassword1}");
		createVariable("ignoreAdminAccount", "true"); // Don't use the Admin-Account given in the env.properties for this test
	} else {
		createVariable("exportLocation", "${exportLocation}/ignoreAdminAccount");
		echo("####### Exporting the API with Admin permissions #######");
	}
	
	echo("####### Export the API from the API-Manager #######");
	createVariable("expectedReturnCode", "0");
	swaggerExport.doExecute(context);
	
	String exportedAPIConfigFile = context.getVariable("exportLocation")+"/api.custom-host.com/"+context.getVariable("exportFolder")+"/api-config.json";
	
	echo("####### Reading exported API-Config file: '"+exportedAPIConfigFile+"' #######");
	JsonNode exportedAPIConfig = mapper.readTree(new FileInputStream(new File(exportedAPIConfigFile)));
	JsonNode importedAPIConfig = mapper.readTree(this.getClass().getResourceAsStream("/test/export/files/basic/complete-config.json"));

	assertEquals(exportedAPIConfig.get("path").asText(), 				context.getVariable("apiPath"));
	assertEquals(exportedAPIConfig.get("name").asText(), 				context.getVariable("apiName"));
	assertEquals(exportedAPIConfig.get("state").asText(), 				context.getVariable("state"));
	assertEquals(exportedAPIConfig.get("version").asText(), 			"1.0.0");
	assertEquals(exportedAPIConfig.get("organization").asText(),		"API Development "+context.getVariable("orgNumber"));
	assertEquals(exportedAPIConfig.get("summary").asText(), 			"My complete API-Summary");
	assertEquals(exportedAPIConfig.get("descriptionType").asText(), 	"manual");
	assertEquals(exportedAPIConfig.get("descriptionManual").asText(), 	"This is my __markdown__ based API description.");
	assertEquals(exportedAPIConfig.get("descriptionManual").asText(), 	"This is my __markdown__ based API description.");
	assertEquals(exportedAPIConfig.get("vhost").asText(), 				"api.custom-host.com");
	//assertEquals(exportedAPIConfig.get("backendBasepath").asText(), 	"http://any.server.com:7676");
	
	List<SecurityProfile> importedSecurityProfiles = mapper.convertValue(importedAPIConfig.get("securityProfiles"), new TypeReference<List<SecurityProfile>>(){});
	List<SecurityProfile> exportedSecurityProfiles = mapper.convertValue(exportedAPIConfig.get("securityProfiles"), new TypeReference<List<SecurityProfile>>(){});
	assertEquals(importedSecurityProfiles, exportedSecurityProfiles, "SecurityProfiles are not equal.");
	
	List<SecurityProfile> importedAuthenticationProfiles = mapper.convertValue(importedAPIConfig.get("authenticationProfiles"), new TypeReference<List<AuthenticationProfile>>(){});
	List<SecurityProfile> exportedAuthenticationProfiles = mapper.convertValue(exportedAPIConfig.get("authenticationProfiles"), new TypeReference<List<AuthenticationProfile>>(){});
	assertEquals(importedAuthenticationProfiles, exportedAuthenticationProfiles, "AuthenticationProfiles are not equal.");
	
	TagMap<String, String[]> importedTags = mapper.convertValue(importedAPIConfig.get("tags"), new TypeReference<TagMap<String, String[]>>(){});
	TagMap<String, String[]> exportedTags = mapper.convertValue(exportedAPIConfig.get("tags"), new TypeReference<TagMap<String, String[]>>(){});
	assertEquals(importedTags, exportedTags, "Tags are not equal.");
	
	List<CorsProfile> importedCorsProfiles = mapper.convertValue(importedAPIConfig.get("corsProfiles"), new TypeReference<List<CorsProfile>>(){});
	List<CorsProfile> exportedCorsProfiles = mapper.convertValue(exportedAPIConfig.get("corsProfiles"), new TypeReference<List<CorsProfile>>(){});
	assertEquals(importedCorsProfiles, exportedCorsProfiles, "CorsProfiles are not equal.");

	if(!ignoreAdminAccount) {
		APIQuota importedAppQuota = mapper.convertValue(importedAPIConfig.get("applicationQuota"), new TypeReference<APIQuota>(){});
		APIQuota exportedAppQuota = mapper.convertValue(exportedAPIConfig.get("applicationQuota"), new TypeReference<APIQuota>(){});
		assertEquals(importedAppQuota, exportedAppQuota, "applicationQuota are not equal.");
		
		APIQuota importedSystemQuota = mapper.convertValue(importedAPIConfig.get("systemQuota"), new TypeReference<APIQuota>(){});
		APIQuota exportedSystemQuota = mapper.convertValue(exportedAPIConfig.get("systemQuota"), new TypeReference<APIQuota>(){});
		assertEquals(importedSystemQuota, exportedSystemQuota, "systemQuota are not equal.");
	}

	assertEquals(exportedAPIConfig.get("caCerts").size(), 				4);
	
	assertEquals(exportedAPIConfig.get("caCerts").get(0).get("certFile").asText(), 				"swagger.io.crt");
	assertEquals(exportedAPIConfig.get("caCerts").get(0).get("inbound").asBoolean(), 			false);
	assertEquals(exportedAPIConfig.get("caCerts").get(0).get("outbound").asBoolean(), 			true);
	
	assertEquals(exportedAPIConfig.get("caCerts").get(3).get("certFile").asText(), 				"GlobalSign.crt");
	assertEquals(exportedAPIConfig.get("caCerts").get(3).get("inbound").asBoolean(), 			true);
	assertEquals(exportedAPIConfig.get("caCerts").get(3).get("outbound").asBoolean(), 			false);
	
	assertTrue(new File(context.getVariable("exportLocation")+"/api.custom-host.com/"+context.getVariable("exportFolder")+"/swagger.io.crt").exists(), "Certificate swagger.io.crt is missing");
	assertTrue(new File(context.getVariable("exportLocation")+"/api.custom-host.com/"+context.getVariable("exportFolder")+"/GoDaddySecureCertificateAuthority-G2.crt").exists(), "Certificate GoDaddySecureCertificateAuthority-G2.crt is missing");
	assertTrue(new File(context.getVariable("exportLocation")+"/api.custom-host.com/"+context.getVariable("exportFolder")+"/GoDaddyRootCertificateAuthority-G2.crt").exists(), "Certificate GoDaddyRootCertificateAuthority-G2.crt is missing");
	assertTrue(new File(context.getVariable("exportLocation")+"/api.custom-host.com/"+context.getVariable("exportFolder")+"/GlobalSign.crt").exists(), "Certificate GlobalSign.crt is missing");
	
	assertTrue(new File(context.getVariable("exportLocation")+"/api.custom-host.com/"+context.getVariable("exportFolder")+"/"+context.getVariable("exportAPIName")).exists(), "Exported Swagger-File is missing");		
}
 
Example 11
Source File: CustomPoliciesTestIT.java    From apimanager-swagger-promote with Apache License 2.0 4 votes vote down vote up
private void exportAPI(TestContext context, boolean ignoreAdminAccount) throws FileNotFoundException, IOException {
	variable("exportLocation", "citrus:systemProperty('java.io.tmpdir')");
	variable(ExportTestAction.EXPORT_API,  "${apiPath}");
	// These are the folder and filenames generated by the export tool 
	variable("exportFolder", "api-test-${apiName}");
	variable("exportAPIName", "${apiName}.json");
	
	echo("####### Export the API from the API-Manager #######");
	createVariable("expectedReturnCode", "0");
	
	if(ignoreAdminAccount) {
		echo("####### Exporting the API with Org-Admin permissions only #######");
		createVariable("exportLocation", "${exportLocation}/orgAdmin");
		createVariable("apiManagerUser", "${oadminUsername1}"); // This is an org-admin user
		createVariable("apiManagerPass", "${oadminPassword1}");
		createVariable("ignoreAdminAccount", "true"); // Don't use the Admin-Account given in the env.properties for this test
	} else {
		createVariable("exportLocation", "${exportLocation}/ignoreAdminAccount");
		echo("####### Exporting the API with Admin permissions #######");
	}
	
	swaggerExport.doExecute(context);
	
	String exportedAPIConfigFile = context.getVariable("exportLocation")+"/"+context.getVariable("exportFolder")+"/api-config.json";
	
	echo("####### Reading exported API-Config file: '"+exportedAPIConfigFile+"' #######");
	JsonNode exportedAPIConfig = mapper.readTree(new FileInputStream(new File(exportedAPIConfigFile)));
	String tmp = context.replaceDynamicContentInString(IOUtils.toString(this.getClass().getResourceAsStream("/test/export/files/customPolicies/custom-policies-issue-156.json"), "UTF-8"));
	JsonNode importedAPIConfig = mapper.readTree(tmp);

	assertEquals(exportedAPIConfig.get("path").asText(), 				context.getVariable("apiPath"));
	assertEquals(exportedAPIConfig.get("name").asText(), 				context.getVariable("apiName"));
	assertEquals(exportedAPIConfig.get("state").asText(), 				context.getVariable("state"));
	assertEquals(exportedAPIConfig.get("version").asText(), 			"v1");
	assertEquals(exportedAPIConfig.get("organization").asText(),		"API Development "+context.getVariable("orgNumber"));
	
	List<SecurityProfile> importedSecurityProfiles = mapper.convertValue(importedAPIConfig.get("securityProfiles"), new TypeReference<List<SecurityProfile>>(){});
	List<SecurityProfile> exportedSecurityProfiles = mapper.convertValue(exportedAPIConfig.get("securityProfiles"), new TypeReference<List<SecurityProfile>>(){});
	assertEquals(importedSecurityProfiles, exportedSecurityProfiles, "SecurityProfiles are not equal.");
	
	Map<String, OutboundProfile> importedOutboundProfiles = mapper.convertValue(importedAPIConfig.get("outboundProfiles"), new TypeReference<Map<String, OutboundProfile>>(){});
	Map<String, OutboundProfile> exportedOutboundProfiles = mapper.convertValue(exportedAPIConfig.get("outboundProfiles"), new TypeReference<Map<String, OutboundProfile>>(){});
	assertEquals(importedOutboundProfiles, exportedOutboundProfiles, "OutboundProfiles are not equal.");
	
	TagMap<String, String[]> importedTags = mapper.convertValue(importedAPIConfig.get("tags"), new TypeReference<TagMap<String, String[]>>(){});
	TagMap<String, String[]> exportedTags = mapper.convertValue(exportedAPIConfig.get("tags"), new TypeReference<TagMap<String, String[]>>(){});
	assertEquals(importedTags, exportedTags, "Tags are not equal.");
	
	List<CorsProfile> importedCorsProfiles = mapper.convertValue(importedAPIConfig.get("corsProfiles"), new TypeReference<List<CorsProfile>>(){});
	List<CorsProfile> exportedCorsProfiles = mapper.convertValue(exportedAPIConfig.get("corsProfiles"), new TypeReference<List<CorsProfile>>(){});
	assertEquals(importedCorsProfiles, exportedCorsProfiles, "CorsProfiles are not equal.");
	
	APIQuota importedAppQuota = mapper.convertValue(importedAPIConfig.get("applicationQuota"), new TypeReference<APIQuota>(){});
	APIQuota exportedAppQuota = mapper.convertValue(exportedAPIConfig.get("applicationQuota"), new TypeReference<APIQuota>(){});
	assertEquals(importedAppQuota, exportedAppQuota, "applicationQuota are not equal.");
	
	APIQuota importedSystemQuota = mapper.convertValue(importedAPIConfig.get("systemQuota"), new TypeReference<APIQuota>(){});
	APIQuota exportedSystemQuota = mapper.convertValue(exportedAPIConfig.get("systemQuota"), new TypeReference<APIQuota>(){});
	assertEquals(importedSystemQuota, exportedSystemQuota, "systemQuota are not equal.");
	

	assertEquals(exportedAPIConfig.get("caCerts").size(), 				3);
	
	assertEquals(exportedAPIConfig.get("caCerts").get(0).get("certFile").asText(), 				"risequipmentservicedev.nov.cloud.crt");
	assertEquals(exportedAPIConfig.get("caCerts").get(0).get("inbound").asBoolean(), 			false);
	assertEquals(exportedAPIConfig.get("caCerts").get(0).get("outbound").asBoolean(), 			true);
	
	assertEquals(exportedAPIConfig.get("caCerts").get(1).get("certFile").asText(), 				"Let'sEncryptAuthorityX3.crt");
	assertEquals(exportedAPIConfig.get("caCerts").get(1).get("inbound").asBoolean(), 			false);
	assertEquals(exportedAPIConfig.get("caCerts").get(1).get("outbound").asBoolean(), 			true);
	
	assertEquals(exportedAPIConfig.get("caCerts").get(2).get("certFile").asText(), 				"DSTRootCAX3.crt");
	assertEquals(exportedAPIConfig.get("caCerts").get(2).get("inbound").asBoolean(), 			false);
	assertEquals(exportedAPIConfig.get("caCerts").get(2).get("outbound").asBoolean(), 			true);
	
	assertTrue(new File(context.getVariable("exportLocation")+"/"+context.getVariable("exportFolder")+"/risequipmentservicedev.nov.cloud.crt").exists(), "Certificate risequipmentservicedev.nov.cloud.crt is missing");
	assertTrue(new File(context.getVariable("exportLocation")+"/"+context.getVariable("exportFolder")+"/Let'sEncryptAuthorityX3.crt").exists(), "Certificate Let'sEncryptAuthorityX3.crt is missing");
	assertTrue(new File(context.getVariable("exportLocation")+"/"+context.getVariable("exportFolder")+"/DSTRootCAX3.crt").exists(), "Certificate DSTRootCAX3.crt is missing");
	
	assertTrue(new File(context.getVariable("exportLocation")+"/"+context.getVariable("exportFolder")+"/"+context.getVariable("exportAPIName")).exists(), "Exported Swagger-File is missing");
}
 
Example 12
Source File: RoutePolicyOnlyTestIT.java    From apimanager-swagger-promote with Apache License 2.0 4 votes vote down vote up
@CitrusTest
@Test @Parameters("context")
public void run(@Optional @CitrusResource TestContext context) throws IOException {		
	ObjectMapper mapper = new ObjectMapper();

	swaggerExport = new ExportTestAction();
	swaggerImport = new ImportTestAction();
	description("Import an API including a Routing-Policy to export it afterwards");

	variable("apiNumber", RandomNumberFunction.getRandomNumber(3, true));
	variable("apiPath", "/api/test/"+this.getClass().getSimpleName()+"-${apiNumber}");
	variable("apiName", this.getClass().getSimpleName()+"-${apiNumber}");
	variable("state", "published");
	variable("exportLocation", "citrus:systemProperty('java.io.tmpdir')");
	variable(ExportTestAction.EXPORT_API,  "${apiPath}");
	
	// These are the folder and filenames generated by the export tool 
	variable("exportFolder", "api-test-${apiName}");
	variable("exportAPIName", "${apiName}.json");

	echo("####### Importing the API, which should exported in the second step #######");
	createVariable(ImportTestAction.API_DEFINITION,  "/test/export/files/basic/petstore.json");
	createVariable(ImportTestAction.API_CONFIG,  "/test/export/files/customPolicies/route-policy-only-test.json");
	createVariable("routePolicy", "Routing policy 1");
	createVariable("tokenInfoPolicy", "Tokeninfo policy 1");
	createVariable("expectedReturnCode", "0");
	swaggerImport.doExecute(context);

	echo("####### Export the API from the API-Manager #######");
	createVariable("expectedReturnCode", "0");
	swaggerExport.doExecute(context);
	
	String exportedAPIConfigFile = context.getVariable("exportLocation")+"/"+context.getVariable("exportFolder")+"/api-config.json";
	
	echo("####### Reading exported API-Config file: '"+exportedAPIConfigFile+"' #######");
	JsonNode exportedAPIConfig = mapper.readTree(new FileInputStream(new File(exportedAPIConfigFile)));
	String tmp = context.replaceDynamicContentInString(IOUtils.toString(this.getClass().getResourceAsStream("/test/export/files/customPolicies/route-policy-only-test.json"), "UTF-8"));
	JsonNode importedAPIConfig = mapper.readTree(tmp);

	assertEquals(exportedAPIConfig.get("path").asText(), 				context.getVariable("apiPath"));
	assertEquals(exportedAPIConfig.get("name").asText(), 				context.getVariable("apiName"));
	assertEquals(exportedAPIConfig.get("state").asText(), 				context.getVariable("state"));
	assertEquals(exportedAPIConfig.get("version").asText(), 			"v1");
	assertEquals(exportedAPIConfig.get("organization").asText(),		"API Development "+context.getVariable("orgNumber"));
	
	List<SecurityProfile> importedSecurityProfiles = mapper.convertValue(importedAPIConfig.get("securityProfiles"), new TypeReference<List<SecurityProfile>>(){});
	List<SecurityProfile> exportedSecurityProfiles = mapper.convertValue(exportedAPIConfig.get("securityProfiles"), new TypeReference<List<SecurityProfile>>(){});
	assertEquals(importedSecurityProfiles, exportedSecurityProfiles, "SecurityProfiles are not equal.");
	
	Map<String, OutboundProfile> importedOutboundProfiles = mapper.convertValue(importedAPIConfig.get("outboundProfiles"), new TypeReference<Map<String, OutboundProfile>>(){});
	Map<String, OutboundProfile> exportedOutboundProfiles = mapper.convertValue(exportedAPIConfig.get("outboundProfiles"), new TypeReference<Map<String, OutboundProfile>>(){});
	assertEquals(importedOutboundProfiles, exportedOutboundProfiles, "OutboundProfiles are not equal.");
	
	TagMap<String, String[]> importedTags = mapper.convertValue(importedAPIConfig.get("tags"), new TypeReference<TagMap<String, String[]>>(){});
	TagMap<String, String[]> exportedTags = mapper.convertValue(exportedAPIConfig.get("tags"), new TypeReference<TagMap<String, String[]>>(){});
	assertEquals(importedTags, exportedTags, "Tags are not equal.");
	
	List<CorsProfile> importedCorsProfiles = mapper.convertValue(importedAPIConfig.get("corsProfiles"), new TypeReference<List<CorsProfile>>(){});
	List<CorsProfile> exportedCorsProfiles = mapper.convertValue(exportedAPIConfig.get("corsProfiles"), new TypeReference<List<CorsProfile>>(){});
	assertEquals(importedCorsProfiles, exportedCorsProfiles, "CorsProfiles are not equal.");
	
	assertTrue(new File(context.getVariable("exportLocation")+"/"+context.getVariable("exportFolder")+"/"+context.getVariable("exportAPIName")).exists(), "Exported Swagger-File is missing");
}