diff options
Diffstat (limited to 'catalog-be/src/test')
-rw-r--r-- | catalog-be/src/test/java/org/openecomp/sdc/be/components/csar/ServiceCsarInfoTest.java | 14 | ||||
-rw-r--r-- | catalog-be/src/test/java/org/openecomp/sdc/be/components/impl/ServiceImportBusinessLogicTest.java | 14 | ||||
-rw-r--r-- | catalog-be/src/test/resources/csars/service-Ser09080002-csar.csar | bin | 63922 -> 63966 bytes | |||
-rw-r--r-- | catalog-be/src/test/resources/csars/serviceWithUnknownTypes.csar (renamed from catalog-be/src/test/resources/csars/serviceWithUnknownDataTypes.csar) | bin | 56980 -> 57080 bytes |
4 files changed, 27 insertions, 1 deletions
diff --git a/catalog-be/src/test/java/org/openecomp/sdc/be/components/csar/ServiceCsarInfoTest.java b/catalog-be/src/test/java/org/openecomp/sdc/be/components/csar/ServiceCsarInfoTest.java index 80ecc212f1..add427d164 100644 --- a/catalog-be/src/test/java/org/openecomp/sdc/be/components/csar/ServiceCsarInfoTest.java +++ b/catalog-be/src/test/java/org/openecomp/sdc/be/components/csar/ServiceCsarInfoTest.java @@ -47,7 +47,7 @@ class ServiceCsarInfoTest { private User user; private static final String CSAR_UUID = "csarUUID"; - private static final String PAYLOAD_NAME = "csars/serviceWithUnknownDataTypes.csar"; + private static final String PAYLOAD_NAME = "csars/serviceWithUnknownTypes.csar"; private static final String SERVICE_NAME = "serviceWithDataType"; private static final String MAIN_TEMPLATE_NAME = "Definitions/service-Servicewithdatatype-template.yml"; @@ -78,4 +78,16 @@ return new ServiceCsarInfo(user, CSAR_UUID, payload, SERVICE_NAME, mainTemplateN ((Map<String, Object>) ((Map<String, Object>) dataTypeDefinition.get("properties")).get("prop2")).get("type")); } + @SuppressWarnings("unchecked") + @Test + void testGetInterfaceTypes() { + final Map<String, Object> interfaceTypes = csarInfo.getInterfaceTypes(); + assertEquals(9, interfaceTypes.size()); + final Map<String, Object> interfaceTypeDefinition = (Map<String, Object>) interfaceTypes.get( + "tosca.interfaces.test.node.lifecycle.Reconfigure"); + assertNotNull(interfaceTypeDefinition); + assertEquals("tosca.interfaces.Root", interfaceTypeDefinition.get("derived_from")); + assertEquals("reconfigure", ((Map<String, Object>) interfaceTypeDefinition.get("Reconfigure")).get("description")); + } + } diff --git a/catalog-be/src/test/java/org/openecomp/sdc/be/components/impl/ServiceImportBusinessLogicTest.java b/catalog-be/src/test/java/org/openecomp/sdc/be/components/impl/ServiceImportBusinessLogicTest.java index 944f51c244..faaa7e3162 100644 --- a/catalog-be/src/test/java/org/openecomp/sdc/be/components/impl/ServiceImportBusinessLogicTest.java +++ b/catalog-be/src/test/java/org/openecomp/sdc/be/components/impl/ServiceImportBusinessLogicTest.java @@ -143,6 +143,7 @@ class ServiceImportBusinessLogicTest extends ServiceImportBussinessLogicBaseTest private final GroupTypeOperation groupTypeOperation = mock(GroupTypeOperation.class); private final CapabilityTypeOperation capabilityTypeOperation = mock(CapabilityTypeOperation.class); private final CapabilityTypeImportManager capabilityTypeImportManager = mock(CapabilityTypeImportManager.class); + private final InterfaceLifecycleTypeImportManager interfaceLifecycleTypeImportManager = mock(InterfaceLifecycleTypeImportManager.class); @InjectMocks private ServiceImportBusinessLogic sIBL; @@ -256,6 +257,10 @@ class ServiceImportBusinessLogicTest extends ServiceImportBussinessLogicBaseTest when(artifactTypeOperation.getArtifactTypeByUid(contains("tosca.testartifacts.Name"))).thenReturn(Either.right(StorageOperationStatus.NOT_FOUND)); when(artifactTypeOperation.getArtifactTypeByUid(contains("tosca.artifacts"))).thenReturn(Either.left(null)); + when(interfaceLifecycleTypeOperation.getInterface(contains("tosca.interfaces"))).thenReturn(Either.left(new InterfaceDefinition())); + when(interfaceLifecycleTypeOperation.getInterface(contains("tosca.interfaces.test"))).thenReturn(Either.right(StorageOperationStatus.NOT_FOUND)); + + when(capabilityTypeOperation.getCapabilityType(anyString())) .thenReturn(Either.left(new CapabilityTypeDefinition())); when(capabilityTypeOperation.getCapabilityType(contains("tosca.testcapabilitytypes.Name"))) @@ -313,6 +318,15 @@ class ServiceImportBusinessLogicTest extends ServiceImportBussinessLogicBaseTest Map<String, Object> nodeTypesMap = nodeTypes.getValue(); Map<String, Object> newUpdatedNodeType = (Map<String, Object>) nodeTypesMap.get(updatedNodeType); assertEquals(8, ((Map<String, Object>) newUpdatedNodeType.get("properties")).size()); + + ArgumentCaptor<String> interfaceTypes = ArgumentCaptor.forClass(String.class); + verify(interfaceLifecycleTypeImportManager).createLifecycleTypes(interfaceTypes.capture(), any(), anyBoolean()); + Map<String, Object> yamlInterfaceMap = new Yaml().load(interfaceTypes.getValue()); + assertEquals(3, yamlInterfaceMap.size()); + assertNotNull(yamlInterfaceMap.get("tosca.interfaces.test.node.lifecycle.Attach")); + assertNotNull(yamlInterfaceMap.get("tosca.interfaces.test.node.lifecycle.Detach")); + assertNotNull(yamlInterfaceMap.get("tosca.interfaces.test.node.lifecycle.Reconfigure")); + } @Test diff --git a/catalog-be/src/test/resources/csars/service-Ser09080002-csar.csar b/catalog-be/src/test/resources/csars/service-Ser09080002-csar.csar Binary files differindex c780e3484c..de7d71fc37 100644 --- a/catalog-be/src/test/resources/csars/service-Ser09080002-csar.csar +++ b/catalog-be/src/test/resources/csars/service-Ser09080002-csar.csar diff --git a/catalog-be/src/test/resources/csars/serviceWithUnknownDataTypes.csar b/catalog-be/src/test/resources/csars/serviceWithUnknownTypes.csar Binary files differindex ffd209978f..b50113c2d2 100644 --- a/catalog-be/src/test/resources/csars/serviceWithUnknownDataTypes.csar +++ b/catalog-be/src/test/resources/csars/serviceWithUnknownTypes.csar |