From 70975c212b58b793d3893e131a3d23d8144f5df9 Mon Sep 17 00:00:00 2001 From: vasraz Date: Sat, 19 Jun 2021 13:53:06 +0100 Subject: Reduce usage of outdated library JMockit (catalog-dao) Signed-off-by: Vasyl Razinkov Issue-ID: SDC-3379 Change-Id: I6b46049b71eafbfedfd3d40c68c743efff13ef54 --- .../schema/tables/DistribStatusEventTableDesc.java | 33 +++++++------------- .../org/openecomp/sdc/be/dao/utils/JsonUtil.java | 6 ---- .../sdc/be/resources/data/CategoryData.java | 35 ++++------------------ 3 files changed, 16 insertions(+), 58 deletions(-) (limited to 'catalog-dao/src/main/java/org') diff --git a/catalog-dao/src/main/java/org/openecomp/sdc/be/dao/cassandra/schema/tables/DistribStatusEventTableDesc.java b/catalog-dao/src/main/java/org/openecomp/sdc/be/dao/cassandra/schema/tables/DistribStatusEventTableDesc.java index 7e64605228..ff40d06fc5 100644 --- a/catalog-dao/src/main/java/org/openecomp/sdc/be/dao/cassandra/schema/tables/DistribStatusEventTableDesc.java +++ b/catalog-dao/src/main/java/org/openecomp/sdc/be/dao/cassandra/schema/tables/DistribStatusEventTableDesc.java @@ -21,14 +21,16 @@ package org.openecomp.sdc.be.dao.cassandra.schema.tables; import com.datastax.driver.core.DataType; import java.util.Map; +import lombok.AllArgsConstructor; +import lombok.Getter; import org.apache.commons.lang3.tuple.ImmutablePair; import org.openecomp.sdc.be.resources.data.auditing.AuditingTypesConstants; public class DistribStatusEventTableDesc extends DistribBaseEventTableDesc { @Override - protected void updateColumnDistribDescription(Map> columns) { - for (DSEFieldsDescription field : DSEFieldsDescription.values()) { + protected void updateColumnDistribDescription(final Map> columns) { + for (final DSEFieldsDescription field : DSEFieldsDescription.values()) { columns.put(field.getName(), new ImmutablePair<>(field.type, field.indexed)); } } @@ -38,7 +40,9 @@ public class DistribStatusEventTableDesc extends DistribBaseEventTableDesc { return AuditingTypesConstants.DISTRIBUTION_STATUS_EVENT_TYPE; } - enum DSEFieldsDescription { + @Getter + @AllArgsConstructor + private enum DSEFieldsDescription { // @formatter:off DID("did", DataType.varchar(), true), CONSUMER_ID("consumer_id", DataType.varchar(), false), @@ -47,26 +51,9 @@ public class DistribStatusEventTableDesc extends DistribBaseEventTableDesc { STATUS_TIME("status_time", DataType.varchar(), false); // @formatter:on - private String name; - private DataType type; - private boolean indexed; + private final String name; + private final DataType type; + private final boolean indexed; - DSEFieldsDescription(String name, DataType type, boolean indexed) { - this.name = name; - this.type = type; - this.indexed = indexed; - } - - public String getName() { - return name; - } - - public DataType getType() { - return type; - } - - public boolean isIndexed() { - return indexed; - } } } diff --git a/catalog-dao/src/main/java/org/openecomp/sdc/be/dao/utils/JsonUtil.java b/catalog-dao/src/main/java/org/openecomp/sdc/be/dao/utils/JsonUtil.java index ebcb1d5271..8153d44be7 100644 --- a/catalog-dao/src/main/java/org/openecomp/sdc/be/dao/utils/JsonUtil.java +++ b/catalog-dao/src/main/java/org/openecomp/sdc/be/dao/utils/JsonUtil.java @@ -139,10 +139,4 @@ public final class JsonUtil { return mapper.readValue(json, type); } - public static List toList(String json, Class elementClass, Class elementGenericClass) throws IOException { - ObjectMapper mapper = getOneObjectMapper(); - JavaType elementType = mapper.getTypeFactory().constructParametricType(elementClass, elementGenericClass); - JavaType listType = mapper.getTypeFactory().constructCollectionType(List.class, elementType); - return mapper.readValue(json, listType); - } } diff --git a/catalog-dao/src/main/java/org/openecomp/sdc/be/resources/data/CategoryData.java b/catalog-dao/src/main/java/org/openecomp/sdc/be/resources/data/CategoryData.java index 229d774222..f4f92941c7 100644 --- a/catalog-dao/src/main/java/org/openecomp/sdc/be/resources/data/CategoryData.java +++ b/catalog-dao/src/main/java/org/openecomp/sdc/be/resources/data/CategoryData.java @@ -21,10 +21,16 @@ package org.openecomp.sdc.be.resources.data; import java.util.HashMap; import java.util.Map; +import lombok.Getter; +import lombok.Setter; +import lombok.ToString; import org.openecomp.sdc.be.dao.graph.datatype.GraphNode; import org.openecomp.sdc.be.dao.neo4j.GraphPropertiesDictionary; import org.openecomp.sdc.be.datatypes.enums.NodeTypeEnum; +@Getter +@Setter +@ToString public abstract class CategoryData extends GraphNode { private String name; @@ -59,38 +65,9 @@ public abstract class CategoryData extends GraphNode { return map; } - public String getName() { - return name; - } - - public void setName(String name) { - this.name = name; - } - - public String getNormalizedName() { - return normalizedName; - } - - public void setNormalizedName(String normalizedName) { - this.normalizedName = normalizedName; - } - - @Override - public String toString() { - return "CategoryData [name=" + name + ", normalizedName=" + normalizedName + "uniqueId=" + uniqueId + "]"; - } - @Override public String getUniqueIdKey() { return GraphPropertiesDictionary.UNIQUE_ID.getProperty(); } - @Override - public String getUniqueId() { - return uniqueId; - } - - public void setUniqueId(String uniqueId) { - this.uniqueId = uniqueId; - } } -- cgit 1.2.3-korg