aboutsummaryrefslogtreecommitdiffstats
path: root/policy-management/src/main/java
diff options
context:
space:
mode:
authorPamela Dragosh <pdragosh@research.att.com>2017-09-19 07:34:04 -0400
committerPamela Dragosh <pdragosh@research.att.com>2017-09-19 07:35:25 -0400
commit38bd1bffbed6faa272bf435c9936e3a99287372e (patch)
tree911517d6606281d35ab94fa0d36c9f2c6c10ea16 /policy-management/src/main/java
parentde75812664012694f42d1decb9409955683dbbb9 (diff)
Adding JUnits for Configuration Classes
Also fixed some Sonar Major issues to help clean that up. Issue-ID: POLICY-109 Change-Id: Ic8a0b8d97f2be1cc1f8e8e4e8b319c6117b231a4 Signed-off-by: Pamela Dragosh <pdragosh@research.att.com>
Diffstat (limited to 'policy-management/src/main/java')
-rw-r--r--policy-management/src/main/java/org/onap/policy/drools/protocol/configuration/ControllerConfiguration.java3
-rw-r--r--policy-management/src/main/java/org/onap/policy/drools/protocol/configuration/DroolsConfiguration.java17
-rw-r--r--policy-management/src/main/java/org/onap/policy/drools/protocol/configuration/PdpdConfiguration.java21
3 files changed, 22 insertions, 19 deletions
diff --git a/policy-management/src/main/java/org/onap/policy/drools/protocol/configuration/ControllerConfiguration.java b/policy-management/src/main/java/org/onap/policy/drools/protocol/configuration/ControllerConfiguration.java
index ded7a52c..b0b8b504 100644
--- a/policy-management/src/main/java/org/onap/policy/drools/protocol/configuration/ControllerConfiguration.java
+++ b/policy-management/src/main/java/org/onap/policy/drools/protocol/configuration/ControllerConfiguration.java
@@ -67,7 +67,7 @@ public class ControllerConfiguration {
@JsonProperty("drools")
private DroolsConfiguration drools;
@JsonIgnore
- private Map<String, Object> additionalProperties = new HashMap<String, Object>();
+ private Map<String, Object> additionalProperties = new HashMap<>();
protected final static Object NOT_FOUND_VALUE = new Object();
/**
@@ -75,6 +75,7 @@ public class ControllerConfiguration {
*
*/
public ControllerConfiguration() {
+ // Empty
}
/**
diff --git a/policy-management/src/main/java/org/onap/policy/drools/protocol/configuration/DroolsConfiguration.java b/policy-management/src/main/java/org/onap/policy/drools/protocol/configuration/DroolsConfiguration.java
index 5f32d7a4..4c672e7b 100644
--- a/policy-management/src/main/java/org/onap/policy/drools/protocol/configuration/DroolsConfiguration.java
+++ b/policy-management/src/main/java/org/onap/policy/drools/protocol/configuration/DroolsConfiguration.java
@@ -63,7 +63,7 @@ public class DroolsConfiguration {
@JsonProperty("version")
private String version;
@JsonIgnore
- private Map<String, Object> additionalProperties = new HashMap<String, Object>();
+ private Map<String, Object> additionalProperties = new HashMap<>();
protected final static Object NOT_FOUND_VALUE = new Object();
/**
@@ -71,6 +71,7 @@ public class DroolsConfiguration {
*
*/
public DroolsConfiguration() {
+ // Empty
}
/**
@@ -196,21 +197,21 @@ public class DroolsConfiguration {
switch (name) {
case "artifactId":
if (value instanceof String) {
- setArtifactId(((String) value));
+ setArtifactId((String) value);
} else {
throw new IllegalArgumentException(("property \"artifactId\" is of type \"java.lang.String\", but got "+ value.getClass().toString()));
}
return true;
case "groupId":
if (value instanceof String) {
- setGroupId(((String) value));
+ setGroupId((String) value);
} else {
throw new IllegalArgumentException(("property \"groupId\" is of type \"java.lang.String\", but got "+ value.getClass().toString()));
}
return true;
case "version":
if (value instanceof String) {
- setVersion(((String) value));
+ setVersion((String) value);
} else {
throw new IllegalArgumentException(("property \"version\" is of type \"java.lang.String\", but got "+ value.getClass().toString()));
}
@@ -239,21 +240,21 @@ public class DroolsConfiguration {
public<T >T get(String name) {
Object value = declaredPropertyOrNotFound(name, DroolsConfiguration.NOT_FOUND_VALUE);
if (DroolsConfiguration.NOT_FOUND_VALUE!= value) {
- return ((T) value);
+ return (T) value;
} else {
- return ((T) getAdditionalProperties().get(name));
+ return (T) getAdditionalProperties().get(name);
}
}
public void set(String name, Object value) {
if (!declaredProperty(name, value)) {
- getAdditionalProperties().put(name, ((Object) value));
+ getAdditionalProperties().put(name, value);
}
}
public DroolsConfiguration with(String name, Object value) {
if (!declaredProperty(name, value)) {
- getAdditionalProperties().put(name, ((Object) value));
+ getAdditionalProperties().put(name, value);
}
return this;
}
diff --git a/policy-management/src/main/java/org/onap/policy/drools/protocol/configuration/PdpdConfiguration.java b/policy-management/src/main/java/org/onap/policy/drools/protocol/configuration/PdpdConfiguration.java
index d7295fd4..8d6f9bfd 100644
--- a/policy-management/src/main/java/org/onap/policy/drools/protocol/configuration/PdpdConfiguration.java
+++ b/policy-management/src/main/java/org/onap/policy/drools/protocol/configuration/PdpdConfiguration.java
@@ -67,9 +67,9 @@ public class PdpdConfiguration {
*
*/
@JsonProperty("controllers")
- private List<ControllerConfiguration> controllers = new ArrayList<ControllerConfiguration>();
+ private List<ControllerConfiguration> controllers = new ArrayList<>();
@JsonIgnore
- private Map<String, Object> additionalProperties = new HashMap<String, Object>();
+ private Map<String, Object> additionalProperties = new HashMap<>();
protected final static Object NOT_FOUND_VALUE = new Object();
/**
@@ -77,6 +77,7 @@ public class PdpdConfiguration {
*
*/
public PdpdConfiguration() {
+ // Empty
}
/**
@@ -201,21 +202,21 @@ public class PdpdConfiguration {
switch (name) {
case "requestID":
if (value instanceof String) {
- setRequestID(((String) value));
+ setRequestID((String) value);
} else {
throw new IllegalArgumentException(("property \"requestID\" is of type \"java.lang.String\", but got "+ value.getClass().toString()));
}
return true;
case "entity":
if (value instanceof String) {
- setEntity(((String) value));
+ setEntity((String) value);
} else {
throw new IllegalArgumentException(("property \"entity\" is of type \"java.lang.String\", but got "+ value.getClass().toString()));
}
return true;
case "controllers":
if (value instanceof List) {
- setControllers(((List<ControllerConfiguration> ) value));
+ setControllers((List<ControllerConfiguration> ) value);
} else {
throw new IllegalArgumentException(("property \"controllers\" is of type \"java.util.List<org.onap.policy.drools.protocol.configuration.Controller>\", but got "+ value.getClass().toString()));
}
@@ -244,21 +245,21 @@ public class PdpdConfiguration {
public<T >T get(String name) {
Object value = declaredPropertyOrNotFound(name, PdpdConfiguration.NOT_FOUND_VALUE);
if (PdpdConfiguration.NOT_FOUND_VALUE!= value) {
- return ((T) value);
+ return (T) value;
} else {
- return ((T) getAdditionalProperties().get(name));
+ return (T) getAdditionalProperties().get(name);
}
}
public void set(String name, Object value) {
if (!declaredProperty(name, value)) {
- getAdditionalProperties().put(name, ((Object) value));
+ getAdditionalProperties().put(name, value);
}
}
public PdpdConfiguration with(String name, Object value) {
if (!declaredProperty(name, value)) {
- getAdditionalProperties().put(name, ((Object) value));
+ getAdditionalProperties().put(name, value);
}
return this;
}
@@ -276,7 +277,7 @@ public class PdpdConfiguration {
if ((other instanceof PdpdConfiguration) == false) {
return false;
}
- PdpdConfiguration rhs = ((PdpdConfiguration) other);
+ PdpdConfiguration rhs = (PdpdConfiguration) other;
return new EqualsBuilder().append(requestID, rhs.requestID).append(entity, rhs.entity).append(controllers, rhs.controllers).append(additionalProperties, rhs.additionalProperties).isEquals();
}