summaryrefslogtreecommitdiffstats
path: root/common-be
diff options
context:
space:
mode:
authorvasraz <vasyl.razinkov@est.tech>2020-08-19 18:01:52 +0100
committerVasyl Razinkov <vasyl.razinkov@est.tech>2020-09-07 19:22:41 +0000
commita8a96339680fa1c4df5577285442e902b5637631 (patch)
tree36d11a6db3ef6f9e12fd6d330c2394a39a8c325c /common-be
parent7f5501ed9e9807a4e5a17c06dd9b5989cced11aa (diff)
Fix Vulnerabilities reported by SONAR
Change-Id: I8f4e173a4ea5111db55eebaf15be86f1583082ad Signed-off-by: Vasyl Razinkov <vasyl.razinkov@est.tech> Issue-ID: SDC-3248
Diffstat (limited to 'common-be')
-rw-r--r--common-be/src/main/java/org/openecomp/sdc/be/datatypes/enums/GraphPropertyEnum.java58
-rw-r--r--common-be/src/main/java/org/openecomp/sdc/be/datatypes/enums/JsonPresentationFields.java36
-rw-r--r--common-be/src/test/java/org/openecomp/sdc/be/datatypes/enums/GraphPropertyEnumTest.java80
-rw-r--r--common-be/src/test/java/org/openecomp/sdc/be/datatypes/enums/JsonPresentationFieldsTest.java50
4 files changed, 20 insertions, 204 deletions
diff --git a/common-be/src/main/java/org/openecomp/sdc/be/datatypes/enums/GraphPropertyEnum.java b/common-be/src/main/java/org/openecomp/sdc/be/datatypes/enums/GraphPropertyEnum.java
index 1f1c01f9a4..70f76030bd 100644
--- a/common-be/src/main/java/org/openecomp/sdc/be/datatypes/enums/GraphPropertyEnum.java
+++ b/common-be/src/main/java/org/openecomp/sdc/be/datatypes/enums/GraphPropertyEnum.java
@@ -18,8 +18,11 @@ package org.openecomp.sdc.be.datatypes.enums;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
+import lombok.AllArgsConstructor;
+import lombok.Getter;
-
+@AllArgsConstructor
+@Getter
public enum GraphPropertyEnum {
// field name ,class type ,unique ,indexed
@@ -59,25 +62,16 @@ public enum GraphPropertyEnum {
IS_ARCHIVED("isArchived", Boolean.class, false, true),
IS_VSP_ARCHIVED("isVspArchived", Boolean.class, false, true),
ARCHIVE_TIME("archiveTime", Long.class, false, true),
- PREV_CATALOG_UPDATE_TIME ("previousUpdateTime", Long.class, false, true),
- CURRENT_CATALOG_UPDATE_TIME ("currentUpdateTime", Long.class, false, true),
+ PREV_CATALOG_UPDATE_TIME("previousUpdateTime", Long.class, false, true),
+ CURRENT_CATALOG_UPDATE_TIME("currentUpdateTime", Long.class, false, true),
//Healing
HEALING_VERSION("healVersion", Integer.class, false, true);
-
-
- private String property;
- private Class clazz;
- private boolean unique;
- private boolean indexed;
-
- GraphPropertyEnum(String property, Class clazz, boolean unique, boolean indexed) {
- this.property = property;
- this.clazz = clazz;
- this.unique = unique;
- this.indexed = indexed;
- }
+ private final String property;
+ private final Class<?> clazz;
+ private final boolean unique;
+ private final boolean indexed;
public static GraphPropertyEnum getByProperty(String property) {
for (GraphPropertyEnum currProperty : GraphPropertyEnum.values()) {
@@ -88,38 +82,6 @@ public enum GraphPropertyEnum {
return null;
}
- public String getProperty() {
- return property;
- }
-
- public void setProperty(String property) {
- this.property = property;
- }
-
- public Class getClazz() {
- return clazz;
- }
-
- public void setClazz(Class clazz) {
- this.clazz = clazz;
- }
-
- public boolean isUnique() {
- return unique;
- }
-
- public void setUnique(boolean unique) {
- this.unique = unique;
- }
-
- public boolean isIndexed() {
- return indexed;
- }
-
- public void setIndexed(boolean indexed) {
- this.indexed = indexed;
- }
-
public static List<String> getAllProperties() {
List<String> arrayList = new ArrayList<>();
diff --git a/common-be/src/main/java/org/openecomp/sdc/be/datatypes/enums/JsonPresentationFields.java b/common-be/src/main/java/org/openecomp/sdc/be/datatypes/enums/JsonPresentationFields.java
index 46a3f99abc..41c04e77b2 100644
--- a/common-be/src/main/java/org/openecomp/sdc/be/datatypes/enums/JsonPresentationFields.java
+++ b/common-be/src/main/java/org/openecomp/sdc/be/datatypes/enums/JsonPresentationFields.java
@@ -17,7 +17,13 @@ package org.openecomp.sdc.be.datatypes.enums;
import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonValue;
+import lombok.AllArgsConstructor;
+import lombok.Getter;
+import lombok.ToString;
+@AllArgsConstructor
+@Getter
+@ToString(onlyExplicitlyIncluded = true)
public enum JsonPresentationFields {
UNIQUE_ID("uniqueId", GraphPropertyEnum.UNIQUE_ID),
@@ -256,32 +262,16 @@ public enum JsonPresentationFields {
TOSCA_DEFINITIONS_VERSION("tosca_definitions_version", null);
-
- private String presentation;
- private GraphPropertyEnum storedAs;
-
- JsonPresentationFields(String presentation, GraphPropertyEnum storedAs) {
- this.presentation = presentation;
- this.storedAs = storedAs;
- }
+ @ToString.Include
+ private final String presentation;
+ @ToString.Exclude
+ private final GraphPropertyEnum storedAs;
@JsonValue
public String getPresentation() {
return presentation;
}
- public void setPresentation(String presentation) {
- this.presentation = presentation;
- }
-
- public GraphPropertyEnum getStoredAs() {
- return storedAs;
- }
-
- public void setStoredAs(GraphPropertyEnum storedAs) {
- this.storedAs = storedAs;
- }
-
public static String getPresentationByGraphProperty(GraphPropertyEnum property) {
for (JsonPresentationFields currPresentation : JsonPresentationFields.values()) {
if (currPresentation.getStoredAs() == property) {
@@ -291,12 +281,6 @@ public enum JsonPresentationFields {
return null;
}
- @Override
- public String toString() {
- // TODO Auto-generated method stub
- return presentation;
- }
-
@JsonCreator
public static JsonPresentationFields getByPresentation(String presentation) {
for (JsonPresentationFields inst : JsonPresentationFields.values()) {
diff --git a/common-be/src/test/java/org/openecomp/sdc/be/datatypes/enums/GraphPropertyEnumTest.java b/common-be/src/test/java/org/openecomp/sdc/be/datatypes/enums/GraphPropertyEnumTest.java
index 63d1384cda..c4165d4cc0 100644
--- a/common-be/src/test/java/org/openecomp/sdc/be/datatypes/enums/GraphPropertyEnumTest.java
+++ b/common-be/src/test/java/org/openecomp/sdc/be/datatypes/enums/GraphPropertyEnumTest.java
@@ -41,86 +41,6 @@ public class GraphPropertyEnumTest {
}
@Test
- public void testGetProperty() throws Exception {
- GraphPropertyEnum testSubject;
- String result;
-
- // default test
- testSubject = createTestSubject();
- result = testSubject.getProperty();
- }
-
- @Test
- public void testSetProperty() throws Exception {
- GraphPropertyEnum testSubject;
- String property = "";
-
- // default test
- testSubject = createTestSubject();
- testSubject.setProperty(property);
- }
-
- @Test
- public void testGetClazz() throws Exception {
- GraphPropertyEnum testSubject;
- Class result;
-
- // default test
- testSubject = createTestSubject();
- result = testSubject.getClazz();
- }
-
- @Test
- public void testSetClazz() throws Exception {
- GraphPropertyEnum testSubject;
- Class clazz = null;
-
- // default test
- testSubject = createTestSubject();
- testSubject.setClazz(clazz);
- }
-
- @Test
- public void testIsUnique() throws Exception {
- GraphPropertyEnum testSubject;
- boolean result;
-
- // default test
- testSubject = createTestSubject();
- result = testSubject.isUnique();
- }
-
- @Test
- public void testSetUnique() throws Exception {
- GraphPropertyEnum testSubject;
- boolean unique = false;
-
- // default test
- testSubject = createTestSubject();
- testSubject.setUnique(unique);
- }
-
- @Test
- public void testIsIndexed() throws Exception {
- GraphPropertyEnum testSubject;
- boolean result;
-
- // default test
- testSubject = createTestSubject();
- result = testSubject.isIndexed();
- }
-
- @Test
- public void testSetIndexed() throws Exception {
- GraphPropertyEnum testSubject;
- boolean indexed = false;
-
- // default test
- testSubject = createTestSubject();
- testSubject.setIndexed(indexed);
- }
-
- @Test
public void testGetAllProperties() throws Exception {
List<String> result;
diff --git a/common-be/src/test/java/org/openecomp/sdc/be/datatypes/enums/JsonPresentationFieldsTest.java b/common-be/src/test/java/org/openecomp/sdc/be/datatypes/enums/JsonPresentationFieldsTest.java
index b0dc9aaef4..f31b6df3a1 100644
--- a/common-be/src/test/java/org/openecomp/sdc/be/datatypes/enums/JsonPresentationFieldsTest.java
+++ b/common-be/src/test/java/org/openecomp/sdc/be/datatypes/enums/JsonPresentationFieldsTest.java
@@ -29,46 +29,6 @@ public class JsonPresentationFieldsTest {
}
@Test
- public void testGetPresentation() throws Exception {
- JsonPresentationFields testSubject;
- String result;
-
- // default test
- testSubject = createTestSubject();
- result = testSubject.getPresentation();
- }
-
- @Test
- public void testSetPresentation() throws Exception {
- JsonPresentationFields testSubject;
- String presentation = "";
-
- // default test
- testSubject = createTestSubject();
- testSubject.setPresentation(presentation);
- }
-
- @Test
- public void testGetStoredAs() throws Exception {
- JsonPresentationFields testSubject;
- GraphPropertyEnum result;
-
- // default test
- testSubject = createTestSubject();
- result = testSubject.getStoredAs();
- }
-
- @Test
- public void testSetStoredAs() throws Exception {
- JsonPresentationFields testSubject;
- GraphPropertyEnum storedAs = null;
-
- // default test
- testSubject = createTestSubject();
- testSubject.setStoredAs(storedAs);
- }
-
- @Test
public void testGetPresentationByGraphProperty() throws Exception {
GraphPropertyEnum property = null;
String result;
@@ -79,16 +39,6 @@ public class JsonPresentationFieldsTest {
}
@Test
- public void testToString() throws Exception {
- JsonPresentationFields testSubject;
- String result;
-
- // default test
- testSubject = createTestSubject();
- result = testSubject.toString();
- }
-
- @Test
public void testGetByPresentation() throws Exception {
String presentation = "";
JsonPresentationFields result;