diff options
author | liamfallon <liam.fallon@est.tech> | 2019-11-08 16:11:50 +0000 |
---|---|---|
committer | liamfallon <liam.fallon@est.tech> | 2019-11-12 09:20:22 +0000 |
commit | 0c20d1c294fe146e1018f14b07a8d861c29fe527 (patch) | |
tree | 04d82d897c7ecf69771a5810443109e17749eae5 /ONAP-PAP-REST/src/main/java | |
parent | 2ee068fed59becbd3327937125264bdcf651f7b8 (diff) |
JUnit/SONAR/Checkstyle in ONAP-REST
Third batch of JPA pojos (E-M), 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: I4fee1e9fb9c8a69dd6f2f15d3e3a8844473b857b
Signed-off-by: liamfallon <liam.fallon@est.tech>
Diffstat (limited to 'ONAP-PAP-REST/src/main/java')
3 files changed, 25 insertions, 25 deletions
diff --git a/ONAP-PAP-REST/src/main/java/org/onap/policy/pap/xacml/rest/components/HandleIncomingNotifications.java b/ONAP-PAP-REST/src/main/java/org/onap/policy/pap/xacml/rest/components/HandleIncomingNotifications.java index 4e4c02672..72e6f488a 100644 --- a/ONAP-PAP-REST/src/main/java/org/onap/policy/pap/xacml/rest/components/HandleIncomingNotifications.java +++ b/ONAP-PAP-REST/src/main/java/org/onap/policy/pap/xacml/rest/components/HandleIncomingNotifications.java @@ -250,12 +250,12 @@ public class HandleIncomingNotifications { } else if (localGroup == null) { // creating a new group try { - PolicyDbDao.getPolicyDbDaoInstance().getPapEngine().newGroup(groupRecord.getgroupName(), + PolicyDbDao.getPolicyDbDaoInstance().getPapEngine().newGroup(groupRecord.getGroupName(), groupRecord.getDescription()); } catch (NullPointerException | PAPException e) { PolicyLogger.error(MessageCodes.EXCEPTION_ERROR, e, PolicyDbDao.POLICYDBDAO_VAR, "Caught PAPException trying to create pdp group with " - + "papEngine.newGroup(groupRecord.getgroupName(), groupRecord.getDescription());"); + + "papEngine.newGroup(groupRecord.getGroupName(), groupRecord.getDescription());"); throw new PAPException("Could not create group " + groupRecord); } try { @@ -311,11 +311,11 @@ public class HandleIncomingNotifications { needToUpdate = true; } if (!PolicyDbDao.stringEquals(localGroupClone.getId(), groupRecord.getGroupId()) - || !PolicyDbDao.stringEquals(localGroupClone.getName(), groupRecord.getgroupName())) { + || !PolicyDbDao.stringEquals(localGroupClone.getName(), groupRecord.getGroupName())) { // changing ids // we do not want to change the id, the papEngine will do this // for us, it needs to know the old id - localGroupClone.setName(groupRecord.getgroupName()); + localGroupClone.setName(groupRecord.getGroupName()); needToUpdate = true; } if (!PolicyDbDao.stringEquals(localGroupClone.getDescription(), groupRecord.getDescription())) { diff --git a/ONAP-PAP-REST/src/main/java/org/onap/policy/pap/xacml/rest/components/PolicyDbDaoTransactionInstance.java b/ONAP-PAP-REST/src/main/java/org/onap/policy/pap/xacml/rest/components/PolicyDbDaoTransactionInstance.java index 882169a34..67214acf2 100644 --- a/ONAP-PAP-REST/src/main/java/org/onap/policy/pap/xacml/rest/components/PolicyDbDaoTransactionInstance.java +++ b/ONAP-PAP-REST/src/main/java/org/onap/policy/pap/xacml/rest/components/PolicyDbDaoTransactionInstance.java @@ -1008,7 +1008,7 @@ public class PolicyDbDaoTransactionInstance implements PolicyDbDaoTransaction { } if (group.getName() != null - && !PolicyDbDao.stringEquals(group.getName(), groupToUpdateInDb.getgroupName())) { + && !PolicyDbDao.stringEquals(group.getName(), groupToUpdateInDb.getGroupName())) { // we need to check if the new id exists in the database String newGrpId = PolicyDbDao.createNewPdpGroupId(group.getName()); Query checkGroupQuery = session.createQuery(PolicyDbDao.GROUPENTITY_SELECT); 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 8dda4ddc7..39a12c81a 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 @@ -42,8 +42,8 @@ import org.onap.policy.pap.xacml.rest.util.DictionaryUtils; import org.onap.policy.rest.dao.CommonClassDao; import org.onap.policy.rest.jpa.ActionList; import org.onap.policy.rest.jpa.AddressGroup; -import org.onap.policy.rest.jpa.FWTag; -import org.onap.policy.rest.jpa.FWTagPicker; +import org.onap.policy.rest.jpa.FwTag; +import org.onap.policy.rest.jpa.FwTagPicker; import org.onap.policy.rest.jpa.FirewallDictionaryList; import org.onap.policy.rest.jpa.GroupServiceList; import org.onap.policy.rest.jpa.PortList; @@ -1013,7 +1013,7 @@ public class FirewallDictionaryController { produces = MediaType.APPLICATION_JSON_VALUE) public void getTagPickerNameEntityDataByName(HttpServletResponse response) { DictionaryUtils utils = getDictionaryUtilsInstance(); - utils.getDataByEntity(response, fwTagPickerDatas, tagPickerName, FWTagPicker.class); + utils.getDataByEntity(response, fwTagPickerDatas, tagPickerName, FwTagPicker.class); } @RequestMapping( @@ -1022,7 +1022,7 @@ public class FirewallDictionaryController { produces = MediaType.APPLICATION_JSON_VALUE) public void getTagPickerDictionaryEntityData(HttpServletResponse response) { DictionaryUtils utils = getDictionaryUtilsInstance(); - utils.getData(response, fwTagPickerDatas, FWTagPicker.class); + utils.getData(response, fwTagPickerDatas, FwTagPicker.class); } @RequestMapping(value = {"/fw_dictionary/save_fwTagPicker"}, method = {RequestMethod.POST}) @@ -1034,15 +1034,15 @@ public class FirewallDictionaryController { ObjectMapper mapper = new ObjectMapper(); mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false); JsonNode root = mapper.readTree(request.getReader()); - FWTagPicker fwTagPicker; + FwTagPicker fwTagPicker; TagGridValues data; String userId = ""; if (fromAPI) { - fwTagPicker = mapper.readValue(root.get(dictionaryFields).toString(), FWTagPicker.class); + fwTagPicker = mapper.readValue(root.get(dictionaryFields).toString(), FwTagPicker.class); data = mapper.readValue(root.get(dictionaryFields).toString(), TagGridValues.class); userId = "API"; } else { - fwTagPicker = mapper.readValue(root.get("fwTagPickerDictionaryData").toString(), FWTagPicker.class); + fwTagPicker = mapper.readValue(root.get("fwTagPickerDictionaryData").toString(), FwTagPicker.class); data = mapper.readValue(root.get("fwTagPickerDictionaryData").toString(), TagGridValues.class); userId = root.get(userid).textValue(); } @@ -1051,10 +1051,10 @@ public class FirewallDictionaryController { UserInfo userInfo = utils.getUserInfo(userId); List<Object> duplicateData = commonClassDao.checkDuplicateEntry(fwTagPicker.getTagPickerName(), - tagPickerName, FWTagPicker.class); + tagPickerName, FwTagPicker.class); boolean duplicateflag = false; if (!duplicateData.isEmpty()) { - FWTagPicker data1 = (FWTagPicker) duplicateData.get(0); + FwTagPicker data1 = (FwTagPicker) duplicateData.get(0); if (request.getParameter(operation) != null && "update".equals(request.getParameter(operation))) { fwTagPicker.setId(data1.getId()); } else if ((request.getParameter(operation) != null @@ -1073,7 +1073,7 @@ public class FirewallDictionaryController { fwTagPicker.setModifiedDate(new Date()); commonClassDao.update(fwTagPicker); } - responseString = mapper.writeValueAsString(commonClassDao.getData(FWTagPicker.class)); + responseString = mapper.writeValueAsString(commonClassDao.getData(FwTagPicker.class)); } else { responseString = duplicateResponseString; } @@ -1092,7 +1092,7 @@ public class FirewallDictionaryController { public void removeFirewallTagPickerDictionary(HttpServletRequest request, HttpServletResponse response) throws IOException { DictionaryUtils utils = getDictionaryUtilsInstance(); - utils.removeData(request, response, fwTagPickerDatas, FWTagPicker.class); + utils.removeData(request, response, fwTagPickerDatas, FwTagPicker.class); } @RequestMapping( @@ -1101,7 +1101,7 @@ public class FirewallDictionaryController { produces = MediaType.APPLICATION_JSON_VALUE) public void getTagDictionaryEntityData(HttpServletResponse response) { DictionaryUtils utils = getDictionaryUtilsInstance(); - utils.getData(response, fwTagDatas, FWTag.class); + utils.getData(response, fwTagDatas, FwTag.class); } @RequestMapping( @@ -1110,7 +1110,7 @@ public class FirewallDictionaryController { produces = MediaType.APPLICATION_JSON_VALUE) public void getTagNameEntityDataByName(HttpServletResponse response) { DictionaryUtils utils = getDictionaryUtilsInstance(); - utils.getDataByEntity(response, fwTagDatas, "fwTagName", FWTag.class); + utils.getDataByEntity(response, fwTagDatas, "fwTagName", FwTag.class); } @RequestMapping(value = {"/fw_dictionary/save_fwTag"}, method = {RequestMethod.POST}) @@ -1122,15 +1122,15 @@ public class FirewallDictionaryController { ObjectMapper mapper = new ObjectMapper(); mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false); JsonNode root = mapper.readTree(request.getReader()); - FWTag fwTag; + FwTag fwTag; TagGridValues tagGridValues; String userId = ""; if (fromAPI) { - fwTag = mapper.readValue(root.get(dictionaryFields).toString(), FWTag.class); + fwTag = mapper.readValue(root.get(dictionaryFields).toString(), FwTag.class); tagGridValues = mapper.readValue(root.get(dictionaryFields).toString(), TagGridValues.class); userId = "API"; } else { - fwTag = mapper.readValue(root.get("fwTagDictionaryData").toString(), FWTag.class); + fwTag = mapper.readValue(root.get("fwTagDictionaryData").toString(), FwTag.class); tagGridValues = mapper.readValue(root.get("fwTagDictionaryData").toString(), TagGridValues.class); userId = root.get(userid).textValue(); } @@ -1138,10 +1138,10 @@ public class FirewallDictionaryController { UserInfo userInfo = utils.getUserInfo(userId); List<Object> duplicateData = - commonClassDao.checkDuplicateEntry(fwTag.getFwTagName(), "fwTagName", FWTag.class); + commonClassDao.checkDuplicateEntry(fwTag.getFwTagName(), "fwTagName", FwTag.class); boolean duplicateflag = false; if (!duplicateData.isEmpty()) { - FWTag data = (FWTag) duplicateData.get(0); + FwTag data = (FwTag) duplicateData.get(0); if (request.getParameter(operation) != null && "update".equals(request.getParameter(operation))) { fwTag.setId(data.getId()); } else if ((request.getParameter(operation) != null @@ -1160,7 +1160,7 @@ public class FirewallDictionaryController { fwTag.setModifiedDate(new Date()); commonClassDao.update(fwTag); } - responseString = mapper.writeValueAsString(commonClassDao.getData(FWTag.class)); + responseString = mapper.writeValueAsString(commonClassDao.getData(FwTag.class)); } else { responseString = duplicateResponseString; } @@ -1179,7 +1179,7 @@ public class FirewallDictionaryController { public void removeFirewallTagDictionary(HttpServletRequest request, HttpServletResponse response) throws IOException { DictionaryUtils utils = getDictionaryUtilsInstance(); - utils.removeData(request, response, fwTagDatas, FWTag.class); + utils.removeData(request, response, fwTagDatas, FwTag.class); } } |