diff options
author | Tej, Tarun <tt3868@att.com> | 2017-08-11 12:20:16 -0400 |
---|---|---|
committer | Tarun Tej Velaga <tt3868@att.com> | 2017-08-11 16:37:25 +0000 |
commit | ce1cf85647ab1ae3c292fd1b1286ea0dbb56223f (patch) | |
tree | 6d0afd4c23543a91794dafe4274df8b473feadec /ONAP-PDP-REST/src | |
parent | 827a2016429bc377e28d2a414b6bcbdf8b6dc924 (diff) |
Fixes for Backward compatibility issues
Changes to the API interface and Java SDK to support backward compatibility.
Issue-Id: POLICY-165
Change-Id: I2efe8196614cfbd8b733abceb505bd6b91aa97f7
Signed-off-by: Tarun Tej Velaga <tt3868@att.com>
Diffstat (limited to 'ONAP-PDP-REST/src')
5 files changed, 23 insertions, 9 deletions
diff --git a/ONAP-PDP-REST/src/main/java/org/onap/policy/pdp/rest/api/models/ConfigPolicyAPIRequest.java b/ONAP-PDP-REST/src/main/java/org/onap/policy/pdp/rest/api/models/ConfigPolicyAPIRequest.java index dd40bfe5f..e7cb40762 100644 --- a/ONAP-PDP-REST/src/main/java/org/onap/policy/pdp/rest/api/models/ConfigPolicyAPIRequest.java +++ b/ONAP-PDP-REST/src/main/java/org/onap/policy/pdp/rest/api/models/ConfigPolicyAPIRequest.java @@ -19,11 +19,11 @@ */ package org.onap.policy.pdp.rest.api.models; -import io.swagger.annotations.ApiModel; - import java.io.Serializable; import java.util.Map; +import io.swagger.annotations.ApiModel; + @ApiModel public class ConfigPolicyAPIRequest implements Serializable{ private static final long serialVersionUID = -4103391389984557025L; @@ -66,6 +66,13 @@ public class ConfigPolicyAPIRequest implements Serializable{ return onapName; } /** + * @return the onapName + */ + @Deprecated + public String getEcompName() { + return onapName; + } + /** * @return the configName */ public String getConfigName() { @@ -114,6 +121,13 @@ public class ConfigPolicyAPIRequest implements Serializable{ this.onapName = onapName; } /** + * @param ecompName the onapName to set + */ + @Deprecated + public void setEcompName(String ecompName) { + this.onapName = ecompName; + } + /** * @param configName the configName to set */ public void setConfigName(String configName) { diff --git a/ONAP-PDP-REST/src/main/java/org/onap/policy/pdp/rest/api/services/GetConfigService.java b/ONAP-PDP-REST/src/main/java/org/onap/policy/pdp/rest/api/services/GetConfigService.java index 1817d8861..58d5c8f31 100644 --- a/ONAP-PDP-REST/src/main/java/org/onap/policy/pdp/rest/api/services/GetConfigService.java +++ b/ONAP-PDP-REST/src/main/java/org/onap/policy/pdp/rest/api/services/GetConfigService.java @@ -302,7 +302,7 @@ public class GetConfigService { return false; } if(configRequestParameters.getOnapName()==null && configRequestParameters.getPolicyName()==null){ - message = XACMLErrorConstants.ERROR_DATA_ISSUE + "Cannot proceed without onapComponentName or PolicyName"; + message = XACMLErrorConstants.ERROR_DATA_ISSUE + "Cannot proceed without onapName or PolicyName"; return false; } return true; diff --git a/ONAP-PDP-REST/src/main/java/org/onap/policy/pdp/rest/api/services/GetDecisionService.java b/ONAP-PDP-REST/src/main/java/org/onap/policy/pdp/rest/api/services/GetDecisionService.java index 66beb0663..a74203cca 100644 --- a/ONAP-PDP-REST/src/main/java/org/onap/policy/pdp/rest/api/services/GetDecisionService.java +++ b/ONAP-PDP-REST/src/main/java/org/onap/policy/pdp/rest/api/services/GetDecisionService.java @@ -164,7 +164,7 @@ public class GetDecisionService { message = XACMLErrorConstants.ERROR_DATA_ISSUE + "No Decision Request Paramaters"; return false; } - onapComponentName = decisionRequestParameters.getONAPComponentName(); + onapComponentName = decisionRequestParameters.getOnapName(); decisionAttributes = decisionRequestParameters.getDecisionAttributes(); if (onapComponentName == null || onapComponentName.isEmpty()) { message = XACMLErrorConstants.ERROR_DATA_ISSUE + "No onapComponentName given : " + onapComponentName; diff --git a/ONAP-PDP-REST/src/test/java/org/onap/policy/pdp/rest/api/services/PDPServicesTest.java b/ONAP-PDP-REST/src/test/java/org/onap/policy/pdp/rest/api/services/PDPServicesTest.java index e77a8517a..4e8a0fa4a 100644 --- a/ONAP-PDP-REST/src/test/java/org/onap/policy/pdp/rest/api/services/PDPServicesTest.java +++ b/ONAP-PDP-REST/src/test/java/org/onap/policy/pdp/rest/api/services/PDPServicesTest.java @@ -73,7 +73,7 @@ public class PDPServicesTest { DecisionRequestParameters pep = new DecisionRequestParameters(); Map<String,String> eventAttributes = new HashMap<>(); eventAttributes.put("TEST", "test"); - pep.setONAPComponentName("te123"); + pep.setOnapName("te123"); pep.setDecisionAttributes(eventAttributes); PDPServices fixture = new PDPServices(); @@ -119,7 +119,7 @@ public class PDPServicesTest { .add("Request", Json.createObjectBuilder() .add("AccessSubject", Json.createObjectBuilder() .add("Attribute", Json.createObjectBuilder() - .add("Value", pep.getONAPComponentName()) + .add("Value", pep.getOnapName()) .add("AttributeId", "ONAPName"))) .add("Resource", Json.createObjectBuilder() .add("Attribute", resourceArray)) diff --git a/ONAP-PDP-REST/src/test/java/org/onap/policy/pdp/rest/api/test/PolicyEngineServicesTest.java b/ONAP-PDP-REST/src/test/java/org/onap/policy/pdp/rest/api/test/PolicyEngineServicesTest.java index 2a76f581c..aa55a2a14 100644 --- a/ONAP-PDP-REST/src/test/java/org/onap/policy/pdp/rest/api/test/PolicyEngineServicesTest.java +++ b/ONAP-PDP-REST/src/test/java/org/onap/policy/pdp/rest/api/test/PolicyEngineServicesTest.java @@ -236,7 +236,7 @@ public class PolicyEngineServicesTest { DecisionRequestParameters pep = new DecisionRequestParameters(); Map<String,String> eventAttributes = new HashMap<>(); eventAttributes.put("TEST", "test"); - pep.setONAPComponentName("te123"); + pep.setOnapName("te123"); pep.setDecisionAttributes(eventAttributes); //Failure Tests. mockMvc.perform(post("/getDecision")).andExpect(status().isBadRequest()); @@ -245,10 +245,10 @@ public class PolicyEngineServicesTest { mockMvc.perform(post("/getDecision").content(PolicyUtils.objectToJsonString(pep)).contentType(MediaType.APPLICATION_JSON) .headers(headers).header(UUIDHEADER, "123")).andExpect(status().isOk()); pep.setDecisionAttributes(null); - pep.setONAPComponentName(null); + pep.setOnapName(null); mockMvc.perform(post("/getDecision").content(PolicyUtils.objectToJsonString(pep)).contentType(MediaType.APPLICATION_JSON) .headers(headers).header(UUIDHEADER, UUID.randomUUID())).andExpect(status().isBadRequest()); - pep.setONAPComponentName("testing"); + pep.setOnapName("testing"); mockMvc.perform(post("/getDecision").content(PolicyUtils.objectToJsonString(pep)).contentType(MediaType.APPLICATION_JSON) .headers(headers)).andExpect(status().isBadRequest()); pep.setDecisionAttributes(eventAttributes); |