diff options
Diffstat (limited to 'sdnr/wt/mountpoint-registrar/provider/src/test/java')
5 files changed, 48 insertions, 20 deletions
diff --git a/sdnr/wt/mountpoint-registrar/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/mountpointregistrar/test/PNFRegistrationConfigTest.java b/sdnr/wt/mountpoint-registrar/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/mountpointregistrar/test/PNFRegistrationConfigTest.java index 2bc41490d..29da7ad85 100644 --- a/sdnr/wt/mountpoint-registrar/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/mountpointregistrar/test/PNFRegistrationConfigTest.java +++ b/sdnr/wt/mountpoint-registrar/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/mountpointregistrar/test/PNFRegistrationConfigTest.java @@ -24,6 +24,7 @@ import java.io.File; import java.io.IOException; import java.nio.charset.StandardCharsets; +import org.junit.After; import org.junit.Test; import org.onap.ccsdk.features.sdnr.wt.common.configuration.ConfigurationFileRepresentation; import org.onap.ccsdk.features.sdnr.wt.mountpointregistrar.impl.PNFRegistrationConfig; @@ -70,5 +71,15 @@ public class PNFRegistrationConfigTest { } } + + @After + public void cleanUp() { + File file = new File("test.properties"); + if (file.exists()) { + System.out.println("File exists, Deleting it"); + file.delete(); + } + + } } diff --git a/sdnr/wt/mountpoint-registrar/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/mountpointregistrar/test/TestDMaaPVESMsgConsumerMain.java b/sdnr/wt/mountpoint-registrar/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/mountpointregistrar/test/TestDMaaPVESMsgConsumerMain.java index 956477379..aefeddb0d 100644 --- a/sdnr/wt/mountpoint-registrar/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/mountpointregistrar/test/TestDMaaPVESMsgConsumerMain.java +++ b/sdnr/wt/mountpoint-registrar/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/mountpointregistrar/test/TestDMaaPVESMsgConsumerMain.java @@ -107,18 +107,18 @@ public class TestDMaaPVESMsgConsumerMain { Map<String, Configuration> configMap = new HashMap<String, Configuration>(); DMaaPVESMsgConsumerMain dmaapMain; -// @Before + // @Before public void preTest1() { try { - Files.asCharSink(new File(CONFIGURATIONFILE), StandardCharsets.UTF_8).write(TESTCONFIG_GENERAL); - ConfigurationFileRepresentation configFileRepresentation = new ConfigurationFileRepresentation(CONFIGURATIONFILE); + Files.asCharSink(new File(CONFIGURATIONFILE), StandardCharsets.UTF_8).write(TESTCONFIG_GENERAL); + ConfigurationFileRepresentation configFileRepresentation = new ConfigurationFileRepresentation(CONFIGURATIONFILE); - generalConfig = new GeneralConfig(configFileRepresentation); - PNFRegistrationConfig pnfRegConfig = new PNFRegistrationConfig(configFileRepresentation); - FaultConfig faultConfig = new FaultConfig(configFileRepresentation); + generalConfig = new GeneralConfig(configFileRepresentation); + PNFRegistrationConfig pnfRegConfig = new PNFRegistrationConfig(configFileRepresentation); + FaultConfig faultConfig = new FaultConfig(configFileRepresentation); - configMap.put("pnfRegistration", pnfRegConfig); - configMap.put("fault", faultConfig); + configMap.put("pnfRegistration", pnfRegConfig); + configMap.put("fault", faultConfig); } catch (Exception e) { System.out.println("Failed in preTest execution "+e.getMessage()); } @@ -126,15 +126,15 @@ public class TestDMaaPVESMsgConsumerMain { public void preTest2() { try { - Files.asCharSink(new File(CONFIGURATIONFILE), StandardCharsets.UTF_8).write(TESTCONFIG_GENERAL_INVALID); - ConfigurationFileRepresentation configFileRepresentation = new ConfigurationFileRepresentation(CONFIGURATIONFILE); + Files.asCharSink(new File(CONFIGURATIONFILE), StandardCharsets.UTF_8).write(TESTCONFIG_GENERAL_INVALID); + ConfigurationFileRepresentation configFileRepresentation = new ConfigurationFileRepresentation(CONFIGURATIONFILE); - generalConfig = new GeneralConfig(configFileRepresentation); - PNFRegistrationConfig pnfRegConfig = new PNFRegistrationConfig(configFileRepresentation); - FaultConfig faultConfig = new FaultConfig(configFileRepresentation); + generalConfig = new GeneralConfig(configFileRepresentation); + PNFRegistrationConfig pnfRegConfig = new PNFRegistrationConfig(configFileRepresentation); + FaultConfig faultConfig = new FaultConfig(configFileRepresentation); - configMap.put("pnfRegistration", pnfRegConfig); - configMap.put("fault", faultConfig); + configMap.put("pnfRegistration", pnfRegConfig); + configMap.put("fault", faultConfig); } catch (Exception e) { System.out.println("Failed in preTest execution "+e.getMessage()); } @@ -146,7 +146,7 @@ public class TestDMaaPVESMsgConsumerMain { assertNotNull(configMap); dmaapMain = new DMaaPVESMsgConsumerMain(configMap); } - + @Test public void testDMaaPVESMsgConsumerMainMapOfStringConfiguration1() { preTest2(); @@ -156,11 +156,17 @@ public class TestDMaaPVESMsgConsumerMain { @After public void postTest() { + File file = new File("test.properties"); + if (file.exists()) { + System.out.println("File exists, Deleting it"); + file.delete(); + } List<DMaaPVESMsgConsumer> consumers = DMaaPVESMsgConsumerMain.getConsumers(); for (DMaaPVESMsgConsumer consumer : consumers) { // stop all consumers consumer.stopConsumer(); } } - } + + diff --git a/sdnr/wt/mountpoint-registrar/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/mountpointregistrar/test/TestFaultConfig.java b/sdnr/wt/mountpoint-registrar/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/mountpointregistrar/test/TestFaultConfig.java index cbdb24a03..e8573e4e7 100644 --- a/sdnr/wt/mountpoint-registrar/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/mountpointregistrar/test/TestFaultConfig.java +++ b/sdnr/wt/mountpoint-registrar/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/mountpointregistrar/test/TestFaultConfig.java @@ -24,6 +24,7 @@ import java.io.File; import java.io.IOException; import java.nio.charset.StandardCharsets; +import org.junit.After; import org.junit.Test; import org.onap.ccsdk.features.sdnr.wt.common.configuration.ConfigurationFileRepresentation; import org.onap.ccsdk.features.sdnr.wt.mountpointregistrar.impl.FaultConfig; @@ -71,5 +72,15 @@ public class TestFaultConfig { // TODO Auto-generated catch block } } + + @After + public void cleanUp() { + File file = new File("test.properties"); + if (file.exists()) { + System.out.println("File exists, Deleting it"); + file.delete(); + } + + } } diff --git a/sdnr/wt/mountpoint-registrar/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/mountpointregistrar/test/TestMapping.java b/sdnr/wt/mountpoint-registrar/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/mountpointregistrar/test/TestMapping.java index 5c9fbe35d..9790a9ccc 100644 --- a/sdnr/wt/mountpoint-registrar/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/mountpointregistrar/test/TestMapping.java +++ b/sdnr/wt/mountpoint-registrar/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/mountpointregistrar/test/TestMapping.java @@ -18,16 +18,16 @@ package org.onap.ccsdk.features.sdnr.wt.mountpointregistrar.test; import com.fasterxml.jackson.core.JsonProcessingException; +import com.fasterxml.jackson.databind.ObjectMapper; import java.util.Optional; import org.junit.Test; -import org.onap.ccsdk.features.sdnr.wt.yangtools.YangToolsMapper; import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev130715.DateAndTime; import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev190801.SeverityType; import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.devicemanager.rev190109.PushFaultNotificationInputBuilder; public class TestMapping { - private final YangToolsMapper mapper = new YangToolsMapper(); + private final ObjectMapper mapper = new ObjectMapper(); private static Optional<SeverityType> getSeverity(String faultSeverity) { diff --git a/sdnr/wt/mountpoint-registrar/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/mountpointregistrar/test/TestMountpointRegistrarImpl.java b/sdnr/wt/mountpoint-registrar/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/mountpointregistrar/test/TestMountpointRegistrarImpl.java index 014a96f03..b048c201c 100644 --- a/sdnr/wt/mountpoint-registrar/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/mountpointregistrar/test/TestMountpointRegistrarImpl.java +++ b/sdnr/wt/mountpoint-registrar/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/mountpointregistrar/test/TestMountpointRegistrarImpl.java @@ -123,7 +123,7 @@ public class TestMountpointRegistrarImpl { Thread.sleep(millis); } catch (InterruptedException e) { LOG.warn(e.getMessage()); - Thread.interrupted(); + Thread.currentThread().interrupt(); } } |