Remove dmaap from models
[policy/models.git] / models-sim / policy-models-sim-pdp / src / test / java / org / onap / policy / models / sim / pdp / parameters / CommonTestData.java
index e0da3d8..a6b136b 100644 (file)
@@ -1,6 +1,6 @@
 /*-
  * ============LICENSE_START=======================================================
- *  Copyright (C) 2019 Nordix Foundation.
+ *  Copyright (C) 2019-2020, 2024 Nordix Foundation.
  *  Modifications Copyright (C) 2019 AT&T Intellectual Property. All rights reserved.
  * ================================================================================
  * Licensed under the Apache License, Version 2.0 (the "License");
 
 package org.onap.policy.models.sim.pdp.parameters;
 
-import java.util.Arrays;
 import java.util.List;
 import java.util.Map;
 import java.util.TreeMap;
-
+import org.onap.policy.common.endpoints.parameters.TopicParameters;
 import org.onap.policy.common.parameters.ParameterGroup;
 import org.onap.policy.common.utils.coder.Coder;
 import org.onap.policy.common.utils.coder.CoderException;
@@ -43,17 +42,18 @@ public class CommonTestData {
     public static final String PDP_NAME = "apex-pdp";
     public static final String VERSION = "0.0.1";
     public static final String PDP_TYPE = "apex";
+    public static final String PDP_GROUP = "defaultGroup";
     public static final String DESCRIPTION = "Pdp status for HealthCheck";
     public static final String POLICY_NAME = "onap.controllloop.operational.apex.BBS";
     public static final String POLICY_VERSION = "0.0.1";
     protected static final List<ToscaPolicyTypeIdentifierParameters> SUPPORTED_POLICY_TYPES =
-            Arrays.asList(getSupportedPolicyTypes(POLICY_NAME, POLICY_VERSION));
+        List.of(getSupportedPolicyTypes(POLICY_NAME, POLICY_VERSION));
+    public static final List<TopicParameters> TOPIC_PARAMS = List.of(getTopicParams());
     private static final String REST_SERVER_PASS = "zb!XztG34";
     private static final String REST_SERVER_USER = "healthcheck";
     private static final int REST_SERVER_PORT = 6969;
     private static final String REST_SERVER_HOST = "0.0.0.0";
     private static final boolean REST_SERVER_HTTPS = true;
-    private static final boolean REST_SERVER_AAF = false;
 
     public static final Coder coder = new StandardCoder();
 
@@ -69,6 +69,19 @@ public class CommonTestData {
         return policyTypeIdentParameters;
     }
 
+    /**
+     * Returns topic parameters for test cases.
+     *
+     * @return topic parameters
+     */
+    public static TopicParameters getTopicParams() {
+        final TopicParameters topicParams = new TopicParameters();
+        topicParams.setTopic("POLICY-PDP-PAP");
+        topicParams.setTopicCommInfrastructure("kafka");
+        topicParams.setServers(List.of("localhost:9092"));
+        return topicParams;
+    }
+
     /**
      * Converts the contents of a map to a parameter class.
      *
@@ -98,7 +111,7 @@ public class CommonTestData {
         map.put("name", name);
         map.put("restServerParameters", getRestServerParametersMap(false));
         map.put("pdpStatusParameters", getPdpStatusParametersMap(false));
-
+        map.put("topicParameterGroup", getTopicParametersMap(false));
         return map;
     }
 
@@ -111,7 +124,6 @@ public class CommonTestData {
     public Map<String, Object> getRestServerParametersMap(final boolean isEmpty) {
         final Map<String, Object> map = new TreeMap<>();
         map.put("https", REST_SERVER_HTTPS);
-        map.put("aaf", REST_SERVER_AAF);
 
         if (!isEmpty) {
             map.put("host", REST_SERVER_HOST);
@@ -136,10 +148,26 @@ public class CommonTestData {
             map.put("pdpName", PDP_NAME);
             map.put("version", VERSION);
             map.put("pdpType", PDP_TYPE);
+            map.put("pdpGroup", PDP_GROUP);
             map.put("description", DESCRIPTION);
             map.put("supportedPolicyTypes", SUPPORTED_POLICY_TYPES);
         }
 
         return map;
     }
+
+    /**
+     * Returns a property map for a TopicParameters map for test cases.
+     *
+     * @param isEmpty boolean value to represent that object created should be empty or not
+     * @return a property map suitable for constructing an object
+     */
+    public Map<String, Object> getTopicParametersMap(final boolean isEmpty) {
+        final Map<String, Object> map = new TreeMap<>();
+        if (!isEmpty) {
+            map.put("topicSources", TOPIC_PARAMS);
+            map.put("topicSinks", TOPIC_PARAMS);
+        }
+        return map;
+    }
 }