summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rwxr-xr-xueb-listener/pom.xml12
-rw-r--r--ueb-listener/src/main/java/org/onap/ccsdk/sli/northbound/uebclient/SdncUebCallback.java4
-rw-r--r--ueb-listener/src/main/java/org/onap/ccsdk/sli/northbound/uebclient/SdncUebConfiguration.java22
-rw-r--r--ueb-listener/src/test/java/org/onap/ccsdk/sli/northbound/uebclient/TestSdncUebCallback.java30
-rwxr-xr-xueb-listener/src/test/resources/ueb-listener.properties19
5 files changed, 81 insertions, 6 deletions
diff --git a/ueb-listener/pom.xml b/ueb-listener/pom.xml
index 84e407698..c00395d6e 100755
--- a/ueb-listener/pom.xml
+++ b/ueb-listener/pom.xml
@@ -63,6 +63,18 @@
<version>${junit.version}</version>
<scope>test</scope>
</dependency>
+ <dependency>
+ <groupId>org.testng</groupId>
+ <artifactId>testng</artifactId>
+ <version>6.11</version>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.mockito</groupId>
+ <artifactId>mockito-core</artifactId>
+ <version>${mockito.version}</version>
+ <scope>test</scope>
+ </dependency>
<dependency>
<groupId>org.onap.ccsdk.sli.core</groupId>
<artifactId>dblib-provider</artifactId>
diff --git a/ueb-listener/src/main/java/org/onap/ccsdk/sli/northbound/uebclient/SdncUebCallback.java b/ueb-listener/src/main/java/org/onap/ccsdk/sli/northbound/uebclient/SdncUebCallback.java
index f25ce1458..f00d73724 100644
--- a/ueb-listener/src/main/java/org/onap/ccsdk/sli/northbound/uebclient/SdncUebCallback.java
+++ b/ueb-listener/src/main/java/org/onap/ccsdk/sli/northbound/uebclient/SdncUebCallback.java
@@ -1073,6 +1073,10 @@ public class SdncUebCallback implements INotificationCallback {
}
private String escapeFilename(String str) {
+
+ if (str == null) {
+ str = "";
+ }
StringBuffer retval = new StringBuffer();
for (int i = 0 ; i < str.length() ; i++) {
diff --git a/ueb-listener/src/main/java/org/onap/ccsdk/sli/northbound/uebclient/SdncUebConfiguration.java b/ueb-listener/src/main/java/org/onap/ccsdk/sli/northbound/uebclient/SdncUebConfiguration.java
index 4d9c82464..d97abacbd 100644
--- a/ueb-listener/src/main/java/org/onap/ccsdk/sli/northbound/uebclient/SdncUebConfiguration.java
+++ b/ueb-listener/src/main/java/org/onap/ccsdk/sli/northbound/uebclient/SdncUebConfiguration.java
@@ -82,21 +82,31 @@ public class SdncUebConfiguration implements IConfiguration{
}
public SdncUebConfiguration() {
+ String propDir = System.getenv(SDNC_CONFIG_DIR);
+ if (propDir == null) {
+
+ propDir = "/opt/sdnc/data/properties";
+ }
+ try {
+ init(propDir);
+ } catch (Exception e) {
+ LOG.error("Cannot initialize SdncUebConfiguration", e);
+ }
+ }
+ public SdncUebConfiguration(String propDir) {
try {
- init();
+ init(propDir);
} catch (Exception e) {
LOG.error("Cannot initialize SdncUebConfiguration", e);
}
}
- public void init() throws IOException {
+
+ public void init(String propDir) throws IOException {
String propPath;
- String propDir = System.getenv(SDNC_CONFIG_DIR);
- if (propDir == null) {
- propDir = "/opt/sdnc/data/properties";
- }
+
propPath = propDir + "/ueb-listener.properties";
File propFile = new File(propPath);
diff --git a/ueb-listener/src/test/java/org/onap/ccsdk/sli/northbound/uebclient/TestSdncUebCallback.java b/ueb-listener/src/test/java/org/onap/ccsdk/sli/northbound/uebclient/TestSdncUebCallback.java
new file mode 100644
index 000000000..93fadc989
--- /dev/null
+++ b/ueb-listener/src/test/java/org/onap/ccsdk/sli/northbound/uebclient/TestSdncUebCallback.java
@@ -0,0 +1,30 @@
+package org.onap.ccsdk.sli.northbound.uebclient;
+
+import static org.junit.Assert.*;
+
+import org.junit.Before;
+import org.junit.Test;
+import org.openecomp.sdc.api.IDistributionClient;
+import org.openecomp.sdc.api.notification.INotificationData;
+
+import static org.mockito.Mockito.mock;
+
+public class TestSdncUebCallback {
+ SdncUebConfiguration config;
+
+ @Before
+ public void setUp() throws Exception {
+ config = new SdncUebConfiguration("src/test/resources");
+ }
+
+ @Test
+ public void test() {
+
+ IDistributionClient iDistClient = mock(IDistributionClient.class);
+ SdncUebCallback cb = new SdncUebCallback(iDistClient, config);
+
+ INotificationData iData = mock(INotificationData.class);
+ cb.activateCallback(iData);
+ }
+
+}
diff --git a/ueb-listener/src/test/resources/ueb-listener.properties b/ueb-listener/src/test/resources/ueb-listener.properties
new file mode 100755
index 000000000..7855b2116
--- /dev/null
+++ b/ueb-listener/src/test/resources/ueb-listener.properties
@@ -0,0 +1,19 @@
+org.openecomp.sdnc.uebclient.asdc-address=localhost:1234
+org.openecomp.sdnc.uebclient.consumer-group=ccsdk1
+org.openecomp.sdnc.uebclient.consumer-id=localhost_ccsdk1
+org.openecomp.sdnc.uebclient.environment-name=UNITTEST
+org.openecomp.sdnc.uebclient.password=123456
+org.openecomp.sdnc.uebclient.user=test
+org.openecomp.sdnc.uebclient.sdnc-user=test
+org.openecomp.sdnc.uebclient.sdnc-passwd=test
+org.openecomp.sdnc.uebclient.asdc-api-base-url=http://localhost:8282/restconf/operations/
+org.openecomp.sdnc.uebclient.asdc-api-namespace=org:onap:ccsdk
+org.openecomp.sdnc.uebclient.spool.incoming=src/test/resources/incoming
+org.openecomp.sdnc.uebclient.spool.archive=src/test/resources/archive
+org.openecomp.sdnc.uebclient.polling-interval=30
+org.openecomp.sdnc.uebclient.polling-timeout=15
+org.openecomp.sdnc.uebclient.relevant-artifact-types=YANG_XML,VF_LICENSE,TOSCA_TEMPLATE,TOSCA_CSAR,UCPE_LAYER_2_CONFIGURATION
+org.openecomp.sdnc.uebclient.activate-server-tls-auth=false
+org.openecomp.sdnc.uebclient.keystore-path=
+org.openecomp.sdnc.uebclient.keystore-password=
+org.openecomp.sdnc.uebclient.xslt-path-list=src/main/resources/removeNs.xslt,src/main/resources/normalizeTagNames.xslt