From 9b6f57681520b4f0e4ed3cabd80204a11041e20e Mon Sep 17 00:00:00 2001
From: sebdet <sebastien.determe@intl.att.com>
Date: Mon, 10 Feb 2020 15:21:47 +0100
Subject: Add policy downloader

Add policy downloader to sync all policy types in the database

Issue-ID: CLAMP-518
Change-Id: I5ab82970cd3403e46fe7cc8447766977b11b68e7
Signed-off-by: sebdet <sebastien.determe@intl.att.com>
---
 .../resources/clds/camel/routes/policy-flows.xml   |  4 +-
 .../example/policy/api/v1/policytypes/.file        | 60 ++++++++++++++++++++++
 .../example/policy/api/v1/policytypes/.header      |  1 +
 3 files changed, 63 insertions(+), 2 deletions(-)
 create mode 100644 src/test/resources/http-cache/example/policy/api/v1/policytypes/.file
 create mode 100644 src/test/resources/http-cache/example/policy/api/v1/policytypes/.header

(limited to 'src/test')

diff --git a/src/test/resources/clds/camel/routes/policy-flows.xml b/src/test/resources/clds/camel/routes/policy-flows.xml
index ce24b27c..c28e4543 100644
--- a/src/test/resources/clds/camel/routes/policy-flows.xml
+++ b/src/test/resources/clds/camel/routes/policy-flows.xml
@@ -140,7 +140,7 @@
 						<log loggingLevel="INFO"
 								message="Endpoint to get all policy models: {{clamp.config.policy.pap.url}}/policy/api/v1/policytypes"></log>
 						<toD
-								uri="{{clamp.config.policy.pap.url}}/policy/api/v1/policytypes?bridgeEndpoint=true&amp;useSystemProperties=true&amp;throwExceptionOnFailure=${exchangeProperty[raiseHttpExceptionFlag]}&amp;authMethod=Basic&amp;authUsername={{clamp.config.policy.api.userName}}&amp;authPassword={{clamp.config.policy.api.password}}&amp;connectionTimeToLive=5000&amp;httpClient.connectTimeout=10000&amp;httpClient.socketTimeout=20000&amp;authenticationPreemptive=true&amp;connectionClose=true"/>
+								uri="{{clamp.config.policy.api.url}}/policy/api/v1/policytypes?bridgeEndpoint=true&amp;useSystemProperties=true&amp;throwExceptionOnFailure=${exchangeProperty[raiseHttpExceptionFlag]}&amp;authMethod=Basic&amp;authUsername={{clamp.config.policy.api.userName}}&amp;authPassword={{clamp.config.policy.api.password}}&amp;connectionTimeToLive=5000&amp;httpClient.connectTimeout=10000&amp;httpClient.socketTimeout=20000&amp;authenticationPreemptive=true&amp;connectionClose=true"/>
 						<convertBodyTo type="java.lang.String"/>		
 						<doFinally>
 								<to uri="direct:reset-raise-http-exception-flag"/>
@@ -174,7 +174,7 @@
 						<log loggingLevel="INFO"
 								message="Endpoint to get policy model: {{clamp.config.policy.pap.url}}/policy/api/v1/policytypes/${exchangeProperty[policyModelName]}/versions/${exchangeProperty[policyModelVersion]}"></log>
 						<toD
-								uri="{{clamp.config.policy.pap.url}}/policy/api/v1/policytypes/${exchangeProperty[policyModelName]}/versions/${exchangeProperty[policyModelVersion]}?bridgeEndpoint=true&amp;useSystemProperties=true&amp;throwExceptionOnFailure=${exchangeProperty[raiseHttpExceptionFlag]}&amp;authMethod=Basic&amp;authUsername={{clamp.config.policy.api.userName}}&amp;authPassword={{clamp.config.policy.api.password}}&amp;connectionTimeToLive=5000&amp;httpClient.connectTimeout=10000&amp;httpClient.socketTimeout=20000&amp;authenticationPreemptive=true&amp;connectionClose=true"/>
+								uri="{{clamp.config.policy.api.url}}/policy/api/v1/policytypes/${exchangeProperty[policyModelName]}/versions/${exchangeProperty[policyModelVersion]}?bridgeEndpoint=true&amp;useSystemProperties=true&amp;throwExceptionOnFailure=${exchangeProperty[raiseHttpExceptionFlag]}&amp;authMethod=Basic&amp;authUsername={{clamp.config.policy.api.userName}}&amp;authPassword={{clamp.config.policy.api.password}}&amp;connectionTimeToLive=5000&amp;httpClient.connectTimeout=10000&amp;httpClient.socketTimeout=20000&amp;authenticationPreemptive=true&amp;connectionClose=true"/>
 					    <convertBodyTo type="java.lang.String"/>
 						<doFinally>
 								<to uri="direct:reset-raise-http-exception-flag"/>
