Improve test coverage 36/118536/1
authorvasraz <vasyl.razinkov@est.tech>
Thu, 25 Feb 2021 16:20:56 +0000 (16:20 +0000)
committerVasyl Razinkov <vasyl.razinkov@est.tech>
Thu, 25 Feb 2021 16:24:24 +0000 (16:24 +0000)
Change-Id: I8f46ff547d885d7c742ed67577da4e934b76d6d1
Signed-off-by: Vasyl Razinkov <vasyl.razinkov@est.tech>
Issue-ID: SDC-3490

19 files changed:
common-be/src/main/java/org/openecomp/sdc/be/datatypes/enums/AssetTypeEnum.java
common-be/src/main/java/org/openecomp/sdc/be/datatypes/enums/ComponentTypeEnum.java
common-be/src/main/java/org/openecomp/sdc/be/datatypes/enums/ConnectionPointEnum.java
common-be/src/main/java/org/openecomp/sdc/be/datatypes/enums/CreatedFrom.java
common-be/src/main/java/org/openecomp/sdc/be/datatypes/enums/DeclarationTypeEnum.java
common-be/src/main/java/org/openecomp/sdc/be/datatypes/enums/EnvironmentStatusEnum.java
common-be/src/main/java/org/openecomp/sdc/be/datatypes/enums/ExternalCategoryTypeEnum.java
common-be/src/main/java/org/openecomp/sdc/be/datatypes/enums/FilterKeyEnum.java
common-be/src/main/java/org/openecomp/sdc/be/datatypes/enums/GroupTypeEnum.java
common-be/src/main/java/org/openecomp/sdc/be/datatypes/enums/InstantiationTypes.java
common-be/src/main/java/org/openecomp/sdc/be/datatypes/enums/JsonPresentationFields.java
common-be/src/main/java/org/openecomp/sdc/be/datatypes/enums/JsonPresentationFieldsExtractor.java
common-be/src/main/java/org/openecomp/sdc/be/datatypes/enums/MetadataKeyEnum.java
common-be/src/main/java/org/openecomp/sdc/be/datatypes/enums/NodeFilterConstraintType.java
common-be/src/main/java/org/openecomp/sdc/be/datatypes/enums/NodeTypeEnum.java
common-be/src/main/java/org/openecomp/sdc/be/datatypes/enums/OriginTypeEnum.java
common-be/src/main/java/org/openecomp/sdc/be/datatypes/enums/PortMirroringEnum.java
common-be/src/main/java/org/openecomp/sdc/be/datatypes/enums/PromoteVersionEnum.java
common-be/src/main/java/org/openecomp/sdc/be/datatypes/enums/ResourceTypeEnum.java

index 00105f8..2094699 100644 (file)
 
 package org.openecomp.sdc.be.datatypes.enums;
 
