1 package org.onap.vid.config;
3 import org.hibernate.SessionFactory;
4 import org.mockito.Mockito;
5 import org.onap.portalsdk.core.service.DataAccessService;
6 import org.onap.vid.aai.AaiClientInterface;
7 import org.onap.vid.aai.util.HttpsAuthClient;
8 import org.onap.vid.aai.util.SSLContextProvider;
9 import org.onap.vid.aai.util.ServletRequestHelper;
10 import org.onap.vid.aai.util.SystemPropertyHelper;
11 import org.onap.vid.job.JobAdapter;
12 import org.onap.vid.job.JobsBrokerService;
13 import org.onap.vid.job.command.*;
14 import org.onap.vid.job.impl.JobAdapterImpl;
15 import org.onap.vid.job.impl.JobWorker;
16 import org.onap.vid.job.impl.JobsBrokerServiceInDatabaseImpl;
17 import org.onap.vid.mso.RestMsoImplementation;
18 import org.onap.vid.services.*;
19 import org.springframework.beans.factory.config.ConfigurableBeanFactory;
20 import org.springframework.context.ApplicationContext;
21 import org.springframework.context.annotation.Bean;
22 import org.springframework.context.annotation.Configuration;
23 import org.springframework.context.annotation.Scope;
24 import org.togglz.core.manager.FeatureManager;
27 public class JobCommandsConfigWithMockedMso {
30 public RestMsoImplementation restMso() {
31 return Mockito.mock(RestMsoImplementation.class);
35 public JobsBrokerService jobsBrokerService(DataAccessService dataAccessService, SessionFactory sessionFactory) {
36 return new JobsBrokerServiceInDatabaseImpl(dataAccessService, sessionFactory, 200, 0);
40 public SSLContextProvider sslContextProvider() {
41 return new SSLContextProvider();
45 public SystemPropertyHelper systemPropertyHelper() {
46 return new SystemPropertyHelper();
50 public ServletRequestHelper servletRequestHelper() {
51 return new ServletRequestHelper();
55 public HttpsAuthClient httpsAuthClientFactory(SystemPropertyHelper systemPropertyHelper, SSLContextProvider sslContextProvider, FeatureManager featureManager){
56 return new HttpsAuthClient("some random path", systemPropertyHelper, sslContextProvider, featureManager);
60 public JobAdapter jobAdapter() {
61 return new JobAdapterImpl();
65 public JobCommandFactory jobCommandFactory(ApplicationContext applicationContext) {
66 return new JobCommandFactory(applicationContext);
70 public JobWorker jobWorker(JobsBrokerService jobsBrokerService, JobCommandFactory jobCommandFactory) {
71 JobWorker jobWorker = new JobWorker();
72 jobWorker.setJobsBrokerService(jobsBrokerService);
73 jobWorker.setJobCommandFactory(jobCommandFactory);
78 public FeatureManager featureManager() {
79 return Mockito.mock(FeatureManager.class);
83 public AsyncInstantiationBusinessLogic asyncInstantiationBusinessLogic(DataAccessService dataAccessService,
84 JobAdapter jobAdapter,
85 JobsBrokerService jobsBrokerService,
86 SessionFactory sessionFactory,
87 AaiClientInterface aaiClient,
88 FeatureManager featureManager,
89 CloudOwnerService cloudOwnerService) {
90 return new AsyncInstantiationBusinessLogicImpl(dataAccessService, jobAdapter, jobsBrokerService, sessionFactory, aaiClient, featureManager, cloudOwnerService);
94 @Scope(ConfigurableBeanFactory.SCOPE_PROTOTYPE)
95 public MacroServiceInstantiationCommand serviceInstantiationCommand() {
96 return new MacroServiceInstantiationCommand();
100 @Scope(ConfigurableBeanFactory.SCOPE_PROTOTYPE)
101 public ServiceInProgressStatusCommand inProgressStatusCommand() {
102 return new ServiceInProgressStatusCommand();
106 @Scope(ConfigurableBeanFactory.SCOPE_PROTOTYPE)
107 public ALaCarteServiceInstantiationCommand aLaCarteServiceInstantiationCommand() {
108 return new ALaCarteServiceInstantiationCommand();
112 @Scope(ConfigurableBeanFactory.SCOPE_PROTOTYPE)
113 public ALaCarteServiceCommand aLaCarteServiceCommand(
114 AsyncInstantiationBusinessLogic asyncInstantiationBusinessLogic,
115 JobsBrokerService jobsBrokerService,
116 MsoResultHandlerService msoResultHandlerService,
117 JobAdapter jobAdapter,
118 InProgressStatusService inProgressStatusService,
119 WatchChildrenJobsBL watchChildrenJobsBL,
120 RestMsoImplementation restMso) {
121 return new ALaCarteServiceCommand(inProgressStatusService, watchChildrenJobsBL, asyncInstantiationBusinessLogic, jobsBrokerService, msoResultHandlerService, jobAdapter, restMso);
125 @Scope(ConfigurableBeanFactory.SCOPE_PROTOTYPE)
126 public InstanceGroupCommand instanceGroupCommand(
127 AsyncInstantiationBusinessLogic asyncInstantiationBusinessLogic,
128 MsoResultHandlerService msoResultHandlerService, InProgressStatusService inProgressStatusService,
129 WatchChildrenJobsBL watchChildrenJobsBL,
130 RestMsoImplementation restMso) {
131 return new InstanceGroupCommand(asyncInstantiationBusinessLogic, restMso, msoResultHandlerService, inProgressStatusService, watchChildrenJobsBL);
135 @Scope(ConfigurableBeanFactory.SCOPE_PROTOTYPE)
136 public VnfInstantiationCommand vnfInstantiationCommand() {
137 return new VnfInstantiationCommand();
141 @Scope(ConfigurableBeanFactory.SCOPE_PROTOTYPE)
142 public VolumeGroupInstantiationCommand volumeGroupInstantiationCommand() {
143 return new VolumeGroupInstantiationCommand();
147 @Scope(ConfigurableBeanFactory.SCOPE_PROTOTYPE)
148 public WatchingCommandBaseModule watchingCommandBaseModule() {
149 return new WatchingCommandBaseModule();
153 @Scope(ConfigurableBeanFactory.SCOPE_PROTOTYPE)
154 public VolumeGroupInProgressStatusCommand volumeGroupInProgressStatusCommand() {
155 return new VolumeGroupInProgressStatusCommand();
159 @Scope(ConfigurableBeanFactory.SCOPE_PROTOTYPE)
160 public VfmoduleInstantiationCommand vfmoduleInstantiationCommand() {
161 return new VfmoduleInstantiationCommand();
165 @Scope(ConfigurableBeanFactory.SCOPE_PROTOTYPE)
166 public WatchingCommand watchingCommandCommand() {
167 return new WatchingCommand();
171 @Scope(ConfigurableBeanFactory.SCOPE_PROTOTYPE)
172 public ResourceInProgressStatusCommand resourceInProgressStatusCommand() {
173 return new ResourceInProgressStatusCommand();
177 @Scope(ConfigurableBeanFactory.SCOPE_PROTOTYPE)
178 public VnfInProgressStatusCommand vnfInProgressStatusCommand() {
179 return new VnfInProgressStatusCommand();
183 @Scope(ConfigurableBeanFactory.SCOPE_PROTOTYPE)
184 public InstanceGroupInstantiationCommand instanceGroupInstantiationCommand() {
185 return new InstanceGroupInstantiationCommand();
189 public AuditService auditService(AsyncInstantiationBusinessLogic asyncInstantiationBL, RestMsoImplementation msoClient) {
190 return new AuditServiceImpl(asyncInstantiationBL, msoClient);
194 public InProgressStatusService inProgressStatusService(AsyncInstantiationBusinessLogic asyncInstantiationBL, RestMsoImplementation restMso, AuditService auditService) {
195 return new InProgressStatusService(asyncInstantiationBL, restMso, auditService);
199 public MsoResultHandlerService rootCommandService(AsyncInstantiationBusinessLogic asyncInstantiationBL, AuditService auditService) {
200 return new MsoResultHandlerService(asyncInstantiationBL, auditService);
204 public CommandUtils commandUtils() {
205 return Mockito.mock(CommandUtils.class);
209 public WatchChildrenJobsBL watchChildrenJobsService(DataAccessService dataAccessService) {
210 return new WatchChildrenJobsBL(dataAccessService);