X-Git-Url: https://gerrit.onap.org/r/gitweb?a=blobdiff_plain;f=ONAP-SDK-APP%2Fsrc%2Ftest%2Fjava%2Forg%2Fonap%2Fportalapp%2Fconf%2FExternalAppConfigTest.java;fp=ONAP-SDK-APP%2Fsrc%2Ftest%2Fjava%2Forg%2Fonap%2Fportalapp%2Fconf%2FExternalAppConfigTest.java;h=fb11e246ce801dd0ff504c752192f43366932b6a;hb=a1a71e8e4a02976839f4a1fb9f0c9813d60b9a0b;hp=133d4a8601e9dc0366095a79325d8b2531eb2297;hpb=939cf950022f89aec547d3a6a9f6b9443b7a8a95;p=policy%2Fengine.git diff --git a/ONAP-SDK-APP/src/test/java/org/onap/portalapp/conf/ExternalAppConfigTest.java b/ONAP-SDK-APP/src/test/java/org/onap/portalapp/conf/ExternalAppConfigTest.java index 133d4a860..fb11e246c 100644 --- a/ONAP-SDK-APP/src/test/java/org/onap/portalapp/conf/ExternalAppConfigTest.java +++ b/ONAP-SDK-APP/src/test/java/org/onap/portalapp/conf/ExternalAppConfigTest.java @@ -1,15 +1,17 @@ /*- * ============LICENSE_START======================================================= - * ONAP Policy Engine + * ONAP Portal SDK * ================================================================================ * Copyright (C) 2018 AT&T Intellectual Property. All rights reserved. * ================================================================================ + * Modifications Copyright (C) 2019 Samsung + * ================================================================================ * 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. @@ -36,37 +38,36 @@ import org.springframework.web.servlet.config.annotation.InterceptorRegistry; import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry; public class ExternalAppConfigTest { - @Test - public void testConfig() throws MalformedURLException { - // Setup test data - ApplicationContext ctx = Mockito.mock(ApplicationContext.class); - UrlResource value = new UrlResource("http://localhost"); - Mockito.when(ctx.getResource(Mockito.any())).thenReturn(value); - ResourceHandlerRegistry registry = new ResourceHandlerRegistry(ctx, null); - InterceptorRegistry interceptor = new InterceptorRegistry(); - RegistryAdapter schedulerRegistryAdapter = new RegistryAdapter(); - Registerable reg = Mockito.mock(Registerable.class); - Mockito.when(reg.getTriggers()).thenReturn(new Trigger[1]); - schedulerRegistryAdapter.setRegistry(reg); - WorkflowScheduleService workflowScheduleService = Mockito.mock(WorkflowScheduleService.class); - schedulerRegistryAdapter.setWorkflowScheduleService(workflowScheduleService); - Mockito.when(workflowScheduleService.triggerWorkflowScheduling()) - .thenReturn(Collections.emptyList()); + @Test + public void testConfig() throws MalformedURLException { + // Setup test data + ApplicationContext ctx = Mockito.mock(ApplicationContext.class); + UrlResource value = new UrlResource("http://localhost"); + Mockito.when(ctx.getResource(Mockito.any())).thenReturn(value); + ResourceHandlerRegistry registry = new ResourceHandlerRegistry(ctx, null); + InterceptorRegistry interceptor = new InterceptorRegistry(); + RegistryAdapter schedulerRegistryAdapter = new RegistryAdapter(); + Registerable reg = Mockito.mock(Registerable.class); + Mockito.when(reg.getTriggers()).thenReturn(new Trigger[1]); + schedulerRegistryAdapter.setRegistry(reg); + WorkflowScheduleService workflowScheduleService = Mockito.mock(WorkflowScheduleService.class); + schedulerRegistryAdapter.setWorkflowScheduleService(workflowScheduleService); + Mockito.when(workflowScheduleService.triggerWorkflowScheduling()).thenReturn(Collections.emptyList()); - // Test constructor - ExternalAppConfig config = new ExternalAppConfig(); - assertNotNull(config); + // Test constructor + ExternalAppConfig config = new ExternalAppConfig(); + assertNotNull(config); - // Test set and get - config.setApplicationContext(ctx); - assertNotNull(config.viewResolver()); - config.addResourceHandlers(registry); - assertNotNull(config.dataAccessService()); - assertNotNull(config.addTileDefinitions()); - config.addInterceptors(interceptor); - assertNotNull(config.cacheManager()); - config.setSchedulerRegistryAdapter(schedulerRegistryAdapter); - assertNull(config.schedulerFactoryBean()); - assertNotNull(config.loginStrategy()); - } + // Test set and get + config.setApplicationContext(ctx); + assertNotNull(config.viewResolver()); + config.addResourceHandlers(registry); + assertNotNull(config.dataAccessService()); + assertNotNull(config.addTileDefinitions()); + config.addInterceptors(interceptor); + assertNotNull(config.cacheManager()); + config.setSchedulerRegistryAdapter(schedulerRegistryAdapter); + assertNull(config.schedulerFactoryBean()); + assertNotNull(config.loginStrategy()); + } }