* empty constructor
* Unnecessary imports
* try-with-resources
* missing @Override
* useless parens
* proper boolean detection
* useless imports
* Use Set vs HashSet
* moving statements to separate lines
Issue-ID: POLICY-477
Change-Id: I5fae9c5c8e7d30f731a1caefc8a5271cf382e0a0
Signed-off-by: Pamela Dragosh <pdragosh@research.att.com>
private static final long serialVersionUID = 4945973094200118969L;
public PolicyEngineException() {
private static final long serialVersionUID = 4945973094200118969L;
public PolicyEngineException() {
}
public PolicyEngineException(String message) {
}
public PolicyEngineException(String message) {
public void setResponseAttributes(Map<String,String> responseAttributes){
this.responseAttributes = responseAttributes;
}
public void setResponseAttributes(Map<String,String> responseAttributes){
this.responseAttributes = responseAttributes;
}
public Map<String,String> getResponseAttributes(){
return responseAttributes;
}
public Map<String,String> getResponseAttributes(){
return responseAttributes;
}
return null;
}
if(scheme.equals(NotificationScheme.MANUAL_ALL_NOTIFICATIONS)) {
return null;
}
if(scheme.equals(NotificationScheme.MANUAL_ALL_NOTIFICATIONS)) {
- boolean removed = false, updated = false;
+ boolean removed = false;
+ boolean updated = false;
if(notification.getRemovedPolicies()!=null && !notification.getRemovedPolicies().isEmpty()){
removed = true;
}
if(notification.getRemovedPolicies()!=null && !notification.getRemovedPolicies().isEmpty()){
removed = true;
}
import java.util.Collection;
import java.util.HashSet;
import java.util.Collection;
import java.util.HashSet;
import org.onap.policy.api.LoadedPolicy;
import org.onap.policy.api.NotificationType;
import org.onap.policy.api.PDPNotification;
import org.onap.policy.api.RemovedPolicy;
import org.onap.policy.api.LoadedPolicy;
import org.onap.policy.api.NotificationType;
import org.onap.policy.api.PDPNotification;
import org.onap.policy.api.RemovedPolicy;
-import org.onap.policy.std.StdLoadedPolicy;
-import org.onap.policy.std.StdPDPNotification;
-import org.onap.policy.std.StdRemovedPolicy;
-
-import org.onap.policy.common.logging.flexlogger.*;
+import org.onap.policy.common.logging.flexlogger.FlexLogger;
+import org.onap.policy.common.logging.flexlogger.Logger;
public class MatchStore {
private static HashSet<Matches> matchStore = new HashSet<>();
public class MatchStore {
private static HashSet<Matches> matchStore = new HashSet<>();
- public static HashSet<Matches> getMatchStore() {
+ public static Set<Matches> getMatchStore() {
}
// IF not a match then add it to the MatchStore
}
// IF not a match then add it to the MatchStore
matchStore.add(newMatch);
}
}
matchStore.add(newMatch);
}
}
try {
switch (policyConfigResponse.getType()) {
case JSON:
try {
switch (policyConfigResponse.getType()) {
case JSON:
- JsonReader jsonReader = Json
- .createReader(new StringReader(policyConfigResponse.getConfig()));
- JsonObject object = jsonReader.readObject();
- jsonReader.close();
- policyConfig.setJsonObject(object);
+ try (JsonReader jsonReader = Json
+ .createReader(new StringReader(policyConfigResponse.getConfig())) ) {
+ JsonObject object = jsonReader.readObject();
+ policyConfig.setJsonObject(object);
+ }
break;
case OTHER:
policyConfig.setOther(policyConfigResponse.getConfig());
break;
case OTHER:
policyConfig.setOther(policyConfigResponse.getConfig());
@Override
public String getPolicyName() {
if(policyName!=null && policyName.contains(".xml")){
@Override
public String getPolicyName() {
if(policyName!=null && policyName.contains(".xml")){
- return (policyName.substring(0, policyName.substring(0, policyName.lastIndexOf('.')).lastIndexOf('.')));
+ return policyName.substring(0, policyName.substring(0, policyName.lastIndexOf('.')).lastIndexOf('.'));
public void setOther(String other) {
this.other = other;
}
public void setOther(String other) {
this.other = other;
}
public PolicyDecision getDecision() {
return policyDecision;
}
public PolicyDecision getDecision() {
return policyDecision;
}
public void setDetails(String details){
this.details = details;
}
public void setDetails(String details){
this.details = details;
}
public String getDetails(){
return details;
}
public String getDetails(){
return details;
}
public PolicyConfigType getPolicyType() {
return type;
}
public PolicyConfigType getPolicyType() {
return type;
}
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertNull;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertNull;
-import java.util.HashSet;
import java.util.Hashtable;
import java.util.Hashtable;
import org.junit.After;
import org.junit.Before;
import org.junit.After;
import org.junit.Before;
public void testGetMatchStore_1()
throws Exception {
public void testGetMatchStore_1()
throws Exception {
- HashSet<Matches> result = MatchStore.getMatchStore();
+ Set<Matches> result = MatchStore.getMatchStore();
// add additional test code here
// An unexpected exception was thrown in user code while executing this test:
// add additional test code here
// An unexpected exception was thrown in user code while executing this test: