aboutsummaryrefslogtreecommitdiffstats
path: root/src/test/java/org
diff options
context:
space:
mode:
authormalar <malarvizhi.44@wipro.com>2022-01-19 14:23:36 +0000
committermalar <malarvizhi.44@wipro.com>2022-02-10 06:43:42 +0000
commitd629f558e1fafd8130f265ec3876fa85f5646ae4 (patch)
tree7982a8ec68081a3063d9d9b842ee4bb2c126dc4c /src/test/java/org
parent63ac399a6644702bdf8867cc91ccaabe3644a38f (diff)
Fix bug in triggering control loop for PCI collision/confusion - by replacing Config DB with CPS
Issue-ID: DCAEGEN2-3057 Signed-off-by: Malarvizhi Paramasivam <malarvizhi.44@wipro.com> Change-Id: I122022c1ad7e4dc007e8565bac694813d4a35bef
Diffstat (limited to 'src/test/java/org')
-rw-r--r--src/test/java/org/onap/dcaegen2/services/sonhms/restclient/CpsClientTest.java19
1 files changed, 11 insertions, 8 deletions
diff --git a/src/test/java/org/onap/dcaegen2/services/sonhms/restclient/CpsClientTest.java b/src/test/java/org/onap/dcaegen2/services/sonhms/restclient/CpsClientTest.java
index a531b4d..e43a635 100644
--- a/src/test/java/org/onap/dcaegen2/services/sonhms/restclient/CpsClientTest.java
+++ b/src/test/java/org/onap/dcaegen2/services/sonhms/restclient/CpsClientTest.java
@@ -2,7 +2,7 @@
* ============LICENSE_START=======================================================
* son-handler
* ================================================================================
- * Copyright (C) 2021 Wipro Limited.
+ * Copyright (C) 2021-2022 Wipro Limited.
* ==============================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -103,7 +103,7 @@ public class CpsClientTest {
@Test
public void getPciTest() {
- String responseBody = "{\n" + " \"attribute-name\": \"string\",\n" + " \"value\": 0\n" + "}";
+ String responseBody = "{\n" + " \"nRPCI\": \"11\",\n" + " \"value\": 0\n" + "}";
PowerMockito.mockStatic(SonHandlerRestTemplate.class);
PowerMockito.mockStatic(Configuration.class);
PowerMockito.when(Configuration.getInstance()).thenReturn(configuration);
@@ -116,7 +116,7 @@ public class CpsClientTest {
int result = cps.getPci("1");
String response = ResponseEntity.ok(responseBody).getBody();
JSONObject respObj = new JSONObject(response);
- assertEquals(respObj.getInt("value"), result);
+ assertEquals(respObj.getInt("nRPCI"), result);
} catch (CpsNotFoundException e) {
log.debug("CpsNotFoundException {}", e.toString());
;
@@ -127,7 +127,7 @@ public class CpsClientTest {
@Test
public void getPnfNameTest() {
- String responseBody = "{\n" + " \"attribute-name\": \"string\",\n" + " \"value\": \"string\"\n" + "}";
+ String responseBody = "[{\n" + " \"idGNBCUCPFunction\": \"cucpserver1\",\n" + " \"value\": \"string\"\n" + "}]";
PowerMockito.mockStatic(SonHandlerRestTemplate.class);
PowerMockito.mockStatic(Configuration.class);
PowerMockito.when(Configuration.getInstance()).thenReturn(configuration);
@@ -136,10 +136,13 @@ public class CpsClientTest {
Matchers.<ParameterizedTypeReference<String>>any()))
.thenReturn(ResponseEntity.ok(responseBody));
try {
- String result = cps.getPnfName("1");
+ String result = cps.getPnfName("cucpserver1");
String response = ResponseEntity.ok(responseBody).getBody();
- JSONObject respObj = new JSONObject(response);
- assertEquals(respObj.getString("value"), result);
+
+ JSONArray requestArray = new JSONArray(response);
+ for (int i=0;i<requestArray.length();i++) {
+ assertEquals(requestArray.getJSONObject(i).getString("idGNBCUCPFunction"), result);
+ }
} catch (CpsNotFoundException e) {
log.debug("CpsNotFoundException {}", e.toString());
;
@@ -168,4 +171,4 @@ public class CpsClientTest {
}
-} \ No newline at end of file
+}