Skip to content

Commit

Permalink
- Fix integration test
Browse files Browse the repository at this point in the history
  • Loading branch information
rathnapandi committed Oct 7, 2024
1 parent 0a14c3f commit 2eea666
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ public void run(@Optional @CitrusResource TestContext context) throws IOExceptio
// ############## Creating Test-Application 1 #################
variable("app1Name", "Consuming Test App ${apiNumber} ${orgNumber}");
$(http().client(apiManager).send().post("/applications").message().header("Content-Type", "application/json")
.body("{\"name\":\"${app1Name}\",\"apis\":[],\"organizationId\":\"${orgId}\"}"));
.body("{\"name\":\"${app1Name}\",\"apis\":[],\"organizationId\":\"${orgId3}\"}"));

$(http().client(apiManager).receive().response(HttpStatus.CREATED).message().type(MessageType.JSON).extract(fromBody()
.expression("$.id", "consumingTestApp1Id")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,8 @@ public void doExecute(TestContext context) {
apiDefinition = origApiDefinition;
}
String configFile = replaceDynamicContentInFile(origConfigFile, context, createTempFilename(origConfigFile));
LOG.info("Using Replaced Swagger-File: " + apiDefinition);
LOG.info("Using Replaced configFile-File: " + configFile);
LOG.info("Using Replaced Swagger-File: {}", apiDefinition);
LOG.info("Using Replaced configFile-File: {}", configFile);
int expectedReturnCode = 0;
try {
expectedReturnCode = Integer.parseInt(context.getVariable("expectedReturnCode"));
Expand Down Expand Up @@ -119,7 +119,7 @@ public void doExecute(TestContext context) {
// This creates the dynamic staging config file! (For testing, we also support reading out of a file directly)
replaceDynamicContentInFile(stageConfigFile, context, replacedStagedConfig);
}
copyImagesAndCertificates(origConfigFile, context);
copyImagesAndCertificates(origConfigFile);

List<String> args = new ArrayList<>();
if (useEnvironmentOnly) {
Expand All @@ -138,8 +138,7 @@ public void doExecute(TestContext context) {
if (useApiAdmin) {
LOG.info("API-Manager import is using user: '" + context.replaceDynamicContentInString("${apiManagerUser}") + "'");
args.add(context.replaceDynamicContentInString("${apiManagerUser}"));
}
else {
} else {
LOG.info("API-Manager import is using user: '" + context.replaceDynamicContentInString("${oadminUsername1}") + "'");
args.add(context.replaceDynamicContentInString("${oadminUsername1}"));
}
Expand Down Expand Up @@ -262,7 +261,7 @@ private File createTestDirectory(TestContext context) {
return testDir;
}

private void copyImagesAndCertificates(String origConfigFile, TestContext context) {
private void copyImagesAndCertificates(String origConfigFile) {
File sourceDir = new File(origConfigFile).getParentFile();
if (!sourceDir.exists()) {
sourceDir = new File(ImportTestAction.class.getResource(origConfigFile).getFile()).getParentFile();
Expand All @@ -272,7 +271,7 @@ private void copyImagesAndCertificates(String origConfigFile, TestContext contex
}
FileFilter filter = new WildcardFileFilter("*.crt", "*.jpg", "*.png", "*.pem", "*.md");
try {
LOG.info("Copy certificates and images from source: " + sourceDir + " into test-dir: '" + testDir + "' (Filter: \"*.crt\", \"*.jpg\", \"*.png\", \"*.pem\", \"*.md\")");
LOG.info("Copy certificates and images from source: {} into test-dir: {} (Filter: \"*.crt\", \"*.jpg\", \"*.png\", \"*.pem\", \"*.md\")", sourceDir, testDir);
FileUtils.copyDirectory(sourceDir, testDir, filter);
} catch (IOException e) {
e.printStackTrace();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@
"state":"${state}",
"version":"1.0.1",
"organization":"API Development ${orgNumber}",
"clientOrganizations" : [ "API Development 5172" ],
"applications":[
{ "name":"${consumingTestAppName}" }
]
}
}

0 comments on commit 2eea666

Please sign in to comment.