summaryrefslogtreecommitdiffstats
path: root/asdctool
diff options
context:
space:
mode:
authorvasraz <vasyl.razinkov@est.tech>2020-04-01 14:43:08 +0100
committerVasyl Razinkov <vasyl.razinkov@est.tech>2020-04-01 13:43:56 +0000
commit0323dc0535e4af4c5aa2d7ef4a3fb4eb4cb9a813 (patch)
treee1dc3e3cfb8c1c2c4f888220438e218b6a878d1c /asdctool
parentcb717c690420d0e9e873ac2c59de0a0ea2ca278d (diff)
Increase test coverage
Change-Id: I290371a025ba3376a013ba464e4dfb601d74aa8b Signed-off-by: Vasyl Razinkov <vasyl.razinkov@est.tech> Issue-ID: SDC-2833
Diffstat (limited to 'asdctool')
-rw-r--r--asdctool/src/main/java/org/openecomp/sdc/asdctool/enums/DistributionStatusEnum.java34
-rw-r--r--asdctool/src/main/java/org/openecomp/sdc/asdctool/enums/LifeCycleTransitionEnum.java53
-rw-r--r--asdctool/src/main/java/org/openecomp/sdc/asdctool/enums/LifecycleStateEnum.java13
-rw-r--r--asdctool/src/main/java/org/openecomp/sdc/asdctool/enums/SchemaZipFileEnum.java44
-rw-r--r--asdctool/src/test/java/org/openecomp/sdc/asdctool/enums/SchemaZipFileEnumTest.java99
5 files changed, 28 insertions, 215 deletions
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[]{};
diff --git a/asdctool/src/test/java/org/openecomp/sdc/asdctool/enums/SchemaZipFileEnumTest.java b/asdctool/src/test/java/org/openecomp/sdc/asdctool/enums/SchemaZipFileEnumTest.java
deleted file mode 100644
index 73291ca5a4..0000000000
--- a/asdctool/src/test/java/org/openecomp/sdc/asdctool/enums/SchemaZipFileEnumTest.java
+++ /dev/null
@@ -1,99 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * SDC
- * ================================================================================
- * Copyright (C) 2019 AT&T Intellectual Property. All rights reserved.
- * ================================================================================
- * 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.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- * ============LICENSE_END=========================================================
- */
-
-package org.openecomp.sdc.asdctool.enums;
-
-import org.junit.After;
-import org.junit.Before;
-import org.junit.Test;
-
-public class SchemaZipFileEnumTest {
-
- private SchemaZipFileEnum testSubject;
- private String result;
-
- @Before
- public void setUp() {
- testSubject = createTestSubject();
- }
-
- @After
- public void tearDown() {
- testSubject = null;
- result = null;
- }
-
-
- private SchemaZipFileEnum createTestSubject() {
- return SchemaZipFileEnum.DATA;
- }
-
- @Test
- public void testGetFileName() throws Exception {
- SchemaZipFileEnum testSubject;
- String result;
-
- // default test
- testSubject = createTestSubject();
- result = testSubject.getFileName();
- }
-
- @Test
- public void testGetSourceFolderName() throws Exception {
- SchemaZipFileEnum testSubject;
- String result;
-
- // default test
- testSubject = createTestSubject();
- result = testSubject.getSourceFolderName();
- }
-
-
- @Test
- public void testGetSourceFileName() throws Exception {
- SchemaZipFileEnum testSubject;
- String result;
-
- // default test
- testSubject = createTestSubject();
- result = testSubject.getSourceFileName();
- }
-
- @Test
- public void testGetCollectionTitle() throws Exception {
- SchemaZipFileEnum testSubject;
- String result;
-
- // default test
- testSubject = createTestSubject();
- result = testSubject.getCollectionTitle();
- }
-
- @Test
- public void testGetImportFileList() throws Exception {
- SchemaZipFileEnum testSubject;
- String[] result;
-
- // default test
- testSubject = createTestSubject();
- result = testSubject.getImportFileList();
- }
-
-}