1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
|
package org.onap.vid.config;
import org.hibernate.SessionFactory;
import org.mockito.Mockito;
import org.onap.portalsdk.core.service.DataAccessService;
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.job.JobAdapter;
import org.onap.vid.job.JobsBrokerService;
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.*;
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 {
@Bean
public RestMsoImplementation restMso() {
return Mockito.mock(RestMsoImplementation.class);
}
@Bean
public JobsBrokerService jobsBrokerService(DataAccessService dataAccessService, SessionFactory sessionFactory) {
return new JobsBrokerServiceInDatabaseImpl(dataAccessService, sessionFactory, 200, 0);
}
@Bean
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
public JobAdapter jobAdapter() {
return new JobAdapterImpl();
}
@Bean
public JobCommandFactory jobCommandFactory(ApplicationContext applicationContext) {
return new JobCommandFactory(applicationContext);
}
@Bean
public JobWorker jobWorker(JobsBrokerService jobsBrokerService, JobCommandFactory jobCommandFactory) {
JobWorker jobWorker = new JobWorker();
jobWorker.setJobsBrokerService(jobsBrokerService);
jobWorker.setJobCommandFactory(jobCommandFactory);
return jobWorker;
}
@Bean
public FeatureManager featureManager() {
return Mockito.mock(FeatureManager.class);
}
@Bean
public AsyncInstantiationBusinessLogic asyncInstantiationBusinessLogic(DataAccessService dataAccessService,
JobAdapter jobAdapter,
JobsBrokerService jobsBrokerService,
SessionFactory sessionFactory,
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 WatchingCommandBaseModule watchingCommandBaseModule() {
return new WatchingCommandBaseModule();
}
@Bean
@Scope(ConfigurableBeanFactory.SCOPE_PROTOTYPE)
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 WatchChildrenJobsBL watchChildrenJobsService(DataAccessService dataAccessService) {
return new WatchChildrenJobsBL(dataAccessService);
}
}
|