Added Controller configuration
[nonrtric.git] / policy-agent / src / test / java / org / oransc / policyagent / clients / A1ClientHelper.java
index e0f885d..1855949 100644 (file)
@@ -40,14 +40,14 @@ import reactor.core.publisher.Mono;
 public class A1ClientHelper {
     private static Gson gson = new GsonBuilder() //
         .setFieldNamingPolicy(FieldNamingPolicy.LOWER_CASE_WITH_DASHES) //
-        .create(); //
+        .create();
 
     private A1ClientHelper() {
     }
 
-    protected static String createInputJsonString(SdncOscAdapterInput inputParams) {
+    protected static <T> String createInputJsonString(T inputParams) {
         JSONObject inputJson = new JSONObject();
-        inputJson.put("input", new JSONObject(gson.toJson(inputParams)));
+        inputJson.put("input", gson.toJson(inputParams));
         return inputJson.toString();
     }
 
@@ -63,6 +63,7 @@ public class A1ClientHelper {
         RicConfig cfg = ImmutableRicConfig.builder().name("ric") //
             .baseUrl(url) //
             .managedElementIds(new Vector<String>(Arrays.asList("kista_1", "kista_2"))) //
+            .controllerName("") //
             .build();
         return new Ric(cfg);
     }
@@ -82,4 +83,10 @@ public class A1ClientHelper {
         return ImmutablePolicyType.builder().name(name).schema("schema").build();
     }
 
+    protected static String getCreateSchema(String policyType, String policyTypeId) {
+        JSONObject obj = new JSONObject(policyType);
+        JSONObject schemaObj = obj.getJSONObject("create_schema");
+        schemaObj.put("title", policyTypeId);
+        return schemaObj.toString();
+    }
 }