Remove restricted notice from TOSCA file
[vid.git] / vid-app-common / src / test / java / org / onap / vid / config / JobAdapterConfig.java
1 /*-
2  * ============LICENSE_START=======================================================
3  * VID
4  * ================================================================================
5  * Copyright (C) 2017 - 2019 AT&T Intellectual Property. All rights reserved.
6  * ================================================================================
7  * Licensed under the Apache License, Version 2.0 (the "License");
8  * you may not use this file except in compliance with the License.
9  * You may obtain a copy of the License at
10  * 
11  *      http://www.apache.org/licenses/LICENSE-2.0
12  * 
13  * Unless required by applicable law or agreed to in writing, software
14  * distributed under the License is distributed on an "AS IS" BASIS,
15  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16  * See the License for the specific language governing permissions and
17  * limitations under the License.
18  * ============LICENSE_END=========================================================
19  */
20
21 package org.onap.vid.config;
22
23
24 import org.hibernate.SessionFactory;
25 import org.onap.vid.job.JobAdapter;
26 import org.onap.vid.job.JobsBrokerService;
27 import org.onap.vid.job.impl.JobAdapterImpl;
28 import org.onap.vid.job.impl.JobsBrokerServiceInDatabaseImpl;
29 import org.onap.vid.properties.VidProperties;
30 import org.onap.portalsdk.core.service.DataAccessService;
31 import org.onap.portalsdk.core.util.SystemProperties;
32 import org.springframework.context.annotation.Bean;
33 import org.springframework.context.annotation.Configuration;
34 import org.springframework.transaction.annotation.EnableTransactionManagement;
35
36 @Configuration
37 @EnableTransactionManagement
38 public class JobAdapterConfig {
39
40     @Bean
41     public JobAdapter jobAdapter() {
42         return new JobAdapterImpl();
43     }
44
45     @Bean
46     public JobsBrokerService jobsBrokerService(DataAccessService dataAccessService, SessionFactory sessionFactory) {
47         int maxOpenedInstantiationRequestsToMso = Integer.parseInt(SystemProperties.getProperty(VidProperties.MSO_MAX_OPENED_INSTANTIATION_REQUESTS));
48         int pollingIntervalSeconds = Integer.parseInt(SystemProperties.getProperty(VidProperties.MSO_ASYNC_POLLING_INTERVAL_SECONDS));
49
50         return new JobsBrokerServiceInDatabaseImpl(dataAccessService, sessionFactory, maxOpenedInstantiationRequestsToMso, pollingIntervalSeconds);
51     }
52
53 }