diff --git a/src/test/resources/http-cache/example/policy/api/v1/policytypes/.file b/src/test/resources/http-cache/example/policy/api/v1/policytypes/.file
new file mode 100644
index 00000000..7394d3f9
--- /dev/null
+++ b/src/test/resources/http-cache/example/policy/api/v1/policytypes/.file
@@ -0,0 +1,60 @@
+tosca_definitions_version: tosca_simple_yaml_1_0_0
+policy_types:
+  - onap.policies.Monitoring:
+      version: 1.0.0
+      description: A base policy type for all policies that govern monitoring provision
+      derived_from: tosca.policies.Root
+      properties:
+        # Omitted for brevity, see Section 1
+ 
+ - onap.policies.controlloop.Operational:
+      version: 1.0.0
+      description: Operational Policy for Control Loops
+      derived_from: tosca.policies.Root
+      properties:
+        # Omitted for brevity, see Section 1
+ 
+  - onap.policies.controloop.operational.Drools:
+      version: 1.0.0
+      description: Operational Policy for Control Loops using the Drools PDP
+      derived_from: onap.policies.controlloop.Operational
+      properties:
+        # Omitted for brevity, see Section 1
+ 
+  - onap.policies.controloop.operational.Apex:
+      version: 1.0.0
+      description: Operational Policy for Control Loops using the APEX PDP
+      derived_from: onap.policies.controlloop.Operational
+      properties:
+        # Omitted for brevity, see Section 1
+ 
+ - onap.policies.controlloop.Guard:
+      version: 1.0.0
+      description: Operational Policy for Control Loops
+      derived_from: tosca.policies.Root
+      properties:
+        # Omitted for brevity, see Section 1
+ 
+  - onap.policies.controlloop.guard.FrequencyLimiter:
+      version: 1.0.0
+      description: Supports limiting the frequency of actions being taken by a Actor.
+      derived_from: onap.policies.controlloop.Guard
+      properties:
+        # Omitted for brevity, see Section 1
+ 
+  - onap.policies.controlloop.guard.Blacklist:
+      version: 1.0.0
+      description: Supports blacklist of VNF's from performing control loop actions on.
+      derived_from: onap.policies.controlloop.Guard
+      properties:
+        # Omitted for brevity, see Section 1
+ 
+  - onap.policies.controlloop.guard.MinMax:
+      version: 1.0.0
+      description: Supports Min/Max number of VF Modules
+      derived_from: onap.policies.controlloop.Guard
+      properties:
+        # Omitted for brevity, see Section 1
+ 
+data_types:
+  # Any bespoke data types referenced by policy type definitions[]
diff --git a/src/test/resources/http-cache/example/policy/api/v1/policytypes/.header b/src/test/resources/http-cache/example/policy/api/v1/policytypes/.header
new file mode 100644
index 00000000..6a280d97
--- /dev/null
+++ b/src/test/resources/http-cache/example/policy/api/v1/policytypes/.header
@@ -0,0 +1 @@
+{"Transfer-Encoding": "chunked", "Set-Cookie": "JSESSIONID=158qxkdtdobkd1umr3ikkgrmlx;Path=/", "Expires": "Thu, 01 Jan 1970 00:00:00 GMT", "Server": "Jetty(9.3.21.v20170918)", "Content-Type": "application/json", "X-ECOMP-RequestID": "e2ddb3c8-994f-47df-b4dc-097d4fb55c08"}
\ No newline at end of file
-- 
cgit