diff options
-rw-r--r-- | src/main/java/org/onap/clamp/clds/client/PolicyClient.java | 19 | ||||
-rw-r--r-- | src/test/java/org/onap/clamp/clds/it/PolicyClientItCase.java | 2 |
2 files changed, 12 insertions, 9 deletions
diff --git a/src/main/java/org/onap/clamp/clds/client/PolicyClient.java b/src/main/java/org/onap/clamp/clds/client/PolicyClient.java index d4f9014ba..cb86acbd3 100644 --- a/src/main/java/org/onap/clamp/clds/client/PolicyClient.java +++ b/src/main/java/org/onap/clamp/clds/client/PolicyClient.java @@ -365,15 +365,18 @@ public class PolicyClient { logger.info("policyName=" + policyName); configRequestParameters.setPolicyName(policyName); - - Collection<PolicyConfig> response = getPolicyEngine().getConfig(configRequestParameters); - for (PolicyConfig policyConfig : response) { - Integer version = Integer.valueOf(policyConfig.getPolicyVersion()); - versions.add(version); + try { + Collection<PolicyConfig> response = getPolicyEngine().getConfig(configRequestParameters); + for (PolicyConfig policyConfig : response) { + Integer version = Integer.valueOf(policyConfig.getPolicyVersion()); + versions.add(version); + } + Collections.sort(versions); + logger.info("Policy versions.size()=" + versions.size()); + } catch (PolicyConfigException e) { + // just print warning - if no policy version found + logger.warn("warning: policy not found...policy name - " + policyName, e.getMessage()); } - Collections.sort(versions); - logger.info("Policy versions.size()=" + versions.size()); - return versions; } diff --git a/src/test/java/org/onap/clamp/clds/it/PolicyClientItCase.java b/src/test/java/org/onap/clamp/clds/it/PolicyClientItCase.java index 0c358948c..c129800d5 100644 --- a/src/test/java/org/onap/clamp/clds/it/PolicyClientItCase.java +++ b/src/test/java/org/onap/clamp/clds/it/PolicyClientItCase.java @@ -95,7 +95,7 @@ public class PolicyClientItCase extends AbstractItCase { try { policyClient.sendMicroServiceInJson(policyJson, prop, tcaPolicyRequestUuid); } catch (Exception e) { - assertTrue(e.getMessage().contains("Exception while communicating with Policy")); + assertTrue(e.getMessage().contains("Policy send failed: PE500 ")); } } } |