Update SDC library 45/41345/1
authorDeterme, Sebastien (sd378r) <sd378r@intl.att.com>
Fri, 6 Apr 2018 09:48:07 +0000 (11:48 +0200)
committerDeterme, Sebastien (sd378r) <sd378r@intl.att.com>
Fri, 6 Apr 2018 09:48:07 +0000 (11:48 +0200)
Upgrade SDC library to latest and remove the message bus condition, it's
now a mandatory parameter as well

Issue-ID: CLAMP-149
Change-Id: I4c7ddcca6ac176380821bd8f1e4e3ef3d9fcea30
Signed-off-by: Determe, Sebastien (sd378r) <sd378r@intl.att.com>
12 files changed:
pom.xml
src/main/java/org/onap/clamp/clds/config/sdc/SdcSingleControllerConfiguration.java
src/main/java/org/onap/clamp/clds/sdc/controller/DistributionStatusMessage.java
src/main/java/org/onap/clamp/clds/sdc/controller/SdcSingleController.java
src/main/java/org/onap/clamp/clds/sdc/controller/installer/CsarHandler.java
src/main/resources/clds/sdc-controllers-config.json
src/test/java/org/onap/clamp/clds/config/sdc/SdcSingleControllerConfigurationTest.java
src/test/java/org/onap/clamp/clds/sdc/controller/installer/CsarHandlerTest.java
src/test/resources/clds/sdc-controller-config-NULL.json
src/test/resources/clds/sdc-controller-config-TLS.json
src/test/resources/clds/sdc-controller-config-bad.json
src/test/resources/clds/sdc-controller-config-empty-encrypted.json [moved from src/test/resources/clds/sdc-controller-config-bad-address.json with 69% similarity]

diff --git a/pom.xml b/pom.xml
index 007b660..6087029 100644 (file)
--- a/pom.xml
+++ b/pom.xml
                                </dependency>
                                <!-- For SDC Controller -->
                                <dependency>
-                                               <groupId>org.openecomp.sdc.sdc-distribution-client</groupId>
+                                               <groupId>org.onap.sdc.sdc-distribution-client</groupId>
                                                <artifactId>sdc-distribution-client</artifactId>
-                                               <version>1.2.2</version>
+                                               <version>1.3.0</version>
                                </dependency>
                                <dependency>
-                                       <groupId>org.openecomp.sdc.sdc-tosca</groupId>
+                                       <groupId>org.onap.sdc.sdc-tosca</groupId>
                                        <artifactId>sdc-tosca</artifactId>
-                                       <version>1.2.2</version>
+                                       <version>1.3.3</version>
                                </dependency>
                </dependencies>
 
index e2aac55..bc3d1b9 100644 (file)
@@ -36,7 +36,7 @@ import java.util.List;
 import org.apache.commons.codec.DecoderException;
 import org.onap.clamp.clds.exception.sdc.controller.SdcParametersException;
 import org.onap.clamp.clds.util.CryptoUtils;
