Use new get method from A1 API for AC policy
[portal/ric-dashboard.git] / a1-med-client / src / test / java / org / oransc / ric / portal / dashboard / a1med / client / test / A1MediatorClientTest.java
index d8d5193..73a28c8 100644 (file)
@@ -19,6 +19,7 @@
  */
 package org.oransc.ric.portal.dashboard.a1med.client.test;
 
+import org.junit.jupiter.api.Assertions;
 import org.junit.jupiter.api.Test;
 import org.oransc.ric.a1med.client.api.A1MediatorApi;
 import org.oransc.ric.a1med.client.invoker.ApiClient;
@@ -27,7 +28,7 @@ import org.springframework.web.client.RestClientException;
 /**
  * Demonstrates use of the generated A1 mediator client.
  * 
- * The test fails because no server is available.
+ * The tests fail because no server is available.
  */
 public class A1MediatorClientTest {
 
@@ -37,8 +38,18 @@ public class A1MediatorClientTest {
                apiClient.setBasePath("http://localhost:30099/");
                A1MediatorApi a1Api = new A1MediatorApi(apiClient);
                try {
-                       a1Api.a1ControllerGetHandler("policy");
-                       System.out.println("getPolicy answered: " + apiClient.getStatusCode().toString());
+                       Object o = a1Api.a1ControllerGetHandler("policy");
+                       System.out.println(
+                                       "getPolicy answered code {} " + apiClient.getStatusCode().toString() + ", content " + o.toString());
+                       Assertions.assertTrue(apiClient.getStatusCode().is2xxSuccessful());
+               } catch (RestClientException e) {
+                       System.err.println("getPolicy failed: " + e.toString());
+               }
+               try {
+                       String policy = "{}";
+                       a1Api.a1ControllerPutHandler("policy", policy);
+                       System.out.println("putPolicy answered: " + apiClient.getStatusCode().toString());
+                       Assertions.assertTrue(apiClient.getStatusCode().is2xxSuccessful());
                } catch (RestClientException e) {
                        System.err.println("getPolicy failed: " + e.toString());
                }