Merge "Remove the nosonar"
authorSébastien Determe <sd378r@intl.att.com>
Thu, 12 Apr 2018 10:36:18 +0000 (10:36 +0000)
committerGerrit Code Review <gerrit@onap.org>
Thu, 12 Apr 2018 10:36:18 +0000 (10:36 +0000)
12 files changed:
pom.xml
src/main/java/org/onap/clamp/clds/Application.java
src/main/java/org/onap/clamp/clds/client/DcaeInventoryServices.java
src/main/java/org/onap/clamp/clds/client/req/policy/PolicyClient.java
src/main/java/org/onap/clamp/clds/config/PolicyConfiguration.java [new file with mode: 0644]
src/main/java/org/onap/clamp/clds/sdc/controller/SdcSingleController.java
src/main/java/org/onap/clamp/clds/sdc/controller/installer/CsarInstallerImpl.java
src/main/resources/application.properties
src/main/resources/clds/clds-policy-config.properties [deleted file]
src/test/java/org/onap/clamp/clds/it/PolicyClientItCase.java
src/test/resources/application.properties
src/test/resources/clds/clds-policy-config.properties [deleted file]

diff --git a/pom.xml b/pom.xml
index 1664de0..efd3a65 100644 (file)
--- a/pom.xml
+++ b/pom.xml
                                <dependency>
                                                <groupId>org.onap.policy.engine</groupId>
                                                <artifactId>PolicyEngineAPI</artifactId>
-                                               <version>1.1.0</version>
+                                               <version>1.2.0</version>
                                                <exclusions>
                                                                <exclusion>
                                                                                <groupId>com.google.guava</groupId>
                                <dependency>
                                                <groupId>org.onap.policy.common</groupId>
                                                <artifactId>ONAP-Logging</artifactId>
-                                               <version>1.1.0</version>
+                                               <version>1.1.3</version>
                                                <exclusions>
                                                                <exclusion>
                                                                                <artifactId>log4j</artifactId>
                                <dependency>
                                                <groupId>org.onap.policy.engine</groupId>
                                                <artifactId>PolicyEngineUtils</artifactId>
-                                               <version>1.1.0</version>
+                                               <version>1.1.3</version>
                                                <exclusions>
                                                                <exclusion>
                                                                                <artifactId>log4j</artifactId>
                                <dependency>
                                                <groupId>org.onap.policy.drools-applications</groupId>
                                                <artifactId>policy-yaml</artifactId>
-                                               <version>1.1.0</version>
+                                               <version>1.1.3</version>
                                                <exclusions>
                                                                <exclusion>
                                                                                <artifactId>log4j</artifactId>
                                <dependency>
                                                <groupId>org.onap.policy.drools-applications</groupId>
                                                <artifactId>sdc</artifactId>
-                                               <version>1.1.0</version>
+                                               <version>1.1.3</version>
                                                <exclusions>
                                                                <exclusion>
                                                                                <artifactId>log4j</artifactId>
                                <dependency>
                                                <groupId>org.onap.policy.drools-applications</groupId>
                                                <artifactId>aai</artifactId>
-                                               <version>1.1.0</version>
+                                               <version>1.1.3</version>
                                                <exclusions>
                                                                <exclusion>
                                                                                <artifactId>log4j</artifactId>
index 3e27e3e..f4fe706 100644 (file)
@@ -42,6 +42,7 @@ import org.springframework.boot.autoconfigure.security.SecurityAutoConfiguration
 import org.springframework.boot.builder.SpringApplicationBuilder;
 import org.springframework.boot.context.embedded.EmbeddedServletContainerFactory;
 import org.springframework.boot.context.embedded.tomcat.TomcatEmbeddedServletContainerFactory;
+import org.springframework.boot.context.properties.EnableConfigurationProperties;
 import org.springframework.boot.web.servlet.ServletRegistrationBean;
 import org.springframework.boot.web.support.SpringBootServletInitializer;
 import org.springframework.context.annotation.Bean;
@@ -56,6 +57,7 @@ import org.springframework.scheduling.annotation.EnableAsync;
         DataSourceAutoConfiguration.class, HibernateJpaAutoConfiguration.class, JpaRepositoriesAutoConfiguration.class,
         SecurityAutoConfiguration.class, ManagementWebSecurityAutoConfiguration.class
 })
