Commit includes ControlLoopPolicy API and bugfixes
Change-Id: I3e18bb8b4c31a0d908bb0cff4c85e2a3fb450a63
Signed-off-by: Ravindra Bakkamanthala <rb7147@att.com>
diff --git a/PolicyEngineAPI/src/main/java/org/openecomp/policy/api/PolicyEngine.java b/PolicyEngineAPI/src/main/java/org/openecomp/policy/api/PolicyEngine.java
index 4fad508..4e2c092 100644
--- a/PolicyEngineAPI/src/main/java/org/openecomp/policy/api/PolicyEngine.java
+++ b/PolicyEngineAPI/src/main/java/org/openecomp/policy/api/PolicyEngine.java
@@ -326,8 +326,8 @@
/**
* Retrieves the count of policies on the PAP, PDP, and Policy Engine as a whole
*
- * @param parameters {@link com.att.labs.ecomp.policy.api.MetricsRequestParameters} which represents the Parameters required to get the Policy Metrics
- * @return {@link com.att.labs.ecomp.policy.api.MetricsResponse} which consists of the response related to getMetrics Request.
+ * @param parameters {@link org.openecomp.policy.api.MetricsRequestParameters} which represents the Parameters required to get the Policy Metrics
+ * @return {@link org.openecomp.policy.api.MetricsResponse} which consists of the response related to getMetrics Request.
* @throws PolicyException PolicyException related to the operation
*
* */
diff --git a/PolicyEngineAPI/src/main/java/org/openecomp/policy/std/AutoClientUEB.java b/PolicyEngineAPI/src/main/java/org/openecomp/policy/std/AutoClientUEB.java
index 91d81d0..7821877 100644
--- a/PolicyEngineAPI/src/main/java/org/openecomp/policy/std/AutoClientUEB.java
+++ b/PolicyEngineAPI/src/main/java/org/openecomp/policy/std/AutoClientUEB.java
@@ -22,7 +22,6 @@
import java.net.MalformedURLException;
import java.net.URL;
-import java.security.GeneralSecurityException;
import java.util.List;
import java.util.UUID;
@@ -127,11 +126,9 @@
CConsumer = builder.build();
- } catch (MalformedURLException e1) {
- e1.printStackTrace();
- } catch (GeneralSecurityException e1) {
- e1.printStackTrace();
- }
+ } catch (Exception e1) {
+ logger.error("Exception Occured" + e1);
+ }
while (this.isRunning() )
{
try {
diff --git a/PolicyEngineAPI/src/main/java/org/openecomp/policy/std/ManualClientEndDMAAP.java b/PolicyEngineAPI/src/main/java/org/openecomp/policy/std/ManualClientEndDMAAP.java
index 0e30ada..f4a218d 100644
--- a/PolicyEngineAPI/src/main/java/org/openecomp/policy/std/ManualClientEndDMAAP.java
+++ b/PolicyEngineAPI/src/main/java/org/openecomp/policy/std/ManualClientEndDMAAP.java
@@ -60,7 +60,9 @@
} catch (Exception e) {
logger.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + "Unable to create DMaaP Publisher: ", e);
}
- pub.close ();
+ if(pub != null){
+ pub.close ();
+ }
}
//NOTE: should be able to remove this for DMAAP since we will not be creating topics dynamically
diff --git a/PolicyEngineAPI/src/main/java/org/openecomp/policy/std/ManualClientEndUEB.java b/PolicyEngineAPI/src/main/java/org/openecomp/policy/std/ManualClientEndUEB.java
index f2a6a96..287e5c8 100644
--- a/PolicyEngineAPI/src/main/java/org/openecomp/policy/std/ManualClientEndUEB.java
+++ b/PolicyEngineAPI/src/main/java/org/openecomp/policy/std/ManualClientEndUEB.java
@@ -23,7 +23,6 @@
import java.io.IOException;
import java.net.MalformedURLException;
import java.net.URL;
-import java.security.GeneralSecurityException;
import java.util.List;
import org.json.JSONObject;
@@ -90,10 +89,8 @@
CambriaPublisher pub = null;
try {
pub = CambriaClientFactory.createSimplePublisher(null, UEBlist, pubTopic);
- } catch (MalformedURLException e1) {
- e1.printStackTrace();
- } catch (GeneralSecurityException e1) {
- e1.printStackTrace();
+ } catch (Exception e1) {
+ logger.error("Exception Occured"+e1);
}
final JSONObject msg1 = new JSONObject ();
@@ -135,11 +132,9 @@
String id = "0";
try {
CConsumer = CambriaClientFactory.createConsumer ( null, uebURLList, topic + uniquID, "clientGroup", id, 15*1000, 1000 );
- } catch (MalformedURLException e1) {
- e1.printStackTrace();
- } catch (GeneralSecurityException e1) {
- e1.printStackTrace();
- }
+ } catch (Exception e1) {
+ logger.error("Exception Occured"+e1);
+ }
int count = 1;
while (count < 4) {
publishMessage(topic + "UpdateRequest", uniquID, uebURLList);
diff --git a/PolicyEngineAPI/src/main/java/org/openecomp/policy/std/MatchStore.java b/PolicyEngineAPI/src/main/java/org/openecomp/policy/std/MatchStore.java
index ac3c9e9..1459dd9 100644
--- a/PolicyEngineAPI/src/main/java/org/openecomp/policy/std/MatchStore.java
+++ b/PolicyEngineAPI/src/main/java/org/openecomp/policy/std/MatchStore.java
@@ -34,7 +34,7 @@
import org.openecomp.policy.common.logging.flexlogger.*;
public class MatchStore {
- private static HashSet<Matches> matchStore = new HashSet<Matches>();
+ private static HashSet<Matches> matchStore = new HashSet<>();
private static Logger logger = FlexLogger.getLogger(MatchStore.class.getName());
public static HashSet<Matches> getMatchStore() {
@@ -115,7 +115,7 @@
}
if(oldNotification.getRemovedPolicies()!=null && !oldNotification.getRemovedPolicies().isEmpty()){
// send all removed policies to client.
- Collection<StdRemovedPolicy> removedPolicies = new HashSet<StdRemovedPolicy>();
+ Collection<StdRemovedPolicy> removedPolicies = new HashSet<>();
StdRemovedPolicy newRemovedPolicy;
for(RemovedPolicy removedPolicy: oldNotification.getRemovedPolicies()){
newRemovedPolicy = new StdRemovedPolicy();
@@ -127,7 +127,7 @@
removed = true;
}
if(oldNotification.getLoadedPolicies()!=null && !oldNotification.getLoadedPolicies().isEmpty()){
- Collection<StdLoadedPolicy> updatedPolicies = new HashSet<StdLoadedPolicy>();
+ Collection<StdLoadedPolicy> updatedPolicies = new HashSet<>();
StdLoadedPolicy newUpdatedPolicy;
for(LoadedPolicy updatedPolicy: oldNotification.getLoadedPolicies()){
// if it is config policies check their matches..
diff --git a/PolicyEngineAPI/src/main/java/org/openecomp/policy/std/NotificationUnMarshal.java b/PolicyEngineAPI/src/main/java/org/openecomp/policy/std/NotificationUnMarshal.java
index a09391b..196f89b 100644
--- a/PolicyEngineAPI/src/main/java/org/openecomp/policy/std/NotificationUnMarshal.java
+++ b/PolicyEngineAPI/src/main/java/org/openecomp/policy/std/NotificationUnMarshal.java
@@ -39,7 +39,7 @@
notification = mapper.readValue(json, StdPDPNotification.class);
if(notification!=null){
if(notification.getLoadedPolicies()!=null){
- Collection<StdLoadedPolicy> stdLoadedPolicies = new ArrayList<StdLoadedPolicy>();
+ Collection<StdLoadedPolicy> stdLoadedPolicies = new ArrayList<>();
for(LoadedPolicy loadedPolicy: notification.getLoadedPolicies()){
StdLoadedPolicy stdLoadedPolicy = (StdLoadedPolicy) loadedPolicy;
if(notification.getRemovedPolicies()!=null){
diff --git a/PolicyEngineAPI/src/main/java/org/openecomp/policy/std/StdPolicyEngine.java b/PolicyEngineAPI/src/main/java/org/openecomp/policy/std/StdPolicyEngine.java
index abe5ee7..5b10f30 100644
--- a/PolicyEngineAPI/src/main/java/org/openecomp/policy/std/StdPolicyEngine.java
+++ b/PolicyEngineAPI/src/main/java/org/openecomp/policy/std/StdPolicyEngine.java
@@ -97,9 +97,9 @@
import org.springframework.web.client.RestTemplate;
import org.xml.sax.InputSource;
-import com.att.aft.dme2.internal.gson.Gson;
-import com.att.aft.dme2.internal.gson.GsonBuilder;
import com.fasterxml.jackson.core.JsonProcessingException;
+import com.google.gson.Gson;
+import com.google.gson.GsonBuilder;
/**
* PolicyEngine Implementation class
@@ -565,7 +565,7 @@
public Collection<PolicyConfig> getConfigImpl(ConfigRequestParameters configRequestParameters) throws PolicyConfigException{
String resource= "getConfig";
- ArrayList<PolicyConfig> response = new ArrayList<PolicyConfig>();
+ ArrayList<PolicyConfig> response = new ArrayList<>();
String body = new String();
// Create Request.
try {
@@ -598,7 +598,7 @@
}
private ArrayList<PolicyConfig> configResult(APIPolicyConfigResponse[] response) throws PolicyConfigException {
- ArrayList<PolicyConfig> result = new ArrayList<PolicyConfig>();
+ ArrayList<PolicyConfig> result = new ArrayList<>();
if(response!=null && response.length>0){
for(APIPolicyConfigResponse policyConfigResponse: response){
StdPolicyConfig policyConfig = new StdPolicyConfig();
@@ -647,7 +647,7 @@
private void setMatches(Map<String, String> matchingConditions) {
Matches match = new Matches();
- HashMap<String, String> configAttributes = new HashMap<String,String>();
+ HashMap<String, String> configAttributes = new HashMap<>();
try{
for(String key: matchingConditions.keySet()){
if(key.equalsIgnoreCase("ECOMPName")){
@@ -741,7 +741,7 @@
}
public Collection<String> listConfigImpl(ConfigRequestParameters listRequestParameters) throws PolicyConfigException{
- Collection<String> policyList = new ArrayList<String>();
+ Collection<String> policyList = new ArrayList<>();
if (junit){
policyList.add("Policy Name: listConfigTest");
return policyList;
@@ -796,7 +796,7 @@
}
private ArrayList<PolicyResponse> eventResult(StdPolicyResponse[] response) throws PolicyEventException{
- ArrayList<PolicyResponse> eventResult = new ArrayList<PolicyResponse>();
+ ArrayList<PolicyResponse> eventResult = new ArrayList<>();
if(response!=null && response.length>0){
for(StdPolicyResponse policyConfigResponse: response){
eventResult.add(policyConfigResponse);
@@ -860,7 +860,7 @@
typeDefault = new ArrayList<String>(Arrays.asList(prop.getProperty("NOTIFICATION_TYPE").split(",")));
notificationType = typeDefault;
} else {
- notificationType = new ArrayList<String>();
+ notificationType = new ArrayList<>();
notificationType.add(check_type);
}
}
@@ -873,7 +873,7 @@
if(serverList.contains(",")) {
notificationURLList = new ArrayList<String>(Arrays.asList(serverList.split(",")));
} else {
- notificationURLList = new ArrayList<String>();
+ notificationURLList = new ArrayList<>();
notificationURLList.add(serverList);
}
}
@@ -911,8 +911,8 @@
environment = Environment.DEVL.toString();
}
// Initializing the values.
- pdps = new ArrayList<String>();
- encoding = new ArrayList<String>();
+ pdps = new ArrayList<>();
+ encoding = new ArrayList<>();
// Check the Keys for PDP_URLs
Collection<Object> unsorted = prop.keySet();
@SuppressWarnings({ "rawtypes", "unchecked" })
diff --git a/PolicyEngineAPI/src/main/resources/logback.xml b/PolicyEngineAPI/src/main/resources/logback.xml
index 9e990cc..098db5a 100644
--- a/PolicyEngineAPI/src/main/resources/logback.xml
+++ b/PolicyEngineAPI/src/main/resources/logback.xml
@@ -205,7 +205,7 @@
<maxIndex>9</maxIndex>
</rollingPolicy>
<filter class="ch.qos.logback.classic.filter.ThresholdFilter">
- <level>INFO</level>
+ <level>DEBUG</level>
</filter>
<triggeringPolicy
class="ch.qos.logback.core.rolling.SizeBasedTriggeringPolicy">