aboutsummaryrefslogtreecommitdiffstats
path: root/ms
diff options
context:
space:
mode:
Diffstat (limited to 'ms')
-rw-r--r--ms/cds-sdc-listener/application/pom.xml15
-rw-r--r--ms/cds-sdc-listener/application/src/main/java/org/onap/ccsdk/apps/cdssdclistener/CdsSdcListenerApplication.java2
-rw-r--r--ms/cds-sdc-listener/application/src/main/java/org/onap/ccsdk/apps/cdssdclistener/CdsSdcListenerClient.java81
-rw-r--r--ms/cds-sdc-listener/application/src/main/java/org/onap/ccsdk/apps/cdssdclistener/CdsSdcListenerConfiguration.java137
-rw-r--r--ms/cds-sdc-listener/application/src/main/java/org/onap/ccsdk/apps/cdssdclistener/CdsSdcListenerDto.java23
-rw-r--r--ms/cds-sdc-listener/application/src/main/java/org/onap/ccsdk/apps/cdssdclistener/CdsSdcListenerNotificationCallback.java69
-rw-r--r--ms/cds-sdc-listener/application/src/main/java/org/onap/ccsdk/apps/cdssdclistener/exceptions/CdsSdcListenerException.java27
-rw-r--r--ms/cds-sdc-listener/application/src/main/java/org/onap/ccsdk/apps/cdssdclistener/service/ListenerService.java18
-rw-r--r--ms/cds-sdc-listener/application/src/main/java/org/onap/ccsdk/apps/cdssdclistener/service/ListenerServiceImpl.java27
-rw-r--r--ms/cds-sdc-listener/application/src/main/resources/application.yml17
-rw-r--r--ms/cds-sdc-listener/application/src/test/java/org/onap/ccsdk/apps/cdssdclistener/CdsSdcListenerClientTest.java71
-rw-r--r--ms/cds-sdc-listener/application/src/test/java/org/onap/ccsdk/apps/cdssdclistener/CdsSdcListenerConfigurationTest.java41
12 files changed, 528 insertions, 0 deletions
diff --git a/ms/cds-sdc-listener/application/pom.xml b/ms/cds-sdc-listener/application/pom.xml
index 54f59b7ca..86cd764de 100644
--- a/ms/cds-sdc-listener/application/pom.xml
+++ b/ms/cds-sdc-listener/application/pom.xml
@@ -36,6 +36,21 @@
<artifactId>spring-boot-devtools</artifactId>
<optional>true</optional>
</dependency>
+
+ <!-- SDC Distribution client dependency -->
+ <dependency>
+ <groupId>org.onap.sdc.sdc-distribution-client</groupId>
+ <artifactId>sdc-distribution-client</artifactId>
+ <version>1.3.0</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.jmockit</groupId>
+ <artifactId>jmockit</artifactId>
+ <version>1.19</version>
+ <scope>test</scope>
+ </dependency>
+
</dependencies>
<build>
diff --git a/ms/cds-sdc-listener/application/src/main/java/org/onap/ccsdk/apps/cdssdclistener/CdsSdcListenerApplication.java b/ms/cds-sdc-listener/application/src/main/java/org/onap/ccsdk/apps/cdssdclistener/CdsSdcListenerApplication.java
index 661f8cb5b..3bd34fb08 100644
--- a/ms/cds-sdc-listener/application/src/main/java/org/onap/ccsdk/apps/cdssdclistener/CdsSdcListenerApplication.java
+++ b/ms/cds-sdc-listener/application/src/main/java/org/onap/ccsdk/apps/cdssdclistener/CdsSdcListenerApplication.java
@@ -10,8 +10,10 @@ package org.onap.ccsdk.apps.cdssdclistener;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
+import org.springframework.boot.context.properties.EnableConfigurationProperties;
@SpringBootApplication
+@EnableConfigurationProperties(CdsSdcListenerConfiguration.class)
public class CdsSdcListenerApplication {
public static void main(String[] args) {
SpringApplication.run(CdsSdcListenerApplication.class, args);
diff --git a/ms/cds-sdc-listener/application/src/main/java/org/onap/ccsdk/apps/cdssdclistener/CdsSdcListenerClient.java b/ms/cds-sdc-listener/application/src/main/java/org/onap/ccsdk/apps/cdssdclistener/CdsSdcListenerClient.java
new file mode 100644
index 000000000..af0bb40b6
--- /dev/null
+++ b/ms/cds-sdc-listener/application/src/main/java/org/onap/ccsdk/apps/cdssdclistener/CdsSdcListenerClient.java
@@ -0,0 +1,81 @@
+/*
+ * Copyright (C) 2019 Bell Canada. All rights reserved.
+ *
+ * NOTICE: All the intellectual and technical concepts contained herein are
+ * proprietary to Bell Canada and are protected by trade secret or copyright law.
+ * Unauthorized copying of this file, via any medium is strictly prohibited.
+ */
+package org.onap.ccsdk.apps.cdssdclistener;
+
+import java.util.Optional;
+import org.onap.ccsdk.apps.cdssdclistener.exceptions.CdsSdcListenerException;
+import org.onap.sdc.api.IDistributionClient;
+import org.onap.sdc.api.results.IDistributionClientResult;
+import org.onap.sdc.impl.DistributionClientFactory;
+import org.onap.sdc.utils.DistributionActionResultEnum;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.boot.context.event.ApplicationReadyEvent;
+import org.springframework.context.event.EventListener;
+import org.springframework.stereotype.Component;
+
+@Component
+public class CdsSdcListenerClient {
+
+ private static Logger LOG = LoggerFactory.getLogger(CdsSdcListenerClient.class);
+
+ @Autowired
+ private CdsSdcListenerConfiguration configuration;
+
+ @Autowired
+ private CdsSdcListenerNotificationCallback notification;
+
+ @Autowired
+ private CdsSdcListenerDto listenerDto;
+
+ private IDistributionClient distributionClient;
+
+ /**
+ * This method initializes the SDC Distribution client.
+ */
+ @EventListener(ApplicationReadyEvent.class)
+ public void initSdcClient() throws CdsSdcListenerException {
+ LOG.info("Initialize the SDC distribution client");
+
+ distributionClient = Optional.of(DistributionClientFactory.createDistributionClient())
+ .orElseThrow(() -> new CdsSdcListenerException("Could not able to create SDC Distribution client"));
+
+ listenerDto.setDistributionClient(distributionClient);
+
+ IDistributionClientResult result = distributionClient.init(configuration, notification);
+
+ startSdcClientBasedOnTheResult(result);
+ }
+
+ private void startSdcClientBasedOnTheResult(IDistributionClientResult result) throws CdsSdcListenerException {
+ if (!result.getDistributionActionResult().equals(DistributionActionResultEnum.SUCCESS)) {
+ throw new CdsSdcListenerException(
+ "SDC distribution client init failed with reason:" + result.getDistributionMessageResult());
+ }
+
+ // Start the client.
+ result = this.distributionClient.start();
+
+ if (!result.getDistributionActionResult().equals(DistributionActionResultEnum.SUCCESS)) {
+ throw new CdsSdcListenerException(
+ "Startup of the SDC distribution client failed with reason: " + result.getDistributionMessageResult());
+ }
+ }
+
+ private void closeSdcDistributionclient() throws CdsSdcListenerException {
+
+ IDistributionClientResult status = this.distributionClient.stop();
+
+ LOG.info("Closing SDC distribution client");
+ if (status.getDistributionActionResult().equals(DistributionActionResultEnum.SUCCESS)) {
+ throw new CdsSdcListenerException(
+ "Failed to close the SDC distribution client due to : " + status.getDistributionMessageResult());
+ }
+ }
+}
diff --git a/ms/cds-sdc-listener/application/src/main/java/org/onap/ccsdk/apps/cdssdclistener/CdsSdcListenerConfiguration.java b/ms/cds-sdc-listener/application/src/main/java/org/onap/ccsdk/apps/cdssdclistener/CdsSdcListenerConfiguration.java
new file mode 100644
index 000000000..0cbb917fc
--- /dev/null
+++ b/ms/cds-sdc-listener/application/src/main/java/org/onap/ccsdk/apps/cdssdclistener/CdsSdcListenerConfiguration.java
@@ -0,0 +1,137 @@
+/*
+ * Copyright (C) 2019 Bell Canada. All rights reserved.
+ *
+ * NOTICE: All the intellectual and technical concepts contained herein are
+ * proprietary to Bell Canada and are protected by trade secret or copyright law.
+ * Unauthorized copying of this file, via any medium is strictly prohibited.
+ */
+
+package org.onap.ccsdk.apps.cdssdclistener;
+
+import java.util.List;
+import org.onap.sdc.api.consumer.IConfiguration;
+import org.springframework.beans.factory.annotation.Value;
+import org.springframework.boot.context.properties.ConfigurationProperties;
+
+/**
+ * In order to initiate a SDC distribution client we need to supply some pre-configuration values that
+ * distribution client needs.
+ */
+@ConfigurationProperties("listenerservice")
+public class CdsSdcListenerConfiguration implements IConfiguration {
+
+ public static final String TOSCA_CSAR = "TOSCA_CSAR";
+
+ @Value("${listenerservice.config.asdcAddress}")
+ private String asdcAddress;
+
+ @Value("${listenerservice.config.messageBusAddress}")
+ private List<String> messageBusAddress;
+
+ @Value("${listenerservice.config.user}")
+ private String user;
+
+ @Value("${listenerservice.config.password}")
+ private String password;
+
+ @Value("${listenerservice.config.pollingTimeout}")
+ private int pollingTimeout;
+
+ @Value("${listenerservice.config.pollingInterval}")
+ private int pollingInterval;
+
+ @Value("${listenerservice.config.relevantArtifactTypes}")
+ private List<String> relevantArtifactTypes;
+
+ @Value("${listenerservice.config.consumerGroup}")
+ private String consumerGroup;
+
+ @Value("${listenerservice.config.environmentName}")
+ private String envName;
+
+ @Value("${listenerservice.config.consumerId}")
+ private String consumerId;
+
+ @Value("${listenerservice.config.activateServerTLSAuth}")
+ private boolean activateServerTLSAuth;
+
+ @Value("${listenerservice.config.isUseHttpsWithDmaap}")
+ private boolean isUseHttpsWithDmaap;
+
+
+ @Override
+ public String getAsdcAddress() {
+ return asdcAddress;
+ }
+
+ @Override
+ public List<String> getMsgBusAddress() {
+ return messageBusAddress;
+ }
+
+ @Override
+ public String getUser() {
+ return user;
+ }
+
+ @Override
+ public String getPassword() {
+ return password;
+ }
+
+ @Override
+ public int getPollingInterval() {
+ return pollingInterval;
+ }
+
+ @Override
+ public int getPollingTimeout() {
+ return pollingTimeout;
+ }
+
+ @Override
+ public List<String> getRelevantArtifactTypes() {
+ return relevantArtifactTypes;
+ }
+
+ @Override
+ public String getConsumerGroup() {
+ return consumerGroup;
+ }
+
+ @Override
+ public String getEnvironmentName() {
+ return envName;
+ }
+
+ @Override
+ public String getConsumerID() {
+ return consumerId;
+ }
+
+ @Override
+ public String getKeyStorePath() {
+ return null;
+ }
+
+ @Override
+ public String getKeyStorePassword() {
+ return null;
+ }
+
+ @Override
+ public boolean activateServerTLSAuth() {
+ return activateServerTLSAuth;
+ }
+
+ @Override
+ public boolean isFilterInEmptyResources() {
+ return false;
+ }
+
+ @Override
+ public Boolean isUseHttpsWithDmaap() {
+ return isUseHttpsWithDmaap;
+ }
+}
+
diff --git a/ms/cds-sdc-listener/application/src/main/java/org/onap/ccsdk/apps/cdssdclistener/CdsSdcListenerDto.java b/ms/cds-sdc-listener/application/src/main/java/org/onap/ccsdk/apps/cdssdclistener/CdsSdcListenerDto.java
new file mode 100644
index 000000000..afa753e5a
--- /dev/null
+++ b/ms/cds-sdc-listener/application/src/main/java/org/onap/ccsdk/apps/cdssdclistener/CdsSdcListenerDto.java
@@ -0,0 +1,23 @@
+/*
+ * Copyright (C) 2019 Bell Canada. All rights reserved.
+ *
+ * NOTICE: All the intellectual and technical concepts contained herein are
+ * proprietary to Bell Canada and are protected by trade secret or copyright law.
+ * Unauthorized copying of this file, via any medium is strictly prohibited.
+ */
+package org.onap.ccsdk.apps.cdssdclistener;
+
+import org.onap.sdc.api.IDistributionClient;
+
+public class CdsSdcListenerDto {
+
+ private IDistributionClient distributionClient;
+
+ public IDistributionClient getDistributionClient() {
+ return distributionClient;
+ }
+
+ public void setDistributionClient(IDistributionClient distributionClient) {
+ this.distributionClient = distributionClient;
+ }
+}
diff --git a/ms/cds-sdc-listener/application/src/main/java/org/onap/ccsdk/apps/cdssdclistener/CdsSdcListenerNotificationCallback.java b/ms/cds-sdc-listener/application/src/main/java/org/onap/ccsdk/apps/cdssdclistener/CdsSdcListenerNotificationCallback.java
new file mode 100644
index 000000000..35747635f
--- /dev/null
+++ b/ms/cds-sdc-listener/application/src/main/java/org/onap/ccsdk/apps/cdssdclistener/CdsSdcListenerNotificationCallback.java
@@ -0,0 +1,69 @@
+/*
+ * Copyright (C) 2019 Bell Canada. All rights reserved.
+ *
+ * NOTICE: All the intellectual and technical concepts contained herein are
+ * proprietary to Bell Canada and are protected by trade secret or copyright law.
+ * Unauthorized copying of this file, via any medium is strictly prohibited.
+ */
+
+package org.onap.ccsdk.apps.cdssdclistener;
+
+import static org.onap.sdc.utils.DistributionActionResultEnum.SUCCESS;
+import java.util.List;
+import org.onap.sdc.api.IDistributionClient;
+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.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Component;
+
+@Component
+public class CdsSdcListenerNotificationCallback implements INotificationCallback {
+
+ @Autowired
+ private CdsSdcListenerDto cdsSdcListenerDto;
+
+ private static final Logger LOGGER = LoggerFactory.getLogger(CdsSdcListenerNotificationCallback.class);
+
+ @Override
+ public void activateCallback(INotificationData notificationData) {
+ LOGGER.info(notificationData.getDistributionID(), "The UUID generated by SDC {}");
+ processNotification(notificationData);
+ }
+
+ private void processNotification(INotificationData notificationData) {
+ downlaodCsarArtifacts(notificationData.getServiceArtifacts());
+ }
+
+ /**
+ * Download the TOSCA CSAR artifact.
+ * @param artifactInfo - An object consists of Artifact information.
+ */
+ private void downlaodCsarArtifacts(List<IArtifactInfo> artifactInfo) {
+ final IDistributionClient distributionClient = cdsSdcListenerDto.getDistributionClient();
+
+ artifactInfo.forEach(info -> {
+ final String url = info.getArtifactURL();
+ final String id = info.getArtifactUUID();
+ if (info.getArtifactType().equals(CdsSdcListenerConfiguration.TOSCA_CSAR)) {
+ LOGGER.info("Trying to download the artifact from : {} and UUID is {} ", url, id);
+
+ IDistributionClientDownloadResult result = distributionClient.download(info);
+
+ if (!result.getDistributionActionResult().equals(SUCCESS)) {
+ LOGGER.info("Failed to download the artifact from : {} due to {} ", url,
+ result.getDistributionActionResult());
+ } else {
+ parseCBAFileFromCsar(result);
+ }
+ }
+ });
+ }
+
+ private void parseCBAFileFromCsar(IDistributionClientDownloadResult result) {
+
+ }
+}
diff --git a/ms/cds-sdc-listener/application/src/main/java/org/onap/ccsdk/apps/cdssdclistener/exceptions/CdsSdcListenerException.java b/ms/cds-sdc-listener/application/src/main/java/org/onap/ccsdk/apps/cdssdclistener/exceptions/CdsSdcListenerException.java
new file mode 100644
index 000000000..3f83b6ac2
--- /dev/null
+++ b/ms/cds-sdc-listener/application/src/main/java/org/onap/ccsdk/apps/cdssdclistener/exceptions/CdsSdcListenerException.java
@@ -0,0 +1,27 @@
+/*
+ * Copyright (C) 2019 Bell Canada. All rights reserved.
+ *
+ * NOTICE: All the intellectual and technical concepts contained herein are
+ * proprietary to Bell Canada and are protected by trade secret or copyright law.
+ * Unauthorized copying of this file, via any medium is strictly prohibited.
+ */
+
+package org.onap.ccsdk.apps.cdssdclistener.exceptions;
+
+public class CdsSdcListenerException extends Exception {
+
+ /**
+ * @param message The message to dump
+ */
+ public CdsSdcListenerException(final String message) {
+ super(message);
+ }
+
+ /**
+ * @param message The message to dump
+ * @param cause The Throwable cause object
+ */
+ public CdsSdcListenerException(final String message, final Throwable cause) {
+ super(message, cause);
+ }
+}
diff --git a/ms/cds-sdc-listener/application/src/main/java/org/onap/ccsdk/apps/cdssdclistener/service/ListenerService.java b/ms/cds-sdc-listener/application/src/main/java/org/onap/ccsdk/apps/cdssdclistener/service/ListenerService.java
new file mode 100644
index 000000000..d6c2c4f40
--- /dev/null
+++ b/ms/cds-sdc-listener/application/src/main/java/org/onap/ccsdk/apps/cdssdclistener/service/ListenerService.java
@@ -0,0 +1,18 @@
+/*
+ * Copyright (C) 2019 Bell Canada. All rights reserved.
+ *
+ * NOTICE: All the intellectual and technical concepts contained herein are
+ * proprietary to Bell Canada and are protected by trade secret or copyright law.
+ * Unauthorized copying of this file, via any medium is strictly prohibited.
+ */
+
+package org.onap.ccsdk.apps.cdssdclistener.service;
+
+import java.io.File;
+
+public interface ListenerService {
+
+ void extractBluePrint(File file);
+
+ void storeBluePrint(File file);
+}
diff --git a/ms/cds-sdc-listener/application/src/main/java/org/onap/ccsdk/apps/cdssdclistener/service/ListenerServiceImpl.java b/ms/cds-sdc-listener/application/src/main/java/org/onap/ccsdk/apps/cdssdclistener/service/ListenerServiceImpl.java
new file mode 100644
index 000000000..864c485ce
--- /dev/null
+++ b/ms/cds-sdc-listener/application/src/main/java/org/onap/ccsdk/apps/cdssdclistener/service/ListenerServiceImpl.java
@@ -0,0 +1,27 @@
+/*
+ * Copyright (C) 2019 Bell Canada. All rights reserved.
+ *
+ * NOTICE: All the intellectual and technical concepts contained herein are
+ * proprietary to Bell Canada and are protected by trade secret or copyright law.
+ * Unauthorized copying of this file, via any medium is strictly prohibited.
+ */
+
+package org.onap.ccsdk.apps.cdssdclistener.service;
+
+import java.io.File;
+import org.springframework.stereotype.Component;
+
+@Component
+public class ListenerServiceImpl implements ListenerService {
+
+ @Override
+ public void extractBluePrint(File file) {
+ //TODO
+
+ }
+
+ @Override
+ public void storeBluePrint(File file) {
+ //TODO
+ }
+}
diff --git a/ms/cds-sdc-listener/application/src/main/resources/application.yml b/ms/cds-sdc-listener/application/src/main/resources/application.yml
new file mode 100644
index 000000000..1daef585b
--- /dev/null
+++ b/ms/cds-sdc-listener/application/src/main/resources/application.yml
@@ -0,0 +1,17 @@
+listenerservice:
+ config:
+ asdcAddress: localhost:8443
+ messageBusAddress: localhost
+ user: vid
+ password: Kp8bJ4SXszM0WXlhak3eHlcse2gAw84vaoGGmJvUy2U
+ pollingInterval: 15
+ pollingTimeout: 15
+ relevantArtifactTypes: TOSCA_CSAR
+ consumerGroup: cds-id-local
+ environmentName: AUTO
+ consumerId: cds-id-local
+ keyStorePassword:
+ keyStorePath:
+ activateServerTLSAuth : false
+ isUseHttpsWithDmaap: false
+
diff --git a/ms/cds-sdc-listener/application/src/test/java/org/onap/ccsdk/apps/cdssdclistener/CdsSdcListenerClientTest.java b/ms/cds-sdc-listener/application/src/test/java/org/onap/ccsdk/apps/cdssdclistener/CdsSdcListenerClientTest.java
new file mode 100644
index 000000000..3a634b8c9
--- /dev/null
+++ b/ms/cds-sdc-listener/application/src/test/java/org/onap/ccsdk/apps/cdssdclistener/CdsSdcListenerClientTest.java
@@ -0,0 +1,71 @@
+/*
+ * Copyright (C) 2019 Bell Canada. All rights reserved.
+ *
+ * NOTICE: All the intellectual and technical concepts contained herein are
+ * proprietary to Bell Canada and are protected by trade secret or copyright law.
+ * Unauthorized copying of this file, via any medium is strictly prohibited.
+ */
+
+package org.onap.ccsdk.apps.cdssdclistener;
+
+import mockit.Expectations;
+import mockit.Injectable;
+import mockit.Mock;
+import mockit.MockUp;
+import mockit.Tested;
+import mockit.VerificationsInOrder;
+import mockit.integration.junit4.JMockit;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.onap.ccsdk.apps.cdssdclistener.exceptions.CdsSdcListenerException;
+import org.onap.sdc.api.IDistributionClient;
+import org.onap.sdc.api.results.IDistributionClientResult;
+import org.onap.sdc.impl.DistributionClientFactory;
+import org.onap.sdc.impl.DistributionClientResultImpl;
+import org.onap.sdc.utils.DistributionActionResultEnum;
+
+@RunWith(JMockit.class)
+public class CdsSdcListenerClientTest {
+
+ @Tested
+ private CdsSdcListenerClient cdsSdcListenerClient;
+
+ @Test
+ public void testInitCdsClientSuccesfully(@Injectable IDistributionClient distributionClient,
+ @Injectable CdsSdcListenerConfiguration configuration,
+ @Injectable CdsSdcListenerNotificationCallback notification,
+ @Injectable CdsSdcListenerDto cdsSdcListenerDto) throws CdsSdcListenerException {
+
+ // Arrange
+ new MockUp<DistributionClientFactory>() {
+ @Mock
+ public IDistributionClient createDistributionClient() {
+ return distributionClient;
+ }
+ };
+
+ new Expectations() {{
+ distributionClient.init(configuration, notification);
+ result = getResult();
+ }};
+
+ new Expectations() {{
+ distributionClient.start();
+ result = getResult();
+ }};
+
+ // Act
+ cdsSdcListenerClient.initSdcClient();
+
+ // Verify
+ new VerificationsInOrder() {{
+ distributionClient.init(configuration, notification);
+ distributionClient.start();
+ }};
+ }
+
+ public IDistributionClientResult getResult() {
+ return new DistributionClientResultImpl(DistributionActionResultEnum.SUCCESS,
+ DistributionActionResultEnum.SUCCESS.name());
+ }
+}
diff --git a/ms/cds-sdc-listener/application/src/test/java/org/onap/ccsdk/apps/cdssdclistener/CdsSdcListenerConfigurationTest.java b/ms/cds-sdc-listener/application/src/test/java/org/onap/ccsdk/apps/cdssdclistener/CdsSdcListenerConfigurationTest.java
new file mode 100644
index 000000000..886049df7
--- /dev/null
+++ b/ms/cds-sdc-listener/application/src/test/java/org/onap/ccsdk/apps/cdssdclistener/CdsSdcListenerConfigurationTest.java
@@ -0,0 +1,41 @@
+/*
+ * Copyright (C) 2019 Bell Canada. All rights reserved.
+ *
+ * NOTICE: All the intellectual and technical concepts contained herein are
+ * proprietary to Bell Canada and are protected by trade secret or copyright law.
+ * Unauthorized copying of this file, via any medium is strictly prohibited.
+ */
+
+package org.onap.ccsdk.apps.cdssdclistener;
+
+import static org.junit.Assert.assertEquals;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.boot.context.properties.EnableConfigurationProperties;
+import org.springframework.boot.test.context.SpringBootTest;
+import org.springframework.test.context.junit4.SpringRunner;
+
+@RunWith(SpringRunner.class)
+@EnableConfigurationProperties(CdsSdcListenerConfiguration.class)
+@SpringBootTest(classes = {CdsSdcListenerConfigurationTest.class})
+public class CdsSdcListenerConfigurationTest {
+
+ @Autowired
+ private CdsSdcListenerConfiguration listenerConfiguration;
+
+ @Test
+ public void testCdsSdcListenerConfiguration() {
+ assertEquals(listenerConfiguration.getAsdcAddress(), "localhost:8443");
+ assertEquals(listenerConfiguration.getMsgBusAddress().stream().findFirst().get(), "localhost");
+ assertEquals(listenerConfiguration.getUser(), "vid");
+ assertEquals(listenerConfiguration.getPassword(), "Kp8bJ4SXszM0WXlhak3eHlcse2gAw84vaoGGmJvUy2U");
+ assertEquals(listenerConfiguration.getPollingInterval(), 15);
+ assertEquals(listenerConfiguration.getPollingTimeout(), 15);
+ assertEquals(listenerConfiguration.getRelevantArtifactTypes().stream().findFirst().get(), "TOSCA_CSAR");
+ assertEquals(listenerConfiguration.getConsumerGroup(), "cds-id-local");
+ assertEquals(listenerConfiguration.getEnvironmentName(), "AUTO");
+ assertEquals(listenerConfiguration.getConsumerID(), "cds-id-local");
+ assertEquals(listenerConfiguration.activateServerTLSAuth(), false);
+ }
+}