aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorEddy Hautot <eh552t@intl.att.com>2018-04-06 10:20:01 +0000
committerGerrit Code Review <gerrit@onap.org>2018-04-06 10:20:01 +0000
commitf6c9b5a616c431395bd8c8f962bd3c693fb45697 (patch)
treef64f57165efac45329fee32228ac2b10321c6f69 /src
parent70129e77f01878319d771fa0125bdd05c52d9608 (diff)
parentdd2d790dd97ec4260531bc1fdce5766bf85797d8 (diff)
Merge "Update SDC library"
Diffstat (limited to 'src')
-rw-r--r--src/main/java/org/onap/clamp/clds/config/sdc/SdcSingleControllerConfiguration.java14
-rw-r--r--src/main/java/org/onap/clamp/clds/sdc/controller/DistributionStatusMessage.java4
-rw-r--r--src/main/java/org/onap/clamp/clds/sdc/controller/SdcSingleController.java22
-rw-r--r--src/main/java/org/onap/clamp/clds/sdc/controller/installer/CsarHandler.java14
-rw-r--r--src/main/resources/clds/sdc-controllers-config.json30
-rw-r--r--src/test/java/org/onap/clamp/clds/config/sdc/SdcSingleControllerConfigurationTest.java11
-rw-r--r--src/test/java/org/onap/clamp/clds/sdc/controller/installer/CsarHandlerTest.java10
-rw-r--r--src/test/resources/clds/sdc-controller-config-NULL.json5
-rw-r--r--src/test/resources/clds/sdc-controller-config-TLS.json2
-rw-r--r--src/test/resources/clds/sdc-controller-config-bad.json2
-rw-r--r--src/test/resources/clds/sdc-controller-config-empty-encrypted.json (renamed from src/test/resources/clds/sdc-controller-config-bad-address.json)6
11 files changed, 57 insertions, 63 deletions
diff --git a/src/main/java/org/onap/clamp/clds/config/sdc/SdcSingleControllerConfiguration.java b/src/main/java/org/onap/clamp/clds/config/sdc/SdcSingleControllerConfiguration.java
index e2aac55f1..bc3d1b986 100644
--- a/src/main/java/org/onap/clamp/clds/config/sdc/SdcSingleControllerConfiguration.java
+++ b/src/main/java/org/onap/clamp/clds/config/sdc/SdcSingleControllerConfiguration.java
@@ -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);
diff --git a/src/main/java/org/onap/clamp/clds/sdc/controller/DistributionStatusMessage.java b/src/main/java/org/onap/clamp/clds/sdc/controller/DistributionStatusMessage.java
index db5d271b0..ca4f97b1d 100644
--- a/src/main/java/org/onap/clamp/clds/sdc/controller/DistributionStatusMessage.java
+++ b/src/main/java/org/onap/clamp/clds/sdc/controller/DistributionStatusMessage.java
@@ -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 {
diff --git a/src/main/java/org/onap/clamp/clds/sdc/controller/SdcSingleController.java b/src/main/java/org/onap/clamp/clds/sdc/controller/SdcSingleController.java
index c02edbbf9..2744ef7ae 100644
--- a/src/main/java/org/onap/clamp/clds/sdc/controller/SdcSingleController.java
+++ b/src/main/java/org/onap/clamp/clds/sdc/controller/SdcSingleController.java
@@ -38,17 +38,17 @@ import org.onap.clamp.clds.exception.sdc.controller.SdcParametersException;
import org.onap.clamp.clds.sdc.controller.installer.CsarHandler;
import org.onap.clamp.clds.sdc.controller.installer.CsarInstaller;
import org.onap.clamp.clds.util.LoggingUtils;
-import org.openecomp.sdc.api.IDistributionClient;
-import org.openecomp.sdc.api.consumer.IDistributionStatusMessage;
-import org.openecomp.sdc.api.consumer.INotificationCallback;
-import org.openecomp.sdc.api.notification.IArtifactInfo;
-import org.openecomp.sdc.api.notification.INotificationData;
-import org.openecomp.sdc.api.results.IDistributionClientDownloadResult;
-import org.openecomp.sdc.api.results.IDistributionClientResult;
-import org.openecomp.sdc.impl.DistributionClientFactory;
-import org.openecomp.sdc.tosca.parser.exceptions.SdcToscaParserException;
-import org.openecomp.sdc.utils.DistributionActionResultEnum;
-import org.openecomp.sdc.utils.DistributionStatusEnum;
+import org.onap.sdc.api.IDistributionClient;
+import org.onap.sdc.api.consumer.IDistributionStatusMessage;
+import org.onap.sdc.api.consumer.INotificationCallback;
+import org.onap.sdc.api.notification.IArtifactInfo;
+import org.onap.sdc.api.notification.INotificationData;
+import org.onap.sdc.api.results.IDistributionClientDownloadResult;
+import org.onap.sdc.api.results.IDistributionClientResult;
+import org.onap.sdc.impl.DistributionClientFactory;
+import org.onap.sdc.tosca.parser.exceptions.SdcToscaParserException;
+import org.onap.sdc.utils.DistributionActionResultEnum;
+import org.onap.sdc.utils.DistributionStatusEnum;
/**
* This class handles one sdc controller defined in the config.
diff --git a/src/main/java/org/onap/clamp/clds/sdc/controller/installer/CsarHandler.java b/src/main/java/org/onap/clamp/clds/sdc/controller/installer/CsarHandler.java
index 97ab05868..2b83905a8 100644
--- a/src/main/java/org/onap/clamp/clds/sdc/controller/installer/CsarHandler.java
+++ b/src/main/java/org/onap/clamp/clds/sdc/controller/installer/CsarHandler.java
@@ -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
diff --git a/src/main/resources/clds/sdc-controllers-config.json b/src/main/resources/clds/sdc-controllers-config.json
index bf1a758a8..d18a161a5 100644
--- a/src/main/resources/clds/sdc-controllers-config.json
+++ b/src/main/resources/clds/sdc-controllers-config.json
@@ -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"]
}
}
}
diff --git a/src/test/java/org/onap/clamp/clds/config/sdc/SdcSingleControllerConfigurationTest.java b/src/test/java/org/onap/clamp/clds/config/sdc/SdcSingleControllerConfigurationTest.java
index dd60d2796..00d5dffbb 100644
--- a/src/test/java/org/onap/clamp/clds/config/sdc/SdcSingleControllerConfigurationTest.java
+++ b/src/test/java/org/onap/clamp/clds/config/sdc/SdcSingleControllerConfigurationTest.java
@@ -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
diff --git a/src/test/java/org/onap/clamp/clds/sdc/controller/installer/CsarHandlerTest.java b/src/test/java/org/onap/clamp/clds/sdc/controller/installer/CsarHandlerTest.java
index 5486e652b..46bddaf4f 100644
--- a/src/test/java/org/onap/clamp/clds/sdc/controller/installer/CsarHandlerTest.java
+++ b/src/test/java/org/onap/clamp/clds/sdc/controller/installer/CsarHandlerTest.java
@@ -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 {
diff --git a/src/test/resources/clds/sdc-controller-config-NULL.json b/src/test/resources/clds/sdc-controller-config-NULL.json
index 5c8ec0cfe..bf310c706 100644
--- a/src/test/resources/clds/sdc-controller-config-NULL.json
+++ b/src/test/resources/clds/sdc-controller-config-NULL.json
@@ -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"]
}
diff --git a/src/test/resources/clds/sdc-controller-config-TLS.json b/src/test/resources/clds/sdc-controller-config-TLS.json
index 066448ee3..99366b765 100644
--- a/src/test/resources/clds/sdc-controller-config-TLS.json
+++ b/src/test/resources/clds/sdc-controller-config-TLS.json
@@ -3,7 +3,7 @@
"consumerGroup": "consumerGroup",
"consumerId": "consumerId",
"environmentName": "environmentName",
- "sdcAddress": "hostname",
+ "sdcAddress": "hostname:8080",
"password": "bb3871669d893c7fb8aaacda31b77b4f537E67A081C2726889548ED7BC4C2DE6",
"pollingInterval":10,
"pollingTimeout":30,
diff --git a/src/test/resources/clds/sdc-controller-config-bad.json b/src/test/resources/clds/sdc-controller-config-bad.json
index d99ed5801..194ff5f4b 100644
--- a/src/test/resources/clds/sdc-controller-config-bad.json
+++ b/src/test/resources/clds/sdc-controller-config-bad.json
@@ -5,7 +5,7 @@
"consumerGroup": "consumerGroup",
"consumerId": "consumerId",
"environmentName": "environmentName",
- "sdcAddress": "hostname1",
+ "sdcAddress": "hostname1:8080",
"pollingInterval": 10,
"pollingTimeout": 30
}
diff --git a/src/test/resources/clds/sdc-controller-config-bad-address.json b/src/test/resources/clds/sdc-controller-config-empty-encrypted.json
index 6775c6b3c..2a70b9edc 100644
--- a/src/test/resources/clds/sdc-controller-config-bad-address.json
+++ b/src/test/resources/clds/sdc-controller-config-empty-encrypted.json
@@ -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"]
}