Skip to content

Commit

Permalink
- issue #461 fix junit
Browse files Browse the repository at this point in the history
  • Loading branch information
rathnapandi committed Mar 7, 2024
1 parent 37351fe commit c731c90
Showing 1 changed file with 14 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@ public class APIManagerAPIAdapter {
Map<APIFilter, String> apiManagerResponse = new HashMap<>();
ObjectMapper mapper = new ObjectMapper();
private final CoreParameters cmd;
private final List<String> queryStringPassThroughBreakingVersion = Arrays.asList("7.7.20220530", "7.7.20220830", "7.7.20221130", "7.7.20230228", "7.7.20230530", "7.7.20230830", "7.7.20231130", "7.7.20240228");

/**
* Maps the provided status to the REST-API endpoint to change the status!
Expand Down Expand Up @@ -566,9 +567,10 @@ public API createAPIProxy(API api) throws AppException {

public API updateAPIProxy(API api) throws AppException {
LOG.debug("Updating API-Proxy: {} {} ( {} )", api.getName(), api.getVersion(), api.getId());
String[] serializeAllExcept = getSerializeAllExcept();
mapper.setSerializationInclusion(Include.NON_NULL);
FilterProvider filter = new SimpleFilterProvider().setDefaultFilter(
SimpleBeanPropertyFilter.serializeAll());
SimpleBeanPropertyFilter.serializeAllExcept(serializeAllExcept));
mapper.registerModule(new SimpleModule().setSerializerModifier(new APIImportSerializerModifier()));
mapper.setFilterProvider(filter);
mapper.registerModule(new SimpleModule().setSerializerModifier(new PolicySerializerModifier(false)));
Expand All @@ -591,6 +593,17 @@ public API updateAPIProxy(API api) throws AppException {
}
}

private String[] getSerializeAllExcept() throws AppException {
String[] serializeAllExcept;
// queryStringPassThrough added in inboundProfiles on API manager version 7.7.20220530
if (queryStringPassThroughBreakingVersion.contains(APIManagerAdapter.getInstance().getApiManagerVersion())) {
serializeAllExcept = new String[]{"apiDefinition", "certFile", "useForInbound", "useForOutbound", "organization", "applications", "image", "clientOrganizations", "applicationQuota", "systemQuota", "backendBasepath", "remoteHost"};
} else {
serializeAllExcept = new String[]{"queryStringPassThrough", "apiDefinition", "certFile", "useForInbound", "useForOutbound", "organization", "applications", "image", "clientOrganizations", "applicationQuota", "systemQuota", "backendBasepath", "remoteHost"};
}
return serializeAllExcept;
}

public void deleteAPIProxy(API api) throws AppException {
LOG.debug("Deleting API-Proxy with Name : {} and Id: {}", api.getName(), api.getId());
try {
Expand Down

0 comments on commit c731c90

Please sign in to comment.