diff options
Diffstat (limited to 'catalog-be/src/test/java/org/openecomp/sdc/be/servlets/TypesUploadEndpointTest.java')
-rw-r--r-- | catalog-be/src/test/java/org/openecomp/sdc/be/servlets/TypesUploadEndpointTest.java | 59 |
1 files changed, 31 insertions, 28 deletions
diff --git a/catalog-be/src/test/java/org/openecomp/sdc/be/servlets/TypesUploadEndpointTest.java b/catalog-be/src/test/java/org/openecomp/sdc/be/servlets/TypesUploadEndpointTest.java index c948910a67..72af772507 100644 --- a/catalog-be/src/test/java/org/openecomp/sdc/be/servlets/TypesUploadEndpointTest.java +++ b/catalog-be/src/test/java/org/openecomp/sdc/be/servlets/TypesUploadEndpointTest.java @@ -67,6 +67,7 @@ import org.openecomp.sdc.be.model.AnnotationTypeDefinition; import org.openecomp.sdc.be.model.operations.StorageException; import org.openecomp.sdc.be.model.operations.impl.AnnotationTypeOperations; import org.openecomp.sdc.be.model.operations.impl.CommonTypeOperations; +import org.openecomp.sdc.be.model.operations.impl.ModelOperation; import org.openecomp.sdc.be.model.operations.impl.OperationUtils; import org.openecomp.sdc.be.model.operations.impl.PropertyOperation; import org.openecomp.sdc.be.resources.data.AnnotationTypeData; @@ -84,40 +85,14 @@ class TypesUploadEndpointTest extends JerseySpringBaseTest { private static PropertyOperation propertyOperation; private static ComponentsUtils componentUtils; private static OperationUtils operationUtils; - - @org.springframework.context.annotation.Configuration - @Import(BaseTestConfig.class) - static class TypesUploadTestConfig { - - @Bean - TypesUploadEndpoint typesUploadEndpoint() { - UserBusinessLogic userBusinessLogic = mock(UserBusinessLogic.class); - ComponentsUtils componentsUtils = mock(ComponentsUtils.class); - return new TypesUploadEndpoint(userBusinessLogic, componentsUtils, commonImportManager(), - annotationTypeOperations(), accessValidations); - } - - @Bean - CommonImportManager commonImportManager() { - return new CommonImportManager(componentUtils, propertyOperation); - } - - @Bean - AnnotationTypeOperations annotationTypeOperations() { - return new AnnotationTypeOperations(commonTypeOperations()); - } - - @Bean - CommonTypeOperations commonTypeOperations() { - return new CommonTypeOperations(janusGraphGenericDao, propertyOperation, operationUtils); - } - } + private static ModelOperation modelOperation; @BeforeAll public static void initClass() { janusGraphGenericDao = mock(HealingJanusGraphGenericDao.class); accessValidations = mock(AccessValidations.class); propertyOperation = mock(PropertyOperation.class); + modelOperation = mock(ModelOperation.class); componentUtils = Mockito.mock(ComponentsUtils.class); operationUtils = Mockito.mock(OperationUtils.class); } @@ -258,4 +233,32 @@ class TypesUploadEndpointTest extends JerseySpringBaseTest { typeActionResults.add(new ImmutablePair(dummyDefition, null)); assertThat(TypesUploadEndpoint.getHttpStatus(typeActionResults).value()).isEqualTo(HttpStatus.BAD_REQUEST_400); } + + @org.springframework.context.annotation.Configuration + @Import(BaseTestConfig.class) + static class TypesUploadTestConfig { + + @Bean + TypesUploadEndpoint typesUploadEndpoint() { + UserBusinessLogic userBusinessLogic = mock(UserBusinessLogic.class); + ComponentsUtils componentsUtils = mock(ComponentsUtils.class); + return new TypesUploadEndpoint(userBusinessLogic, componentsUtils, commonImportManager(), + annotationTypeOperations(), accessValidations); + } + + @Bean + CommonImportManager commonImportManager() { + return new CommonImportManager(componentUtils, propertyOperation, modelOperation); + } + + @Bean + AnnotationTypeOperations annotationTypeOperations() { + return new AnnotationTypeOperations(commonTypeOperations()); + } + + @Bean + CommonTypeOperations commonTypeOperations() { + return new CommonTypeOperations(janusGraphGenericDao, propertyOperation, operationUtils); + } + } } |