aboutsummaryrefslogtreecommitdiffstats
path: root/ONAP-PAP-REST
diff options
context:
space:
mode:
authorliamfallon <liam.fallon@est.tech>2019-11-08 16:11:50 +0000
committerliamfallon <liam.fallon@est.tech>2019-11-12 09:20:22 +0000
commit0c20d1c294fe146e1018f14b07a8d861c29fe527 (patch)
tree04d82d897c7ecf69771a5810443109e17749eae5 /ONAP-PAP-REST
parent2ee068fed59becbd3327937125264bdcf651f7b8 (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')
-rw-r--r--ONAP-PAP-REST/src/main/java/org/onap/policy/pap/xacml/rest/components/HandleIncomingNotifications.java8
-rw-r--r--ONAP-PAP-REST/src/main/java/org/onap/policy/pap/xacml/rest/components/PolicyDbDaoTransactionInstance.java2
-rw-r--r--ONAP-PAP-REST/src/main/java/org/onap/policy/pap/xacml/rest/controller/FirewallDictionaryController.java40
-rw-r--r--ONAP-PAP-REST/src/test/java/org/onap/policy/pap/xacml/rest/components/PolicyDBDaoTest.java8
-rw-r--r--ONAP-PAP-REST/src/test/java/org/onap/policy/pap/xacml/rest/controller/FirewallDictionaryControllerTest.java24
5 files changed, 41 insertions, 41 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);
}
}
diff --git a/ONAP-PAP-REST/src/test/java/org/onap/policy/pap/xacml/rest/components/PolicyDBDaoTest.java b/ONAP-PAP-REST/src/test/java/org/onap/policy/pap/xacml/rest/components/PolicyDBDaoTest.java
index 05f633099..99cc47c23 100644
--- a/ONAP-PAP-REST/src/test/java/org/onap/policy/pap/xacml/rest/components/PolicyDBDaoTest.java
+++ b/ONAP-PAP-REST/src/test/java/org/onap/policy/pap/xacml/rest/components/PolicyDBDaoTest.java
@@ -312,7 +312,7 @@ public class PolicyDBDaoTest {
getGroup.setParameter("deleted", false);
List<?> groups = getGroup.list();
GroupEntity groupEntity = (GroupEntity) groups.get(0);
- Assert.assertEquals(groupName, groupEntity.getgroupName());
+ Assert.assertEquals(groupName, groupEntity.getGroupName());
Assert.assertEquals("this is a test group", groupEntity.getDescription());
session.getTransaction().commit();
session.close();
@@ -375,7 +375,7 @@ public class PolicyDBDaoTest {
Assert.fail();
}
PdpEntity pdp = (PdpEntity) pdps.get(0);
- Assert.assertEquals(groupName, pdp.getGroup().getgroupName());
+ Assert.assertEquals(groupName, pdp.getGroup().getGroupName());
Assert.assertEquals(pdp.getPdpName(), "primary");
session3.getTransaction().commit();
session3.close();
@@ -451,7 +451,7 @@ public class PolicyDBDaoTest {
getPdp3.setParameter("deleted", false);
List<?> pdps3 = getPdp3.list();
for (Object obj : pdps3) {
- Assert.assertEquals("testgroup1", ((PdpEntity) obj).getGroup().getgroupName());
+ Assert.assertEquals("testgroup1", ((PdpEntity) obj).getGroup().getGroupName());
}
session5.getTransaction().commit();
@@ -490,7 +490,7 @@ public class PolicyDBDaoTest {
getPdp4.setParameter("deleted", false);
List<?> pdps4 = getPdp4.list();
for (Object obj : pdps4) {
- Assert.assertEquals("testgroup2", ((PdpEntity) obj).getGroup().getgroupName());
+ Assert.assertEquals("testgroup2", ((PdpEntity) obj).getGroup().getGroupName());
}
session7.getTransaction().commit();
diff --git a/ONAP-PAP-REST/src/test/java/org/onap/policy/pap/xacml/rest/controller/FirewallDictionaryControllerTest.java b/ONAP-PAP-REST/src/test/java/org/onap/policy/pap/xacml/rest/controller/FirewallDictionaryControllerTest.java
index b94e8d338..3359a7aed 100644
--- a/ONAP-PAP-REST/src/test/java/org/onap/policy/pap/xacml/rest/controller/FirewallDictionaryControllerTest.java
+++ b/ONAP-PAP-REST/src/test/java/org/onap/policy/pap/xacml/rest/controller/FirewallDictionaryControllerTest.java
@@ -47,8 +47,8 @@ import org.onap.policy.rest.adapter.Term;
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;
@@ -228,25 +228,25 @@ public class FirewallDictionaryControllerTest {
@Test
public void testGetTagPickerNameEntityDataByName() {
- test_WithGetDataByColumn(FWTagPicker.class, "fwTagPickerDictionaryDatas", "tagPickerName",
+ test_WithGetDataByColumn(FwTagPicker.class, "fwTagPickerDictionaryDatas", "tagPickerName",
() -> controller.getTagPickerNameEntityDataByName(response));
}
@Test
public void testGetTagPickerDictionaryEntityData() {
- test_WithGetData(FWTagPicker.class, "fwTagPickerDictionaryDatas",
+ test_WithGetData(FwTagPicker.class, "fwTagPickerDictionaryDatas",
() -> controller.getTagPickerDictionaryEntityData(response));
}
@Test
public void testGetTagNameEntityDataByName() {
- test_WithGetDataByColumn(FWTag.class, "fwTagDictionaryDatas", "fwTagName",
+ test_WithGetDataByColumn(FwTag.class, "fwTagDictionaryDatas", "fwTagName",
() -> controller.getTagNameEntityDataByName(response));
}
@Test
public void testGetTagDictionaryEntityData() {
- test_WithGetData(FWTag.class, "fwTagDictionaryDatas", () -> controller.getTagDictionaryEntityData(response));
+ test_WithGetData(FwTag.class, "fwTagDictionaryDatas", () -> controller.getTagDictionaryEntityData(response));
}
@Test
@@ -563,7 +563,7 @@ public class FirewallDictionaryControllerTest {
"{\"fwTagPickerDictionaryData\":{\"description\":\"test\",\"networkRole\":\"test\",\"tagPickerName\":"
+ "\"Test\",\"tags\":[{\"$$hashKey\":\"object:1855\",\"id\":\"choice1\",\"number\":\"test\",\"option\":"
+ "\"Test\"}]},\"userid\":\"demo\"}";
- testSave(FWTagPicker.class, "fwTagPickerDictionaryDatas", "tagPickerName",
+ testSave(FwTagPicker.class, "fwTagPickerDictionaryDatas", "tagPickerName",
() -> controller.saveFirewallTagPickerDictionary(request, response));
}
@@ -573,14 +573,14 @@ public class FirewallDictionaryControllerTest {
"{\"fwTagPickerDictionaryData\":{\"id\":1,\"description\":\"test\",\"networkRole\":"
+ "\"test\",\"tagPickerName\":\"Test\",\"tags\":[{\"$$hashKey\":\"object:1855\",\"id\":"
+ "\"choice1\",\"number\":\"test\",\"option\":\"Test\"}]},\"userid\":\"demo\"}";
- testUpdate(FWTagPicker.class, "fwTagPickerDictionaryDatas", "tagPickerName",
+ testUpdate(FwTagPicker.class, "fwTagPickerDictionaryDatas", "tagPickerName",
() -> controller.saveFirewallTagPickerDictionary(request, response));
}
@Test
public void testRemoveFirewallTagPickerDictionary() {
jsonString = "{\"userid\":\"demo\",\"data\":{\"id\":1,\"description\":\"test\",\"tagPickerName\":\"Test\"}}";
- testRemove(FWTagPicker.class, "fwTagPickerDictionaryDatas",
+ testRemove(FwTagPicker.class, "fwTagPickerDictionaryDatas",
() -> controller.removeFirewallTagPickerDictionary(request, response));
}
@@ -589,7 +589,7 @@ public class FirewallDictionaryControllerTest {
jsonString =
"{\"fwTagDictionaryData\":{\"description\":\"test\",\"fwTagName\":\"Test\",\"tags\":[{\"$$hashKey\":"
+ "\"object:1690\",\"id\":\"choice1\",\"tags\":\"test\"}]},\"userid\":\"demo\"}";
- testSave(FWTag.class, "fwTagDictionaryDatas", "fwTagName",
+ testSave(FwTag.class, "fwTagDictionaryDatas", "fwTagName",
() -> controller.saveFirewallTagDictionary(request, response));
}
@@ -598,14 +598,14 @@ public class FirewallDictionaryControllerTest {
jsonString =
"{\"fwTagDictionaryData\":{\"id\":1,\"description\":\"test\",\"fwTagName\":\"Test\",\"tags\":"
+ "[{\"$$hashKey\":\"object:1690\",\"id\":\"choice1\",\"tags\":\"test\"}]},\"userid\":\"demo\"}";
- testUpdate(FWTag.class, "fwTagDictionaryDatas", "fwTagName",
+ testUpdate(FwTag.class, "fwTagDictionaryDatas", "fwTagName",
() -> controller.saveFirewallTagDictionary(request, response));
}
@Test
public void testRemoveFirewallTagDictionary() {
jsonString = "{\"userid\":\"demo\",\"data\":{\"id\":1,\"description\":\"test\",\"fwTagName\":\"Test\"}}";
- testRemove(FWTag.class, "fwTagDictionaryDatas",
+ testRemove(FwTag.class, "fwTagDictionaryDatas",
() -> controller.removeFirewallTagDictionary(request, response));
}