diff options
Diffstat (limited to 'catalog-be/src/test/java')
6 files changed, 66 insertions, 61 deletions
diff --git a/catalog-be/src/test/java/org/openecomp/sdc/be/components/impl/ComponentInstanceBusinessLogicTest.java b/catalog-be/src/test/java/org/openecomp/sdc/be/components/impl/ComponentInstanceBusinessLogicTest.java index 12ffe1c193..456074fbba 100644 --- a/catalog-be/src/test/java/org/openecomp/sdc/be/components/impl/ComponentInstanceBusinessLogicTest.java +++ b/catalog-be/src/test/java/org/openecomp/sdc/be/components/impl/ComponentInstanceBusinessLogicTest.java @@ -1169,7 +1169,7 @@ class ComponentInstanceBusinessLogicTest { .thenReturn(StorageOperationStatus.OK); result = testSubject.updateInstanceRequirement(componentTypeEnum, containerComponentId, - componentInstanceUniqueId, capabilityType, capabilityName, requirementDef, userId); + componentInstanceUniqueId, requirementDef, userId); assertEquals(requirementDef, result.left().value()); } 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 55a73c6f3b..d219347fc4 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 @@ -142,52 +142,52 @@ public class ResourceBusinessLogicTest { private static final String GENERIC_CR_NAME = "org.openecomp.resource.abstract.nodes.CR"; private static final String GENERIC_PNF_NAME = "org.openecomp.resource.abstract.nodes.PNF"; - final ServletContext servletContext = Mockito.mock(ServletContext.class); + private final ServletContext servletContext = Mockito.mock(ServletContext.class); IElementOperation mockElementDao; - JanusGraphDao mockJanusGraphDao = Mockito.mock(JanusGraphDao.class); - UserBusinessLogic mockUserAdmin = Mockito.mock(UserBusinessLogic.class); - ToscaOperationFacade toscaOperationFacade = Mockito.mock(ToscaOperationFacade.class); - NodeTypeOperation nodeTypeOperation = Mockito.mock(NodeTypeOperation.class); - NodeTemplateOperation nodeTemplateOperation = Mockito.mock(NodeTemplateOperation.class); - TopologyTemplateOperation topologyTemplateOperation = Mockito.mock(TopologyTemplateOperation.class); - final LifecycleBusinessLogic lifecycleBl = Mockito.mock(LifecycleBusinessLogic.class); - final CatalogOperation catalogOperation = Mockito.mock(CatalogOperation.class); - final ICapabilityTypeOperation capabilityTypeOperation = Mockito.mock(ICapabilityTypeOperation.class); - final PropertyOperation propertyOperation = Mockito.mock(PropertyOperation.class); - final ApplicationDataTypeCache applicationDataTypeCache = Mockito.mock(ApplicationDataTypeCache.class); - WebAppContextWrapper webAppContextWrapper = Mockito.mock(WebAppContextWrapper.class); - UserValidations userValidations = Mockito.mock(UserValidations.class); - WebApplicationContext webAppContext = Mockito.mock(WebApplicationContext.class); - IInterfaceLifecycleOperation interfaceTypeOperation = Mockito.mock(IInterfaceLifecycleOperation.class); - ArtifactCassandraDao artifactCassandraDao = Mockito.mock(ArtifactCassandraDao.class); - IElementOperation elementDao = new ElementOperationMock(); - - CsarUtils csarUtils = Mockito.mock(CsarUtils.class); - UserBusinessLogic userBusinessLogic = Mockito.mock(UserBusinessLogic.class); - IGroupOperation groupOperation = Mockito.mock(IGroupOperation.class); - IGroupInstanceOperation groupInstanceOperation = Mockito.mock(IGroupInstanceOperation.class); - IGroupTypeOperation groupTypeOperation = Mockito.mock(IGroupTypeOperation.class); - GroupBusinessLogic groupBusinessLogic = Mockito.mock(GroupBusinessLogic.class); - InterfaceOperation interfaceOperation = Mockito.mock(InterfaceOperation.class); - ArtifactsOperations artifactToscaOperation = Mockito.mock(ArtifactsOperations.class); - private PropertyBusinessLogic propertyBusinessLogic = Mockito.mock(PropertyBusinessLogic.class); - ArtifactsResolver artifactsResolver = Mockito.mock(ArtifactsResolver.class); - InterfaceLifecycleOperation interfaceLifecycleTypeOperation = Mockito.mock(InterfaceLifecycleOperation.class); - ComponentInstanceBusinessLogic componentInstanceBusinessLogic = Mockito.mock(ComponentInstanceBusinessLogic.class); - ResourceImportManager resourceImportManager = Mockito.mock(ResourceImportManager.class); - InputsBusinessLogic inputsBusinessLogic = Mockito.mock(InputsBusinessLogic.class); - CompositionBusinessLogic compositionBusinessLogic = Mockito.mock(CompositionBusinessLogic.class); - ResourceDataMergeBusinessLogic resourceDataMergeBusinessLogic = Mockito.mock(ResourceDataMergeBusinessLogic.class); - CsarArtifactsAndGroupsBusinessLogic csarArtifactsAndGroupsBusinessLogic = Mockito.mock(CsarArtifactsAndGroupsBusinessLogic.class); - MergeInstanceUtils mergeInstanceUtils = Mockito.mock(MergeInstanceUtils.class); - UiComponentDataConverter uiComponentDataConverter = Mockito.mock(UiComponentDataConverter.class); - ToscaExportHandler toscaExportHandler = Mockito.mock(ToscaExportHandler.class); - PolicyBusinessLogic policyBusinessLogic = Mockito.mock(PolicyBusinessLogic.class); - + private final JanusGraphDao mockJanusGraphDao = Mockito.mock(JanusGraphDao.class); + private final UserBusinessLogic mockUserAdmin = Mockito.mock(UserBusinessLogic.class); + private final ToscaOperationFacade toscaOperationFacade = Mockito.mock(ToscaOperationFacade.class); + private final NodeTypeOperation nodeTypeOperation = Mockito.mock(NodeTypeOperation.class); + private final NodeTemplateOperation nodeTemplateOperation = Mockito.mock(NodeTemplateOperation.class); + private final TopologyTemplateOperation topologyTemplateOperation = Mockito.mock(TopologyTemplateOperation.class); + private final LifecycleBusinessLogic lifecycleBl = Mockito.mock(LifecycleBusinessLogic.class); + private final CatalogOperation catalogOperation = Mockito.mock(CatalogOperation.class); + private final ICapabilityTypeOperation capabilityTypeOperation = Mockito.mock(ICapabilityTypeOperation.class); + private final PropertyOperation propertyOperation = Mockito.mock(PropertyOperation.class); + private final ApplicationDataTypeCache applicationDataTypeCache = Mockito.mock(ApplicationDataTypeCache.class); + private final WebAppContextWrapper webAppContextWrapper = Mockito.mock(WebAppContextWrapper.class); + private final UserValidations userValidations = Mockito.mock(UserValidations.class); + private final WebApplicationContext webAppContext = Mockito.mock(WebApplicationContext.class); + private final IInterfaceLifecycleOperation interfaceTypeOperation = Mockito.mock(IInterfaceLifecycleOperation.class); + private final ArtifactCassandraDao artifactCassandraDao = Mockito.mock(ArtifactCassandraDao.class); + private final IElementOperation elementDao = new ElementOperationMock(); + + private final CsarUtils csarUtils = Mockito.mock(CsarUtils.class); + private final UserBusinessLogic userBusinessLogic = Mockito.mock(UserBusinessLogic.class); + private final IGroupOperation groupOperation = Mockito.mock(IGroupOperation.class); + private final IGroupInstanceOperation groupInstanceOperation = Mockito.mock(IGroupInstanceOperation.class); + private final IGroupTypeOperation groupTypeOperation = Mockito.mock(IGroupTypeOperation.class); + private final GroupBusinessLogic groupBusinessLogic = Mockito.mock(GroupBusinessLogic.class); + private final InterfaceOperation interfaceOperation = Mockito.mock(InterfaceOperation.class); + private final ArtifactsOperations artifactToscaOperation = Mockito.mock(ArtifactsOperations.class); + private final PropertyBusinessLogic propertyBusinessLogic = Mockito.mock(PropertyBusinessLogic.class); + private final ArtifactsResolver artifactsResolver = Mockito.mock(ArtifactsResolver.class); + private final InterfaceLifecycleOperation interfaceLifecycleTypeOperation = Mockito.mock(InterfaceLifecycleOperation.class); + private final ComponentInstanceBusinessLogic componentInstanceBusinessLogic = Mockito.mock(ComponentInstanceBusinessLogic.class); + private final ResourceImportManager resourceImportManager = Mockito.mock(ResourceImportManager.class); + private final InputsBusinessLogic inputsBusinessLogic = Mockito.mock(InputsBusinessLogic.class); + private final OutputsBusinessLogic outputsBusinessLogic = Mockito.mock(OutputsBusinessLogic.class); + private final CompositionBusinessLogic compositionBusinessLogic = Mockito.mock(CompositionBusinessLogic.class); + private final ResourceDataMergeBusinessLogic resourceDataMergeBusinessLogic = Mockito.mock(ResourceDataMergeBusinessLogic.class); + private final CsarArtifactsAndGroupsBusinessLogic csarArtifactsAndGroupsBusinessLogic = Mockito.mock(CsarArtifactsAndGroupsBusinessLogic.class); + private final MergeInstanceUtils mergeInstanceUtils = Mockito.mock(MergeInstanceUtils.class); + private final UiComponentDataConverter uiComponentDataConverter = Mockito.mock(UiComponentDataConverter.class); + private final ToscaExportHandler toscaExportHandler = Mockito.mock(ToscaExportHandler.class); + private final PolicyBusinessLogic policyBusinessLogic = Mockito.mock(PolicyBusinessLogic.class); @InjectMocks ResponseFormatManager responseManager = null; - GraphLockOperation graphLockOperation = Mockito.mock(GraphLockOperation.class); + private final GraphLockOperation graphLockOperation = Mockito.mock(GraphLockOperation.class); User user = null; Resource resourceResponse = null; Resource genericVF = null; @@ -285,7 +285,7 @@ public class ResourceBusinessLogicTest { artifactManager.setNodeTemplateOperation(nodeTemplateOperation); bl = new ResourceBusinessLogic(mockElementDao, groupOperation, groupInstanceOperation, groupTypeOperation, groupBusinessLogic, interfaceOperation, interfaceLifecycleTypeOperation, artifactManager, componentInstanceBusinessLogic, - resourceImportManager, inputsBusinessLogic, compositionBusinessLogic, resourceDataMergeBusinessLogic, + resourceImportManager, inputsBusinessLogic, outputsBusinessLogic, compositionBusinessLogic, resourceDataMergeBusinessLogic, csarArtifactsAndGroupsBusinessLogic, mergeInstanceUtils, uiComponentDataConverter, csarBusinessLogic, artifactToscaOperation, propertyBusinessLogic, componentContactIdValidator, componentNameValidator, componentTagsValidator, componentValidator, componentIconValidator, componentProjectCodeValidator, @@ -2273,4 +2273,4 @@ public class ResourceBusinessLogicTest { assertTrue(result.isRight()); assertTrue(result.right().value() instanceof ByActionStatusComponentException); } -}
\ No newline at end of file +} diff --git a/catalog-be/src/test/java/org/openecomp/sdc/be/components/lifecycle/CheckoutTest.java b/catalog-be/src/test/java/org/openecomp/sdc/be/components/lifecycle/CheckoutTest.java index 48c2c9c2a2..47ca94dbdc 100644 --- a/catalog-be/src/test/java/org/openecomp/sdc/be/components/lifecycle/CheckoutTest.java +++ b/catalog-be/src/test/java/org/openecomp/sdc/be/components/lifecycle/CheckoutTest.java @@ -7,9 +7,9 @@ * 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. @@ -30,6 +30,7 @@ import org.openecomp.sdc.be.components.csar.CsarBusinessLogic; import org.openecomp.sdc.be.components.impl.ComponentInstanceBusinessLogic; import org.openecomp.sdc.be.components.impl.CompositionBusinessLogic; import org.openecomp.sdc.be.components.impl.InputsBusinessLogic; +import org.openecomp.sdc.be.components.impl.OutputsBusinessLogic; import org.openecomp.sdc.be.components.impl.PolicyBusinessLogic; import org.openecomp.sdc.be.components.impl.PropertyBusinessLogic; import org.openecomp.sdc.be.components.impl.ResourceBusinessLogic; @@ -56,6 +57,7 @@ public class CheckoutTest extends LifecycleTestBase { private final ComponentInstanceBusinessLogic componentInstanceBusinessLogic = Mockito.mock(ComponentInstanceBusinessLogic.class); private final ResourceImportManager resourceImportManager = Mockito.mock(ResourceImportManager.class); private final InputsBusinessLogic inputsBusinessLogic = Mockito.mock(InputsBusinessLogic.class); + private final OutputsBusinessLogic outputsBusinessLogic = Mockito.mock(OutputsBusinessLogic.class); private final CompositionBusinessLogic compositionBusinessLogic = Mockito.mock(CompositionBusinessLogic.class); private final ResourceDataMergeBusinessLogic resourceDataMergeBusinessLogic = Mockito.mock(ResourceDataMergeBusinessLogic.class); private final CsarArtifactsAndGroupsBusinessLogic csarArtifactsAndGroupsBusinessLogic = Mockito.mock(CsarArtifactsAndGroupsBusinessLogic.class); @@ -63,13 +65,13 @@ public class CheckoutTest extends LifecycleTestBase { private final UiComponentDataConverter uiComponentDataConverter = Mockito.mock(UiComponentDataConverter.class); private final CsarBusinessLogic csarBusinessLogic = Mockito.mock(CsarBusinessLogic.class); private final PropertyBusinessLogic propertyBusinessLogic = Mockito.mock(PropertyBusinessLogic.class); - protected ComponentContactIdValidator componentContactIdValidator = new ComponentContactIdValidator(componentsUtils); - protected ComponentNameValidator componentNameValidator = new ComponentNameValidator(componentsUtils, toscaOperationFacade); + private final ComponentContactIdValidator componentContactIdValidator = new ComponentContactIdValidator(componentsUtils); + private final ComponentNameValidator componentNameValidator = new ComponentNameValidator(componentsUtils, toscaOperationFacade); private final PolicyBusinessLogic policyBusinessLogic = Mockito.mock(PolicyBusinessLogic.class); @InjectMocks ResourceBusinessLogic bl = new ResourceBusinessLogic(elementDao, groupOperation, groupInstanceOperation, groupTypeOperation, groupBusinessLogic, interfaceOperation, interfaceLifecycleTypeOperation, artifactsBusinessLogic, - componentInstanceBusinessLogic, resourceImportManager, inputsBusinessLogic, compositionBusinessLogic, + componentInstanceBusinessLogic, resourceImportManager, inputsBusinessLogic, outputsBusinessLogic,compositionBusinessLogic, resourceDataMergeBusinessLogic, csarArtifactsAndGroupsBusinessLogic, mergeInstanceUtils, uiComponentDataConverter, csarBusinessLogic, artifactToscaOperation, propertyBusinessLogic, componentContactIdValidator, componentNameValidator, componentTagsValidator, componentValidator, diff --git a/catalog-be/src/test/java/org/openecomp/sdc/be/servlets/ComponentInstanceServletTest.java b/catalog-be/src/test/java/org/openecomp/sdc/be/servlets/ComponentInstanceServletTest.java index abe2544f73..d164fe3058 100644 --- a/catalog-be/src/test/java/org/openecomp/sdc/be/servlets/ComponentInstanceServletTest.java +++ b/catalog-be/src/test/java/org/openecomp/sdc/be/servlets/ComponentInstanceServletTest.java @@ -498,7 +498,7 @@ class ComponentInstanceServletTest extends JerseyTest { eq(AuditingActionEnum.GET_TOSCA_MODEL), eq(ComponentTypeEnum.SERVICE))) .thenReturn(Either.left(requirementDefinition)); when(componentInstanceBusinessLogic.updateInstanceRequirement(ComponentTypeEnum.SERVICE, - componentId, componentInstanceId, capabilityType, requirementName, requirementDefinition, USER_ID)) + componentId, componentInstanceId, requirementDefinition, USER_ID)) .thenReturn(Either.left(requirementDefinition)); when(componentsUtils.getResponseFormat(ActionStatus.OK)).thenReturn(responseFormat); when(responseFormat.getStatus()).thenReturn(HttpStatus.OK_200); diff --git a/catalog-be/src/test/java/org/openecomp/sdc/be/tosca/InterfacesOperationsConverterTest.java b/catalog-be/src/test/java/org/openecomp/sdc/be/tosca/InterfacesOperationsConverterTest.java index d4fb60e878..3c425c1f08 100644 --- a/catalog-be/src/test/java/org/openecomp/sdc/be/tosca/InterfacesOperationsConverterTest.java +++ b/catalog-be/src/test/java/org/openecomp/sdc/be/tosca/InterfacesOperationsConverterTest.java @@ -124,7 +124,7 @@ class InterfacesOperationsConverterTest { final Map<String, Object> interfaceTypeElement = addInterfaceTypeElement(component, new ArrayList<>()); - ToscaExportHandler handler = new ToscaExportHandler(null,null,null,null,null,null, null, null, + ToscaExportHandler handler = new ToscaExportHandler(null,null,null,null,null,null, null, null,null, interfacesOperationsConverter); ToscaTemplate template = new ToscaTemplate("test"); template.setInterface_types(interfaceTypeElement); @@ -152,7 +152,7 @@ class InterfacesOperationsConverterTest { final Map<String, Object> interfaceTypeElement = addInterfaceTypeElement(component, new ArrayList<>()); - ToscaExportHandler handler = new ToscaExportHandler(null,null,null,null,null,null, null, null, + ToscaExportHandler handler = new ToscaExportHandler(null,null,null,null,null,null, null, null,null, interfacesOperationsConverter); ToscaTemplate template = new ToscaTemplate("testService"); template.setInterface_types(interfaceTypeElement); @@ -178,7 +178,7 @@ class InterfacesOperationsConverterTest { ToscaNodeType nodeType = new ToscaNodeType(); interfacesOperationsConverter.addInterfaceDefinitionElement(component, nodeType, dataTypes, false); - ToscaExportHandler handler = new ToscaExportHandler(null,null,null,null,null,null, null, null, + ToscaExportHandler handler = new ToscaExportHandler(null,null,null,null,null,null, null, null,null, interfacesOperationsConverter); ToscaTemplate template = new ToscaTemplate(NODE_TYPE_NAME); Map<String, ToscaNodeType> nodeTypes = new HashMap<>(); @@ -208,7 +208,7 @@ class InterfacesOperationsConverterTest { ToscaNodeType nodeType = new ToscaNodeType(); interfacesOperationsConverter.addInterfaceDefinitionElement(component, nodeType, dataTypes, false); - ToscaExportHandler handler = new ToscaExportHandler(null,null,null,null,null,null, null, null, + ToscaExportHandler handler = new ToscaExportHandler(null,null,null,null,null,null, null, null,null, interfacesOperationsConverter); ToscaTemplate template = new ToscaTemplate("testService"); Map<String, ToscaNodeType> nodeTypes = new HashMap<>(); @@ -267,7 +267,7 @@ class InterfacesOperationsConverterTest { ToscaNodeType nodeType = new ToscaNodeType(); interfacesOperationsConverter.addInterfaceDefinitionElement(component, nodeType, null, false); - ToscaExportHandler handler = new ToscaExportHandler(null,null,null,null,null,null, null, null, + ToscaExportHandler handler = new ToscaExportHandler(null,null,null,null,null,null, null, null,null, interfacesOperationsConverter); ToscaTemplate template = new ToscaTemplate("test"); Map<String, ToscaNodeType> nodeTypes = new HashMap<>(); @@ -301,7 +301,7 @@ class InterfacesOperationsConverterTest { ToscaNodeType nodeType = new ToscaNodeType(); interfacesOperationsConverter.addInterfaceDefinitionElement(component, nodeType, dataTypes, false); - ToscaExportHandler handler = new ToscaExportHandler(null,null,null,null,null,null, null, null, + ToscaExportHandler handler = new ToscaExportHandler(null,null,null,null,null,null, null, null,null, interfacesOperationsConverter); ToscaTemplate template = new ToscaTemplate("test"); Map<String, ToscaNodeType> nodeTypes = new HashMap<>(); @@ -350,7 +350,7 @@ class InterfacesOperationsConverterTest { ToscaNodeType nodeType = new ToscaNodeType(); interfacesOperationsConverter.addInterfaceDefinitionElement(component, nodeType, dataTypes, false); - ToscaExportHandler handler = new ToscaExportHandler(null,null,null,null,null,null, null, null, + ToscaExportHandler handler = new ToscaExportHandler(null,null,null,null,null,null, null, null,null, interfacesOperationsConverter); ToscaTemplate template = new ToscaTemplate("test"); Map<String, ToscaNodeType> nodeTypes = new HashMap<>(); @@ -385,7 +385,7 @@ class InterfacesOperationsConverterTest { component.getInterfaces().put(interfaceName, aInterfaceWithInput); final ToscaNodeType nodeType = new ToscaNodeType(); interfacesOperationsConverter.addInterfaceDefinitionElement(component, nodeType, dataTypes, false); - final ToscaExportHandler handler = new ToscaExportHandler(null, null, null, null, null, null, null, null, + final ToscaExportHandler handler = new ToscaExportHandler(null, null, null, null, null, null, null, null,null, interfacesOperationsConverter); final ToscaTemplate template = new ToscaTemplate("testService"); final Map<String, ToscaNodeType> nodeTypes = new HashMap<>(); diff --git a/catalog-be/src/test/java/org/openecomp/sdc/be/tosca/ToscaExportHandlerTest.java b/catalog-be/src/test/java/org/openecomp/sdc/be/tosca/ToscaExportHandlerTest.java index 71a43acdb4..2b00668a74 100644 --- a/catalog-be/src/test/java/org/openecomp/sdc/be/tosca/ToscaExportHandlerTest.java +++ b/catalog-be/src/test/java/org/openecomp/sdc/be/tosca/ToscaExportHandlerTest.java @@ -113,6 +113,7 @@ import org.openecomp.sdc.be.tosca.model.ToscaTemplateArtifact; import org.openecomp.sdc.be.tosca.model.ToscaTemplateRequirement; import org.openecomp.sdc.be.tosca.model.ToscaTopolgyTemplate; import org.openecomp.sdc.be.tosca.utils.InputConverter; +import org.openecomp.sdc.be.tosca.utils.OutputConverter; public class ToscaExportHandlerTest extends BeConfDependentTest { @@ -140,6 +141,9 @@ public class ToscaExportHandlerTest extends BeConfDependentTest { private InputConverter inputConverter; @Mock + private OutputConverter outputConverter; + + @Mock private GroupExportParser groupExportParser; @Mock @@ -426,8 +430,7 @@ public class ToscaExportHandlerTest extends BeConfDependentTest { when(inputConverter.convertInputs(any(List.class), any(Map.class))).thenReturn(new HashMap<>()); - when(groupExportParser.getGroups(component)) - .thenReturn(null); + when(groupExportParser.getGroups(component)).thenReturn(null); // test component contains group result = Deencapsulation.invoke(testSubject, "convertToscaTemplate", component, toscaNode); |