summaryrefslogtreecommitdiffstats
path: root/PolicyEngineClient/src/main/java/org
diff options
context:
space:
mode:
authorRavindra Bakkamanthala <rb7147@att.com>2017-05-23 14:56:12 -0400
committerRavindra Bakkamanthala <rb7147@att.com>2017-05-23 16:49:56 -0400
commit87c95be02a8a4d77e165dede90777e811b59dcae (patch)
tree4712199fc3520b530dda0c4d3b074c327df547f2 /PolicyEngineClient/src/main/java/org
parent7e547eaa55920dfbc9691eab33bb728395b50cf2 (diff)
Commit includes ControlLoopPolicy API and bugfixes
Change-Id: I3e18bb8b4c31a0d908bb0cff4c85e2a3fb450a63 Signed-off-by: Ravindra Bakkamanthala <rb7147@att.com>
Diffstat (limited to 'PolicyEngineClient/src/main/java/org')
-rw-r--r--PolicyEngineClient/src/main/java/org/openecomp/policyEngine/ActionPolicyClient.java12
-rw-r--r--PolicyEngineClient/src/main/java/org/openecomp/policyEngine/BrmsParamPolicyClient.java7
-rw-r--r--PolicyEngineClient/src/main/java/org/openecomp/policyEngine/BrmsRawPolicyClient.java4
-rw-r--r--PolicyEngineClient/src/main/java/org/openecomp/policyEngine/ConfigBasePolicyClient.java4
-rw-r--r--PolicyEngineClient/src/main/java/org/openecomp/policyEngine/DecisionPolicyClient.java14
-rw-r--r--PolicyEngineClient/src/main/java/org/openecomp/policyEngine/GeneralTestClient.java10
-rw-r--r--PolicyEngineClient/src/main/java/org/openecomp/policyEngine/ListConfigPoliciesClient.java2
-rw-r--r--PolicyEngineClient/src/main/java/org/openecomp/policyEngine/MainClient.java10
-rw-r--r--PolicyEngineClient/src/main/java/org/openecomp/policyEngine/PolicyEngineTestClient.java6
9 files changed, 33 insertions, 36 deletions
diff --git a/PolicyEngineClient/src/main/java/org/openecomp/policyEngine/ActionPolicyClient.java b/PolicyEngineClient/src/main/java/org/openecomp/policyEngine/ActionPolicyClient.java
index 37d25f2b9..18de85bd4 100644
--- a/PolicyEngineClient/src/main/java/org/openecomp/policyEngine/ActionPolicyClient.java
+++ b/PolicyEngineClient/src/main/java/org/openecomp/policyEngine/ActionPolicyClient.java
@@ -46,21 +46,21 @@ public class ActionPolicyClient {
//policyParameters.setPolicyScope("MikeAPItesting"); //Directory will be created where the Policies are saved... this displays a a subscope on the GUI
//Set the Component Attributes... These are Optional
- Map<String, String> configAttributes = new HashMap<String, String>();
+ Map<String, String> configAttributes = new HashMap<>();
configAttributes.put("Template", "UpdateTemplate");
configAttributes.put("controller", "default");
configAttributes.put("SamPoll", "30");
configAttributes.put("value", "abcd");
- Map<AttributeType, Map<String,String>> attributes = new HashMap<AttributeType, Map<String,String>>();
+ Map<AttributeType, Map<String,String>> attributes = new HashMap<>();
attributes.put(AttributeType.MATCHING, configAttributes);
policyParameters.setAttributes(attributes);
- List<String> dynamicRuleAlgorithmLabels = new LinkedList<String>();
- List<String> dynamicRuleAlgorithmFunctions = new LinkedList<String>();
- List<String> dynamicRuleAlgorithmField1 = new LinkedList<String>();
- List<String> dynamicRuleAlgorithmField2 = new LinkedList<String>();
+ List<String> dynamicRuleAlgorithmLabels = new LinkedList<>();
+ List<String> dynamicRuleAlgorithmFunctions = new LinkedList<>();
+ List<String> dynamicRuleAlgorithmField1 = new LinkedList<>();
+ List<String> dynamicRuleAlgorithmField2 = new LinkedList<>();
//Example of a complex Rule algorithm
/* label field1 function field2
diff --git a/PolicyEngineClient/src/main/java/org/openecomp/policyEngine/BrmsParamPolicyClient.java b/PolicyEngineClient/src/main/java/org/openecomp/policyEngine/BrmsParamPolicyClient.java
index 3d80fe2ef..790c8e893 100644
--- a/PolicyEngineClient/src/main/java/org/openecomp/policyEngine/BrmsParamPolicyClient.java
+++ b/PolicyEngineClient/src/main/java/org/openecomp/policyEngine/BrmsParamPolicyClient.java
@@ -62,16 +62,13 @@ public class BrmsParamPolicyClient {
// Set description of the policy(Optional)
policyParameters.setPolicyDescription("This is a sample BRMS Param policy creation example");
- //Set Scope folder where the policy needs to be created(Mandatory)
- //policyParameters.setPolicyScope("Lakshman");
-
// Set BRMS Param Template Attributes(Mandatory)
- Map<String, String> ruleAttributes = new HashMap<String, String>();
+ Map<String, String> ruleAttributes = new HashMap<>();
ruleAttributes.put("templateName", "Sample"); // This sampleTemplate is the Template name from dictionary.
ruleAttributes.put("controller", "default"); // Set Rule to a PDP Controller, default is the controller name.
ruleAttributes.put("SamPoll", "300"); // Template specific key and value set by us.
ruleAttributes.put("value", "abcd"); // Template specific key and value set by us.
- Map<AttributeType, Map<String, String>> attributes = new HashMap<AttributeType, Map<String, String>>();
+ Map<AttributeType, Map<String, String>> attributes = new HashMap<>();
attributes.put(AttributeType.RULE, ruleAttributes);
policyParameters.setAttributes(attributes);
diff --git a/PolicyEngineClient/src/main/java/org/openecomp/policyEngine/BrmsRawPolicyClient.java b/PolicyEngineClient/src/main/java/org/openecomp/policyEngine/BrmsRawPolicyClient.java
index 478b7e96a..c144e1989 100644
--- a/PolicyEngineClient/src/main/java/org/openecomp/policyEngine/BrmsRawPolicyClient.java
+++ b/PolicyEngineClient/src/main/java/org/openecomp/policyEngine/BrmsRawPolicyClient.java
@@ -66,10 +66,10 @@ public class BrmsRawPolicyClient {
try {
PolicyEngine policyEngine = new PolicyEngine("config.properties");
PolicyParameters policyParameters = new PolicyParameters();
- Map<String, String> attrib= new HashMap<String,String>();
+ Map<String, String> attrib= new HashMap<>();
attrib.put("cpu","80");
attrib.put("memory", "50");
- Map<AttributeType, Map<String, String>> attributes = new HashMap<AttributeType, Map<String, String>>();
+ Map<AttributeType, Map<String, String>> attributes = new HashMap<>();
attributes.put(AttributeType.RULE, attrib);
// Set Policy Type
diff --git a/PolicyEngineClient/src/main/java/org/openecomp/policyEngine/ConfigBasePolicyClient.java b/PolicyEngineClient/src/main/java/org/openecomp/policyEngine/ConfigBasePolicyClient.java
index dcaaaf188..a3903806c 100644
--- a/PolicyEngineClient/src/main/java/org/openecomp/policyEngine/ConfigBasePolicyClient.java
+++ b/PolicyEngineClient/src/main/java/org/openecomp/policyEngine/ConfigBasePolicyClient.java
@@ -50,12 +50,12 @@ public class ConfigBasePolicyClient{
//policyParameters.setPolicyScope("MikeConsole"); //Directory will be created where the Policies are saved... this displays a a subscope on the GUI
//Set the Config Attributes... These are Optional
- Map<String, String> configAttributes = new HashMap<String, String>();
+ Map<String, String> configAttributes = new HashMap<>();
configAttributes.put("Template", "SampleTemplate");
configAttributes.put("controller", "default");
configAttributes.put("SamPoll", "30");
configAttributes.put("value", "abcd");
- Map<AttributeType, Map<String,String>> attributes = new HashMap<AttributeType, Map<String,String>>();
+ Map<AttributeType, Map<String,String>> attributes = new HashMap<>();
attributes.put(AttributeType.MATCHING, configAttributes);
policyParameters.setAttributes(attributes);
policyParameters.setRequestID(UUID.randomUUID());
diff --git a/PolicyEngineClient/src/main/java/org/openecomp/policyEngine/DecisionPolicyClient.java b/PolicyEngineClient/src/main/java/org/openecomp/policyEngine/DecisionPolicyClient.java
index 6b0b02eee..428a2ca03 100644
--- a/PolicyEngineClient/src/main/java/org/openecomp/policyEngine/DecisionPolicyClient.java
+++ b/PolicyEngineClient/src/main/java/org/openecomp/policyEngine/DecisionPolicyClient.java
@@ -47,27 +47,27 @@ public class DecisionPolicyClient {
//policyParameters.setPolicyScope("MikeAPItests"); //Directory will be created where the Policies are saved... this displays a a subscope on the GUI
//Set the Component Attributes... These are Optional
- Map<String, String> configAttributes = new HashMap<String, String>();
+ Map<String, String> configAttributes = new HashMap<>();
configAttributes.put("Template", "UpdateTemplate");
configAttributes.put("controller", "default");
configAttributes.put("SamPoll", "30");
configAttributes.put("value", "abcd");
- Map<AttributeType, Map<String,String>> attributes = new HashMap<AttributeType, Map<String,String>>();
+ Map<AttributeType, Map<String,String>> attributes = new HashMap<>();
attributes.put(AttributeType.MATCHING, configAttributes);
//Set the settings... These are Optional
- Map<String, String> settingsMap = new HashMap<String, String>();
+ Map<String, String> settingsMap = new HashMap<>();
settingsMap.put("server", "5");
attributes.put(AttributeType.SETTINGS, settingsMap);
policyParameters.setAttributes(attributes);
- List<String> dynamicRuleAlgorithmLabels = new LinkedList<String>();
- List<String> dynamicRuleAlgorithmFunctions = new LinkedList<String>();
- List<String> dynamicRuleAlgorithmField1 = new LinkedList<String>();
- List<String> dynamicRuleAlgorithmField2 = new LinkedList<String>();
+ List<String> dynamicRuleAlgorithmLabels = new LinkedList<>();
+ List<String> dynamicRuleAlgorithmFunctions = new LinkedList<>();
+ List<String> dynamicRuleAlgorithmField1 = new LinkedList<>();
+ List<String> dynamicRuleAlgorithmField2 = new LinkedList<>();
//Example of a complex Rule algorithm using the settings in the Field1
/* label field1 function field2
diff --git a/PolicyEngineClient/src/main/java/org/openecomp/policyEngine/GeneralTestClient.java b/PolicyEngineClient/src/main/java/org/openecomp/policyEngine/GeneralTestClient.java
index 6ca340efe..4298e8167 100644
--- a/PolicyEngineClient/src/main/java/org/openecomp/policyEngine/GeneralTestClient.java
+++ b/PolicyEngineClient/src/main/java/org/openecomp/policyEngine/GeneralTestClient.java
@@ -126,8 +126,8 @@ public class GeneralTestClient {
for (Object jsonObject : jsonObjectArray) {
totalTC++;
totalTCforFile++;
- ArrayList<String> expectedResult = new ArrayList<String>();
- ArrayList<String> resultReceived = new ArrayList<String>();
+ ArrayList<String> expectedResult = new ArrayList<>();
+ ArrayList<String> resultReceived = new ArrayList<>();
JSONObject testCase = (JSONObject) jsonObject;
// get a String from the JSON object
long id = (long) testCase.get("id");
@@ -155,7 +155,7 @@ public class GeneralTestClient {
.get("ECOMPName");
String configName = (String) testCase
.get("ConfigName");
- Map<String, String> configAttributes = new HashMap<String, String>();
+ Map<String, String> configAttributes = new HashMap<>();
configAttributes.put("key", "value");
JSONArray configAttributesJSON = (JSONArray) testCase
.get("configAttributes");
@@ -191,7 +191,7 @@ public class GeneralTestClient {
break;
case "getAction":
- Map<String, String> eventAttributes = new HashMap<String, String>();
+ Map<String, String> eventAttributes = new HashMap<>();
eventAttributes.put("Key", "Value");
JSONArray eventAttributesJSON = (JSONArray) testCase
.get("eventAttributes");
@@ -228,7 +228,7 @@ public class GeneralTestClient {
case "getDecision":
eCOMPComponentName = (String) testCase
.get("ECOMPName");
- Map<String, String> decisionAttributes = new HashMap<String, String>();
+ Map<String, String> decisionAttributes = new HashMap<>();
decisionAttributes.put("Key", "Value");
JSONArray decisionAttributesJSON = (JSONArray) testCase
.get("decisionAttributes");
diff --git a/PolicyEngineClient/src/main/java/org/openecomp/policyEngine/ListConfigPoliciesClient.java b/PolicyEngineClient/src/main/java/org/openecomp/policyEngine/ListConfigPoliciesClient.java
index b9fd15282..497ff84a1 100644
--- a/PolicyEngineClient/src/main/java/org/openecomp/policyEngine/ListConfigPoliciesClient.java
+++ b/PolicyEngineClient/src/main/java/org/openecomp/policyEngine/ListConfigPoliciesClient.java
@@ -48,7 +48,7 @@ public class ListConfigPoliciesClient {
parameters.setEcompName(".*");
parameters.setConfigName(".*");
- Map<String, String> configAttributes = new HashMap<String,String>();
+ Map<String, String> configAttributes = new HashMap<>();
configAttributes.put("java", "java");
configAttributes.put("peach", "Tar");
configAttributes.put("true", "false");
diff --git a/PolicyEngineClient/src/main/java/org/openecomp/policyEngine/MainClient.java b/PolicyEngineClient/src/main/java/org/openecomp/policyEngine/MainClient.java
index eb6197041..d17f0c649 100644
--- a/PolicyEngineClient/src/main/java/org/openecomp/policyEngine/MainClient.java
+++ b/PolicyEngineClient/src/main/java/org/openecomp/policyEngine/MainClient.java
@@ -53,15 +53,15 @@ public class MainClient {
PolicyEngine policyEngine;
try {
policyEngine = new PolicyEngine("config.properties");
- Map<String, String> configAttributes = new HashMap<String,String>();
+ Map<String, String> configAttributes = new HashMap<>();
configAttributes.put("java", "java");
configAttributes.put("peach", "Tar");
configAttributes.put("true", "false");
configAttributes.put("small", "testPass");
- Map<String, String> eventAttributes = new HashMap<String,String>();
+ Map<String, String> eventAttributes = new HashMap<>();
eventAttributes.put("true", "true");
eventAttributes.put("cpu", "91");
- Map<String, String> decisionAttributes = new HashMap<String,String>();
+ Map<String, String> decisionAttributes = new HashMap<>();
decisionAttributes.put("Key", "Value");
// Config Example
@@ -102,11 +102,11 @@ public class MainClient {
try {
System.in.read();
} catch (IOException e) {
- //
+ System.err.println("Exception Occured"+e);
}
} catch (PolicyEngineException e1) {
- e1.printStackTrace();
+ System.err.println("Exception Occured"+e1);
}
}
diff --git a/PolicyEngineClient/src/main/java/org/openecomp/policyEngine/PolicyEngineTestClient.java b/PolicyEngineClient/src/main/java/org/openecomp/policyEngine/PolicyEngineTestClient.java
index ecdb1666f..a56145214 100644
--- a/PolicyEngineClient/src/main/java/org/openecomp/policyEngine/PolicyEngineTestClient.java
+++ b/PolicyEngineClient/src/main/java/org/openecomp/policyEngine/PolicyEngineTestClient.java
@@ -71,7 +71,7 @@ public class PolicyEngineTestClient {
public static ArrayList<String> getConfig(PolicyEngine policyEngine,
String eCOMPComponentName, String configName,
Map<String, String> configAttributes) {
- ArrayList<String> resultReceived = new ArrayList<String>();
+ ArrayList<String> resultReceived = new ArrayList<>();
try {
UUID requestID = UUID.randomUUID();
Collection<PolicyConfig> policyConfigs;
@@ -114,7 +114,7 @@ public class PolicyEngineTestClient {
*/
public static ArrayList<String> getDecision(PolicyEngine policyEngine,
String eCOMPComponentName, Map<String, String> decisionAttributes) {
- ArrayList<String> resultReceived = new ArrayList<String>();
+ ArrayList<String> resultReceived = new ArrayList<>();
// Decision example
try {
UUID requestID = UUID.randomUUID();
@@ -139,7 +139,7 @@ public class PolicyEngineTestClient {
*/
public static ArrayList<String> getAction(PolicyEngine policyEngine,
Map<String, String> eventAttributes) {
- ArrayList<String> resultReceived = new ArrayList<String>();
+ ArrayList<String> resultReceived = new ArrayList<>();
try {
UUID requestID = UUID.randomUUID();
@SuppressWarnings("deprecation")