+import lombok.AllArgsConstructor;
+import lombok.Getter;
+
+@Getter
+@AllArgsConstructor
 public enum AssetTypeEnum {
     RESOURCES("resources", "Resource"), SERVICES("services", "Service"), PRODUCTS("products", "Product");
 
-    private String value;
-
-    public String getValue() {
-        return value;
-    }
-
-    public String getCorrespondingComponent() {
-        return correspondingComponent;
-    }
-
-    private String correspondingComponent;
-
-    AssetTypeEnum(String value, String correspondingComponent) {
-        this.value = value;
-        this.correspondingComponent = correspondingComponent;
-    }
+    private final String value;
+    private final String correspondingComponent;
 
     public static ComponentTypeEnum convertToComponentTypeEnum(String assetType) {
         ComponentTypeEnum ret = null;
index d155240..e4e689a 100644 (file)
 
 package org.openecomp.sdc.be.datatypes.enums;
 
+import lombok.AllArgsConstructor;
+import lombok.Getter;
+
+@Getter
+@AllArgsConstructor
 public enum ComponentTypeEnum {
     RESOURCE("Resource"),
     SERVICE("Service"),
@@ -22,37 +27,12 @@ public enum ComponentTypeEnum {
     PRODUCT("Product"),
     SERVICE_INSTANCE("Service Instance");
 
-    private String value;
-
-    ComponentTypeEnum(String value) {
-        this.value = value;
-    }
-
-    public String getValue() {
-        return value;
-    }
-
     // Those values cannot be another field in enum, because they are needed
     // as constants for Swagger allowedValues param
     public static final String RESOURCE_PARAM_NAME = "resources";
     public static final String SERVICE_PARAM_NAME = "services";
     public static final String PRODUCT_PARAM_NAME = "products";
-
-    public NodeTypeEnum getNodeType() {
-
-        switch (this) {
-            case RESOURCE:
-                return NodeTypeEnum.Resource;
-            case SERVICE:
-                return NodeTypeEnum.Service;
-            case PRODUCT:
-                return NodeTypeEnum.Product;
-            case RESOURCE_INSTANCE:
-                return NodeTypeEnum.ResourceInstance;
-            default:
-                throw new UnsupportedOperationException("No nodeType is defined for: " + this.getValue());
-        }
-    }
+    private final String value;
 
     public static ComponentTypeEnum findByValue(String value) {
         ComponentTypeEnum ret = null;
@@ -104,4 +84,20 @@ public enum ComponentTypeEnum {
         }
         return ret;
     }
+
+    public NodeTypeEnum getNodeType() {
+
+        switch (this) {
+            case RESOURCE:
+                return NodeTypeEnum.Resource;
+            case SERVICE:
+                return NodeTypeEnum.Service;
+            case PRODUCT:
+                return NodeTypeEnum.Product;
+            case RESOURCE_INSTANCE:
+                return NodeTypeEnum.ResourceInstance;
+            default:
+                throw new UnsupportedOperationException("No nodeType is defined for: " + this.getValue());
+        }
+    }
 }
index aea66c9..2791055 100644 (file)
@@ -17,24 +17,24 @@ package org.openecomp.sdc.be.datatypes.enums;
 
 import java.util.Arrays;
 import java.util.List;
+import lombok.AllArgsConstructor;
+import lombok.Getter;
 
+@Getter
+@AllArgsConstructor
 public enum ConnectionPointEnum {
 
     CAPABILITY("capability"), REQUIREMENT("requirement");
 
-    private String data;
     private static List<ConnectionPointEnum> connectionPointEnums = Arrays.asList(values());
+    private final String data;
 
-    ConnectionPointEnum(String inData) {
-        this.data = inData;
+    public static ConnectionPointEnum getConnectionPointEnum(String data) {
+        return connectionPointEnums.stream().filter(cp -> cp.toString().equals(data)).findAny().orElse(null);
     }
 
     @Override
     public String toString() {
         return data;
     }
-
-    public static ConnectionPointEnum getConnectionPointEnum(String data) {
-        return connectionPointEnums.stream().filter(cp -> cp.toString().equals(data)).findAny().orElse(null);
-    }
 }
index aabe4aa..635574b 100644 (file)
 
 package org.openecomp.sdc.be.datatypes.enums;
 
+import lombok.AllArgsConstructor;
+import lombok.Getter;
+
+@Getter
+@AllArgsConstructor
 public enum EnvironmentStatusEnum {
     UNKNOWN("unknown"),
     IN_PROGRESS("in_progress"),
@@ -23,14 +28,6 @@ public enum EnvironmentStatusEnum {
 
     private final String name;
 
-    EnvironmentStatusEnum(String name) {
-        this.name = name;
-    }
-
-    public String getName() {
-        return name;
-    }
-
     public static EnvironmentStatusEnum getByName(final String name) {
         switch (name) {
             case ("in_progress"):
index 22ef7f3..4b466dd 100644 (file)
 
 package org.openecomp.sdc.be.datatypes.enums;
 
+import lombok.AllArgsConstructor;
+import lombok.Getter;
+
 /**
- * Category Type Enum
- * Any service category to be supported by SDC Ext API can be added here
+ * Category Type Enum Any service category to be supported by SDC Ext API can be added here
  *
  * @author atifhusain
  */
+@Getter
+@AllArgsConstructor
 public enum ExternalCategoryTypeEnum {
 
     PARTNER_DOMAIN_SERVICE("Partner Domain Service", true);
 
-    private String value;
-    private boolean isAtomicType;
-
-    ExternalCategoryTypeEnum(String value, boolean isAtomicType) {
-        this.value = value;
-        this.isAtomicType = isAtomicType;
-    }
-
-    public String getValue() {
-        return value;
-    }
-
-    public boolean isAtomicType() {
-        return isAtomicType;
-    }
+    private final String value;
+    private final boolean isAtomicType;
 
     public static ExternalCategoryTypeEnum getType(String type) {
         for (ExternalCategoryTypeEnum e : ExternalCategoryTypeEnum.values()) {
index ffe64e7..e4245f3 100644 (file)
@@ -18,21 +18,18 @@ package org.openecomp.sdc.be.datatypes.enums;
 import java.util.Arrays;
 import java.util.List;
 import java.util.stream.Collectors;
+import lombok.AllArgsConstructor;
+import lombok.Getter;
 
+@Getter
+@AllArgsConstructor
 public enum FilterKeyEnum {
-    RESOURCE_TYPE("resourceType"), SUB_CATEGORY("subCategory"), CATEGORY("category"), DISTRIBUTION_STATUS("distributionStatus"), NAME_FRAGMENT("nameFragment");
+    RESOURCE_TYPE("resourceType"), SUB_CATEGORY("subCategory"), CATEGORY("category"), DISTRIBUTION_STATUS("distributionStatus"), NAME_FRAGMENT(
+        "nameFragment");
 
     private static final int NUMBER_OF_RESOURCES_FILTERED = 3;
     private static final int NUMBER_OF_SERVICES_FILTERED = 4;
-    private String name;
-
-    FilterKeyEnum(String name) {
-        this.name = name;
-    }
-
-    public String getName() {
-        return name;
-    }
+    private final String name;
 
     public static List<String> getAllFilters() {
         return Arrays.stream(FilterKeyEnum.values()).map(FilterKeyEnum::getName).collect(Collectors.toList());
index 7d55845..4801706 100644 (file)
 
 package org.openecomp.sdc.be.datatypes.enums;
 
+import lombok.AllArgsConstructor;
+import lombok.Getter;
+
+@Getter
+@AllArgsConstructor
 public enum GroupTypeEnum {
     VF_MODULE("org.openecomp.groups.VfModule"), HEAT_STACK("org.openecomp.groups.HeatStack");
 
-    private String groupTypeName;
-
-    GroupTypeEnum(String groupTypeName) {
-        this.groupTypeName = groupTypeName;
-    }
+    private final String groupTypeName;
 
-    public String getGroupTypeName() {
-        return groupTypeName;
-    }
 }
index 319c98d..dc0908b 100644 (file)
 package org.openecomp.sdc.be.datatypes.enums;
 
 import java.util.stream.Stream;
+import lombok.AllArgsConstructor;
+import lombok.Getter;
 
+@Getter
+@AllArgsConstructor
 public enum InstantiationTypes {
 
     A_LA_CARTE("A-la-carte"),
     MACRO("Macro");
 
-    private String value;
-
-    InstantiationTypes(String value) {
-        this.value = value;
-    }
-
-    public String getValue() {
-        return value;
-    }
+    private final String value;
 
     /**
      * Checks if enum with the given type exists.
@@ -41,6 +37,6 @@ public enum InstantiationTypes {
 
     public static boolean containsName(String type) {
         return Stream.of(InstantiationTypes.values())
-                .anyMatch(instType -> type.equals(instType.getValue()));
+            .anyMatch(instType -> type.equals(instType.getValue()));
     }
 }
index 2ec5b28..36d0f40 100644 (file)
@@ -105,10 +105,8 @@ public enum JsonPresentationFields {
     HEAT_PARAMETERS("heatParameters", null),
     GENERATED_FROM_ID("generatedFromId", null),
 
-
     // end artifacts
 
-
     //property
     DEFINITION("definition", null),
     DEFAULT_VALUE("defaultValue", null),
@@ -236,20 +234,20 @@ public enum JsonPresentationFields {
     IS_VSP_ARCHIVED("isVspArchived", GraphPropertyEnum.IS_VSP_ARCHIVED),
     CI_IS_ORIGIN_ARCHIVED("isOriginArchived", null),
 
-       //Interface Operation
-       IO_OPERATION_TYPE("operationType",null),
-       IO_INPUT_PARAMETERS("inputParams",null),
-       IO_OUTPUT_PARAMETERS("outputParams",null),
+    //Interface Operation
+    IO_OPERATION_TYPE("operationType", null),
+    IO_INPUT_PARAMETERS("inputParams", null),
+    IO_OUTPUT_PARAMETERS("outputParams", null),
     IO_PARAM_NAME("paramName", null),
     IO_PARAM_ID("paramId", null),
     IO_NAME("name", null),
-       IO_MANDATORY("mandatory", null),
-       IO_TYPE("type", null),
-       IO_PROPERTY("property", null),
-       IO_WORKFLOW_NAME("workflowName", null),
-       IO_WORKFLOW_VERSION("workflowVersion", null),
-       IO_WORKFLOW_ID("workflowId", null),
-       IO_WORKFLOW_VERSION_ID("workflowVersionId", null),
+    IO_MANDATORY("mandatory", null),
+    IO_TYPE("type", null),
+    IO_PROPERTY("property", null),
+    IO_WORKFLOW_NAME("workflowName", null),
+    IO_WORKFLOW_VERSION("workflowVersion", null),
+    IO_WORKFLOW_ID("workflowId", null),
+    IO_WORKFLOW_VERSION_ID("workflowVersionId", null),
     IO_WORKFLOW_ASSOCIATION_TYPE("workflowAssociationType", null),
 
     //Interface
@@ -274,11 +272,6 @@ public enum JsonPresentationFields {
     @ToString.Exclude
     private final GraphPropertyEnum storedAs;
 
-    @JsonValue
-    public String getPresentation() {
-        return presentation;
-    }
-
     public static String getPresentationByGraphProperty(GraphPropertyEnum property) {
         for (JsonPresentationFields currPresentation : JsonPresentationFields.values()) {
             if (currPresentation.getStoredAs() == property) {
@@ -298,4 +291,9 @@ public enum JsonPresentationFields {
         return null;
     }
 
+    @JsonValue
+    public String getPresentation() {
+        return presentation;
+    }
+
 }
index 5f20c58..b3e55ac 100644 (file)
@@ -24,14 +24,14 @@ package org.openecomp.sdc.be.datatypes.enums;
 
 import java.util.List;
 import java.util.Map;
+import lombok.AllArgsConstructor;
+import lombok.Getter;
 
+@Getter
+@AllArgsConstructor
 public class JsonPresentationFieldsExtractor {
 
-    private Map<String, Object> properties;
-
-    public JsonPresentationFieldsExtractor(Map<String, Object> properties) {
-        this.properties = properties;
-    }
+    private final Map<String, Object> properties;
 
     public String getUniqueId() {
         return (String) properties.get(JsonPresentationFields.UNIQUE_ID.getPresentation());
@@ -148,7 +148,7 @@ public class JsonPresentationFieldsExtractor {
     }
 
     public ResourceTypeEnum getResourceType() {
-        return ResourceTypeEnum.valueOf((String)properties.get(JsonPresentationFields.RESOURCE_TYPE.getPresentation()));
+        return ResourceTypeEnum.valueOf((String) properties.get(JsonPresentationFields.RESOURCE_TYPE.getPresentation()));
     }
 
     public String getToscaResourceName() {
index 0ed8eab..138c60b 100644 (file)
  */
 package org.openecomp.sdc.be.datatypes.enums;
 
+import lombok.AllArgsConstructor;
 import lombok.Getter;
 
+@Getter
+@AllArgsConstructor
 public enum MetadataKeyEnum {
-    METADATA_KEYS("metadataKeys"), 
-    NAME("name"), 
+    METADATA_KEYS("metadataKeys"),
+    NAME("name"),
     MANDATORY("mandatory"),
     VALID_VALUES("validValues");
 
-    @Getter
     private final String name;
 
-    MetadataKeyEnum(final String name) {
-        this.name = name;
-    }
-
 }
index 76db876..13b6629 100644 (file)
@@ -32,11 +32,10 @@ public enum NodeFilterConstraintType {
     PROPERTIES(NodeFilterConstraintType.PROPERTIES_PARAM_NAME),
     CAPABILITIES(NodeFilterConstraintType.CAPABILITIES_PARAM_NAME);
 
-    private final String type;
-
     // Those values are needed as constants for Swagger allowedValues param
     public static final String PROPERTIES_PARAM_NAME = "properties";
     public static final String CAPABILITIES_PARAM_NAME = "capabilities";
+    private final String type;
 
     /**
      * Parse a String to the related {@link NodeFilterConstraintType}.
index a6266d3..592bdc4 100644 (file)
 
 package org.openecomp.sdc.be.datatypes.enums;
 
+import lombok.AllArgsConstructor;
+import lombok.Getter;
+
+@Getter
+@AllArgsConstructor
 public enum NodeTypeEnum {
     User("user"),
     Service("service"),
@@ -60,15 +65,7 @@ public enum NodeTypeEnum {
     AnnotationType("annotationType"),
     Component("component");
 
-    private String name;
-
-    NodeTypeEnum(String name) {
-        this.name = name;
-    }
-
-    public String getName() {
-        return name;
-    }
+    private final String name;
 
     public static NodeTypeEnum getByName(String name) {
         for (NodeTypeEnum inst : NodeTypeEnum.values()) {
index 5e70905..5fad178 100644 (file)
 
 package org.openecomp.sdc.be.datatypes.enums;
 
+import lombok.AllArgsConstructor;
+import lombok.Getter;
+
+@Getter
+@AllArgsConstructor
 public enum OriginTypeEnum {
     PRODUCT("Product", "Product", "product instance", ComponentTypeEnum.PRODUCT, false),
     SERVICE("Service", "Service", "service instance", ComponentTypeEnum.SERVICE, false),
@@ -30,39 +35,11 @@ public enum OriginTypeEnum {
     ServiceProxy("Service Proxy", "Service Proxy", "service proxy", ComponentTypeEnum.RESOURCE, false),
     ServiceSubstitution("Service Substitution", "Service Substitution", "service substitution", ComponentTypeEnum.RESOURCE, false);
 
-    private String value;
-    private String displayValue;
-    private String instanceType;
-    private ComponentTypeEnum componentType;
-       private boolean isAtomicType;
-
-    OriginTypeEnum(String value, String displayValue, String instanceType, ComponentTypeEnum componentType, boolean isAtomicType) {
-        this.value = value;
-        this.displayValue = displayValue;
-        this.instanceType = instanceType;
-        this.componentType = componentType;
-               this.isAtomicType = isAtomicType;
-    }
-
-    public String getValue() {
-        return value;
-    }
-
-    public String getDisplayValue() {
-        return displayValue;
-    }
-
-    public String getInstanceType() {
-        return instanceType;
-    }
-
-    public ComponentTypeEnum getComponentType() {
-        return componentType;
-    }
-
-       public boolean isAtomicType() {
-               return isAtomicType;
-       }
+    private final String value;
+    private final String displayValue;
+    private final String instanceType;
+    private final ComponentTypeEnum componentType;
+    private final boolean isAtomicType;
 
     public static OriginTypeEnum findByValue(String value) {
         OriginTypeEnum ret = null;
index 305ae79..a75ee15 100644 (file)
 
 package org.openecomp.sdc.be.datatypes.enums;
 
+import lombok.AllArgsConstructor;
+import lombok.Getter;
+
+@Getter
+@AllArgsConstructor
 public enum PortMirroringEnum {
     CISCO_VENDOR_NAME("CISCO"),
     CISCO_VENDOR_MODEL_NUMBER("4500x");
 
-    private String value;
-
-    public String getValue() {
-        return value;
-    }
+    private final String value;
 
-    PortMirroringEnum(String value) {
-        this.value = value;
-    }
 }
index 3ad4239..379ef69 100644 (file)
 
 package org.openecomp.sdc.be.datatypes.enums;
 
+import lombok.Getter;
+
+@Getter
 public enum PromoteVersionEnum {
-    
+
     NONE,
     MINOR,
     MAJOR
index 2af43dc..d0f1c23 100644 (file)
 package org.openecomp.sdc.be.datatypes.enums;
 
 import java.util.Arrays;
+import lombok.AllArgsConstructor;
+import lombok.Getter;
 
 /**
  * Resource Type Enum
  *
  * @author mshitrit
  */
+@Getter
+@AllArgsConstructor
 public enum ResourceTypeEnum {
 
     VFC("VFC"/* (Virtual Function Component)"*/, true),
@@ -36,24 +40,11 @@ public enum ResourceTypeEnum {
     ServiceProxy("ServiceProxy", true),
     //Generic VFC/VF/PNF/Service Type
     ABSTRACT("Abstract", true),
-       SERVICE("Service"/*(Network Service)"*/,false);
+    SERVICE("Service"/*(Network Service)"*/, false);
 
     private final String value;
     private final boolean isAtomicType;
 
-    ResourceTypeEnum(final String value, final boolean isAtomicType) {
-        this.value = value;
-        this.isAtomicType = isAtomicType;
-    }
-
-    public String getValue() {
-        return value;
-    }
-
-    public boolean isAtomicType() {
-        return isAtomicType;
-    }
-
     public static ResourceTypeEnum getType(final String type) {
         if (type == null) {
             return null;