+@EnableConfigurationProperties
 @EnableAsync
 public class Application extends SpringBootServletInitializer {
 
index ffc9b8e..f1cfd18 100644 (file)
@@ -61,6 +61,8 @@ public class DcaeInventoryServices {
     protected static final EELFLogger auditLogger = EELFManager.getInstance().getAuditLogger();\r
     protected static final EELFLogger metricsLogger = EELFManager.getInstance().getMetricsLogger();\r
     public static final String DCAE_INVENTORY_URL = "dcae.inventory.url";\r
+    public static final String DCAE_INVENTORY_RETRY_INTERVAL = "dcae.intentory.retry.interval";\r
+    public static final String DCAE_INVENTORY_RETRY_LIMIT = "dcae.intentory.retry.limit";\r
     public static final String DCAE_TYPE_NAME = "typeName";\r
     public static final String DCAE_TYPE_ID = "typeId";\r
     @Autowired\r
@@ -78,7 +80,7 @@ public class DcaeInventoryServices {
      * @throws ParseException\r
      *             In case of DCAE Json parse exception\r
      */\r
-    public void setEventInventory(CldsModel cldsModel, String userId) throws ParseException {\r
+    public void setEventInventory(CldsModel cldsModel, String userId) throws ParseException, InterruptedException {\r
         String artifactName = cldsModel.getControlName();\r
         DcaeEvent dcaeEvent = new DcaeEvent();\r
         DcaeInventoryResponse dcaeResponse = null;\r
@@ -159,7 +161,7 @@ public class DcaeInventoryServices {
      *             In case of issues with the Json parsing\r
      */\r
     public DcaeInventoryResponse getDcaeInformation(String artifactName, String serviceUuid, String resourceUuid)\r
-            throws IOException, ParseException {\r
+            throws IOException, ParseException, InterruptedException {\r
         Date startTime = new Date();\r
         LoggingUtils.setTargetContext("DCAE", "getDcaeInformation");\r
         String queryString = "?asdcResourceId=" + resourceUuid + "&asdcServiceId=" + serviceUuid + "&typeName="\r
@@ -167,7 +169,8 @@ public class DcaeInventoryServices {
         String fullUrl = refProp.getStringValue(DCAE_INVENTORY_URL) + "/dcae-service-types" + queryString;\r
         logger.info("Dcae Inventory Service full url - " + fullUrl);\r
         String dcaeInventoryResponse = null;\r
-        String responseStr = DcaeHttpConnectionManager.doDcaeHttpQuery(fullUrl, "GET", null, null);\r
+\r
+        String responseStr = queryDCAEInventory (fullUrl);\r
         JSONParser parser = new JSONParser();\r
         Object obj0 = parser.parse(responseStr);\r
         JSONObject jsonObj = (JSONObject) obj0;\r
@@ -185,6 +188,34 @@ public class DcaeInventoryServices {
         return JacksonUtils.getObjectMapperInstance().readValue(dcaeInventoryResponse, DcaeInventoryResponse.class);\r
     }\r
 \r
+    private String queryDCAEInventory (String fullUrl) throws IOException, InterruptedException {\r
+        int retryInterval = 0;\r
+        int retryLimit = 1;\r
+        if (refProp.getStringValue(DCAE_INVENTORY_RETRY_LIMIT) != null) {\r
+            retryLimit = Integer.valueOf(refProp.getStringValue(DCAE_INVENTORY_RETRY_LIMIT));\r
+        }\r
+        if (refProp.getStringValue(DCAE_INVENTORY_RETRY_INTERVAL) != null) {\r
+               retryInterval = Integer.valueOf(refProp.getStringValue(DCAE_INVENTORY_RETRY_INTERVAL));\r
+        }\r
+\r
+        int i = 0;\r
+        while (i < retryLimit) {\r
+            i++;\r
+            try {\r
+                return DcaeHttpConnectionManager.doDcaeHttpQuery(fullUrl, "GET", null, null);\r
+            } catch (BadRequestException e) {\r
+                if (i == retryLimit) {\r
+                    // reach the retry limit, but still failed to connect to DCAE\r
+                    throw e;\r
+                } else {\r
+                    // wait for a while and try to connect to DCAE again\r
+                    Thread.sleep(retryInterval);\r
+                }\r
+            }\r
+        }\r
+        // normally it should not go to this branch. It should either return the DCAE query result, or throw exception\r
+        return null;\r
+    }\r
     /**\r
      * Inserts a new DCAEServiceType or updates an existing instance. If the\r
      * typeName is same second time(already exists) then the\r
index 8caac0c..5c68f00 100644 (file)
@@ -26,7 +26,6 @@ package org.onap.clamp.clds.client.req.policy;
 import com.att.eelf.configuration.EELFLogger;
 import com.att.eelf.configuration.EELFManager;
 
-import java.io.IOException;
 import java.util.ArrayList;
 import java.util.Collection;
 import java.util.Collections;
@@ -38,6 +37,7 @@ import java.util.UUID;
 import javax.ws.rs.BadRequestException;
 
 import org.onap.clamp.clds.config.ClampProperties;
+import org.onap.clamp.clds.config.PolicyConfiguration;
 import org.onap.clamp.clds.exception.policy.PolicyClientException;
 import org.onap.clamp.clds.model.properties.ModelProperties;
 import org.onap.clamp.clds.util.LoggingUtils;
@@ -55,7 +55,6 @@ import org.onap.policy.api.PolicyParameters;
 import org.onap.policy.api.PolicyType;
 import org.onap.policy.api.PushPolicyParameters;
 import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.beans.factory.annotation.Value;
 import org.springframework.context.ApplicationContext;
 import org.springframework.stereotype.Component;
 
@@ -71,12 +70,12 @@ public class PolicyClient {
     protected static final EELFLogger metricsLogger = EELFManager.getInstance().getMetricsLogger();
     protected static final String POLICY_MSTYPE_PROPERTY_NAME = "policy.ms.type";
     protected static final String POLICY_ONAPNAME_PROPERTY_NAME = "policy.onap.name";
-    @Value("${clamp.config.files.cldsPolicyConfig:'classpath:/clds/clds-policy-config.properties'}")
-    protected String cldsPolicyConfigFile;
     @Autowired
     protected ApplicationContext appContext;
     @Autowired
     protected ClampProperties refProp;
+    @Autowired
+    private PolicyConfiguration policyConfiguration;
 
     /**
      * Perform BRMS policy type.
@@ -353,9 +352,7 @@ public class PolicyClient {
     private PolicyEngine getPolicyEngine() {
         PolicyEngine policyEngine;
         try {
-            policyEngine = new PolicyEngine(appContext.getResource(cldsPolicyConfigFile).getFile().getAbsolutePath());
-        } catch (IOException e1) {
-            throw new PolicyClientException("Exception when opening policy config file", e1);
+            policyEngine = new PolicyEngine(policyConfiguration.getProperties());
         } catch (PolicyEngineException e) {
             throw new PolicyClientException("Exception when creating a new policy engine", e);
         }
diff --git a/src/main/java/org/onap/clamp/clds/config/PolicyConfiguration.java b/src/main/java/org/onap/clamp/clds/config/PolicyConfiguration.java
new file mode 100644 (file)
index 0000000..53899d5
--- /dev/null
@@ -0,0 +1,128 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP CLAMP
+ * ================================================================================
+ * Copyright (C) 2018 AT&T Intellectual Property. All rights
+ *                             reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END============================================
+ * ===================================================================
+ * ECOMP is a trademark and service mark of AT&T Intellectual Property.
+ */
+
+package org.onap.clamp.clds.config;
+
+import java.util.Properties;
+
+import org.springframework.boot.context.properties.ConfigurationProperties;
+import org.springframework.stereotype.Component;
+
+@Component
+@ConfigurationProperties(prefix = "clamp.config.policy")
+public class PolicyConfiguration {
+
+    public static final String PDP_URL1 = "PDP_URL1";
+    public static final String PDP_URL2 = "PDP_URL2";
+    public static final String PAP_URL = "PAP_URL";
+    public static final String NOTIFICATION_TYPE = "NOTIFICATION_TYPE";
+    public static final String NOTIFICATION_UEB_SERVERS = "NOTIFICATION_UEB_SERVERS";
+    public static final String CLIENT_ID = "CLIENT_ID";
+    public static final String CLIENT_KEY = "CLIENT_KEY";
+    public static final String ENVIRONMENT = "ENVIRONMENT";
+    private String pdpUrl1;
+    private String pdpUrl2;
+    private String papUrl;
+    private String notificationType;
+    private String notificationUebServers;
+    private String clientId;
+    private String clientKey;
+    private String policyEnvironment;
+
+    public String getPdpUrl1() {
+        return pdpUrl1;
+    }
+
+    public void setPdpUrl1(String pdpUrl1) {
+        this.pdpUrl1 = pdpUrl1;
+    }
+
+    public String getPdpUrl2() {
+        return pdpUrl2;
+    }
+
+    public void setPdpUrl2(String pdpUrl2) {
+        this.pdpUrl2 = pdpUrl2;
+    }
+
+    public String getPapUrl() {
+        return papUrl;
+    }
+
+    public void setPapUrl(String papUrl) {
+        this.papUrl = papUrl;
+    }
+
+    public String getNotificationType() {
+        return notificationType;
+    }
+
+    public void setNotificationType(String notificationType) {
+        this.notificationType = notificationType;
+    }
+
+    public String getNotificationUebServers() {
+        return notificationUebServers;
+    }
+
+    public void setNotificationUebServers(String notificationUebServers) {
+        this.notificationUebServers = notificationUebServers;
+    }
+
+    public String getClientId() {
+        return clientId;
+    }
+
+    public void setClientId(String clientId) {
+        this.clientId = clientId;
+    }
+
+    public String getClientKey() {
+        return clientKey;
+    }
+
+    public void setClientKey(String clientKey) {
+        this.clientKey = clientKey;
+    }
+
+    public String getPolicyEnvironment() {
+        return policyEnvironment;
+    }
+
+    public void setPolicyEnvironment(String environment) {
+        this.policyEnvironment = environment;
+    }
+
+    public Properties getProperties() {
+        Properties prop = new Properties();
+        prop.put(PDP_URL1, pdpUrl1);
+        prop.put(PDP_URL2, pdpUrl2);
+        prop.put(PAP_URL, papUrl);
+        prop.put(NOTIFICATION_TYPE, notificationType);
+        prop.put(NOTIFICATION_UEB_SERVERS, notificationUebServers);
+        prop.put(CLIENT_ID, clientId);
+        prop.put(CLIENT_KEY, clientKey);
+        prop.put(ENVIRONMENT, policyEnvironment);
+        return prop;
+    }
+}
index 627bc72..a44f867 100644 (file)
@@ -27,6 +27,7 @@ import com.att.eelf.configuration.EELFLogger;
 import com.att.eelf.configuration.EELFManager;\r
 \r
 import java.util.Date;\r
+import java.util.concurrent.ThreadLocalRandom;\r
 \r
 import org.onap.clamp.clds.config.ClampProperties;\r
 import org.onap.clamp.clds.config.sdc.SdcSingleControllerConfiguration;\r
@@ -200,6 +201,10 @@ public class SdcSingleController {
     public void treatNotification(INotificationData iNotif) {\r
         CsarHandler csar = null;\r
         try {\r
+            // wait for a random time, so that 2 running Clamp will not treat the same Notification at the same time \r
+            int i = ThreadLocalRandom.current().nextInt(1, 5);\r
+            Thread.sleep(i * 1000);\r
+\r
             logger.info("Notification received for service UUID:" + iNotif.getServiceUUID());\r
             this.changeControllerStatus(SdcSingleControllerStatus.BUSY);\r
             csar = new CsarHandler(iNotif, this.sdcConfig.getSdcControllerName(),\r
@@ -241,6 +246,8 @@ public class SdcSingleController {
             this.sendSdcNotification(NotificationType.DEPLOY, csar.getArtifactElement().getArtifactURL(),\r
                     sdcConfig.getConsumerID(), iNotif.getDistributionID(), DistributionStatusEnum.DEPLOY_ERROR,\r
                     e.getMessage(), System.currentTimeMillis());\r
+        } catch (InterruptedException e) {\r
+            logger.error("Interrupt exception caught during the notification processing", e);\r
         } catch (RuntimeException e) {\r
             logger.error("Unexpected exception caught during the notification processing", e);\r
         } finally {\r
index 1b5b425..cb0da0a 100644 (file)
@@ -43,6 +43,7 @@ import org.onap.clamp.clds.model.CldsModel;
 import org.onap.clamp.clds.model.CldsTemplate;
 import org.onap.clamp.clds.service.CldsService;
 import org.onap.clamp.clds.service.CldsTemplateService;
+import org.springframework.transaction.annotation.Transactional;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.beans.factory.annotation.Value;
 import org.springframework.context.ApplicationContext;
@@ -89,13 +90,14 @@ public class CsarInstallerImpl implements CsarInstaller {
     }
 
     @Override
+    @Transactional
     public void installTheCsar(CsarHandler csar) throws SdcArtifactInstallerException {
         try {
             String serviceTypeId = queryDcaeToGetServiceTypeId(csar);
             createFakeCldsModel(csar, createFakeCldsTemplate(csar, this.searchForRightMapping(csar)), serviceTypeId);
         } catch (IOException e) {
             throw new SdcArtifactInstallerException("Exception caught during the Csar installation in database", e);
-        } catch (ParseException e) {
+        } catch (ParseException | InterruptedException e) {
             throw new SdcArtifactInstallerException("Exception caught during the Dcae query to get ServiceTypeId", e);
         }
     }
@@ -149,7 +151,7 @@ public class CsarInstallerImpl implements CsarInstaller {
         return policyNameList.get(0);
     }
 
-    private String queryDcaeToGetServiceTypeId(CsarHandler csar) throws IOException, ParseException {
+    private String queryDcaeToGetServiceTypeId(CsarHandler csar) throws IOException, ParseException, InterruptedException {
         return dcaeInventoryService.getDcaeInformation(csar.getBlueprintArtifactName(),
                 csar.getBlueprintInvariantServiceUuid(), csar.getBlueprintInvariantResourceUuid()).getTypeId();
     }
index 5f6a0d6..0d58350 100644 (file)
@@ -124,6 +124,21 @@ clamp.config.sdc.template=classpath:/clds/templates/sdc-template.json
 clamp.config.sdc.decode.service_ids=classpath:/clds/templates/sdc-decode-service_ids.json\r
 #\r
 #\r
+# Configuration Settings for Policy Engine Components\r
+clamp.config.policy.pdpUrl1=http://vm1.policy.simpledemo.onap.org:8081/pdp/ , testpdp, alpha123\r
+clamp.config.policy.pdpUrl2=http://vm1.policy.simpledemo.onap.org:8081/pdp/ , testpdp, alpha123\r
+clamp.config.policy.papUrl=http://vm1.policy.simpledemo.onap.org:8081/pap/ , testpap, alpha123\r
+clamp.config.policy.notificationType=websocket\r
+clamp.config.policy.notificationUebServers=localhost\r
+clamp.config.policy.notificationTopic=\r
+clamp.config.policy.clientId=myclientid\r
+# base64 encoding\r
+\r
+clamp.config.policy.clientKey=5CE79532B3A2CB4D132FC0C04BF916A7\r
+#DEVL for development\r
+#TEST for Test environments\r
+#PROD for prod environments\r
+clamp.config.policy.policyEnvironment=TEST\r
 # General Policy request properties\r
 #\r
 clamp.config.policy.onap.name=DCAE\r
@@ -191,6 +206,8 @@ clamp.config.clds.service.cache.invalidate.after.seconds=120
 \r
 #DCAE Inventory Url Properties\r
 clamp.config.dcae.inventory.url=http://dcae.api.simpledemo.onap.org:8080\r
+clamp.config.dcae.intentory.retry.interval=10000\r
+clamp.config.dcae.intentory.retry.limit=3\r
 \r
 #DCAE Dispatcher Url Properties\r
 clamp.config.dcae.dispatcher.url=http://dcae.api.simpledemo.onap.org:8080\r
@@ -203,4 +220,4 @@ clamp.config.security.permission.type.cl.event=permission-type-cl-event
 clamp.config.security.permission.type.filter.vf=permission-type-filter-vf\r
 clamp.config.security.permission.type.template=permission-type-template\r
 #This one indicates the type of instances (dev|prod|perf...), this must be set accordingly in clds-users.properties\r
-clamp.config.security.permission.instance=dev
\ No newline at end of file
+clamp.config.security.permission.instance=dev\r
diff --git a/src/main/resources/clds/clds-policy-config.properties b/src/main/resources/clds/clds-policy-config.properties
deleted file mode 100644 (file)
index 54b9277..0000000
+++ /dev/null
@@ -1,37 +0,0 @@
-###
-# ============LICENSE_START=======================================================
-# ONAP CLAMP
-# ================================================================================
-# Copyright (C) 2017 AT&T Intellectual Property. All rights
-#                             reserved.
-# ================================================================================
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-# ============LICENSE_END============================================
-# ===================================================================
-# ECOMP is a trademark and service mark of AT&T Intellectual Property.
-###
-
-# Configuration Settings for Policy Engine Components
-PDP_URL1=http://vm1.policy.simpledemo.onap.org:8081/pdp/ , testpdp, alpha123
-PDP_URL2=http://vm1.policy.simpledemo.onap.org:8081/pdp/ , testpdp, alpha123
-NOTIFICATION_TYPE=websocket
-NOTIFICATION_UEB_SERVERS=localhost
-NOTIFICATION_TOPIC=
-CLIENT_ID=myclientid
-# base64 encoding
-#CLIENT_KEY=ChlakDuk
-CLIENT_KEY=5CE79532B3A2CB4D132FC0C04BF916A7
-#DEVL for development
-#TEST for Test environments
-#PROD for prod environments
-ENVIRONMENT=TEST
\ No newline at end of file
index 71cd9f6..c7f0f28 100644 (file)
@@ -23,6 +23,8 @@
 
 package org.onap.clamp.clds.it;
 
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
 import static org.junit.Assert.assertTrue;
 
 import java.io.IOException;
@@ -37,6 +39,7 @@ import org.onap.clamp.clds.client.req.policy.OperationalPolicyReq;
 import org.onap.clamp.clds.client.req.policy.PolicyClient;
 import org.onap.clamp.clds.client.req.tca.TcaRequestFormatter;
 import org.onap.clamp.clds.config.ClampProperties;
+import org.onap.clamp.clds.config.PolicyConfiguration;
 import org.onap.clamp.clds.model.CldsEvent;
 import org.onap.clamp.clds.model.properties.ModelProperties;
 import org.onap.clamp.clds.model.properties.Policy;
@@ -56,6 +59,8 @@ import org.springframework.test.context.junit4.SpringRunner;
 @SpringBootTest
 public class PolicyClientItCase {
 
+    @Autowired
+    private PolicyConfiguration policyConfiguration;
     @Autowired
     private ClampProperties refProp;
     @Autowired
@@ -144,4 +149,30 @@ public class PolicyClientItCase {
         TimeUnit.SECONDS.sleep(20);
         deleteTcaPolicy(CldsEvent.ACTION_DELETE);
     }
+
+    @Test
+    public void testPolicyConfiguration() {
+        assertNotNull(policyConfiguration.getPdpUrl1());
+        assertNotNull(policyConfiguration.getPdpUrl2());
+        assertNotNull(policyConfiguration.getPapUrl());
+        assertNotNull(policyConfiguration.getPolicyEnvironment());
+        assertNotNull(policyConfiguration.getClientId());
+        assertNotNull(policyConfiguration.getClientKey());
+        assertNotNull(policyConfiguration.getNotificationType());
+        assertNotNull(policyConfiguration.getNotificationUebServers());
+        assertEquals(8, policyConfiguration.getProperties().size());
+        assertTrue(((String) policyConfiguration.getProperties().get(PolicyConfiguration.PDP_URL1))
+                .contains("/pdp/ , testpdp, alpha123"));
+        assertTrue(((String) policyConfiguration.getProperties().get(PolicyConfiguration.PDP_URL2))
+                .contains("/pdp/ , testpdp, alpha123"));
+        assertTrue(((String) policyConfiguration.getProperties().get(PolicyConfiguration.PAP_URL))
+                .contains("/pap/ , testpap, alpha123"));
+        assertEquals("websocket", policyConfiguration.getProperties().get(PolicyConfiguration.NOTIFICATION_TYPE));
+        assertEquals("localhost",
+                policyConfiguration.getProperties().get(PolicyConfiguration.NOTIFICATION_UEB_SERVERS));
+        assertEquals("myclientid", policyConfiguration.getProperties().get(PolicyConfiguration.CLIENT_ID));
+        assertEquals("5CE79532B3A2CB4D132FC0C04BF916A7",
+                policyConfiguration.getProperties().get(PolicyConfiguration.CLIENT_KEY));
+        assertEquals("DEVL", policyConfiguration.getProperties().get(PolicyConfiguration.ENVIRONMENT));
+    }
 }
index 37f9bd7..676c5b9 100644 (file)
@@ -124,6 +124,20 @@ clamp.config.sdc.template=classpath:/clds/templates/sdc-template.json
 clamp.config.sdc.decode.service_ids=classpath:/clds/templates/sdc-decode-service_ids.json\r
 #\r
 #\r
+# Configuration Settings for Policy Engine Components\r
+clamp.config.policy.pdpUrl1=http://localhost:${docker.http-cache.port.host}/pdp/ , testpdp, alpha123\r
+clamp.config.policy.pdpUrl2=http://localhost:${docker.http-cache.port.host}/pdp/ , testpdp, alpha123\r
+clamp.config.policy.papUrl=http://localhost:${docker.http-cache.port.host}/pap/ , testpap, alpha123\r
+clamp.config.policy.notificationType=websocket\r
+clamp.config.policy.notificationUebServers=localhost\r
+clamp.config.policy.notificationTopic=\r
+clamp.config.policy.clientId=myclientid\r
+# base64 encoding\r
+clamp.config.policy.clientKey=5CE79532B3A2CB4D132FC0C04BF916A7\r
+#DEVL for development\r
+#TEST for Test environments\r
+#PROD for prod environments\r
+clamp.config.policy.policyEnvironment=DEVL\r
 # General Policy request properties\r
 #\r
 clamp.config.policy.onap.name=DCAE\r
diff --git a/src/test/resources/clds/clds-policy-config.properties b/src/test/resources/clds/clds-policy-config.properties
deleted file mode 100644 (file)
index 892cdda..0000000
+++ /dev/null
@@ -1,37 +0,0 @@
-###
-# ============LICENSE_START=======================================================
-# ONAP CLAMP
-# ================================================================================
-# Copyright (C) 2017 AT&T Intellectual Property. All rights
-#                             reserved.
-# ================================================================================
-# Licensed under the Apache License, Version 2.0 (the "License"); 
-# you may not use this file except in compliance with the License. 
-# You may obtain a copy of the License at
-# 
-# http://www.apache.org/licenses/LICENSE-2.0
-# 
-# Unless required by applicable law or agreed to in writing, software 
-# distributed under the License is distributed on an "AS IS" BASIS, 
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 
-# See the License for the specific language governing permissions and 
-# limitations under the License.
-# ============LICENSE_END============================================
-# ===================================================================
-# ECOMP is a trademark and service mark of AT&T Intellectual Property.
-###
-
-# Configuration Settings for Policy Engine Components
-PDP_URL1=https://localhost:8081/pdp/ , testpdp, alpha123
-PDP_URL2=https://localhost:8081/pdp/ , testpdp, alpha456
-PAP_URL=https://localhost:8081/pap/ , testpap, alpha123
-NOTIFICATION_TYPE=websocket
-NOTIFICATION_UEB_SERVERS=localhost
-
-CLIENT_ID=myclientid
-# base64 encoding
-CLIENT_KEY=ChlakDuk
-#DEVL for development
-#TEST for Test environments
-#PROD for prod environments
-ENVIRONMENT=DEVL