1 package org.onap.vid.config;
3 import org.hibernate.SessionFactory;
4 import org.mockito.Mockito;
5 import org.onap.vid.aai.AaiClientInterface;
6 import org.onap.vid.aai.util.HttpsAuthClient;
7 import org.onap.vid.job.JobAdapter;
8 import org.onap.vid.job.JobsBrokerService;
9 import org.onap.vid.job.command.InProgressStatusCommand;
10 import org.onap.vid.job.command.JobCommandFactory;
11 import org.onap.vid.job.command.ServiceInstantiationCommand;
12 import org.onap.vid.job.impl.JobAdapterImpl;
13 import org.onap.vid.job.impl.JobWorker;
14 import org.onap.vid.job.impl.JobsBrokerServiceInDatabaseImpl;
15 import org.onap.vid.mso.RestMsoImplementation;
16 import org.onap.vid.services.AsyncInstantiationBusinessLogic;
17 import org.onap.vid.services.AsyncInstantiationBusinessLogicImpl;
18 import org.onap.vid.services.AuditService;
19 import org.onap.vid.services.AuditServiceImpl;
20 import org.onap.portalsdk.core.service.DataAccessService;
21 import org.springframework.beans.factory.config.ConfigurableBeanFactory;
22 import org.springframework.context.ApplicationContext;
23 import org.springframework.context.annotation.Bean;
24 import org.springframework.context.annotation.Configuration;
25 import org.springframework.context.annotation.Scope;
26 import org.togglz.core.manager.FeatureManager;
29 public class JobCommandsConfigWithMockedMso {
32 public RestMsoImplementation restMso() {
33 return Mockito.mock(RestMsoImplementation.class);
37 public JobsBrokerService jobsBrokerService(DataAccessService dataAccessService, SessionFactory sessionFactory) {
38 return new JobsBrokerServiceInDatabaseImpl(dataAccessService, sessionFactory, 200, 0);
42 public HttpsAuthClient httpsAuthClientFactory(){
43 return new HttpsAuthClient("some random path");
47 public JobAdapter jobAdapter() {
48 return new JobAdapterImpl();
52 public JobCommandFactory jobCommandFactory(ApplicationContext applicationContext) {
53 return new JobCommandFactory(applicationContext);
57 public JobWorker jobWorker(JobsBrokerService jobsBrokerService, JobCommandFactory jobCommandFactory) {
58 JobWorker jobWorker = new JobWorker();
59 jobWorker.setJobsBrokerService(jobsBrokerService);
60 jobWorker.setJobCommandFactory(jobCommandFactory);
65 public AsyncInstantiationBusinessLogic asyncInstantiationBusinessLogic(DataAccessService dataAccessService,
66 JobAdapter jobAdapter,
67 JobsBrokerService jobsBrokerService,
68 SessionFactory sessionFactory,
69 AaiClientInterface aaiClient) {
70 return new AsyncInstantiationBusinessLogicImpl(dataAccessService, jobAdapter, jobsBrokerService, sessionFactory, aaiClient);
74 @Scope(ConfigurableBeanFactory.SCOPE_PROTOTYPE)
75 public ServiceInstantiationCommand serviceInstantiationCommand() {
76 return new ServiceInstantiationCommand();
80 @Scope(ConfigurableBeanFactory.SCOPE_PROTOTYPE)
81 public InProgressStatusCommand inProgressStatusCommand() {
82 return new InProgressStatusCommand();
86 public AuditService auditService() {
87 return new AuditServiceImpl();