diff options
author | liamfallon <liam.fallon@est.tech> | 2019-11-18 12:36:28 +0000 |
---|---|---|
committer | liamfallon <liam.fallon@est.tech> | 2019-11-18 15:27:15 +0000 |
commit | 779125e31adbcc59a9864843b523bd6ed2751cbb (patch) | |
tree | 55d42bf962d5a684efeaf0025d90e6adc2551ab5 /ONAP-PAP-REST/src/main/java | |
parent | a2ab61f0ad39970ad35c3e47ff8429f59850c469 (diff) |
Unit/SONAR/Checkstyle in ONAP-REST
Util package of ONAP-REST, 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: Ic134408efe76b9838f5607a07f1735d12bd41032
Signed-off-by: liamfallon <liam.fallon@est.tech>
Diffstat (limited to 'ONAP-PAP-REST/src/main/java')
5 files changed, 47 insertions, 47 deletions
diff --git a/ONAP-PAP-REST/src/main/java/org/onap/policy/pap/xacml/rest/components/CreateNewMicroServiceModel.java b/ONAP-PAP-REST/src/main/java/org/onap/policy/pap/xacml/rest/components/CreateNewMicroServiceModel.java index ea5e8aa43..e18628dff 100644 --- a/ONAP-PAP-REST/src/main/java/org/onap/policy/pap/xacml/rest/components/CreateNewMicroServiceModel.java +++ b/ONAP-PAP-REST/src/main/java/org/onap/policy/pap/xacml/rest/components/CreateNewMicroServiceModel.java @@ -49,16 +49,16 @@ import org.onap.policy.pap.xacml.rest.XACMLPapServlet; import org.onap.policy.pap.xacml.rest.daoimpl.CommonClassDaoImpl; import org.onap.policy.rest.jpa.MicroServiceModels; import org.onap.policy.rest.jpa.UserInfo; -import org.onap.policy.rest.util.MSAttributeObject; -import org.onap.policy.rest.util.MSModelUtils; -import org.onap.policy.rest.util.MSModelUtils.MODEL_TYPE; +import org.onap.policy.rest.util.MsAttributeObject; +import org.onap.policy.rest.util.MsModelUtils; +import org.onap.policy.rest.util.MsModelUtils.ModelType; public class CreateNewMicroServiceModel { private static final Logger logger = FlexLogger.getLogger(CreateNewMicroServiceModel.class); private MicroServiceModels newModel = null; - private HashMap<String, MSAttributeObject> classMap = new HashMap<>(); + private HashMap<String, MsAttributeObject> classMap = new HashMap<>(); - private MSModelUtils utils = new MSModelUtils(XACMLPapServlet.getMsOnapName(), XACMLPapServlet.getMsPolicyName()); + private MsModelUtils utils = new MsModelUtils(XACMLPapServlet.getMsOnapName(), XACMLPapServlet.getMsPolicyName()); public CreateNewMicroServiceModel(String fileName, String serviceName, String string, String version) { super(); @@ -84,7 +84,7 @@ public class CreateNewMicroServiceModel { this.newModel.setUserCreatedBy(userInfo); String cleanUpFile = null; - Map<String, MSAttributeObject> tempMap = new HashMap<>(); + Map<String, MsAttributeObject> tempMap = new HashMap<>(); // Need to delete the file if (importFile.contains(".zip")) { extractFolder(randomID + ".zip"); @@ -100,7 +100,7 @@ public class CreateNewMicroServiceModel { cleanUpFile = "ExtractDir" + File.separator + randomID + ".yml"; } else { - tempMap = utils.processEpackage("ExtractDir" + File.separator + randomID + ".xmi", MODEL_TYPE.XMI); + tempMap = utils.processEpackage("ExtractDir" + File.separator + randomID + ".xmi", ModelType.XMI); classMap.putAll(tempMap); cleanUpFile = "ExtractDir" + File.separator + randomID + ".xmi"; } @@ -111,7 +111,7 @@ public class CreateNewMicroServiceModel { } private void processFiles(String modelName, List<File> fileList) { - Map<String, MSAttributeObject> tempMap; + Map<String, MsAttributeObject> tempMap; for (File file : fileList) { if (file.isFile()) { int indx = file.getName().lastIndexOf('.'); @@ -123,7 +123,7 @@ public class CreateNewMicroServiceModel { } else { - tempMap = utils.processEpackage(file.getAbsolutePath(), MODEL_TYPE.XMI); + tempMap = utils.processEpackage(file.getAbsolutePath(), ModelType.XMI); classMap.putAll(tempMap); } } @@ -149,7 +149,7 @@ public class CreateNewMicroServiceModel { utils.parseTosca(fileName); - MSAttributeObject msAttributes = new MSAttributeObject(); + MsAttributeObject msAttributes = new MsAttributeObject(); msAttributes.setClassName(modelName); LinkedHashMap<String, String> returnAttributeList = new LinkedHashMap<>(); @@ -256,7 +256,7 @@ public class CreateNewMicroServiceModel { public Map<String, String> addValuesToNewModel(String type) { Map<String, String> successMap = new HashMap<>(); - MSAttributeObject mainClass = null; + MsAttributeObject mainClass = null; List<String> dependency = null; String subAttribute = null; @@ -317,7 +317,7 @@ public class CreateNewMicroServiceModel { dependency = utils.getFullDependencyList(dependency, classMap); if (!dependency.isEmpty()) { for (String element : dependency) { - MSAttributeObject temp = new MSAttributeObject(); + MsAttributeObject temp = new MsAttributeObject(); if (classMap.containsKey(element)) { temp = classMap.get(element); mainClass.addAllRefAttribute(temp.getRefAttribute()); diff --git a/ONAP-PAP-REST/src/main/java/org/onap/policy/pap/xacml/rest/components/CreateNewOptimizationModel.java b/ONAP-PAP-REST/src/main/java/org/onap/policy/pap/xacml/rest/components/CreateNewOptimizationModel.java index 0f52b9bae..8c63a2766 100644 --- a/ONAP-PAP-REST/src/main/java/org/onap/policy/pap/xacml/rest/components/CreateNewOptimizationModel.java +++ b/ONAP-PAP-REST/src/main/java/org/onap/policy/pap/xacml/rest/components/CreateNewOptimizationModel.java @@ -45,19 +45,19 @@ import org.onap.policy.pap.xacml.rest.XACMLPapServlet; import org.onap.policy.pap.xacml.rest.daoimpl.CommonClassDaoImpl; import org.onap.policy.rest.jpa.OptimizationModels; import org.onap.policy.rest.jpa.UserInfo; -import org.onap.policy.rest.util.MSAttributeObject; -import org.onap.policy.rest.util.MSModelUtils; -import org.onap.policy.rest.util.MSModelUtils.MODEL_TYPE; +import org.onap.policy.rest.util.MsAttributeObject; +import org.onap.policy.rest.util.MsModelUtils; +import org.onap.policy.rest.util.MsModelUtils.ModelType; public class CreateNewOptimizationModel { private static final Logger logger = FlexLogger.getLogger(CreateNewOptimizationModel.class); private OptimizationModels newModel = null; - private HashMap<String, MSAttributeObject> classMap = new HashMap<>(); + private HashMap<String, MsAttributeObject> classMap = new HashMap<>(); private static final String EXTRACTDIR = "ExtractDir"; private static final String SUCCESS = "success"; - MSModelUtils utils = new MSModelUtils(XACMLPapServlet.getMsOnapName(), XACMLPapServlet.getMsPolicyName()); + MsModelUtils utils = new MsModelUtils(XACMLPapServlet.getMsOnapName(), XACMLPapServlet.getMsPolicyName()); public CreateNewOptimizationModel() { super(); @@ -75,7 +75,7 @@ public class CreateNewOptimizationModel { this.newModel.setUserCreatedBy(userInfo); String cleanUpFile = null; - Map<String, MSAttributeObject> tempMap = new HashMap<>(); + Map<String, MsAttributeObject> tempMap = new HashMap<>(); // Need to delete the file if (importFile.contains(".zip")) { extractFolder(randomID + ".zip"); @@ -103,7 +103,7 @@ public class CreateNewOptimizationModel { cleanUpFile = EXTRACTDIR + File.separator + randomID + ".yml"; } else { - tempMap = utils.processEpackage(EXTRACTDIR + File.separator + randomID + ".xmi", MODEL_TYPE.XMI); + tempMap = utils.processEpackage(EXTRACTDIR + File.separator + randomID + ".xmi", ModelType.XMI); classMap.putAll(tempMap); cleanUpFile = EXTRACTDIR + File.separator + randomID + ".xmi"; } @@ -118,7 +118,7 @@ public class CreateNewOptimizationModel { utils.parseTosca(fileName); - MSAttributeObject msAttributes = new MSAttributeObject(); + MsAttributeObject msAttributes = new MsAttributeObject(); msAttributes.setClassName(modelName); LinkedHashMap<String, String> returnAttributeList = new LinkedHashMap<>(); @@ -216,7 +216,7 @@ public class CreateNewOptimizationModel { public Map<String, String> addValuesToNewModel() { Map<String, String> successMap = new HashMap<>(); - MSAttributeObject mainClass; + MsAttributeObject mainClass; if (!classMap.containsKey(this.newModel.getModelName())) { logger.error( diff --git a/ONAP-PAP-REST/src/main/java/org/onap/policy/pap/xacml/rest/controller/MicroServiceDictionaryController.java b/ONAP-PAP-REST/src/main/java/org/onap/policy/pap/xacml/rest/controller/MicroServiceDictionaryController.java index b9e1ce1ce..566ac1447 100644 --- a/ONAP-PAP-REST/src/main/java/org/onap/policy/pap/xacml/rest/controller/MicroServiceDictionaryController.java +++ b/ONAP-PAP-REST/src/main/java/org/onap/policy/pap/xacml/rest/controller/MicroServiceDictionaryController.java @@ -54,8 +54,8 @@ import org.onap.policy.rest.jpa.MicroServiceModels; import org.onap.policy.rest.jpa.MicroserviceHeaderdeFaults; import org.onap.policy.rest.jpa.PrefixList; import org.onap.policy.rest.jpa.UserInfo; -import org.onap.policy.rest.util.MSAttributeObject; -import org.onap.policy.rest.util.MSModelUtils; +import org.onap.policy.rest.util.MsAttributeObject; +import org.onap.policy.rest.util.MsModelUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.http.MediaType; import org.springframework.stereotype.Controller; @@ -75,7 +75,7 @@ public class MicroServiceDictionaryController { private static String getDictionary = "getDictionary"; private static String errorMsg = "error"; private static String dictionaryDBQuery = "dictionaryDBQuery"; - private LinkedHashMap<String, MSAttributeObject> classMap; + private LinkedHashMap<String, MsAttributeObject> classMap; private List<String> modelList = new ArrayList<>(); private static String dictionaryFields = "dictionaryFields"; private static String duplicateResponseString = "Duplicate"; @@ -109,7 +109,7 @@ public class MicroServiceDictionaryController { MicroServiceDictionaryController.commonClassDao = commonClassDao; } - MSModelUtils utils = new MSModelUtils(XACMLPapServlet.getMsOnapName(), XACMLPapServlet.getMsPolicyName()); + MsModelUtils utils = new MsModelUtils(XACMLPapServlet.getMsOnapName(), XACMLPapServlet.getMsPolicyName()); private MicroServiceModels newModel; @@ -650,12 +650,12 @@ public class MicroServiceDictionaryController { Set<String> keys = jsonObject.keySet(); for (String key : keys) { String value = jsonObject.get(key).toString(); - MSAttributeObject msAttributeObject = mapper1.readValue(value, MSAttributeObject.class); + MsAttributeObject msAttributeObject = mapper1.readValue(value, MsAttributeObject.class); classMap.put(key, msAttributeObject); } userId = root.get("userid").textValue(); - MSAttributeObject mainClass = classMap.get(this.newModel.getModelName()); + MsAttributeObject mainClass = classMap.get(this.newModel.getModelName()); this.newModel.setDependency("[]"); String value = new Gson().toJson(mainClass.getSubClass()); this.newModel.setSubAttributes(value); @@ -703,7 +703,7 @@ public class MicroServiceDictionaryController { Set<String> keys = jsonObject.keySet(); for (String key : keys) { String value = jsonObject.get(key).toString(); - MSAttributeObject msAttributeObject = mapper1.readValue(value, MSAttributeObject.class); + MsAttributeObject msAttributeObject = mapper1.readValue(value, MsAttributeObject.class); classMap.put(key, msAttributeObject); } } @@ -769,11 +769,11 @@ public class MicroServiceDictionaryController { utils.removeData(request, response, microServiceModelsDictionaryDatas, MicroServiceModels.class); } - private void addValuesToNewModel(HashMap<String, MSAttributeObject> classMap) { + private void addValuesToNewModel(HashMap<String, MsAttributeObject> classMap) { // Loop through the classmap and pull out the required info for the new file. String subAttribute = null; - MSAttributeObject mainClass = classMap.get(this.newModel.getModelName()); + MsAttributeObject mainClass = classMap.get(this.newModel.getModelName()); if (mainClass != null) { String dependTemp = StringUtils.replaceEach(mainClass.getDependency(), new String[] {"[", "]", " "}, @@ -781,7 +781,7 @@ public class MicroServiceDictionaryController { ArrayList<String> dependency = new ArrayList<>(Arrays.asList(dependTemp.split(","))); dependency = getFullDependencyList(dependency); for (String element : dependency) { - MSAttributeObject temp = classMap.get(element); + MsAttributeObject temp = classMap.get(element); if (temp != null) { mainClass.addAllRefAttribute(temp.getRefAttribute()); mainClass.addAllAttribute(temp.getAttribute()); @@ -812,7 +812,7 @@ public class MicroServiceDictionaryController { returnList.addAll(dependency); for (String element : dependency) { if (classMap.containsKey(element)) { - MSAttributeObject value = classMap.get(element); + MsAttributeObject value = classMap.get(element); String rawValue = StringUtils.replaceEach(value.getDependency(), new String[] {"[", "]"}, new String[] {"", ""}); workingList = new ArrayList<>(Arrays.asList(rawValue.split(","))); diff --git a/ONAP-PAP-REST/src/main/java/org/onap/policy/pap/xacml/rest/controller/OptimizationDictionaryController.java b/ONAP-PAP-REST/src/main/java/org/onap/policy/pap/xacml/rest/controller/OptimizationDictionaryController.java index 52394bab0..a24ee0275 100644 --- a/ONAP-PAP-REST/src/main/java/org/onap/policy/pap/xacml/rest/controller/OptimizationDictionaryController.java +++ b/ONAP-PAP-REST/src/main/java/org/onap/policy/pap/xacml/rest/controller/OptimizationDictionaryController.java @@ -43,8 +43,8 @@ import org.onap.policy.pap.xacml.rest.util.DictionaryUtils; import org.onap.policy.rest.dao.CommonClassDao; import org.onap.policy.rest.jpa.OptimizationModels; import org.onap.policy.rest.jpa.UserInfo; -import org.onap.policy.rest.util.MSAttributeObject; -import org.onap.policy.rest.util.MSModelUtils; +import org.onap.policy.rest.util.MsAttributeObject; +import org.onap.policy.rest.util.MsModelUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.http.MediaType; import org.springframework.stereotype.Controller; @@ -57,7 +57,7 @@ public class OptimizationDictionaryController { private static CommonClassDao commonClassDao; private static String operation = "operation"; - private LinkedHashMap<String, MSAttributeObject> classMap; + private LinkedHashMap<String, MsAttributeObject> classMap; private static String dictionaryFields = "dictionaryFields"; private static String duplicateResponseString = "Duplicate"; private static String optimizationModelsDictionaryDatas = "optimizationModelsDictionaryDatas"; @@ -85,7 +85,7 @@ public class OptimizationDictionaryController { OptimizationDictionaryController.commonClassDao = commonClassDao; } - MSModelUtils utils = new MSModelUtils(XACMLPapServlet.getMsOnapName(), XACMLPapServlet.getMsPolicyName()); + MsModelUtils utils = new MsModelUtils(XACMLPapServlet.getMsOnapName(), XACMLPapServlet.getMsPolicyName()); private OptimizationModels newModel; @@ -157,12 +157,12 @@ public class OptimizationDictionaryController { Set<String> keys = jsonObject.keySet(); for (String key : keys) { String value = jsonObject.get(key).toString(); - MSAttributeObject msAttributeObject = mapper1.readValue(value, MSAttributeObject.class); + MsAttributeObject msAttributeObject = mapper1.readValue(value, MsAttributeObject.class); classMap.put(key, msAttributeObject); } userId = root.get("userid").textValue(); - MSAttributeObject mainClass = classMap.get(this.newModel.getModelName()); + MsAttributeObject mainClass = classMap.get(this.newModel.getModelName()); this.newModel.setDependency("[]"); String value = new Gson().toJson(mainClass.getSubClass()); this.newModel.setSubattributes(value); @@ -212,7 +212,7 @@ public class OptimizationDictionaryController { Set<String> keys = jsonObject.keySet(); for (String key : keys) { String value = jsonObject.get(key).toString(); - MSAttributeObject msAttributeObject = mapper1.readValue(value, MSAttributeObject.class); + MsAttributeObject msAttributeObject = mapper1.readValue(value, MsAttributeObject.class); classMap.put(key, msAttributeObject); } } @@ -279,11 +279,11 @@ public class OptimizationDictionaryController { dUtils.removeData(request, response, optimizationModelsDictionaryDatas, OptimizationModels.class); } - private void addValuesToNewModel(HashMap<String, MSAttributeObject> classMap) { + private void addValuesToNewModel(HashMap<String, MsAttributeObject> classMap) { // Loop through the classmap and pull out the required info for the new file. String subAttribute = null; - MSAttributeObject mainClass = classMap.get(this.newModel.getModelName()); + MsAttributeObject mainClass = classMap.get(this.newModel.getModelName()); if (mainClass != null) { String dependTemp = StringUtils.replaceEach(mainClass.getDependency(), new String[] {"[", "]", " "}, @@ -291,7 +291,7 @@ public class OptimizationDictionaryController { ArrayList<String> dependency = new ArrayList<>(Arrays.asList(dependTemp.split(","))); dependency = getFullDependencyList(dependency); for (String element : dependency) { - MSAttributeObject temp = classMap.get(element); + MsAttributeObject temp = classMap.get(element); if (temp != null) { mainClass.addAllRefAttribute(temp.getRefAttribute()); mainClass.addAllAttribute(temp.getAttribute()); @@ -322,7 +322,7 @@ public class OptimizationDictionaryController { returnList.addAll(dependency); for (String element : dependency) { if (classMap.containsKey(element)) { - MSAttributeObject value = classMap.get(element); + MsAttributeObject value = classMap.get(element); String rawValue = StringUtils.replaceEach(value.getDependency(), new String[] {"[", "]"}, new String[] {"", ""}); workingList = new ArrayList<>(Arrays.asList(rawValue.split(","))); diff --git a/ONAP-PAP-REST/src/main/java/org/onap/policy/pap/xacml/rest/model/RemoveGroupPolicy.java b/ONAP-PAP-REST/src/main/java/org/onap/policy/pap/xacml/rest/model/RemoveGroupPolicy.java index b83db1f07..908353ba3 100644 --- a/ONAP-PAP-REST/src/main/java/org/onap/policy/pap/xacml/rest/model/RemoveGroupPolicy.java +++ b/ONAP-PAP-REST/src/main/java/org/onap/policy/pap/xacml/rest/model/RemoveGroupPolicy.java @@ -26,14 +26,14 @@ import java.util.Collection; import java.util.HashSet; import java.util.Set; -import org.onap.policy.rest.util.PDPPolicyContainer; +import org.onap.policy.rest.util.PdpPolicyContainer; import org.onap.policy.xacml.api.pap.OnapPDPGroup; import org.onap.policy.xacml.std.pap.StdPDPGroup; public class RemoveGroupPolicy { // Container from where we are fetching the policies - private static PDPPolicyContainer policyContainer; + private static PdpPolicyContainer policyContainer; private StdPDPGroup updatedObject; private final StdPDPGroup group; @@ -57,7 +57,7 @@ public class RemoveGroupPolicy { if (this.group == null) { return; } - setRemoveGroupPolicy(new PDPPolicyContainer(group)); + setRemoveGroupPolicy(new PdpPolicyContainer(group)); } /** @@ -71,7 +71,7 @@ public class RemoveGroupPolicy { this.isSaved = true; } - private static void setRemoveGroupPolicy(PDPPolicyContainer pdpPolicyContainer) { + private static void setRemoveGroupPolicy(PdpPolicyContainer pdpPolicyContainer) { RemoveGroupPolicy.policyContainer = pdpPolicyContainer; } |