Fix policy Hosts

Add support for PAP(for PDP group) and API host/creds (for policy
create/delete)

Issue-ID: CLAMP-359
Change-Id: I304193c4f1e77bd6676b32ca3d611da57106e655
Signed-off-by: sebdet <sebastien.determe@intl.att.com>
diff --git a/src/main/resources/application-noaaf.properties b/src/main/resources/application-noaaf.properties
index 6124f10..de3f7c0 100644
--- a/src/main/resources/application-noaaf.properties
+++ b/src/main/resources/application-noaaf.properties
@@ -135,9 +135,12 @@
 #
 #
 # Configuration Settings for Policy Engine Components
-clamp.config.policy.url=http4://policy.api.simpledemo.onap.org:8081
-clamp.config.policy.userName=test
-clamp.config.policy.password=test
+clamp.config.policy.api.url=http4://policy.api.simpledemo.onap.org:6969
+clamp.config.policy.api.userName=healthcheck
+clamp.config.policy.api.password=zb!XztG34
+clamp.config.policy.pap.url=http4://policy.api.simpledemo.onap.org:6969
+clamp.config.policy.pap.userName=healthcheck
+clamp.config.policy.pap.password=zb!XztG34
 clamp.config.policy.pdpUrl1=http://policy.api.simpledemo.onap.org:8081/pdp/ , testpdp, alpha123
 clamp.config.policy.pdpUrl2=http://policy.api.simpledemo.onap.org:8081/pdp/ , testpdp, alpha123
 clamp.config.policy.papUrl=http://policy.api.simpledemo.onap.org:8081/pap/ , testpap, alpha123
diff --git a/src/main/resources/application.properties b/src/main/resources/application.properties
index 1234431..beb0665 100644
--- a/src/main/resources/application.properties
+++ b/src/main/resources/application.properties
@@ -152,9 +152,13 @@
 #
 #
 # Configuration Settings for Policy Engine Components
-clamp.config.policy.url=http4://policy.api.simpledemo.onap.org:8081
-clamp.config.policy.userName=test
-clamp.config.policy.password=test
+clamp.config.policy.api.url=http4://policy.api.simpledemo.onap.org:6969
+clamp.config.policy.api.userName=healthcheck
+clamp.config.policy.api.password=zb!XztG34
+clamp.config.policy.pap.url=http4://policy.api.simpledemo.onap.org:6969
+clamp.config.policy.pap.userName=healthcheck
+clamp.config.policy.pap.password=zb!XztG34
+
 clamp.config.policy.pdpUrl1=http://policy.api.simpledemo.onap.org:8081/pdp/ , testpdp, alpha123
 clamp.config.policy.pdpUrl2=http://policy.api.simpledemo.onap.org:8081/pdp/ , testpdp, alpha123
 clamp.config.policy.papUrl=http://policy.api.simpledemo.onap.org:8081/pap/ , testpap, alpha123
diff --git a/src/main/resources/clds/camel/routes/flexible-flow.xml b/src/main/resources/clds/camel/routes/flexible-flow.xml
index 9874d05..75341de 100644
--- a/src/main/resources/clds/camel/routes/flexible-flow.xml
+++ b/src/main/resources/clds/camel/routes/flexible-flow.xml
@@ -131,9 +131,9 @@
 			</setHeader>
 			<log
 				loggingLevel="INFO"
-				message="Endpoint to create microservice policy: {{clamp.config.policy.url}}/policy/api/v1/policytypes/${exchangeProperty[microServicePolicy].getModelType()}/versions/1.0.0/policies"></log>
+				message="Endpoint to create microservice policy: {{clamp.config.policy.api.url}}/policy/api/v1/policytypes/${exchangeProperty[microServicePolicy].getModelType()}/versions/1.0.0/policies"></log>
 			<toD
-				uri="{{clamp.config.policy.url}}/policy/api/v1/policytypes/${exchangeProperty[microServicePolicy].getModelType()}/versions/1.0.0/policies?bridgeEndpoint=true&amp;mapHttpMessageHeaders=false&amp;throwExceptionOnFailure=${exchangeProperty[raiseHttpExceptionFlag]}&amp;httpClient.connectTimeout=10000&amp;authUsername={{clamp.config.policy.userName}}&amp;authPassword={{clamp.config.policy.password}}" />
+				uri="{{clamp.config.policy.api.url}}/policy/api/v1/policytypes/${exchangeProperty[microServicePolicy].getModelType()}/versions/1.0.0/policies?bridgeEndpoint=true&amp;mapHttpMessageHeaders=false&amp;throwExceptionOnFailure=${exchangeProperty[raiseHttpExceptionFlag]}&amp;httpClient.connectTimeout=10000&amp;authUsername={{clamp.config.policy.api.userName}}&amp;authPassword={{clamp.config.policy.api.password}}" />
 			<doFinally>
 				<to uri="direct:reset-raise-http-exception-flag" />
 				<to
