summaryrefslogtreecommitdiffstats
path: root/asdc-controller
diff options
context:
space:
mode:
Diffstat (limited to 'asdc-controller')
-rw-r--r--asdc-controller/pom.xml17
-rw-r--r--asdc-controller/src/main/java/org/onap/so/asdc/client/ASDCConfiguration.java51
-rw-r--r--asdc-controller/src/main/java/org/onap/so/asdc/client/ASDCController.java2
-rw-r--r--asdc-controller/src/test/java/org/onap/so/asdc/client/ASDCConfigurationTest.java28
-rw-r--r--asdc-controller/src/test/java/org/onap/so/asdc/client/tests/ASDCConfigurationTest.java36
-rw-r--r--asdc-controller/src/test/resources/application-test.yaml4
-rw-r--r--asdc-controller/src/test/resources/mso-with-NULL.json5
-rw-r--r--asdc-controller/src/test/resources/mso.json5
-rw-r--r--asdc-controller/src/test/resources/mso4-with-TLS.json5
9 files changed, 68 insertions, 85 deletions
diff --git a/asdc-controller/pom.xml b/asdc-controller/pom.xml
index 244d83f7db..0334226ae6 100644
--- a/asdc-controller/pom.xml
+++ b/asdc-controller/pom.xml
@@ -15,6 +15,8 @@
<antlr.version>4.7.1</antlr.version>
<sdc.tosca.version>1.6.5</sdc.tosca.version>
<jtosca.version>1.5.1</jtosca.version>
+ <sdc-dist-client.version>2.0.0</sdc-dist-client.version>
+ <kafka-clients.version>3.3.1</kafka-clients.version>
</properties>
<build>
<finalName>${project.artifactId}-${project.version}</finalName>
@@ -188,6 +190,15 @@
</plugin>
</plugins>
</build>
+ <dependencyManagement>
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.kafka</groupId>
+ <artifactId>kafka-clients</artifactId>
+ <version>${kafka-clients.version}</version>
+ </dependency>
+ </dependencies>
+ </dependencyManagement>
<dependencies>
<dependency>
<groupId>io.swagger.core.v3</groupId>
@@ -225,7 +236,7 @@
<dependency>
<groupId>org.onap.sdc.sdc-distribution-client</groupId>
<artifactId>sdc-distribution-client</artifactId>
- <version>1.4.1</version>
+ <version>${sdc-dist-client.version}</version>
<exclusions>
<exclusion>
<groupId>org.slf4j</groupId>
@@ -234,6 +245,10 @@
</exclusions>
</dependency>
<dependency>
+ <groupId>org.apache.httpcomponents</groupId>
+ <artifactId>httpmime</artifactId>
+ </dependency>
+ <dependency>
<groupId>org.onap.sdc.sdc-tosca</groupId>
<artifactId>sdc-tosca</artifactId>
<version>${sdc.tosca.version}</version>
diff --git a/asdc-controller/src/main/java/org/onap/so/asdc/client/ASDCConfiguration.java b/asdc-controller/src/main/java/org/onap/so/asdc/client/ASDCConfiguration.java
index c2b3ffddca..8351552223 100644
--- a/asdc-controller/src/main/java/org/onap/so/asdc/client/ASDCConfiguration.java
+++ b/asdc-controller/src/main/java/org/onap/so/asdc/client/ASDCConfiguration.java
@@ -24,7 +24,6 @@ package org.onap.so.asdc.client;
import java.security.GeneralSecurityException;
import java.util.Arrays;
-import java.util.Collections;
import java.util.List;
import org.onap.sdc.api.consumer.IConfiguration;
import org.onap.so.utils.CryptoUtils;
@@ -42,7 +41,7 @@ public class ASDCConfiguration implements IConfiguration {
// echo -n "This is a test string" | openssl aes-128-ecb -e -K 546573746F736973546573746F736973
// -nosalt | xxd
- private static Logger logger = LoggerFactory.getLogger(ASDCConfiguration.class);
+ private static final Logger logger = LoggerFactory.getLogger(ASDCConfiguration.class);
private String asdcControllerName;
@@ -64,8 +63,7 @@ public class ASDCConfiguration implements IConfiguration {
HEAT_VOL, OTHER, TOSCA_CSAR, VF_MODULES_METADATA, WORKFLOW, CLOUD_TECHNOLOGY_SPECIFIC_ARTIFACT, HELM};
- public static final List<String> SUPPORTED_ARTIFACT_TYPES_LIST =
- Collections.unmodifiableList(Arrays.asList(SUPPORTED_ARTIFACT_TYPES));
+ public static final List<String> SUPPORTED_ARTIFACT_TYPES_LIST = List.of(SUPPORTED_ARTIFACT_TYPES);
@Autowired
private Environment env;
@@ -73,20 +71,12 @@ public class ASDCConfiguration implements IConfiguration {
@Value("${mso.asdc.config.key}")
private String configKey;
- @Value("${mso.asdc-connections.asdc-controller1.messageBusAddress}")
- private String[] messageBusAddress;
-
public void setAsdcControllerName(String asdcControllerName) {
this.asdcControllerName = asdcControllerName;
}
@Override
- public java.lang.Boolean isUseHttpsWithDmaap() {
- return getBooleanPropertyWithDefault("mso.asdc-connections.asdc-controller1.useHttpsWithDmaap", true);
- }
-
- @Override
- public java.lang.Boolean isUseHttpsWithSDC() {
+ public Boolean isUseHttpsWithSDC() {
return getBooleanPropertyWithDefault("mso.asdc-connections.asdc-controller1.useHttpsWithSdc", true);
}
@@ -95,15 +85,6 @@ public class ASDCConfiguration implements IConfiguration {
return true;
}
- @Override
- public List<String> getMsgBusAddress() {
- if (messageBusAddress.length > 0) {
- return Arrays.asList(messageBusAddress);
- } else {
- return Collections.emptyList();
- }
- }
-
public String getAsdcControllerName() {
return asdcControllerName;
}
@@ -173,7 +154,7 @@ public class ASDCConfiguration implements IConfiguration {
return defaultValue;
} else {
try {
- return Boolean.valueOf(config);
+ return Boolean.parseBoolean(config);
} catch (Exception e) {
logger.warn("Exception while getting boolean property with default property", e);
return defaultValue;
@@ -209,8 +190,8 @@ public class ASDCConfiguration implements IConfiguration {
}
@Override
- public String getAsdcAddress() {
- return getPropertyOrNull("mso.asdc-connections.asdc-controller1.asdcAddress");
+ public String getSdcAddress() {
+ return getPropertyOrNull("mso.asdc-connections.asdc-controller1.sdcAddress");
}
@Override
@@ -242,4 +223,24 @@ public class ASDCConfiguration implements IConfiguration {
return getBooleanPropertyWithDefault("mso.asdc-connections.asdc-controller1.isFilterInEmptyResources", true);
}
+ @Override
+ public String getHttpProxyHost() {
+ return getPropertyOrNull("mso.asdc-connections.asdc-controller1.httpProxyHost");
+ }
+
+ @Override
+ public int getHttpProxyPort() {
+ return getIntegerPropertyOrZero("mso.asdc-connections.asdc-controller1.httpProxyPort");
+ }
+
+ @Override
+ public String getHttpsProxyHost() {
+ return getPropertyOrNull("mso.asdc-connections.asdc-controller1.httpsProxyHost");
+ }
+
+ @Override
+ public int getHttpsProxyPort() {
+ return getIntegerPropertyOrZero("mso.asdc-connections.asdc-controller1.httpsProxyPort");
+ }
+
}
diff --git a/asdc-controller/src/main/java/org/onap/so/asdc/client/ASDCController.java b/asdc-controller/src/main/java/org/onap/so/asdc/client/ASDCController.java
index bb792f9fd1..8e3c5f4b7d 100644
--- a/asdc-controller/src/main/java/org/onap/so/asdc/client/ASDCController.java
+++ b/asdc-controller/src/main/java/org/onap/so/asdc/client/ASDCController.java
@@ -957,7 +957,7 @@ public class ASDCController {
*/
public String getAddress() {
if (asdcConfig != null) {
- return asdcConfig.getAsdcAddress();
+ return asdcConfig.getSdcAddress();
}
return UNKNOWN;
}
diff --git a/asdc-controller/src/test/java/org/onap/so/asdc/client/ASDCConfigurationTest.java b/asdc-controller/src/test/java/org/onap/so/asdc/client/ASDCConfigurationTest.java
index e4749742ee..c0e7d314e4 100644
--- a/asdc-controller/src/test/java/org/onap/so/asdc/client/ASDCConfigurationTest.java
+++ b/asdc-controller/src/test/java/org/onap/so/asdc/client/ASDCConfigurationTest.java
@@ -20,8 +20,7 @@
package org.onap.so.asdc.client;
-
-
+import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertTrue;
import javax.transaction.Transactional;
import org.junit.Test;
@@ -40,19 +39,18 @@ public class ASDCConfigurationTest extends BaseTest {
@Test
@Transactional
- public void testInitASDCConfiguration() throws Exception {
- assertTrue("msopreist".equals(config.getUser()));
- assertTrue("msoasdc-id-local".equals(config.getConsumerGroup()));
- assertTrue("msoasdc-id-local".equals(config.getConsumerID()));
- assertTrue("Pre-IST".equals(config.getEnvironmentName()));
- assertTrue("localhost:8443".equals(config.getAsdcAddress()));
- assertTrue("msopreist".equals(config.getPassword()));
- assertTrue(config.getPollingInterval() == 30);
- assertTrue(config.getPollingTimeout() == 30);
- assertTrue(config.getRelevantArtifactTypes().size() == config.SUPPORTED_ARTIFACT_TYPES_LIST.size());
- assertTrue(config.getWatchDogTimeout() == 1);
- assertTrue(config.isUseHttpsWithDmaap() == true);
- assertTrue(config.isUseHttpsWithSDC() == true);
+ public void testInitASDCConfiguration() {
+ assertEquals("msopreist", config.getUser());
+ assertEquals("msoasdc-id-local", config.getConsumerGroup());
+ assertEquals("msoasdc-id-local", config.getConsumerID());
+ assertEquals("Pre-IST", config.getEnvironmentName());
+ assertEquals("localhost:8443", config.getSdcAddress());
+ assertEquals("msopreist", config.getPassword());
+ assertEquals(30, config.getPollingInterval());
+ assertEquals(30, config.getPollingTimeout());
+ assertEquals(config.getRelevantArtifactTypes().size(), ASDCConfiguration.SUPPORTED_ARTIFACT_TYPES_LIST.size());
+ assertEquals(1, config.getWatchDogTimeout());
+ assertTrue(config.isUseHttpsWithSDC());
}
}
diff --git a/asdc-controller/src/test/java/org/onap/so/asdc/client/tests/ASDCConfigurationTest.java b/asdc-controller/src/test/java/org/onap/so/asdc/client/tests/ASDCConfigurationTest.java
index 992d495369..5b8637d1ed 100644
--- a/asdc-controller/src/test/java/org/onap/so/asdc/client/tests/ASDCConfigurationTest.java
+++ b/asdc-controller/src/test/java/org/onap/so/asdc/client/tests/ASDCConfigurationTest.java
@@ -43,7 +43,7 @@ public class ASDCConfigurationTest extends BaseTest {
@Autowired
private ASDCConfiguration config;
- private List<String> msgBusAddressList = new ArrayList<String>();
+ private final List<String> msgBusAddressList = new ArrayList<>();
private static final String MSO_PRE_IST = "msopreist";
private static final String MSO_ASDC_ID_LOCAL = "msoasdc-id-local";
@@ -51,63 +51,58 @@ public class ASDCConfigurationTest extends BaseTest {
private static final String ASDC_ADDRESS = "localhost:8443";
@Test
- public void isUseHttpsWithDmaapTest() {
- assertTrue(config.isUseHttpsWithDmaap());
- }
-
- @Test
public void isConsumeProduceStatusTopicTest() {
assertTrue(config.isConsumeProduceStatusTopic());
}
@Test
public void getUserTest() {
- assertTrue(MSO_PRE_IST.equals(config.getUser()));
+ assertEquals(MSO_PRE_IST, config.getUser());
}
@Test
public void getConsumerGroupTest() {
- assertTrue(MSO_ASDC_ID_LOCAL.equals(config.getConsumerGroup()));
+ assertEquals(MSO_ASDC_ID_LOCAL, config.getConsumerGroup());
}
@Test
public void getConsumerIDTest() {
- assertTrue(MSO_ASDC_ID_LOCAL.equals(config.getConsumerID()));
+ assertEquals(MSO_ASDC_ID_LOCAL, config.getConsumerID());
}
@Test
public void getEnvironmentNameTest() {
- assertTrue(PRE_IST.equals(config.getEnvironmentName()));
+ assertEquals(PRE_IST, config.getEnvironmentName());
}
@Test
public void getAsdcAddress() {
- assertTrue(ASDC_ADDRESS.equals(config.getAsdcAddress()));
+ assertEquals(ASDC_ADDRESS, config.getSdcAddress());
}
@Test
public void getPasswordTest() {
- assertTrue(MSO_PRE_IST.equals(config.getPassword()));
+ assertEquals(MSO_PRE_IST, config.getPassword());
}
@Test
public void getPollingIntervalTest() {
- assertTrue(config.getPollingInterval() == 30);
+ assertEquals(30, config.getPollingInterval());
}
@Test
public void getPollingTimeoutTest() {
- assertTrue(config.getPollingTimeout() == 30);
+ assertEquals(30, config.getPollingTimeout());
}
@Test
public void getRelevantArtifactTypesTest() {
- assertTrue(config.getRelevantArtifactTypes().size() == ASDCConfiguration.SUPPORTED_ARTIFACT_TYPES_LIST.size());
+ assertEquals(config.getRelevantArtifactTypes().size(), ASDCConfiguration.SUPPORTED_ARTIFACT_TYPES_LIST.size());
}
@Test
public void getWatchDogTimeoutTest() {
- assertTrue(config.getWatchDogTimeout() == 1);
+ assertEquals(1, config.getWatchDogTimeout());
}
@Test
@@ -137,13 +132,4 @@ public class ASDCConfigurationTest extends BaseTest {
String actualAsdcControllerName = config.getAsdcControllerName();
assertEquals(asdcControllerName, actualAsdcControllerName);
}
-
- @Test
- public void getMsgBusAddressTest() {
- msgBusAddressList.add("localhost");
- msgBusAddressList.add("localhost");
-
- List<String> actualMsgBusAddress = config.getMsgBusAddress();
- assertEquals(msgBusAddressList, actualMsgBusAddress);
- }
}
diff --git a/asdc-controller/src/test/resources/application-test.yaml b/asdc-controller/src/test/resources/application-test.yaml
index 31ec987152..e1fbe1ccd5 100644
--- a/asdc-controller/src/test/resources/application-test.yaml
+++ b/asdc-controller/src/test/resources/application-test.yaml
@@ -76,18 +76,16 @@ mso:
consumerGroup: msoasdc-id-local
consumerId: msoasdc-id-local
environmentName: Pre-IST
- asdcAddress: localhost:8443
+ sdcAddress: localhost:8443
password: CB655C3C236F1F0370A347E3A0E0E133BE10ADCF4D16377E7378D3FE46A4BF60C27DF1FFB4
pollingInterval: 30
pollingTimeout: 30
relevantArtifactTypes: HEAT,HEAT_ENV,HEAT_VOL
- useHttpsWithDmaap: true
activateServerTLSAuth: false
keyStorePassword:
keyStorePath:
watchDogTimeout: 1
isFilterInEmptyResources: true
- messageBusAddress: localhost,localhost
asdc:
config:
activity:
diff --git a/asdc-controller/src/test/resources/mso-with-NULL.json b/asdc-controller/src/test/resources/mso-with-NULL.json
index aeb740f31c..8e6454fae1 100644
--- a/asdc-controller/src/test/resources/mso-with-NULL.json
+++ b/asdc-controller/src/test/resources/mso-with-NULL.json
@@ -8,11 +8,6 @@
"asdcAddress": "hostname",
"password": "1c551b8b5ab91fcd5a0907b11c304199",
"watchDogTimeout": "300",
- "messageBusAddress": [
- "localhost",
- "localhost",
- "localhost"
- ],
"pollingInterval":10,
"pollingTimeout":30
diff --git a/asdc-controller/src/test/resources/mso.json b/asdc-controller/src/test/resources/mso.json
index 6d3f7a3233..d80955f647 100644
--- a/asdc-controller/src/test/resources/mso.json
+++ b/asdc-controller/src/test/resources/mso.json
@@ -8,11 +8,6 @@
"asdcAddress": "hostname",
"password": "1c551b8b5ab91fcd5a0907b11c304199",
"watchDogTimeout": "300",
- "messageBusAddress": [
- "localhost",
- "localhost",
- "localhost"
- ],
"pollingInterval":10,
"pollingTimeout":30
diff --git a/asdc-controller/src/test/resources/mso4-with-TLS.json b/asdc-controller/src/test/resources/mso4-with-TLS.json
index e1b32b7d4a..8c14117c41 100644
--- a/asdc-controller/src/test/resources/mso4-with-TLS.json
+++ b/asdc-controller/src/test/resources/mso4-with-TLS.json
@@ -11,11 +11,6 @@
"pollingTimeout":30,
"activateServerTLSAuth": true,
"watchDogTimeout": "300",
- "messageBusAddress": [
- "localhost",
- "localhost",
- "localhost"
- ],
"keyStorePassword":"1c551b8b5ab91fcd5a0907b11c304199",
"keyStorePath": "/test"
}