summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDan Timoney <dtimoney@att.com>2017-10-03 14:30:51 -0400
committerDan Timoney <dtimoney@att.com>2017-10-03 14:51:00 -0400
commitfa9d764ef796f450f5f031a8c2a43ee60ab8b829 (patch)
tree661a781f6e0d879c8ca6eb5f26bae676a7587206
parent12d893efa353bc5bd5054cd59998a623f5d058d0 (diff)
Add ueb-listener unit test
Enhance ueb-listener unit test to verify TOSCA parse Change-Id: Iedc675ead3ef69e4fa7151c8c4c500990c0ee6a7 Issue-ID: CCSDK-106 Signed-off-by: Dan Timoney <dtimoney@att.com>
-rw-r--r--asdcApi/provider/src/test/java/org/onap/ccsdk/sli/northbound/asdcapi/TestAsdcApiApi.java (renamed from asdcApi/provider/src/test/java/org/onap/sdnc/northbound/asdcapi/TestAsdcApiApi.java)2
-rwxr-xr-xueb-listener/pom.xml9
-rw-r--r--ueb-listener/src/main/java/org/onap/ccsdk/sli/northbound/uebclient/SdncARModel.java14
-rw-r--r--ueb-listener/src/main/java/org/onap/ccsdk/sli/northbound/uebclient/SdncBaseModel.java60
-rw-r--r--ueb-listener/src/main/java/org/onap/ccsdk/sli/northbound/uebclient/SdncServiceModel.java2
-rw-r--r--ueb-listener/src/main/java/org/onap/ccsdk/sli/northbound/uebclient/SdncUebCallback.java15
-rw-r--r--ueb-listener/src/main/java/org/onap/ccsdk/sli/northbound/uebclient/SdncUebConfiguration.java17
-rw-r--r--ueb-listener/src/main/java/org/onap/ccsdk/sli/northbound/uebclient/SdncVFModel.java16
-rw-r--r--ueb-listener/src/test/java/org/onap/ccsdk/sli/northbound/uebclient/TestSdncUebCallback.java35
-rw-r--r--ueb-listener/src/test/resources/incoming/src_test_resources_csars_service-NfodService-csar.csarbin0 -> 38938 bytes
-rw-r--r--ueb-listener/src/test/resources/log4j.properties30
-rwxr-xr-xueb-listener/src/test/resources/ueb-listener.properties38
12 files changed, 151 insertions, 87 deletions
diff --git a/asdcApi/provider/src/test/java/org/onap/sdnc/northbound/asdcapi/TestAsdcApiApi.java b/asdcApi/provider/src/test/java/org/onap/ccsdk/sli/northbound/asdcapi/TestAsdcApiApi.java
index c78abc8f7..f65bbc045 100644
--- a/asdcApi/provider/src/test/java/org/onap/sdnc/northbound/asdcapi/TestAsdcApiApi.java
+++ b/asdcApi/provider/src/test/java/org/onap/ccsdk/sli/northbound/asdcapi/TestAsdcApiApi.java
@@ -19,7 +19,7 @@
* ============LICENSE_END=========================================================
*/
-package org.onap.sdnc.northbound.asdcapi;
+package org.onap.ccsdk.sli.northbound.asdcapi;
import org.junit.Before;
import org.junit.Test;
diff --git a/ueb-listener/pom.xml b/ueb-listener/pom.xml
index c00395d6e..68d8fc080 100755
--- a/ueb-listener/pom.xml
+++ b/ueb-listener/pom.xml
@@ -14,7 +14,8 @@
<version>0.1.0-SNAPSHOT</version>
</parent>
<properties>
- <sdc.client.version>1.1.7-SNAPSHOT</sdc.client.version>
+ <sdc.client.version>1.1.32-SNAPSHOT</sdc.client.version>
+ <sdc.tosca.version>1.1.34-SNAPSHOT</sdc.tosca.version>
<fasterxml.jackson.version>2.9.0.pr1</fasterxml.jackson.version>
<skip.SWM>true</skip.SWM>
<ueb.listener.base>/opt/app/ueb-listener</ueb.listener.base>
@@ -31,6 +32,12 @@
<version>${sdc.client.version}</version>
<scope>compile</scope>
</dependency>
+ <dependency>
+ <groupId>org.openecomp.sdc.sdc-tosca</groupId>
+ <artifactId>sdc-tosca</artifactId>
+ <version>${sdc.tosca.version}</version>
+ <scope>compile</scope>
+ </dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
diff --git a/ueb-listener/src/main/java/org/onap/ccsdk/sli/northbound/uebclient/SdncARModel.java b/ueb-listener/src/main/java/org/onap/ccsdk/sli/northbound/uebclient/SdncARModel.java
index 75b19cd2e..8d480a4d1 100644
--- a/ueb-listener/src/main/java/org/onap/ccsdk/sli/northbound/uebclient/SdncARModel.java
+++ b/ueb-listener/src/main/java/org/onap/ccsdk/sli/northbound/uebclient/SdncARModel.java
@@ -8,9 +8,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -23,24 +23,24 @@ package org.onap.ccsdk.sli.northbound.uebclient;
import org.openecomp.sdc.tosca.parser.api.ISdcCsarHelper;
import org.openecomp.sdc.tosca.parser.impl.SdcPropertyNames;
-import org.openecomp.sdc.toscaparser.api.Metadata;
import org.openecomp.sdc.toscaparser.api.NodeTemplate;
+import org.openecomp.sdc.toscaparser.api.elements.Metadata;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
public class SdncARModel extends SdncBaseModel {
-
+
private static final Logger LOG = LoggerFactory
.getLogger(SdncARModel.class);
public SdncARModel(ISdcCsarHelper sdcCsarHelper, NodeTemplate nodeTemplate) {
super(sdcCsarHelper, nodeTemplate);
-
+
// extract metadata
- Metadata metadata = nodeTemplate.getMetadata();
+ Metadata metadata = nodeTemplate.getMetaData();
addParameter("type", extractValue (metadata, SdcPropertyNames.PROPERTY_NAME_TYPE));
-
+
// extract properties
//addParameter("role", extractValue (sdcCsarHelper, nodeTemplate, SdcPropertyNames.PROPERTY_NAME_ROLE));
//addParameter("type", extractValue (nodeTemplate, SdcPropertyNames.PROPERTY_NAME_TYPE)); - wrong location, get from metadata
diff --git a/ueb-listener/src/main/java/org/onap/ccsdk/sli/northbound/uebclient/SdncBaseModel.java b/ueb-listener/src/main/java/org/onap/ccsdk/sli/northbound/uebclient/SdncBaseModel.java
index 32e51599e..6128f288b 100644
--- a/ueb-listener/src/main/java/org/onap/ccsdk/sli/northbound/uebclient/SdncBaseModel.java
+++ b/ueb-listener/src/main/java/org/onap/ccsdk/sli/northbound/uebclient/SdncBaseModel.java
@@ -8,9 +8,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -27,33 +27,33 @@ import java.util.Map;
import org.openecomp.sdc.tosca.parser.api.ISdcCsarHelper;
import org.openecomp.sdc.tosca.parser.impl.SdcPropertyNames;
import org.openecomp.sdc.toscaparser.api.Group;
-import org.openecomp.sdc.toscaparser.api.Metadata;
import org.openecomp.sdc.toscaparser.api.NodeTemplate;
+import org.openecomp.sdc.toscaparser.api.elements.Metadata;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
public class SdncBaseModel {
-
+
private static final Logger LOG = LoggerFactory
.getLogger(SdncBaseModel.class);
-
+
protected String customizationUUID = null;
protected String invariantUUID = null;
- protected String model_yaml = null;
- protected String version = null;
-
+ protected String model_yaml = null;
+ protected String version = null;
+
protected Map<String, String> params = null;
protected ISdcCsarHelper sdcCsarHelper = null;
public SdncBaseModel() {
-
+
}
-
+
public SdncBaseModel(ISdcCsarHelper sdcCsarHelper, Metadata metadata) {
params = new HashMap<>();
this.sdcCsarHelper = sdcCsarHelper;
-
+
// extract service metadata
invariantUUID = extractValue(metadata, SdcPropertyNames.PROPERTY_NAME_INVARIANTUUID);
addParameter("invariant_uuid",invariantUUID);
@@ -70,11 +70,11 @@ public class SdncBaseModel {
this.sdcCsarHelper = sdcCsarHelper;
// extract nodeTemplate metadata
- Metadata metadata = nodeTemplate.getMetadata();
+ Metadata metadata = nodeTemplate.getMetaData();
customizationUUID = extractValue (metadata, SdcPropertyNames.PROPERTY_NAME_CUSTOMIZATIONUUID);
addParameter("invariant_uuid", extractValue (metadata, SdcPropertyNames.PROPERTY_NAME_INVARIANTUUID));
addParameter("uuid", extractValue (metadata, SdcPropertyNames.PROPERTY_NAME_UUID));
- addParameter("version", extractValue (metadata, SdcPropertyNames.PROPERTY_NAME_VERSION));
+ addParameter("version", extractValue (metadata, SdcPropertyNames.PROPERTY_NAME_VERSION));
}
public SdncBaseModel(ISdcCsarHelper sdcCsarHelper, Group group) {
@@ -86,9 +86,9 @@ public class SdncBaseModel {
Metadata metadata = group.getMetadata();
//customizationUUID = extractValue (metadata, SdcPropertyNames.PROPERTY_NAME_VFMODULECUSTOMIZATIONUUID); - returning null
customizationUUID = extractValue (metadata, "vfModuleModelCustomizationUUID");
- addParameter("invariant_uuid", extractValue (metadata, SdcPropertyNames.PROPERTY_NAME_VFMODULEMODELINVARIANTUUID));
- addParameter("uuid", extractValue (metadata, SdcPropertyNames.PROPERTY_NAME_VFMODULEMODELUUID));
- addParameter("version", extractValue (metadata, SdcPropertyNames.PROPERTY_NAME_VFMODULEMODELVERSION));
+ addParameter("invariant_uuid", extractValue (metadata, SdcPropertyNames.PROPERTY_NAME_VFMODULEMODELINVARIANTUUID));
+ addParameter("uuid", extractValue (metadata, SdcPropertyNames.PROPERTY_NAME_VFMODULEMODELUUID));
+ addParameter("version", extractValue (metadata, SdcPropertyNames.PROPERTY_NAME_VFMODULEMODELVERSION));
}
protected void addParameter (String name, String value) {
@@ -102,26 +102,26 @@ public class SdncBaseModel {
params.put(name, value);
}
}
-
+
public static void addIntParameter (String name, String value, Map<String, String> params) {
if (value != null && !value.isEmpty()) {
params.put(name, value);
}
}
-
+
public static void addParameter (String name, String value, Map<String, String> params) {
if (value != null && !value.isEmpty()) {
params.put(name, "\"" + value + "\"");
}
}
-
+
protected String extractValue (Metadata metadata, String name) {
String value = sdcCsarHelper.getMetadataPropertyValue(metadata, name);
if (value != null) {
return value;
} else {
return "";
- }
+ }
}
public static String extractValue (ISdcCsarHelper sdcCsarHelper, Metadata metadata, String name) {
@@ -130,7 +130,7 @@ public class SdncBaseModel {
return value;
} else {
return "";
- }
+ }
}
protected String extractValue (NodeTemplate nodeTemplate, String name) {
@@ -241,19 +241,19 @@ public class SdncBaseModel {
public void setCustomizationUUID(String customizationUUID) {
this.customizationUUID = customizationUUID;
}
-
+
public String getSql(String tableName, String model_yaml) {
-
+
StringBuilder sb = new StringBuilder();
sb.append("INSERT into " + tableName + " (customization_uuid, model_yaml, ");
-
+
int paramCount = 0;
for (String paramKey : params.keySet()) {
paramCount++;
sb.append(paramKey);
if (paramCount < params.size()) sb.append(", ");
}
-
+
sb.append(") values (" + getCustomizationUUID() + ", \"" + model_yaml + "\", ");
paramCount = 0;
@@ -267,19 +267,19 @@ public class SdncBaseModel {
sb.append(");");
return sb.toString();
}
-
+
public static String getSql(String tableName, String keyName, String keyValue, String model_yaml, Map<String, String> params) {
-
+
StringBuilder sb = new StringBuilder();
sb.append("INSERT into " + tableName + " (" + keyName + ", ");
-
+
int paramCount = 0;
for (String paramKey : params.keySet()) {
paramCount++;
sb.append(paramKey);
if (paramCount < params.size()) sb.append(", ");
}
-
+
sb.append(") values (" + keyValue + ", ");
paramCount = 0;
@@ -293,5 +293,5 @@ public class SdncBaseModel {
sb.append(");");
return sb.toString();
}
-
+
}
diff --git a/ueb-listener/src/main/java/org/onap/ccsdk/sli/northbound/uebclient/SdncServiceModel.java b/ueb-listener/src/main/java/org/onap/ccsdk/sli/northbound/uebclient/SdncServiceModel.java
index 3df27be6e..d3fd16791 100644
--- a/ueb-listener/src/main/java/org/onap/ccsdk/sli/northbound/uebclient/SdncServiceModel.java
+++ b/ueb-listener/src/main/java/org/onap/ccsdk/sli/northbound/uebclient/SdncServiceModel.java
@@ -23,7 +23,7 @@ package org.onap.ccsdk.sli.northbound.uebclient;
import org.openecomp.sdc.tosca.parser.api.ISdcCsarHelper;
import org.openecomp.sdc.tosca.parser.impl.SdcPropertyNames;
-import org.openecomp.sdc.toscaparser.api.Metadata;
+import org.openecomp.sdc.toscaparser.api.elements.Metadata;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
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 f00d73724..b3c96d9d8 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
@@ -74,8 +74,8 @@ import org.openecomp.sdc.tosca.parser.exceptions.SdcToscaParserException;
import org.openecomp.sdc.tosca.parser.impl.SdcPropertyNames;
import org.openecomp.sdc.tosca.parser.impl.SdcToscaParserFactory;
import org.openecomp.sdc.toscaparser.api.Group;
-import org.openecomp.sdc.toscaparser.api.Metadata;
import org.openecomp.sdc.toscaparser.api.NodeTemplate;
+import org.openecomp.sdc.toscaparser.api.elements.Metadata;
import org.openecomp.sdc.utils.ArtifactTypeEnum;
import org.openecomp.sdc.utils.DistributionActionResultEnum;
import org.openecomp.sdc.utils.DistributionStatusEnum;
@@ -238,6 +238,8 @@ public class SdncUebCallback implements INotificationCallback {
File incomingDir = null;
File archiveDir = null;
+ LOG.debug("IncomingDirName is {}", incomingDirName);
+
// Process service level artifacts
List<IArtifactInfo> artifactList = data.getServiceArtifacts();
@@ -298,12 +300,15 @@ public class SdncUebCallback implements INotificationCallback {
public void deployDownloadedFiles(File incomingDir, File archiveDir, INotificationData data) {
if (incomingDir == null) {
+ LOG.debug("incomingDir is null - using {}", config.getIncomingDir());
incomingDir = new File(config.getIncomingDir());
if (!incomingDir.exists()) {
incomingDir.mkdirs();
}
+ } else {
+ LOG.debug("incomingDir is not null - it is {}", incomingDir.getPath());
}
if (archiveDir == null) {
@@ -315,6 +320,7 @@ public class SdncUebCallback implements INotificationCallback {
}
String curFileName = "";
+ LOG.debug("Scanning {} - {} for downloaded files", incomingDir.getPath(), incomingDir.toPath());
try (DirectoryStream<Path> stream = Files.newDirectoryStream(incomingDir.toPath())) {
for (Path file: stream) {
curFileName = file.toString();
@@ -533,7 +539,6 @@ public class SdncUebCallback implements INotificationCallback {
sdcCsarHelper = factory.getSdcCsarHelper(spoolFile.getAbsolutePath());
} catch (SdcToscaParserException e) {
LOG.error("Could not create SDC TOSCA Parser ", e);
- factory.close();
return;
}
@@ -550,7 +555,6 @@ public class SdncUebCallback implements INotificationCallback {
insertToscaData(serviceModel.getSql(model_yaml));
} catch (IOException e) {
LOG.error("Could not insert Tosca YAML data into the SERVICE_MODEL table ", e);
- factory.close();
return;
}
@@ -693,7 +697,7 @@ public class SdncUebCallback implements INotificationCallback {
//String extcp_subnetpool_id = "\"" + SdncBaseModel.extractValue(sdcCsarHelper, match.getLeft(), SdcPropertyNames.PROPERTY_NAME_SUBNETPOOLID) + "\""; // need path to subnetpoolid
// extract values from the right "VFC" Node
- String vfcCustomizationUuid = "\"" + SdncBaseModel.extractValue(sdcCsarHelper, match.getRight().getMetadata(), "customization_uuid") + "\"";
+ String vfcCustomizationUuid = "\"" + SdncBaseModel.extractValue(sdcCsarHelper, match.getRight().getMetaData(), "customization_uuid") + "\"";
SdncBaseModel.addParameter("vm_type", SdncBaseModel.extractValue(sdcCsarHelper, match.getRight(), SdcPropertyNames.PROPERTY_NAME_VMTYPE), mappingParams);
SdncBaseModel.addIntParameter("ipv4_count", SdncBaseModel.extractValue(sdcCsarHelper, match.getRight(), SdcPropertyNames.PROPERTY_NAME_NETWORKASSIGNMENTS_IPV4SUBNETDEFAULTASSIGNMENTS_MINSUBNETSCOUNT), mappingParams);
SdncBaseModel.addIntParameter("ipv6_count", SdncBaseModel.extractValue(sdcCsarHelper, match.getRight(), SdcPropertyNames.PROPERTY_NAME_NETWORKASSIGNMENTS_IPV6SUBNETDEFAULTASSIGNMENTS_MINSUBNETSCOUNT), mappingParams);
@@ -712,8 +716,7 @@ public class SdncUebCallback implements INotificationCallback {
} // VF loop
- // Close ASDC TOSCA Parser factory - we are done processing this distribution
- factory.close();
+
if ((artifact != null) && (data != null)) {
LOG.info("Update to SDN-C succeeded");
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 d97abacbd..b49a66070 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
@@ -30,7 +30,6 @@ import java.util.List;
import java.util.Properties;
import org.openecomp.sdc.api.consumer.IConfiguration;
-import org.openecomp.sdc.utils.ArtifactTypeEnum;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -162,16 +161,8 @@ public class SdncUebConfiguration implements IConfiguration{
relevantArtifactTypes = new LinkedList<>();
for (String artifactType : artifactTypes) {
- try {
- if (ArtifactTypeEnum.valueOf(artifactType) != null) {
- relevantArtifactTypes.add(artifactType);
- } else {
- LOG.warn("Skipping unrecognized artifact type {}", artifactType);
- }
- } catch (Exception e) {
- LOG.warn("Caught exception validating artifact type {}", artifactType, e);
- }
+ relevantArtifactTypes.add(artifactType);
}
@@ -282,7 +273,11 @@ public class SdncUebConfiguration implements IConfiguration{
@Override
public boolean isFilterInEmptyResources() {
- // TODO Auto-generated method stub
+ return false;
+ }
+
+ @Override
+ public Boolean isUseHttpsWithDmaap() {
return false;
}
diff --git a/ueb-listener/src/main/java/org/onap/ccsdk/sli/northbound/uebclient/SdncVFModel.java b/ueb-listener/src/main/java/org/onap/ccsdk/sli/northbound/uebclient/SdncVFModel.java
index deed20cf4..fd71527de 100644
--- a/ueb-listener/src/main/java/org/onap/ccsdk/sli/northbound/uebclient/SdncVFModel.java
+++ b/ueb-listener/src/main/java/org/onap/ccsdk/sli/northbound/uebclient/SdncVFModel.java
@@ -8,9 +8,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -23,13 +23,13 @@ package org.onap.ccsdk.sli.northbound.uebclient;
import org.openecomp.sdc.tosca.parser.api.ISdcCsarHelper;
import org.openecomp.sdc.tosca.parser.impl.SdcPropertyNames;
-import org.openecomp.sdc.toscaparser.api.Metadata;
import org.openecomp.sdc.toscaparser.api.NodeTemplate;
+import org.openecomp.sdc.toscaparser.api.elements.Metadata;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
public class SdncVFModel extends SdncBaseModel {
-
+
private static final Logger LOG = LoggerFactory
.getLogger(SdncVFModel.class);
@@ -38,11 +38,11 @@ public class SdncVFModel extends SdncBaseModel {
super(sdcCsarHelper, nodeTemplate);
// extract metadata
- Metadata metadata = nodeTemplate.getMetadata();
+ Metadata metadata = nodeTemplate.getMetaData();
addParameter("name", extractValue(metadata, SdcPropertyNames.PROPERTY_NAME_NAME));
- addParameter("vendor", extractValue (metadata, SdcPropertyNames.PROPERTY_NAME_RESOURCEVENDOR));
- addParameter("vendor_version", extractValue (metadata, SdcPropertyNames.PROPERTY_NAME_RESOURCEVENDORRELEASE));
-
+ addParameter("vendor", extractValue (metadata, SdcPropertyNames.PROPERTY_NAME_RESOURCEVENDOR));
+ addParameter("vendor_version", extractValue (metadata, SdcPropertyNames.PROPERTY_NAME_RESOURCEVENDORRELEASE));
+
// extract properties
addParameter("ecomp_generated_naming", extractBooleanValue(nodeTemplate, SdcPropertyNames.PROPERTY_NAME_VNFECOMPNAMING_ECOMPGENERATEDNAMING));
addParameter("naming_policy", extractValue(nodeTemplate, SdcPropertyNames.PROPERTY_NAME_VNFECOMPNAMING_NAMINGPOLICY));
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
index 93fadc989..609d12011 100644
--- 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
@@ -1,15 +1,25 @@
package org.onap.ccsdk.sli.northbound.uebclient;
-import static org.junit.Assert.*;
+import static org.mockito.Mockito.mock;
+
+import java.io.File;
+import java.nio.file.DirectoryStream;
+import java.nio.file.Files;
+import java.nio.file.Path;
+import java.nio.file.StandardCopyOption;
+import org.junit.After;
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;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
public class TestSdncUebCallback {
+
+ private static final Logger LOG = LoggerFactory
+ .getLogger(TestSdncUebCallback.class);
SdncUebConfiguration config;
@Before
@@ -17,6 +27,25 @@ public class TestSdncUebCallback {
config = new SdncUebConfiguration("src/test/resources");
}
+ @After
+ public void tearDown() throws Exception {
+ // Move anything in archive back to incoming
+ String curFileName = "";
+
+ Path incomingPath = new File(config.getIncomingDir()).toPath();
+ File archiveDir = new File(config.getArchiveDir());
+ try (DirectoryStream<Path> stream = Files.newDirectoryStream(archiveDir.toPath())) {
+ for (Path file: stream) {
+ Files.move(file, incomingPath.resolve(file.getFileName()), StandardCopyOption.REPLACE_EXISTING);
+ }
+ } catch (Exception x) {
+ // IOException can never be thrown by the iteration.
+ // In this snippet, it can only be thrown by newDirectoryStream.
+ LOG.warn("Cannot replace spool file {}", curFileName, x);
+ }
+
+ }
+
@Test
public void test() {
diff --git a/ueb-listener/src/test/resources/incoming/src_test_resources_csars_service-NfodService-csar.csar b/ueb-listener/src/test/resources/incoming/src_test_resources_csars_service-NfodService-csar.csar
new file mode 100644
index 000000000..329076a15
--- /dev/null
+++ b/ueb-listener/src/test/resources/incoming/src_test_resources_csars_service-NfodService-csar.csar
Binary files differ
diff --git a/ueb-listener/src/test/resources/log4j.properties b/ueb-listener/src/test/resources/log4j.properties
new file mode 100644
index 000000000..71849c3db
--- /dev/null
+++ b/ueb-listener/src/test/resources/log4j.properties
@@ -0,0 +1,30 @@
+###
+# ============LICENSE_START=======================================================
+# openECOMP : SDN-C
+# ================================================================================
+# Copyright (C) 2017 AT&T Intellectual Property. All rights
+# reserved.
+# ================================================================================
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+# ============LICENSE_END=========================================================
+###
+
+log4j.rootLogger=DEBUG,CONSOLE
+
+# CONSOLE is set to be a ConsoleAppender using a PatternLayout.
+log4j.appender.CONSOLE=org.apache.log4j.ConsoleAppender
+log4j.appender.CONSOLE.Threshold=DEBUG
+log4j.appender.CONSOLE.layout=org.apache.log4j.PatternLayout
+log4j.appender.CONSOLE.layout.ConversionPattern=%p %d{yyyy-MM-dd HH:mm:ss.SSS Z} %c{1} - %m%n
+
+
diff --git a/ueb-listener/src/test/resources/ueb-listener.properties b/ueb-listener/src/test/resources/ueb-listener.properties
index 7855b2116..548cc4c45 100755
--- a/ueb-listener/src/test/resources/ueb-listener.properties
+++ b/ueb-listener/src/test/resources/ueb-listener.properties
@@ -1,19 +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
+org.onap.ccsdk.sli.northbound.uebclient.asdc-address=localhost:1234
+org.onap.ccsdk.sli.northbound.uebclient.consumer-group=ccsdk1
+org.onap.ccsdk.sli.northbound.uebclient.consumer-id=localhost_ccsdk1
+org.onap.ccsdk.sli.northbound.uebclient.environment-name=UNITTEST
+org.onap.ccsdk.sli.northbound.uebclient.password=123456
+org.onap.ccsdk.sli.northbound.uebclient.user=test
+org.onap.ccsdk.sli.northbound.uebclient.sdnc-user=test
+org.onap.ccsdk.sli.northbound.uebclient.sdnc-passwd=test
+org.onap.ccsdk.sli.northbound.uebclient.asdc-api-base-url=http://localhost:8282/restconf/operations/
+org.onap.ccsdk.sli.northbound.uebclient.asdc-api-namespace=org:onap:ccsdk
+org.onap.ccsdk.sli.northbound.uebclient.spool.incoming=src/test/resources/incoming
+org.onap.ccsdk.sli.northbound.uebclient.spool.archive=src/test/resources/archive
+org.onap.ccsdk.sli.northbound.uebclient.polling-interval=30
+org.onap.ccsdk.sli.northbound.uebclient.polling-timeout=15
+org.onap.ccsdk.sli.northbound.uebclient.relevant-artifact-types=YANG_XML,VF_LICENSE,TOSCA_TEMPLATE,TOSCA_CSAR,UCPE_LAYER_2_CONFIGURATION
+org.onap.ccsdk.sli.northbound.uebclient.activate-server-tls-auth=false
+org.onap.ccsdk.sli.northbound.uebclient.keystore-path=
+org.onap.ccsdk.sli.northbound.uebclient.keystore-password=
+org.onap.ccsdk.sli.northbound.uebclient.xslt-path-list= \ No newline at end of file