aboutsummaryrefslogtreecommitdiffstats
path: root/UniversalVesAdapter/src/test/java/org
diff options
context:
space:
mode:
authorPooja03 <PM00501616@techmahindra.com>2018-08-09 17:49:09 +0530
committerPooja03 <PM00501616@techmahindra.com>2018-08-09 17:49:09 +0530
commitc17ce648ecc3453df8754b936f2b344f13f6dc65 (patch)
treedc57f5dc5bc9a6d02b415b11ceed2ae31e573af3 /UniversalVesAdapter/src/test/java/org
parent1463aaab6db65130de04d84a68fd9331a1c0caa9 (diff)
Integratation of DMaaP, Mapping File
DMaaP integratation, Mapping File, Initialization of Adapter Change-Id: I826aa2e64fa7c155f088a7519c24887ce88e2ec4 Issue-ID: DCAEGEN2-335 Signed-off-by: Pooja03 <PM00501616@techmahindra.com>
Diffstat (limited to 'UniversalVesAdapter/src/test/java/org')
-rw-r--r--UniversalVesAdapter/src/test/java/org/onap/dcaegen2/ves/domain/AdditionalFieldTest.java5
-rw-r--r--UniversalVesAdapter/src/test/java/org/onap/dcaegen2/ves/domain/AdditionalMeasurementTest.java2
-rw-r--r--UniversalVesAdapter/src/test/java/org/onap/dcaegen2/ves/domain/AdditionalObjectTest.java2
-rw-r--r--UniversalVesAdapter/src/test/java/org/onap/dcaegen2/ves/domain/AdditionalParameterTest.java10
-rw-r--r--UniversalVesAdapter/src/test/java/org/onap/universalvesadapter/adapter/UniversalEventAdapterTest.java207
-rw-r--r--UniversalVesAdapter/src/test/java/org/onap/universalvesadapter/configs/DMaapMrUrlConfigurationTest.java53
-rw-r--r--UniversalVesAdapter/src/test/java/org/onap/universalvesadapter/configs/DiskRepoConfigurationTest.java51
-rw-r--r--UniversalVesAdapter/src/test/java/org/onap/universalvesadapter/configs/UniversalEventConfigurationTest.java48
-rw-r--r--UniversalVesAdapter/src/test/java/org/onap/universalvesadapter/controller/VesControllerTest.java2
-rw-r--r--UniversalVesAdapter/src/test/java/org/onap/universalvesadapter/domain/ConfigFileDataTest.java40
-rw-r--r--UniversalVesAdapter/src/test/java/org/onap/universalvesadapter/exception/ConfigFileReadExceptionTest.java34
-rw-r--r--UniversalVesAdapter/src/test/java/org/onap/universalvesadapter/exception/ConfigFileSmooksConversionExceptionTest.java2
-rw-r--r--UniversalVesAdapter/src/test/java/org/onap/universalvesadapter/service/AdapterServiceTest.java147
-rw-r--r--UniversalVesAdapter/src/test/java/org/onap/universalvesadapter/service/DMaapServiceTest.java3
-rw-r--r--UniversalVesAdapter/src/test/java/org/onap/universalvesadapter/service/DiskRepoConfigFileServiceTest.java3
-rw-r--r--UniversalVesAdapter/src/test/java/org/onap/universalvesadapter/service/MongoDbConfigFileServiceTest.java58
-rw-r--r--UniversalVesAdapter/src/test/java/org/onap/universalvesadapter/service/VesServiceTest.java9
-rw-r--r--UniversalVesAdapter/src/test/java/org/onap/universalvesadapter/utils/MapperConfigUtilsTest.java13
-rw-r--r--UniversalVesAdapter/src/test/java/org/onap/universalvesadapter/utils/ParallelTasksTest.java72
-rw-r--r--UniversalVesAdapter/src/test/java/org/onap/universalvesadapter/utils/SmooksUtilsTest.java19
20 files changed, 161 insertions, 619 deletions
diff --git a/UniversalVesAdapter/src/test/java/org/onap/dcaegen2/ves/domain/AdditionalFieldTest.java b/UniversalVesAdapter/src/test/java/org/onap/dcaegen2/ves/domain/AdditionalFieldTest.java
index ce4c8c7..e082249 100644
--- a/UniversalVesAdapter/src/test/java/org/onap/dcaegen2/ves/domain/AdditionalFieldTest.java
+++ b/UniversalVesAdapter/src/test/java/org/onap/dcaegen2/ves/domain/AdditionalFieldTest.java
@@ -19,11 +19,6 @@
*/
package org.onap.dcaegen2.ves.domain;
-import static org.junit.Assert.*;
-
-import java.util.HashMap;
-import java.util.Map;
-import org.onap.dcaegen2.ves.domain.AdditionalField;
import org.junit.Test;
import org.springframework.beans.factory.annotation.Autowired;
diff --git a/UniversalVesAdapter/src/test/java/org/onap/dcaegen2/ves/domain/AdditionalMeasurementTest.java b/UniversalVesAdapter/src/test/java/org/onap/dcaegen2/ves/domain/AdditionalMeasurementTest.java
index 1b9149b..58a2507 100644
--- a/UniversalVesAdapter/src/test/java/org/onap/dcaegen2/ves/domain/AdditionalMeasurementTest.java
+++ b/UniversalVesAdapter/src/test/java/org/onap/dcaegen2/ves/domain/AdditionalMeasurementTest.java
@@ -21,7 +21,7 @@ package org.onap.dcaegen2.ves.domain;
import java.util.List;
import java.util.Map;
-import org.onap.dcaegen2.ves.domain.AdditionalMeasurement;
+
import org.junit.Test;
public class AdditionalMeasurementTest {
diff --git a/UniversalVesAdapter/src/test/java/org/onap/dcaegen2/ves/domain/AdditionalObjectTest.java b/UniversalVesAdapter/src/test/java/org/onap/dcaegen2/ves/domain/AdditionalObjectTest.java
index fc28bd5..d3750ed 100644
--- a/UniversalVesAdapter/src/test/java/org/onap/dcaegen2/ves/domain/AdditionalObjectTest.java
+++ b/UniversalVesAdapter/src/test/java/org/onap/dcaegen2/ves/domain/AdditionalObjectTest.java
@@ -21,7 +21,7 @@ package org.onap.dcaegen2.ves.domain;
import java.util.List;
import java.util.Map;
-import org.onap.dcaegen2.ves.domain.AdditionalInformation;
+
import org.junit.Test;
public class AdditionalObjectTest {
diff --git a/UniversalVesAdapter/src/test/java/org/onap/dcaegen2/ves/domain/AdditionalParameterTest.java b/UniversalVesAdapter/src/test/java/org/onap/dcaegen2/ves/domain/AdditionalParameterTest.java
index 92cda09..9b64ddd 100644
--- a/UniversalVesAdapter/src/test/java/org/onap/dcaegen2/ves/domain/AdditionalParameterTest.java
+++ b/UniversalVesAdapter/src/test/java/org/onap/dcaegen2/ves/domain/AdditionalParameterTest.java
@@ -19,6 +19,8 @@
*/
package org.onap.dcaegen2.ves.domain;
+import static org.junit.Assert.assertNotNull;
+
import java.util.Map;
import org.junit.Test;
@@ -37,6 +39,7 @@ public class AdditionalParameterTest {
// default test
testSubject = createTestSubject();
result = testSubject.getCriticality();
+
}
@Test
@@ -57,6 +60,7 @@ public class AdditionalParameterTest {
// default test
testSubject = createTestSubject();
result = testSubject.getName();
+
}
@Test
@@ -77,6 +81,7 @@ public class AdditionalParameterTest {
// default test
testSubject = createTestSubject();
result = testSubject.getThresholdCrossed();
+
}
@Test
@@ -97,6 +102,7 @@ public class AdditionalParameterTest {
// default test
testSubject = createTestSubject();
result = testSubject.getValue();
+
}
@Test
@@ -117,6 +123,7 @@ public class AdditionalParameterTest {
// default test
testSubject = createTestSubject();
result = testSubject.getAdditionalProperties();
+
}
@Test
@@ -138,6 +145,7 @@ public class AdditionalParameterTest {
// default test
testSubject = createTestSubject();
result = testSubject.toString();
+
}
@Test
@@ -148,6 +156,7 @@ public class AdditionalParameterTest {
// default test
testSubject = createTestSubject();
result = testSubject.hashCode();
+
}
@Test
@@ -159,5 +168,6 @@ public class AdditionalParameterTest {
// default test
testSubject = createTestSubject();
result = testSubject.equals(other);
+
}
} \ No newline at end of file
diff --git a/UniversalVesAdapter/src/test/java/org/onap/universalvesadapter/adapter/UniversalEventAdapterTest.java b/UniversalVesAdapter/src/test/java/org/onap/universalvesadapter/adapter/UniversalEventAdapterTest.java
index bc2cf4f..1f80fde 100644
--- a/UniversalVesAdapter/src/test/java/org/onap/universalvesadapter/adapter/UniversalEventAdapterTest.java
+++ b/UniversalVesAdapter/src/test/java/org/onap/universalvesadapter/adapter/UniversalEventAdapterTest.java
@@ -19,48 +19,26 @@
*/
package org.onap.universalvesadapter.adapter;
-import static org.junit.Assert.*;
-import static org.mockito.Mockito.when;
+import static org.junit.Assert.assertNotEquals;
+import static org.junit.Assert.assertNotNull;
-import java.io.FileNotFoundException;
-import java.io.FileReader;
-import java.io.IOException;
-import java.util.Arrays;
-import java.util.Collections;
+import java.util.HashMap;
import java.util.Map;
-import java.util.concurrent.ConcurrentHashMap;
-
-import javax.annotation.Resource;
import org.junit.Before;
-import org.junit.BeforeClass;
import org.junit.Test;
import org.junit.runner.RunWith;
-import org.milyn.Smooks;
import org.mockito.InjectMocks;
import org.mockito.Mock;
-import org.mockito.Mockito;
import org.mockito.MockitoAnnotations;
-import org.onap.dcaegen2.ves.domain.VesEvent;
import org.onap.universalvesadapter.Application;
-import org.onap.universalvesadapter.adapter.UniversalEventAdapter;
-import org.onap.universalvesadapter.exception.ConfigFileReadException;
-import org.onap.universalvesadapter.exception.ConfigFileSmooksConversionException;
-import org.onap.universalvesadapter.exception.MapperConfigException;
import org.onap.universalvesadapter.exception.VesException;
-import org.onap.universalvesadapter.service.ConfigFileService;
-import org.onap.universalvesadapter.utils.MapperConfigUtils;
-import org.onap.universalvesadapter.utils.SmooksUtils;
+import org.onap.universalvesadapter.service.VESAdapterInitializer;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.beans.factory.annotation.Value;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.junit4.SpringRunner;
-import org.springframework.util.FileCopyUtils;
-import com.fasterxml.jackson.core.JsonProcessingException;
-import com.fasterxml.jackson.databind.ObjectMapper;
@RunWith(SpringRunner.class)
@SpringBootTest(classes=Application.class)
@@ -69,10 +47,9 @@ public class UniversalEventAdapterTest {
private final Logger eLOGGER = LoggerFactory.getLogger(this.getClass());
@Mock
- private ConfigFileService configFileService;
+ private VESAdapterInitializer vESAdapterInitializer;
@InjectMocks
- @Autowired
private UniversalEventAdapter universalVesAdapter;
@@ -86,7 +63,7 @@ public class UniversalEventAdapterTest {
public void testtransform() {
StringBuffer incomingJsonString = new StringBuffer("{ ")
.append("\"protocol version\":\"v2c\", ")
- .append("\"notify OID\":\".1.3.6.1.4.1.74.2.46.12.1.1AAA\", ")
+ .append("\"notify OID\":\".1.3.6.1.4.1.1751.2.46.12.1.1\", ")
.append("\"cambria.partition\":\"dcae-snmp.client.research.att.com\", ")
.append("\"trap category\":\"UCSNMP-HEARTBEAT\", ")
.append("\"epoch_serno\": 15161177410000, ")
@@ -107,48 +84,140 @@ public class UniversalEventAdapterTest {
.append(" }] ")
.append("}");
- StringBuffer configFileData = new StringBuffer("<?xml version=\"1.0\" encoding=\"UTF-8\"?> ")
- .append("<smooks-resource-list xmlns=\"http://www.milyn.org/xsd/smooks-1.1.xsd\" ")
- .append("xmlns:json=\"http://www.milyn.org/xsd/smooks/json-1.1.xsd\" ")
- .append(" xmlns:jb=\"http://www.milyn.org/xsd/smooks/javabean-1.2.xsd\"> ")
- .append(" <json:reader rootName=\"simple\" keyWhitspaceReplacement=\"-\"> ")
- .append(" </json:reader> ")
- .append(" <jb:bean class=\"org.onap.dcaegen2.ves.domain.VesEvent\" beanId=\"vesEvent\" ")
- .append(" createOnElement=\"simple\">")
- .append(" <jb:wiring property=\"event\" beanIdRef=\"event\"/>")
- .append(" </jb:bean> ")
- .append(" <jb:bean class=\"org.onap.dcaegen2.ves.domain.Event\" beanId=\"event\" ")
- .append(" createOnElement=\"simple\"> ")
- .append(" <jb:wiring property=\"commonEventHeader\" beanIdRef=\"commonEventHeader\"/>")
- .append(" <jb:wiring property=\"faultFields\" beanIdRef=\"faultFields\"/> ")
- .append(" </jb:bean> ")
- .append(" <jb:bean class=\"org.onap.dcaegen2.ves.domain.CommonEventHeader\" ")
- .append(" beanId=\"commonEventHeader\" createOnElement=\"simple\"> ")
- .append(" <jb:value property=\"eventId\" data=\"#/community\" /> ")
- .append(" <jb:value property=\"eventName\" data=\"#/protocol-version\" /> ")
- .append(" <jb:value property=\"domain\" data=\"#/trap-category\" /> ")
- .append(" <jb:value property=\"sequence\" data=\"#/time-received\" decoder=\"Long\"/> ")
- .append(" <jb:value property=\"lastEpochMicrosec\" data=\"#/community-len\" decoder=\"Double\" /> ")
- .append(" <jb:value property=\"startEpochMicrosec\" data=\"#/notify-OID-len\" /> ")
- .append(" </jb:bean> ")
- .append(" <jb:bean class=\"org.onap.dcaegen2.ves.domain.FaultFields\" beanId=\"faultFields\"")
- .append(" createOnElement=\"simple\"> <jb:value property=\"alarmCondition\" data=\"#/cambria.partition\" /> ")
- .append(" <jb:value property=\"eventSeverity\" data=\"#/notify-OID\" /> ")
- .append(" <jb:value property=\"eventSourceType\" data=\"#/agent-name\" /> ")
- .append(" <jb:value property=\"specificProblem\" data=\"#/agent-address\" /> ")
- .append(" <jb:value property=\"faultFieldsVersion\" data=\"#/epoch_serno\" decoder=\"Double\" /> ")
- .append(" </jb:bean> ")
- .append("</smooks-resource-list>");
-
- try {
- Mockito.when(configFileService.readConfigFile(Mockito.anyString())).thenReturn(configFileData.toString());
- } catch (Exception e) {
- eLOGGER.error("Error occurred : " + e.getMessage());
- }
-
+ Map<String,String> testMap=new HashMap<String,String>();
+ testMap.put("defaultSnmpMappingFile", "<?xml version=\"1.0\"?>\r\n" +
+ "<smooks-resource-list\r\n" +
+ " xmlns=\"http://www.milyn.org/xsd/smooks-1.1.xsd\"\r\n" +
+ " xmlns:json=\"http://www.milyn.org/xsd/smooks/json-1.1.xsd\"\r\n" +
+ " xmlns:jb=\"http://www.milyn.org/xsd/smooks/javabean-1.4.xsd\">\r\n" +
+ " <json:reader rootName=\"vesevent\" keyWhitspaceReplacement=\"-\">\r\n" +
+ " <json:keyMap>\r\n" +
+ " <json:key from=\"date&amp;time\" to=\"date-and-time\" />\r\n" +
+ " </json:keyMap>\r\n" +
+ " </json:reader>\r\n" +
+ " \r\n" +
+ " <jb:bean class=\"org.onap.dcaegen2.ves.domain.VesEvent\" beanId=\"vesEvent\" createOnElement=\"vesevent\">\r\n" +
+ " <jb:wiring property=\"event\" beanIdRef=\"event\"/>\r\n" +
+ " </jb:bean>\r\n" +
+ " \r\n" +
+ " <jb:bean class=\"org.onap.dcaegen2.ves.domain.Event\" beanId=\"event\" createOnElement=\"vesevent\">\r\n" +
+ " <jb:wiring property=\"commonEventHeader\" beanIdRef=\"commonEventHeader\"/>\r\n" +
+ " <jb:wiring property=\"faultFields\" beanIdRef=\"faultFields\"/> \r\n" +
+ " <!--<jb:wiring property=\"measurementsForVfScalingFields\" beanIdRef=\"measurementsForVfScalingFields\"/> --> \r\n" +
+ " </jb:bean> \r\n" +
+ " <!--<jb:bean class=\"org.onap.dcaegen2.ves.domain.MeasurementsForVfScalingFields\" beanId=\"measurementsForVfScalingFields\" createOnElement=\"simple\">\r\n" +
+ " <jb:wiring property=\"additionalMeasurements\" beanIdRef=\"additionalMeasurements\"/>\r\n" +
+ " </jb:bean>-->\r\n" +
+ " \r\n" +
+ " <jb:bean class=\"org.onap.dcaegen2.ves.domain.CommonEventHeader\" beanId=\"commonEventHeader\" createOnElement=\"vesevent\">\r\n" +
+ " <jb:expression property=\"version\">\"3.0\"</jb:expression>\r\n" +
+ " <jb:expression property=\"eventId\">\"XXXX\"</jb:expression>\r\n" +
+ " <jb:expression property=\"reportingEntityName\">\"VesAdapter\"</jb:expression>\r\n" +
+ " <jb:expression property=\"domain\">\"fault\"</jb:expression>\r\n" +
+ " <jb:expression property=\"eventName\" execOnElement=\"vesevent\" >commonEventHeader.domain+\"_\"+commonEventHeader.reportingEntityName +\"_\"+ faultFields.alarmCondition;</jb:expression>\r\n" +
+ " <jb:value property=\"sequence\" data=\"0\" default=\"0\" decoder=\"Long\"/>\r\n" +
+ " <jb:value property=\"lastEpochMicrosec\" data=\"#/time-received\" decoder=\"Double\" />\r\n" +
+ " <jb:value property=\"startEpochMicrosec\" data=\"#/time-received\" decoder=\"Double\"/>\r\n" +
+ " <jb:expression property=\"priority\">\"Medium\"</jb:expression>\r\n" +
+ " <jb:expression property=\"sourceName\">\"VesAdapter\"</jb:expression>\r\n" +
+ " </jb:bean> \r\n" +
+ " \r\n" +
+ " <jb:bean class=\"org.onap.dcaegen2.ves.domain.FaultFields\" beanId=\"faultFields\" createOnElement=\"vesevent\">\r\n" +
+ " <jb:value property=\"alarmCondition\" data=\"#/trap-category\" />\r\n" +
+ " <jb:expression property=\"eventSeverity\">\"MINOR\"</jb:expression>\r\n" +
+ " <jb:expression property=\"eventSourceType\">\"SNMP Agent\"</jb:expression>\r\n" +
+ " <jb:expression property=\"specificProblem\">\"SNMP Fault\"</jb:expression>\r\n" +
+ " <jb:value property=\"faultFieldsVersion\" data=\"2.0\" default=\"2.0\" decoder=\"Double\" />\r\n" +
+ " <jb:wiring property=\"alarmAdditionalInformation\" beanIdRef=\"alarmAdditionalInformationroot\"/> \r\n" +
+ " <jb:expression property=\"vfStatus\">\"Active\"</jb:expression>\r\n" +
+ " \r\n" +
+ " </jb:bean> \r\n" +
+ " <jb:bean class=\"java.util.ArrayList\" beanId=\"alarmAdditionalInformationroot\" createOnElement=\"vesevent\">\r\n" +
+ " <jb:wiring beanIdRef=\"alarmAdditionalInformation\"/>\r\n" +
+ " </jb:bean>\r\n" +
+ " \r\n" +
+ " <jb:bean class=\"org.onap.dcaegen2.ves.domain.AlarmAdditionalInformation\" beanId=\"alarmAdditionalInformation\" createOnElement=\"varbinds/element\">\r\n" +
+ " <jb:value property=\"name\" data=\"#/varbind_oid\"/>\r\n" +
+ " <jb:value property=\"value\" data=\"#/varbind_value\" />\r\n" +
+ " </jb:bean>\r\n" +
+ " <!--<jb:bean class=\"java.util.ArrayList\" beanId=\"additionalMeasurements\" createOnElement=\"simple\">\r\n" +
+ " <jb:wiring beanIdRef=\"additionalMeasurement\"/>\r\n" +
+ " </jb:bean> \r\n" +
+ " \r\n" +
+ " <jb:bean class=\"org.onap.dcaegen2.ves.domain.AdditionalMeasurement\" beanId=\"additionalMeasurement\" createOnElement=\"varbinds/element\">\r\n" +
+ " <jb:value property=\"name\" data=\"#/varbind_value\" />\r\n" +
+ " </jb:bean> --> \r\n" +
+ " \r\n" +
+ "</smooks-resource-list>");
+ testMap.put(".1.3.6.1.4.1.1751.2.46.12", "<?xml version=\"1.0\"?>\r\n" +
+ "<smooks-resource-list\r\n" +
+ " xmlns=\"http://www.milyn.org/xsd/smooks-1.1.xsd\"\r\n" +
+ " xmlns:json=\"http://www.milyn.org/xsd/smooks/json-1.1.xsd\"\r\n" +
+ " xmlns:jb=\"http://www.milyn.org/xsd/smooks/javabean-1.4.xsd\">\r\n" +
+ " <json:reader rootName=\"vesevent\" keyWhitspaceReplacement=\"-\">\r\n" +
+ " <json:keyMap>\r\n" +
+ " <json:key from=\"date&amp;time\" to=\"date-and-time\" />\r\n" +
+ " </json:keyMap>\r\n" +
+ " </json:reader>\r\n" +
+ " \r\n" +
+ " <jb:bean class=\"org.onap.dcaegen2.ves.domain.VesEvent\" beanId=\"vesEvent\" createOnElement=\"vesevent\">\r\n" +
+ " <jb:wiring property=\"event\" beanIdRef=\"event\"/>\r\n" +
+ " </jb:bean>\r\n" +
+ " \r\n" +
+ " <jb:bean class=\"org.onap.dcaegen2.ves.domain.Event\" beanId=\"event\" createOnElement=\"vesevent\">\r\n" +
+ " <jb:wiring property=\"commonEventHeader\" beanIdRef=\"commonEventHeader\"/>\r\n" +
+ " <jb:wiring property=\"faultFields\" beanIdRef=\"faultFields\"/> \r\n" +
+ " <!--<jb:wiring property=\"measurementsForVfScalingFields\" beanIdRef=\"measurementsForVfScalingFields\"/> --> \r\n" +
+ " </jb:bean> \r\n" +
+ " <!--<jb:bean class=\"org.onap.dcaegen2.ves.domain.MeasurementsForVfScalingFields\" beanId=\"measurementsForVfScalingFields\" createOnElement=\"simple\">\r\n" +
+ " <jb:wiring property=\"additionalMeasurements\" beanIdRef=\"additionalMeasurements\"/>\r\n" +
+ " </jb:bean>-->\r\n" +
+ " \r\n" +
+ " <jb:bean class=\"org.onap.dcaegen2.ves.domain.CommonEventHeader\" beanId=\"commonEventHeader\" createOnElement=\"vesevent\">\r\n" +
+ " <jb:expression property=\"version\">\"3.0\"</jb:expression>\r\n" +
+ " <jb:expression property=\"eventId\">\"XXXX\"</jb:expression>\r\n" +
+ " <jb:expression property=\"reportingEntityName\">\"VesAdapter\"</jb:expression>\r\n" +
+ " <jb:expression property=\"domain\">\"fault\"</jb:expression>\r\n" +
+ " <jb:expression property=\"eventName\" execOnElement=\"vesevent\" >commonEventHeader.domain+\"_\"+commonEventHeader.reportingEntityName +\"_\"+ faultFields.alarmCondition;</jb:expression>\r\n" +
+ " <jb:value property=\"sequence\" data=\"0\" default=\"0\" decoder=\"Long\"/>\r\n" +
+ " <jb:value property=\"lastEpochMicrosec\" data=\"#/time-received\" decoder=\"Double\" />\r\n" +
+ " <jb:value property=\"startEpochMicrosec\" data=\"#/time-received\" decoder=\"Double\"/>\r\n" +
+ " <jb:expression property=\"priority\">\"Medium\"</jb:expression>\r\n" +
+ " <jb:expression property=\"sourceName\">\"VesAdapter\"</jb:expression>\r\n" +
+ " </jb:bean> \r\n" +
+ " \r\n" +
+ " <jb:bean class=\"org.onap.dcaegen2.ves.domain.FaultFields\" beanId=\"faultFields\" createOnElement=\"vesevent\">\r\n" +
+ " <jb:value property=\"alarmCondition\" data=\"#/trap-category\" />\r\n" +
+ " <jb:expression property=\"eventSeverity\">\"MINOR\"</jb:expression>\r\n" +
+ " <jb:expression property=\"eventSourceType\">\"SNMP Agent\"</jb:expression>\r\n" +
+ " <jb:expression property=\"specificProblem\">\"SNMP Fault\"</jb:expression>\r\n" +
+ " <jb:value property=\"faultFieldsVersion\" data=\"2.0\" default=\"2.0\" decoder=\"Double\" />\r\n" +
+ " <jb:wiring property=\"alarmAdditionalInformation\" beanIdRef=\"alarmAdditionalInformationroot\"/> \r\n" +
+ " <jb:expression property=\"vfStatus\">\"Active\"</jb:expression>\r\n" +
+ " \r\n" +
+ " </jb:bean> \r\n" +
+ " <jb:bean class=\"java.util.ArrayList\" beanId=\"alarmAdditionalInformationroot\" createOnElement=\"vesevent\">\r\n" +
+ " <jb:wiring beanIdRef=\"alarmAdditionalInformation\"/>\r\n" +
+ " </jb:bean>\r\n" +
+ " \r\n" +
+ " <jb:bean class=\"org.onap.dcaegen2.ves.domain.AlarmAdditionalInformation\" beanId=\"alarmAdditionalInformation\" createOnElement=\"varbinds/element\">\r\n" +
+ " <jb:value property=\"name\" data=\"#/varbind_oid\"/>\r\n" +
+ " <jb:value property=\"value\" data=\"#/varbind_value\" />\r\n" +
+ " </jb:bean>\r\n" +
+ " <!--<jb:bean class=\"java.util.ArrayList\" beanId=\"additionalMeasurements\" createOnElement=\"simple\">\r\n" +
+ " <jb:wiring beanIdRef=\"additionalMeasurement\"/>\r\n" +
+ " </jb:bean> \r\n" +
+ " \r\n" +
+ " <jb:bean class=\"org.onap.dcaegen2.ves.domain.AdditionalMeasurement\" beanId=\"additionalMeasurement\" createOnElement=\"varbinds/element\">\r\n" +
+ " <jb:value property=\"name\" data=\"#/varbind_value\" />\r\n" +
+ " </jb:bean> --> \r\n" +
+ " \r\n" +
+ "</smooks-resource-list>");
try {
- String actualResult = universalVesAdapter.transform(incomingJsonString.toString(), "snmp");
+
+ VESAdapterInitializer.setMappingFiles(testMap);
+ String actualResult = universalVesAdapter.transform(incomingJsonString.toString(), "snmp");
assertNotNull(actualResult);
assertNotEquals("", actualResult);
} catch (VesException exception) {
diff --git a/UniversalVesAdapter/src/test/java/org/onap/universalvesadapter/configs/DMaapMrUrlConfigurationTest.java b/UniversalVesAdapter/src/test/java/org/onap/universalvesadapter/configs/DMaapMrUrlConfigurationTest.java
deleted file mode 100644
index c7497b4..0000000
--- a/UniversalVesAdapter/src/test/java/org/onap/universalvesadapter/configs/DMaapMrUrlConfigurationTest.java
+++ /dev/null
@@ -1,53 +0,0 @@
-/*
-* ============LICENSE_START=======================================================
-* ONAP : DCAE
-* ================================================================================
-* Copyright 2018 TechMahindra
-*=================================================================================
-* 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=========================================================
-*/
-package org.onap.universalvesadapter.configs;
-
-import static org.junit.Assert.*;
-
-import org.junit.Test;
-import org.junit.runner.RunWith;
-import org.mockito.InjectMocks;
-import org.onap.universalvesadapter.Application;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.boot.test.context.SpringBootTest;
-import org.springframework.test.context.junit4.SpringRunner;
-
-@RunWith(SpringRunner.class)
-@SpringBootTest(classes=Application.class)
-public class DMaapMrUrlConfigurationTest {
-
- @Autowired
- @InjectMocks
- DMaapMrUrlConfiguration dMaapMrUrlConfiguration = new DMaapMrUrlConfiguration();
-
- @Test
- public void test() {
- String actualdata1 = dMaapMrUrlConfiguration.getConsumerProperties();
- String actualdata2 = dMaapMrUrlConfiguration.getPublisherProperties();
- String actualdata3 = dMaapMrUrlConfiguration.getUrl();
-
- assertEquals("../UniversalVesAdapter/src/main/resources/dme2/consumer.properties", actualdata1);
- assertEquals("../UniversalVesAdapter/src/main/resources/dme2/publisher.properties", actualdata2);
- assertEquals("http://localhost:8080/greeting12", actualdata3);
-
-
- }
-
-}
diff --git a/UniversalVesAdapter/src/test/java/org/onap/universalvesadapter/configs/DiskRepoConfigurationTest.java b/UniversalVesAdapter/src/test/java/org/onap/universalvesadapter/configs/DiskRepoConfigurationTest.java
deleted file mode 100644
index 4d42641..0000000
--- a/UniversalVesAdapter/src/test/java/org/onap/universalvesadapter/configs/DiskRepoConfigurationTest.java
+++ /dev/null
@@ -1,51 +0,0 @@
-/*
-* ============LICENSE_START=======================================================
-* ONAP : DCAE
-* ================================================================================
-* Copyright 2018 TechMahindra
-*=================================================================================
-* 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=========================================================
-*/
-package org.onap.universalvesadapter.configs;
-
-import static org.junit.Assert.*;
-
-import org.onap.universalvesadapter.Application;
-import org.onap.universalvesadapter.configs.DiskRepoConfiguration;
-import org.junit.Test;
-import org.junit.runner.RunWith;
-import org.mockito.InjectMocks;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.beans.factory.annotation.Value;
-import org.springframework.boot.test.context.SpringBootTest;
-import org.springframework.test.context.junit4.SpringRunner;
-
-@RunWith(SpringRunner.class)
-@SpringBootTest(classes=Application.class)
-public class DiskRepoConfigurationTest {
-
- @InjectMocks
- @Autowired
- DiskRepoConfiguration diskRepoConfiguration = new DiskRepoConfiguration();
-
- @Test
- public void test() {
-
-
- String actualdata = diskRepoConfiguration.getFileRepositoryUrl();
-
- assertEquals("http://localhost:8888/fileAsString/", actualdata);
- }
-
-}
diff --git a/UniversalVesAdapter/src/test/java/org/onap/universalvesadapter/configs/UniversalEventConfigurationTest.java b/UniversalVesAdapter/src/test/java/org/onap/universalvesadapter/configs/UniversalEventConfigurationTest.java
deleted file mode 100644
index c79caa9..0000000
--- a/UniversalVesAdapter/src/test/java/org/onap/universalvesadapter/configs/UniversalEventConfigurationTest.java
+++ /dev/null
@@ -1,48 +0,0 @@
-/*
-* ============LICENSE_START=======================================================
-* ONAP : DCAE
-* ================================================================================
-* Copyright 2018 TechMahindra
-*=================================================================================
-* 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=========================================================
-*/
-package org.onap.universalvesadapter.configs;
-
-import static org.junit.Assert.*;
-
-import org.junit.Test;
-import org.junit.runner.RunWith;
-import org.mockito.InjectMocks;
-import org.onap.universalvesadapter.Application;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.boot.test.context.SpringBootTest;
-import org.springframework.test.context.junit4.SpringRunner;
-
-@RunWith(SpringRunner.class)
-@SpringBootTest(classes=Application.class)
-public class UniversalEventConfigurationTest {
-
- @Autowired
- @InjectMocks
- UniversalEventConfiguration universalEventConfiguration = new UniversalEventConfiguration();
-
- @Test
- public void test() {
- String actualdata = universalEventConfiguration.getConfigForEvent("default");
-
- assertEquals("defaultConfig.xml", actualdata);
-
- }
-
-}
diff --git a/UniversalVesAdapter/src/test/java/org/onap/universalvesadapter/controller/VesControllerTest.java b/UniversalVesAdapter/src/test/java/org/onap/universalvesadapter/controller/VesControllerTest.java
index b35b7b4..582b4fc 100644
--- a/UniversalVesAdapter/src/test/java/org/onap/universalvesadapter/controller/VesControllerTest.java
+++ b/UniversalVesAdapter/src/test/java/org/onap/universalvesadapter/controller/VesControllerTest.java
@@ -22,7 +22,6 @@ package org.onap.universalvesadapter.controller;
import static org.junit.Assert.assertEquals;
import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.get;
import static org.springframework.test.web.servlet.result.MockMvcResultHandlers.print;
-import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.jsonPath;
import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status;
import org.junit.Test;
@@ -34,7 +33,6 @@ import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.junit4.SpringRunner;
import org.springframework.test.web.servlet.MockMvc;
import org.springframework.test.web.servlet.MvcResult;
-import org.springframework.test.web.servlet.ResultActions;
@RunWith(SpringRunner.class)
@SpringBootTest(classes=Application.class)
diff --git a/UniversalVesAdapter/src/test/java/org/onap/universalvesadapter/domain/ConfigFileDataTest.java b/UniversalVesAdapter/src/test/java/org/onap/universalvesadapter/domain/ConfigFileDataTest.java
deleted file mode 100644
index 9f51cae..0000000
--- a/UniversalVesAdapter/src/test/java/org/onap/universalvesadapter/domain/ConfigFileDataTest.java
+++ /dev/null
@@ -1,40 +0,0 @@
-/*
-* ============LICENSE_START=======================================================
-* ONAP : DCAE
-* ================================================================================
-* Copyright 2018 TechMahindra
-*=================================================================================
-* 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=========================================================
-*/
-package org.onap.universalvesadapter.domain;
-
-import static org.junit.Assert.*;
-
-import org.junit.Test;
-import org.springframework.beans.factory.annotation.Autowired;
-
-public class ConfigFileDataTest {
-
- @Autowired
- ConfigFileData configFileData = new ConfigFileData();
- @Test
- public void test() {
- configFileData.setXmlContent("xmlContent");
- configFileData.setXmlFileName("xmlFileName");
-
- assertEquals(configFileData.getXmlContent(), "xmlContent");
- assertEquals(configFileData.getXmlFileName(), "xmlFileName");
- }
-
-}
diff --git a/UniversalVesAdapter/src/test/java/org/onap/universalvesadapter/exception/ConfigFileReadExceptionTest.java b/UniversalVesAdapter/src/test/java/org/onap/universalvesadapter/exception/ConfigFileReadExceptionTest.java
deleted file mode 100644
index 1d5307a..0000000
--- a/UniversalVesAdapter/src/test/java/org/onap/universalvesadapter/exception/ConfigFileReadExceptionTest.java
+++ /dev/null
@@ -1,34 +0,0 @@
-/*
-* ============LICENSE_START=======================================================
-* ONAP : DCAE
-* ================================================================================
-* Copyright 2018 TechMahindra
-*=================================================================================
-* 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=========================================================
-*/
-package org.onap.universalvesadapter.exception;
-
-import org.junit.Test;
-
-public class ConfigFileReadExceptionTest {
-
-
- @Test
- public void test() {
- ConfigFileReadException se = new ConfigFileReadException("message");
- ConfigFileReadException se1 = new ConfigFileReadException("message", se);
-
-
- }
-}
diff --git a/UniversalVesAdapter/src/test/java/org/onap/universalvesadapter/exception/ConfigFileSmooksConversionExceptionTest.java b/UniversalVesAdapter/src/test/java/org/onap/universalvesadapter/exception/ConfigFileSmooksConversionExceptionTest.java
index 2fda822..ac60be1 100644
--- a/UniversalVesAdapter/src/test/java/org/onap/universalvesadapter/exception/ConfigFileSmooksConversionExceptionTest.java
+++ b/UniversalVesAdapter/src/test/java/org/onap/universalvesadapter/exception/ConfigFileSmooksConversionExceptionTest.java
@@ -19,8 +19,6 @@
*/
package org.onap.universalvesadapter.exception;
-import static org.junit.Assert.*;
-
import org.junit.Test;
public class ConfigFileSmooksConversionExceptionTest {
diff --git a/UniversalVesAdapter/src/test/java/org/onap/universalvesadapter/service/AdapterServiceTest.java b/UniversalVesAdapter/src/test/java/org/onap/universalvesadapter/service/AdapterServiceTest.java
deleted file mode 100644
index 298ab69..0000000
--- a/UniversalVesAdapter/src/test/java/org/onap/universalvesadapter/service/AdapterServiceTest.java
+++ /dev/null
@@ -1,147 +0,0 @@
-/*
-* ============LICENSE_START=======================================================
-* ONAP : DCAE
-* ================================================================================
-* Copyright 2018 TechMahindra
-*=================================================================================
-* 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=========================================================
-*/
-package org.onap.universalvesadapter.service;
-
-import static org.junit.Assert.*;
-import static org.mockito.Mockito.when;
-
-import java.io.FileNotFoundException;
-import java.io.FileReader;
-import java.io.IOException;
-
-import org.junit.Before;
-import org.junit.Test;
-import org.junit.runner.RunWith;
-import org.mockito.InjectMocks;
-import org.mockito.MockitoAnnotations;
-import org.onap.dcaegen2.ves.domain.AdditionalField;
-import org.onap.universalvesadapter.Application;
-import org.onap.universalvesadapter.exception.MapperConfigException;
-import org.onap.universalvesadapter.service.AdapterService;
-import org.onap.universalvesadapter.utils.MapperConfigUtils;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.beans.factory.annotation.Value;
-import org.springframework.boot.test.context.SpringBootTest;
-import org.springframework.test.context.junit4.SpringRunner;
-import org.springframework.util.FileCopyUtils;
-
-@RunWith(SpringRunner.class)
-@SpringBootTest(classes=Application.class)
-public class AdapterServiceTest {
-
-// private final Logger eLOGGER = LoggerFactory.getLogger(this.getClass());
-
- @Before
- public void setup() {
- MockitoAnnotations.initMocks(this);
- }
-
- @Autowired
- @InjectMocks
- private AdapterService adapterService;
-
-
- //AdapterService adapterService = new AdapterService();
-
- @Value("${mapperConfig.file}")
- private String mapperConfigFile;
-
- @Test
- public void identifyEventTypeFromIncomingJson() throws MapperConfigException, FileNotFoundException, IOException {
-
- String inputJsonString = "{ "
- + "\"protocol version\":\"v2c\", "
- + "\"notify OID\":\".1.3.6.1.4.1.74.2.46.12.1.1AAA\", "
- + "\"cambria.partition\":\"dcae-snmp.client.research.att.com\", "
- + "\"trap category\":\"UCSNMP-HEARTBEAT\", "
- + "\"epoch_serno\": 15161177410000, "
- + "\"community\":\"public\", "
- + "\"time received\": 1516117741, "
- + "\"agent name\":\"localhost\", "
- + "\"agent address\":\"127.0.0.1\", "
- + "\"community len\": 6, "
- + "\"notify OID len\": 12, "
- + "\"varbinds\": [{ "
- + " \"varbind_type\":\"octet\", "
- + " \"varbind_oid\":\".1.3.6.1.4.1.74.2.46.12.1.1.1\", "
- + " \"varbind_value\":\"ucsnmp heartbeat - ignore\" "
- + " }, { "
- + " \"varbind_type\":\"octet\", "
- + " \"varbind_oid\":\".1.3.6.1.4.1.74.2.46.12.1.1.2\", "
- + " \"varbind_value\":\"Tue Jan 16 10:49:01 EST 2018\" "
- + " }] "
- + "}";
-
- String domain = "";
-
- String mappingFileContent = "{" + " \"entries\" : ["
- + " {"
- + " \"priority\" : 1,"
- + " \"evaluation\" : {"
- + " \"operand\" : \"STARTSWITH\","
- + " \"field\" : \"notify OID\","
- + " \"value\" : \".1.3.6.1.4.1.74\","
- + " \"datatype\" : \"STRING\","
- + " \"lhs\" : null,"
- + " \"rhs\" : null "
- + " },"
- + " \"result\" : \"snmp\""
- + " } "
- + " ]"
- + "}";
- MapperConfigUtils.readMapperConfigFile(mappingFileContent);
- domain = adapterService.identifyEventTypeFromIncomingJson(inputJsonString);
- adapterService.identifyEventTypeFromIncomingJson(inputJsonString);
-
-
- assertEquals("snmp", domain);
- }
- /*@Test
- public void testidentifyEventTypeFromIncomingJson() throws MapperConfigException{
- String inputJsonString = "{ "
- + "\"protocol version\":\"v2c\", "
- + "\"notify OID\":\".1.3.6.1.4.1.74.2.46.12.1.1AAA\", "
- + "\"cambria.partition\":\"dcae-snmp.client.research.att.com\", "
- + "\"trap category\":\"UCSNMP-HEARTBEAT\", "
- + "\"epoch_serno\": 15161177410000, "
- + "\"community\":\"public\", "
- + "\"time received\": 1516117741, "
- + "\"agent name\":\"localhost\", "
- + "\"agent address\":\"127.0.0.1\", "
- + "\"community len\": 6, "
- + "\"notify OID len\": 12, "
- + "\"varbinds\": [{ "
- + " \"varbind_type\":\"octet\", "
- + " \"varbind_oid\":\".1.3.6.1.4.1.74.2.46.12.1.1.1\", "
- + " \"varbind_value\":\"ucsnmp heartbeat - ignore\" "
- + " }, { "
- + " \"varbind_type\":\"octet\", "
- + " \"varbind_oid\":\".1.3.6.1.4.1.74.2.46.12.1.1.2\", "
- + " \"varbind_value\":\"Tue Jan 16 10:49:01 EST 2018\" "
- + " }] "
- + "}";
-// when(MapperConfigUtils.checkIncomingJsonForMatchingDomain(inputJsonString)).thenReturn("snmp");
- String actualDomain=adapterService.identifyEventTypeFromIncomingJson(inputJsonString);
- assertEquals("default", actualDomain);
- }*/
-
-}
diff --git a/UniversalVesAdapter/src/test/java/org/onap/universalvesadapter/service/DMaapServiceTest.java b/UniversalVesAdapter/src/test/java/org/onap/universalvesadapter/service/DMaapServiceTest.java
index 7183fc5..f238306 100644
--- a/UniversalVesAdapter/src/test/java/org/onap/universalvesadapter/service/DMaapServiceTest.java
+++ b/UniversalVesAdapter/src/test/java/org/onap/universalvesadapter/service/DMaapServiceTest.java
@@ -16,7 +16,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
* ============LICENSE_END=========================================================
-*/
+
package org.onap.universalvesadapter.service;
import static org.junit.Assert.*;
@@ -140,3 +140,4 @@ public class DMaapServiceTest {
}
+*/ \ No newline at end of file
diff --git a/UniversalVesAdapter/src/test/java/org/onap/universalvesadapter/service/DiskRepoConfigFileServiceTest.java b/UniversalVesAdapter/src/test/java/org/onap/universalvesadapter/service/DiskRepoConfigFileServiceTest.java
index 8af6270..a639c1f 100644
--- a/UniversalVesAdapter/src/test/java/org/onap/universalvesadapter/service/DiskRepoConfigFileServiceTest.java
+++ b/UniversalVesAdapter/src/test/java/org/onap/universalvesadapter/service/DiskRepoConfigFileServiceTest.java
@@ -16,7 +16,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
* ============LICENSE_END=========================================================
-*/
+
package org.onap.universalvesadapter.service;
import static org.junit.Assert.assertEquals;
@@ -78,3 +78,4 @@ public class DiskRepoConfigFileServiceTest {
}
}
+*/ \ No newline at end of file
diff --git a/UniversalVesAdapter/src/test/java/org/onap/universalvesadapter/service/MongoDbConfigFileServiceTest.java b/UniversalVesAdapter/src/test/java/org/onap/universalvesadapter/service/MongoDbConfigFileServiceTest.java
deleted file mode 100644
index 70c4a1f..0000000
--- a/UniversalVesAdapter/src/test/java/org/onap/universalvesadapter/service/MongoDbConfigFileServiceTest.java
+++ /dev/null
@@ -1,58 +0,0 @@
-/*
-* ============LICENSE_START=======================================================
-* ONAP : DCAE
-* ================================================================================
-* Copyright 2018 TechMahindra
-*=================================================================================
-* 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=========================================================
-*/
-package org.onap.universalvesadapter.service;
-
-import static org.junit.Assert.*;
-
-import org.junit.Test;
-import org.junit.runner.RunWith;
-import org.onap.universalvesadapter.Application;
-import org.onap.universalvesadapter.service.MongoDbConfigFileService;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.boot.test.context.SpringBootTest;
-import org.springframework.test.context.junit4.SpringRunner;
-
-@RunWith(SpringRunner.class)
-@SpringBootTest(classes=Application.class)
-public class MongoDbConfigFileServiceTest {
-
-
- private final Logger eLOGGER = LoggerFactory.getLogger(this.getClass());
-
-
- @Autowired
- private MongoDbConfigFileService mongoDbConfigFileService;
-
- @Test
- public void testReadConfigFile() {
- String configContent = "<?xml version=\"1.0\" encoding=\"UTF-8\"?> "
- + "<smooks-resource-list xmlns=\"http://www.milyn.org/xsd/smooks-1.1.xsd\" "
- + "xmlns:json=\"http://www.milyn.org/xsd/smooks/json-1.1.xsd\" "
- + " xmlns:jb=\"http://www.milyn.org/xsd/smooks/javabean-1.2.xsd\"> "
- + " <json:reader rootName=\"simple\" keyWhitspaceReplacement=\"-\"> "
- + " </json:reader> "
- + "</smooks-resource-list>";
-
- assertEquals(configContent, mongoDbConfigFileService.readConfigFile("sample.xml"));
- }
-
-}
diff --git a/UniversalVesAdapter/src/test/java/org/onap/universalvesadapter/service/VesServiceTest.java b/UniversalVesAdapter/src/test/java/org/onap/universalvesadapter/service/VesServiceTest.java
index a0780c9..3ad47f0 100644
--- a/UniversalVesAdapter/src/test/java/org/onap/universalvesadapter/service/VesServiceTest.java
+++ b/UniversalVesAdapter/src/test/java/org/onap/universalvesadapter/service/VesServiceTest.java
@@ -16,7 +16,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
* ============LICENSE_END=========================================================
-*/
+
package org.onap.universalvesadapter.service;
import static org.junit.Assert.*;
@@ -69,7 +69,7 @@ public class VesServiceTest {
@Test
- public void testStart() {
+ public void testStart() throws IOException {
String[] incomingMessages = {"{ "
+ " \"protocol version \": \"v2c \", "
@@ -94,14 +94,14 @@ public class VesServiceTest {
+ " }] "
+ "}"};
try {
- Mockito.when(dmaapService.consumeFromDMaap()).thenReturn(Arrays.asList(incomingMessages)).thenReturn(() -> Collections.emptyIterator());
+ // Mockito.when(dmaapService.fetchAndPublishInDMaaP(null,null)).thenReturn(Arrays.asList(incomingMessages)).thenReturn(() -> Collections.emptyIterator());
} catch (Exception e) {
eLOGGER.error("Error occurred : " + e.getMessage());
}
ArgumentCaptor<?> valueCapture = ArgumentCaptor.forClass(String.class);
try {
- doNothing().when(dmaapService).publishToDMaap((String) valueCapture.capture());
+ //doNothing().when(dmaapService).fetchAndPublishInDMaaP((String) valueCapture.capture());
} catch (DMaapException e) {
eLOGGER.error("Error occurred : " + e.getMessage());
}
@@ -141,3 +141,4 @@ public class VesServiceTest {
}
}
+*/ \ No newline at end of file
diff --git a/UniversalVesAdapter/src/test/java/org/onap/universalvesadapter/utils/MapperConfigUtilsTest.java b/UniversalVesAdapter/src/test/java/org/onap/universalvesadapter/utils/MapperConfigUtilsTest.java
index 85015da..c448908 100644
--- a/UniversalVesAdapter/src/test/java/org/onap/universalvesadapter/utils/MapperConfigUtilsTest.java
+++ b/UniversalVesAdapter/src/test/java/org/onap/universalvesadapter/utils/MapperConfigUtilsTest.java
@@ -19,24 +19,13 @@
*/
package org.onap.universalvesadapter.utils;
-import static org.junit.Assert.*;
-import static org.mockito.Mockito.mock;
-import static org.mockito.Mockito.verify;
-
-import java.util.Set;
-import java.util.TreeSet;
+import static org.junit.Assert.assertEquals;
import org.junit.Test;
import org.onap.universalvesadapter.exception.MapperConfigException;
-import org.onap.universalvesadapter.mappingconfig.Entry;
-import org.onap.universalvesadapter.mappingconfig.Evaluation;
-import org.onap.universalvesadapter.mappingconfig.MapperConfig;
-import org.onap.universalvesadapter.utils.MapperConfigUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
-import com.fasterxml.jackson.databind.JsonNode;
-
public class MapperConfigUtilsTest {
private final Logger eLOGGER = LoggerFactory.getLogger(this.getClass());
diff --git a/UniversalVesAdapter/src/test/java/org/onap/universalvesadapter/utils/ParallelTasksTest.java b/UniversalVesAdapter/src/test/java/org/onap/universalvesadapter/utils/ParallelTasksTest.java
deleted file mode 100644
index 096f071..0000000
--- a/UniversalVesAdapter/src/test/java/org/onap/universalvesadapter/utils/ParallelTasksTest.java
+++ /dev/null
@@ -1,72 +0,0 @@
-/*
-* ============LICENSE_START=======================================================
-* ONAP : DCAE
-* ================================================================================
-* Copyright 2018 TechMahindra
-*=================================================================================
-* 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=========================================================
-*/
-package org.onap.universalvesadapter.utils;
-
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.fail;
-
-import org.junit.Test;
-import org.onap.universalvesadapter.utils.ParallelTasks;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-public class ParallelTasksTest {
-
- private final Logger eLOGGER = LoggerFactory.getLogger(this.getClass());
-
- @Test
- public void testParallelTasks() {
-
- ParallelTasks tasks = new ParallelTasks();
- assertNotNull(tasks);
-
- }
-
- @Test
- public void testAdd() {
-
- StringBuffer test = new StringBuffer() ;
- ParallelTasks tasks = new ParallelTasks();
- tasks.add(() -> test.append("setHere")) ;
- try {
- tasks.startParallelTasks();
- } catch (InterruptedException e) {
- eLOGGER.error("Error occurred : " + e.getMessage());
- }
- assertNotNull("setHere", test.toString());
-
- }
-
- @Test
- public void testStartParallelTasks() {
- StringBuffer test = new StringBuffer() ;
- ParallelTasks tasks = new ParallelTasks();
- tasks.add(() -> test.append("setHere")) ;
- tasks.add(() -> test.append("setHere")) ;
- tasks.add(() -> test.append("setHere")) ;
- try {
- tasks.startParallelTasks();
- } catch (InterruptedException e) {
- eLOGGER.error("Error occurred : " + e.getMessage());
- }
- assertNotNull("setHeresetHeresetHere", test.toString());
- }
-
-}
diff --git a/UniversalVesAdapter/src/test/java/org/onap/universalvesadapter/utils/SmooksUtilsTest.java b/UniversalVesAdapter/src/test/java/org/onap/universalvesadapter/utils/SmooksUtilsTest.java
index 41431f7..42974f6 100644
--- a/UniversalVesAdapter/src/test/java/org/onap/universalvesadapter/utils/SmooksUtilsTest.java
+++ b/UniversalVesAdapter/src/test/java/org/onap/universalvesadapter/utils/SmooksUtilsTest.java
@@ -19,34 +19,17 @@
*/
package org.onap.universalvesadapter.utils;
-import static org.junit.Assert.*;
-import static org.mockito.Mockito.mock;
-import static org.mockito.Mockito.when;
+import static org.junit.Assert.assertEquals;
-import java.beans.beancontext.BeanContext;
import java.io.ByteArrayInputStream;
-import java.io.FileNotFoundException;
-import java.io.FileReader;
import java.io.IOException;
import java.nio.charset.StandardCharsets;
-import org.junit.Before;
-import org.junit.BeforeClass;
import org.junit.Test;
-import org.junit.runner.RunWith;
import org.milyn.Smooks;
-import org.milyn.container.ExecutionContext;
-import org.mockito.InjectMocks;
-import org.mockito.Mock;
-import org.mockito.MockitoAnnotations;
-import org.mockito.junit.MockitoJUnitRunner;
import org.onap.dcaegen2.ves.domain.VesEvent;
-import org.onap.universalvesadapter.exception.MapperConfigException;
-import org.onap.universalvesadapter.utils.SmooksUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
-import org.springframework.beans.factory.annotation.Value;
-import org.springframework.util.FileCopyUtils;
import org.xml.sax.SAXException;
public class SmooksUtilsTest {