@@ -176,9 +176,9 @@
 			</setHeader>
 			<log
 				loggingLevel="INFO"
-				message="Endpoint to delete microservice policy: {{clamp.config.policy.url}}/policy/api/v1/policytypes/${exchangeProperty[microServicePolicy].getModelType()}/versions/1.0.0/policies/${exchangeProperty[microServicePolicy].getName()}"></log>
+				message="Endpoint to delete microservice policy: {{clamp.config.policy.api.url}}/policy/api/v1/policytypes/${exchangeProperty[microServicePolicy].getModelType()}/versions/1.0.0/policies/${exchangeProperty[microServicePolicy].getName()}/versions/1.0.0"></log>
 			<toD
-				uri="{{clamp.config.policy.url}}/policy/api/v1/policytypes/${exchangeProperty[microServicePolicy].getModelType()}/versions/1.0.0/policies/${exchangeProperty[microServicePolicy].getName()}?bridgeEndpoint=true&amp;mapHttpMessageHeaders=false&amp;throwExceptionOnFailure=${exchangeProperty[raiseHttpExceptionFlag]}&amp;httpClient.connectTimeout=10000&amp;deleteWithBody=false&amp;mapHttpMessageBody=false&amp;mapHttpMessageFormUrlEncodedBody=false&amp;authUsername={{clamp.config.policy.userName}}&amp;authPassword={{clamp.config.policy.password}}" />
+				uri="{{clamp.config.policy.api.url}}/policy/api/v1/policytypes/${exchangeProperty[microServicePolicy].getModelType()}/versions/1.0.0/policies/${exchangeProperty[microServicePolicy].getName()}/versions/1.0.0?bridgeEndpoint=true&amp;mapHttpMessageHeaders=false&amp;throwExceptionOnFailure=${exchangeProperty[raiseHttpExceptionFlag]}&amp;httpClient.connectTimeout=10000&amp;deleteWithBody=false&amp;mapHttpMessageBody=false&amp;mapHttpMessageFormUrlEncodedBody=false&amp;authUsername={{clamp.config.policy.api.userName}}&amp;authPassword={{clamp.config.policy.api.password}}" />
 
 			<doFinally>
 				<to uri="direct:reset-raise-http-exception-flag" />
@@ -226,9 +226,9 @@
 			</setHeader>
 			<log
 				loggingLevel="INFO"
-				message="Endpoint to create operational policy: {{clamp.config.policy.url}}/policy/api/v1/policytypes/onap.policy.controlloop.operational/versions/1.0.0/policies"></log>
+				message="Endpoint to create operational policy: {{clamp.config.policy.api.url}}/policy/api/v1/policytypes/onap.policy.controlloop.operational/versions/1.0.0/policies"></log>
 			<toD
-				uri="{{clamp.config.policy.url}}/policy/api/v1/policytypes/onap.policy.controlloop.operational/versions/1.0.0/policies?bridgeEndpoint=true&amp;mapHttpMessageHeaders=false&amp;throwExceptionOnFailure=${exchangeProperty[raiseHttpExceptionFlag]}&amp;httpClient.connectTimeout=10000&amp;authUsername={{clamp.config.policy.userName}}&amp;authPassword={{clamp.config.policy.password}}" />
+				uri="{{clamp.config.policy.api.url}}/policy/api/v1/policytypes/onap.policy.controlloop.operational/versions/1.0.0/policies?bridgeEndpoint=true&amp;mapHttpMessageHeaders=false&amp;throwExceptionOnFailure=${exchangeProperty[raiseHttpExceptionFlag]}&amp;httpClient.connectTimeout=10000&amp;authUsername={{clamp.config.policy.api.userName}}&amp;authPassword={{clamp.config.policy.api.password}}" />
 			<doFinally>
 				<to uri="direct:reset-raise-http-exception-flag" />
 				<to
@@ -271,9 +271,9 @@
 			</setHeader>
 			<log
 				loggingLevel="INFO"
-				message="Endpoint to delete operational policy: {{clamp.config.policy.url}}/policy/api/v1/policytypes/onap.policy.controlloop.operational/versions/1.0.0/policies/${exchangeProperty[operationalPolicy].getName()}"></log>
+				message="Endpoint to delete operational policy: {{clamp.config.policy.api.url}}/policy/api/v1/policytypes/onap.policy.controlloop.operational/versions/1.0.0/policies/${exchangeProperty[operationalPolicy].getName()}/versions/1.0.0"></log>
 			<toD
