diff options
author | highstreetherbert <herbert.eiselt@highstreet-technologies.com> | 2020-07-10 18:55:57 +0200 |
---|---|---|
committer | highstreetherbert <herbert.eiselt@highstreet-technologies.com> | 2020-07-11 20:24:17 +0200 |
commit | 5f5644378ff7510a6c7c1190e93e997abc8cbc25 (patch) | |
tree | b55f22f5ca5422d939f073cee832300df5ec7610 /sdnr/wt/mountpoint-registrar/provider/src/test | |
parent | 23c27ddcd79913d11eac16eb42c5a43899de97a1 (diff) |
Reformat sdnr mountpoint-registrar to ONAP code style
Reformat to ONAP code style
Issue-ID: SDNC-1281
Signed-off-by: highstreetherbert <herbert.eiselt@highstreet-technologies.com>
Change-Id: I284542212bc2b7c505bf939239f291526f2ae8ac
Signed-off-by: highstreetherbert <herbert.eiselt@highstreet-technologies.com>
Diffstat (limited to 'sdnr/wt/mountpoint-registrar/provider/src/test')
13 files changed, 744 insertions, 736 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 39488f887..9c41da9ea 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 @@ -1,4 +1,4 @@ -/******************************************************************************* +/* * ============LICENSE_START======================================================================== * ONAP : ccsdk feature sdnr wt * ================================================================================================= @@ -14,82 +14,81 @@ * or implied. See the License for the specific language governing permissions and limitations under * the License. * ============LICENSE_END========================================================================== - ******************************************************************************/ + */ package org.onap.ccsdk.features.sdnr.wt.mountpointregistrar.test; import static org.junit.Assert.assertEquals; - +import com.google.common.io.Files; 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; -import com.google.common.io.Files; - public class PNFRegistrationConfigTest { - private static final String TESTCONFIG_CONTENT="[pnfRegistration]\n" + - "pnfRegConsumerClass=org.onap.ccsdk.features.sdnr.wt.mountpointregistrar.impl.DMaaPPNFRegVESMsgConsumer\n" + - "TransportType=HTTPNOAUTH\n" + - "Protocol=http\n" + - "username=username\n" + - "password=password\n" + - "host=onap-dmap:3904\n" + - "topic=unauthenticated.VES_PNFREG_OUTPUT\n" + - "contenttype=application/json\n" + - "group=myG\n" + - "id=C1\n" + - "timeout=20000\n" + - "limit=10000\n" + - "fetchPause=5000\n" + - "jersey.config.client.readTimeout=25000\n" + - "jersey.config.client.connectTimeout=25000\n" + - ""; + // @formatter:off + private static final String TESTCONFIG_CONTENT = "[pnfRegistration]\n" + + "pnfRegConsumerClass=org.onap.ccsdk.features.sdnr.wt.mountpointregistrar.impl.DMaaPPNFRegVESMsgConsumer\n" + + "TransportType=HTTPNOAUTH\n" + + "Protocol=http\n" + + "username=username\n" + + "password=password\n" + + "host=onap-dmap:3904\n" + + "topic=unauthenticated.VES_PNFREG_OUTPUT\n" + + "contenttype=application/json\n" + + "group=myG\n" + + "id=C1\n" + + "timeout=20000\n" + + "limit=10000\n" + + "fetchPause=5000\n" + + "jersey.config.client.readTimeout=25000\n" + + "jersey.config.client.connectTimeout=25000\n" + + ""; + // @formatter:on + private ConfigurationFileRepresentation cfg; + + @Test + public void test() { + try { + Files.asCharSink(new File("test.properties"), StandardCharsets.UTF_8).write(TESTCONFIG_CONTENT); + cfg = new ConfigurationFileRepresentation("test.properties"); + PNFRegistrationConfig pnfCfg = new PNFRegistrationConfig(cfg); + assertEquals("pnfRegistration", pnfCfg.getSectionName()); + assertEquals("org.onap.ccsdk.features.sdnr.wt.mountpointregistrar.impl.DMaaPPNFRegVESMsgConsumer", + pnfCfg.getConsumerClass()); + assertEquals("HTTPNOAUTH", pnfCfg.getTransportType()); + assertEquals("onap-dmap:3904", pnfCfg.getHostPort()); + assertEquals("unauthenticated.VES_PNFREG_OUTPUT", pnfCfg.getTopic()); + assertEquals("application/json", pnfCfg.getContenttype()); + assertEquals("myG", pnfCfg.getConsumerGroup()); + assertEquals("C1", pnfCfg.getConsumerId()); + assertEquals("20000", pnfCfg.getTimeout()); + assertEquals("10000", pnfCfg.getLimit()); + assertEquals("5000", pnfCfg.getFetchPause()); + assertEquals("http", pnfCfg.getProtocol()); + assertEquals("username", pnfCfg.getUsername()); + assertEquals("password", pnfCfg.getPassword()); + assertEquals("25000", pnfCfg.getClientReadTimeout()); + assertEquals("25000", pnfCfg.getClientConnectTimeout()); - private ConfigurationFileRepresentation cfg; + } catch (IOException e) { + // TODO Auto-generated catch block + } - @Test - public void test() { - try { - Files.asCharSink(new File("test.properties"), StandardCharsets.UTF_8).write(TESTCONFIG_CONTENT); - cfg = new ConfigurationFileRepresentation("test.properties"); - PNFRegistrationConfig pnfCfg = new PNFRegistrationConfig(cfg); - assertEquals("pnfRegistration", pnfCfg.getSectionName()); - assertEquals("org.onap.ccsdk.features.sdnr.wt.mountpointregistrar.impl.DMaaPPNFRegVESMsgConsumer", pnfCfg.getConsumerClass()); - assertEquals("HTTPNOAUTH", pnfCfg.getTransportType()); - assertEquals("onap-dmap:3904", pnfCfg.getHostPort()); - assertEquals("unauthenticated.VES_PNFREG_OUTPUT", pnfCfg.getTopic()); - assertEquals("application/json", pnfCfg.getContenttype()); - assertEquals("myG", pnfCfg.getConsumerGroup()); - assertEquals("C1", pnfCfg.getConsumerId()); - assertEquals("20000", pnfCfg.getTimeout()); - assertEquals("10000", pnfCfg.getLimit()); - assertEquals("5000", pnfCfg.getFetchPause()); - assertEquals("http", pnfCfg.getProtocol()); - assertEquals("username", pnfCfg.getUsername()); - assertEquals("password", pnfCfg.getPassword()); - assertEquals("25000", pnfCfg.getClientReadTimeout()); - assertEquals("25000", pnfCfg.getClientConnectTimeout()); + } - } catch (IOException e) { - // 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(); + } - } - - @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/TestDMaaPFaultVESMsgConsumer.java b/sdnr/wt/mountpoint-registrar/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/mountpointregistrar/test/TestDMaaPFaultVESMsgConsumer.java index b5544dfa4..8929612ad 100644 --- a/sdnr/wt/mountpoint-registrar/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/mountpointregistrar/test/TestDMaaPFaultVESMsgConsumer.java +++ b/sdnr/wt/mountpoint-registrar/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/mountpointregistrar/test/TestDMaaPFaultVESMsgConsumer.java @@ -1,4 +1,4 @@ -/******************************************************************************* +/* * ============LICENSE_START======================================================================== * ONAP : ccsdk feature sdnr wt * ================================================================================================= @@ -14,7 +14,7 @@ * or implied. See the License for the specific language governing permissions and limitations under * the License. * ============LICENSE_END========================================================================== - ******************************************************************************/ + */ package org.onap.ccsdk.features.sdnr.wt.mountpointregistrar.test; @@ -24,145 +24,148 @@ import org.onap.ccsdk.features.sdnr.wt.mountpointregistrar.impl.FaultNotificatio public class TestDMaaPFaultVESMsgConsumer extends DMaaPFaultVESMsgConsumer { - private static final String DEFAULT_SDNRUSER = "admin"; - private static final String DEFAULT_SDNRPASSWD = "admin"; - private static final String DEFAULT_SDNRBASEURL = "http://localhost:8181"; + private static final String DEFAULT_SDNRUSER = "admin"; + private static final String DEFAULT_SDNRPASSWD = "admin"; + private static final String DEFAULT_SDNRBASEURL = "http://localhost:8181"; - private static final String faultVESMsg = "" - + "{\"event\":" - + " {\"commonEventHeader\":" - + " { \"domain\":\"fault\"," - + " \"eventId\":\"1e9a28bcd119_50007_2019-11-20T14:59:47.3Z\"," - + " \"eventName\":\"fault_O_RAN_COMPONENT_Alarms\"," - + " \"eventType\":\"O_RAN_COMPONENT_Alarms\"," - + " \"sequence\":1," - + " \"priority\":\"Low\"," - + " \"reportingEntityId\":\"\"," - + " \"reportingEntityName\":\"1e9a28bcd119_50007\"," - + " \"sourceId\":\"\"," - + " \"sourceName\":\"1e9a28bcd119_50007\"," - + " \"startEpochMicrosec\":94801033822670," - + " \"lastEpochMicrosec\":94801033822670," - + " \"nfNamingCode\":\"sdn controller\"," - + " \"nfVendorName\":\"sdn\"," - + " \"timeZoneOffset\":\"+00:00\"," - + " \"version\":\"4.0.1\"," - + " \"vesEventListenerVersion\":\"7.0.1\"" - + " }," - + " \"faultFields\":" - + " {" - + " \"faultFieldsVersion\":\"4.0\"," - + " \"alarmCondition\":\"8\"," - + " \"alarmInterfaceA\":\"dkom32\"," - + " \"eventSourceType\":\"O_RAN_COMPONENT\"," - + " \"specificProblem\":\"dsonj32 don32 mdson32pk654\"," - + " \"eventSeverity\":\"@eventSeverity@\"," - + " \"vfStatus\":\"Active\"," - + " \"alarmAdditionalInformation\":" - + " {" - + " \"eventTime\":\"2019-11-20T14:59:47.3Z\"," - + " \"equipType\":\"O-RAN-sim\"," - + " \"vendor\":\"Melacon\"," - + " \"model\":\"Simulated Device\"" - + " }" - + " }" - + " }" - + "}"; + // @formatter:off + private static final String faultVESMsg = "" + + "{\"event\":" + " {\"commonEventHeader\":" + + " { \"domain\":\"fault\"," + + " \"eventId\":\"1e9a28bcd119_50007_2019-11-20T14:59:47.3Z\"," + + " \"eventName\":\"fault_O_RAN_COMPONENT_Alarms\"," + + " \"eventType\":\"O_RAN_COMPONENT_Alarms\"," + + " \"sequence\":1," + + " \"priority\":\"Low\"," + + " \"reportingEntityId\":\"\"," + + " \"reportingEntityName\":\"1e9a28bcd119_50007\"," + + " \"sourceId\":\"\"," + + " \"sourceName\":\"1e9a28bcd119_50007\"," + + " \"startEpochMicrosec\":94801033822670," + + " \"lastEpochMicrosec\":94801033822670," + + " \"nfNamingCode\":\"sdn controller\"," + + " \"nfVendorName\":\"sdn\"," + + " \"timeZoneOffset\":\"+00:00\"," + + " \"version\":\"4.0.1\"," + + " \"vesEventListenerVersion\":\"7.0.1\"" + + " }," + + " \"faultFields\":" + + " {" + + " \"faultFieldsVersion\":\"4.0\"," + + " \"alarmCondition\":\"8\"," + + " \"alarmInterfaceA\":\"dkom32\"," + + " \"eventSourceType\":\"O_RAN_COMPONENT\"," + + " \"specificProblem\":\"dsonj32 don32 mdson32pk654\"," + + " \"eventSeverity\":\"@eventSeverity@\"," + + " \"vfStatus\":\"Active\"," + + " \"alarmAdditionalInformation\":" + + " {" + + " \"eventTime\":\"2019-11-20T14:59:47.3Z\"," + + " \"equipType\":\"O-RAN-sim\"," + + " \"vendor\":\"Melacon\"," + + " \"model\":\"Simulated Device\"" + + " }" + + " }" + + " }" + + "}"; + // @formatter:on + // @formatter:off + private static final String faultVESMsg_Incomplete = "" + + "{\"event\":" + + " {\"commonEventHeader\":" + + " { \"domain\":\"fault\"," + + " \"eventId\":\"1e9a28bcd119_50007_2019-11-20T14:59:47.3Z\"," + + " \"eventName\":\"fault_O_RAN_COMPONENT_Alarms\"," + + " \"eventType\":\"O_RAN_COMPONENT_Alarms\"," + + " \"sequence\":1," + + " \"priority\":\"Low\"," + + " \"reportingEntityId\":\"\"," + + " \"reportingEntityName\":\"1e9a28bcd119_50007\"," + + " \"sourceId\":\"\"," + + " \"sourceName\":\"1e9a28bcd119_50007\"," + + " \"startEpochMicrosec\":94801033822670," + + " \"lastEpochMicrosec\":94801033822670," + + " \"nfNamingCode\":\"sdn controller\"," + + " \"nfVendorName\":\"sdn\"," + + " \"timeZoneOffset\":\"+00:00\"," + + " \"version\":\"4.0.1\"," + + " \"vesEventListenerVersion\":\"7.0.1\"," + + " }," + + " \"faultFields\":" + + " {" + + " \"faultFieldsVersion\":\"4.0\"," + + " \"alarmCondition\":\"8\"," + + " \"alarmInterfaceA\":\"dkom32\"," + + " \"eventSourceType\":\"O_RAN_COMPONENT\"," + + " \"specificProblem\":\"dsonj32 don32 mdson32pk654\"," + + " \"eventSeverity\":\"CRITICAL\"," + + " \"vfStatus\":\"Active\"," + + " \"alarmAdditionalInformation\":" + + " {" + + " \"eventTime\":\"2019-11-20T14:59:47.3Z\"," + + " \"equipType\":\"O-RAN-sim\"," + + " \"vendor\":\"Melacon\"," + + " \"model\":\"Simulated Device\"" + + " }" + + " }" + + " }" + + "}"; + // @formatter:on - private static final String faultVESMsg_Incomplete = "" - + "{\"event\":" - + " {\"commonEventHeader\":" - + " { \"domain\":\"fault\"," - + " \"eventId\":\"1e9a28bcd119_50007_2019-11-20T14:59:47.3Z\"," - + " \"eventName\":\"fault_O_RAN_COMPONENT_Alarms\"," - + " \"eventType\":\"O_RAN_COMPONENT_Alarms\"," - + " \"sequence\":1," - + " \"priority\":\"Low\"," - + " \"reportingEntityId\":\"\"," - + " \"reportingEntityName\":\"1e9a28bcd119_50007\"," - + " \"sourceId\":\"\"," - + " \"sourceName\":\"1e9a28bcd119_50007\"," - + " \"startEpochMicrosec\":94801033822670," - + " \"lastEpochMicrosec\":94801033822670," - + " \"nfNamingCode\":\"sdn controller\"," - + " \"nfVendorName\":\"sdn\"," - + " \"timeZoneOffset\":\"+00:00\"," - + " \"version\":\"4.0.1\"," - + " \"vesEventListenerVersion\":\"7.0.1\"," - + " }," - + " \"faultFields\":" - + " {" - + " \"faultFieldsVersion\":\"4.0\"," - + " \"alarmCondition\":\"8\"," - + " \"alarmInterfaceA\":\"dkom32\"," - + " \"eventSourceType\":\"O_RAN_COMPONENT\"," - + " \"specificProblem\":\"dsonj32 don32 mdson32pk654\"," - + " \"eventSeverity\":\"CRITICAL\"," - + " \"vfStatus\":\"Active\"," - + " \"alarmAdditionalInformation\":" - + " {" - + " \"eventTime\":\"2019-11-20T14:59:47.3Z\"," - + " \"equipType\":\"O-RAN-sim\"," - + " \"vendor\":\"Melacon\"," - + " \"model\":\"Simulated Device\"" - + " }" - + " }" - + " }" - + "}"; - @Test - public void test() { - DMaaPFaultVESMsgConsumer faultMsgConsumer = new TestDMaaPFaultVESMsgConsumer(); - try { + @Test + public void test() { + DMaaPFaultVESMsgConsumer faultMsgConsumer = new TestDMaaPFaultVESMsgConsumer(); + try { - faultMsgConsumer.processMsg(faultVESMsg.replace("@eventSeverity@", "CRITICAL")); - faultMsgConsumer.processMsg(faultVESMsg.replace("@eventSeverity@", "Major")); - faultMsgConsumer.processMsg(faultVESMsg.replace("@eventSeverity@", "minor")); - faultMsgConsumer.processMsg(faultVESMsg.replace("@eventSeverity@", "NonAlarmed")); - faultMsgConsumer.processMsg(faultVESMsg.replace("@eventSeverity@", "warning")); - faultMsgConsumer.processMsg(faultVESMsg.replace("@eventSeverity@", "Unknown")); - faultMsgConsumer.processMsg(faultVESMsg_Incomplete); - } catch (Exception e) { - e.printStackTrace(); - System.out.println("Exception while processing Fault Message - "+e.getMessage()); - } - } + faultMsgConsumer.processMsg(faultVESMsg.replace("@eventSeverity@", "CRITICAL")); + faultMsgConsumer.processMsg(faultVESMsg.replace("@eventSeverity@", "Major")); + faultMsgConsumer.processMsg(faultVESMsg.replace("@eventSeverity@", "minor")); + faultMsgConsumer.processMsg(faultVESMsg.replace("@eventSeverity@", "NonAlarmed")); + faultMsgConsumer.processMsg(faultVESMsg.replace("@eventSeverity@", "warning")); + faultMsgConsumer.processMsg(faultVESMsg.replace("@eventSeverity@", "Unknown")); + faultMsgConsumer.processMsg(faultVESMsg_Incomplete); + } catch (Exception e) { + e.printStackTrace(); + System.out.println("Exception while processing Fault Message - " + e.getMessage()); + } + } - @Override - public FaultNotificationClient getFaultNotificationClient(String baseUrl) { - return new TestFaultNotificationClient(); - } + @Override + public FaultNotificationClient getFaultNotificationClient(String baseUrl) { + return new TestFaultNotificationClient(); + } - @Override - public String getSDNRUser() { - return DEFAULT_SDNRUSER; - } + @Override + public String getSDNRUser() { + return DEFAULT_SDNRUSER; + } - @Override - public String getSDNRPasswd() { - return DEFAULT_SDNRPASSWD; - } + @Override + public String getSDNRPasswd() { + return DEFAULT_SDNRPASSWD; + } - @Override - public String getBaseUrl() { - return DEFAULT_SDNRBASEURL; - } + @Override + public String getBaseUrl() { + return DEFAULT_SDNRBASEURL; + } - @Test - public void Test1() { - TestGeneralConfig cfgTest = new TestGeneralConfig(); - cfgTest.test(); - DMaaPFaultVESMsgConsumer faultConsumer = new DMaaPFaultVESMsgConsumer(); - System.out.println(faultConsumer.getBaseUrl()); - System.out.println(faultConsumer.getSDNRUser()); - System.out.println(faultConsumer.getSDNRPasswd()); - } + @Test + public void Test1() { + TestGeneralConfig cfgTest = new TestGeneralConfig(); + cfgTest.test(); + DMaaPFaultVESMsgConsumer faultConsumer = new DMaaPFaultVESMsgConsumer(); + System.out.println(faultConsumer.getBaseUrl()); + System.out.println(faultConsumer.getSDNRUser()); + System.out.println(faultConsumer.getSDNRPasswd()); + } - /* - * @Test public void Test2() { TestGeneralConfig cfgTest = new - * TestGeneralConfig(); cfgTest.test1(); //cfgTest.test(); - * DMaaPFaultVESMsgConsumer faultConsumer = new DMaaPFaultVESMsgConsumer(); - * System.out.println(faultConsumer.getBaseUrl()); - * System.out.println(faultConsumer.getSDNRUser()); - * System.out.println(faultConsumer.getSDNRPasswd()); } - */ + /* + * @Test public void Test2() { TestGeneralConfig cfgTest = new + * TestGeneralConfig(); cfgTest.test1(); //cfgTest.test(); + * DMaaPFaultVESMsgConsumer faultConsumer = new DMaaPFaultVESMsgConsumer(); + * System.out.println(faultConsumer.getBaseUrl()); + * System.out.println(faultConsumer.getSDNRUser()); + * System.out.println(faultConsumer.getSDNRPasswd()); } + */ } diff --git a/sdnr/wt/mountpoint-registrar/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/mountpointregistrar/test/TestDMaaPPNFRegVESMsgConsumer.java b/sdnr/wt/mountpoint-registrar/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/mountpointregistrar/test/TestDMaaPPNFRegVESMsgConsumer.java index eda372d77..169f734e8 100644 --- a/sdnr/wt/mountpoint-registrar/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/mountpointregistrar/test/TestDMaaPPNFRegVESMsgConsumer.java +++ b/sdnr/wt/mountpoint-registrar/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/mountpointregistrar/test/TestDMaaPPNFRegVESMsgConsumer.java @@ -1,4 +1,4 @@ -/******************************************************************************* +/* * ============LICENSE_START======================================================================== * ONAP : ccsdk feature sdnr wt * ================================================================================================= @@ -14,7 +14,7 @@ * or implied. See the License for the specific language governing permissions and limitations under * the License. * ============LICENSE_END========================================================================== - ******************************************************************************/ + */ package org.onap.ccsdk.features.sdnr.wt.mountpointregistrar.test; @@ -24,253 +24,255 @@ import org.onap.ccsdk.features.sdnr.wt.mountpointregistrar.impl.PNFMountPointCli public class TestDMaaPPNFRegVESMsgConsumer extends DMaaPPNFRegVESMsgConsumer { - private static final String DEFAULT_SDNRUSER = "admin"; - private static final String DEFAULT_SDNRPASSWD = "admin"; - private static final String DEFAULT_SDNRBASEURL = "http://localhost:8181"; + private static final String DEFAULT_SDNRUSER = "admin"; + private static final String DEFAULT_SDNRPASSWD = "admin"; + private static final String DEFAULT_SDNRBASEURL = "http://localhost:8181"; - private static final String pnfRegMsg_TLS = "{\n" + - " \"event\": {\n" + - " \"commonEventHeader\": {\n" + - " \"domain\": \"pnfRegistration\",\n" + - " \"eventId\": \"NSHMRIACQ01M01123401_1234 BestInClass\",\n" + - " \"eventName\": \"pnfRegistration_EventType5G\",\n" + - " \"eventType\": \"EventType5G\",\n" + - " \"sequence\": 0,\n" + - " \"priority\": \"Low\",\n" + - " \"reportingEntityId\": \"\",\n" + - " \"reportingEntityName\": \"pendurty-virtual-machine\",\n" + - " \"sourceId\": \"\",\n" + - " \"sourceName\": \"NSHMRIACQ01M01123401\",\n" + - " \"startEpochMicrosec\": 1571300004203,\n" + - " \"lastEpochMicrosec\": 1571300004203,\n" + - " \"nfNamingCode\": \"1234\",\n" + - " \"nfVendorName\": \"VENDORA\",\n" + - " \"timeZoneOffset\": \"+00:00\",\n" + - " \"version\": \"4.0.1\",\n" + - " \"vesEventListenerVersion\":\"7.0.1\"\n" + - " },\n" + - " \"pnfRegistrationFields\": {\n" + - " \"pnfRegistrationFieldsVersion\": \"2.0\",\n" + - " \"additionalFields\": \n" + - " { \n" + - " \"protocol\":\"TLS\",\n"+ - " \"keyId\":\"netconf\",\n"+ - " \"oamPort\":\"50000\",\n"+ - " \"betweenAttemptsTimeout\":\"2000\",\n" + - " \"keepaliveDelay\":\"120\",\n" + - " \"sleep-factor\":\"1.5\",\n" + - " \"reconnectOnChangedSchema\":\"false\",\n" + - " \"connectionTimeout\":\"20000\",\n" + - " \"maxConnectionAttempts\":\"100\",\n" + - " \"username\":\"netconf\",\n" + - " \"tcpOnly\":\"false\"\n" + - " },\n" + - " \"lastServiceDate\":\"2019-08-16\",\n" + - " \"macAddress\":\"02:42:f7:d4:62:ce\",\n" + - " \"manufactureDate\":\"2019-08-16\",\n" + - " \"modelNumbsdnrer\": \"1234 BestInClass\",\n" + - " \"oamV4IpAddress\": \"10.10.10.11\",\n" + - " \"oamPort\":\"17380\",\n" + - " \"oamV6IpAddress\": \"0:0:0:0:0:ffff:a0a:011\",\n" + - " \"serialNumber\": \"VENDORA-1234-10.10.10.11-1234 BestInClass\",\n" + - " \"softwareVersion\": \"2.3.5\",\n" + - " \"unitFamily\": \"VENDORA-1234\",\n" + - " \"unitType\": \"1234\",\n" + - " \"vendorName\": \"VENDORA\"\n" + - " }\n" + - " }\n" + - "}\n" + - ""; + // @formatter:off + private static final String pnfRegMsg_TLS = "{\n" + + " \"event\": {\n" + + " \"commonEventHeader\": {\n" + + " \"domain\": \"pnfRegistration\",\n" + + " \"eventId\": \"NSHMRIACQ01M01123401_1234 BestInClass\",\n" + + " \"eventName\": \"pnfRegistration_EventType5G\",\n" + + " \"eventType\": \"EventType5G\",\n" + + " \"sequence\": 0,\n" + + " \"priority\": \"Low\",\n" + + " \"reportingEntityId\": \"\",\n" + + " \"reportingEntityName\": \"pendurty-virtual-machine\",\n" + + " \"sourceId\": \"\",\n" + + " \"sourceName\": \"NSHMRIACQ01M01123401\",\n" + + " \"startEpochMicrosec\": 1571300004203,\n" + + " \"lastEpochMicrosec\": 1571300004203,\n" + + " \"nfNamingCode\": \"1234\",\n" + + " \"nfVendorName\": \"VENDORA\",\n" + + " \"timeZoneOffset\": \"+00:00\",\n" + + " \"version\": \"4.0.1\",\n" + + " \"vesEventListenerVersion\":\"7.0.1\"\n" + + " },\n" + + " \"pnfRegistrationFields\": {\n" + + " \"pnfRegistrationFieldsVersion\": \"2.0\",\n" + + " \"additionalFields\": \n" + + " { \n" + + " \"protocol\":\"TLS\",\n" + + " \"keyId\":\"netconf\",\n" + + " \"oamPort\":\"50000\",\n" + + " \"betweenAttemptsTimeout\":\"2000\",\n" + + " \"keepaliveDelay\":\"120\",\n" + + " \"sleep-factor\":\"1.5\",\n" + + " \"reconnectOnChangedSchema\":\"false\",\n" + + " \"connectionTimeout\":\"20000\",\n" + + " \"maxConnectionAttempts\":\"100\",\n" + + " \"username\":\"netconf\",\n" + + " \"tcpOnly\":\"false\"\n" + + " },\n" + + " \"lastServiceDate\":\"2019-08-16\",\n" + + " \"macAddress\":\"02:42:f7:d4:62:ce\",\n" + + " \"manufactureDate\":\"2019-08-16\",\n" + + " \"modelNumbsdnrer\": \"1234 BestInClass\",\n" + + " \"oamV4IpAddress\": \"10.10.10.11\",\n" + + " \"oamPort\":\"17380\",\n" + + " \"oamV6IpAddress\": \"0:0:0:0:0:ffff:a0a:011\",\n" + + " \"serialNumber\": \"VENDORA-1234-10.10.10.11-1234 BestInClass\",\n" + + " \"softwareVersion\": \"2.3.5\",\n" + + " \"unitFamily\": \"VENDORA-1234\",\n" + + " \"unitType\": \"1234\",\n" + + " \"vendorName\": \"VENDORA\"\n" + + " }\n" + + " }\n" + + "}\n" + + ""; - private static final String pnfRegMsg_SSH = "{\n" + - " \"event\": {\n" + - " \"commonEventHeader\": {\n" + - " \"domain\": \"pnfRegistration\",\n" + - " \"eventId\": \"NSHMRIACQ01M01123401_1234 BestInClass\",\n" + - " \"eventName\": \"pnfRegistration_EventType5G\",\n" + - " \"eventType\": \"EventType5G\",\n" + - " \"sequence\": 0,\n" + - " \"priority\": \"Low\",\n" + - " \"reportingEntityId\": \"\",\n" + - " \"reportingEntityName\": \"pendurty-virtual-machine\",\n" + - " \"sourceId\": \"\",\n" + - " \"sourceName\": \"NSHMRIACQ01M01123401\",\n" + - " \"startEpochMicrosec\": 1571300004203,\n" + - " \"lastEpochMicrosec\": 1571300004203,\n" + - " \"nfNamingCode\": \"1234\",\n" + - " \"nfVendorName\": \"VENDORA\",\n" + - " \"timeZoneOffset\": \"+00:00\",\n" + - " \"version\": \"4.0.1\",\n" + - " \"vesEventListenerVersion\":\"7.0.1\"\n" + - " },\n" + - " \"pnfRegistrationFields\": {\n" + - " \"pnfRegistrationFieldsVersion\": \"2.0\",\n" + - " \"additionalFields\": \n" + - " { \n" + - " \"protocol\":\"SSH\",\n"+ - " \"password\":\"netconf\",\n"+ - " \"oamPort\":\"50000\",\n"+ - " \"betweenAttemptsTimeout\":\"2000\",\n" + - " \"keepaliveDelay\":\"120\",\n" + - " \"sleep-factor\":\"1.5\",\n" + - " \"reconnectOnChangedSchema\":\"false\",\n" + - " \"connectionTimeout\":\"20000\",\n" + - " \"maxConnectionAttempts\":\"100\",\n" + - " \"username\":\"netconf\",\n" + - " \"tcpOnly\":\"false\"\n" + - " },\n" + - " \"lastServiceDate\":\"2019-08-16\",\n" + - " \"macAddress\":\"02:42:f7:d4:62:ce\",\n" + - " \"manufactureDate\":\"2019-08-16\",\n" + - " \"modelNumbsdnrer\": \"1234 BestInClass\",\n" + - " \"oamV4IpAddress\": \"10.10.10.11\",\n" + - " \"oamPort\":\"17380\",\n" + - " \"oamV6IpAddress\": \"0:0:0:0:0:ffff:a0a:011\",\n" + - " \"serialNumber\": \"VENDORA-1234-10.10.10.11-1234 BestInClass\",\n" + - " \"softwareVersion\": \"2.3.5\",\n" + - " \"unitFamily\": \"VENDORA-1234\",\n" + - " \"unitType\": \"1234\",\n" + - " \"vendorName\": \"VENDORA\"\n" + - " }\n" + - " }\n" + - "}\n" + - ""; + private static final String pnfRegMsg_SSH = "{\n" + + " \"event\": {\n" + + " \"commonEventHeader\": {\n" + + " \"domain\": \"pnfRegistration\",\n" + + " \"eventId\": \"NSHMRIACQ01M01123401_1234 BestInClass\",\n" + + " \"eventName\": \"pnfRegistration_EventType5G\",\n" + + " \"eventType\": \"EventType5G\",\n" + + " \"sequence\": 0,\n" + + " \"priority\": \"Low\",\n" + + " \"reportingEntityId\": \"\",\n" + + " \"reportingEntityName\": \"pendurty-virtual-machine\",\n" + + " \"sourceId\": \"\",\n" + + " \"sourceName\": \"NSHMRIACQ01M01123401\",\n" + + " \"startEpochMicrosec\": 1571300004203,\n" + + " \"lastEpochMicrosec\": 1571300004203,\n" + + " \"nfNamingCode\": \"1234\",\n" + + " \"nfVendorName\": \"VENDORA\",\n" + + " \"timeZoneOffset\": \"+00:00\",\n" + + " \"version\": \"4.0.1\",\n" + + " \"vesEventListenerVersion\":\"7.0.1\"\n" + + " },\n" + + " \"pnfRegistrationFields\": {\n" + + " \"pnfRegistrationFieldsVersion\": \"2.0\",\n" + + " \"additionalFields\": \n" + + " { \n" + + " \"protocol\":\"SSH\",\n" + + " \"password\":\"netconf\",\n" + + " \"oamPort\":\"50000\",\n" + + " \"betweenAttemptsTimeout\":\"2000\",\n" + + " \"keepaliveDelay\":\"120\",\n" + + " \"sleep-factor\":\"1.5\",\n" + + " \"reconnectOnChangedSchema\":\"false\",\n" + + " \"connectionTimeout\":\"20000\",\n" + + " \"maxConnectionAttempts\":\"100\",\n" + + " \"username\":\"netconf\",\n" + + " \"tcpOnly\":\"false\"\n" + + " },\n" + + " \"lastServiceDate\":\"2019-08-16\",\n" + + " \"macAddress\":\"02:42:f7:d4:62:ce\",\n" + + " \"manufactureDate\":\"2019-08-16\",\n" + + " \"modelNumbsdnrer\": \"1234 BestInClass\",\n" + + " \"oamV4IpAddress\": \"10.10.10.11\",\n" + + " \"oamPort\":\"17380\",\n" + + " \"oamV6IpAddress\": \"0:0:0:0:0:ffff:a0a:011\",\n" + + " \"serialNumber\": \"VENDORA-1234-10.10.10.11-1234 BestInClass\",\n" + + " \"softwareVersion\": \"2.3.5\",\n" + + " \"unitFamily\": \"VENDORA-1234\",\n" + + " \"unitType\": \"1234\",\n" + + " \"vendorName\": \"VENDORA\"\n" + + " }\n" + + " }\n" + + "}\n" + + ""; - private static final String pnfRegMsg_OTHER = "{\n" + - " \"event\": {\n" + - " \"commonEventHeader\": {\n" + - " \"domain\": \"pnfRegistration\",\n" + - " \"eventId\": \"NSHMRIACQ01M01123401_1234 BestInClass\",\n" + - " \"eventName\": \"pnfRegistration_EventType5G\",\n" + - " \"eventType\": \"EventType5G\",\n" + - " \"sequence\": 0,\n" + - " \"priority\": \"Low\",\n" + - " \"reportingEntityId\": \"\",\n" + - " \"reportingEntityName\": \"pendurty-virtual-machine\",\n" + - " \"sourceId\": \"\",\n" + - " \"sourceName\": \"NSHMRIACQ01M01123401\",\n" + - " \"startEpochMicrosec\": 1571300004203,\n" + - " \"lastEpochMicrosec\": 1571300004203,\n" + - " \"nfNamingCode\": \"1234\",\n" + - " \"nfVendorName\": \"VENDORA\",\n" + - " \"timeZoneOffset\": \"+00:00\",\n" + - " \"version\": \"4.0.1\",\n" + - " \"vesEventListenerVersion\":\"7.0.1\"\n" + - " },\n" + - " \"pnfRegistrationFields\": {\n" + - " \"pnfRegistrationFieldsVersion\": \"2.0\",\n" + - " \"additionalFields\": \n" + - " { \n" + - " \"protocol\":\"OTHER\",\n"+ - " \"password\":\"netconf\",\n"+ - " \"oamPort\":\"50000\",\n"+ - " \"betweenAttemptsTimeout\":\"2000\",\n" + - " \"keepaliveDelay\":\"120\",\n" + - " \"sleep-factor\":\"1.5\",\n" + - " \"reconnectOnChangedSchema\":\"false\",\n" + - " \"connectionTimeout\":\"20000\",\n" + - " \"maxConnectionAttempts\":\"100\",\n" + - " \"username\":\"netconf\",\n" + - " \"tcpOnly\":\"false\"\n" + - " },\n" + - " \"lastServiceDate\":\"2019-08-16\",\n" + - " \"macAddress\":\"02:42:f7:d4:62:ce\",\n" + - " \"manufactureDate\":\"2019-08-16\",\n" + - " \"modelNumbsdnrer\": \"1234 BestInClass\",\n" + - " \"oamV4IpAddress\": \"10.10.10.11\",\n" + - " \"oamPort\":\"17380\",\n" + - " \"oamV6IpAddress\": \"0:0:0:0:0:ffff:a0a:011\",\n" + - " \"serialNumber\": \"VENDORA-1234-10.10.10.11-1234 BestInClass\",\n" + - " \"softwareVersion\": \"2.3.5\",\n" + - " \"unitFamily\": \"VENDORA-1234\",\n" + - " \"unitType\": \"1234\",\n" + - " \"vendorName\": \"VENDORA\"\n" + - " }\n" + - " }\n" + - "}\n" + - ""; - private static final String pnfRegMsg = "{\n" + - " \"event\": {\n" + - " \"commonEventHeader\": {\n" + - " \"domain\": \"pnfRegistration\",\n" + - " \"eventId\": \"NSHMRIACQ01M01123401_1234 BestInClass\",\n" + - " \"eventName\": \"pnfRegistration_EventType5G\",\n" + - " \"eventType\": \"EventType5G\",\n" + - " \"sequence\": 0,\n" + - " \"priority\": \"Low\",\n" + - " \"reportingEntityId\": \"\",\n" + - " \"reportingEntityName\": \"pendurty-virtual-machine\",\n" + - " \"sourceId\": \"\",\n" + - " \"sourceName\": \"NSHMRIACQ01M01123401\",\n" + - " \"startEpochMicrosec\": 1571300004203,\n" + - " \"lastEpochMicrosec\": 1571300004203,\n" + - " \"nfNamingCode\": \"1234\",\n" + - " \"nfVendorName\": \"VENDORA\",\n" + - " \"timeZoneOffset\": \"+00:00\",\n" + - " \"version\": \"4.0.1\",\n" + - " \"vesEventListenerVersion\":\"7.0.1\"\n" + - " },\n" + - " \"pnfRegistrationFields\": {\n" + - " \"pnfRegistrationFieldsVersion\": \"2.0\",\n" + - " \"lastServiceDate\":\"2019-08-16\",\n" + - " \"macAddress\":\"02:42:f7:d4:62:ce\",\n" + - " \"manufactureDate\":\"2019-08-16\",\n" + - " \"modelNumbsdnrer\": \"1234 BestInClass\",\n" + - " \"oamV4IpAddress\": \"10.10.10.11\",\n" + - " \"oamPort\":\"17380\",\n" + - " \"oamV6IpAddress\": \"0:0:0:0:0:ffff:a0a:011\",\n" + - " \"serialNumber\": \"VENDORA-1234-10.10.10.11-1234 BestInClass\",\n" + - " \"softwareVersion\": \"2.3.5\",\n" + - " \"unitFamily\": \"VENDORA-1234\",\n" + - " \"unitType\": \"1234\",\n" + - " \"vendorName\": \"VENDORA\"\n" + - " }\n" + - " }\n" + - "}\n" + - ""; + private static final String pnfRegMsg_OTHER = "{\n" + + " \"event\": {\n" + + " \"commonEventHeader\": {\n" + + " \"domain\": \"pnfRegistration\",\n" + + " \"eventId\": \"NSHMRIACQ01M01123401_1234 BestInClass\",\n" + + " \"eventName\": \"pnfRegistration_EventType5G\",\n" + + " \"eventType\": \"EventType5G\",\n" + + " \"sequence\": 0,\n" + + " \"priority\": \"Low\",\n" + + " \"reportingEntityId\": \"\",\n" + + " \"reportingEntityName\": \"pendurty-virtual-machine\",\n" + + " \"sourceId\": \"\",\n" + + " \"sourceName\": \"NSHMRIACQ01M01123401\",\n" + + " \"startEpochMicrosec\": 1571300004203,\n" + + " \"lastEpochMicrosec\": 1571300004203,\n" + + " \"nfNamingCode\": \"1234\",\n" + + " \"nfVendorName\": \"VENDORA\",\n" + + " \"timeZoneOffset\": \"+00:00\",\n" + + " \"version\": \"4.0.1\",\n" + + " \"vesEventListenerVersion\":\"7.0.1\"\n" + + " },\n" + + " \"pnfRegistrationFields\": {\n" + + " \"pnfRegistrationFieldsVersion\": \"2.0\",\n" + + " \"additionalFields\": \n" + + " { \n" + + " \"protocol\":\"OTHER\",\n" + + " \"password\":\"netconf\",\n" + + " \"oamPort\":\"50000\",\n" + + " \"betweenAttemptsTimeout\":\"2000\",\n" + + " \"keepaliveDelay\":\"120\",\n" + + " \"sleep-factor\":\"1.5\",\n" + + " \"reconnectOnChangedSchema\":\"false\",\n" + + " \"connectionTimeout\":\"20000\",\n" + + " \"maxConnectionAttempts\":\"100\",\n" + + " \"username\":\"netconf\",\n" + + " \"tcpOnly\":\"false\"\n" + + " },\n" + + " \"lastServiceDate\":\"2019-08-16\",\n" + + " \"macAddress\":\"02:42:f7:d4:62:ce\",\n" + + " \"manufactureDate\":\"2019-08-16\",\n" + + " \"modelNumbsdnrer\": \"1234 BestInClass\",\n" + + " \"oamV4IpAddress\": \"10.10.10.11\",\n" + + " \"oamPort\":\"17380\",\n" + + " \"oamV6IpAddress\": \"0:0:0:0:0:ffff:a0a:011\",\n" + + " \"serialNumber\": \"VENDORA-1234-10.10.10.11-1234 BestInClass\",\n" + + " \"softwareVersion\": \"2.3.5\",\n" + + " \"unitFamily\": \"VENDORA-1234\",\n" + + " \"unitType\": \"1234\",\n" + + " \"vendorName\": \"VENDORA\"\n" + + " }\n" + + " }\n" + + "}\n" + + ""; + private static final String pnfRegMsg = "{\n" + + " \"event\": {\n" + + " \"commonEventHeader\": {\n" + + " \"domain\": \"pnfRegistration\",\n" + + " \"eventId\": \"NSHMRIACQ01M01123401_1234 BestInClass\",\n" + + " \"eventName\": \"pnfRegistration_EventType5G\",\n" + + " \"eventType\": \"EventType5G\",\n" + + " \"sequence\": 0,\n" + + " \"priority\": \"Low\",\n" + + " \"reportingEntityId\": \"\",\n" + + " \"reportingEntityName\": \"pendurty-virtual-machine\",\n" + + " \"sourceId\": \"\",\n" + + " \"sourceName\": \"NSHMRIACQ01M01123401\",\n" + + " \"startEpochMicrosec\": 1571300004203,\n" + + " \"lastEpochMicrosec\": 1571300004203,\n" + + " \"nfNamingCode\": \"1234\",\n" + + " \"nfVendorName\": \"VENDORA\",\n" + + " \"timeZoneOffset\": \"+00:00\",\n" + + " \"version\": \"4.0.1\",\n" + + " \"vesEventListenerVersion\":\"7.0.1\"\n" + + " },\n" + + " \"pnfRegistrationFields\": {\n" + + " \"pnfRegistrationFieldsVersion\": \"2.0\",\n" + + " \"lastServiceDate\":\"2019-08-16\",\n" + + " \"macAddress\":\"02:42:f7:d4:62:ce\",\n" + + " \"manufactureDate\":\"2019-08-16\",\n" + + " \"modelNumbsdnrer\": \"1234 BestInClass\",\n" + + " \"oamV4IpAddress\": \"10.10.10.11\",\n" + + " \"oamPort\":\"17380\",\n" + + " \"oamV6IpAddress\": \"0:0:0:0:0:ffff:a0a:011\",\n" + + " \"serialNumber\": \"VENDORA-1234-10.10.10.11-1234 BestInClass\",\n" + + " \"softwareVersion\": \"2.3.5\",\n" + + " \"unitFamily\": \"VENDORA-1234\",\n" + + " \"unitType\": \"1234\",\n" + + " \"vendorName\": \"VENDORA\"\n" + + " }\n" + + " }\n" + + "}\n" + + ""; + // @formatter:on - @Test - public void processMsgTest() { + @Test + public void processMsgTest() { - DMaaPPNFRegVESMsgConsumer pnfRegMsgConsumer = new TestDMaaPPNFRegVESMsgConsumer(); - try { - pnfRegMsgConsumer.processMsg(pnfRegMsg); - pnfRegMsgConsumer.processMsg(pnfRegMsg_SSH); - pnfRegMsgConsumer.processMsg(pnfRegMsg_TLS); - pnfRegMsgConsumer.processMsg(pnfRegMsg_OTHER); - } catch (Exception e) { - e.printStackTrace(); - System.out.println("Exception while processing PNF Registration Message - "+e.getMessage()); - } - } + DMaaPPNFRegVESMsgConsumer pnfRegMsgConsumer = new TestDMaaPPNFRegVESMsgConsumer(); + try { + pnfRegMsgConsumer.processMsg(pnfRegMsg); + pnfRegMsgConsumer.processMsg(pnfRegMsg_SSH); + pnfRegMsgConsumer.processMsg(pnfRegMsg_TLS); + pnfRegMsgConsumer.processMsg(pnfRegMsg_OTHER); + } catch (Exception e) { + e.printStackTrace(); + System.out.println("Exception while processing PNF Registration Message - " + e.getMessage()); + } + } - @Override - public PNFMountPointClient getPNFMountPointClient(String baseUrl) { - return new TestPNFMountPointClient(); - } + @Override + public PNFMountPointClient getPNFMountPointClient(String baseUrl) { + return new TestPNFMountPointClient(); + } - @Override - public String getSDNRUser() { - return DEFAULT_SDNRUSER; - } + @Override + public String getSDNRUser() { + return DEFAULT_SDNRUSER; + } - @Override - public String getSDNRPasswd() { - return DEFAULT_SDNRPASSWD; - } + @Override + public String getSDNRPasswd() { + return DEFAULT_SDNRPASSWD; + } - @Override - public String getBaseUrl() { - return DEFAULT_SDNRBASEURL; - } + @Override + public String getBaseUrl() { + return DEFAULT_SDNRBASEURL; + } - @Test - public void Test1() { - TestGeneralConfig cfgTest = new TestGeneralConfig(); - cfgTest.test(); - DMaaPPNFRegVESMsgConsumer pnfConsumer = new DMaaPPNFRegVESMsgConsumer(); - System.out.println(pnfConsumer.getBaseUrl()); - System.out.println(pnfConsumer.getSDNRUser()); - System.out.println(pnfConsumer.getSDNRPasswd()); - } + @Test + public void Test1() { + TestGeneralConfig cfgTest = new TestGeneralConfig(); + cfgTest.test(); + DMaaPPNFRegVESMsgConsumer pnfConsumer = new DMaaPPNFRegVESMsgConsumer(); + System.out.println(pnfConsumer.getBaseUrl()); + System.out.println(pnfConsumer.getSDNRUser()); + System.out.println(pnfConsumer.getSDNRPasswd()); + } } 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 774ca2085..1f1cfa33f 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 @@ -1,4 +1,4 @@ -/******************************************************************************* +/* * ============LICENSE_START======================================================================== * ONAP : ccsdk feature sdnr wt * ================================================================================================= @@ -14,18 +14,17 @@ * or implied. See the License for the specific language governing permissions and limitations under * the License. * ============LICENSE_END========================================================================== - ******************************************************************************/ + */ package org.onap.ccsdk.features.sdnr.wt.mountpointregistrar.test; import static org.junit.Assert.assertNotNull; - +import com.google.common.io.Files; import java.io.File; import java.nio.charset.StandardCharsets; import java.util.HashMap; import java.util.List; import java.util.Map; - import org.junit.After; import org.junit.Test; import org.onap.ccsdk.features.sdnr.wt.common.configuration.Configuration; @@ -36,136 +35,138 @@ import org.onap.ccsdk.features.sdnr.wt.mountpointregistrar.impl.FaultConfig; import org.onap.ccsdk.features.sdnr.wt.mountpointregistrar.impl.GeneralConfig; import org.onap.ccsdk.features.sdnr.wt.mountpointregistrar.impl.PNFRegistrationConfig; -import com.google.common.io.Files; - public class TestDMaaPVESMsgConsumerMain { - private static final String CONFIGURATIONFILE = "test.properties"; - private static final String TESTCONFIG_GENERAL="[general]\n" + - "dmaapEnabled=false\n" + - "baseUrl=http://localhost:8181\n" + - "sdnrUser=admin\n" + - "sdnrPasswd=admin\n" + - "\n" + - "[pnfRegistration]\n" + - "pnfRegConsumerClass=org.onap.ccsdk.features.sdnr.wt.mountpointregistrar.test.impl.DummyPNFRegVESMsgConsumer\n" + - "TransportType=HTTPNOAUTH\n" + - "host=onap-dmap:3904\n" + - "topic=unauthenticated.VES_PNFREG_OUTPUT\n" + - "contenttype=application/json\n" + - "group=myG\n" + - "id=C1\n" + - "timeout=20000\n" + - "limit=10000\n" + - "\n" + - "[fault]\n" + - "faultConsumerClass=org.onap.ccsdk.features.sdnr.wt.mountpointregistrar.test.impl.DummyFaultVESMsgConsumer\n" + - "TransportType=HTTPNOAUTH\n" + - "host=onap-dmap:3904\n" + - "topic=unauthenticated.SEC_FAULT_OUTPUT\n" + - "contenttype=application/json\n" + - "group=myG\n" + - "id=C1\n" + - "timeout=20000\n" + - "limit=10000\n" + - "fetchPause=10000\n" + - "\n" + - ""; - - private static final String TESTCONFIG_GENERAL_INVALID="[general]\n" + - "dmaapEnabled=false\n" + - "baseUrl=http://localhost:8181\n" + - "sdnrUser=admin\n" + - "sdnrPasswd=admin\n" + - "\n" + - "[pnfRegistration]\n" + - "pnfRegConsumerClass=org.onap.ccsdk.features.sdnr.wt.mountpointregistrar.test.impl.DummyPNFRegVESMsgConsumer\n" + - "TransportType=HTTPNOAUTH\n" + - "host=onap-dmap:3904\n" + - "topic=unauthenticated.VES_PNFREG_OUTPUT\n" + - "contenttype=application/json\n" + - "group=myG\n" + - "id=C1\n" + - "timeout=20000\n" + - "limit=10000\n" + - "\n" + - "[fault]\n" + - "faultConsumerClass=org.onap.ccsdk.features.sdnr.wt.mountpointregistrar.test.impl.DummyFaultVESMsgConsumer\n" + - "TransportType=HTTPNOAUTH\n" + - "host=onap-dmap:3904\n" + - "topic=unauthenticated.SEC_FAULT_OUTPUT\n" + - "contenttype=application/json\n" + - "group=myG\n" + - "id=C1\n" + - "timeout=HELLO\n" + - "limit=10000\n" + - "fetchPause=WORLD\n" + - "\n" + - ""; - public GeneralConfig generalConfig; - Map<String, Configuration> configMap = new HashMap<String, Configuration>(); - DMaaPVESMsgConsumerMain dmaapMain; - - // @Before - public void preTest1() { - try { - 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); - - configMap.put("pnfRegistration", pnfRegConfig); - configMap.put("fault", faultConfig); - } catch (Exception e) { - System.out.println("Failed in preTest execution "+e.getMessage()); - } - } - - public void preTest2() { - try { - 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); - - configMap.put("pnfRegistration", pnfRegConfig); - configMap.put("fault", faultConfig); - } catch (Exception e) { - System.out.println("Failed in preTest execution "+e.getMessage()); - } - } - - @Test - public void testDMaaPVESMsgConsumerMainMapOfStringConfiguration() { - preTest1(); - assertNotNull(configMap); - dmaapMain = new DMaaPVESMsgConsumerMain(configMap); - } - - @Test - public void testDMaaPVESMsgConsumerMainMapOfStringConfiguration1() { - preTest2(); - assertNotNull(configMap); - dmaapMain = new DMaaPVESMsgConsumerMain(configMap); - } - - @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(); - } - } + private static final String CONFIGURATIONFILE = "test.properties"; + // @formatter:off + private static final String TESTCONFIG_GENERAL = "[general]\n" + + "dmaapEnabled=false\n" + + "baseUrl=http://localhost:8181\n" + + "sdnrUser=admin\n" + + "sdnrPasswd=admin\n" + + "\n" + + "[pnfRegistration]\n" + + "pnfRegConsumerClass=org.onap.ccsdk.features.sdnr.wt.mountpointregistrar.test.impl.DummyPNFRegVESMsgConsumer\n" + + "TransportType=HTTPNOAUTH\n" + + "host=onap-dmap:3904\n" + + "topic=unauthenticated.VES_PNFREG_OUTPUT\n" + + "contenttype=application/json\n" + + "group=myG\n" + + "id=C1\n" + + "timeout=20000\n" + + "limit=10000\n" + + "\n" + + "[fault]\n" + + "faultConsumerClass=org.onap.ccsdk.features.sdnr.wt.mountpointregistrar.test.impl.DummyFaultVESMsgConsumer\n" + + "TransportType=HTTPNOAUTH\n" + + "host=onap-dmap:3904\n" + + "topic=unauthenticated.SEC_FAULT_OUTPUT\n" + + "contenttype=application/json\n" + + "group=myG\n" + + "id=C1\n" + + "timeout=20000\n" + + "limit=10000\n" + + "fetchPause=10000\n" + + "\n" + + ""; + + private static final String TESTCONFIG_GENERAL_INVALID = "[general]\n" + + "dmaapEnabled=false\n" + + "baseUrl=http://localhost:8181\n" + + "sdnrUser=admin\n" + + "sdnrPasswd=admin\n" + + "\n" + + "[pnfRegistration]\n" + + "pnfRegConsumerClass=org.onap.ccsdk.features.sdnr.wt.mountpointregistrar.test.impl.DummyPNFRegVESMsgConsumer\n" + + "TransportType=HTTPNOAUTH\n" + + "host=onap-dmap:3904\n" + + "topic=unauthenticated.VES_PNFREG_OUTPUT\n" + + "contenttype=application/json\n" + + "group=myG\n" + + "id=C1\n" + + "timeout=20000\n" + + "limit=10000\n" + + "\n" + + "[fault]\n" + + "faultConsumerClass=org.onap.ccsdk.features.sdnr.wt.mountpointregistrar.test.impl.DummyFaultVESMsgConsumer\n" + + "TransportType=HTTPNOAUTH\n" + + "host=onap-dmap:3904\n" + + "topic=unauthenticated.SEC_FAULT_OUTPUT\n" + + "contenttype=application/json\n" + + "group=myG\n" + + "id=C1\n" + + "timeout=HELLO\n" + + "limit=10000\n" + + "fetchPause=WORLD\n" + + "\n" + + ""; + public GeneralConfig generalConfig; + // @formatter:on + Map<String, Configuration> configMap = new HashMap<String, Configuration>(); + DMaaPVESMsgConsumerMain dmaapMain; + + // @Before + public void preTest1() { + try { + 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); + + configMap.put("pnfRegistration", pnfRegConfig); + configMap.put("fault", faultConfig); + } catch (Exception e) { + System.out.println("Failed in preTest execution " + e.getMessage()); + } + } + + public void preTest2() { + try { + 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); + + configMap.put("pnfRegistration", pnfRegConfig); + configMap.put("fault", faultConfig); + } catch (Exception e) { + System.out.println("Failed in preTest execution " + e.getMessage()); + } + } + + @Test + public void testDMaaPVESMsgConsumerMainMapOfStringConfiguration() { + preTest1(); + assertNotNull(configMap); + dmaapMain = new DMaaPVESMsgConsumerMain(configMap); + } + + @Test + public void testDMaaPVESMsgConsumerMainMapOfStringConfiguration1() { + preTest2(); + assertNotNull(configMap); + dmaapMain = new DMaaPVESMsgConsumerMain(configMap); + } + + @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 e07b9757c..c847fbb9f 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 @@ -1,4 +1,4 @@ -/******************************************************************************* +/* * ============LICENSE_START======================================================================== * ONAP : ccsdk feature sdnr wt * ================================================================================================= @@ -14,82 +14,82 @@ * or implied. See the License for the specific language governing permissions and limitations under * the License. * ============LICENSE_END========================================================================== - ******************************************************************************/ + */ package org.onap.ccsdk.features.sdnr.wt.mountpointregistrar.test; import static org.junit.Assert.assertEquals; - +import com.google.common.io.Files; 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; -import com.google.common.io.Files; - public class TestFaultConfig { - private static final String TESTCONFIG_CONTENT="[fault]\n" + - "faultConsumerClass=org.onap.ccsdk.features.sdnr.wt.mountpointregistrar.impl.DMaaPFaultVESMsgConsumer\n" + - "TransportType=HTTPNOAUTH\n" + - "Protocol=http\n" + - "username=username\n" + - "password=password\n" + - "host=onap-dmap:3904\n" + - "topic=unauthenticated.SEC_FAULT_OUTPUT\n" + - "contenttype=application/json\n" + - "group=myG\n" + - "id=C1\n" + - "timeout=20000\n" + - "limit=10000\n" + - "fetchPause=5000\n" + - "jersey.config.client.readTimeout=25000\n" + - "jersey.config.client.connectTimeout=25000\n" + - "\n" + - ""; + // @formatter:off + private static final String TESTCONFIG_CONTENT = "[fault]\n" + + "faultConsumerClass=org.onap.ccsdk.features.sdnr.wt.mountpointregistrar.impl.DMaaPFaultVESMsgConsumer\n" + + "TransportType=HTTPNOAUTH\n" + + "Protocol=http\n" + + "username=username\n" + + "password=password\n" + + "host=onap-dmap:3904\n" + + "topic=unauthenticated.SEC_FAULT_OUTPUT\n" + + "contenttype=application/json\n" + + "group=myG\n" + + "id=C1\n" + + "timeout=20000\n" + + "limit=10000\n" + + "fetchPause=5000\n" + + "jersey.config.client.readTimeout=25000\n" + + "jersey.config.client.connectTimeout=25000\n" + + "\n" + + ""; + // @formatter:on + + private ConfigurationFileRepresentation cfg; + + @Test + public void test() { + try { + Files.asCharSink(new File("test.properties"), StandardCharsets.UTF_8).write(TESTCONFIG_CONTENT); + cfg = new ConfigurationFileRepresentation("test.properties"); + FaultConfig faultCfg = new FaultConfig(cfg); + assertEquals("fault", faultCfg.getSectionName()); + assertEquals("org.onap.ccsdk.features.sdnr.wt.mountpointregistrar.impl.DMaaPFaultVESMsgConsumer", + faultCfg.getConsumerClass()); + assertEquals("HTTPNOAUTH", faultCfg.getTransportType()); + assertEquals("onap-dmap:3904", faultCfg.getHostPort()); + assertEquals("unauthenticated.SEC_FAULT_OUTPUT", faultCfg.getTopic()); + assertEquals("application/json", faultCfg.getContenttype()); + assertEquals("myG", faultCfg.getConsumerGroup()); + assertEquals("C1", faultCfg.getConsumerId()); + assertEquals("20000", faultCfg.getTimeout()); + assertEquals("10000", faultCfg.getLimit()); + assertEquals("5000", faultCfg.getFetchPause()); + assertEquals("http", faultCfg.getProtocol()); + assertEquals("username", faultCfg.getUsername()); + assertEquals("password", faultCfg.getPassword()); + assertEquals("25000", faultCfg.getClientReadTimeout()); + assertEquals("25000", faultCfg.getClientConnectTimeout()); - private ConfigurationFileRepresentation cfg; + } catch (IOException e) { + // TODO Auto-generated catch block + } + } - @Test - public void test() { - try { - Files.asCharSink(new File("test.properties"), StandardCharsets.UTF_8).write(TESTCONFIG_CONTENT); - cfg = new ConfigurationFileRepresentation("test.properties"); - FaultConfig faultCfg = new FaultConfig(cfg); - assertEquals("fault", faultCfg.getSectionName()); - assertEquals("org.onap.ccsdk.features.sdnr.wt.mountpointregistrar.impl.DMaaPFaultVESMsgConsumer", faultCfg.getConsumerClass()); - assertEquals("HTTPNOAUTH", faultCfg.getTransportType()); - assertEquals("onap-dmap:3904", faultCfg.getHostPort()); - assertEquals("unauthenticated.SEC_FAULT_OUTPUT", faultCfg.getTopic()); - assertEquals("application/json", faultCfg.getContenttype()); - assertEquals("myG", faultCfg.getConsumerGroup()); - assertEquals("C1", faultCfg.getConsumerId()); - assertEquals("20000", faultCfg.getTimeout()); - assertEquals("10000", faultCfg.getLimit()); - assertEquals("5000", faultCfg.getFetchPause()); - assertEquals("http", faultCfg.getProtocol()); - assertEquals("username", faultCfg.getUsername()); - assertEquals("password", faultCfg.getPassword()); - assertEquals("25000", faultCfg.getClientReadTimeout()); - assertEquals("25000", faultCfg.getClientConnectTimeout()); + @After + public void cleanUp() { + File file = new File("test.properties"); + if (file.exists()) { + System.out.println("File exists, Deleting it"); + file.delete(); + } - } catch (IOException e) { - // 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/TestFaultNotificationClient.java b/sdnr/wt/mountpoint-registrar/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/mountpointregistrar/test/TestFaultNotificationClient.java index b09b54f7e..0b9e2df24 100644 --- a/sdnr/wt/mountpoint-registrar/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/mountpointregistrar/test/TestFaultNotificationClient.java +++ b/sdnr/wt/mountpoint-registrar/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/mountpointregistrar/test/TestFaultNotificationClient.java @@ -1,4 +1,4 @@ -/******************************************************************************* +/* * ============LICENSE_START======================================================================== * ONAP : ccsdk feature sdnr wt * ================================================================================================= @@ -14,7 +14,7 @@ * or implied. See the License for the specific language governing permissions and limitations under * the License. * ============LICENSE_END========================================================================== - ******************************************************************************/ + */ package org.onap.ccsdk.features.sdnr.wt.mountpointregistrar.test; @@ -31,27 +31,29 @@ import org.onap.ccsdk.features.sdnr.wt.mountpointregistrar.impl.FaultNotificatio public class TestFaultNotificationClient extends FaultNotificationClient { - public static String baseUrl = "http://localhost:8181"; - FaultNotificationClient testClient ; + public static String baseUrl = "http://localhost:8181"; + FaultNotificationClient testClient; - public TestFaultNotificationClient() { - super(baseUrl); + public TestFaultNotificationClient() { + super(baseUrl); - } + } - @Test - public void testFaultNotificationClient() { - testClient = new TestFaultNotificationClient(); - testClient.setAuthorization("admin", "admin"); - assertEquals(true, testClient.sendFaultNotification("TEST_50001", "1", "2019-11-20T09:25:19.948Z", "SEDNKSAHQ01M01nSky01", "lossOfSignal", "Critical")); - assertEquals(true, testClient.sendFaultNotification("TEST_50001", "1", "2019-11-20T09:25:19.948Z", "SEDNKSAHQ01M01nSky01", "lossOfSignal", "Critical")); - } + @Test + public void testFaultNotificationClient() { + testClient = new TestFaultNotificationClient(); + testClient.setAuthorization("admin", "admin"); + assertEquals(true, testClient.sendFaultNotification("TEST_50001", "1", "2019-11-20T09:25:19.948Z", + "SEDNKSAHQ01M01nSky01", "lossOfSignal", "Critical")); + assertEquals(true, testClient.sendFaultNotification("TEST_50001", "1", "2019-11-20T09:25:19.948Z", + "SEDNKSAHQ01M01nSky01", "lossOfSignal", "Critical")); + } - @Override - protected @Nonnull BaseHTTPResponse sendRequest(String uri, String method, String body, Map<String, String> headers) + @Override + protected @Nonnull BaseHTTPResponse sendRequest(String uri, String method, String body, Map<String, String> headers) throws IOException { - System.out.println("In overridden sendRequest in TestFaultNotificationClient"); + System.out.println("In overridden sendRequest in TestFaultNotificationClient"); return new BaseHTTPResponse(200, body); } } diff --git a/sdnr/wt/mountpoint-registrar/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/mountpointregistrar/test/TestGeneralConfig.java b/sdnr/wt/mountpoint-registrar/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/mountpointregistrar/test/TestGeneralConfig.java index 4eb5ba17b..c07ee480b 100644 --- a/sdnr/wt/mountpoint-registrar/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/mountpointregistrar/test/TestGeneralConfig.java +++ b/sdnr/wt/mountpoint-registrar/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/mountpointregistrar/test/TestGeneralConfig.java @@ -1,4 +1,4 @@ -/******************************************************************************* +/* * ============LICENSE_START======================================================================== * ONAP : ccsdk feature sdnr wt * ================================================================================================= @@ -14,58 +14,57 @@ * or implied. See the License for the specific language governing permissions and limitations under * the License. * ============LICENSE_END========================================================================== - ******************************************************************************/ + */ package org.onap.ccsdk.features.sdnr.wt.mountpointregistrar.test; import static org.junit.Assert.assertEquals; - +import com.google.common.io.Files; 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.GeneralConfig; -import com.google.common.io.Files; - public class TestGeneralConfig { - private static final String TESTCONFIG_CONTENT="[general]\n" + - "dmaapEnabled=false\n" + - "baseUrl=http://localhost:8181\n" + - "sdnrUser=admin\n" + - "sdnrPasswd=admin\n" + - ""; + // @formatter:off + private static final String TESTCONFIG_CONTENT = "[general]\n" + + "dmaapEnabled=false\n" + + "baseUrl=http://localhost:8181\n" + + "sdnrUser=admin\n" + + "sdnrPasswd=admin\n" + + ""; + // @formatter:on + + private ConfigurationFileRepresentation globalCfg; + + @Test + public void test() { + try { + Files.asCharSink(new File("test.properties"), StandardCharsets.UTF_8).write(TESTCONFIG_CONTENT); + globalCfg = new ConfigurationFileRepresentation("test.properties"); + GeneralConfig cfg = new GeneralConfig(globalCfg); + assertEquals(false, cfg.getEnabled()); + assertEquals("http://localhost:8181", GeneralConfig.getBaseUrl()); + assertEquals("admin", GeneralConfig.getSDNRUser()); + assertEquals("admin", GeneralConfig.getSDNRPasswd()); + assertEquals("general", cfg.getSectionName()); + } catch (IOException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + } - private ConfigurationFileRepresentation globalCfg; + @After + public void cleanUp() { + File file = new File("test.properties"); + if (file.exists()) { + System.out.println("File exists, Deleting it"); + file.delete(); + } - @Test - public void test() { - try { - Files.asCharSink(new File("test.properties"), StandardCharsets.UTF_8).write(TESTCONFIG_CONTENT); - globalCfg = new ConfigurationFileRepresentation("test.properties"); - GeneralConfig cfg = new GeneralConfig(globalCfg); - assertEquals(false, cfg.getEnabled()); - assertEquals("http://localhost:8181", GeneralConfig.getBaseUrl()); - assertEquals("admin", GeneralConfig.getSDNRUser()); - assertEquals("admin", GeneralConfig.getSDNRPasswd()); - assertEquals("general", cfg.getSectionName()); - } catch (IOException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } - } - - @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 3259f2e4c..7753c0975 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 @@ -1,4 +1,4 @@ -/******************************************************************************* +/* * ============LICENSE_START======================================================================== * ONAP : ccsdk feature sdnr wt * ================================================================================================= @@ -14,7 +14,7 @@ * or implied. See the License for the specific language governing permissions and limitations under * the License. * ============LICENSE_END========================================================================== - ******************************************************************************/ + */ package org.onap.ccsdk.features.sdnr.wt.mountpointregistrar.test; import java.util.Optional; @@ -36,8 +36,8 @@ public class TestMapping { return SeverityType.forName(faultSeverity); // <-- mapping provided by generated classes. Manual mapping beneficial. } - private String updateFaultPayload(String faultNodeId, String faultCounter, String faultOccurrenceTime, String faultObjectId, - String faultReason, String faultSeverity) throws JsonProcessingException { + private String updateFaultPayload(String faultNodeId, String faultCounter, String faultOccurrenceTime, + String faultObjectId, String faultReason, String faultSeverity) throws JsonProcessingException { PushFaultNotificationInputBuilder faultNotificationBuilder = new PushFaultNotificationInputBuilder(); faultNotificationBuilder.setNodeId(faultNodeId); @@ -59,9 +59,9 @@ public class TestMapping { public void test() throws JsonProcessingException { DateAndTime dt = new DateAndTime("2017-03-01T09:15:00.0Z"); - String result = updateFaultPayload("f1","34",dt.getValue(),"fefef","reason","Critical"); + String result = updateFaultPayload("f1", "34", dt.getValue(), "fefef", "reason", "Critical"); - System.out.println("Res: "+result); - } + System.out.println("Res: " + result); + } } 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 af47f3d33..433972435 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 @@ -1,4 +1,4 @@ -/******************************************************************************* +/* * ============LICENSE_START======================================================= ONAP : ccsdk * feature sdnr wt ================================================================================ * Copyright (C) 2019 highstreet technologies GmbH Intellectual Property. All rights reserved. @@ -12,7 +12,7 @@ * 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.ccsdk.features.sdnr.wt.mountpointregistrar.test; import static org.junit.Assert.assertNotNull; @@ -58,12 +58,12 @@ public class TestMountpointRegistrarImpl { // start using blueprint interface try { - mountpointRegistrar = new MountpointRegistrarImpl(); - mountpointRegistrar.init(); + mountpointRegistrar = new MountpointRegistrarImpl(); + mountpointRegistrar.init(); } catch (Exception e) { StringWriter sw = new StringWriter(); e.printStackTrace(new PrintWriter(sw)); - fail("Not initialized" +sw.toString()); + fail("Not initialized" + sw.toString()); } System.out.println("Initialization status: " + mountpointRegistrar.isInitializationOk()); System.out.println("Initialization done"); @@ -75,7 +75,7 @@ public class TestMountpointRegistrarImpl { System.out.println("Start shutdown"); // close using blueprint interface try { - mountpointRegistrar.close(); + mountpointRegistrar.close(); } catch (Exception e) { System.out.println(e); } @@ -94,7 +94,7 @@ public class TestMountpointRegistrarImpl { // ********************* Private @SuppressWarnings("unused") - private static void sleep(int millis) { + private static void sleep(int millis) { try { Thread.sleep(millis); } catch (InterruptedException e) { diff --git a/sdnr/wt/mountpoint-registrar/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/mountpointregistrar/test/TestPNFMountPointClient.java b/sdnr/wt/mountpoint-registrar/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/mountpointregistrar/test/TestPNFMountPointClient.java index 5a68e15bc..596522fc0 100644 --- a/sdnr/wt/mountpoint-registrar/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/mountpointregistrar/test/TestPNFMountPointClient.java +++ b/sdnr/wt/mountpoint-registrar/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/mountpointregistrar/test/TestPNFMountPointClient.java @@ -1,4 +1,4 @@ -/******************************************************************************* +/* * ============LICENSE_START======================================================================== * ONAP : ccsdk feature sdnr wt * ================================================================================================= @@ -14,7 +14,7 @@ * or implied. See the License for the specific language governing permissions and limitations under * the License. * ============LICENSE_END========================================================================== - ******************************************************************************/ + */ package org.onap.ccsdk.features.sdnr.wt.mountpointregistrar.test; @@ -31,28 +31,30 @@ import org.onap.ccsdk.features.sdnr.wt.mountpointregistrar.impl.PNFMountPointCli public class TestPNFMountPointClient extends PNFMountPointClient { - public static String baseUrl = "http://localhost:8181"; - PNFMountPointClient testClient ; + public static String baseUrl = "http://localhost:8181"; + PNFMountPointClient testClient; - public TestPNFMountPointClient() { - super(baseUrl); + public TestPNFMountPointClient() { + super(baseUrl); - } + } - @Test - public void testPNFMountPointClient() { - testClient = new TestPNFMountPointClient(); - testClient.setAuthorization("admin", "admin"); - assertEquals(true, testClient.pnfMountPointCreate("TEST_50001", "127.0.0.1", "TLS", "key_id", "admin", "admin", "17380")); + @Test + public void testPNFMountPointClient() { + testClient = new TestPNFMountPointClient(); + testClient.setAuthorization("admin", "admin"); + assertEquals(true, + testClient.pnfMountPointCreate("TEST_50001", "127.0.0.1", "TLS", "key_id", "admin", "admin", "17380")); - assertEquals(true, testClient.pnfMountPointCreate("TEST_50001", "127.0.0.1", "SSH", "key_id", "admin", "admin", "17380")); - } + assertEquals(true, + testClient.pnfMountPointCreate("TEST_50001", "127.0.0.1", "SSH", "key_id", "admin", "admin", "17380")); + } - @Override - protected @Nonnull BaseHTTPResponse sendRequest(String uri, String method, String body, Map<String, String> headers) + @Override + protected @Nonnull BaseHTTPResponse sendRequest(String uri, String method, String body, Map<String, String> headers) throws IOException { - System.out.println("In overridden sendRequest in TestPNFMountPointClient"); + System.out.println("In overridden sendRequest in TestPNFMountPointClient"); return new BaseHTTPResponse(200, body); } diff --git a/sdnr/wt/mountpoint-registrar/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/mountpointregistrar/test/impl/DummyFaultVESMsgConsumer.java b/sdnr/wt/mountpoint-registrar/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/mountpointregistrar/test/impl/DummyFaultVESMsgConsumer.java index a5662c986..d1e9015e7 100644 --- a/sdnr/wt/mountpoint-registrar/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/mountpointregistrar/test/impl/DummyFaultVESMsgConsumer.java +++ b/sdnr/wt/mountpoint-registrar/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/mountpointregistrar/test/impl/DummyFaultVESMsgConsumer.java @@ -1,4 +1,4 @@ -/******************************************************************************* +/* * ============LICENSE_START======================================================================== * ONAP : ccsdk feature sdnr wt * ================================================================================================= @@ -14,7 +14,7 @@ * or implied. See the License for the specific language governing permissions and limitations under * the License. * ============LICENSE_END========================================================================== - ******************************************************************************/ + */ package org.onap.ccsdk.features.sdnr.wt.mountpointregistrar.test.impl; @@ -22,10 +22,10 @@ import org.onap.ccsdk.features.sdnr.wt.mountpointregistrar.impl.DMaaPVESMsgConsu public class DummyFaultVESMsgConsumer extends DMaaPVESMsgConsumerImpl { - @Override - public void processMsg(String msg) throws Exception { - System.out.println("Message received is - "+msg); + @Override + public void processMsg(String msg) throws Exception { + System.out.println("Message received is - " + msg); - } + } } diff --git a/sdnr/wt/mountpoint-registrar/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/mountpointregistrar/test/impl/DummyPNFRegVESMsgConsumer.java b/sdnr/wt/mountpoint-registrar/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/mountpointregistrar/test/impl/DummyPNFRegVESMsgConsumer.java index 368bbde11..a165182c0 100644 --- a/sdnr/wt/mountpoint-registrar/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/mountpointregistrar/test/impl/DummyPNFRegVESMsgConsumer.java +++ b/sdnr/wt/mountpoint-registrar/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/mountpointregistrar/test/impl/DummyPNFRegVESMsgConsumer.java @@ -1,4 +1,4 @@ -/******************************************************************************* +/* * ============LICENSE_START======================================================================== * ONAP : ccsdk feature sdnr wt * ================================================================================================= @@ -14,7 +14,7 @@ * or implied. See the License for the specific language governing permissions and limitations under * the License. * ============LICENSE_END========================================================================== - ******************************************************************************/ + */ package org.onap.ccsdk.features.sdnr.wt.mountpointregistrar.test.impl; @@ -23,10 +23,10 @@ import org.onap.ccsdk.features.sdnr.wt.mountpointregistrar.impl.DMaaPVESMsgConsu public class DummyPNFRegVESMsgConsumer extends DMaaPVESMsgConsumerImpl { - @Override - public void processMsg(String msg) throws Exception { - System.out.println("Message received is - "+msg); + @Override + public void processMsg(String msg) throws Exception { + System.out.println("Message received is - " + msg); - } + } } diff --git a/sdnr/wt/mountpoint-registrar/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/mountpointregistrar/test/mock/odlapi/ClusterSingletonServiceProviderMock.java b/sdnr/wt/mountpoint-registrar/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/mountpointregistrar/test/mock/odlapi/ClusterSingletonServiceProviderMock.java index d76b9db93..0b51b995d 100644 --- a/sdnr/wt/mountpoint-registrar/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/mountpointregistrar/test/mock/odlapi/ClusterSingletonServiceProviderMock.java +++ b/sdnr/wt/mountpoint-registrar/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/mountpointregistrar/test/mock/odlapi/ClusterSingletonServiceProviderMock.java @@ -1,4 +1,4 @@ -/******************************************************************************* +/* * ============LICENSE_START======================================================================== * ONAP : ccsdk feature sdnr wt * ================================================================================================= @@ -14,7 +14,7 @@ * or implied. See the License for the specific language governing permissions and limitations under * the License. * ============LICENSE_END========================================================================== - ******************************************************************************/ + */ package org.onap.ccsdk.features.sdnr.wt.mountpointregistrar.test.mock.odlapi; @@ -24,14 +24,14 @@ import org.opendaylight.mdsal.singleton.common.api.ClusterSingletonServiceRegist public class ClusterSingletonServiceProviderMock implements ClusterSingletonServiceProvider { - @Override - public void close() throws Exception { + @Override + public void close() throws Exception { - } + } - @Override - public ClusterSingletonServiceRegistration registerClusterSingletonService(ClusterSingletonService service) { - return null; - } + @Override + public ClusterSingletonServiceRegistration registerClusterSingletonService(ClusterSingletonService service) { + return null; + } } |