From 1ec2a8d3be78a5aba4ba311e917b8d09cf57d7e9 Mon Sep 17 00:00:00 2001 From: Rafal Wrzesniak Date: Wed, 8 Sep 2021 11:25:02 +0200 Subject: 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 Change-Id: Ibf41a7739e5df8254649b56a6bef64be0f1057cc Signed-off-by: Rafal Wrzesniak Issue-ID: CCSDK-3455 --- .../test/TestFaultNotificationClient.java | 13 ++++++++----- .../mountpointregistrar/test/TestPNFMountPointClient.java | 14 +++++++++----- 2 files changed, 17 insertions(+), 10 deletions(-) (limited to 'sdnr/wt/mountpoint-registrar/provider/src/test/java/org') 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 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 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 -- cgit 1.2.3-korg