-				uri="{{clamp.config.policy.url}}/policy/api/v1/policytypes/onap.policy.controlloop.operational/versions/1.0.0/policies/${exchangeProperty[operationalPolicy].getName()}?bridgeEndpoint=true&amp;mapHttpMessageHeaders=false&amp;throwExceptionOnFailure=${exchangeProperty[raiseHttpExceptionFlag]}&amp;httpClient.connectTimeout=10000&amp;deleteWithBody=false&amp;mapHttpMessageBody=false&amp;mapHttpMessageFormUrlEncodedBody=false&amp;authUsername={{clamp.config.policy.userName}}&amp;authPassword={{clamp.config.policy.password}}" />
+				uri="{{clamp.config.policy.api.url}}/policy/api/v1/policytypes/onap.policy.controlloop.operational/versions/1.0.0/policies/${exchangeProperty[operationalPolicy].getName()}/versions/1.0.0?bridgeEndpoint=true&amp;mapHttpMessageHeaders=false&amp;throwExceptionOnFailure=${exchangeProperty[raiseHttpExceptionFlag]}&amp;httpClient.connectTimeout=10000&amp;deleteWithBody=false&amp;mapHttpMessageBody=false&amp;mapHttpMessageFormUrlEncodedBody=false&amp;authUsername={{clamp.config.policy.api.userName}}&amp;authPassword={{clamp.config.policy.api.password}}" />
 			<doFinally>
 				<to uri="direct:reset-raise-http-exception-flag" />
 				<to
@@ -320,9 +320,9 @@
 			</setHeader>
 			<log
 				loggingLevel="INFO"
-				message="Endpoint to create guard policy: {{clamp.config.policy.url}}/policy/api/v1/policytypes/onap.policy.controlloop.Guard/versions/1.0.0/policies"></log>
+				message="Endpoint to create guard policy: {{clamp.config.policy.api.url}}/policy/api/v1/policytypes/onap.policy.controlloop.guard/versions/1.0.0/policies"></log>
 			<toD
-				uri="{{clamp.config.policy.url}}/policy/api/v1/policytypes/onap.policy.controlloop.Guard/versions/1.0.0/policies?bridgeEndpoint=true&amp;mapHttpMessageHeaders=false&amp;throwExceptionOnFailure=${exchangeProperty[raiseHttpExceptionFlag]}&amp;httpClient.connectTimeout=10000&amp;authUsername={{clamp.config.policy.userName}}&amp;authPassword={{clamp.config.policy.password}}" />
+				uri="{{clamp.config.policy.api.url}}/policy/api/v1/policytypes/onap.policy.controlloop.guard/versions/1.0.0/policies?bridgeEndpoint=true&amp;mapHttpMessageHeaders=false&amp;throwExceptionOnFailure=${exchangeProperty[raiseHttpExceptionFlag]}&amp;httpClient.connectTimeout=10000&amp;authUsername={{clamp.config.policy.api.userName}}&amp;authPassword={{clamp.config.policy.api.password}}" />
 			<doFinally>
 				<to uri="direct:reset-raise-http-exception-flag" />
 				<to
@@ -364,9 +364,9 @@
 			</setHeader>
 			<log
 				loggingLevel="INFO"
-				message="Endpoint to delete guard policy: {{clamp.config.policy.url}}/policy/api/v1/policytypes/onap.policy.controlloop.Guard/versions/1.0.0/policies/${exchangeProperty[guardPolicy].getKey()}"></log>
+				message="Endpoint to delete guard policy: {{clamp.config.policy.api.url}}/policy/api/v1/policytypes/onap.policy.controlloop.guard/versions/1.0.0/policies/${exchangeProperty[guardPolicy].getKey()}/versions/1.0.0"></log>
 			<toD
-				uri="{{clamp.config.policy.url}}/policy/api/v1/policytypes/onap.policy.controlloop.Guard/versions/1.0.0/policies/${exchangeProperty[guardPolicy].getKey()}?bridgeEndpoint=true&amp;throwExceptionOnFailure=${exchangeProperty[raiseHttpExceptionFlag]}&amp;httpClient.connectTimeout=10000&amp;deleteWithBody=false&amp;mapHttpMessageBody=false&amp;mapHttpMessageFormUrlEncodedBody=false&amp;authUsername={{clamp.config.policy.userName}}&amp;authPassword={{clamp.config.policy.password}}" />
+				uri="{{clamp.config.policy.api.url}}/policy/api/v1/policytypes/onap.policy.controlloop.guard/versions/1.0.0/policies/${exchangeProperty[guardPolicy].getKey()}/versions/1.0.0?bridgeEndpoint=true&amp;throwExceptionOnFailure=${exchangeProperty[raiseHttpExceptionFlag]}&amp;httpClient.connectTimeout=10000&amp;deleteWithBody=false&amp;mapHttpMessageBody=false&amp;mapHttpMessageFormUrlEncodedBody=false&amp;authUsername={{clamp.config.policy.api.userName}}&amp;authPassword={{clamp.config.policy.api.password}}" />
 
 			<doFinally>
 				<to uri="direct:reset-raise-http-exception-flag" />
