From 0323dc0535e4af4c5aa2d7ef4a3fb4eb4cb9a813 Mon Sep 17 00:00:00 2001 From: vasraz Date: Wed, 1 Apr 2020 14:43:08 +0100 Subject: Increase test coverage Change-Id: I290371a025ba3376a013ba464e4dfb601d74aa8b Signed-off-by: Vasyl Razinkov Issue-ID: SDC-2833 --- .../sdc/asdctool/enums/DistributionStatusEnum.java | 34 +++++--------- .../asdctool/enums/LifeCycleTransitionEnum.java | 53 +++------------------- .../sdc/asdctool/enums/LifecycleStateEnum.java | 13 ------ .../sdc/asdctool/enums/SchemaZipFileEnum.java | 44 ++++-------------- 4 files changed, 28 insertions(+), 116 deletions(-) (limited to 'asdctool/src/main/java/org') diff --git a/asdctool/src/main/java/org/openecomp/sdc/asdctool/enums/DistributionStatusEnum.java b/asdctool/src/main/java/org/openecomp/sdc/asdctool/enums/DistributionStatusEnum.java index 92c4a7cf54..5e601a0c37 100644 --- a/asdctool/src/main/java/org/openecomp/sdc/asdctool/enums/DistributionStatusEnum.java +++ b/asdctool/src/main/java/org/openecomp/sdc/asdctool/enums/DistributionStatusEnum.java @@ -7,9 +7,9 @@ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -20,27 +20,17 @@ package org.openecomp.sdc.asdctool.enums; -public enum DistributionStatusEnum { - DISTRIBUTION_NOT_APPROVED("Distribution not approved"), DISTRIBUTION_APPROVED("Distribution approved"), DISTRIBUTED("Distributed"), DISTRIBUTION_REJECTED("Distribution rejected"); - - private String value; - - private DistributionStatusEnum(String value) { - this.value = value; - } +import lombok.AllArgsConstructor; +import lombok.Getter; - public String getValue() { - return value; - } - - public static DistributionStatusEnum findState(String state) { +@Getter +@AllArgsConstructor +public enum DistributionStatusEnum { + DISTRIBUTION_NOT_APPROVED("Distribution not approved"), + DISTRIBUTION_APPROVED("Distribution approved"), + DISTRIBUTED("Distributed"), + DISTRIBUTION_REJECTED("Distribution rejected"); - for (DistributionStatusEnum distributionStatus : DistributionStatusEnum.values()) { - if (distributionStatus.name().equalsIgnoreCase(state) || distributionStatus.getValue().equalsIgnoreCase(state)) { - return distributionStatus; - } - } - return null; - } + private final String value; } \ No newline at end of file diff --git a/asdctool/src/main/java/org/openecomp/sdc/asdctool/enums/LifeCycleTransitionEnum.java b/asdctool/src/main/java/org/openecomp/sdc/asdctool/enums/LifeCycleTransitionEnum.java index b29f5fba8d..6f52734f2f 100644 --- a/asdctool/src/main/java/org/openecomp/sdc/asdctool/enums/LifeCycleTransitionEnum.java +++ b/asdctool/src/main/java/org/openecomp/sdc/asdctool/enums/LifeCycleTransitionEnum.java @@ -20,6 +20,11 @@ package org.openecomp.sdc.asdctool.enums; +import lombok.AllArgsConstructor; +import lombok.Getter; + +@Getter +@AllArgsConstructor public enum LifeCycleTransitionEnum { CHECKOUT("checkout"), @@ -32,52 +37,6 @@ public enum LifeCycleTransitionEnum { CERTIFY("certify"), DISTRIBUTE("distribute"); - String displayName; - - LifeCycleTransitionEnum(String displayName) { - this.displayName = displayName; - } - - public String getDisplayName() { - return displayName; - } - - public static LifeCycleTransitionEnum getFromDisplayName(String name) { - if (name.equalsIgnoreCase(LifeCycleTransitionEnum.CHECKOUT.getDisplayName())) { - return LifeCycleTransitionEnum.CHECKOUT; - } - if (name.equalsIgnoreCase(LifeCycleTransitionEnum.CHECKIN.getDisplayName())) { - return LifeCycleTransitionEnum.CHECKIN; - } - if (name.equalsIgnoreCase(LifeCycleTransitionEnum.CERTIFICATION_REQUEST.getDisplayName())) { - return LifeCycleTransitionEnum.CERTIFICATION_REQUEST; - } - if (name.equalsIgnoreCase(LifeCycleTransitionEnum.UNDO_CHECKOUT.getDisplayName())) { - return LifeCycleTransitionEnum.UNDO_CHECKOUT; - } - if (name.equalsIgnoreCase(LifeCycleTransitionEnum.CANCEL_CERTIFICATION.getDisplayName())) { - return LifeCycleTransitionEnum.CANCEL_CERTIFICATION; - } - if (name.equalsIgnoreCase(LifeCycleTransitionEnum.START_CERTIFICATION.getDisplayName())) { - return LifeCycleTransitionEnum.START_CERTIFICATION; - } - if (name.equalsIgnoreCase(LifeCycleTransitionEnum.FAIL_CERTIFICATION.getDisplayName())) { - return LifeCycleTransitionEnum.FAIL_CERTIFICATION; - } - if (name.equalsIgnoreCase(LifeCycleTransitionEnum.CERTIFY.getDisplayName())) { - return LifeCycleTransitionEnum.CERTIFY; - } - if (name.equalsIgnoreCase(LifeCycleTransitionEnum.DISTRIBUTE.getDisplayName())) { - return LifeCycleTransitionEnum.DISTRIBUTE; - } else - throw new IllegalArgumentException(name + " value does not match any of LifeCycleTransitionEnum values"); - } + private final String displayName; - public static String valuesAsString() { - StringBuilder sb = new StringBuilder(); - for (LifeCycleTransitionEnum op : LifeCycleTransitionEnum.values()) { - sb.append(op.getDisplayName()).append(" "); - } - return sb.toString(); - } } \ No newline at end of file diff --git a/asdctool/src/main/java/org/openecomp/sdc/asdctool/enums/LifecycleStateEnum.java b/asdctool/src/main/java/org/openecomp/sdc/asdctool/enums/LifecycleStateEnum.java index 98fb95faa7..e376d179fa 100644 --- a/asdctool/src/main/java/org/openecomp/sdc/asdctool/enums/LifecycleStateEnum.java +++ b/asdctool/src/main/java/org/openecomp/sdc/asdctool/enums/LifecycleStateEnum.java @@ -23,22 +23,9 @@ package org.openecomp.sdc.asdctool.enums; public enum LifecycleStateEnum { READY_FOR_CERTIFICATION, - CERTIFICATION_IN_PROGRESS, - CERTIFIED, - NOT_CERTIFIED_CHECKIN, - NOT_CERTIFIED_CHECKOUT; - public static LifecycleStateEnum findState(String state) { - - for (LifecycleStateEnum lifecycleStateEnum : LifecycleStateEnum.values()) { - if (lifecycleStateEnum.name().equals(state)) { - return lifecycleStateEnum; - } - } - return null; - } } \ No newline at end of file diff --git a/asdctool/src/main/java/org/openecomp/sdc/asdctool/enums/SchemaZipFileEnum.java b/asdctool/src/main/java/org/openecomp/sdc/asdctool/enums/SchemaZipFileEnum.java index 1ab2b809c1..a764b8db44 100644 --- a/asdctool/src/main/java/org/openecomp/sdc/asdctool/enums/SchemaZipFileEnum.java +++ b/asdctool/src/main/java/org/openecomp/sdc/asdctool/enums/SchemaZipFileEnum.java @@ -24,6 +24,11 @@ import static org.openecomp.sdc.asdctool.enums.SchemaZipFileEnum.SchemaZipConsta import static org.openecomp.sdc.asdctool.enums.SchemaZipFileEnum.SchemaZipConstants.EMPTY_IMPORT_LIST; import static org.openecomp.sdc.asdctool.enums.SchemaZipFileEnum.SchemaZipConstants.RELATIONSHIPS_TYPES_IMPORT_LIST; +import lombok.AllArgsConstructor; +import lombok.Getter; + +@Getter +@AllArgsConstructor public enum SchemaZipFileEnum { DATA("data", "data-types", "dataTypes", "data_types", EMPTY_IMPORT_LIST), @@ -35,40 +40,11 @@ public enum SchemaZipFileEnum { CAPABILITIES("capabilities", "capability-types", "capabilityTypes", "capability_types", DATA_IMPORT_LIST), INTERFACES("interfaces", "interface-lifecycle-types", "interfaceLifecycleTypes", "interface_types", DATA_IMPORT_LIST); - private String fileName; - private String sourceFolderName; - private String sourceFileName; - private String collectionTitle; - private String[] importFileList; - - SchemaZipFileEnum(String fileName, String sourceFolderName, String sourceFileName, String collectionTitle, - String[] importFileList) { - this.fileName = fileName; - this.sourceFolderName = sourceFolderName; - this.sourceFileName = sourceFileName; - this.collectionTitle = collectionTitle; - this.importFileList = importFileList; - } - - public String getFileName() { - return fileName; - } - - public String getSourceFolderName() { - return sourceFolderName; - } - - public String getSourceFileName() { - return sourceFileName; - } - - public String getCollectionTitle() { - return collectionTitle; - } - - public String[] getImportFileList() { - return importFileList; - } + private final String fileName; + private final String sourceFolderName; + private final String sourceFileName; + private final String collectionTitle; + private final String[] importFileList; static class SchemaZipConstants { static final String [] EMPTY_IMPORT_LIST = new String[]{}; -- cgit 1.2.3-korg