summaryrefslogtreecommitdiffstats
path: root/PolicyEngineAPI
diff options
context:
space:
mode:
Diffstat (limited to 'PolicyEngineAPI')
-rw-r--r--PolicyEngineAPI/pom.xml13
-rw-r--r--PolicyEngineAPI/src/main/java/org/openecomp/policy/api/PolicyEngine.java4
-rw-r--r--PolicyEngineAPI/src/main/java/org/openecomp/policy/std/AutoClientUEB.java9
-rw-r--r--PolicyEngineAPI/src/main/java/org/openecomp/policy/std/ManualClientEndDMAAP.java4
-rw-r--r--PolicyEngineAPI/src/main/java/org/openecomp/policy/std/ManualClientEndUEB.java15
-rw-r--r--PolicyEngineAPI/src/main/java/org/openecomp/policy/std/MatchStore.java6
-rw-r--r--PolicyEngineAPI/src/main/java/org/openecomp/policy/std/NotificationUnMarshal.java2
-rw-r--r--PolicyEngineAPI/src/main/java/org/openecomp/policy/std/StdPolicyEngine.java22
-rw-r--r--PolicyEngineAPI/src/main/resources/logback.xml2
9 files changed, 42 insertions, 35 deletions
diff --git a/PolicyEngineAPI/pom.xml b/PolicyEngineAPI/pom.xml
index a0e66f17d..f0bffb5de 100644
--- a/PolicyEngineAPI/pom.xml
+++ b/PolicyEngineAPI/pom.xml
@@ -88,6 +88,11 @@
<version>4.3.3.RELEASE</version>
</dependency>
<dependency>
+ <groupId>com.google.code.gson</groupId>
+ <artifactId>gson</artifactId>
+ <version>2.8.0</version>
+ </dependency>
+ <dependency>
<groupId>log4j</groupId>
<artifactId>log4j</artifactId>
<version>1.2.17</version>
@@ -112,6 +117,14 @@
<groupId>org.powermock</groupId>
<artifactId>powermock-api-mockito</artifactId>
</exclusion>
+ <exclusion>
+ <groupId>com.att.aft</groupId>
+ <artifactId>dme2</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>com.att.cadi</groupId>
+ <artifactId>cadi-aaf</artifactId>
+ </exclusion>
</exclusions>
</dependency>
<!-- https://mvnrepository.com/artifact/org.mockito/mockito-all -->
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 4fad508f6..4e2c092c1 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 @@ public class PolicyEngine{
/**
* 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 91d81d043..782187720 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 @@ package org.openecomp.policy.std;
import java.net.MalformedURLException;
import java.net.URL;
-import java.security.GeneralSecurityException;
import java.util.List;
import java.util.UUID;
@@ -127,11 +126,9 @@ public class AutoClientUEB implements Runnable {
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 0e30ada39..f4a218d66 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 @@ public class ManualClientEndDMAAP {
} 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 f2a6a96d8..287e5c851 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 @@ package org.openecomp.policy.std;
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 @@ public class ManualClientEndUEB {
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 @@ public class ManualClientEndUEB {
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 ac3c9e968..1459dd9d9 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.std.StdRemovedPolicy;
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 @@ public class MatchStore {
}
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 @@ public class MatchStore {
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 a09391baf..196f89b3d 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 @@ public class NotificationUnMarshal {
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 abe5ee767..5b10f3066 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.HttpClientErrorException;
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 class StdPolicyEngine {
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 @@ public class StdPolicyEngine {
}
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 @@ public class StdPolicyEngine {
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 class StdPolicyEngine {
}
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 @@ public class StdPolicyEngine {
}
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 @@ public class StdPolicyEngine {
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 @@ public class StdPolicyEngine {
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 @@ public class StdPolicyEngine {
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 9e990ccd3..098db5a54 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">