diff options
author | franciscovila <javier.paradela.vila@est.tech> | 2022-10-07 11:52:30 +0100 |
---|---|---|
committer | Michael Morris <michael.morris@est.tech> | 2022-10-25 13:18:15 +0000 |
commit | 5517cab153e2efce298f1da98fd4b41b483cb57f (patch) | |
tree | efe1e9b3db94f155c977d1ac6d2b7e51bdb3cf3c /catalog-be/src/test | |
parent | 3d79660270cc259688e0ba20150286c1680c7559 (diff) |
Constraint validation - Node Template Interfaces
Validate constraints in node template interfaces
Issue-ID: SDC-4207
Signed-off-by: franciscovila <javier.paradela.vila@est.tech>
Change-Id: Ibe4a55342067942a2a29f540c896ecc39811220f
Diffstat (limited to 'catalog-be/src/test')
2 files changed, 281 insertions, 11 deletions
diff --git a/catalog-be/src/test/java/org/openecomp/sdc/be/components/impl/ComponentInterfaceOperationBusinessLogicTest.java b/catalog-be/src/test/java/org/openecomp/sdc/be/components/impl/ComponentInterfaceOperationBusinessLogicTest.java index 6018207cb7..b3f6024a9b 100644 --- a/catalog-be/src/test/java/org/openecomp/sdc/be/components/impl/ComponentInterfaceOperationBusinessLogicTest.java +++ b/catalog-be/src/test/java/org/openecomp/sdc/be/components/impl/ComponentInterfaceOperationBusinessLogicTest.java @@ -20,11 +20,13 @@ package org.openecomp.sdc.be.components.impl; import static org.assertj.core.api.Assertions.assertThat; +import static org.junit.jupiter.api.Assertions.assertTrue; import static org.junit.jupiter.api.Assertions.fail; import static org.mockito.ArgumentMatchers.any; import static org.mockito.Mockito.when; import fj.data.Either; +import java.util.Arrays; import java.util.Collections; import java.util.HashMap; import java.util.List; @@ -41,28 +43,39 @@ import org.mockito.junit.jupiter.MockitoExtension; import org.openecomp.sdc.be.components.impl.exceptions.BusinessLogicException; import org.openecomp.sdc.be.components.validation.ComponentValidations; import org.openecomp.sdc.be.components.validation.UserValidations; +import org.openecomp.sdc.be.dao.janusgraph.JanusGraphDao; import org.openecomp.sdc.be.dao.janusgraph.JanusGraphGenericDao; import org.openecomp.sdc.be.dao.janusgraph.JanusGraphOperationStatus; -import org.openecomp.sdc.be.dao.janusgraph.JanusGraphDao; import org.openecomp.sdc.be.datatypes.elements.ArtifactDataDefinition; +import org.openecomp.sdc.be.datatypes.elements.ListDataDefinition; import org.openecomp.sdc.be.datatypes.elements.OperationDataDefinition; +import org.openecomp.sdc.be.datatypes.elements.OperationInputDefinition; +import org.openecomp.sdc.be.datatypes.elements.PropertyDataDefinition; import org.openecomp.sdc.be.datatypes.enums.ComponentTypeEnum; import org.openecomp.sdc.be.datatypes.enums.NodeTypeEnum; import org.openecomp.sdc.be.datatypes.enums.OriginTypeEnum; import org.openecomp.sdc.be.impl.ComponentsUtils; +import org.openecomp.sdc.be.model.ArtifactTypeDefinition; import org.openecomp.sdc.be.model.Component; import org.openecomp.sdc.be.model.ComponentInstance; import org.openecomp.sdc.be.model.ComponentInstanceInterface; import org.openecomp.sdc.be.model.ComponentParametersView; +import org.openecomp.sdc.be.model.DataTypeDefinition; import org.openecomp.sdc.be.model.InterfaceDefinition; +import org.openecomp.sdc.be.model.PropertyConstraint; +import org.openecomp.sdc.be.model.PropertyDefinition; import org.openecomp.sdc.be.model.Service; +import org.openecomp.sdc.be.model.cache.ApplicationDataTypeCache; import org.openecomp.sdc.be.model.jsonjanusgraph.operations.ToscaOperationFacade; import org.openecomp.sdc.be.model.operations.api.StorageOperationStatus; import org.openecomp.sdc.be.model.operations.impl.GraphLockOperation; +import org.openecomp.sdc.be.model.operations.impl.UniqueIdBuilder; +import org.openecomp.sdc.be.model.tosca.constraints.ValidValuesConstraint; import org.openecomp.sdc.common.datastructure.Wrapper; +import org.openecomp.sdc.exception.ResponseFormat; @ExtendWith(MockitoExtension.class) -public class ComponentInterfaceOperationBusinessLogicTest extends BaseBusinessLogicMock { +class ComponentInterfaceOperationBusinessLogicTest extends BaseBusinessLogicMock { @InjectMocks private ComponentInterfaceOperationBusinessLogic componentInterfaceOperationBusinessLogic; @@ -81,6 +94,12 @@ public class ComponentInterfaceOperationBusinessLogicTest extends BaseBusinessLo private UserValidations userValidations; @Mock private ComponentValidations componentValidations; + @Mock + private PropertyBusinessLogic propertyBusinessLogic; + @Mock + private ApplicationDataTypeCache applicationDataTypeCache; + @Mock + private ArtifactTypeBusinessLogic artifactTypeBusinessLogic; private Component component; private ComponentInstance componentInstance; @@ -92,19 +111,19 @@ public class ComponentInterfaceOperationBusinessLogicTest extends BaseBusinessLo componentInterfaceOperationBusinessLogic = new ComponentInterfaceOperationBusinessLogic(elementDao, groupOperation, groupInstanceOperation, groupTypeOperation, interfaceOperation, interfaceLifecycleTypeOperation, artifactToscaOperation, - componentValidations); + componentValidations, propertyBusinessLogic, artifactTypeBusinessLogic); componentInterfaceOperationBusinessLogic.setToscaOperationFacade(toscaOperationFacade); componentInterfaceOperationBusinessLogic.setGraphLockOperation(graphLockOperation); componentInterfaceOperationBusinessLogic.setComponentsUtils(componentsUtils); componentInterfaceOperationBusinessLogic.setUserValidations(userValidations); componentInterfaceOperationBusinessLogic.setJanusGraphGenericDao(janusGraphGenericDao); componentInterfaceOperationBusinessLogic.setJanusGraphDao(janusGraphDao); - + componentInterfaceOperationBusinessLogic.setApplicationDataTypeCache(applicationDataTypeCache); initComponentData(); } @Test - public void updateSubstitutionFilterTest() throws BusinessLogicException { + void updateComponentInstanceInterfaceOperationTest() throws BusinessLogicException { final String componentId = component.getUniqueId(); final String componentInstanceId = componentInstance.getUniqueId(); final InterfaceDefinition interfaceDefinition = new InterfaceDefinition(); @@ -141,6 +160,7 @@ public class ComponentInterfaceOperationBusinessLogicTest extends BaseBusinessLo when(janusGraphDao.commit()).thenReturn(JanusGraphOperationStatus.OK); when(graphLockOperation.unlockComponent(componentId, NodeTypeEnum.Service)) .thenReturn(StorageOperationStatus.OK); + when(applicationDataTypeCache.getAll(null)).thenReturn(Either.left(new HashMap<>())); final Optional<ComponentInstance> result = componentInterfaceOperationBusinessLogic .updateComponentInstanceInterfaceOperation(componentId, componentInstanceId, interfaceDefinition, @@ -148,7 +168,257 @@ public class ComponentInterfaceOperationBusinessLogicTest extends BaseBusinessLo assertThat(result).isPresent(); } - public void initComponentData() { + @Test + void valueForInputFailsConstraintsValidation() throws BusinessLogicException { + final String inputType = "myType"; + final String componentId = component.getUniqueId(); + final String componentInstanceId = componentInstance.getUniqueId(); + final InterfaceDefinition interfaceDefinition = new InterfaceDefinition(); + interfaceDefinition.setUniqueId(UUID.randomUUID().toString()); + interfaceDefinition.setType("tosca.interfaces.node.lifecycle.Standard"); + final Map<String, OperationDataDefinition> operations = new HashMap<>(); + final OperationDataDefinition operationDataDefinition = new OperationDataDefinition(); + operationDataDefinition.setUniqueId(UUID.randomUUID().toString()); + final ArtifactDataDefinition artifactDataDefinition = new ArtifactDataDefinition(); + final ListDataDefinition<OperationInputDefinition> inputsDefinitionListData = new ListDataDefinition<>(); + OperationInputDefinition input1 = new OperationInputDefinition(); + input1.setName("input_1"); + input1.setType(inputType); + input1.setValue("{\"input_range\": \"invalid\"}"); + inputsDefinitionListData.add(input1); + artifactDataDefinition.setArtifactName("EO Implementation info"); + operationDataDefinition.setImplementation(artifactDataDefinition); + operationDataDefinition.setInputs(inputsDefinitionListData); + operations.put("configure", operationDataDefinition); + interfaceDefinition.setOperations(operations ); + + DataTypeDefinition myType = new DataTypeDefinition(); + myType.setName(inputType); + PropertyDefinition input_range = new PropertyDefinition(); + input_range.setName("input_range"); + input_range.setType("string"); + PropertyConstraint constraint1 = new ValidValuesConstraint(Arrays.asList("value1", "value2", "value3")); + input_range.setConstraints(List.of(constraint1)); + myType.setProperties(List.of(input_range)); + Map<String, DataTypeDefinition> dataTypes = Collections.singletonMap(myType.getName(), myType); + Wrapper<ResponseFormat> errorWrapper = new Wrapper<>(); + + final ComponentInstanceInterface componentInstanceInterface = + new ComponentInstanceInterface("interfaceId", interfaceDefinition); + Map<String, List<ComponentInstanceInterface>> componentInstancesInterfacesMap = new HashMap<>(); + componentInstancesInterfacesMap.put(componentInstanceId, Collections.singletonList(componentInstanceInterface)); + component.setComponentInstancesInterfaces(componentInstancesInterfacesMap); + componentInstance.setInterfaces( + (Map<String, Object>) new HashMap<>().put(componentInstanceId, interfaceDefinition)); + component.setComponentInstances(Collections.singletonList(componentInstance)); + + when(toscaOperationFacade.getToscaElement(componentId)).thenReturn(Either.left(component)); + when(componentValidations.getComponentInstance(component, componentInstanceId)) + .thenReturn(Optional.of(componentInstance)); + when(applicationDataTypeCache.getAll(null)).thenReturn(Either.left(dataTypes)); + + final Optional<ComponentInstance> result = componentInterfaceOperationBusinessLogic + .updateComponentInstanceInterfaceOperation(componentId, componentInstanceId, interfaceDefinition, + ComponentTypeEnum.SERVICE, errorWrapper, false); + assertThat(result).isNotPresent(); + assertTrue(errorWrapper.getInnerElement().getStatus() == 400); + assertTrue(errorWrapper.getInnerElement().getRequestError().getRequestError().getServiceException().getText() + .contains("Error: Invalid property values provided")); + } + + @Test + void valueForInputSucceedsConstraintsValidation() throws BusinessLogicException { + final String inputType = "myType"; + final String componentId = component.getUniqueId(); + final String componentInstanceId = componentInstance.getUniqueId(); + final InterfaceDefinition interfaceDefinition = new InterfaceDefinition(); + interfaceDefinition.setUniqueId(UUID.randomUUID().toString()); + interfaceDefinition.setType("tosca.interfaces.node.lifecycle.Standard"); + final Map<String, OperationDataDefinition> operations = new HashMap<>(); + final OperationDataDefinition operationDataDefinition = new OperationDataDefinition(); + operationDataDefinition.setUniqueId(UUID.randomUUID().toString()); + final ArtifactDataDefinition artifactDataDefinition = new ArtifactDataDefinition(); + final ListDataDefinition<OperationInputDefinition> inputsDefinitionListData = new ListDataDefinition<>(); + OperationInputDefinition input1 = new OperationInputDefinition(); + input1.setName("input_1"); + input1.setType(inputType); + input1.setValue("{\"input_range\": \"value1\"}"); + inputsDefinitionListData.add(input1); + artifactDataDefinition.setArtifactName("EO Implementation info"); + operationDataDefinition.setImplementation(artifactDataDefinition); + operationDataDefinition.setInputs(inputsDefinitionListData); + operations.put("configure", operationDataDefinition); + interfaceDefinition.setOperations(operations ); + + DataTypeDefinition myType = new DataTypeDefinition(); + myType.setName(inputType); + PropertyDefinition input_range = new PropertyDefinition(); + input_range.setName("input_range"); + input_range.setType("string"); + PropertyConstraint constraint1 = new ValidValuesConstraint(Arrays.asList("value1", "value2", "value3")); + input_range.setConstraints(List.of(constraint1)); + myType.setProperties(List.of(input_range)); + Map<String, DataTypeDefinition> dataTypes = Collections.singletonMap(myType.getName(), myType); + Wrapper<ResponseFormat> errorWrapper = new Wrapper<>(); + + final ComponentInstanceInterface componentInstanceInterface = + new ComponentInstanceInterface("interfaceId", interfaceDefinition); + Map<String, List<ComponentInstanceInterface>> componentInstancesInterfacesMap = new HashMap<>(); + componentInstancesInterfacesMap.put(componentInstanceId, Collections.singletonList(componentInstanceInterface)); + component.setComponentInstancesInterfaces(componentInstancesInterfacesMap); + componentInstance.setInterfaces( + (Map<String, Object>) new HashMap<>().put(componentInstanceId, interfaceDefinition)); + component.setComponentInstances(Collections.singletonList(componentInstance)); + + when(toscaOperationFacade.getToscaElement(componentId)).thenReturn(Either.left(component)); + when(componentValidations.getComponentInstance(component, componentInstanceId)) + .thenReturn(Optional.of(componentInstance)); + when(toscaOperationFacade.updateComponentInstanceInterfaces(component, componentInstanceId)) + .thenReturn(StorageOperationStatus.OK); + when(toscaOperationFacade + .updateComponentInstanceMetadataOfTopologyTemplate(any(Service.class), any(ComponentParametersView.class))) + .thenReturn(Either.left(component)); + when(applicationDataTypeCache.getAll(null)).thenReturn(Either.left(dataTypes)); + + final Optional<ComponentInstance> result = componentInterfaceOperationBusinessLogic + .updateComponentInstanceInterfaceOperation(componentId, componentInstanceId, interfaceDefinition, + ComponentTypeEnum.SERVICE, errorWrapper, false); + assertThat(result).isPresent(); + } + + @Test + void valueForArtifactInputFailsConstraintsValidation() throws BusinessLogicException { + final String inputType = "myType"; + final String artifactType = "artifactType"; + final String componentId = component.getUniqueId(); + final String componentInstanceId = componentInstance.getUniqueId(); + final InterfaceDefinition interfaceDefinition = new InterfaceDefinition(); + interfaceDefinition.setUniqueId(UUID.randomUUID().toString()); + interfaceDefinition.setType("tosca.interfaces.node.lifecycle.Standard"); + final Map<String, OperationDataDefinition> operations = new HashMap<>(); + final OperationDataDefinition operationDataDefinition = new OperationDataDefinition(); + operationDataDefinition.setUniqueId(UUID.randomUUID().toString()); + final ArtifactDataDefinition artifactDataDefinition = new ArtifactDataDefinition(); + + artifactDataDefinition.setArtifactName("EO Implementation info"); + artifactDataDefinition.setArtifactType(artifactType); + PropertyDataDefinition propertyDataDefinition = new PropertyDataDefinition(); + propertyDataDefinition.setName("propertyWithRestrictedValues"); + propertyDataDefinition.setType(inputType); + propertyDataDefinition.setValue("{\"propertyWithRestrictedValues\": \"invalid\"}"); + artifactDataDefinition.addProperty(propertyDataDefinition); + + operationDataDefinition.setImplementation(artifactDataDefinition); + operations.put("configure", operationDataDefinition); + interfaceDefinition.setOperations(operations ); + + final DataTypeDefinition myType = new DataTypeDefinition(); + final ArtifactTypeDefinition artifactTypeDefinitionFromCache = new ArtifactTypeDefinition(); + artifactTypeDefinitionFromCache.setName(UniqueIdBuilder.buildArtifactTypeUid(null, artifactType)); + myType.setName(inputType); + PropertyDefinition propertyWithRestrictedValues = new PropertyDefinition(); + propertyWithRestrictedValues.setName("propertyWithRestrictedValues"); + propertyWithRestrictedValues.setType("string"); + PropertyConstraint constraint1 = new ValidValuesConstraint(Arrays.asList("value1", "value2", "value3")); + propertyWithRestrictedValues.setConstraints(List.of(constraint1)); + artifactTypeDefinitionFromCache.setProperties(List.of(propertyWithRestrictedValues)); + myType.setProperties(List.of(propertyWithRestrictedValues)); + Map<String, DataTypeDefinition> dataTypes = Collections.singletonMap(myType.getName(), myType); + Wrapper<ResponseFormat> errorWrapper = new Wrapper<>(); + + final ComponentInstanceInterface componentInstanceInterface = + new ComponentInstanceInterface("interfaceId", interfaceDefinition); + Map<String, List<ComponentInstanceInterface>> componentInstancesInterfacesMap = new HashMap<>(); + componentInstancesInterfacesMap.put(componentInstanceId, Collections.singletonList(componentInstanceInterface)); + component.setComponentInstancesInterfaces(componentInstancesInterfacesMap); + componentInstance.setInterfaces( + (Map<String, Object>) new HashMap<>().put(componentInstanceId, interfaceDefinition)); + component.setComponentInstances(Collections.singletonList(componentInstance)); + + when(toscaOperationFacade.getToscaElement(componentId)).thenReturn(Either.left(component)); + when(componentValidations.getComponentInstance(component, componentInstanceId)) + .thenReturn(Optional.of(componentInstance)); + when(applicationDataTypeCache.getAll(null)).thenReturn(Either.left(dataTypes)); + when(artifactTypeBusinessLogic.getArtifactTypeByUid(UniqueIdBuilder.buildArtifactTypeUid( + null, artifactType))).thenReturn(artifactTypeDefinitionFromCache); + + final Optional<ComponentInstance> result = componentInterfaceOperationBusinessLogic + .updateComponentInstanceInterfaceOperation(componentId, componentInstanceId, interfaceDefinition, + ComponentTypeEnum.SERVICE, errorWrapper, false); + assertThat(result).isNotPresent(); + assertTrue(errorWrapper.getInnerElement().getStatus() == 400); + assertTrue(errorWrapper.getInnerElement().getRequestError().getRequestError().getServiceException().getText() + .contains("Error: Invalid property values provided")); + } + + @Test + void valueForArtifactInputSucceedsConstraintsValidation() throws BusinessLogicException { + final String inputType = "myType"; + final String artifactType = "artifactType"; + final String componentId = component.getUniqueId(); + final String componentInstanceId = componentInstance.getUniqueId(); + final InterfaceDefinition interfaceDefinition = new InterfaceDefinition(); + interfaceDefinition.setUniqueId(UUID.randomUUID().toString()); + interfaceDefinition.setType("tosca.interfaces.node.lifecycle.Standard"); + final Map<String, OperationDataDefinition> operations = new HashMap<>(); + final OperationDataDefinition operationDataDefinition = new OperationDataDefinition(); + operationDataDefinition.setUniqueId(UUID.randomUUID().toString()); + final ArtifactDataDefinition artifactDataDefinition = new ArtifactDataDefinition(); + + artifactDataDefinition.setArtifactName("EO Implementation info"); + artifactDataDefinition.setArtifactType(artifactType); + PropertyDataDefinition propertyDataDefinition = new PropertyDataDefinition(); + propertyDataDefinition.setName("input_range"); + propertyDataDefinition.setType(inputType); + propertyDataDefinition.setValue("{\"input_range\": \"value2\"}"); + artifactDataDefinition.addProperty(propertyDataDefinition); + + operationDataDefinition.setImplementation(artifactDataDefinition); + operations.put("configure", operationDataDefinition); + interfaceDefinition.setOperations(operations ); + + DataTypeDefinition myType = new DataTypeDefinition(); + final ArtifactTypeDefinition artifactTypeDefinitionFromCache = new ArtifactTypeDefinition(); + artifactTypeDefinitionFromCache.setName(UniqueIdBuilder.buildArtifactTypeUid(null, artifactType)); + myType.setName(inputType); + PropertyDefinition input_range = new PropertyDefinition(); + input_range.setName("input_range"); + input_range.setType("string"); + PropertyConstraint constraint1 = new ValidValuesConstraint(Arrays.asList("value1", "value2", "value3")); + input_range.setConstraints(List.of(constraint1)); + artifactTypeDefinitionFromCache.setProperties(List.of(input_range)); + myType.setProperties(List.of(input_range)); + Map<String, DataTypeDefinition> dataTypes = Collections.singletonMap(myType.getName(), myType); + Wrapper<ResponseFormat> errorWrapper = new Wrapper<>(); + + final ComponentInstanceInterface componentInstanceInterface = + new ComponentInstanceInterface("interfaceId", interfaceDefinition); + Map<String, List<ComponentInstanceInterface>> componentInstancesInterfacesMap = new HashMap<>(); + componentInstancesInterfacesMap.put(componentInstanceId, Collections.singletonList(componentInstanceInterface)); + component.setComponentInstancesInterfaces(componentInstancesInterfacesMap); + componentInstance.setInterfaces( + (Map<String, Object>) new HashMap<>().put(componentInstanceId, interfaceDefinition)); + component.setComponentInstances(Collections.singletonList(componentInstance)); + + when(toscaOperationFacade.getToscaElement(componentId)).thenReturn(Either.left(component)); + when(componentValidations.getComponentInstance(component, componentInstanceId)) + .thenReturn(Optional.of(componentInstance)); + when(toscaOperationFacade.updateComponentInstanceInterfaces(component, componentInstanceId)) + .thenReturn(StorageOperationStatus.OK); + when(toscaOperationFacade + .updateComponentInstanceMetadataOfTopologyTemplate(any(Service.class), any(ComponentParametersView.class))) + .thenReturn(Either.left(component)); + when(applicationDataTypeCache.getAll(null)).thenReturn(Either.left(dataTypes)); + when(artifactTypeBusinessLogic.getArtifactTypeByUid(UniqueIdBuilder.buildArtifactTypeUid( + null, artifactType))).thenReturn(artifactTypeDefinitionFromCache); + + final Optional<ComponentInstance> result = componentInterfaceOperationBusinessLogic + .updateComponentInstanceInterfaceOperation(componentId, componentInstanceId, interfaceDefinition, + ComponentTypeEnum.SERVICE, errorWrapper, false); + assertThat(result).isPresent(); + } + + private void initComponentData() { try { component = new Service(); component.setName("MyTestService"); diff --git a/catalog-be/src/test/java/org/openecomp/sdc/be/servlets/TypesFetchServletTest.java b/catalog-be/src/test/java/org/openecomp/sdc/be/servlets/TypesFetchServletTest.java index 1808560b4e..031377f2e9 100644 --- a/catalog-be/src/test/java/org/openecomp/sdc/be/servlets/TypesFetchServletTest.java +++ b/catalog-be/src/test/java/org/openecomp/sdc/be/servlets/TypesFetchServletTest.java @@ -43,7 +43,7 @@ import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; import org.mockito.Mock; import org.mockito.MockitoAnnotations; -import org.openecomp.sdc.be.components.impl.ArtifactsBusinessLogic; +import org.openecomp.sdc.be.components.impl.ArtifactTypeBusinessLogic; import org.openecomp.sdc.be.components.impl.CapabilitiesBusinessLogic; import org.openecomp.sdc.be.components.impl.ComponentInstanceBusinessLogic; import org.openecomp.sdc.be.components.impl.InterfaceOperationBusinessLogic; @@ -113,7 +113,7 @@ class TypesFetchServletTest extends JerseyTest { @Mock private ResourceBusinessLogic resourceBusinessLogic; @Mock - private ArtifactsBusinessLogic artifactsBusinessLogic; + private ArtifactTypeBusinessLogic artifactTypeBusinessLogic; @Mock private ResponseFormatManager responseFormatManager; @@ -213,7 +213,7 @@ class TypesFetchServletTest extends JerseyTest { bind(relationshipTypeBusinessLogic).to(RelationshipTypeBusinessLogic.class); bind(capabilitiesBusinessLogic).to(CapabilitiesBusinessLogic.class); bind(interfaceOperationBusinessLogic).to(InterfaceOperationBusinessLogic.class); - bind(artifactsBusinessLogic).to(ArtifactsBusinessLogic.class); + bind(artifactTypeBusinessLogic).to(ArtifactTypeBusinessLogic.class); } }) .register(new OperationExceptionMapper( @@ -256,8 +256,8 @@ class TypesFetchServletTest extends JerseyTest { .thenReturn(interfaceOperationBusinessLogic); when(webApplicationContext.getBean(ResourceBusinessLogic.class)) .thenReturn(resourceBusinessLogic); - when(webApplicationContext.getBean(ArtifactsBusinessLogic.class)) - .thenReturn(artifactsBusinessLogic); + when(webApplicationContext.getBean(ArtifactTypeBusinessLogic.class)) + .thenReturn(artifactTypeBusinessLogic); } void initConfig() { |