summaryrefslogtreecommitdiffstats
path: root/POLICY-SDK-APP/src
diff options
context:
space:
mode:
authorPamela Dragosh <pdragosh@research.att.com>2019-10-07 15:26:08 -0400
committerPamela Dragosh <pdragosh@research.att.com>2019-10-07 19:57:49 -0400
commitdbfa1570cd26d19b346287a6fb06f2d8a03f4a06 (patch)
tree93ead8432b6d509a3d16445d44c95631c4ef442a /POLICY-SDK-APP/src
parentb831c6a3df8e1dc9017ae5e8ad002dc3b1002aab (diff)
Use lombok for data objects
Removing lines to see if this will bump coverage. Some sonar for Junit tests and missing coverage. My next task will be to re-use some of this duplicate code for these object types and the controllers. Trailing spaces for patch #3. Issue-ID: POLICY-2133 Change-Id: Iaee123c6be4b63bd831172340709fe7597feaa78 Signed-off-by: Pamela Dragosh <pdragosh@research.att.com>
Diffstat (limited to 'POLICY-SDK-APP/src')
-rw-r--r--POLICY-SDK-APP/src/main/java/org/onap/policy/controller/CreateClosedLoopFaultController.java44
-rw-r--r--POLICY-SDK-APP/src/main/java/org/onap/policy/controller/CreateDcaeMicroServiceController.java127
-rw-r--r--POLICY-SDK-APP/src/main/java/org/onap/policy/controller/CreateOptimizationController.java96
-rw-r--r--POLICY-SDK-APP/src/main/java/org/onap/policy/controller/PDPController.java39
-rw-r--r--POLICY-SDK-APP/src/main/java/org/onap/policy/controller/PolicyRolesController.java39
-rw-r--r--POLICY-SDK-APP/src/test/java/org/onap/policy/controller/PDPControllerTest.java25
-rw-r--r--POLICY-SDK-APP/src/test/java/org/onap/policy/controller/PolicyRolesControllerTest.java5
7 files changed, 47 insertions, 328 deletions
diff --git a/POLICY-SDK-APP/src/main/java/org/onap/policy/controller/CreateClosedLoopFaultController.java b/POLICY-SDK-APP/src/main/java/org/onap/policy/controller/CreateClosedLoopFaultController.java
index b88a59958..f27941832 100644
--- a/POLICY-SDK-APP/src/main/java/org/onap/policy/controller/CreateClosedLoopFaultController.java
+++ b/POLICY-SDK-APP/src/main/java/org/onap/policy/controller/CreateClosedLoopFaultController.java
@@ -36,7 +36,8 @@ import java.util.List;
import java.util.Map;
import java.util.Objects;
import java.util.stream.IntStream;
-
+import lombok.Getter;
+import lombok.Setter;
import oasis.names.tc.xacml._3_0.core.schema.wd_17.AllOfType;
import oasis.names.tc.xacml._3_0.core.schema.wd_17.AnyOfType;
import oasis.names.tc.xacml._3_0.core.schema.wd_17.AttributeDesignatorType;
@@ -577,6 +578,8 @@ public class CreateClosedLoopFaultController extends RestrictedBaseController {
}
+@Getter
+@Setter
class ClosedLoopGridJSONData {
private String clearTimeOut;
@@ -585,43 +588,4 @@ class ClosedLoopGridJSONData {
private List<Object> connecttriggerSignatures;
private List<Object> connectVerificationSignatures;
- public String getClearTimeOut() {
- return clearTimeOut;
- }
-
- public void setClearTimeOut(String clearTimeOut) {
- this.clearTimeOut = clearTimeOut;
- }
-
- public String getTrapMaxAge() {
- return trapMaxAge;
- }
-
- public void setTrapMaxAge(String trapMaxAge) {
- this.trapMaxAge = trapMaxAge;
- }
-
- public String getVerificationclearTimeOut() {
- return verificationclearTimeOut;
- }
-
- public void setVerificationclearTimeOut(String verificationclearTimeOut) {
- this.verificationclearTimeOut = verificationclearTimeOut;
- }
-
- public List<Object> getConnecttriggerSignatures() {
- return connecttriggerSignatures;
- }
-
- public void setConnecttriggerSignatures(List<Object> connecttriggerSignatures) {
- this.connecttriggerSignatures = connecttriggerSignatures;
- }
-
- public List<Object> getConnectVerificationSignatures() {
- return connectVerificationSignatures;
- }
-
- public void setConnectVerificationSignatures(List<Object> connectVerificationSignatures) {
- this.connectVerificationSignatures = connectVerificationSignatures;
- }
}
diff --git a/POLICY-SDK-APP/src/main/java/org/onap/policy/controller/CreateDcaeMicroServiceController.java b/POLICY-SDK-APP/src/main/java/org/onap/policy/controller/CreateDcaeMicroServiceController.java
index f7e5c081f..2b7974d4e 100644
--- a/POLICY-SDK-APP/src/main/java/org/onap/policy/controller/CreateDcaeMicroServiceController.java
+++ b/POLICY-SDK-APP/src/main/java/org/onap/policy/controller/CreateDcaeMicroServiceController.java
@@ -69,7 +69,8 @@ import javax.json.JsonReader;
import javax.json.JsonValue;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
-
+import lombok.Getter;
+import lombok.Setter;
import oasis.names.tc.xacml._3_0.core.schema.wd_17.AllOfType;
import oasis.names.tc.xacml._3_0.core.schema.wd_17.AnyOfType;
import oasis.names.tc.xacml._3_0.core.schema.wd_17.AttributeDesignatorType;
@@ -1737,6 +1738,8 @@ public class CreateDcaeMicroServiceController extends RestrictedBaseController {
}
+@Getter
+@Setter
class DCAEMicroServiceObject {
private String service;
@@ -1753,127 +1756,5 @@ class DCAEMicroServiceObject {
private String riskLevel;
private String guard = null;
private Object uiContent;
-
- public String getGuard() {
- return guard;
- }
-
- public void setGuard(String guard) {
- this.guard = guard;
- }
-
- public String getRiskType() {
- return riskType;
- }
-
- public void setRiskType(String riskType) {
- this.riskType = riskType;
- }
-
- public String getRiskLevel() {
- return riskLevel;
- }
-
- public void setRiskLevel(String riskLevel) {
- this.riskLevel = riskLevel;
- }
-
- public String getPolicyScope() {
- return policyScope;
- }
-
- public void setPolicyScope(String policyScope) {
- this.policyScope = policyScope;
- }
-
- public String getPriority() {
- return priority;
- }
-
- public void setPriority(String priority) {
- this.priority = priority;
- }
-
- public String getVersion() {
- return version;
- }
-
- public void setVersion(String version) {
- this.version = version;
- }
-
private Object content;
-
- public String getPolicyName() {
- return policyName;
- }
-
- public void setPolicyName(String policyName) {
- this.policyName = policyName;
- }
-
- public String getDescription() {
- return description;
- }
-
- public void setDescription(String description) {
- this.description = description;
- }
-
- public String getConfigName() {
- return configName;
- }
-
- public void setConfigName(String configName) {
- this.configName = configName;
- }
-
- public Object getContent() {
- return content;
- }
-
- public void setContent(Object content) {
- this.content = content;
- }
-
- public String getService() {
- return service;
- }
-
- public void setService(String service) {
- this.service = service;
- }
-
- public String getLocation() {
- return location;
- }
-
- public void setLocation(String location) {
- this.location = location;
- }
-
- public String getUuid() {
- return uuid;
- }
-
- public void setUuid(String uuid) {
- this.uuid = uuid;
- }
-
- public String getTemplateVersion() {
- return templateVersion;
- }
-
- public void setTemplateVersion(String templateVersion) {
- this.templateVersion = templateVersion;
- }
-
- public Object getUiContent() {
- return uiContent;
- }
-
- public void setUiContent(Object uiContent) {
- this.uiContent = uiContent;
- }
-
}
diff --git a/POLICY-SDK-APP/src/main/java/org/onap/policy/controller/CreateOptimizationController.java b/POLICY-SDK-APP/src/main/java/org/onap/policy/controller/CreateOptimizationController.java
index 719c66805..b77f6a7d2 100644
--- a/POLICY-SDK-APP/src/main/java/org/onap/policy/controller/CreateOptimizationController.java
+++ b/POLICY-SDK-APP/src/main/java/org/onap/policy/controller/CreateOptimizationController.java
@@ -52,7 +52,8 @@ import java.util.zip.ZipFile;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
-
+import lombok.Getter;
+import lombok.Setter;
import oasis.names.tc.xacml._3_0.core.schema.wd_17.AllOfType;
import oasis.names.tc.xacml._3_0.core.schema.wd_17.AnyOfType;
import oasis.names.tc.xacml._3_0.core.schema.wd_17.AttributeDesignatorType;
@@ -893,7 +894,8 @@ public class CreateOptimizationController extends RestrictedBaseController {
}
}
-
+@Getter
+@Setter
class OptimizationObject {
private String service;
@@ -906,95 +908,5 @@ class OptimizationObject {
private String riskType;
private String riskLevel;
private String guard = null;
-
- public String getGuard() {
- return guard;
- }
-
- public void setGuard(String guard) {
- this.guard = guard;
- }
-
- public String getRiskType() {
- return riskType;
- }
-
- public void setRiskType(String riskType) {
- this.riskType = riskType;
- }
-
- public String getRiskLevel() {
- return riskLevel;
- }
-
- public void setRiskLevel(String riskLevel) {
- this.riskLevel = riskLevel;
- }
-
- public String getPriority() {
- return priority;
- }
-
- public void setPriority(String priority) {
- this.priority = priority;
- }
-
- public String getPolicyScope() {
- return policyScope;
- }
-
- public void setPolicyScope(String policyScope) {
- this.policyScope = policyScope;
- }
-
- public String getVersion() {
- return version;
- }
-
- public void setVersion(String version) {
- this.version = version;
- }
-
private Object content;
-
- public String getPolicyName() {
- return policyName;
- }
-
- public void setPolicyName(String policyName) {
- this.policyName = policyName;
- }
-
- public String getDescription() {
- return description;
- }
-
- public void setDescription(String description) {
- this.description = description;
- }
-
- public Object getContent() {
- return content;
- }
-
- public void setContent(Object content) {
- this.content = content;
- }
-
- public String getService() {
- return service;
- }
-
- public void setService(String service) {
- this.service = service;
- }
-
- public String getTemplateVersion() {
- return templateVersion;
- }
-
- public void setTemplateVersion(String templateVersion) {
- this.templateVersion = templateVersion;
- }
-
}
diff --git a/POLICY-SDK-APP/src/main/java/org/onap/policy/controller/PDPController.java b/POLICY-SDK-APP/src/main/java/org/onap/policy/controller/PDPController.java
index 24fade137..56d882fb4 100644
--- a/POLICY-SDK-APP/src/main/java/org/onap/policy/controller/PDPController.java
+++ b/POLICY-SDK-APP/src/main/java/org/onap/policy/controller/PDPController.java
@@ -37,7 +37,8 @@ import java.util.Set;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
-
+import lombok.Getter;
+import lombok.Setter;
import org.json.JSONObject;
import org.onap.policy.admin.RESTfulPAPEngine;
import org.onap.policy.common.logging.flexlogger.FlexLogger;
@@ -409,43 +410,11 @@ public class PDPController extends RestrictedBaseController {
}
}
-
+@Getter
+@Setter
class PdpData {
String id;
int jmxPort;
String name;
String description;
-
- public String getId() {
- return id;
- }
-
- public void setId(String id) {
- this.id = id;
- }
-
- public int getJmxPort() {
- return jmxPort;
- }
-
- public void setJmxPort(int jmxPort) {
- this.jmxPort = jmxPort;
- }
-
- public String getName() {
- return name;
- }
-
- public void setName(String name) {
- this.name = name;
- }
-
- public String getDescription() {
- return description;
- }
-
- public void setDescription(String description) {
- this.description = description;
- }
-
}
diff --git a/POLICY-SDK-APP/src/main/java/org/onap/policy/controller/PolicyRolesController.java b/POLICY-SDK-APP/src/main/java/org/onap/policy/controller/PolicyRolesController.java
index 29fdecdaa..f416386c5 100644
--- a/POLICY-SDK-APP/src/main/java/org/onap/policy/controller/PolicyRolesController.java
+++ b/POLICY-SDK-APP/src/main/java/org/onap/policy/controller/PolicyRolesController.java
@@ -34,7 +34,8 @@ import java.util.Map;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
-
+import lombok.Getter;
+import lombok.Setter;
import org.json.JSONObject;
import org.onap.policy.common.logging.flexlogger.FlexLogger;
import org.onap.policy.common.logging.flexlogger.Logger;
@@ -191,43 +192,11 @@ public class PolicyRolesController extends RestrictedBaseController {
}
}
-
+@Setter
+@Getter
class ReadScopes {
private int id;
private UserInfo loginId;
private String role;
private List<String> scope;
-
- public int getId() {
- return id;
- }
-
- public void setId(int id) {
- this.id = id;
- }
-
- public UserInfo getLoginId() {
- return loginId;
- }
-
- public void setLoginId(UserInfo loginId) {
- this.loginId = loginId;
- }
-
- public String getRole() {
- return role;
- }
-
- public void setRole(String role) {
- this.role = role;
- }
-
- public List<String> getScope() {
- return scope;
- }
-
- public void setScope(List<String> scope) {
- this.scope = scope;
- }
-
}
diff --git a/POLICY-SDK-APP/src/test/java/org/onap/policy/controller/PDPControllerTest.java b/POLICY-SDK-APP/src/test/java/org/onap/policy/controller/PDPControllerTest.java
index 0d5a09754..372090fdf 100644
--- a/POLICY-SDK-APP/src/test/java/org/onap/policy/controller/PDPControllerTest.java
+++ b/POLICY-SDK-APP/src/test/java/org/onap/policy/controller/PDPControllerTest.java
@@ -22,6 +22,7 @@
package org.onap.policy.controller;
+import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertTrue;
import java.io.UnsupportedEncodingException;
@@ -50,6 +51,11 @@ public class PDPControllerTest extends Mockito {
private Set<StdPDPGroup> groups;
private static List<Object> rolesdata;
+ /**
+ * Before.
+ *
+ * @throws Exception Exception
+ */
@Before
public void setUp() throws Exception {
logger.info("setUp: Entering");
@@ -79,9 +85,9 @@ public class PDPControllerTest extends Mockito {
}
@Test
- public void testPDPGroupData() {
- HttpServletRequest request = mock(HttpServletRequest.class);
- MockHttpServletResponse response = new MockHttpServletResponse();
+ public void testPdpGroupData() {
+ final HttpServletRequest request = mock(HttpServletRequest.class);
+ final MockHttpServletResponse response = new MockHttpServletResponse();
PolicyController controller = mock(PolicyController.class);
PDPController pdpController = new PDPController();
pdpController.setJunit(true);;
@@ -95,4 +101,17 @@ public class PDPControllerTest extends Mockito {
logger.error("Exception Occured" + e);
}
}
+
+ @Test
+ public void testPdpData() {
+ PdpData data = new PdpData();
+ data.setId("id");
+ assertEquals("id", data.getId());
+ data.setDescription("foo");
+ assertEquals("foo", data.getDescription());
+ data.setJmxPort(0);
+ assertEquals(0, data.getJmxPort());
+ data.setName("name");
+ assertEquals("name", data.getName());
+ }
}
diff --git a/POLICY-SDK-APP/src/test/java/org/onap/policy/controller/PolicyRolesControllerTest.java b/POLICY-SDK-APP/src/test/java/org/onap/policy/controller/PolicyRolesControllerTest.java
index 720f6ca76..e24525619 100644
--- a/POLICY-SDK-APP/src/test/java/org/onap/policy/controller/PolicyRolesControllerTest.java
+++ b/POLICY-SDK-APP/src/test/java/org/onap/policy/controller/PolicyRolesControllerTest.java
@@ -51,6 +51,11 @@ public class PolicyRolesControllerTest {
private PolicyRolesController controller = null;
private static CommonClassDao commonClassDao;
+ /**
+ * Before.
+ *
+ * @throws Exception exception
+ */
@Before
public void setUp() throws Exception {
logger.info("setUp: Entering");