-import org.openecomp.sdc.api.consumer.IConfiguration;
+import org.onap.sdc.api.consumer.IConfiguration;
 
 /**
  * This class maps the SDC config JSON for one controller.
@@ -129,8 +129,8 @@ public class SdcSingleControllerConfiguration implements IConfiguration {
 
     private String getEncryptedStringConfig(String key) throws GeneralSecurityException, DecoderException {
         if (jsonRootNode != null && jsonRootNode.get(key) != null) {
-            String config = CryptoUtils.decrypt(jsonRootNode.get(key).asText());
-            return config.isEmpty() ? null : config;
+            return jsonRootNode.get(key).asText().isEmpty() ? null
+                    : CryptoUtils.decrypt(jsonRootNode.get(key).asText());
         }
         return null;
     }
@@ -241,10 +241,10 @@ public class SdcSingleControllerConfiguration implements IConfiguration {
             throw new SdcParametersException(ENVIRONMENT_NAME_ATTRIBUTE_NAME + errorMessageKeyNotFound);
         }
         if (this.getAsdcAddress() == null || this.getAsdcAddress().isEmpty()) {
-            if (this.getMsgBusAddress() == null || this.getMsgBusAddress().isEmpty()) {
-                throw new SdcParametersException(SDC_ADDRESS_ATTRIBUTE_NAME + " and " + MESSAGE_BUS_ADDRESSES
-                        + " are not set, one of them should be set for SDC client" + errorMessageKeyNotFound);
-            }
+            throw new SdcParametersException(SDC_ADDRESS_ATTRIBUTE_NAME + errorMessageKeyNotFound);
+        }
+        if (this.getMsgBusAddress() == null || this.getMsgBusAddress().isEmpty()) {
+            throw new SdcParametersException(MESSAGE_BUS_ADDRESSES + errorMessageKeyNotFound);
         }
         if (this.getPassword() == null || this.getPassword().isEmpty()) {
             throw new SdcParametersException(SDC_KEY_ATTRIBUTE_NAME + errorMessageKeyNotFound);
index db5d271..ca4f97b 100644 (file)
@@ -23,8 +23,8 @@
 
 package org.onap.clamp.clds.sdc.controller;
 
-import org.openecomp.sdc.api.consumer.IDistributionStatusMessage;
-import org.openecomp.sdc.utils.DistributionStatusEnum;
+import org.onap.sdc.api.consumer.IDistributionStatusMessage;
+import org.onap.sdc.utils.DistributionStatusEnum;
 
 public class DistributionStatusMessage implements IDistributionStatusMessage {
 
index c02edbb..2744ef7 100644 (file)
@@ -38,17 +38,17 @@ import org.onap.clamp.clds.exception.sdc.controller.SdcParametersException;
 import org.onap.clamp.clds.sdc.controller.installer.CsarHandler;\r
 import org.onap.clamp.clds.sdc.controller.installer.CsarInstaller;\r
 import org.onap.clamp.clds.util.LoggingUtils;\r
-import org.openecomp.sdc.api.IDistributionClient;\r
-import org.openecomp.sdc.api.consumer.IDistributionStatusMessage;\r
-import org.openecomp.sdc.api.consumer.INotificationCallback;\r
-import org.openecomp.sdc.api.notification.IArtifactInfo;\r
-import org.openecomp.sdc.api.notification.INotificationData;\r
-import org.openecomp.sdc.api.results.IDistributionClientDownloadResult;\r
-import org.openecomp.sdc.api.results.IDistributionClientResult;\r
-import org.openecomp.sdc.impl.DistributionClientFactory;\r
-import org.openecomp.sdc.tosca.parser.exceptions.SdcToscaParserException;\r
-import org.openecomp.sdc.utils.DistributionActionResultEnum;\r
-import org.openecomp.sdc.utils.DistributionStatusEnum;\r
+import org.onap.sdc.api.IDistributionClient;\r
+import org.onap.sdc.api.consumer.IDistributionStatusMessage;\r
+import org.onap.sdc.api.consumer.INotificationCallback;\r
+import org.onap.sdc.api.notification.IArtifactInfo;\r
+import org.onap.sdc.api.notification.INotificationData;\r
+import org.onap.sdc.api.results.IDistributionClientDownloadResult;\r
+import org.onap.sdc.api.results.IDistributionClientResult;\r
+import org.onap.sdc.impl.DistributionClientFactory;\r
+import org.onap.sdc.tosca.parser.exceptions.SdcToscaParserException;\r
+import org.onap.sdc.utils.DistributionActionResultEnum;\r
+import org.onap.sdc.utils.DistributionStatusEnum;\r
 \r
 /**\r
  * This class handles one sdc controller defined in the config.\r
index 97ab058..2b83905 100644 (file)
@@ -41,13 +41,13 @@ import java.util.zip.ZipFile;
 
 import org.onap.clamp.clds.exception.sdc.controller.CsarHandlerException;
 import org.onap.clamp.clds.exception.sdc.controller.SdcArtifactInstallerException;
-import org.openecomp.sdc.api.notification.IArtifactInfo;
-import org.openecomp.sdc.api.notification.INotificationData;
-import org.openecomp.sdc.api.notification.IResourceInstance;
-import org.openecomp.sdc.api.results.IDistributionClientDownloadResult;
-import org.openecomp.sdc.tosca.parser.api.ISdcCsarHelper;
-import org.openecomp.sdc.tosca.parser.exceptions.SdcToscaParserException;
-import org.openecomp.sdc.tosca.parser.impl.SdcToscaParserFactory;
+import org.onap.sdc.api.notification.IArtifactInfo;
+import org.onap.sdc.api.notification.INotificationData;
+import org.onap.sdc.api.notification.IResourceInstance;
+import org.onap.sdc.api.results.IDistributionClientDownloadResult;
+import org.onap.sdc.tosca.parser.api.ISdcCsarHelper;
+import org.onap.sdc.tosca.parser.exceptions.SdcToscaParserException;
+import org.onap.sdc.tosca.parser.impl.SdcToscaParserFactory;
 
 /**
  * CsarDescriptor that will be used to deploy file in CLAMP file system. Some
index bf1a758..d18a161 100644 (file)
@@ -1,28 +1,18 @@
 {
   "sdc-connections":{
-    "sdc-controller1":{
-        "user": "User1",
+    "sdc-controller":{
+        "user": "clamp",
         "consumerGroup": "consumerGroup1",
         "consumerId": "consumerId1",
-        "environmentName": "environmentName1",
-        "sdcAddress": "sdc.api.simpledemo.onap.org:8080",
-        "password": "bb3871669d893c7fb8aaacda31b77b4f537E67A081C2726889548ED7BC4C2DE6",
-        "pollingInterval":10,
+        "environmentName": "AUTO",
+        "sdcAddress": "sdc.api.simpledemo.onap.org:8443",
+        "password": "b7acccda32b98c5bb7acccda32b98c5b05D511BD6D93626E90D18E9D24D9B78CD34C7EE8012F0A189A28763E82271E50A5D4EC10C7D93E06E0A2D27CAE66B981",
+        "pollingInterval":30,
         "pollingTimeout":30,
-        "messageBusAddresses":["localhost"]
-        
-    },
-     "sdc-controller2":{
-        "user": "User2",
-        "consumerGroup": "consumerGroup2",
-        "consumerId": "consumerId2",
-        "environmentName": "environmentName2",
-        "sdcAddress": "sdc.api.simpledemo.onap.org:8080",
-        "password": "bb3871669d893c7fb8aaacda31b77b4f537E67A081C2726889548ED7BC4C2DE6",
-        "pollingInterval":10,
-        "pollingTimeout":30,
-        "messageBusAddresses":["localhost"]
-        
+        "activateServerTLSAuth":"false",
+        "keyStorePassword":"",
+        "keyStorePath":"",
+        "messageBusAddresses":["ueb.api.simpledemo.onap.org"]
     }
   }
 }
index dd60d27..00d5dff 100644 (file)
@@ -22,6 +22,7 @@ package org.onap.clamp.clds.config.sdc;
 
 import static org.junit.Assert.assertArrayEquals;
 import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNull;
 import static org.junit.Assert.assertTrue;
 import static org.junit.Assert.fail;
 
@@ -59,7 +60,7 @@ public class SdcSingleControllerConfigurationTest {
         assertEquals("consumerGroup", sdcConfig.getConsumerGroup());
         assertEquals("consumerId", sdcConfig.getConsumerID());
         assertEquals("environmentName", sdcConfig.getEnvironmentName());
-        assertEquals("hostname", sdcConfig.getAsdcAddress());
+        assertEquals("hostname:8080", sdcConfig.getAsdcAddress());
         assertEquals(10, sdcConfig.getPollingInterval());
         assertEquals(30, sdcConfig.getPollingTimeout());
         assertEquals(SdcSingleControllerConfiguration.SUPPORTED_ARTIFACT_TYPES_LIST.size(),
@@ -81,13 +82,13 @@ public class SdcSingleControllerConfigurationTest {
         fail("Should have raised an exception");
     }
 
-    @Test(expected = SdcParametersException.class)
-    public final void testAllRequiredParametersAddresses()
+    @Test
+    public final void testAllRequiredParametersEmptyEncrypted()
             throws JsonParseException, JsonMappingException, IOException {
         SdcSingleControllerConfiguration sdcConfig = loadControllerConfiguration(
-                "clds/sdc-controller-config-bad-address.json", "sdc-controller1");
+                "clds/sdc-controller-config-empty-encrypted.json", "sdc-controller1");
         sdcConfig.testAllRequiredParameters();
-        fail("Should have raised an exception");
+        assertNull(sdcConfig.getKeyStorePassword());
     }
 
     @Test
index 5486e65..46bddaf 100644 (file)
@@ -43,11 +43,11 @@ import org.mockito.Mockito;
 import org.onap.clamp.clds.exception.sdc.controller.CsarHandlerException;
 import org.onap.clamp.clds.exception.sdc.controller.SdcArtifactInstallerException;
 import org.onap.clamp.clds.util.ResourceFileUtil;
-import org.openecomp.sdc.api.notification.IArtifactInfo;
-import org.openecomp.sdc.api.notification.INotificationData;
-import org.openecomp.sdc.api.notification.IResourceInstance;
-import org.openecomp.sdc.api.results.IDistributionClientDownloadResult;
-import org.openecomp.sdc.tosca.parser.exceptions.SdcToscaParserException;
+import org.onap.sdc.api.notification.IArtifactInfo;
+import org.onap.sdc.api.notification.INotificationData;
+import org.onap.sdc.api.notification.IResourceInstance;
+import org.onap.sdc.api.results.IDistributionClientDownloadResult;
+import org.onap.sdc.tosca.parser.exceptions.SdcToscaParserException;
 
 public class CsarHandlerTest {
 
index 5c8ec0c..bf310c7 100644 (file)
@@ -3,8 +3,9 @@
         "consumerGroup": "NULL",
         "consumerId": "consumerId",
         "environmentName": "environmentName",
-        "sdcAddress": "hostname",
+        "sdcAddress": "hostname:8080",
         "password": "bb3871669d893c7fb8aaacda31b77b4f537E67A081C2726889548ED7BC4C2DE6",
         "pollingInterval":10,
-        "pollingTimeout":30
+        "pollingTimeout":30,
+        "messageBusAddresses":["localhost"]
 }
index 066448e..99366b7 100644 (file)
@@ -3,7 +3,7 @@
         "consumerGroup": "consumerGroup",
         "consumerId": "consumerId",
         "environmentName": "environmentName",
-        "sdcAddress": "hostname",
+        "sdcAddress": "hostname:8080",
         "password": "bb3871669d893c7fb8aaacda31b77b4f537E67A081C2726889548ED7BC4C2DE6",
         "pollingInterval":10,
         "pollingTimeout":30,
index d99ed58..194ff5f 100644 (file)
@@ -5,7 +5,7 @@
                        "consumerGroup": "consumerGroup",
                        "consumerId": "consumerId",
                        "environmentName": "environmentName",
-                       "sdcAddress": "hostname1",
+                       "sdcAddress": "hostname1:8080",
                        "pollingInterval": 10,
                        "pollingTimeout": 30
                }
@@ -3,10 +3,12 @@
         "consumerGroup": "consumerGroup",
         "consumerId": "consumerId",
         "environmentName": "environmentName",
+        "sdcAddress": "hostname:8080",
         "password": "bb3871669d893c7fb8aaacda31b77b4f537E67A081C2726889548ED7BC4C2DE6",
         "pollingInterval":10,
         "pollingTimeout":30,
         "activateServerTLSAuth": true,
-        "keyStorePassword":"bb3871669d893c7fb8aaacda31b77b4f537E67A081C2726889548ED7BC4C2DE6",    
-        "keyStorePath": "/test"
+        "keyStorePassword":"",
+        "keyStorePath": "/test",
+        "messageBusAddresses":["localhost"]
 }