From 6ad41e3ccd398a2721f41ad61c80b7bb03f7d127 Mon Sep 17 00:00:00 2001 From: Ittay Stern Date: Mon, 31 Dec 2018 17:21:27 +0200 Subject: Merge from ECOMP's repository Main Features -------------- - Async-Instantiation jobs mechanism major update; still WIP (package `org.onap.vid.job`) - New features in View/Edit: Activate fabric configuration; show related networks; soft delete - Support AAI service-tree traversal (`AAIServiceTree`) - In-memory cache for SDC models and certain A&AI queries (`CacheProviderWithLoadingCache`) - Upgrade TOSCA Parser and add parsing options; fix malformed TOSCA models - Resolve Cloud-Owner values for MSO - Pass X-ONAP headers to MSO Infrastructure -------------- - Remove codehaus' jackson mapper; use soley fasterxml 2.9.7 - Surefire invokes both TestNG and JUnit tests - Support Kotlin source files - AaiController2 which handles errors in a "Spring manner" - Inline generated-sources and remove jsonschema2pojo Quality -------- - Cumulative bug fixes (A&AI API, UI timeouts, and many more) - Many Sonar issues cleaned-up - Some unused classes removed - Minor changes in vid-automation project, allowing some API verification to run Hard Merges ------------ - HTTP Clients (MSO, A&AI, WebConfig, OutgoingRequestHeadersTest) - Moved `package org.onap.vid.controllers` to `controller`, without plural -- just to keep semantic sync with ECOMP. Reference commit in ECOMP: 3d1141625 Issue-ID: VID-378 Change-Id: I9c8d1e74caa41815891d441fc0760bb5f29c5788 Signed-off-by: Ittay Stern --- .../vid/config/JobCommandsConfigWithMockedMso.java | 207 ++++++++++++++------- 1 file changed, 137 insertions(+), 70 deletions(-) (limited to 'vid-app-common/src/test/java/org/onap/vid/config/JobCommandsConfigWithMockedMso.java') diff --git a/vid-app-common/src/test/java/org/onap/vid/config/JobCommandsConfigWithMockedMso.java b/vid-app-common/src/test/java/org/onap/vid/config/JobCommandsConfigWithMockedMso.java index c1ac6a219..9cb9b33db 100644 --- a/vid-app-common/src/test/java/org/onap/vid/config/JobCommandsConfigWithMockedMso.java +++ b/vid-app-common/src/test/java/org/onap/vid/config/JobCommandsConfigWithMockedMso.java @@ -1,57 +1,27 @@ -/*- - * ============LICENSE_START======================================================= - * VID - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. - * Modifications Copyright (C) 2018 Nokia. All rights reserved. - * ================================================================================ - * 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. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============LICENSE_END========================================================= - */ - package org.onap.vid.config; -import com.fasterxml.jackson.core.JsonProcessingException; -import com.fasterxml.jackson.databind.ObjectMapper; -import java.io.IOException; import org.hibernate.SessionFactory; import org.mockito.Mockito; import org.onap.portalsdk.core.service.DataAccessService; -import org.onap.vid.aai.AaiOverTLSClient; -import org.onap.vid.aai.AaiOverTLSClientInterface; -import org.onap.vid.aai.AaiOverTLSPropertySupplier; +import org.onap.vid.aai.AaiClientInterface; import org.onap.vid.aai.util.HttpsAuthClient; import org.onap.vid.aai.util.SSLContextProvider; +import org.onap.vid.aai.util.ServletRequestHelper; import org.onap.vid.aai.util.SystemPropertyHelper; -import org.onap.vid.client.SyncRestClient; import org.onap.vid.job.JobAdapter; import org.onap.vid.job.JobsBrokerService; -import org.onap.vid.job.command.InProgressStatusCommand; -import org.onap.vid.job.command.JobCommandFactory; -import org.onap.vid.job.command.ServiceInstantiationCommand; +import org.onap.vid.job.command.*; import org.onap.vid.job.impl.JobAdapterImpl; import org.onap.vid.job.impl.JobWorker; import org.onap.vid.job.impl.JobsBrokerServiceInDatabaseImpl; import org.onap.vid.mso.RestMsoImplementation; -import org.onap.vid.services.AsyncInstantiationBusinessLogic; -import org.onap.vid.services.AsyncInstantiationBusinessLogicImpl; -import org.onap.vid.services.AuditService; -import org.onap.vid.services.AuditServiceImpl; +import org.onap.vid.services.*; import org.springframework.beans.factory.config.ConfigurableBeanFactory; import org.springframework.context.ApplicationContext; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; import org.springframework.context.annotation.Scope; +import org.togglz.core.manager.FeatureManager; @Configuration public class JobCommandsConfigWithMockedMso { @@ -67,8 +37,23 @@ public class JobCommandsConfigWithMockedMso { } @Bean - public HttpsAuthClient httpsAuthClientFactory(){ - return new HttpsAuthClient("some random path", new SystemPropertyHelper(), new SSLContextProvider()); + public SSLContextProvider sslContextProvider() { + return new SSLContextProvider(); + } + + @Bean + public SystemPropertyHelper systemPropertyHelper() { + return new SystemPropertyHelper(); + } + + @Bean + public ServletRequestHelper servletRequestHelper() { + return new ServletRequestHelper(); + } + + @Bean + public HttpsAuthClient httpsAuthClientFactory(SystemPropertyHelper systemPropertyHelper, SSLContextProvider sslContextProvider, FeatureManager featureManager){ + return new HttpsAuthClient("some random path", systemPropertyHelper, sslContextProvider, featureManager); } @Bean @@ -90,31 +75,8 @@ public class JobCommandsConfigWithMockedMso { } @Bean - public AaiOverTLSClientInterface AaiOverTLSClient(){ - io.joshworks.restclient.http.mapper.ObjectMapper objectMapper = new io.joshworks.restclient.http.mapper.ObjectMapper() { - - ObjectMapper om = new ObjectMapper(); - - @Override - public T readValue(String s, Class aClass) { - try { - return om.readValue(s, aClass); - } catch (IOException e) { - throw new RuntimeException(e); - } - } - - @Override - public String writeValue(Object o) { - try { - return om.writeValueAsString(o); - } catch (JsonProcessingException e) { - throw new RuntimeException(e); - } - } - }; - - return new AaiOverTLSClient(new SyncRestClient(objectMapper), new AaiOverTLSPropertySupplier()); + public FeatureManager featureManager() { + return Mockito.mock(FeatureManager.class); } @Bean @@ -122,25 +84,130 @@ public class JobCommandsConfigWithMockedMso { JobAdapter jobAdapter, JobsBrokerService jobsBrokerService, SessionFactory sessionFactory, - AaiOverTLSClientInterface aaiOverTLSClientInterface) { - return new AsyncInstantiationBusinessLogicImpl(dataAccessService, jobAdapter, jobsBrokerService, sessionFactory, aaiOverTLSClientInterface); + AaiClientInterface aaiClient, + FeatureManager featureManager, + CloudOwnerService cloudOwnerService) { + return new AsyncInstantiationBusinessLogicImpl(dataAccessService, jobAdapter, jobsBrokerService, sessionFactory, aaiClient, featureManager, cloudOwnerService); + } + + @Bean + @Scope(ConfigurableBeanFactory.SCOPE_PROTOTYPE) + public MacroServiceInstantiationCommand serviceInstantiationCommand() { + return new MacroServiceInstantiationCommand(); + } + + @Bean + @Scope(ConfigurableBeanFactory.SCOPE_PROTOTYPE) + public ServiceInProgressStatusCommand inProgressStatusCommand() { + return new ServiceInProgressStatusCommand(); + } + + @Bean + @Scope(ConfigurableBeanFactory.SCOPE_PROTOTYPE) + public ALaCarteServiceInstantiationCommand aLaCarteServiceInstantiationCommand() { + return new ALaCarteServiceInstantiationCommand(); + } + + @Bean + @Scope(ConfigurableBeanFactory.SCOPE_PROTOTYPE) + public ALaCarteServiceCommand aLaCarteServiceCommand( + AsyncInstantiationBusinessLogic asyncInstantiationBusinessLogic, + JobsBrokerService jobsBrokerService, + MsoResultHandlerService msoResultHandlerService, + JobAdapter jobAdapter, + InProgressStatusService inProgressStatusService, + WatchChildrenJobsBL watchChildrenJobsBL, + RestMsoImplementation restMso) { + return new ALaCarteServiceCommand(inProgressStatusService, watchChildrenJobsBL, asyncInstantiationBusinessLogic, jobsBrokerService, msoResultHandlerService, jobAdapter, restMso); + } + + @Bean + @Scope(ConfigurableBeanFactory.SCOPE_PROTOTYPE) + public InstanceGroupCommand instanceGroupCommand( + AsyncInstantiationBusinessLogic asyncInstantiationBusinessLogic, + MsoResultHandlerService msoResultHandlerService, InProgressStatusService inProgressStatusService, + WatchChildrenJobsBL watchChildrenJobsBL, + RestMsoImplementation restMso) { + return new InstanceGroupCommand(asyncInstantiationBusinessLogic, restMso, msoResultHandlerService, inProgressStatusService, watchChildrenJobsBL); + } + + @Bean + @Scope(ConfigurableBeanFactory.SCOPE_PROTOTYPE) + public VnfInstantiationCommand vnfInstantiationCommand() { + return new VnfInstantiationCommand(); + } + + @Bean + @Scope(ConfigurableBeanFactory.SCOPE_PROTOTYPE) + public VolumeGroupInstantiationCommand volumeGroupInstantiationCommand() { + return new VolumeGroupInstantiationCommand(); } @Bean @Scope(ConfigurableBeanFactory.SCOPE_PROTOTYPE) - public ServiceInstantiationCommand serviceInstantiationCommand() { - return new ServiceInstantiationCommand(); + public WatchingCommandBaseModule watchingCommandBaseModule() { + return new WatchingCommandBaseModule(); } @Bean @Scope(ConfigurableBeanFactory.SCOPE_PROTOTYPE) - public InProgressStatusCommand inProgressStatusCommand() { - return new InProgressStatusCommand(); + public VolumeGroupInProgressStatusCommand volumeGroupInProgressStatusCommand() { + return new VolumeGroupInProgressStatusCommand(); + } + + @Bean + @Scope(ConfigurableBeanFactory.SCOPE_PROTOTYPE) + public VfmoduleInstantiationCommand vfmoduleInstantiationCommand() { + return new VfmoduleInstantiationCommand(); + } + + @Bean + @Scope(ConfigurableBeanFactory.SCOPE_PROTOTYPE) + public WatchingCommand watchingCommandCommand() { + return new WatchingCommand(); + } + + @Bean + @Scope(ConfigurableBeanFactory.SCOPE_PROTOTYPE) + public ResourceInProgressStatusCommand resourceInProgressStatusCommand() { + return new ResourceInProgressStatusCommand(); + } + + @Bean + @Scope(ConfigurableBeanFactory.SCOPE_PROTOTYPE) + public VnfInProgressStatusCommand vnfInProgressStatusCommand() { + return new VnfInProgressStatusCommand(); + } + + @Bean + @Scope(ConfigurableBeanFactory.SCOPE_PROTOTYPE) + public InstanceGroupInstantiationCommand instanceGroupInstantiationCommand() { + return new InstanceGroupInstantiationCommand(); + } + + @Bean + public AuditService auditService(AsyncInstantiationBusinessLogic asyncInstantiationBL, RestMsoImplementation msoClient) { + return new AuditServiceImpl(asyncInstantiationBL, msoClient); + } + + @Bean + public InProgressStatusService inProgressStatusService(AsyncInstantiationBusinessLogic asyncInstantiationBL, RestMsoImplementation restMso, AuditService auditService) { + return new InProgressStatusService(asyncInstantiationBL, restMso, auditService); + } + + @Bean + public MsoResultHandlerService rootCommandService(AsyncInstantiationBusinessLogic asyncInstantiationBL, AuditService auditService) { + return new MsoResultHandlerService(asyncInstantiationBL, auditService); + } + + @Bean + public CommandUtils commandUtils() { + return Mockito.mock(CommandUtils.class); } @Bean - public AuditService auditService() { - return new AuditServiceImpl(); + public WatchChildrenJobsBL watchChildrenJobsService(DataAccessService dataAccessService) { + return new WatchChildrenJobsBL(dataAccessService); } } -- cgit 1.2.3-korg