From: liamfallon Date: Fri, 15 Nov 2019 13:35:42 +0000 (+0000) Subject: Unit/SONAR/Checkstyle in ONAP-REST X-Git-Tag: 1.6.0~36^2 X-Git-Url: https://gerrit.onap.org/r/gitweb?p=policy%2Fengine.git;a=commitdiff_plain;h=d4e3a1b394715c6386f963130e4e081d421ecd1b Unit/SONAR/Checkstyle in ONAP-REST Fifth and final batch of JPA pojos (Q-Z), with JUnit added and SONAR/Checkstyle issues addressed. In cases where a class name change caused an update in another package, the license header on files for those knock on changes are not updated. Issue-ID: POLICY-2131 Change-Id: I1cc536a5b8a0cd3c6beff068dd72381f7ae10d12 Signed-off-by: liamfallon --- diff --git a/ONAP-PAP-REST/src/main/java/org/onap/policy/pap/xacml/rest/components/FirewallConfigPolicy.java b/ONAP-PAP-REST/src/main/java/org/onap/policy/pap/xacml/rest/components/FirewallConfigPolicy.java index 01c211cdb..e153ea834 100644 --- a/ONAP-PAP-REST/src/main/java/org/onap/policy/pap/xacml/rest/components/FirewallConfigPolicy.java +++ b/ONAP-PAP-REST/src/main/java/org/onap/policy/pap/xacml/rest/components/FirewallConfigPolicy.java @@ -610,16 +610,16 @@ public class FirewallConfigPolicy extends Policy { TermList termEntry = new TermList(); termEntry.setTermName(ruleName); - termEntry.setSrcIPList(srcListInsert); - termEntry.setDestIPList(destListInsert); + termEntry.setSrcIpList(srcListInsert); + termEntry.setDestIpList(destListInsert); termEntry.setProtocolList("null"); termEntry.setPortList("null"); termEntry.setSrcPortList("null"); termEntry.setDestPortList(destPortListInsert); termEntry.setAction(action); termEntry.setDescription(description); - termEntry.setFromZones(fromZoneInsert); - termEntry.setToZones(toZoneInsert); + termEntry.setFromZone(fromZoneInsert); + termEntry.setToZone(toZoneInsert); termEntry.setUserCreatedBy(userInfo); dbConnection.save(termEntry); @@ -962,16 +962,16 @@ public class FirewallConfigPolicy extends Policy { TermList termEntry = new TermList(); termEntry.setTermName(ruleName); - termEntry.setSrcIPList(srcListInsert); - termEntry.setDestIPList(destListInsert); + termEntry.setSrcIpList(srcListInsert); + termEntry.setDestIpList(destListInsert); termEntry.setProtocolList("null"); termEntry.setPortList("null"); termEntry.setSrcPortList("null"); termEntry.setDestPortList(destPortListInsert); termEntry.setAction(action); termEntry.setDescription(description); - termEntry.setFromZones(fromZoneInsert); - termEntry.setToZones(toZoneInsert); + termEntry.setFromZone(fromZoneInsert); + termEntry.setToZone(toZoneInsert); termEntry.setUserCreatedBy(userInfo); dbConnection.save(termEntry); @@ -1144,7 +1144,7 @@ public class FirewallConfigPolicy extends Policy { serviceListEntry.setServiceName(groupName); serviceListEntry.setServiceDescription(description); serviceListEntry.setServiceType(type); - serviceListEntry.setServiceTransProtocol(transportProtocol); + serviceListEntry.setServiceTransportProtocol(transportProtocol); serviceListEntry.setServiceAppProtocol("null"); serviceListEntry.setServicePorts(ports); dbConnection.save(serviceListEntry); diff --git a/ONAP-PAP-REST/src/main/java/org/onap/policy/pap/xacml/rest/controller/ClosedLoopDictionaryController.java b/ONAP-PAP-REST/src/main/java/org/onap/policy/pap/xacml/rest/controller/ClosedLoopDictionaryController.java index 16e8e2e2c..9ea956aa7 100644 --- a/ONAP-PAP-REST/src/main/java/org/onap/policy/pap/xacml/rest/controller/ClosedLoopDictionaryController.java +++ b/ONAP-PAP-REST/src/main/java/org/onap/policy/pap/xacml/rest/controller/ClosedLoopDictionaryController.java @@ -40,8 +40,8 @@ import org.onap.policy.rest.jpa.ClosedLoopSite; import org.onap.policy.rest.jpa.OnapName; import org.onap.policy.rest.jpa.PepOptions; import org.onap.policy.rest.jpa.UserInfo; -import org.onap.policy.rest.jpa.VNFType; -import org.onap.policy.rest.jpa.VSCLAction; +import org.onap.policy.rest.jpa.VnfType; +import org.onap.policy.rest.jpa.VsclAction; import org.onap.policy.rest.jpa.VarbindDictionary; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.http.MediaType; @@ -54,9 +54,9 @@ import org.springframework.web.servlet.ModelAndView; public class ClosedLoopDictionaryController { private static CommonClassDao commonClassDao; - private static String vsclaction = "vsclaction"; + private static String vsclaction = "action"; private static String operation = "operation"; - private static String vnftype = "vnftype"; + private static String vnftype = "type"; private static String pepName = "pepName"; private static String varbindName = "varbindName"; private static String serviceName = "serviceName"; @@ -98,7 +98,7 @@ public class ClosedLoopDictionaryController { produces = MediaType.APPLICATION_JSON_VALUE) public void getVSCLActionDictionaryByNameEntityData(HttpServletResponse response) { DictionaryUtils utils = getDictionaryUtilsInstance(); - utils.getDataByEntity(response, vsclActionDatas, vsclaction, VSCLAction.class); + utils.getDataByEntity(response, vsclActionDatas, vsclaction, VsclAction.class); } @RequestMapping( @@ -107,7 +107,7 @@ public class ClosedLoopDictionaryController { produces = MediaType.APPLICATION_JSON_VALUE) public void getVSCLActionDictionaryEntityData(HttpServletResponse response) { DictionaryUtils utils = getDictionaryUtilsInstance(); - utils.getData(response, vsclActionDatas, VSCLAction.class); + utils.getData(response, vsclActionDatas, VsclAction.class); } @RequestMapping( @@ -116,7 +116,7 @@ public class ClosedLoopDictionaryController { produces = MediaType.APPLICATION_JSON_VALUE) public void getVNFTypeDictionaryByNameEntityData(HttpServletResponse response) { DictionaryUtils utils = getDictionaryUtilsInstance(); - utils.getDataByEntity(response, vnfTypeDatas, vnftype, VNFType.class); + utils.getDataByEntity(response, vnfTypeDatas, vnftype, VnfType.class); } @RequestMapping( @@ -125,7 +125,7 @@ public class ClosedLoopDictionaryController { produces = MediaType.APPLICATION_JSON_VALUE) public void getVNFTypeDictionaryEntityData(HttpServletResponse response) { DictionaryUtils utils = getDictionaryUtilsInstance(); - utils.getData(response, vnfTypeDatas, VNFType.class); + utils.getData(response, vnfTypeDatas, VnfType.class); } @RequestMapping( @@ -208,22 +208,22 @@ public class ClosedLoopDictionaryController { ObjectMapper mapper = new ObjectMapper(); mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false); JsonNode root = mapper.readTree(request.getReader()); - VSCLAction vSCLAction; + VsclAction vSCLAction; String userId = null; if (fromAPI) { - vSCLAction = mapper.readValue(root.get(dictionaryFields).toString(), VSCLAction.class); + vSCLAction = mapper.readValue(root.get(dictionaryFields).toString(), VsclAction.class); userId = "API"; } else { - vSCLAction = mapper.readValue(root.get("vsclActionDictionaryData").toString(), VSCLAction.class); + vSCLAction = mapper.readValue(root.get("vsclActionDictionaryData").toString(), VsclAction.class); userId = root.get(userid).textValue(); } UserInfo userInfo = utils.getUserInfo(userId); List duplicateData = - commonClassDao.checkDuplicateEntry(vSCLAction.getVsclaction(), vsclaction, VSCLAction.class); + commonClassDao.checkDuplicateEntry(vSCLAction.getAction(), vsclaction, VsclAction.class); boolean duplicateflag = false; if (!duplicateData.isEmpty()) { - VSCLAction data = (VSCLAction) duplicateData.get(0); + VsclAction data = (VsclAction) duplicateData.get(0); if (request.getParameter(operation) != null && "update".equals(request.getParameter(operation))) { vSCLAction.setId(data.getId()); } else if ((request.getParameter(operation) != null @@ -242,7 +242,7 @@ public class ClosedLoopDictionaryController { vSCLAction.setModifiedDate(new Date()); commonClassDao.update(vSCLAction); } - responseString = mapper.writeValueAsString(commonClassDao.getData(VSCLAction.class)); + responseString = mapper.writeValueAsString(commonClassDao.getData(VsclAction.class)); } else { responseString = duplicateResponseString; } @@ -272,22 +272,22 @@ public class ClosedLoopDictionaryController { ObjectMapper mapper = new ObjectMapper(); mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false); JsonNode root = mapper.readTree(request.getReader()); - VNFType vNFType; + VnfType vNFType; String userId = null; if (fromAPI) { - vNFType = mapper.readValue(root.get(dictionaryFields).toString(), VNFType.class); + vNFType = mapper.readValue(root.get(dictionaryFields).toString(), VnfType.class); userId = "API"; } else { - vNFType = mapper.readValue(root.get("vnfTypeDictionaryData").toString(), VNFType.class); + vNFType = mapper.readValue(root.get("vnfTypeDictionaryData").toString(), VnfType.class); userId = root.get(userid).textValue(); } UserInfo userInfo = utils.getUserInfo(userId); List duplicateData = - commonClassDao.checkDuplicateEntry(vNFType.getVnftype(), vnftype, VNFType.class); + commonClassDao.checkDuplicateEntry(vNFType.getType(), vnftype, VnfType.class); boolean duplicateflag = false; if (!duplicateData.isEmpty()) { - VNFType data = (VNFType) duplicateData.get(0); + VnfType data = (VnfType) duplicateData.get(0); if (request.getParameter(operation) != null && "update".equals(request.getParameter(operation))) { vNFType.setId(data.getId()); } else if ((request.getParameter(operation) != null @@ -306,7 +306,7 @@ public class ClosedLoopDictionaryController { vNFType.setModifiedDate(new Date()); commonClassDao.update(vNFType); } - responseString = mapper.writeValueAsString(commonClassDao.getData(VNFType.class)); + responseString = mapper.writeValueAsString(commonClassDao.getData(VnfType.class)); } else { responseString = duplicateResponseString; } @@ -325,7 +325,7 @@ public class ClosedLoopDictionaryController { @RequestMapping(value = {"/cl_dictionary/remove_vnfType"}, method = {RequestMethod.POST}) public void removeVnfType(HttpServletRequest request, HttpServletResponse response) throws IOException { DictionaryUtils utils = getDictionaryUtilsInstance(); - utils.removeData(request, response, vnfTypeDatas, VNFType.class); + utils.removeData(request, response, vnfTypeDatas, VnfType.class); } @RequestMapping(value = {"/cl_dictionary/save_pepOptions"}, method = {RequestMethod.POST}) @@ -396,7 +396,7 @@ public class ClosedLoopDictionaryController { @RequestMapping(value = {"/cl_dictionary/remove_pepOptions"}, method = {RequestMethod.POST}) public void removePEPOptions(HttpServletRequest request, HttpServletResponse response) throws IOException { DictionaryUtils utils = getDictionaryUtilsInstance(); - utils.removeData(request, response, pepOptionDatas, VNFType.class); + utils.removeData(request, response, pepOptionDatas, VnfType.class); } @RequestMapping(value = {"/cl_dictionary/save_service"}, method = {RequestMethod.POST}) @@ -460,7 +460,7 @@ public class ClosedLoopDictionaryController { @RequestMapping(value = {"/cl_dictionary/remove_Service"}, method = {RequestMethod.POST}) public void removeServiceType(HttpServletRequest request, HttpServletResponse response) throws IOException { DictionaryUtils utils = getDictionaryUtilsInstance(); - utils.removeData(request, response, closedLoopDatas, VNFType.class); + utils.removeData(request, response, closedLoopDatas, VnfType.class); } @RequestMapping(value = {"/cl_dictionary/save_siteName"}, method = {RequestMethod.POST}) @@ -523,7 +523,7 @@ public class ClosedLoopDictionaryController { @RequestMapping(value = {"/cl_dictionary/remove_site"}, method = {RequestMethod.POST}) public void removeSiteType(HttpServletRequest request, HttpServletResponse response) throws IOException { DictionaryUtils utils = getDictionaryUtilsInstance(); - utils.removeData(request, response, closedLoopSiteDatas, VNFType.class); + utils.removeData(request, response, closedLoopSiteDatas, VnfType.class); } @RequestMapping(value = {"/cl_dictionary/save_varbind"}, method = {RequestMethod.POST}) @@ -588,6 +588,6 @@ public class ClosedLoopDictionaryController { @RequestMapping(value = {"/cl_dictionary/remove_varbindDict"}, method = {RequestMethod.POST}) public void removeVarbind(HttpServletRequest request, HttpServletResponse response) throws IOException { DictionaryUtils utils = getDictionaryUtilsInstance(); - utils.removeData(request, response, varbindDatas, VNFType.class); + utils.removeData(request, response, varbindDatas, VnfType.class); } } diff --git a/ONAP-PAP-REST/src/main/java/org/onap/policy/pap/xacml/rest/controller/DictionaryImportController.java b/ONAP-PAP-REST/src/main/java/org/onap/policy/pap/xacml/rest/controller/DictionaryImportController.java index ef475039d..029582213 100644 --- a/ONAP-PAP-REST/src/main/java/org/onap/policy/pap/xacml/rest/controller/DictionaryImportController.java +++ b/ONAP-PAP-REST/src/main/java/org/onap/policy/pap/xacml/rest/controller/DictionaryImportController.java @@ -63,8 +63,8 @@ import org.onap.policy.rest.jpa.SecurityZone; import org.onap.policy.rest.jpa.ServiceList; import org.onap.policy.rest.jpa.TermList; import org.onap.policy.rest.jpa.UserInfo; -import org.onap.policy.rest.jpa.VNFType; -import org.onap.policy.rest.jpa.VSCLAction; +import org.onap.policy.rest.jpa.VnfType; +import org.onap.policy.rest.jpa.VsclAction; import org.onap.policy.rest.jpa.VarbindDictionary; import org.onap.policy.rest.jpa.Zone; import org.springframework.beans.factory.annotation.Autowired; @@ -311,7 +311,7 @@ public class DictionaryImportController { if (dictionaryName.startsWith("VNFType")) { for (int i = 1; i < dictSheet.size(); i++) { - VNFType attribute = new VNFType(); + VnfType attribute = new VnfType(); UserInfo userinfo = new UserInfo(); userinfo.setUserLoginId(userId); attribute.setUserCreatedBy(userinfo); @@ -320,7 +320,7 @@ public class DictionaryImportController { for (int j = 0; j < rows.length; j++) { if ("vnf_type".equalsIgnoreCase(dictSheet.get(0)[j]) || "VNF Type".equalsIgnoreCase(dictSheet.get(0)[j])) { - attribute.setVnftype(rows[j]); + attribute.setType(rows[j]); } if (DESCRIPTION.equalsIgnoreCase(dictSheet.get(0)[j])) { attribute.setDescription(rows[j]); @@ -331,7 +331,7 @@ public class DictionaryImportController { } if (dictionaryName.startsWith("VSCLAction")) { for (int i = 1; i < dictSheet.size(); i++) { - VSCLAction attribute = new VSCLAction(); + VsclAction attribute = new VsclAction(); UserInfo userinfo = new UserInfo(); userinfo.setUserLoginId(userId); attribute.setUserCreatedBy(userinfo); @@ -340,7 +340,7 @@ public class DictionaryImportController { for (int j = 0; j < rows.length; j++) { if ("vscl_action".equalsIgnoreCase(dictSheet.get(0)[j]) || "VSCL Action".equalsIgnoreCase(dictSheet.get(0)[j])) { - attribute.setVsclaction(rows[j]); + attribute.setAction(rows[j]); } if (DESCRIPTION.equalsIgnoreCase(dictSheet.get(0)[j])) { attribute.setDescription(rows[j]); @@ -431,7 +431,7 @@ public class DictionaryImportController { } if ("varbind_oid".equalsIgnoreCase(dictSheet.get(0)[j]) || "Varbind OID".equalsIgnoreCase(dictSheet.get(0)[j])) { - attribute.setVarbindOID(rows[j]); + attribute.setVarbindOid(rows[j]); } } commonClassDao.save(attribute); @@ -615,7 +615,7 @@ public class DictionaryImportController { } if ("serviceTrasProtocol".equalsIgnoreCase(dictSheet.get(0)[j]) || "Transport Protocol".equalsIgnoreCase(dictSheet.get(0)[j])) { - attribute.setServiceTransProtocol(rows[j]); + attribute.setServiceTransportProtocol(rows[j]); } if ("serviceAppProtocol".equalsIgnoreCase(dictSheet.get(0)[j]) || "APP Protocol".equalsIgnoreCase(dictSheet.get(0)[j])) { @@ -717,19 +717,19 @@ public class DictionaryImportController { } if ("fromZone".equalsIgnoreCase(dictSheet.get(0)[j]) || "From Zone".equalsIgnoreCase(dictSheet.get(0)[j])) { - attribute.setFromZones(rows[j]); + attribute.setFromZone(rows[j]); } if ("toZone".equalsIgnoreCase(dictSheet.get(0)[j]) || "To Zone".equalsIgnoreCase(dictSheet.get(0)[j])) { - attribute.setToZones(rows[j]); + attribute.setToZone(rows[j]); } if ("srcIPList".equalsIgnoreCase(dictSheet.get(0)[j]) || "Source-IP-List".equalsIgnoreCase(dictSheet.get(0)[j])) { - attribute.setSrcIPList(rows[j]); + attribute.setSrcIpList(rows[j]); } if ("destIPList".equalsIgnoreCase(dictSheet.get(0)[j]) || "Destination-IP-List".equalsIgnoreCase(dictSheet.get(0)[j])) { - attribute.setDestIPList(rows[j]); + attribute.setDestIpList(rows[j]); } if ("srcPortList".equalsIgnoreCase(dictSheet.get(0)[j]) || "Source-Port-List".equalsIgnoreCase(dictSheet.get(0)[j])) { diff --git a/ONAP-PAP-REST/src/main/java/org/onap/policy/pap/xacml/rest/controller/FirewallDictionaryController.java b/ONAP-PAP-REST/src/main/java/org/onap/policy/pap/xacml/rest/controller/FirewallDictionaryController.java index 39a12c81a..3c3cbac30 100644 --- a/ONAP-PAP-REST/src/main/java/org/onap/policy/pap/xacml/rest/controller/FirewallDictionaryController.java +++ b/ONAP-PAP-REST/src/main/java/org/onap/policy/pap/xacml/rest/controller/FirewallDictionaryController.java @@ -713,7 +713,7 @@ public class FirewallDictionaryController { mapper.readValue(root.get("serviceListDictionaryData").toString(), GridData.class); } serviceList - .setServiceTransProtocol(utils.appendKey(serviceListGridData.getTransportProtocols(), option, ",")); + .setServiceTransportProtocol(utils.appendKey(serviceListGridData.getTransportProtocols(), option, ",")); serviceList.setServiceAppProtocol(utils.appendKey(serviceListGridData.getAppProtocols(), option, ",")); serviceList.setServiceType("SERVICE"); List duplicateData = @@ -871,10 +871,10 @@ public class FirewallDictionaryController { userId = root.get(userid).textValue(); } - termList.setFromZones(utils.appendKey(termListDatas.getFromZoneDatas(), option, ",")); - termList.setToZones(utils.appendKey(termListDatas.getToZoneDatas(), option, ",")); - termList.setSrcIPList(utils.appendKey(termListDatas.getSourceListDatas(), option, ",")); - termList.setDestIPList(utils.appendKey(termListDatas.getDestinationListDatas(), option, ",")); + termList.setFromZone(utils.appendKey(termListDatas.getFromZoneDatas(), option, ",")); + termList.setToZone(utils.appendKey(termListDatas.getToZoneDatas(), option, ",")); + termList.setSrcIpList(utils.appendKey(termListDatas.getSourceListDatas(), option, ",")); + termList.setDestIpList(utils.appendKey(termListDatas.getDestinationListDatas(), option, ",")); termList.setSrcPortList(utils.appendKey(termListDatas.getSourceServiceDatas(), option, ",")); termList.setDestPortList(utils.appendKey(termListDatas.getDestinationServiceDatas(), option, ",")); termList.setAction(utils.appendKey(termListDatas.getActionListDatas(), option, ",")); diff --git a/ONAP-PAP-REST/src/main/java/org/onap/policy/pap/xacml/rest/controller/SafePolicyController.java b/ONAP-PAP-REST/src/main/java/org/onap/policy/pap/xacml/rest/controller/SafePolicyController.java index d7683fa0b..577870c70 100644 --- a/ONAP-PAP-REST/src/main/java/org/onap/policy/pap/xacml/rest/controller/SafePolicyController.java +++ b/ONAP-PAP-REST/src/main/java/org/onap/policy/pap/xacml/rest/controller/SafePolicyController.java @@ -107,7 +107,7 @@ public class SafePolicyController { } UserInfo userInfo = utils.getUserInfo(userId); List duplicateData = - commonClassDao.checkDuplicateEntry(riskTypeData.getRiskName(), "name", RiskType.class); + commonClassDao.checkDuplicateEntry(riskTypeData.getName(), "name", RiskType.class); boolean duplicateflag = false; if (!duplicateData.isEmpty()) { RiskType data = (RiskType) duplicateData.get(0); diff --git a/ONAP-PAP-REST/src/main/java/org/onap/policy/pap/xacml/rest/elk/client/PolicyElasticSearchController.java b/ONAP-PAP-REST/src/main/java/org/onap/policy/pap/xacml/rest/elk/client/PolicyElasticSearchController.java index f21ac60c8..48dc46c1b 100644 --- a/ONAP-PAP-REST/src/main/java/org/onap/policy/pap/xacml/rest/elk/client/PolicyElasticSearchController.java +++ b/ONAP-PAP-REST/src/main/java/org/onap/policy/pap/xacml/rest/elk/client/PolicyElasticSearchController.java @@ -62,8 +62,8 @@ import org.onap.policy.rest.jpa.PepOptions; import org.onap.policy.rest.jpa.RiskType; import org.onap.policy.rest.jpa.SafePolicyWarning; import org.onap.policy.rest.jpa.TermList; -import org.onap.policy.rest.jpa.VNFType; -import org.onap.policy.rest.jpa.VSCLAction; +import org.onap.policy.rest.jpa.VnfType; +import org.onap.policy.rest.jpa.VsclAction; import org.onap.policy.rest.jpa.VarbindDictionary; import org.onap.policy.utils.PolicyUtils; import org.onap.policy.xacml.api.XACMLErrorConstants; @@ -378,13 +378,13 @@ public class PolicyElasticSearchController { policyList = searchElkDatabase(closedloop, jsonBodyData, "*" + value + "*"); break; case clVnf: - VNFType vNFType = mapper.readValue(root.get("data").toString(), VNFType.class); - value = vNFType.getVnftype(); + VnfType vNFType = mapper.readValue(root.get("data").toString(), VnfType.class); + value = vNFType.getType(); policyList = searchElkDatabase(closedloop, jsonBodyData, "*" + value + "*"); break; case clVSCL: - VSCLAction vsclAction = mapper.readValue(root.get("data").toString(), VSCLAction.class); - value = vsclAction.getVsclaction(); + VsclAction vsclAction = mapper.readValue(root.get("data").toString(), VsclAction.class); + value = vsclAction.getAction(); policyList = searchElkDatabase(closedloop, jsonBodyData, "*" + value + "*"); break; case decision: @@ -423,7 +423,7 @@ public class PolicyElasticSearchController { break; case safeRisk: RiskType riskType = mapper.readValue(root.get("data").toString(), RiskType.class); - value = riskType.getRiskName(); + value = riskType.getName(); policyList = searchElkDatabase(config, "riskType", value); break; case safePolicyWarning: diff --git a/ONAP-PAP-REST/src/main/resources/META-INF/persistence.xml b/ONAP-PAP-REST/src/main/resources/META-INF/persistence.xml index 0280219a7..fcfe9d271 100644 --- a/ONAP-PAP-REST/src/main/resources/META-INF/persistence.xml +++ b/ONAP-PAP-REST/src/main/resources/META-INF/persistence.xml @@ -166,12 +166,12 @@ org.onap.policy.rest.jpa.RuleAlgorithms org.onap.policy.rest.jpa.SecurityZone org.onap.policy.rest.jpa.ServiceList - org.onap.policy.rest.jpa.SystemLogDB + org.onap.policy.rest.jpa.SystemLogDb org.onap.policy.rest.jpa.TermList org.onap.policy.rest.jpa.VarbindDictionary - org.onap.policy.rest.jpa.VMType - org.onap.policy.rest.jpa.VNFType - org.onap.policy.rest.jpa.VSCLAction + org.onap.policy.rest.jpa.VmType + org.onap.policy.rest.jpa.VnfType + org.onap.policy.rest.jpa.VsclAction org.onap.policy.rest.jpa.Zone org.onap.policy.jpa.BackUpMonitorEntity diff --git a/ONAP-PAP-REST/src/test/java/org/onap/policy/pap/test/XACMLPAPTest.java b/ONAP-PAP-REST/src/test/java/org/onap/policy/pap/test/XACMLPAPTest.java index f978d7464..f9faa2928 100644 --- a/ONAP-PAP-REST/src/test/java/org/onap/policy/pap/test/XACMLPAPTest.java +++ b/ONAP-PAP-REST/src/test/java/org/onap/policy/pap/test/XACMLPAPTest.java @@ -488,7 +488,7 @@ public class XACMLPAPTest { // Verify Mockito.verify(httpServletResponse).setStatus(HttpServletResponse.SC_OK); // - // Check VNFType + // Check VnfType // httpServletRequest = Mockito.mock(HttpServletRequest.class); httpServletResponse = Mockito.mock(MockHttpServletResponse.class); diff --git a/ONAP-PAP-REST/src/test/java/org/onap/policy/pap/xacml/rest/controller/ClosedLoopDictionaryControllerTest.java b/ONAP-PAP-REST/src/test/java/org/onap/policy/pap/xacml/rest/controller/ClosedLoopDictionaryControllerTest.java index fab361118..8f0d52b21 100644 --- a/ONAP-PAP-REST/src/test/java/org/onap/policy/pap/xacml/rest/controller/ClosedLoopDictionaryControllerTest.java +++ b/ONAP-PAP-REST/src/test/java/org/onap/policy/pap/xacml/rest/controller/ClosedLoopDictionaryControllerTest.java @@ -44,8 +44,8 @@ import org.onap.policy.rest.jpa.ClosedLoopD2Services; import org.onap.policy.rest.jpa.ClosedLoopSite; import org.onap.policy.rest.jpa.PepOptions; import org.onap.policy.rest.jpa.UserInfo; -import org.onap.policy.rest.jpa.VNFType; -import org.onap.policy.rest.jpa.VSCLAction; +import org.onap.policy.rest.jpa.VnfType; +import org.onap.policy.rest.jpa.VsclAction; import org.onap.policy.rest.jpa.VarbindDictionary; import org.springframework.mock.web.MockHttpServletResponse; @@ -72,8 +72,8 @@ public class ClosedLoopDictionaryControllerTest { userInfo.setUserLoginId("Test"); userInfo.setUserName("Test"); - doNothing().when(commonClassDao).delete(new VSCLAction()); - doNothing().when(commonClassDao).save(new VSCLAction()); + doNothing().when(commonClassDao).delete(new VsclAction()); + doNothing().when(commonClassDao).save(new VsclAction()); controller = new ClosedLoopDictionaryController(); controller.setCommonClassDao(commonClassDao); @@ -88,7 +88,7 @@ public class ClosedLoopDictionaryControllerTest { @Test public void testGetVSCLActionDictionaryByNameEntityData() { - when(commonClassDao.getDataByColumn(VSCLAction.class, "vsclaction")).thenReturn(data); + when(commonClassDao.getDataByColumn(VsclAction.class, "vsclaction")).thenReturn(data); controller.getVSCLActionDictionaryByNameEntityData(response); try { assertTrue(response.getContentAsString() != null @@ -101,7 +101,7 @@ public class ClosedLoopDictionaryControllerTest { @Test public void testGetVSCLActionDictionaryEntityData() { - when(commonClassDao.getData(VSCLAction.class)).thenReturn(new ArrayList<>()); + when(commonClassDao.getData(VsclAction.class)).thenReturn(new ArrayList<>()); controller.getVSCLActionDictionaryEntityData(response); try { assertTrue(response.getContentAsString() != null @@ -114,7 +114,7 @@ public class ClosedLoopDictionaryControllerTest { @Test public void testGetVNFTypeDictionaryByNameEntityData() { - when(commonClassDao.getDataByColumn(VNFType.class, "vnftype")).thenReturn(data); + when(commonClassDao.getDataByColumn(VnfType.class, "vnftype")).thenReturn(data); controller.getVNFTypeDictionaryByNameEntityData(response); try { assertTrue(response.getContentAsString() != null @@ -127,7 +127,7 @@ public class ClosedLoopDictionaryControllerTest { @Test public void testGetVNFTypeDictionaryEntityData() { - when(commonClassDao.getData(VNFType.class)).thenReturn(new ArrayList<>()); + when(commonClassDao.getData(VnfType.class)).thenReturn(new ArrayList<>()); controller.getVNFTypeDictionaryEntityData(response); try { assertTrue(response.getContentAsString() != null diff --git a/ONAP-PDP-REST/src/test/resources/META-INF/persistence.xml b/ONAP-PDP-REST/src/test/resources/META-INF/persistence.xml index 4362be902..01ea8dc2e 100644 --- a/ONAP-PDP-REST/src/test/resources/META-INF/persistence.xml +++ b/ONAP-PDP-REST/src/test/resources/META-INF/persistence.xml @@ -166,12 +166,12 @@ org.onap.policy.rest.jpa.RuleAlgorithms org.onap.policy.rest.jpa.SecurityZone org.onap.policy.rest.jpa.ServiceList - org.onap.policy.rest.jpa.SystemLogDB + org.onap.policy.rest.jpa.SystemLogDb org.onap.policy.rest.jpa.TermList org.onap.policy.rest.jpa.VarbindDictionary - org.onap.policy.rest.jpa.VMType - org.onap.policy.rest.jpa.VNFType - org.onap.policy.rest.jpa.VSCLAction + org.onap.policy.rest.jpa.VmType + org.onap.policy.rest.jpa.VnfType + org.onap.policy.rest.jpa.VsclAction org.onap.policy.rest.jpa.Zone org.onap.policy.jpa.BackUpMonitorEntity diff --git a/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/RainyDayTreatments.java b/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/RainyDayTreatments.java index fd1a6b73b..4b1c810af 100644 --- a/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/RainyDayTreatments.java +++ b/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/RainyDayTreatments.java @@ -3,13 +3,14 @@ * ONAP-REST * ================================================================================ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * Modifications Copyright (C) 2019 Nordix Foundation. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -20,99 +21,45 @@ package org.onap.policy.rest.jpa; +import java.io.Serializable; + import javax.persistence.Column; import javax.persistence.Entity; import javax.persistence.GeneratedValue; import javax.persistence.GenerationType; import javax.persistence.Id; - import javax.persistence.NamedQuery; import javax.persistence.OrderBy; import javax.persistence.Table; -import java.io.Serializable; +import lombok.Getter; +import lombok.NoArgsConstructor; +import lombok.Setter; /** * The persistent class for the RainyDayTreatment database table. - * */ @Entity -@Table(name="RainyDayTreatments") -@NamedQuery(name="RainyDayTreatments.findAll", query="SELECT e FROM RainyDayTreatments e") +@Table(name = "RainyDayTreatments") +@NamedQuery(name = "RainyDayTreatments.findAll", query = "SELECT e FROM RainyDayTreatments e") +@Getter +@Setter +@NoArgsConstructor public class RainyDayTreatments implements Serializable { - /** - * - */ private static final long serialVersionUID = -2491410352490381323L; @Id @GeneratedValue(strategy = GenerationType.AUTO) - @Column(name="id") + @Column(name = "id") private int id; - @Column(name="bbid", nullable=false, length=255) + @Column(name = "bbid", nullable = false, length = 255) @OrderBy("asc") private String bbid; - @Column(name="workstep", nullable=true, length=255) + @Column(name = "workstep", nullable = true, length = 255) private String workstep; - @Column(name="treatments", nullable=true, length=1028) + @Column(name = "treatments", nullable = true, length = 1028) private String treatments; - - public RainyDayTreatments() { - // Empty constructor - } - - public int getId() { - return id; - } - - public void setId(int id) { - this.id = id; - } - - /** - * @return the bbid - */ - public String getBbid() { - return bbid; - } - - /** - * @param bbid the bbid to set - */ - public void setBbid(String bbid) { - this.bbid = bbid; - } - - /** - * @return the workstep - */ - public String getWorkstep() { - return workstep; - } - - /** - * @param workstep the workstep to set - */ - public void setWorkstep(String workstep) { - this.workstep = workstep; - } - - /** - * @return the treatments - */ - public String getTreatments() { - return treatments; - } - - /** - * @param treatments the treatments to set - */ - public void setTreatments(String treatments) { - this.treatments = treatments; - } - - } \ No newline at end of file diff --git a/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/RemoteCatalogValues.java b/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/RemoteCatalogValues.java index 0cb339adf..b7662539c 100644 --- a/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/RemoteCatalogValues.java +++ b/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/RemoteCatalogValues.java @@ -3,13 +3,14 @@ * ONAP-REST * ================================================================================ * Copyright (C) 2017-2018 AT&T Intellectual Property. All rights reserved. + * Modifications Copyright (C) 2019 Nordix Foundation. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -19,8 +20,7 @@ */ package org.onap.policy.rest.jpa; -/* - */ + import java.io.Serializable; import javax.persistence.Column; @@ -32,47 +32,26 @@ import javax.persistence.NamedQuery; import javax.persistence.OrderBy; import javax.persistence.Table; +import lombok.Getter; +import lombok.Setter; @Entity -@Table(name="RemoteCatalogValues") -@NamedQuery(name="RemoteCatalogValues.findAll", query="SELECT e FROM RemoteCatalogValues e ") +@Table(name = "RemoteCatalogValues") +@NamedQuery(name = "RemoteCatalogValues.findAll", query = "SELECT e FROM RemoteCatalogValues e ") +@Getter +@Setter public class RemoteCatalogValues implements Serializable { private static final long serialVersionUID = 1L; @Id @GeneratedValue(strategy = GenerationType.AUTO) - @Column(name="id") + @Column(name = "id") private int id; - @Column(name="name", nullable=false) + @Column(name = "name", nullable = false) @OrderBy("asc") private String name; - @Column(name="value") + @Column(name = "value") private String value; - - public String getValue() { - return value; - } - - public void setValue(String value) { - this.value = value; - } - - public int getId() { - return this.id; - } - - public void setId(int id) { - this.id = id; - } - public String getName() { - return this.name; - } - - public void setName(String name) { - this.name = name; - - } - } diff --git a/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/RiskType.java b/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/RiskType.java index 8239d4ef8..3f7c89ec0 100644 --- a/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/RiskType.java +++ b/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/RiskType.java @@ -3,13 +3,14 @@ * ONAP-REST * ================================================================================ * Copyright (C) 2017-2018 AT&T Intellectual Property. All rights reserved. + * Modifications Copyright (C) 2019 Nordix Foundation. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -19,8 +20,7 @@ */ package org.onap.policy.rest.jpa; -/* - */ + import java.io.Serializable; import java.util.Date; @@ -39,106 +39,63 @@ import javax.persistence.Table; import javax.persistence.Temporal; import javax.persistence.TemporalType; +import lombok.Getter; +import lombok.Setter; +/** + * The Class RiskType. + */ @Entity -@Table(name="RiskType") -@NamedQuery(name="RiskType.findAll", query="SELECT e FROM RiskType e ") +@Table(name = "RiskType") +@NamedQuery(name = "RiskType.findAll", query = "SELECT e FROM RiskType e ") +@Getter +@Setter public class RiskType implements Serializable { private static final long serialVersionUID = 1L; @Id @GeneratedValue(strategy = GenerationType.AUTO) - @Column(name="id") + @Column(name = "id") private int id; - @Column(name="name", nullable=false, unique=true) + @Column(name = "name", nullable = false, unique = true) @OrderBy("asc") private String name; @Temporal(TemporalType.TIMESTAMP) - @Column(name="created_date", updatable=false) + @Column(name = "created_date", updatable = false) private Date createdDate; - @Column(name="description", nullable=true, length=2048) + @Column(name = "description", nullable = true, length = 2048) private String description; @Temporal(TemporalType.TIMESTAMP) - @Column(name="modified_date", nullable=false) + @Column(name = "modified_date", nullable = false) private Date modifiedDate; @ManyToOne(optional = false) - @JoinColumn(name="created_by") + @JoinColumn(name = "created_by") private UserInfo userCreatedBy; @ManyToOne(optional = false) - @JoinColumn(name="modified_by") + @JoinColumn(name = "modified_by") private UserInfo userModifiedBy; - public UserInfo getUserCreatedBy() { - return userCreatedBy; - } - - public void setUserCreatedBy(UserInfo userCreatedBy) { - this.userCreatedBy = userCreatedBy; - } - - public UserInfo getUserModifiedBy() { - return userModifiedBy; - } - - public void setUserModifiedBy(UserInfo userModifiedBy) { - this.userModifiedBy = userModifiedBy; - } - + /** + * Pre persist. + */ @PrePersist - public void prePersist() { + public void prePersist() { Date date = new Date(); this.createdDate = date; this.modifiedDate = date; } + /** + * Pre update. + */ @PreUpdate public void preUpdate() { this.modifiedDate = new Date(); } - public String getRiskName() { - return this.name; - } - - public void setRiskName(String riskName) { - this.name = riskName; - - } - public int getId() { - return this.id; - } - - public void setId(int id) { - this.id = id; - } - - public Date getCreatedDate() { - return this.createdDate; - } - - public void setCreatedDate(Date createdDate) { - this.createdDate = createdDate; - } - - public String getDescription() { - return this.description; - } - - public void setDescription(String description) { - this.description = description; - } - - public Date getModifiedDate() { - return this.modifiedDate; - } - - public void setModifiedDate(Date modifiedDate) { - this.modifiedDate = modifiedDate; - } - } diff --git a/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/RuleAlgorithms.java b/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/RuleAlgorithms.java index 905648d5c..aa2ae75bc 100644 --- a/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/RuleAlgorithms.java +++ b/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/RuleAlgorithms.java @@ -3,13 +3,14 @@ * ONAP-REST * ================================================================================ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * Modifications Copyright (C) 2019 Nordix Foundation. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -17,8 +18,11 @@ * limitations under the License. * ============LICENSE_END========================================================= */ + package org.onap.policy.rest.jpa; +import com.att.research.xacml.api.Identifier; + import java.io.Serializable; import javax.persistence.Column; @@ -30,11 +34,17 @@ import javax.persistence.NamedQuery; import javax.persistence.Table; import javax.persistence.Transient; -import com.att.research.xacml.api.Identifier; +import lombok.Getter; +import lombok.Setter; +/** + * The Class RuleAlgorithms. + */ @Entity -@Table(name="RuleAlgorithms") -@NamedQuery(name="RuleAlgorithms.findAll", query="SELECT d FROM RuleAlgorithms d") +@Table(name = "RuleAlgorithms") +@NamedQuery(name = "RuleAlgorithms.findAll", query = "SELECT d FROM RuleAlgorithms d") +@Getter +@Setter public class RuleAlgorithms implements Serializable { private static final long serialVersionUID = 1L; @@ -43,48 +53,47 @@ public class RuleAlgorithms implements Serializable { @Id @GeneratedValue(strategy = GenerationType.AUTO) - @Column(name="id") + @Column(name = "id") private int id; - @Column(name="is_standard", nullable=false) + @Column(name = "is_standard", nullable = false) private char isStandard; - @Column(name="xacml_id", nullable=false, unique=true, length=255) + @Column(name = "xacml_id", nullable = false, unique = true, length = 255) private String xacmlId; - @Column(name="short_name", nullable=false, length=64) + @Column(name = "short_name", nullable = false, length = 64) private String shortName; + /** + * Instantiates a new rule algorithms. + * + * @param id the id + * @param standard the standard + */ public RuleAlgorithms(Identifier id, char standard) { if (id != null) { this.xacmlId = id.stringValue(); } this.isStandard = standard; } + + /** + * Instantiates a new rule algorithms. + * + * @param id the id + */ public RuleAlgorithms(Identifier id) { this(id, RuleAlgorithms.STANDARD); } + /** + * Instantiates a new rule algorithms. + */ public RuleAlgorithms() { this(null, RuleAlgorithms.STANDARD); } - public int getId() { - return this.id; - } - - public void setId(int id) { - this.id = id; - } - - public char getIsStandard() { - return this.isStandard; - } - - public void setIsStandard(char isStandard) { - this.isStandard = isStandard; - } - @Transient public boolean isStandard() { return this.isStandard == RuleAlgorithms.STANDARD; @@ -94,21 +103,4 @@ public class RuleAlgorithms implements Serializable { public boolean isCustom() { return this.isStandard == RuleAlgorithms.CUSTOM; } - - public String getXacmlId() { - return this.xacmlId; - } - - public void setXacmlId(String xacmlId) { - this.xacmlId = xacmlId; - } - - public String getShortName() { - return shortName; - } - - public void setShortName(String shortName) { - this.shortName = shortName; - } - } diff --git a/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/SafePolicyWarning.java b/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/SafePolicyWarning.java index adc61506b..9663fd954 100644 --- a/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/SafePolicyWarning.java +++ b/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/SafePolicyWarning.java @@ -3,13 +3,14 @@ * ONAP-REST * ================================================================================ * Copyright (C) 2017-2018 AT&T Intellectual Property. All rights reserved. + * Modifications Copyright (C) 2019 Nordix Foundation. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -19,8 +20,7 @@ */ package org.onap.policy.rest.jpa; -/* - */ + import java.io.Serializable; import javax.persistence.Column; @@ -32,55 +32,29 @@ import javax.persistence.NamedQuery; import javax.persistence.OrderBy; import javax.persistence.Table; +import lombok.Getter; +import lombok.Setter; @Entity -@Table(name="SafePolicyWarning") -@NamedQuery(name="SafePolicyWarning.findAll", query="SELECT e FROM SafePolicyWarning e ") +@Table(name = "SafePolicyWarning") +@NamedQuery(name = "SafePolicyWarning.findAll", query = "SELECT e FROM SafePolicyWarning e ") +@Getter +@Setter public class SafePolicyWarning implements Serializable { private static final long serialVersionUID = 1L; @Id @GeneratedValue(strategy = GenerationType.AUTO) - @Column(name="id") + @Column(name = "id") private int id; - @Column(name="name", nullable=false) + @Column(name = "name", nullable = false) @OrderBy("asc") private String name; - @Column(name="message") - private String message ; - - @Column(name="riskType") - private String riskType ; - - public String getRiskType() { - return riskType; - } - public void setRiskType(String riskType) { - this.riskType = riskType; - } - - public int getId() { - return this.id; - } - - public void setId(int id) { - this.id = id; - } - public String getName() { - return this.name; - } - - public String getMessage() { - return message; - } - public void setMessage(String message) { - this.message = message; - } - public void setName(String name) { - this.name = name; - - } + @Column(name = "message") + private String message; + @Column(name = "riskType") + private String riskType; } diff --git a/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/SecurityZone.java b/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/SecurityZone.java index c1d6c0174..fe1c6ac4c 100644 --- a/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/SecurityZone.java +++ b/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/SecurityZone.java @@ -3,13 +3,14 @@ * ONAP-REST * ================================================================================ * Copyright (C) 2017-2018 AT&T Intellectual Property. All rights reserved. + * Modifications Copyright (C) 2019 Nordix Foundation. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -19,8 +20,7 @@ */ package org.onap.policy.rest.jpa; -/* - */ + import java.io.Serializable; import javax.persistence.Column; @@ -32,45 +32,26 @@ import javax.persistence.NamedQuery; import javax.persistence.OrderBy; import javax.persistence.Table; +import lombok.Getter; +import lombok.Setter; + @Entity -@Table(name="securityzone") -@NamedQuery(name="SecurityZone.findAll", query="SELECT e FROM SecurityZone e ") +@Table(name = "securityzone") +@NamedQuery(name = "SecurityZone.findAll", query = "SELECT e FROM SecurityZone e ") +@Getter +@Setter public class SecurityZone implements Serializable { private static final long serialVersionUID = 1L; @Id @GeneratedValue(strategy = GenerationType.AUTO) - @Column(name="id") + @Column(name = "id") private int id; - @Column(name="name", nullable=false) + @Column(name = "name", nullable = false) @OrderBy("asc") private String zoneName; - @Column(name="value") + @Column(name = "value") private String zoneValue; - - public int getId() { - return this.id; - } - - public void setId(int id) { - this.id = id; - } - public String getZoneName() { - return this.zoneName; - } - - public void setZoneName(String zoneName) { - this.zoneName = zoneName; - - } - public String getZoneValue() { - return this.zoneValue; - } - - public void setZoneValue(String zoneValue) { - this.zoneValue = zoneValue; - } - } diff --git a/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/ServiceList.java b/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/ServiceList.java index 33243b0a5..9be6b2ebf 100644 --- a/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/ServiceList.java +++ b/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/ServiceList.java @@ -3,13 +3,14 @@ * ONAP-REST * ================================================================================ * Copyright (C) 2017-2018 AT&T Intellectual Property. All rights reserved. + * Modifications Copyright (C) 2019 Nordix Foundation. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -19,8 +20,7 @@ */ package org.onap.policy.rest.jpa; -/* - */ + import java.io.Serializable; import javax.persistence.Column; @@ -32,92 +32,38 @@ import javax.persistence.NamedQuery; import javax.persistence.OrderBy; import javax.persistence.Table; +import lombok.Getter; +import lombok.Setter; + @Entity -@Table(name="servicegroup") -@NamedQuery(name="ServiceList.findAll", query="SELECT e FROM ServiceList e ") +@Table(name = "servicegroup") +@NamedQuery(name = "ServiceList.findAll", query = "SELECT e FROM ServiceList e ") +@Getter +@Setter public class ServiceList implements Serializable { private static final long serialVersionUID = 1L; @Id @GeneratedValue(strategy = GenerationType.AUTO) - @Column(name="id") + @Column(name = "id") private int id; - @Column(name="name", nullable=false) + @Column(name = "name", nullable = false) @OrderBy("asc") private String serviceName; - @Column(name="description") - private String serviceDesc; + @Column(name = "description") + private String serviceDescription; - @Column(name="type") + @Column(name = "type") private String serviceType; - @Column(name="transportprotocol") - private String serviceTrasProtocol; + @Column(name = "transportprotocol") + private String serviceTransportProtocol; - @Column(name="appprotocol ") + @Column(name = "appprotocol ") private String serviceAppProtocol; - @Column(name="ports") + @Column(name = "ports") private String servicePorts; - - public int getId() { - return this.id; - } - - public void setId(int id) { - this.id = id; - } - public String getServiceName() { - return this.serviceName; - } - - public void setServiceName(String serviceName) { - this.serviceName = serviceName; - - } - - public String getServiceDescription() { - return this.serviceDesc; - } - - public void setServiceDescription(String serviceDesc) { - this.serviceDesc = serviceDesc; - - } - - public String getServiceType() { - return this.serviceType; - } - - public void setServiceType(String serviceType) { - this.serviceType = serviceType; - } - - public String getServiceTransProtocol() { - return this.serviceTrasProtocol; - } - - public void setServiceTransProtocol(String serviceTrasProtocol) { - this.serviceTrasProtocol = serviceTrasProtocol; - - } - - public String getServiceAppProtocol() { - return this.serviceAppProtocol; - } - - public void setServiceAppProtocol(String serviceAppProtocol) { - this.serviceAppProtocol = serviceAppProtocol; - - } - public String getServicePorts() { - return this.servicePorts; - } - - public void setServicePorts(String servicePorts) { - this.servicePorts = servicePorts; - - } } diff --git a/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/SystemLogDB.java b/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/SystemLogDb.java similarity index 53% rename from ONAP-REST/src/main/java/org/onap/policy/rest/jpa/SystemLogDB.java rename to ONAP-REST/src/main/java/org/onap/policy/rest/jpa/SystemLogDb.java index 9dbfc52ee..9b8845fea 100644 --- a/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/SystemLogDB.java +++ b/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/SystemLogDb.java @@ -3,13 +3,14 @@ * ONAP-REST * ================================================================================ * Copyright (C) 2017-2018 AT&T Intellectual Property. All rights reserved. + * Modifications Copyright (C) 2019 Nordix Foundation. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -17,6 +18,7 @@ * limitations under the License. * ============LICENSE_END========================================================= */ + package org.onap.policy.rest.jpa; import java.io.Serializable; @@ -32,47 +34,62 @@ import javax.persistence.Table; import javax.persistence.Temporal; import javax.persistence.TemporalType; +import lombok.Getter; +import lombok.Setter; + /** - * The persistent class for the system log database table. - * -*/ + * The persistent class for the system log database table. + */ @Entity -@Table(name="SystemLogDB") -@NamedQuery(name="SystemLogDB.findAll", query="SELECT o FROM SystemLogDB o") -public class SystemLogDB implements Serializable { +@Table(name = "SystemLogDb") +@NamedQuery(name = "SystemLogDb.findAll", query = "SELECT o FROM SystemLogDb o") +@Getter +@Setter +public class SystemLogDb implements Serializable { private static final long serialVersionUID = 1L; - @Id @GeneratedValue(strategy = GenerationType.AUTO) - @Column(name="id") + @Column(name = "id") private int id; - @Column(name="type", nullable=false) + @Column(name = "type", nullable = false) private String type; - @Column(name="system", nullable=false, length=255) + @Column(name = "system", nullable = false, length = 255) private String system; - @Column(name="description", nullable=true, length=2048) + @Column(name = "description", nullable = true, length = 2048) private String description; - @Column(name="remote", nullable=false, length=255) + @Column(name = "remote", nullable = false, length = 255) private String remote; - @Column(name="logtype", nullable=false, length=255) + @Column(name = "logtype", nullable = false, length = 255) private String logtype; @Temporal(TemporalType.TIMESTAMP) - @Column(name="date", nullable=false, updatable=false) + @Column(name = "date", nullable = false, updatable = false) private Date date; - public SystemLogDB() { + /** + * Instantiates a new system log db. + */ + public SystemLogDb() { super(); } - public SystemLogDB(int id, String system, String description, String remote, - String type, String logtype) { + /** + * Instantiates a new system log db. + * + * @param id the id + * @param system the system + * @param description the description + * @param remote the remote + * @param type the type + * @param logtype the logtype + */ + public SystemLogDb(int id, String system, String description, String remote, String type, String logtype) { this.id = id; this.system = system; this.description = description; @@ -80,62 +97,4 @@ public class SystemLogDB implements Serializable { this.type = type; this.logtype = logtype; } - - public int getId() { - return this.id; - } - - public void setId(int id) { - this.id = id; - } - - public Date getDate(){ - return this.date; - } - - public void setDate(Date date){ - this.date = date; - } - - public String getDescription() { - return this.description; - } - - public void setDescription(String description) { - this.description = description; - } - - public String getType() { - return this.type; - } - - public void setType(String type) { - this.type = type; - - } - - public String getSystem() { - return this.system; - } - - public void setSystem(String system) { - this.system = system; - } - - public String getRemote() { - return this.remote; - } - - public void setRemote(String remote) { - this.remote = remote; - - } - public String getLogtype() { - return this.logtype; - } - - public void setLogtype(String logtype) { - this.logtype = logtype; - - } } diff --git a/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/TermList.java b/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/TermList.java index a87cf2a6b..63dce9390 100644 --- a/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/TermList.java +++ b/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/TermList.java @@ -3,6 +3,7 @@ * ONAP-REST * ================================================================================ * Copyright (C) 2017-2019 AT&T Intellectual Property. All rights reserved. + * Modifications Copyright (C) 2019 Nordix Foundation. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -22,6 +23,7 @@ package org.onap.policy.rest.jpa; import java.io.Serializable; import java.util.Date; + import javax.persistence.Column; import javax.persistence.Entity; import javax.persistence.GeneratedValue; @@ -37,209 +39,97 @@ import javax.persistence.Table; import javax.persistence.Temporal; import javax.persistence.TemporalType; +import lombok.Getter; +import lombok.Setter; +/** + * The Class TermList. + */ @Entity -@Table(name="TERM") -@NamedQuery(name="TermList.findAll", query="SELECT e FROM TermList e") +@Table(name = "TERM") +@NamedQuery(name = "TermList.findAll", query = "SELECT e FROM TermList e") +@Getter +@Setter public class TermList implements Serializable { private static final long serialVersionUID = 1L; @Id @GeneratedValue(strategy = GenerationType.AUTO) - @Column(name="id") + @Column(name = "id") private int id; - @Column(name="termName", nullable=false) + @Column(name = "termName", nullable = false) @OrderBy("asc") private String termName; - @Column(name="description") - private String termDescription; + @Column(name = "description") + private String description; - @Column(name="fromzone") + @Column(name = "fromzone") private String fromZone; - @Column(name="tozone") + @Column(name = "tozone") private String toZone; - @Column(name="srcIPList") - private String srcIPList; + @Column(name = "srcIPList") + private String srcIpList; - @Column(name="destIPList") - private String destIPList; + @Column(name = "destIPList") + private String destIpList; - @Column(name="protocolList") + @Column(name = "protocolList") private String protocolList; - @Column(name="portList") + @Column(name = "portList") private String portList; - @Column(name="srcPortList") + @Column(name = "srcPortList") private String srcPortList; - @Column(name="destPortList") + @Column(name = "destPortList") private String destPortList; - @Column(name="action") + @Column(name = "action") private String action; @Temporal(TemporalType.TIMESTAMP) - @Column(name="created_date", updatable=false) + @Column(name = "created_date", updatable = false) private Date createdDate; @Temporal(TemporalType.TIMESTAMP) - @Column(name="modified_date", nullable=false) + @Column(name = "modified_date", nullable = false) private Date modifiedDate; @ManyToOne(optional = false) - @JoinColumn(name="created_by") + @JoinColumn(name = "created_by") private UserInfo userCreatedBy; @ManyToOne(optional = false) - @JoinColumn(name="modified_by") + @JoinColumn(name = "modified_by") private UserInfo userModifiedBy; + /** + * Instantiates a new term list. + */ public TermList() { this.modifiedDate = new Date(); } - public Date getCreatedDate() { - return this.createdDate; - } - public void setCreatedDate(Date createdDate) { - this.createdDate = createdDate; - } - - public Date getModifiedDate() { - return this.modifiedDate; - } - public void setModifiedDate(Date modifiedDate) { - this.modifiedDate = modifiedDate; - } - - public UserInfo getUserCreatedBy() { - return userCreatedBy; - } - - public void setUserCreatedBy(UserInfo userCreatedBy) { - this.userCreatedBy = userCreatedBy; - } - - public UserInfo getUserModifiedBy() { - return userModifiedBy; - } - - public void setUserModifiedBy(UserInfo userModifiedBy) { - this.userModifiedBy = userModifiedBy; - } - + /** + * Pre persist. + */ @PrePersist - public void prePersist() { + public void prePersist() { Date date = new Date(); this.createdDate = date; this.modifiedDate = date; } + /** + * Pre update. + */ @PreUpdate public void preUpdate() { this.modifiedDate = new Date(); } - - public int getId() { - return this.id; - } - - public void setId(int id) { - this.id = id; - } - - public String getTermName() { - return this.termName; - } - - public void setTermName(String termName) { - this.termName = termName; - } - - public String getTermDescription() { - return this.termDescription; - } - - public void setDescription(String termDescription) { - this.termDescription = termDescription; - } - - public String getFromZone() { - return this.fromZone; - } - - public void setFromZones(String fromZone) { - this.fromZone = fromZone; - } - - public String getToZone() { - return this.toZone; - } - - public void setToZones(String toZone) { - this.toZone = toZone; - } - - public String getSrcIPList() { - return this.srcIPList; - } - - public void setSrcIPList(String srcIPList) { - this.srcIPList = srcIPList; - } - - public String getDestIPList() { - return this.destIPList; - } - - public void setDestIPList(String destIPList) { - this.destIPList = destIPList; - } - - public String getProtocolList() { - return this.protocolList; - } - - public void setProtocolList(String protocolList) { - this.protocolList = protocolList; - } - - public String getPortList() { - return this.portList; - } - - public void setPortList(String portList) { - this.portList = portList; - } - - public String getSrcPortList() { - return this.srcPortList; - } - - public void setSrcPortList(String srcPortList) { - this.srcPortList = srcPortList; - } - - public String getDestPortList() { - return this.destPortList; - } - - public void setDestPortList(String destPortList) { - this.destPortList = destPortList; - } - - - public String getAction() { - return this.action; - } - - public void setAction(String action) { - this.action = action; - } - } diff --git a/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/UserInfo.java b/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/UserInfo.java index da1438010..38d14f848 100644 --- a/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/UserInfo.java +++ b/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/UserInfo.java @@ -3,13 +3,14 @@ * ONAP-REST * ================================================================================ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * Modifications Copyright (C) 2019 Nordix Foundation. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -20,6 +21,10 @@ package org.onap.policy.rest.jpa; +import com.att.research.xacml.api.Identifier; +import com.att.research.xacml.std.IdentifierImpl; +import com.fasterxml.jackson.annotation.JsonBackReference; + import java.io.Serializable; import javax.persistence.Column; @@ -29,44 +34,29 @@ import javax.persistence.NamedQuery; import javax.persistence.Table; import javax.persistence.Transient; -import com.att.research.xacml.api.Identifier; -import com.att.research.xacml.std.IdentifierImpl; -import com.fasterxml.jackson.annotation.JsonBackReference; +import lombok.Getter; +import lombok.Setter; @Entity @Table(name = "UserInfo") -@NamedQuery(name="UserInfo.findAll", query="SELECT u FROM UserInfo u ") +@NamedQuery(name = "UserInfo.findAll", query = "SELECT u FROM UserInfo u ") +@Getter +@Setter public class UserInfo implements Serializable { private static final long serialVersionUID = 1L; @Id - @Column(name="loginid", nullable=false, length=45) + @Column(name = "loginid", nullable = false, length = 45) private String userLoginId; @Column(name = "name", nullable = false, unique = true) private String userName; - public UserInfo(){ + public UserInfo() { this.userLoginId = userName; } - public String getUserLoginId() { - return userLoginId; - } - - public void setUserLoginId(String loginid) { - this.userLoginId = loginid; - } - - public String getUserName() { - return userName; - } - - public void setUserName(String userName) { - this.userName = userName; - } - @Transient @JsonBackReference public Identifier getIdentiferByUserId() { diff --git a/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/VarbindDictionary.java b/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/VarbindDictionary.java index aee187e6f..070cf7a56 100644 --- a/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/VarbindDictionary.java +++ b/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/VarbindDictionary.java @@ -3,6 +3,7 @@ * ONAP-REST * ================================================================================ * Copyright (C) 2017-2019 AT&T Intellectual Property. All rights reserved. + * Modifications Copyright (C) 2019 Nordix Foundation. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -22,6 +23,7 @@ package org.onap.policy.rest.jpa; import java.io.Serializable; import java.util.Date; + import javax.persistence.Column; import javax.persistence.Entity; import javax.persistence.GeneratedValue; @@ -37,10 +39,18 @@ import javax.persistence.Table; import javax.persistence.Temporal; import javax.persistence.TemporalType; +import lombok.Getter; +import lombok.Setter; + +/** + * The Class VarbindDictionary. + */ @Entity -@Table(name="VarbindDictionary") +@Table(name = "VarbindDictionary") @NamedQuery(name = "VarbindDictionary.findAll", query = "Select v FROM VarbindDictionary v") -public class VarbindDictionary implements Serializable{ +@Getter +@Setter +public class VarbindDictionary implements Serializable { private static final long serialVersionUID = 1L; @Id @@ -48,7 +58,7 @@ public class VarbindDictionary implements Serializable{ @Column(name = "Id") private int id; - @Column(name ="varbind_Name", nullable = false, unique = true) + @Column(name = "varbind_Name", nullable = false, unique = true) @OrderBy("asc") private String varbindName; @@ -56,104 +66,46 @@ public class VarbindDictionary implements Serializable{ private String varbindDescription; @Column(name = "varbind_oid", nullable = false) - private String varbindOID; + private String varbindOid; @Temporal(TemporalType.TIMESTAMP) - @Column(name="created_date", updatable=false) + @Column(name = "created_date", updatable = false) private Date createdDate; @Temporal(TemporalType.TIMESTAMP) - @Column(name="modified_date", nullable=false) + @Column(name = "modified_date", nullable = false) private Date modifiedDate; @ManyToOne(optional = false) - @JoinColumn(name="created_by") + @JoinColumn(name = "created_by") private UserInfo userCreatedBy; @ManyToOne(optional = false) - @JoinColumn(name="modified_by") + @JoinColumn(name = "modified_by") private UserInfo userModifiedBy; + /** + * Instantiates a new varbind dictionary. + */ public VarbindDictionary() { this.setModifiedDate(new Date()); } - - public UserInfo getUserCreatedBy() { - return userCreatedBy; - } - - public void setUserCreatedBy(UserInfo userCreatedBy) { - this.userCreatedBy = userCreatedBy; - } - - public UserInfo getUserModifiedBy() { - return userModifiedBy; - } - - public void setUserModifiedBy(UserInfo userModifiedBy) { - this.userModifiedBy = userModifiedBy; - } - + /** + * Pre persist. + */ @PrePersist - public void prePersist() { + public void prePersist() { Date date = new Date(); this.createdDate = date; this.modifiedDate = date; } + /** + * Pre update. + */ @PreUpdate public void preUpdate() { this.modifiedDate = new Date(); } - - public int getId() { - return this.id; - } - - public void setId(int id) { - this.id = id; - } - - public String getVarbindName() { - return varbindName; - } - - public void setVarbindName(String varbindName) { - this.varbindName = varbindName; - } - - public String getVarbindDescription() { - return varbindDescription; - } - - public void setVarbindDescription(String varbindDescription) { - this.varbindDescription = varbindDescription; - } - - public String getVarbindOID() { - return varbindOID; - } - - public void setVarbindOID(String varbindOID) { - this.varbindOID = varbindOID; - } - - public Date getCreatedDate() { - return createdDate; - } - - public void setCreatedDate(Date createdDate) { - this.createdDate = createdDate; - } - - public Date getModifiedDate() { - return modifiedDate; - } - - public void setModifiedDate(Date modifiedDate) { - this.modifiedDate = modifiedDate; - } - - } diff --git a/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/VMType.java b/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/VmType.java similarity index 69% rename from ONAP-REST/src/main/java/org/onap/policy/rest/jpa/VMType.java rename to ONAP-REST/src/main/java/org/onap/policy/rest/jpa/VmType.java index 463e51709..51c3f657d 100644 --- a/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/VMType.java +++ b/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/VmType.java @@ -3,13 +3,14 @@ * ONAP-REST * ================================================================================ * Copyright (C) 2017-2018 AT&T Intellectual Property. All rights reserved. + * Modifications Copyright (C) 2019 Nordix Foundation. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -19,8 +20,7 @@ */ package org.onap.policy.rest.jpa; -/* - */ + import java.io.Serializable; import javax.persistence.Column; @@ -32,47 +32,26 @@ import javax.persistence.NamedQuery; import javax.persistence.OrderBy; import javax.persistence.Table; +import lombok.Getter; +import lombok.Setter; @Entity -@Table(name="VMType") -@NamedQuery(name="VMType.findAll", query="SELECT e FROM VMType e ") -public class VMType implements Serializable { +@Table(name = "VmType") +@NamedQuery(name = "VmType.findAll", query = "SELECT e FROM VmType e ") +@Getter +@Setter +public class VmType implements Serializable { private static final long serialVersionUID = 1L; @Id @GeneratedValue(strategy = GenerationType.AUTO) - @Column(name="id") + @Column(name = "id") private int id; - @Column(name="name", nullable=false) + @Column(name = "name", nullable = false) @OrderBy("asc") private String name; - @Column(name="description") + @Column(name = "description") private String description; - - public String getDescription() { - return description; - } - - public void setDescription(String description) { - this.description = description; - } - - public int getId() { - return this.id; - } - - public void setId(int id) { - this.id = id; - } - public String getName() { - return this.name; - } - - public void setName(String name) { - this.name = name; - - } - } diff --git a/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/VNFType.java b/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/VnfType.java similarity index 57% rename from ONAP-REST/src/main/java/org/onap/policy/rest/jpa/VNFType.java rename to ONAP-REST/src/main/java/org/onap/policy/rest/jpa/VnfType.java index 3d7c7f67b..1a5c679af 100644 --- a/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/VNFType.java +++ b/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/VnfType.java @@ -3,6 +3,7 @@ * ONAP-REST * ================================================================================ * Copyright (C) 2017-2019 AT&T Intellectual Property. All rights reserved. + * Modifications Copyright (C) 2019 Nordix Foundation. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -22,6 +23,7 @@ package org.onap.policy.rest.jpa; import java.io.Serializable; import java.util.Date; + import javax.persistence.Column; import javax.persistence.Entity; import javax.persistence.GeneratedValue; @@ -37,111 +39,70 @@ import javax.persistence.Table; import javax.persistence.Temporal; import javax.persistence.TemporalType; +import lombok.Getter; +import lombok.Setter; - +/** + * The Class VnfType. + */ @Entity -@Table(name="VNFType") -@NamedQuery(name="VNFType.findAll", query="SELECT v FROM VNFType v ") -public class VNFType implements Serializable { +@Table(name = "VnfType") +@NamedQuery(name = "VnfType.findAll", query = "SELECT v FROM VnfType v ") +@Getter +@Setter +public class VnfType implements Serializable { private static final long serialVersionUID = 1L; @Id @GeneratedValue(strategy = GenerationType.AUTO) - @Column(name="id") + @Column(name = "id") private int id; - @Column(name="vnf_type", nullable=false, unique=true) + @Column(name = "vnf_type", nullable = false, unique = true) @OrderBy("asc") - private String vnftype; + private String type; @Temporal(TemporalType.TIMESTAMP) - @Column(name="created_date", updatable=false) + @Column(name = "created_date", updatable = false) private Date createdDate; - @Column(name="description", nullable=true, length=2048) + @Column(name = "description", nullable = true, length = 2048) private String description; @Temporal(TemporalType.TIMESTAMP) - @Column(name="modified_date", nullable=false) + @Column(name = "modified_date", nullable = false) private Date modifiedDate; @ManyToOne(optional = false) - @JoinColumn(name="created_by") + @JoinColumn(name = "created_by") private UserInfo userCreatedBy; @ManyToOne(optional = false) - @JoinColumn(name="modified_by") + @JoinColumn(name = "modified_by") private UserInfo userModifiedBy; - public VNFType() { + /** + * Instantiates a new VNF type. + */ + public VnfType() { this.modifiedDate = new Date(); } - public UserInfo getUserCreatedBy() { - return userCreatedBy; - } - - public void setUserCreatedBy(UserInfo userCreatedBy) { - this.userCreatedBy = userCreatedBy; - } - - public UserInfo getUserModifiedBy() { - return userModifiedBy; - } - - public void setUserModifiedBy(UserInfo userModifiedBy) { - this.userModifiedBy = userModifiedBy; - } - - public String getVnftype() { - return vnftype; - } - - public void setVnftype(String vnftype) { - this.vnftype = vnftype; - } - + /** + * Pre persist. + */ @PrePersist - public void prePersist() { + public void prePersist() { Date date = new Date(); this.createdDate = date; this.modifiedDate = date; } + /** + * Pre update. + */ @PreUpdate public void preUpdate() { this.modifiedDate = new Date(); } - - public int getId() { - return this.id; - } - - public void setId(int id) { - this.id = id; - } - - public Date getCreatedDate() { - return this.createdDate; - } - - public void setCreatedDate(Date createdDate) { - this.createdDate = createdDate; - } - - public String getDescription() { - return this.description; - } - - public void setDescription(String description) { - this.description = description; - } - - public Date getModifiedDate() { - return this.modifiedDate; - } - - public void setModifiedDate(Date modifiedDate) { - this.modifiedDate = modifiedDate; - } } diff --git a/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/VSCLAction.java b/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/VsclAction.java similarity index 57% rename from ONAP-REST/src/main/java/org/onap/policy/rest/jpa/VSCLAction.java rename to ONAP-REST/src/main/java/org/onap/policy/rest/jpa/VsclAction.java index e5aac971d..5506bc5b3 100644 --- a/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/VSCLAction.java +++ b/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/VsclAction.java @@ -3,6 +3,7 @@ * ONAP-REST * ================================================================================ * Copyright (C) 2017-2019 AT&T Intellectual Property. All rights reserved. + * Modifications Copyright (C) 2019 Nordix Foundation. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -22,6 +23,7 @@ package org.onap.policy.rest.jpa; import java.io.Serializable; import java.util.Date; + import javax.persistence.Column; import javax.persistence.Entity; import javax.persistence.GeneratedValue; @@ -37,111 +39,71 @@ import javax.persistence.Table; import javax.persistence.Temporal; import javax.persistence.TemporalType; +import lombok.Getter; +import lombok.Setter; +/** + * The Class VsclAction. + */ @Entity -@Table(name="VSCLAction") -@NamedQuery(name="VSCLAction.findAll", query="SELECT v FROM VSCLAction v ") -public class VSCLAction implements Serializable { +@Table(name = "VsclAction") +@NamedQuery(name = "VsclAction.findAll", query = "SELECT v FROM VsclAction v ") +@Getter +@Setter +public class VsclAction implements Serializable { private static final long serialVersionUID = 1L; @Id @GeneratedValue(strategy = GenerationType.AUTO) - @Column(name="id") + @Column(name = "id") private int id; - @Column(name="vscl_action", nullable=false, unique=true) + @Column(name = "vscl_action", nullable = false, unique = true) @OrderBy("asc") - private String vsclaction; + private String action; @Temporal(TemporalType.TIMESTAMP) - @Column(name="created_date", updatable=false) + @Column(name = "created_date", updatable = false) private Date createdDate; - @Column(name="description", nullable=true, length=2048) + @Column(name = "description", nullable = true, length = 2048) private String description; @Temporal(TemporalType.TIMESTAMP) - @Column(name="modified_date", nullable=false) + @Column(name = "modified_date", nullable = false) private Date modifiedDate; @ManyToOne(optional = false) - @JoinColumn(name="created_by") + @JoinColumn(name = "created_by") private UserInfo userCreatedBy; @ManyToOne(optional = false) - @JoinColumn(name="modified_by") + @JoinColumn(name = "modified_by") private UserInfo userModifiedBy; - public VSCLAction() { + /** + * Instantiates a new vscl action. + */ + public VsclAction() { this.setModifiedDate(new Date()); } - public UserInfo getUserCreatedBy() { - return userCreatedBy; - } - - public void setUserCreatedBy(UserInfo userCreatedBy) { - this.userCreatedBy = userCreatedBy; - } - - public UserInfo getUserModifiedBy() { - return userModifiedBy; - } - - public void setUserModifiedBy(UserInfo userModifiedBy) { - this.userModifiedBy = userModifiedBy; - } - + /** + * Pre persist. + */ @PrePersist - public void prePersist() { + public void prePersist() { Date date = new Date(); this.createdDate = date; this.modifiedDate = date; } + /** + * Pre update. + */ @PreUpdate public void preUpdate() { this.modifiedDate = new Date(); } - public int getId() { - return this.id; - } - - public void setId(int id) { - this.id = id; - } - - public String getVsclaction() { - return vsclaction; - } - - public void setVsclaction(String vsclaction) { - this.vsclaction = vsclaction; - } - - - public Date getCreatedDate() { - return this.createdDate; - } - - public void setCreatedDate(Date createdDate) { - this.createdDate = createdDate; - } - - public String getDescription() { - return this.description; - } - - public void setDescription(String description) { - this.description = description; - } - - public Date getModifiedDate() { - return this.modifiedDate; - } - - public void setModifiedDate(Date modifiedDate) { - this.modifiedDate = modifiedDate; - } } diff --git a/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/WatchPolicyNotificationTable.java b/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/WatchPolicyNotificationTable.java index 9f2cbfdf1..5c288a8a6 100644 --- a/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/WatchPolicyNotificationTable.java +++ b/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/WatchPolicyNotificationTable.java @@ -3,13 +3,14 @@ * ONAP-REST * ================================================================================ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * Modifications Copyright (C) 2019 Nordix Foundation. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -19,13 +20,8 @@ */ package org.onap.policy.rest.jpa; -/* - * - * - * */ import java.io.Serializable; -import java.util.Objects; import javax.persistence.Column; import javax.persistence.Entity; @@ -36,70 +32,29 @@ import javax.persistence.NamedQuery; import javax.persistence.OrderBy; import javax.persistence.Table; +import lombok.EqualsAndHashCode; +import lombok.Getter; +import lombok.Setter; + @Entity @Table(name = "WatchPolicyNotificationTable") -@NamedQuery(name="WatchPolicyNotificationTable.findAll", query="SELECT e FROM WatchPolicyNotificationTable e ") -public class WatchPolicyNotificationTable implements Serializable{ +@NamedQuery(name = "WatchPolicyNotificationTable.findAll", query = "SELECT e FROM WatchPolicyNotificationTable e ") +@Getter +@Setter +@EqualsAndHashCode +public class WatchPolicyNotificationTable implements Serializable { private static final long serialVersionUID = 1L; @Id @GeneratedValue(strategy = GenerationType.AUTO) - @Column(name="id") + @Column(name = "id") private int id; - @Column(name="policyName", nullable=false, unique=true) + @Column(name = "policyName", nullable = false, unique = true) @OrderBy("asc") private String policyName; - @Column(name="loginIds", nullable=false, unique=true) + @Column(name = "loginIds", nullable = false, unique = true) @OrderBy("asc") private String loginIds; - - public int getId() { - return id; - } - - public void setId(int id) { - this.id = id; - } - - public String getPolicyName() { - return policyName; - } - - public void setPolicyName(String policyName) { - this.policyName = policyName; - } - - public String getLoginIds() { - return loginIds; - } - - public void setLoginIds(String loginIds) { - this.loginIds = loginIds; - } - - @Override - public int hashCode() { - return Objects.hash(id, policyName, loginIds); - } - - @Override - public boolean equals(Object obj) { - if(obj == null){ - return false; - } - if(obj == this){ - return true; - } - if(!(obj instanceof WatchPolicyNotificationTable)){ - return false; - } - - return id == ((WatchPolicyNotificationTable)obj).id && - policyName.equals(((WatchPolicyNotificationTable)obj).policyName) && - loginIds.equals(((WatchPolicyNotificationTable)obj).loginIds); - } - - } diff --git a/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/Zone.java b/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/Zone.java index 58c1a275a..71252ed05 100644 --- a/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/Zone.java +++ b/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/Zone.java @@ -3,13 +3,14 @@ * ONAP-REST * ================================================================================ * Copyright (C) 2017-2018 AT&T Intellectual Property. All rights reserved. + * Modifications Copyright (C) 2019 Nordix Foundation. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -19,8 +20,7 @@ */ package org.onap.policy.rest.jpa; -/* - */ + import java.io.Serializable; import javax.persistence.Column; @@ -32,45 +32,26 @@ import javax.persistence.NamedQuery; import javax.persistence.OrderBy; import javax.persistence.Table; +import lombok.Getter; +import lombok.Setter; + @Entity -@Table(name="zone") -@NamedQuery(name="Zone.findAll", query="SELECT e FROM Zone e ") +@Table(name = "zone") +@NamedQuery(name = "Zone.findAll", query = "SELECT e FROM Zone e ") +@Getter +@Setter public class Zone implements Serializable { private static final long serialVersionUID = 1L; @Id @GeneratedValue(strategy = GenerationType.AUTO) - @Column(name="id") + @Column(name = "id") private int id; - @Column(name="zonename", nullable=false) + @Column(name = "zonename", nullable = false) @OrderBy("asc") private String zoneName; - @Column(name="zonevalue") + @Column(name = "zonevalue") private String zoneValue; - - public int getId() { - return this.id; - } - - public void setId(int id) { - this.id = id; - } - public String getZoneName() { - return this.zoneName; - } - - public void setZoneName(String zoneName) { - this.zoneName = zoneName; - - } - public String getZoneValue() { - return this.zoneValue; - } - - public void setZoneValue(String zoneValue) { - this.zoneValue = zoneValue; - } - } diff --git a/ONAP-REST/src/test/java/org/onap/policy/rest/daoimpl/PolicyValidationDaoImplTest.java b/ONAP-REST/src/test/java/org/onap/policy/rest/daoimpl/PolicyValidationDaoImplTest.java index 47456106b..3cedd2312 100644 --- a/ONAP-REST/src/test/java/org/onap/policy/rest/daoimpl/PolicyValidationDaoImplTest.java +++ b/ONAP-REST/src/test/java/org/onap/policy/rest/daoimpl/PolicyValidationDaoImplTest.java @@ -24,6 +24,8 @@ package org.onap.policy.rest.daoimpl; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertNotEquals; +import static org.junit.Assert.assertNotNull; import static org.junit.Assert.assertNull; import static org.junit.Assert.assertTrue; import static org.junit.Assert.fail; @@ -53,7 +55,7 @@ import org.onap.policy.rest.jpa.OnapName; import org.onap.policy.rest.jpa.PolicyEntity; import org.onap.policy.rest.jpa.PolicyRoles; import org.onap.policy.rest.jpa.PolicyVersion; -import org.onap.policy.rest.jpa.SystemLogDB; +import org.onap.policy.rest.jpa.SystemLogDb; import org.onap.policy.rest.jpa.UserInfo; import org.onap.policy.rest.jpa.WatchPolicyNotificationTable; import org.springframework.orm.hibernate4.LocalSessionFactoryBuilder; @@ -70,7 +72,7 @@ public class PolicyValidationDaoImplTest { /** * Set up all unit tests. - * + * * @throws SQLException on SQL exceptions */ @BeforeClass @@ -98,13 +100,13 @@ public class PolicyValidationDaoImplTest { PolicyValidationDaoImpl.setSessionfactory(sessionFactory); // PolicyController.setLogTableLimit("1"); // HibernateSession.setSession(sessionFactory); - SystemLogDB data1 = new SystemLogDB(); + SystemLogDb data1 = new SystemLogDb(); data1.setDate(new Date()); data1.setLogtype("INFO"); data1.setRemote("Test"); data1.setSystem("Test"); data1.setType("Test"); - SystemLogDB data2 = new SystemLogDB(); + SystemLogDb data2 = new SystemLogDb(); data2.setDate(new Date()); data2.setLogtype("error"); data2.setRemote("Test"); @@ -332,6 +334,64 @@ public class PolicyValidationDaoImplTest { assertTrue(dataCur.size() == 1); assertTrue(dataCur.get(0) instanceof WatchPolicyNotificationTable); assertEquals(watch, dataCur.get(0)); + + WatchPolicyNotificationTable table0 = new WatchPolicyNotificationTable(); + WatchPolicyNotificationTable table1 = new WatchPolicyNotificationTable(); + assertEquals(table0, table0); + assertEquals(table0, table1); + assertNotEquals(table0, null); + String helloString = "Hello"; + Object helloObject = helloString; + assertNotEquals(table0, helloObject); + + table0.setId(1); + assertNotEquals(table0, table1); + table1.setId(1); + assertEquals(table0, table1); + + table0.setPolicyName("GoToOz"); + assertNotEquals(table0, table1); + table1.setPolicyName("GoToOz"); + assertEquals(table0, table1); + table1.setPolicyName(null); + assertNotEquals(table0, table1); + table0.setPolicyName(null); + assertEquals(table0, table1); + table1.setPolicyName("GoToOz"); + assertNotEquals(table0, table1); + table0.setPolicyName("GoToOz"); + assertEquals(table0, table1); + assertEquals(table0, table1); + table1.setPolicyName("InOz"); + assertNotEquals(table0, table1); + table0.setPolicyName("InOz"); + assertEquals(table0, table1); + + table0.setLoginIds("Wizard"); + assertNotEquals(table0, table1); + table1.setLoginIds("Wizard"); + assertEquals(table0, table1); + table1.setLoginIds(null); + assertNotEquals(table0, table1); + table0.setLoginIds(null); + assertEquals(table0, table1); + table0.setLoginIds("Wizard"); + assertNotEquals(table0, table1); + table1.setLoginIds("Wizard"); + assertEquals(table0, table1); + table1.setLoginIds(null); + table1.setLoginIds("Witch"); + assertNotEquals(table0, table1); + table0.setLoginIds("Witch"); + assertEquals(table0, table1); + + assertNotNull(table0.hashCode()); + assertNotNull(table1.hashCode()); + assertEquals(table0.hashCode(), table0.hashCode()); + + table0.setLoginIds("Witci"); + assertNotEquals(table0, table1); + assertNotEquals(table0.hashCode(), table1.hashCode()); } /* @@ -453,6 +513,7 @@ public class PolicyValidationDaoImplTest { UserInfo userInfo = new UserInfo(); userInfo.setUserLoginId("TestID"); userInfo.setUserName("Test"); + assertEquals("Test", userInfo.getIdentiferByUserId().getUri().getPath()); commonClassDao.save(userInfo); List multipleData = new ArrayList<>(); multipleData.add("TestID:Test1"); diff --git a/ONAP-REST/src/test/java/org/onap/policy/rest/jpa/ActionDictionaryJpaTest.java b/ONAP-REST/src/test/java/org/onap/policy/rest/jpa/ActionDictionaryJpaTest.java index 3967bb48e..501c7fd92 100644 --- a/ONAP-REST/src/test/java/org/onap/policy/rest/jpa/ActionDictionaryJpaTest.java +++ b/ONAP-REST/src/test/java/org/onap/policy/rest/jpa/ActionDictionaryJpaTest.java @@ -289,6 +289,13 @@ public class ActionDictionaryJpaTest { data.setXacmlId("Test"); assertTrue("Test".equals(data.getXacmlId())); data.toString(); + + RuleAlgorithms ra0 = new RuleAlgorithms(new DummyIdentifier()); + assertTrue(ra0.isStandard()); + assertFalse(ra0.isCustom()); + RuleAlgorithms ra1 = new RuleAlgorithms(new DummyIdentifier(), 'C'); + assertFalse(ra1.isStandard()); + assertTrue(ra1.isCustom()); } @Test diff --git a/ONAP-REST/src/test/java/org/onap/policy/rest/jpa/ClosedLoopPolicyDictionaryJpaTest.java b/ONAP-REST/src/test/java/org/onap/policy/rest/jpa/ClosedLoopPolicyDictionaryJpaTest.java index 96a00f934..00fba8ca6 100644 --- a/ONAP-REST/src/test/java/org/onap/policy/rest/jpa/ClosedLoopPolicyDictionaryJpaTest.java +++ b/ONAP-REST/src/test/java/org/onap/policy/rest/jpa/ClosedLoopPolicyDictionaryJpaTest.java @@ -57,13 +57,13 @@ public class ClosedLoopPolicyDictionaryJpaTest { */ @Test public void testVsclAction() { - VSCLAction data = new VSCLAction(); + VsclAction data = new VsclAction(); data.preUpdate(); data.prePersist(); data.setId(1); assertTrue(1 == data.getId()); - data.setVsclaction("Test"); - assertTrue("Test".equals(data.getVsclaction())); + data.setAction("Test"); + assertTrue("Test".equals(data.getAction())); data.setDescription("Test"); assertTrue("Test".equals(data.getDescription())); data.setCreatedDate(new Date()); @@ -81,13 +81,13 @@ public class ClosedLoopPolicyDictionaryJpaTest { */ @Test public void testVnfType() { - VNFType data = new VNFType(); + VnfType data = new VnfType(); data.preUpdate(); data.prePersist(); data.setId(1); assertTrue(1 == data.getId()); - data.setVnftype("Test"); - assertTrue("Test".equals(data.getVnftype())); + data.setType("Test"); + assertTrue("Test".equals(data.getType())); data.setDescription("Test"); assertTrue("Test".equals(data.getDescription())); data.setCreatedDate(new Date()); @@ -138,8 +138,8 @@ public class ClosedLoopPolicyDictionaryJpaTest { assertTrue("Test".equals(data.getVarbindName())); data.setVarbindDescription("Test"); assertTrue("Test".equals(data.getVarbindDescription())); - data.setVarbindOID("Test"); - assertTrue("Test".equals(data.getVarbindOID())); + data.setVarbindOid("Test"); + assertTrue("Test".equals(data.getVarbindOid())); data.setCreatedDate(new Date()); assertTrue(data.getCreatedDate() != null); data.setModifiedDate(new Date()); diff --git a/ONAP-REST/src/test/java/org/onap/policy/rest/jpa/CommonDictionaryJpaTest.java b/ONAP-REST/src/test/java/org/onap/policy/rest/jpa/CommonDictionaryJpaTest.java index caeb808d8..a6505a3f6 100644 --- a/ONAP-REST/src/test/java/org/onap/policy/rest/jpa/CommonDictionaryJpaTest.java +++ b/ONAP-REST/src/test/java/org/onap/policy/rest/jpa/CommonDictionaryJpaTest.java @@ -178,8 +178,8 @@ public class CommonDictionaryJpaTest { data.prePersist(); data.setId(1); assertTrue(1 == data.getId()); - data.setRiskName("Test"); - assertTrue("Test".equals(data.getRiskName())); + data.setName("Test"); + assertTrue("Test".equals(data.getName())); data.setDescription("Test"); assertTrue("Test".equals(data.getDescription())); data.setCreatedDate(new Date()); diff --git a/ONAP-REST/src/test/java/org/onap/policy/rest/jpa/FwDictionaryJpaTest.java b/ONAP-REST/src/test/java/org/onap/policy/rest/jpa/FwDictionaryJpaTest.java index cee9dde78..42df1c93d 100644 --- a/ONAP-REST/src/test/java/org/onap/policy/rest/jpa/FwDictionaryJpaTest.java +++ b/ONAP-REST/src/test/java/org/onap/policy/rest/jpa/FwDictionaryJpaTest.java @@ -240,8 +240,8 @@ public class FwDictionaryJpaTest { assertTrue("Test".equals(data.getServiceDescription())); data.setServiceType("Test"); assertTrue("Test".equals(data.getServiceType())); - data.setServiceTransProtocol("Test"); - assertTrue("Test".equals(data.getServiceTransProtocol())); + data.setServiceTransportProtocol("Test"); + assertTrue("Test".equals(data.getServiceTransportProtocol())); data.setServiceAppProtocol("Test"); assertTrue("Test".equals(data.getServiceAppProtocol())); data.setServicePorts("Test"); @@ -261,15 +261,15 @@ public class FwDictionaryJpaTest { data.setTermName("Test"); assertTrue("Test".equals(data.getTermName())); data.setDescription("Test"); - assertTrue("Test".equals(data.getTermDescription())); - data.setFromZones("Test"); + assertTrue("Test".equals(data.getDescription())); + data.setFromZone("Test"); assertTrue("Test".equals(data.getFromZone())); - data.setToZones("Test"); + data.setToZone("Test"); assertTrue("Test".equals(data.getToZone())); - data.setSrcIPList("Test"); - assertTrue("Test".equals(data.getSrcIPList())); - data.setDestIPList("Test"); - assertTrue("Test".equals(data.getDestIPList())); + data.setSrcIpList("Test"); + assertTrue("Test".equals(data.getSrcIpList())); + data.setDestIpList("Test"); + assertTrue("Test".equals(data.getDestIpList())); data.setProtocolList("Test"); assertTrue("Test".equals(data.getProtocolList())); data.setPortList("Test"); diff --git a/ONAP-REST/src/test/java/org/onap/policy/rest/jpa/MicroServiceDictionaryJpaTest.java b/ONAP-REST/src/test/java/org/onap/policy/rest/jpa/MicroServiceDictionaryJpaTest.java index 1fcc7baa6..174d63506 100644 --- a/ONAP-REST/src/test/java/org/onap/policy/rest/jpa/MicroServiceDictionaryJpaTest.java +++ b/ONAP-REST/src/test/java/org/onap/policy/rest/jpa/MicroServiceDictionaryJpaTest.java @@ -247,7 +247,7 @@ public class MicroServiceDictionaryJpaTest { */ @Test public void testVmType() { - VMType data = new VMType(); + VmType data = new VmType(); data.setId(1); assertTrue(1 == data.getId()); data.setName("Test"); diff --git a/ONAP-REST/src/test/java/org/onap/policy/rest/jpa/PolicyEntityJpaTest.java b/ONAP-REST/src/test/java/org/onap/policy/rest/jpa/PolicyEntityJpaTest.java index b392b6f5a..a55ff8d6e 100644 --- a/ONAP-REST/src/test/java/org/onap/policy/rest/jpa/PolicyEntityJpaTest.java +++ b/ONAP-REST/src/test/java/org/onap/policy/rest/jpa/PolicyEntityJpaTest.java @@ -21,7 +21,9 @@ package org.onap.policy.rest.jpa; +import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertNotEquals; import static org.junit.Assert.assertNotNull; import static org.junit.Assert.assertNull; import static org.junit.Assert.assertTrue; @@ -130,256 +132,261 @@ public class PolicyEntityJpaTest { PolicyEntity entity0 = new PolicyEntity(); PolicyEntity entity1 = new PolicyEntity(); - assertTrue(entity0.equals(entity0)); - assertTrue(entity0.equals(entity1)); - assertFalse(entity0.equals(null)); + assertEquals(entity0, entity0); + assertEquals(entity0, entity1); + assertNotEquals(entity0, null); String helloString = "Hello"; Object helloObject = helloString; - assertFalse(entity0.equals(helloObject)); + assertNotEquals(entity0, helloObject); entity0.setPolicyId(1); - assertFalse(entity0.equals(entity1)); + assertNotEquals(entity0, entity1); entity1.setPolicyId(1); - assertTrue(entity0.equals(entity1)); + assertEquals(entity0, entity1); entity0.setPolicyId(2); - assertFalse(entity0.equals(entity1)); + assertNotEquals(entity0, entity1); entity1.setPolicyId(2); - assertTrue(entity0.equals(entity1)); + assertEquals(entity0, entity1); entity0.setPolicyName("GoToOz"); - assertFalse(entity0.equals(entity1)); + assertNotEquals(entity0, entity1); entity1.setPolicyName("GoToOz"); - assertTrue(entity0.equals(entity1)); + assertEquals(entity0, entity1); entity1.setPolicyName(null); - assertFalse(entity0.equals(entity1)); + assertNotEquals(entity0, entity1); entity0.setPolicyName(null); - assertTrue(entity0.equals(entity1)); + assertEquals(entity0, entity1); entity1.setPolicyName("GoToOz"); - assertFalse(entity0.equals(entity1)); + assertNotEquals(entity0, entity1); entity0.setPolicyName("GoToOz"); - assertTrue(entity0.equals(entity1)); + assertEquals(entity0, entity1); entity1.setPolicyName("GoToOzNow"); - assertFalse(entity0.equals(entity1)); + assertNotEquals(entity0, entity1); entity0.setPolicyName("GoToOzNow"); - assertTrue(entity0.equals(entity1)); + assertEquals(entity0, entity1); entity0.setScope("All"); - assertFalse(entity0.equals(entity1)); + assertNotEquals(entity0, entity1); entity1.setScope("All"); - assertTrue(entity0.equals(entity1)); + assertEquals(entity0, entity1); entity1.setScope(null); - assertFalse(entity0.equals(entity1)); + assertNotEquals(entity0, entity1); entity0.setScope(null); - assertTrue(entity0.equals(entity1)); + assertEquals(entity0, entity1); entity1.setScope("All"); - assertFalse(entity0.equals(entity1)); + assertNotEquals(entity0, entity1); entity0.setScope("All"); - assertTrue(entity0.equals(entity1)); + assertEquals(entity0, entity1); entity1.setScope("AllIn"); - assertFalse(entity0.equals(entity1)); + assertNotEquals(entity0, entity1); entity0.setScope("AllIn"); - assertTrue(entity0.equals(entity1)); + assertEquals(entity0, entity1); entity0.setVersion(1); - assertFalse(entity0.equals(entity1)); + assertNotEquals(entity0, entity1); entity1.setVersion(1); - assertTrue(entity0.equals(entity1)); + assertEquals(entity0, entity1); entity0.setPolicyVersion(1); - assertFalse(entity0.equals(entity1)); + assertNotEquals(entity0, entity1); entity1.setPolicyVersion(1); - assertTrue(entity0.equals(entity1)); + assertEquals(entity0, entity1); entity0.setPolicyVersion(2); - assertFalse(entity0.equals(entity1)); + assertNotEquals(entity0, entity1); entity1.setPolicyVersion(2); - assertTrue(entity0.equals(entity1)); + assertEquals(entity0, entity1); entity0.setPolicyData("SomeData"); - assertFalse(entity0.equals(entity1)); + assertNotEquals(entity0, entity1); entity1.setPolicyData("SomeData"); - assertTrue(entity0.equals(entity1)); + assertEquals(entity0, entity1); entity1.setPolicyData(null); - assertFalse(entity0.equals(entity1)); + assertNotEquals(entity0, entity1); entity0.setPolicyData(null); - assertTrue(entity0.equals(entity1)); + assertEquals(entity0, entity1); entity1.setPolicyData("SomeData"); - assertFalse(entity0.equals(entity1)); + assertNotEquals(entity0, entity1); entity0.setPolicyData("SomeData"); - assertTrue(entity0.equals(entity1)); + assertEquals(entity0, entity1); entity1.setPolicyData("SomeMoreData"); - assertFalse(entity0.equals(entity1)); + assertNotEquals(entity0, entity1); entity0.setPolicyData("SomeMoreData"); - assertTrue(entity0.equals(entity1)); + assertEquals(entity0, entity1); ConfigurationDataEntity cde0 = new ConfigurationDataEntity(); entity0.setConfigurationDataEntity(cde0); - assertFalse(entity0.equals(entity1)); + assertNotEquals(entity0, entity1); entity1.setConfigurationDataEntity(cde0); - assertTrue(entity0.equals(entity1)); + assertEquals(entity0, entity1); entity1.setConfigurationDataEntity(null); - assertFalse(entity0.equals(entity1)); + assertNotEquals(entity0, entity1); entity0.setConfigurationDataEntity(null); - assertTrue(entity0.equals(entity1)); + assertEquals(entity0, entity1); ConfigurationDataEntity cde1 = new ConfigurationDataEntity(); entity1.setConfigurationDataEntity(cde1); - assertFalse(entity0.equals(entity1)); + assertNotEquals(entity0, entity1); entity0.setConfigurationDataEntity(cde1); - assertTrue(entity0.equals(entity1)); + assertEquals(entity0, entity1); ActionBodyEntity abe0 = new ActionBodyEntity(); entity0.setActionBodyEntity(abe0); - assertFalse(entity0.equals(entity1)); + assertNotEquals(entity0, entity1); entity1.setActionBodyEntity(abe0); - assertTrue(entity0.equals(entity1)); + assertEquals(entity0, entity1); entity1.setActionBodyEntity(null); - assertFalse(entity0.equals(entity1)); + assertNotEquals(entity0, entity1); entity0.setActionBodyEntity(null); - assertTrue(entity0.equals(entity1)); + assertEquals(entity0, entity1); entity1.setActionBodyEntity(abe0); - assertFalse(entity0.equals(entity1)); + assertNotEquals(entity0, entity1); entity0.setActionBodyEntity(abe0); - assertTrue(entity0.equals(entity1)); + assertEquals(entity0, entity1); ActionBodyEntity abe1 = new ActionBodyEntity(); entity1.setActionBodyEntity(abe1); - assertFalse(entity0.equals(entity1)); + assertNotEquals(entity0, entity1); entity0.setActionBodyEntity(abe1); - assertTrue(entity0.equals(entity1)); + assertEquals(entity0, entity1); entity0.setDescription("Description"); - assertFalse(entity0.equals(entity1)); + assertNotEquals(entity0, entity1); entity1.setDescription("Description"); - assertTrue(entity0.equals(entity1)); + assertEquals(entity0, entity1); entity1.setDescription(null); - assertFalse(entity0.equals(entity1)); + assertNotEquals(entity0, entity1); entity0.setDescription(null); - assertTrue(entity0.equals(entity1)); + assertEquals(entity0, entity1); entity1.setDescription("Description"); - assertFalse(entity0.equals(entity1)); + assertNotEquals(entity0, entity1); entity0.setDescription("Description"); - assertTrue(entity0.equals(entity1)); - assertTrue(entity0.equals(entity1)); + assertEquals(entity0, entity1); + assertEquals(entity0, entity1); entity1.setDescription("Description Extra"); - assertFalse(entity0.equals(entity1)); + assertNotEquals(entity0, entity1); entity0.setDescription("Description Extra"); - assertTrue(entity0.equals(entity1)); + assertEquals(entity0, entity1); entity0.setDeleted(true); - assertFalse(entity0.equals(entity1)); + assertNotEquals(entity0, entity1); entity1.setDeleted(true); - assertTrue(entity0.equals(entity1)); + assertEquals(entity0, entity1); entity0.setDeleted(false); - assertFalse(entity0.equals(entity1)); + assertNotEquals(entity0, entity1); entity1.setDeleted(false); - assertTrue(entity0.equals(entity1)); + assertEquals(entity0, entity1); entity0.setDeleteReasonCode("NoReason"); - assertFalse(entity0.equals(entity1)); + assertNotEquals(entity0, entity1); entity1.setDeleteReasonCode("NoReason"); - assertTrue(entity0.equals(entity1)); + assertEquals(entity0, entity1); entity1.setDeleteReasonCode(null); - assertFalse(entity0.equals(entity1)); + assertNotEquals(entity0, entity1); entity0.setDeleteReasonCode(null); - assertTrue(entity0.equals(entity1)); + assertEquals(entity0, entity1); entity1.setDeleteReasonCode("NoReason"); - assertFalse(entity0.equals(entity1)); + assertNotEquals(entity0, entity1); entity0.setDeleteReasonCode("NoReason"); - assertTrue(entity0.equals(entity1)); - assertTrue(entity0.equals(entity1)); + assertEquals(entity0, entity1); + assertEquals(entity0, entity1); entity1.setDeleteReasonCode("NoOtherReason"); - assertFalse(entity0.equals(entity1)); + assertNotEquals(entity0, entity1); entity0.setDeleteReasonCode("NoOtherReason"); - assertTrue(entity0.equals(entity1)); + assertEquals(entity0, entity1); entity0.setCreatedBy("Dorothy"); - assertFalse(entity0.equals(entity1)); + assertNotEquals(entity0, entity1); entity1.setCreatedBy("Dorothy"); - assertTrue(entity0.equals(entity1)); + assertEquals(entity0, entity1); entity1.setCreatedBy(null); - assertFalse(entity0.equals(entity1)); + assertNotEquals(entity0, entity1); entity0.setCreatedBy(null); - assertTrue(entity0.equals(entity1)); + assertEquals(entity0, entity1); entity1.setCreatedBy("Dorothy"); - assertFalse(entity0.equals(entity1)); + assertNotEquals(entity0, entity1); entity0.setCreatedBy("Dorothy"); - assertTrue(entity0.equals(entity1)); + assertEquals(entity0, entity1); entity1.setCreatedBy("Toto"); - assertFalse(entity0.equals(entity1)); + assertNotEquals(entity0, entity1); entity0.setCreatedBy("Toto"); - assertTrue(entity0.equals(entity1)); + assertEquals(entity0, entity1); entity0.setCreatedDate(new Date(12345L)); - assertFalse(entity0.equals(entity1)); + assertNotEquals(entity0, entity1); entity1.setCreatedDate(new Date(12345L)); - assertTrue(entity0.equals(entity1)); + assertEquals(entity0, entity1); entity1.setCreatedDate(null); - assertFalse(entity0.equals(entity1)); + assertNotEquals(entity0, entity1); entity0.setCreatedDate(null); - assertTrue(entity0.equals(entity1)); + assertEquals(entity0, entity1); entity1.setCreatedDate(new Date(12345L)); - assertFalse(entity0.equals(entity1)); + assertNotEquals(entity0, entity1); entity0.setCreatedDate(new Date(12345L)); - assertTrue(entity0.equals(entity1)); - assertTrue(entity0.equals(entity1)); + assertEquals(entity0, entity1); + assertEquals(entity0, entity1); entity1.setCreatedDate(new Date(123456L)); - assertFalse(entity0.equals(entity1)); + assertNotEquals(entity0, entity1); entity0.setCreatedDate(new Date(123456L)); - assertTrue(entity0.equals(entity1)); + assertEquals(entity0, entity1); entity0.setModifiedBy("Dorothy"); - assertFalse(entity0.equals(entity1)); + assertNotEquals(entity0, entity1); entity1.setModifiedBy("Dorothy"); - assertTrue(entity0.equals(entity1)); + assertEquals(entity0, entity1); entity1.setModifiedBy(null); - assertFalse(entity0.equals(entity1)); + assertNotEquals(entity0, entity1); entity0.setModifiedBy(null); - assertTrue(entity0.equals(entity1)); + assertEquals(entity0, entity1); entity1.setModifiedBy("Dorothy"); - assertFalse(entity0.equals(entity1)); + assertNotEquals(entity0, entity1); entity0.setModifiedBy("Dorothy"); - assertTrue(entity0.equals(entity1)); + assertEquals(entity0, entity1); entity1.setModifiedBy("Toto"); - assertFalse(entity0.equals(entity1)); + assertNotEquals(entity0, entity1); entity0.setModifiedBy("Toto"); - assertTrue(entity0.equals(entity1)); + assertEquals(entity0, entity1); entity0.setModifiedDate(new Date(12345L)); - assertFalse(entity0.equals(entity1)); + assertNotEquals(entity0, entity1); entity1.setModifiedDate(new Date(12345L)); - assertTrue(entity0.equals(entity1)); + assertEquals(entity0, entity1); entity1.setModifiedDate(null); - assertFalse(entity0.equals(entity1)); + assertNotEquals(entity0, entity1); entity0.setModifiedDate(null); - assertTrue(entity0.equals(entity1)); + assertEquals(entity0, entity1); entity1.setModifiedDate(new Date(12345L)); - assertFalse(entity0.equals(entity1)); + assertNotEquals(entity0, entity1); entity0.setModifiedDate(new Date(12345L)); - assertTrue(entity0.equals(entity1)); - assertTrue(entity0.equals(entity1)); + assertEquals(entity0, entity1); + assertEquals(entity0, entity1); entity1.setModifiedDate(new Date(123456L)); - assertFalse(entity0.equals(entity1)); + assertNotEquals(entity0, entity1); entity0.setModifiedDate(new Date(123456L)); - assertTrue(entity0.equals(entity1)); + assertEquals(entity0, entity1); entity0.setDeletedBy("Dorothy"); - assertFalse(entity0.equals(entity1)); + assertNotEquals(entity0, entity1); entity1.setDeletedBy("Dorothy"); - assertTrue(entity0.equals(entity1)); + assertEquals(entity0, entity1); entity1.setDeletedBy(null); - assertFalse(entity0.equals(entity1)); + assertNotEquals(entity0, entity1); entity0.setDeletedBy(null); - assertTrue(entity0.equals(entity1)); + assertEquals(entity0, entity1); entity1.setDeletedBy("Dorothy"); - assertFalse(entity0.equals(entity1)); + assertNotEquals(entity0, entity1); entity0.setDeletedBy("Dorothy"); - assertTrue(entity0.equals(entity1)); - assertTrue(entity0.equals(entity1)); + assertEquals(entity0, entity1); + assertEquals(entity0, entity1); entity1.setDeletedBy("Toto"); - assertFalse(entity0.equals(entity1)); + assertNotEquals(entity0, entity1); entity0.setDeletedBy("Toto"); - assertTrue(entity0.equals(entity1)); + assertEquals(entity0, entity1); assertNotNull(entity0.hashCode()); assertNotNull(entity1.hashCode()); + assertEquals(entity0.hashCode(), entity0.hashCode()); + + entity0.setDeletedBy("Totp"); + assertNotEquals(entity0, entity1); + assertNotEquals(entity0.hashCode(), entity1.hashCode()); } /** @@ -405,7 +412,9 @@ public class PolicyEntityJpaTest { assertTrue(data.isDeleted()); assertTrue(data.getCreatedDate() != null); assertTrue(data.getModifiedDate() != null); - data.equals(new ConfigurationDataEntity()); + String helloString = "Hello"; + Object helloObject = helloString; + assertNotEquals(data, helloObject); data.hashCode(); } diff --git a/ONAP-REST/src/test/java/org/onap/policy/rest/jpa/PolicyUtilsJpaTest.java b/ONAP-REST/src/test/java/org/onap/policy/rest/jpa/PolicyUtilsJpaTest.java index 26d47a2fc..f56e55783 100644 --- a/ONAP-REST/src/test/java/org/onap/policy/rest/jpa/PolicyUtilsJpaTest.java +++ b/ONAP-REST/src/test/java/org/onap/policy/rest/jpa/PolicyUtilsJpaTest.java @@ -21,7 +21,8 @@ package org.onap.policy.rest.jpa; -import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNotEquals; import static org.junit.Assert.assertNotNull; import static org.junit.Assert.assertTrue; @@ -116,97 +117,102 @@ public class PolicyUtilsJpaTest { PolicyVersion version0 = new PolicyVersion(); PolicyVersion version1 = new PolicyVersion(); - assertTrue(version0.equals(version0)); - assertTrue(version0.equals(version1)); - assertFalse(version0.equals(null)); + assertEquals(version0, version0); + assertEquals(version0, version1); + assertNotEquals(version0, null); String helloString = "Hello"; Object helloObject = helloString; - assertFalse(version0.equals(helloObject)); + assertNotEquals(version0, helloObject); version0.setId(1); - assertFalse(version0.equals(version1)); + assertNotEquals(version0, version1); version1.setId(1); - assertTrue(version0.equals(version1)); + assertEquals(version0, version1); version0.setActiveVersion(1); - assertFalse(version0.equals(version1)); + assertNotEquals(version0, version1); version1.setActiveVersion(1); - assertTrue(version0.equals(version1)); + assertEquals(version0, version1); version0.setCreatedBy("Dorothy"); - assertFalse(version0.equals(version1)); + assertNotEquals(version0, version1); version1.setCreatedBy("Dorothy"); - assertTrue(version0.equals(version1)); + assertEquals(version0, version1); version1.setCreatedBy(null); - assertFalse(version0.equals(version1)); + assertNotEquals(version0, version1); version0.setCreatedBy(null); - assertTrue(version0.equals(version1)); + assertEquals(version0, version1); version1.setCreatedBy("Dorothy"); - assertFalse(version0.equals(version1)); + assertNotEquals(version0, version1); version0.setCreatedBy("Dorothy"); - assertTrue(version0.equals(version1)); + assertEquals(version0, version1); version0.setCreatedDate(new Date(12345L)); - assertFalse(version0.equals(version1)); + assertNotEquals(version0, version1); version1.setCreatedDate(new Date(12345L)); - assertTrue(version0.equals(version1)); + assertEquals(version0, version1); version1.setCreatedDate(null); - assertFalse(version0.equals(version1)); + assertNotEquals(version0, version1); version0.setCreatedDate(null); - assertTrue(version0.equals(version1)); + assertEquals(version0, version1); version1.setCreatedDate(new Date(12345L)); - assertFalse(version0.equals(version1)); + assertNotEquals(version0, version1); version0.setCreatedDate(new Date(12345L)); - assertTrue(version0.equals(version1)); + assertEquals(version0, version1); version0.setHigherVersion(1); - assertFalse(version0.equals(version1)); + assertNotEquals(version0, version1); version1.setHigherVersion(1); - assertTrue(version0.equals(version1)); + assertEquals(version0, version1); version0.setModifiedBy("Dorothy"); - assertFalse(version0.equals(version1)); + assertNotEquals(version0, version1); version1.setModifiedBy("Dorothy"); - assertTrue(version0.equals(version1)); + assertEquals(version0, version1); version1.setModifiedBy(null); - assertFalse(version0.equals(version1)); + assertNotEquals(version0, version1); version0.setModifiedBy(null); - assertTrue(version0.equals(version1)); + assertEquals(version0, version1); version1.setModifiedBy("Dorothy"); - assertFalse(version0.equals(version1)); + assertNotEquals(version0, version1); version0.setModifiedBy("Dorothy"); - assertTrue(version0.equals(version1)); + assertEquals(version0, version1); version0.setModifiedDate(new Date(12345L)); - assertFalse(version0.equals(version1)); + assertNotEquals(version0, version1); version1.setModifiedDate(new Date(12345L)); - assertTrue(version0.equals(version1)); + assertEquals(version0, version1); version1.setModifiedDate(null); - assertFalse(version0.equals(version1)); + assertNotEquals(version0, version1); version0.setModifiedDate(null); - assertTrue(version0.equals(version1)); + assertEquals(version0, version1); version1.setModifiedDate(new Date(12345L)); - assertFalse(version0.equals(version1)); + assertNotEquals(version0, version1); version0.setModifiedDate(new Date(12345L)); - assertTrue(version0.equals(version1)); + assertEquals(version0, version1); version0.setPolicyName("GoToOz"); - assertFalse(version0.equals(version1)); + assertNotEquals(version0, version1); version1.setPolicyName("GoToOz"); - assertTrue(version0.equals(version1)); + assertEquals(version0, version1); version1.setPolicyName(null); - assertFalse(version0.equals(version1)); + assertNotEquals(version0, version1); version0.setPolicyName(null); - assertTrue(version0.equals(version1)); + assertEquals(version0, version1); version1.setPolicyName("GoToOz"); - assertFalse(version0.equals(version1)); + assertNotEquals(version0, version1); version0.setPolicyName("GoToOz"); - assertTrue(version0.equals(version1)); + assertEquals(version0, version1); assertNotNull(version0.hashCode()); assertNotNull(version1.hashCode()); + assertEquals(version0.hashCode(), version0.hashCode()); + + version0.setPolicyName("GoToOy"); + assertNotEquals(version0, version1); + assertNotEquals(version0.hashCode(), version1.hashCode()); } /** * Test system log DB. */ @Test - public void testSystemLogDB() { - SystemLogDB data = new SystemLogDB(); - new SystemLogDB(1, "", "", "", "", ""); + public void testSystemLogDb() { + SystemLogDb data = new SystemLogDb(); + new SystemLogDb(1, "", "", "", "", ""); data.setId(1); assertTrue(1 == data.getId()); data.setDescription("Test"); diff --git a/POLICY-SDK-APP/src/main/java/org/onap/policy/conf/HibernateSession.java b/POLICY-SDK-APP/src/main/java/org/onap/policy/conf/HibernateSession.java index 82583c5f5..ef6b98803 100644 --- a/POLICY-SDK-APP/src/main/java/org/onap/policy/conf/HibernateSession.java +++ b/POLICY-SDK-APP/src/main/java/org/onap/policy/conf/HibernateSession.java @@ -32,7 +32,7 @@ import org.hibernate.cfg.Configuration; import org.onap.policy.common.logging.flexlogger.FlexLogger; import org.onap.policy.common.logging.flexlogger.Logger; import org.onap.policy.controller.PolicyController; -import org.onap.policy.rest.jpa.SystemLogDB; +import org.onap.policy.rest.jpa.SystemLogDb; @SuppressWarnings("deprecation") public class HibernateSession { @@ -51,7 +51,7 @@ public class HibernateSession { prop.setProperty("hibernate.connection.driver_class", PolicyController.getLogdbDriver()); prop.setProperty("show_sql", "false"); logSessionFactory = new Configuration().addPackage("org.onap.policy.*").addProperties(prop) - .addAnnotatedClass(SystemLogDB.class).buildSessionFactory(); + .addAnnotatedClass(SystemLogDb.class).buildSessionFactory(); } catch (Exception ex) { LOGGER.error("Exception Occured while creating Log database Hibernate session" + ex); } 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 a7a03c021..58765ded1 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 @@ -366,7 +366,7 @@ public class CreateClosedLoopFaultController extends RestrictedBaseController { try { varbindId = (VarbindDictionary) commonclassdao.getEntityItem(VarbindDictionary.class, "varbindName", attrib); - return varbindId.getVarbindOID(); + return varbindId.getVarbindOid(); } catch (Exception e) { policyLogger.error("Error during retrieving varbindName " + attrib, e); return attrib; diff --git a/POLICY-SDK-APP/src/main/java/org/onap/policy/controller/CreateFirewallController.java b/POLICY-SDK-APP/src/main/java/org/onap/policy/controller/CreateFirewallController.java index 446e124ed..3da703ab2 100644 --- a/POLICY-SDK-APP/src/main/java/org/onap/policy/controller/CreateFirewallController.java +++ b/POLICY-SDK-APP/src/main/java/org/onap/policy/controller/CreateFirewallController.java @@ -321,9 +321,9 @@ public class CreateFirewallController extends RestrictedBaseController { List tmList = commonClassDao.getDataById(TermList.class, "termName", id); jpaTermList = (TermList) tmList.get(0); if (jpaTermList != null) { - ruleSrcList = jpaTermList.getSrcIPList(); + ruleSrcList = jpaTermList.getSrcIpList(); if ((ruleSrcList != null) && (!ruleSrcList.isEmpty()) && !"null".equals(ruleSrcList)) { - displayString.append("Source IP List: " + jpaTermList.getSrcIPList()); + displayString.append("Source IP List: " + jpaTermList.getSrcIpList()); displayString.append(" ; \t\n"); for (String srcList : ruleSrcList.split(",")) { if (srcList.startsWith(GROUP)) { @@ -354,9 +354,9 @@ public class CreateFirewallController extends RestrictedBaseController { } displayString.append("\n"); } - ruleDestList = jpaTermList.getDestIPList(); + ruleDestList = jpaTermList.getDestIpList(); if (ruleDestList != null && (!ruleDestList.isEmpty()) && !"null".equals(ruleDestList)) { - displayString.append("Destination IP List: " + jpaTermList.getDestIPList()); + displayString.append("Destination IP List: " + jpaTermList.getDestIpList()); displayString.append(" ; \t\n"); for (String destList : ruleDestList.split(",")) { if (destList.startsWith(GROUP)) { @@ -409,7 +409,7 @@ public class CreateFirewallController extends RestrictedBaseController { displayString.append("\n\t" + "Name: " + sl.getServiceName()); displayString.append("\n\t" + "Description: " + sl.getServiceDescription()); displayString.append( - "\n\t" + "Transport-Protocol: " + sl.getServiceTransProtocol()); + "\n\t" + "Transport-Protocol: " + sl.getServiceTransportProtocol()); displayString.append("\n\t" + "Ports: " + sl.getServicePorts()); displayString.append("\n"); } @@ -421,7 +421,7 @@ public class CreateFirewallController extends RestrictedBaseController { displayString.append("\n\t" + "Name: " + sl.getServiceName()); displayString.append("\n\t" + "Description: " + sl.getServiceDescription()); displayString - .append("\n\t" + "Transport-Protocol: " + sl.getServiceTransProtocol()); + .append("\n\t" + "Transport-Protocol: " + sl.getServiceTransportProtocol()); displayString.append("\n\t" + "Ports: " + sl.getServicePorts()); displayString.append("\n"); } @@ -529,7 +529,7 @@ public class CreateFirewallController extends RestrictedBaseController { for (int j = 0; j < termListData.size(); j++) { jpaTermList = (TermList) termListData.get(j); if (jpaTermList.getTermName().equals(termCollectorList.get(tl))) { - ruleDesc = jpaTermList.getTermDescription(); + ruleDesc = jpaTermList.getDescription(); if ((ruleDesc != null) && (!ruleDesc.isEmpty())) { targetTerm.setDescription(ruleDesc); } @@ -545,14 +545,14 @@ public class CreateFirewallController extends RestrictedBaseController { mapToZone = new HashMap<>(); mapToZone.put(tl, ruleToZone); } - ruleSrcPrefixList = jpaTermList.getSrcIPList(); + ruleSrcPrefixList = jpaTermList.getSrcIpList(); if ((ruleSrcPrefixList != null) && (!ruleSrcPrefixList.isEmpty())) { mapSrcIp = new HashMap<>(); mapSrcIp.put(tl, ruleSrcPrefixList); } - ruleDestPrefixList = jpaTermList.getDestIPList(); + ruleDestPrefixList = jpaTermList.getDestIpList(); if ((ruleDestPrefixList != null) && (!ruleDestPrefixList.isEmpty())) { mapDestIP = new HashMap<>(); mapDestIP.put(tl, ruleDestPrefixList); @@ -741,7 +741,7 @@ public class CreateFirewallController extends RestrictedBaseController { sl = mappingServiceList(t); targetSl.setName(sl.getServiceName()); targetSl.setDescription(sl.getServiceDescription()); - targetSl.setTransportProtocol(sl.getServiceTransProtocol()); + targetSl.setTransportProtocol(sl.getServiceTransportProtocol()); targetSl.setType(sl.getServiceType()); targetSl.setPorts(sl.getServicePorts()); servListArray.add(targetSl); @@ -794,7 +794,7 @@ public class CreateFirewallController extends RestrictedBaseController { targetSl.setName(expandGroupSl.getServiceName()); targetSl.setDescription(expandGroupSl.getServiceDescription()); - targetSl.setTransportProtocol(expandGroupSl.getServiceTransProtocol()); + targetSl.setTransportProtocol(expandGroupSl.getServiceTransportProtocol()); targetSl.setType(expandGroupSl.getServiceType()); targetSl.setPorts(expandGroupSl.getServicePorts()); servListArray.add(targetSl); diff --git a/POLICY-SDK-APP/src/main/java/org/onap/policy/dao/SystemLogDbDao.java b/POLICY-SDK-APP/src/main/java/org/onap/policy/dao/SystemLogDbDao.java index 3c3f4d397..8883475b8 100644 --- a/POLICY-SDK-APP/src/main/java/org/onap/policy/dao/SystemLogDbDao.java +++ b/POLICY-SDK-APP/src/main/java/org/onap/policy/dao/SystemLogDbDao.java @@ -22,10 +22,10 @@ package org.onap.policy.dao; import java.util.List; -import org.onap.policy.rest.jpa.SystemLogDB; +import org.onap.policy.rest.jpa.SystemLogDb; public abstract interface SystemLogDbDao { - public abstract List getLoggingData(); + public abstract List getLoggingData(); - public abstract List getSystemAlertData(); + public abstract List getSystemAlertData(); } diff --git a/POLICY-SDK-APP/src/main/java/org/onap/policy/daoImp/SystemLogDbDaoImpl.java b/POLICY-SDK-APP/src/main/java/org/onap/policy/daoImp/SystemLogDbDaoImpl.java index 768a7a41c..46aed213f 100644 --- a/POLICY-SDK-APP/src/main/java/org/onap/policy/daoImp/SystemLogDbDaoImpl.java +++ b/POLICY-SDK-APP/src/main/java/org/onap/policy/daoImp/SystemLogDbDaoImpl.java @@ -31,7 +31,7 @@ import org.onap.policy.common.logging.flexlogger.Logger; import org.onap.policy.conf.HibernateSession; import org.onap.policy.controller.PolicyController; import org.onap.policy.dao.SystemLogDbDao; -import org.onap.policy.rest.jpa.SystemLogDB; +import org.onap.policy.rest.jpa.SystemLogDb; import org.onap.policy.xacml.api.XACMLErrorConstants; import org.springframework.stereotype.Service; @@ -41,10 +41,10 @@ public class SystemLogDbDaoImpl implements SystemLogDbDao { @SuppressWarnings("unchecked") @Override - public List getLoggingData() { + public List getLoggingData() { Session session = HibernateSession.getSession(); Transaction tx = session.beginTransaction(); - List system = null; + List system = null; try { String sqlWhere = null; if (PolicyController.isjUnit()) { @@ -53,12 +53,12 @@ public class SystemLogDbDaoImpl implements SystemLogDbDao { sqlWhere = "date > DATE_SUB(curdate(), INTERVAL 5 DAY) ORDER BY date DESC limit " + PolicyController.getLogTableLimit() + ""; } - Criteria cr = session.createCriteria(SystemLogDB.class); + Criteria cr = session.createCriteria(SystemLogDb.class); cr.add(Restrictions.sqlRestriction(sqlWhere)); system = cr.list(); tx.commit(); } catch (Exception e) { - logger.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + "Error While Querying SystemLogDB Table" + e); + logger.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + "Error While Querying SystemLogDb Table" + e); } finally { try { session.close(); @@ -71,10 +71,10 @@ public class SystemLogDbDaoImpl implements SystemLogDbDao { @SuppressWarnings("unchecked") @Override - public List getSystemAlertData() { + public List getSystemAlertData() { Session session = HibernateSession.getSession(); Transaction tx = session.beginTransaction(); - List system = null; + List system = null; try { String sqlWhere = null; if (PolicyController.isjUnit()) { @@ -83,12 +83,12 @@ public class SystemLogDbDaoImpl implements SystemLogDbDao { sqlWhere = "date > DATE_SUB(curdate(), INTERVAL 5 DAY) and logtype = 'error' ORDER BY date DESC limit " + PolicyController.getSystemAlertTableLimit() + ""; } - Criteria cr = session.createCriteria(SystemLogDB.class); + Criteria cr = session.createCriteria(SystemLogDb.class); cr.add(Restrictions.sqlRestriction(sqlWhere)); system = cr.list(); tx.commit(); } catch (Exception e) { - logger.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + "Error While Querying SystemLogDB Table" + e); + logger.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + "Error While Querying SystemLogDb Table" + e); } finally { try { session.close(); diff --git a/POLICY-SDK-APP/src/test/java/org/onap/policy/admin/PolicyRestControllerTest.java b/POLICY-SDK-APP/src/test/java/org/onap/policy/admin/PolicyRestControllerTest.java index 77d66367b..e9b631f11 100644 --- a/POLICY-SDK-APP/src/test/java/org/onap/policy/admin/PolicyRestControllerTest.java +++ b/POLICY-SDK-APP/src/test/java/org/onap/policy/admin/PolicyRestControllerTest.java @@ -170,7 +170,7 @@ public class PolicyRestControllerTest { ServiceList serviceList = new ServiceList(); serviceList.setServiceName("Test"); serviceList.setServiceType("SERVICE"); - serviceList.setServiceTransProtocol("Test"); + serviceList.setServiceTransportProtocol("Test"); serviceList.setServiceAppProtocol("Test"); serviceList.setServicePorts("8080"); serviceListData.add(serviceList); @@ -207,10 +207,10 @@ public class PolicyRestControllerTest { termListData = new ArrayList<>(); TermList termList = new TermList(); termList.setTermName("Test"); - termList.setFromZones("Test"); - termList.setToZones("Test"); - termList.setSrcIPList("Test"); - termList.setDestIPList("Test"); + termList.setFromZone("Test"); + termList.setToZone("Test"); + termList.setSrcIpList("Test"); + termList.setDestIpList("Test"); termList.setSrcPortList("Test"); termList.setDestPortList("Test"); termList.setAction("Test"); diff --git a/POLICY-SDK-APP/src/test/java/org/onap/policy/daoImp/CommonClassDaoImplTest.java b/POLICY-SDK-APP/src/test/java/org/onap/policy/daoImp/CommonClassDaoImplTest.java index 0a9f9a3c0..3453f6acc 100644 --- a/POLICY-SDK-APP/src/test/java/org/onap/policy/daoImp/CommonClassDaoImplTest.java +++ b/POLICY-SDK-APP/src/test/java/org/onap/policy/daoImp/CommonClassDaoImplTest.java @@ -49,7 +49,7 @@ import org.onap.policy.rest.jpa.OnapName; import org.onap.policy.rest.jpa.PolicyEntity; import org.onap.policy.rest.jpa.PolicyRoles; import org.onap.policy.rest.jpa.PolicyVersion; -import org.onap.policy.rest.jpa.SystemLogDB; +import org.onap.policy.rest.jpa.SystemLogDb; import org.onap.policy.rest.jpa.UserInfo; import org.onap.policy.rest.jpa.WatchPolicyNotificationTable; import org.springframework.orm.hibernate4.LocalSessionFactoryBuilder; @@ -95,13 +95,13 @@ public class CommonClassDaoImplTest { CommonClassDaoImpl.setSessionfactory(sessionFactory); PolicyController.setLogTableLimit("1"); HibernateSession.setSession(sessionFactory); - SystemLogDB data1 = new SystemLogDB(); + SystemLogDb data1 = new SystemLogDb(); data1.setDate(new Date()); data1.setLogtype("INFO"); data1.setRemote("Test"); data1.setSystem("Test"); data1.setType("Test"); - SystemLogDB data2 = new SystemLogDB(); + SystemLogDb data2 = new SystemLogDb(); data2.setDate(new Date()); data2.setLogtype("error"); data2.setRemote("Test");