From 6af0ccf62efaa371ff337376115a34c8589ca38e Mon Sep 17 00:00:00 2001 From: Ravi Pendurty Date: Mon, 3 Feb 2020 14:24:15 +0100 Subject: Update mountpoint-registrar Include cleanup for test code Issue-ID: SDNC-1030 Signed-off-by: Ravi Pendurty Change-Id: I2ec89f4d74817b61aee888127bc61de6dd335cef --- sdnr/wt/mountpoint-registrar/feature/pom.xml | 4 +-- sdnr/wt/mountpoint-registrar/installer/pom.xml | 2 +- sdnr/wt/mountpoint-registrar/model/pom.xml | 2 +- sdnr/wt/mountpoint-registrar/pom.xml | 2 +- sdnr/wt/mountpoint-registrar/provider/pom.xml | 11 ++---- .../test/PNFRegistrationConfigTest.java | 11 ++++++ .../test/TestDMaaPVESMsgConsumerMain.java | 40 +++++++++++++--------- .../mountpointregistrar/test/TestFaultConfig.java | 11 ++++++ .../wt/mountpointregistrar/test/TestMapping.java | 4 +-- .../test/TestMountpointRegistrarImpl.java | 2 +- 10 files changed, 55 insertions(+), 34 deletions(-) (limited to 'sdnr/wt') diff --git a/sdnr/wt/mountpoint-registrar/feature/pom.xml b/sdnr/wt/mountpoint-registrar/feature/pom.xml index 5cefa7681..51af84fc8 100644 --- a/sdnr/wt/mountpoint-registrar/feature/pom.xml +++ b/sdnr/wt/mountpoint-registrar/feature/pom.xml @@ -28,7 +28,7 @@ org.onap.ccsdk.parent single-feature-parent 1.5.2-SNAPSHOT - + org.onap.ccsdk.features.sdnr.wt @@ -36,7 +36,7 @@ 0.7.1-SNAPSHOT feature - ccsdk-features-sdnr-wt :: ${project.artifactId} :: feature + ccsdk-features :: ${project.artifactId} :: feature diff --git a/sdnr/wt/mountpoint-registrar/installer/pom.xml b/sdnr/wt/mountpoint-registrar/installer/pom.xml index 1528893aa..96dc18839 100755 --- a/sdnr/wt/mountpoint-registrar/installer/pom.xml +++ b/sdnr/wt/mountpoint-registrar/installer/pom.xml @@ -36,7 +36,7 @@ 0.7.1-SNAPSHOT pom - ccsdk-features-sdnr-wt :: ${project.artifactId} + ccsdk-features :: ${project.artifactId} sdnr-wt-mountpoint-registrar diff --git a/sdnr/wt/mountpoint-registrar/model/pom.xml b/sdnr/wt/mountpoint-registrar/model/pom.xml index 55d95950c..53c0fe960 100644 --- a/sdnr/wt/mountpoint-registrar/model/pom.xml +++ b/sdnr/wt/mountpoint-registrar/model/pom.xml @@ -36,7 +36,7 @@ 0.7.1-SNAPSHOT bundle - ccsdk-features-sdnr-wt :: ${project.artifactId} + ccsdk-features :: ${project.artifactId} Apache License, Version 2.0 diff --git a/sdnr/wt/mountpoint-registrar/pom.xml b/sdnr/wt/mountpoint-registrar/pom.xml index cc5165687..27a667429 100755 --- a/sdnr/wt/mountpoint-registrar/pom.xml +++ b/sdnr/wt/mountpoint-registrar/pom.xml @@ -36,7 +36,7 @@ 0.7.1-SNAPSHOT pom - ccsdk-features-sdnr-wt :: ${project.artifactId} + ccsdk-features :: ${project.artifactId} model diff --git a/sdnr/wt/mountpoint-registrar/provider/pom.xml b/sdnr/wt/mountpoint-registrar/provider/pom.xml index 554ce3ac8..39f9eb536 100644 --- a/sdnr/wt/mountpoint-registrar/provider/pom.xml +++ b/sdnr/wt/mountpoint-registrar/provider/pom.xml @@ -17,7 +17,7 @@ org.onap.ccsdk.parent binding-parent 1.5.2-SNAPSHOT - + org.onap.ccsdk.features.sdnr.wt @@ -25,7 +25,7 @@ 0.7.1-SNAPSHOT bundle - ccsdk-features-sdnr-wt :: ${project.artifactId} + ccsdk-features :: ${project.artifactId} Apache License, Version 2.0 @@ -38,7 +38,6 @@ true yyyy-MM-dd HH:mm ${maven.build.timestamp} UTC - 6.4.3 @@ -107,12 +106,6 @@ ${project.version} provided - - org.onap.ccsdk.features.sdnr.wt - sdnr-wt-data-provider-database - ${project.version} - provided - 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 configMap = new HashMap(); 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 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 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(); } } -- cgit 1.2.3-korg