aboutsummaryrefslogtreecommitdiffstats
path: root/openecomp-be/lib/openecomp-tosca-lib/src/test/java
diff options
context:
space:
mode:
authorshiria <shiri.amichai@amdocs.com>2018-07-09 08:36:15 +0300
committerAvi Gaffa <avi.gaffa@amdocs.com>2018-07-11 05:49:02 +0000
commit35767f3c6ea98e643e2d0bc638fa87ac1ef65808 (patch)
treeaca9484cb7f81c3074539d4b5854ec0193b8928e /openecomp-be/lib/openecomp-tosca-lib/src/test/java
parent6acf9fb74dc9ee8d93c4f5c6040876dada27beb2 (diff)
Add support for CapabilityDefinition isTypeOf
Change-Id: Id84b5b67ef85b6e252676f1004184fb3180cd053 Issue-ID: SDC-1475 Signed-off-by: shiria <shiri.amichai@amdocs.com>
Diffstat (limited to 'openecomp-be/lib/openecomp-tosca-lib/src/test/java')
-rw-r--r--openecomp-be/lib/openecomp-tosca-lib/src/test/java/org/openecomp/sdc/tosca/services/impl/ToscaAnalyzerServiceImplTest.java40
1 files changed, 40 insertions, 0 deletions
diff --git a/openecomp-be/lib/openecomp-tosca-lib/src/test/java/org/openecomp/sdc/tosca/services/impl/ToscaAnalyzerServiceImplTest.java b/openecomp-be/lib/openecomp-tosca-lib/src/test/java/org/openecomp/sdc/tosca/services/impl/ToscaAnalyzerServiceImplTest.java
index d9e77e1f84..0f79ed05d6 100644
--- a/openecomp-be/lib/openecomp-tosca-lib/src/test/java/org/openecomp/sdc/tosca/services/impl/ToscaAnalyzerServiceImplTest.java
+++ b/openecomp-be/lib/openecomp-tosca-lib/src/test/java/org/openecomp/sdc/tosca/services/impl/ToscaAnalyzerServiceImplTest.java
@@ -44,6 +44,11 @@ import static org.mockito.Mockito.when;
@RunWith(MockitoJUnitRunner.class)
public class ToscaAnalyzerServiceImplTest {
+
+ public static final String CAPABILITY_TYPE_A = "capabilityTypeA";
+ public static final String CAPABILITY_TYPE_B = "capabilityTypeB";
+ public static final String TOSCA_CAPABILITIES_ROOT = "tosca.capabilities.Root";
+
/*
Dictionary:
SrvTmp: ServiceTemplate
@@ -874,4 +879,39 @@ public class ToscaAnalyzerServiceImplTest {
// not found at all should throw core exception
+
+ @Test
+ public void capabilityDefinitionIsTypeOfDirectTypeFound() {
+ CapabilityDefinition capabilityDefinition = new CapabilityDefinition();
+ capabilityDefinition.setType(CAPABILITY_TYPE_A);
+ assertTrue(toscaAnalyzerService.isTypeOf(capabilityDefinition, CAPABILITY_TYPE_A, new ServiceTemplate(),
+ toscaServiceModelMock));
+ }
+
+ @Test
+ public void capabilityDefinitionIsTypeOfReturnNo() {
+ CapabilityDefinition capabilityDefinition = new CapabilityDefinition();
+ capabilityDefinition.setType(CAPABILITY_TYPE_A);
+ ServiceTemplate serviceTemplate = new ServiceTemplate();
+ serviceTemplate.setCapability_types(new HashMap<>());
+ CapabilityType capabilityType = new CapabilityType();
+ capabilityType.setDerived_from(TOSCA_CAPABILITIES_ROOT);
+ serviceTemplate.getCapability_types().put(CAPABILITY_TYPE_A, capabilityType);
+ assertFalse(toscaAnalyzerService
+ .isTypeOf(capabilityDefinition, CAPABILITY_TYPE_B, serviceTemplate, toscaServiceModelMock));
+ }
+
+ @Test
+ public void capabilityDefinitionIsTypeOfInheritanceTypeFound() {
+ CapabilityDefinition capabilityDefinition = new CapabilityDefinition();
+ capabilityDefinition.setType(CAPABILITY_TYPE_A);
+ ServiceTemplate serviceTemplate = new ServiceTemplate();
+ serviceTemplate.setCapability_types(new HashMap<>());
+ CapabilityType capabilityType = new CapabilityType();
+ capabilityType.setDerived_from(CAPABILITY_TYPE_B);
+ serviceTemplate.getCapability_types().put(CAPABILITY_TYPE_A, capabilityType);
+ assertTrue(toscaAnalyzerService
+ .isTypeOf(capabilityDefinition, CAPABILITY_TYPE_B, serviceTemplate, toscaServiceModelMock));
+ }
+
}