From 966271e4e2601d58eb06f286a3b2921e803fa9af Mon Sep 17 00:00:00 2001 From: aribeiro Date: Wed, 20 May 2020 10:05:48 +0100 Subject: Make Directive values Tosca compliant Issue-ID: SDC-3079 Signed-off-by: aribeiro Change-Id: Ie711c61244a4e2d68a96e2814ba2db52e067c6e4 --- .../components/impl/utils/DirectivesEnumTest.java | 61 ++++++++++++++++++++++ .../components/impl/utils/DirectivesUtilsTest.java | 60 --------------------- .../be/nodeFilter/BaseServiceFilterUtilsTest.java | 4 +- 3 files changed, 63 insertions(+), 62 deletions(-) create mode 100644 catalog-be/src/test/java/org/openecomp/sdc/be/components/impl/utils/DirectivesEnumTest.java delete mode 100644 catalog-be/src/test/java/org/openecomp/sdc/be/components/impl/utils/DirectivesUtilsTest.java (limited to 'catalog-be/src/test/java') diff --git a/catalog-be/src/test/java/org/openecomp/sdc/be/components/impl/utils/DirectivesEnumTest.java b/catalog-be/src/test/java/org/openecomp/sdc/be/components/impl/utils/DirectivesEnumTest.java new file mode 100644 index 0000000000..529625b451 --- /dev/null +++ b/catalog-be/src/test/java/org/openecomp/sdc/be/components/impl/utils/DirectivesEnumTest.java @@ -0,0 +1,61 @@ +/* + * - + * * ============LICENSE_START======================================================= + * * Copyright (C) 2019 Nordix Foundation. + * * ================================================================================ + * * 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. + * * + * * SPDX-License-Identifier: Apache-2.0 + * * ============LICENSE_END========================================================= + * + */ + +package org.openecomp.sdc.be.components.impl.utils; + +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertTrue; + +import java.util.ArrayList; +import java.util.List; +import org.junit.Before; +import org.junit.Test; + +public class DirectivesEnumTest { + + private List directives; + + @Before + public void setup() { + directives = new ArrayList<>(); + } + + @Test + public void testGivenValidDirectives_returnsTrue() { + directives.add(DirectivesEnum.SELECT.getValue()); + directives.add(DirectivesEnum.SELECTABLE.getValue()); + directives.add(DirectivesEnum.SUBSTITUTE.getValue()); + directives.add(DirectivesEnum.SUBSTITUTABLE.getValue()); + assertTrue(DirectivesEnum.isValid(directives)); + } + + @Test + public void testGivenEmptyDirectives_returnsTrue() { + assertTrue(DirectivesEnum.isValid(directives)); + } + + @Test + public void testGivenInvalidDirectives_returnsFalse() { + directives.add("Invalid"); + assertFalse(DirectivesEnum.isValid(directives)); + } +} \ No newline at end of file diff --git a/catalog-be/src/test/java/org/openecomp/sdc/be/components/impl/utils/DirectivesUtilsTest.java b/catalog-be/src/test/java/org/openecomp/sdc/be/components/impl/utils/DirectivesUtilsTest.java deleted file mode 100644 index 9e27134a33..0000000000 --- a/catalog-be/src/test/java/org/openecomp/sdc/be/components/impl/utils/DirectivesUtilsTest.java +++ /dev/null @@ -1,60 +0,0 @@ -/* - * - - * * ============LICENSE_START======================================================= - * * Copyright (C) 2019 Nordix Foundation. - * * ================================================================================ - * * 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. - * * - * * SPDX-License-Identifier: Apache-2.0 - * * ============LICENSE_END========================================================= - * - */ - -package org.openecomp.sdc.be.components.impl.utils; - -import org.junit.Before; -import org.junit.Test; - -import java.util.ArrayList; -import java.util.List; - -import static org.junit.Assert.assertFalse; -import static org.junit.Assert.assertTrue; - -public class DirectivesUtilsTest { - - private List directives; - - @Before - public void setup(){ - directives = new ArrayList<>(); - } - - @Test - public void testGivenValidDirectives_returnsTrue(){ - directives.add(DirectivesUtils.DIRECTIVE.SUBSTITUTABLE.toString()); - directives.add(DirectivesUtils.DIRECTIVE.SELECTABLE.toString()); - assertTrue(DirectivesUtils.isValid(directives)); - } - - @Test - public void testGivenEmptyDirectives_returnsTrue(){ - assertTrue(DirectivesUtils.isValid(directives)); - } - - @Test - public void testGivenInvalidDirectives_returnsFalse(){ - directives.add("Invalid"); - assertFalse(DirectivesUtils.isValid(directives)); - } -} \ No newline at end of file diff --git a/catalog-be/src/test/java/org/openecomp/sdc/be/nodeFilter/BaseServiceFilterUtilsTest.java b/catalog-be/src/test/java/org/openecomp/sdc/be/nodeFilter/BaseServiceFilterUtilsTest.java index 8ddf06abb8..adf6e4439d 100644 --- a/catalog-be/src/test/java/org/openecomp/sdc/be/nodeFilter/BaseServiceFilterUtilsTest.java +++ b/catalog-be/src/test/java/org/openecomp/sdc/be/nodeFilter/BaseServiceFilterUtilsTest.java @@ -18,7 +18,7 @@ package org.openecomp.sdc.be.nodeFilter; import org.junit.Assert; import org.junit.Before; -import org.openecomp.sdc.be.components.impl.utils.DirectivesUtils; +import org.openecomp.sdc.be.components.impl.utils.DirectivesEnum; import org.openecomp.sdc.be.datatypes.elements.CINodeFilterDataDefinition; import org.openecomp.sdc.be.datatypes.elements.ListDataDefinition; import org.openecomp.sdc.be.datatypes.elements.RequirementNodeFilterPropertyDataDefinition; @@ -46,7 +46,7 @@ public class BaseServiceFilterUtilsTest { componentInstance.setUniqueId(CI_NAME); componentInstance.setName(CI_NAME); service.setComponentInstances(Arrays.asList(componentInstance)); - componentInstance.setDirectives(Arrays.asList(DirectivesUtils.SELECTABLE)); + componentInstance.setDirectives(Arrays.asList(DirectivesEnum.SELECTABLE.getValue())); CINodeFilterDataDefinition serviceFilter = new CINodeFilterDataDefinition(); componentInstance.setNodeFilter(serviceFilter); requirementNodeFilterPropertyDataDefinition = new RequirementNodeFilterPropertyDataDefinition(); -- cgit 1.2.3-korg