Skip to content

Commit

Permalink
- Fix for JDK 1.8 compatibility
Browse files Browse the repository at this point in the history
  • Loading branch information
rathnapandi committed Mar 15, 2023
1 parent d56aeab commit d8cb161
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 23 deletions.
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
package com.axway.apim.export.test.impl;

import com.axway.apim.adapter.APIManagerAdapter;
import com.axway.apim.api.API;
import com.axway.apim.api.export.impl.CheckCertificatesAPIHandler;
import com.axway.apim.api.export.lib.cli.CLICheckCertificatesOptions;
Expand All @@ -18,8 +17,7 @@
import java.io.IOException;
import java.util.List;

public class CheckCertificatesTest {

public class CheckCertificatesTest {


private static final String TEST_PACKAGE = "test/export/files/apiLists/";
Expand All @@ -33,9 +31,9 @@ public void setTest() {
}

@Test
public void checkCertNothingAboutToExpire() throws IOException {
public void checkCertNothingAboutToExpire() throws IOException {

List<API> apis = mapper.readValue(this.getClass().getClassLoader().getResourceAsStream(TEST_PACKAGE + "three-apis-no-clientOrgs-and-clientApps.json"), new TypeReference<>() {
List<API> apis = mapper.readValue(this.getClass().getClassLoader().getResourceAsStream(TEST_PACKAGE + "three-apis-no-clientOrgs-and-clientApps.json"), new TypeReference<List<API>>() {
});

APICheckCertificatesParams params = (APICheckCertificatesParams) CLICheckCertificatesOptions.create(new String[]{"-days", "30"}).getParams();
Expand All @@ -47,16 +45,16 @@ public void checkCertNothingAboutToExpire() throws IOException {

@Test
public void checkSomeExpiredCerts() throws IOException {
List<API> apis = mapper.readValue(this.getClass().getClassLoader().getResourceAsStream(TEST_PACKAGE + "three-apis-no-clientOrgs-and-clientApps.json"), new TypeReference<>() {
List<API> apis = mapper.readValue(this.getClass().getClassLoader().getResourceAsStream(TEST_PACKAGE + "three-apis-no-clientOrgs-and-clientApps.json"), new TypeReference<List<API>>() {
});

APICheckCertificatesParams params = (APICheckCertificatesParams) CLICheckCertificatesOptions.create(new String[]{"-days", "23350"}).getParams();
CheckCertificatesAPIHandler checkCerts = new CheckCertificatesAPIHandler(params);
checkCerts.execute(apis);
Result result = checkCerts.getResult();
Assert.assertTrue(result.getErrorCode() == ErrorCode.CHECK_CERTS_FOUND_CERTS);
Assert.assertSame(result.getErrorCode(), ErrorCode.CHECK_CERTS_FOUND_CERTS);
@SuppressWarnings("unchecked")
List<CaCert> expiredCert = (List<CaCert>) result.getResultDetails();
Assert.assertTrue(expiredCert.size() == 1, "Expect one certificate to expire");
Assert.assertEquals(expiredCert.size(), 1, "Expect one certificate to expire");
}
}
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
package com.axway.apim.export.test.impl;

import com.axway.apim.adapter.APIManagerAdapter;
import com.axway.apim.api.API;
import com.axway.apim.api.export.impl.ConsoleAPIExporter;
import com.axway.apim.api.export.lib.cli.CLIAPIExportOptions;
Expand All @@ -15,43 +14,43 @@
import java.util.List;

public class ConsoleAPIExportTest {

private static final String TEST_PACKAGE = "test/export/files/apiLists/";

ObjectMapper mapper = new ObjectMapper();


@BeforeClass
public void setTest() {
mapper.disable(MapperFeature.USE_ANNOTATIONS);
}

@Test
public void runStandardConsoleAPIExport() throws IOException {
List<API> apis = mapper.readValue(this.getClass().getClassLoader().getResourceAsStream(TEST_PACKAGE + "three-apis-no-clientOrgs-and-clientApps.json"), new TypeReference<>() {
List<API> apis = mapper.readValue(this.getClass().getClassLoader().getResourceAsStream(TEST_PACKAGE + "three-apis-no-clientOrgs-and-clientApps.json"), new TypeReference<List<API>>() {
});
APIExportParams cmdParams = (APIExportParams) CLIAPIExportOptions.create(new String[] {}).getParams();
ConsoleAPIExporter consoleExp = new ConsoleAPIExporter(cmdParams);
consoleExp.execute(apis);
}

@Test
public void runWideConsoleAPIExport() throws IOException {
List<API> apis = mapper.readValue(this.getClass().getClassLoader().getResourceAsStream(TEST_PACKAGE + "three-apis-no-clientOrgs-and-clientApps.json"), new TypeReference<>() {
List<API> apis = mapper.readValue(this.getClass().getClassLoader().getResourceAsStream(TEST_PACKAGE + "three-apis-no-clientOrgs-and-clientApps.json"), new TypeReference<List<API>>() {
});

APIExportParams cmdParams = (APIExportParams) CLIAPIExportOptions.create(new String[] {"-wide"}).getParams();
ConsoleAPIExporter consoleExp = new ConsoleAPIExporter(cmdParams);
consoleExp.execute(apis);
}

@Test
public void runUltraConsoleAPIExport() throws IOException {
List<API> apis = mapper.readValue(this.getClass().getClassLoader().getResourceAsStream(TEST_PACKAGE + "three-apis-no-clientOrgs-and-clientApps.json"), new TypeReference<>() {
List<API> apis = mapper.readValue(this.getClass().getClassLoader().getResourceAsStream(TEST_PACKAGE + "three-apis-no-clientOrgs-and-clientApps.json"), new TypeReference<List<API>>() {
});

APIExportParams cmdParams = (APIExportParams) CLIAPIExportOptions.create(new String[] {"-ultra"}).getParams();
ConsoleAPIExporter consoleExp = new ConsoleAPIExporter(cmdParams);
consoleExp.execute(apis);
}
}
}

0 comments on commit d8cb161

Please sign in to comment.