From cd6f933375c412c2f79a12e909821322d58a8499 Mon Sep 17 00:00:00 2001 From: "andre.schmid" Date: Wed, 29 Jan 2020 17:25:21 +0000 Subject: Configure a new Artifact Type Centralizes artifact configuration in one yaml entry. Allow the configuration of a new artifact type without the need of code changes. The configuration file now is used as a source of artifacts types instead the artifact type enum. The enum will be used as a source of base artifact types and also in hard coded business rules. Change-Id: Id0383d9fca9bce0519a4d52a4ecb3a68c8713f0f Issue-ID: SDC-2754 Signed-off-by: andre.schmid --- .../sdc/common/api/ArtifactTypeEnumTest.java | 47 +++++++++------------- 1 file changed, 20 insertions(+), 27 deletions(-) (limited to 'common-app-api/src/test/java') diff --git a/common-app-api/src/test/java/org/openecomp/sdc/common/api/ArtifactTypeEnumTest.java b/common-app-api/src/test/java/org/openecomp/sdc/common/api/ArtifactTypeEnumTest.java index 86cdeaafa8..86f1f86bb0 100644 --- a/common-app-api/src/test/java/org/openecomp/sdc/common/api/ArtifactTypeEnumTest.java +++ b/common-app-api/src/test/java/org/openecomp/sdc/common/api/ArtifactTypeEnumTest.java @@ -20,43 +20,36 @@ package org.openecomp.sdc.common.api; -import java.util.List; +import static org.hamcrest.MatcherAssert.assertThat; +import static org.hamcrest.Matchers.is; +import static org.hamcrest.Matchers.notNullValue; +import static org.hamcrest.Matchers.nullValue; import org.junit.Test; public class ArtifactTypeEnumTest { - - private ArtifactTypeEnum createTestSubject() { - return ArtifactTypeEnum.AAI_SERVICE_MODEL; - } - @Test - public void testGetType() throws Exception { - ArtifactTypeEnum testSubject; - String result; - - // default test - testSubject = createTestSubject(); - result = testSubject.getType(); + public void testGetType() { + assertThat("The artifact type should match", ArtifactTypeEnum.WORKFLOW.getType(), is("WORKFLOW")); + assertThat("The artifact type should match", ArtifactTypeEnum.OTHER.getType(), is("OTHER")); + assertThat("The artifact type should match", ArtifactTypeEnum.HEAT.getType(), is("HEAT")); } @Test - public void testFindType() throws Exception { - String type = ""; - ArtifactTypeEnum result; - - // default test - result = ArtifactTypeEnum.findType(type); + public void testParse() { + ArtifactTypeEnum actual = ArtifactTypeEnum.parse("HEAT"); + assertThat("The artifact type should not be null", actual, notNullValue()); + assertThat("The artifact type should match", actual, is(ArtifactTypeEnum.HEAT)); + actual = ArtifactTypeEnum.parse("OTHER"); + assertThat("The artifact type should not be null", actual, notNullValue()); + assertThat("The artifact type should match", actual, is(ArtifactTypeEnum.OTHER)); + actual = ArtifactTypeEnum.parse("WORKFLOW"); + assertThat("The artifact type should not be null", actual, notNullValue()); + assertThat("The artifact type should match", actual, is(ArtifactTypeEnum.WORKFLOW)); + actual = ArtifactTypeEnum.parse("anyNotKnownType"); + assertThat("The artifact type should be null", actual, nullValue()); } - - @Test - public void testGetAllTypes() throws Exception { - List result; - - // default test - result = ArtifactTypeEnum.getAllTypes(); - } } -- cgit 1.2.3-korg