diff options
author | Rafal Wrzesniak <r.wrzesniak@partner.samsung.com> | 2021-09-08 11:25:02 +0200 |
---|---|---|
committer | Rafal Wrzesniak <r.wrzesniak@partner.samsung.com> | 2021-09-08 11:32:39 +0200 |
commit | 1ec2a8d3be78a5aba4ba311e917b8d09cf57d7e9 (patch) | |
tree | a6d3c1accb8030cc81d4354458d45fb50d4fed3b /sdnr/wt/mountpoint-registrar/provider/src/test/java | |
parent | c7f07d7ef8d70ea520a274914c42b3eeb68bdb3e (diff) |
Move common code from clients to super class
Refactor existing client classes to make them more generic and ready for extensions
Signed-off-by: Rafal Wrzesniak <r.wrzesniak@partner.samsung.com>
Change-Id: Ibf41a7739e5df8254649b56a6bef64be0f1057cc
Signed-off-by: Rafal Wrzesniak <r.wrzesniak@partner.samsung.com>
Issue-ID: CCSDK-3455
Diffstat (limited to 'sdnr/wt/mountpoint-registrar/provider/src/test/java')
2 files changed, 17 insertions, 10 deletions
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 9fb35e6ba..fa289aa4b 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 @@ -3,6 +3,7 @@ * ONAP : ccsdk feature sdnr wt * ================================================================================================= * Copyright (C) 2019 highstreet technologies GmbH Intellectual Property. All rights reserved. + * Copyright (C) 2021 Samsung Electronics Intellectual Property. All rights reserved. * ================================================================================================= * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except * in compliance with the License. You may obtain a copy of the License at @@ -18,7 +19,7 @@ package org.onap.ccsdk.features.sdnr.wt.mountpointregistrar.test; -import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertTrue; import java.io.IOException; import java.util.Map; import javax.annotation.Nonnull; @@ -41,10 +42,12 @@ public class TestFaultNotificationClient extends FaultNotificationClient { 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")); + Map<String, String> payloadMap = FaultNotificationClient.createFaultNotificationPayloadMap( + "TEST_50001", "1", "2019-11-20T09:25:19.948Z", + "SEDNKSAHQ01M01nSky01", "lossOfSignal", "Critical"); + String msg = testClient.prepareMessageFromPayloadMap(payloadMap); + assertTrue(testClient.sendNotification(msg)); + assertTrue(testClient.sendNotification(msg)); } @Override 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 ad87c20d7..9db9071ef 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 @@ -3,6 +3,7 @@ * ONAP : ccsdk feature sdnr wt * ================================================================================================= * Copyright (C) 2019 highstreet technologies GmbH Intellectual Property. All rights reserved. + * Copyright (C) 2021 Samsung Electronics Intellectual Property. All rights reserved. * ================================================================================================= * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except * in compliance with the License. You may obtain a copy of the License at @@ -18,7 +19,7 @@ package org.onap.ccsdk.features.sdnr.wt.mountpointregistrar.test; -import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertTrue; import java.io.IOException; import java.util.Map; import javax.annotation.Nonnull; @@ -41,11 +42,14 @@ public class TestPNFMountPointClient extends PNFMountPointClient { 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")); + Map<String, String> payloadMap = PNFMountPointClient.createPNFNotificationPayloadMap( + "TEST 50001", "127.0.0.1", "TLS", "key_id", + "admin", "admin", "17380"); + String msg = testClient.prepareMessageFromPayloadMap(payloadMap); + + assertTrue(testClient.sendNotification(msg)); + assertTrue(testClient.sendNotification(msg)); - assertEquals(true, - testClient.pnfMountPointCreate("TEST_50001", "127.0.0.1", "SSH", "key_id", "admin", "admin", "17380")); } @Override |