@@ -413,9 +413,9 @@
 			</setHeader>
 			<log
 				loggingLevel="INFO"
-				message="Endpoint to add policies to PDP Group: {{clamp.config.policy.url}}/policy/pap/v1/pdps"></log>
+				message="Endpoint to add policies to PDP Group: {{clamp.config.policy.pap.url}}/policy/pap/v1/pdps"></log>
 			<toD
-				uri="{{clamp.config.policy.url}}/policy/pap/v1/pdps?throwExceptionOnFailure=${exchangeProperty[raiseHttpExceptionFlag]}&amp;httpClient.connectTimeout=10000&amp;authMethod=Basic&amp;authUsername=test&amp;authPassword=test" />
+				uri="{{clamp.config.policy.pap.url}}/policy/pap/v1/pdps?throwExceptionOnFailure=${exchangeProperty[raiseHttpExceptionFlag]}&amp;httpClient.connectTimeout=10000&amp;authUsername={{clamp.config.policy.pap.userName}}&amp;authPassword={{clamp.config.policy.pap.password}}" />
 
 			<doFinally>
 				<to uri="direct:reset-raise-http-exception-flag" />
@@ -463,9 +463,9 @@
 				</setHeader>
 				<log
 					loggingLevel="INFO"
-					message="Endpoint to delete policy from PDP Group: {{clamp.config.policy.url}}/pdps/policies/${exchangeProperty[policyName]}/versions/1.0.0"></log>
+					message="Endpoint to delete policy from PDP Group: {{clamp.config.policy.pap.url}}/pdps/policies/${exchangeProperty[policyName]}/versions/1.0.0"></log>
 				<toD
-					uri="{{clamp.config.policy.url}}/pdps/policies/${exchangeProperty[policyName]}/versions/1.0.0?bridgeEndpoint=true&amp;mapHttpMessageHeaders=false&amp;throwExceptionOnFailure=${exchangeProperty[raiseHttpExceptionFlag]}&amp;httpClient.connectTimeout=10000&amp;authUsername={{clamp.config.policy.userName}}&amp;authPassword={{clamp.config.policy.password}}" />
+					uri="{{clamp.config.policy.pap.url}}/pdps/policies/${exchangeProperty[policyName]}/versions/1.0.0?bridgeEndpoint=true&amp;mapHttpMessageHeaders=false&amp;throwExceptionOnFailure=${exchangeProperty[raiseHttpExceptionFlag]}&amp;httpClient.connectTimeout=10000&amp;authUsername={{clamp.config.policy.pap.userName}}&amp;authPassword={{clamp.config.policy.pap.password}}" />
 				<setProperty propertyName="logMessage">
 					<simple>${exchangeProperty[policyName]} PDP Group removal status
 					</simple>
diff --git a/src/test/resources/application.properties b/src/test/resources/application.properties
index 26e0b3b..ecc4033 100644
--- a/src/test/resources/application.properties
+++ b/src/test/resources/application.properties
@@ -141,9 +141,13 @@
 #

 #

 # Configuration Settings for Policy Engine Components

-clamp.config.policy.url=http4://localhost:${docker.http-cache.port.host}

-clamp.config.policy.userName=test

-clamp.config.policy.password=test

+clamp.config.policy.api.url=http4://localhost:${docker.http-cache.port.host}

+clamp.config.policy.api.userName=healthcheck

+clamp.config.policy.api.password=zb!XztG34

+clamp.config.policy.pap.url=http4://localhost:${docker.http-cache.port.host}

+clamp.config.policy.pap.userName=healthcheck

+clamp.config.policy.pap.password=zb!XztG34

+

 clamp.config.policy.pdpUrl1=http://localhost:${docker.http-cache.port.host}/pdp/ , testpdp, alpha123

 clamp.config.policy.pdpUrl2=http://localhost:${docker.http-cache.port.host}/pdp/ , testpdp, alpha123

 clamp.config.policy.papUrl=http://localhost:${docker.http-cache.port.host}/pap/ , testpap, alpha123