Commit includes ControlLoopPolicy API and bugfixes
Change-Id: I3e18bb8b4c31a0d908bb0cff4c85e2a3fb450a63
Signed-off-by: Ravindra Bakkamanthala <rb7147@att.com>
diff --git a/BRMSGateway/src/main/java/org/openecomp/policy/brmsInterface/BRMSHandler.java b/BRMSGateway/src/main/java/org/openecomp/policy/brmsInterface/BRMSHandler.java
index b28624e..ef990aa 100644
--- a/BRMSGateway/src/main/java/org/openecomp/policy/brmsInterface/BRMSHandler.java
+++ b/BRMSGateway/src/main/java/org/openecomp/policy/brmsInterface/BRMSHandler.java
@@ -125,7 +125,6 @@
ArrayList<PolicyConfig> brmsPolicies = addedPolicies(notification);
Boolean successFlag = false;
for(int i=0; !successFlag && i< bRMSPush.URLListSize(); i++){
- successFlag = false;
if(i!=0 && !successFlag){
for(PolicyConfig policyConfig: brmsPolicies){
logger.info("Policy Retry with this Name notified: " + policyConfig.getPolicyName());
@@ -148,7 +147,7 @@
* Executed when a policy is added to PDP.
*/
private ArrayList<PolicyConfig> addedPolicies(PDPNotification notification) {
- ArrayList<PolicyConfig> result = new ArrayList<PolicyConfig>();
+ ArrayList<PolicyConfig> result = new ArrayList<>();
for(LoadedPolicy updatedPolicy: notification.getLoadedPolicies()){
logger.info("policyName : " + updatedPolicy.getPolicyName());
logger.info("policyVersion :" + updatedPolicy.getVersionNo());
diff --git a/BRMSGateway/src/main/java/org/openecomp/policy/brmsInterface/BRMSPush.java b/BRMSGateway/src/main/java/org/openecomp/policy/brmsInterface/BRMSPush.java
index 7e9b64c..1fbd2aa 100644
--- a/BRMSGateway/src/main/java/org/openecomp/policy/brmsInterface/BRMSPush.java
+++ b/BRMSGateway/src/main/java/org/openecomp/policy/brmsInterface/BRMSPush.java
@@ -110,7 +110,7 @@
private static final String DEFAULT_VERSION = "1.1.0-SNAPSHOT";
private static final String DEPENDENCY_FILE = "dependency.json";
- private static Map<String, String> modifiedGroups = new HashMap<String, String>();
+ private static Map<String, String> modifiedGroups = new HashMap<>();
private static IntegrityMonitor im;
private static BackUpMonitor bm;
private static String resourceName = null;
@@ -131,8 +131,8 @@
private Long dmaapDelay = Long.parseLong("5000");
private String notificationType = null;
private ArrayList<ControllerPOJO> controllers;
- private HashMap<String, ArrayList<Object>> groupMap = new HashMap<String, ArrayList<Object>>();
- private Map<String, String> policyMap = new HashMap<String,String>();
+ private HashMap<String, ArrayList<Object>> groupMap = new HashMap<>();
+ private Map<String, String> policyMap = new HashMap<>();
private String brmsdependencyversion;
private EntityManager em;
private boolean syncFlag = false;
@@ -206,7 +206,7 @@
throw new PolicyException(XACMLErrorConstants.ERROR_DATA_ISSUE + "repositoryURL property is missing from the property file ");
}
if(repURL.contains(",")){
- repURLs = new ArrayList<String>(Arrays.asList(repURL.trim().split(",")));
+ repURLs = new ArrayList<>(Arrays.asList(repURL.trim().split(",")));
}else{
repURLs = new ArrayList<>();
repURLs.add(repURL);
@@ -258,9 +258,9 @@
pubTopic = pubTopic.trim();
if(dmaapServers.contains(",")) {
- dmaapList = new ArrayList<String>(Arrays.asList(dmaapServers.split("\\s*,\\s*")));
+ dmaapList = new ArrayList<>(Arrays.asList(dmaapServers.split("\\s*,\\s*")));
} else {
- dmaapList = new ArrayList<String>();
+ dmaapList = new ArrayList<>();
dmaapList.add(dmaapServers);
}
@@ -322,8 +322,8 @@
* Will Initialize the variables required for BRMSPush.
*/
public void initiate(boolean flag) {
- modifiedGroups = new HashMap<String, String>();
- controllers = new ArrayList<ControllerPOJO>();
+ modifiedGroups = new HashMap<>();
+ controllers = new ArrayList<>();
try {
bm.updateNotification();
} catch (Exception e) {
@@ -346,7 +346,7 @@
if(!responseAttributes.isEmpty()){
// Pick selected Value
String userControllerName = null;
- ArrayList<PEDependency> userDependencies = new ArrayList<PEDependency>();
+ ArrayList<PEDependency> userDependencies = new ArrayList<>();
for(String key: responseAttributes.keySet()){
if(key.equals(policyKeyID)){
selectedName = responseAttributes.get(key);
@@ -421,7 +421,7 @@
dependency.setArtifactId(brmsGroupInfo.getArtifactId());
dependency.setGroupId(brmsGroupInfo.getGroupId());
dependency.setVersion(brmsGroupInfo.getVersion());
- ArrayList<Object> values = new ArrayList<Object>();
+ ArrayList<Object> values = new ArrayList<>();
values.add(dependency);
groupMap.put(brmsGroupInfo.getControllerName(), values);
}
@@ -756,7 +756,7 @@
ControllerPOJO controllerPOJO = new ControllerPOJO();
controllerPOJO.setName(controllerName);
controllerPOJO.setOperation(operation);
- HashMap<String, String> drools = new HashMap<String, String>();
+ HashMap<String, String> drools = new HashMap<>();
drools.put("groupId", getGroupID(controllerName));
drools.put("artifactId", getArtifactID(controllerName));
drools.put("version", getVersion(controllerName));
@@ -776,7 +776,7 @@
ControllerPOJO controllerPOJO = new ControllerPOJO();
controllerPOJO.setName(controllerName);
controllerPOJO.setOperation("lock");
- List<ControllerPOJO> controllers = new ArrayList<ControllerPOJO>();
+ List<ControllerPOJO> controllers = new ArrayList<>();
controllers.add(controllerPOJO);
sendNotification(controllers);
}
@@ -841,7 +841,7 @@
distributionManagement.setRepository(repository);
model.setDistributionManagement(distributionManagement);
// Dependency Management goes here.
- List<Dependency> dependencyList= new ArrayList<Dependency>();
+ List<Dependency> dependencyList= new ArrayList<>();
if(groupMap.get(name).size()>1){
@SuppressWarnings("unchecked")
ArrayList<PEDependency> dependencies = (ArrayList<PEDependency>) groupMap.get(name).get(1);
@@ -880,7 +880,7 @@
if(dependencyInfo.getDependencies().containsKey(controllerName)){
controller = controllerName;
}
- List<Dependency> dependencyList = new ArrayList<Dependency>();
+ List<Dependency> dependencyList = new ArrayList<>();
for(PEDependency dependency: dependencyInfo.getDependencies().get(controller)){
dependencyList.add(dependency.getDependency());
}
@@ -897,7 +897,7 @@
// Default Dependency Section. Can be changed as required.
public List<Dependency> defaultDependencies(String controllerName) {
- List<Dependency> dependencyList = new ArrayList<Dependency>();
+ List<Dependency> dependencyList = new ArrayList<>();
String version= StringEscapeUtils.escapeJava(brmsdependencyversion);
Dependency demoDependency = new Dependency();
@@ -977,7 +977,7 @@
LOGGER.error(XACMLErrorConstants.ERROR_DATA_ISSUE + "groupNames property is missing or empty from the property file ");
throw new PolicyException(XACMLErrorConstants.ERROR_DATA_ISSUE + "groupNames property is missing or empty from the property file ");
}
- groupMap = new HashMap<String, ArrayList<Object>>();
+ groupMap = new HashMap<>();
for(int counter=0; counter < groupNames.length ;counter++){
String name = groupNames[counter];
String groupID = config.getProperty(name+".groupID");
@@ -999,7 +999,7 @@
}
private void addToGroup(String name, PEDependency dependency) {
- ArrayList<Object> values = new ArrayList<Object>();
+ ArrayList<Object> values = new ArrayList<>();
values.add(dependency);
groupMap.put(name, values);
EntityTransaction et = em.getTransaction();
diff --git a/BRMSGateway/src/main/resources/logback.xml b/BRMSGateway/src/main/resources/logback.xml
index 2c67db9..2cae6c8 100644
--- a/BRMSGateway/src/main/resources/logback.xml
+++ b/BRMSGateway/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">