From 0278649141c9247b2ec56bb76998c3b9aa412874 Mon Sep 17 00:00:00 2001 From: JvD_Ericsson Date: Wed, 12 Jul 2023 17:50:10 +0100 Subject: Service import issues Issue-ID: SDC-4568 Signed-off-by: JvD_Ericsson Change-Id: Ife2c4cc78a16d0f93f3a6a24d5bfdd48263d43a5 Signed-off-by: Vasyl Razinkov --- .../sdc/be/components/csar/YamlTemplateParsingHandlerTest.java | 5 ++++- .../openecomp/sdc/be/components/impl/ResourceBusinessLogicTest.java | 2 +- .../sdc/be/components/impl/ServiceImportBusinessLogicTest.java | 6 ++++-- 3 files changed, 9 insertions(+), 4 deletions(-) (limited to 'catalog-be/src/test/java') diff --git a/catalog-be/src/test/java/org/openecomp/sdc/be/components/csar/YamlTemplateParsingHandlerTest.java b/catalog-be/src/test/java/org/openecomp/sdc/be/components/csar/YamlTemplateParsingHandlerTest.java index df3dd1f0d6..218e0267d2 100644 --- a/catalog-be/src/test/java/org/openecomp/sdc/be/components/csar/YamlTemplateParsingHandlerTest.java +++ b/catalog-be/src/test/java/org/openecomp/sdc/be/components/csar/YamlTemplateParsingHandlerTest.java @@ -34,6 +34,7 @@ import org.mockito.junit.jupiter.MockitoExtension; import org.openecomp.sdc.be.components.impl.AnnotationBusinessLogic; import org.openecomp.sdc.be.components.impl.GroupTypeBusinessLogic; import org.openecomp.sdc.be.components.impl.PolicyTypeBusinessLogic; +import org.openecomp.sdc.be.components.impl.ServiceBusinessLogic; import org.openecomp.sdc.be.components.validation.AnnotationValidator; import org.openecomp.sdc.be.dao.janusgraph.JanusGraphDao; import org.openecomp.sdc.be.datatypes.elements.PropertyDataDefinition; @@ -91,6 +92,8 @@ public class YamlTemplateParsingHandlerTest { @Mock private PolicyTypeBusinessLogic policyTypeBusinessLogic; @Mock + private ServiceBusinessLogic serviceBusinessLogic; + @Mock private ToscaFunctionYamlParsingHandler toscaFunctionYamlParsingHandler; private YamlTemplateParsingHandler handler; @@ -139,7 +142,7 @@ public class YamlTemplateParsingHandlerTest { public void setup() { final var annotationBusinessLogic = new AnnotationBusinessLogic(annotationTypeOperations, annotationValidator); handler = new YamlTemplateParsingHandler(janusGraphDao, groupTypeBusinessLogic, annotationBusinessLogic, policyTypeBusinessLogic, - toscaFunctionYamlParsingHandler); + serviceBusinessLogic, toscaFunctionYamlParsingHandler); ReflectionTestUtils.setField(handler, "policyTypeBusinessLogic", policyTypeBusinessLogic); } diff --git a/catalog-be/src/test/java/org/openecomp/sdc/be/components/impl/ResourceBusinessLogicTest.java b/catalog-be/src/test/java/org/openecomp/sdc/be/components/impl/ResourceBusinessLogicTest.java index e9735710da..e4ebd78cce 100644 --- a/catalog-be/src/test/java/org/openecomp/sdc/be/components/impl/ResourceBusinessLogicTest.java +++ b/catalog-be/src/test/java/org/openecomp/sdc/be/components/impl/ResourceBusinessLogicTest.java @@ -1490,7 +1490,7 @@ class ResourceBusinessLogicTest { String resourceYml = new String(csar.get("Definitions/my_vnf.yaml")); YamlTemplateParsingHandler yamlTemplateParser = new YamlTemplateParsingHandler(mockJanusGraphDao, null, - Mockito.mock(AnnotationBusinessLogic.class), null, null); + Mockito.mock(AnnotationBusinessLogic.class), null, null, null); final ParsedToscaYamlInfo parsedToscaYamlInfo = yamlTemplateParser.parseResourceInfoFromYAML("Definitions/my_vnf.yml", resourceYml, Collections.EMPTY_MAP, Collections.EMPTY_MAP, "myVnf", resourceResponse, ""); 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 cf40778542..4b7e42b737 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 @@ -27,6 +27,7 @@ import static org.mockito.Mockito.anyList; import static org.mockito.Mockito.anyMap; import static org.mockito.Mockito.contains; import static org.mockito.Mockito.doNothing; +import static org.mockito.Mockito.doReturn; import static org.mockito.Mockito.eq; import static org.mockito.Mockito.isNull; import static org.mockito.Mockito.matches; @@ -211,8 +212,9 @@ class ServiceImportBusinessLogicTest extends ServiceImportBussinessLogicBaseTest when(csarBusinessLogic.getCsarInfo(any(Service.class), any(), any(User.class), any(Map.class), anyString())).thenReturn(csarInfo); when(serviceImportParseLogic.findNodeTypesArtifactsToHandle(any(Map.class), any(CsarInfo.class), any(Service.class))) .thenReturn(Either.left(new HashMap>>())); - when(csarBusinessLogic.getParsedToscaYamlInfo(anyString(), anyString(), any(), any(CsarInfo.class), any(), any(Service.class))) - .thenReturn(getParsedToscaYamlInfo()); + doReturn(getParsedToscaYamlInfo()).when(csarBusinessLogic).getParsedToscaYamlInfo(anyString(), anyString(), any(), any(CsarInfo.class), any(), any(Service.class)); +// when(csarBusinessLogic.getParsedToscaYamlInfo(anyString(), anyString(), any(), any(CsarInfo.class), any(), any(Service.class))) +// .thenReturn(getParsedToscaYamlInfo()); when(serviceBusinessLogic.lockComponentByName(newService.getSystemName(), oldService, CREATE_RESOURCE)).thenReturn(Either.left(true)); when(toscaOperationFacade.getLatestResourceByToscaResourceName(anyString())).thenReturn(Either.left(createOldResource())); when(serviceImportParseLogic.createServiceTransaction(oldService, csarInfo.getModifier(), false)).thenReturn(newService); -- cgit 1.2.3-korg