aboutsummaryrefslogtreecommitdiffstats
path: root/a1-policy-management/src/test
diff options
context:
space:
mode:
authorPatrikBuhr <patrik.buhr@est.tech>2021-05-19 13:29:44 +0200
committerPatrikBuhr <patrik.buhr@est.tech>2021-05-19 13:30:05 +0200
commit8b965c4b287a42e6504853f3d85f3a9c82c399b1 (patch)
treeb099b0ce3b435c02b18beb37100cc0e95e0d2b04 /a1-policy-management/src/test
parent9a8965fa835da0639719245e44625e15f165d7d5 (diff)
PMS Bugfix - A1 Istanbul
Bugfix, rejecting putting and getting configuratioon via REST if the consul is used (then the configuration file has no effect).. Issue-ID: CCSDK-3256 Signed-off-by: PatrikBuhr <patrik.buhr@est.tech> Change-Id: Ia3b4a387f450b137b576a9d82ba2f7093a5839ef
Diffstat (limited to 'a1-policy-management/src/test')
-rw-r--r--a1-policy-management/src/test/java/org/onap/ccsdk/oran/a1policymanagementservice/controllers/v2/ApplicationTest.java5
-rw-r--r--a1-policy-management/src/test/java/org/onap/ccsdk/oran/a1policymanagementservice/controllers/v2/ConfigurationControllerTest.java3
-rw-r--r--a1-policy-management/src/test/java/org/onap/ccsdk/oran/a1policymanagementservice/utils/MockA1Client.java2
3 files changed, 5 insertions, 5 deletions
diff --git a/a1-policy-management/src/test/java/org/onap/ccsdk/oran/a1policymanagementservice/controllers/v2/ApplicationTest.java b/a1-policy-management/src/test/java/org/onap/ccsdk/oran/a1policymanagementservice/controllers/v2/ApplicationTest.java
index 91eb6333..9c9331da 100644
--- a/a1-policy-management/src/test/java/org/onap/ccsdk/oran/a1policymanagementservice/controllers/v2/ApplicationTest.java
+++ b/a1-policy-management/src/test/java/org/onap/ccsdk/oran/a1policymanagementservice/controllers/v2/ApplicationTest.java
@@ -283,13 +283,12 @@ class ApplicationTest {
}
@Test
- void testAddingRicFromConfiguration_nonRespondingRic() throws ServiceException {
+ void testAddingRicFromConfiguration_nonRespondingRic() throws Exception {
putService("service");
final String RIC = "NonRespondingRic";
MockA1Client a1Client = a1ClientFactory.getOrCreateA1Client(RIC);
- WebClientResponseException a1Exception = new WebClientResponseException(404, "", null, null, null);
- doReturn(Mono.error(a1Exception)).when(a1Client).getPolicyTypeIdentities();
+ doReturn(MockA1Client.monoError("error", HttpStatus.BAD_GATEWAY)).when(a1Client).getPolicyTypeIdentities();
refreshConfigTask.handleUpdatedRicConfig( //
new RicConfigUpdate(ricConfig(RIC, "me1"), RicConfigUpdate.Type.ADDED)) //
diff --git a/a1-policy-management/src/test/java/org/onap/ccsdk/oran/a1policymanagementservice/controllers/v2/ConfigurationControllerTest.java b/a1-policy-management/src/test/java/org/onap/ccsdk/oran/a1policymanagementservice/controllers/v2/ConfigurationControllerTest.java
index 6192c932..030b831f 100644
--- a/a1-policy-management/src/test/java/org/onap/ccsdk/oran/a1policymanagementservice/controllers/v2/ConfigurationControllerTest.java
+++ b/a1-policy-management/src/test/java/org/onap/ccsdk/oran/a1policymanagementservice/controllers/v2/ConfigurationControllerTest.java
@@ -135,7 +135,8 @@ class ConfigurationControllerTest {
String url = "a1-policy/v2/configuration";
// Valid JSON but invalid configuration.
- testErrorCode(restClient().put(url, "{\"error\":\"error\"}"), HttpStatus.BAD_REQUEST, "Faulty configuration");
+ testErrorCode(restClient().put(url, "{\"error\":\"error\"}"), HttpStatus.BAD_REQUEST,
+ "Missing root configuration");
}
private void testErrorCode(Mono<?> request, HttpStatus expStatus, String responseContains) {
diff --git a/a1-policy-management/src/test/java/org/onap/ccsdk/oran/a1policymanagementservice/utils/MockA1Client.java b/a1-policy-management/src/test/java/org/onap/ccsdk/oran/a1policymanagementservice/utils/MockA1Client.java
index 22ac2437..2a3b28ef 100644
--- a/a1-policy-management/src/test/java/org/onap/ccsdk/oran/a1policymanagementservice/utils/MockA1Client.java
+++ b/a1-policy-management/src/test/java/org/onap/ccsdk/oran/a1policymanagementservice/utils/MockA1Client.java
@@ -124,7 +124,7 @@ public class MockA1Client implements A1Client {
}
}
- Mono<String> monoError(String responseBody, HttpStatus status) {
+ public static Mono<String> monoError(String responseBody, HttpStatus status) {
byte[] responseBodyBytes = responseBody.getBytes(StandardCharsets.UTF_8);
WebClientResponseException a1Exception = new WebClientResponseException(status.value(),
status.getReasonPhrase(), null, responseBodyBytes, StandardCharsets.UTF_8, null);