Merge "CPS Delta API: Update action for delta service"
[cps.git] / integration-test / src / test / groovy / org / onap / cps / integration / base / TestConfig.groovy
1 /*
2  *  ============LICENSE_START=======================================================
3  *  Copyright (C) 2023-2024 Nordix Foundation
4  *  ================================================================================
5  *  Licensed under the Apache License, Version 2.0 (the 'License');
6  *  you may not use this file except in compliance with the License.
7  *  You may obtain a copy of the License at
8  *
9  *        http://www.apache.org/licenses/LICENSE-2.0
10  *
11  *  Unless required by applicable law or agreed to in writing, software
12  *  distributed under the License is distributed on an 'AS IS' BASIS,
13  *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14  *  See the License for the specific language governing permissions and
15  *  limitations under the License.
16  *
17  *  SPDX-License-Identifier: Apache-2.0
18  *  ============LICENSE_END=========================================================
19  */
20
21 package org.onap.cps.integration.base
22
23 import com.fasterxml.jackson.databind.ObjectMapper
24 import org.onap.cps.api.impl.YangTextSchemaSourceSetCache
25 import org.onap.cps.spi.CpsDataPersistenceService
26 import org.onap.cps.spi.CpsModulePersistenceService
27 import org.onap.cps.spi.impl.CpsAdminPersistenceServiceImpl
28 import org.onap.cps.spi.impl.CpsDataPersistenceServiceImpl
29 import org.onap.cps.spi.impl.CpsModulePersistenceServiceImpl
30 import org.onap.cps.spi.repository.AnchorRepository
31 import org.onap.cps.spi.repository.DataspaceRepository
32 import org.onap.cps.spi.repository.FragmentRepository
33 import org.onap.cps.spi.repository.ModuleReferenceRepository
34 import org.onap.cps.spi.repository.SchemaSetRepository
35 import org.onap.cps.spi.repository.YangResourceRepository
36 import org.onap.cps.spi.utils.SessionManager
37 import org.onap.cps.spi.utils.TimeLimiterProvider
38 import org.onap.cps.utils.JsonObjectMapper
39 import org.onap.cps.utils.YangParser
40 import org.onap.cps.utils.YangParserHelper
41 import org.onap.cps.yang.TimedYangTextSchemaSourceSetBuilder
42 import org.springframework.beans.factory.annotation.Autowired
43 import org.springframework.context.annotation.Bean
44 import org.springframework.context.annotation.Configuration
45 import org.springframework.context.annotation.Lazy
46 import spock.lang.Specification
47
48 @Configuration
49 class TestConfig extends Specification{
50     @Autowired
51     @Lazy
52     DataspaceRepository dataspaceRepository
53
54     @Autowired
55     @Lazy
56     AnchorRepository anchorRepository
57
58     @Autowired
59     @Lazy
60     SchemaSetRepository schemaSetRepository
61
62     @Autowired
63     @Lazy
64     YangResourceRepository yangResourceRepository
65
66     @Autowired
67     @Lazy
68     FragmentRepository fragmentRepository
69
70     @Autowired
71     @Lazy
72     ModuleReferenceRepository moduleReferenceRepository
73
74     @Autowired
75     @Lazy
76     JsonObjectMapper jsonObjectMapper
77
78     @Autowired
79     @Lazy
80     SessionManager sessionManager
81
82     @Autowired
83     @Lazy
84     YangParserHelper yangParserHelper
85
86     @Autowired
87     @Lazy
88     YangTextSchemaSourceSetCache YangTextSchemaSourceSetCache
89
90
91     @Bean
92     CpsAdminPersistenceServiceImpl cpsAdminPersistenceService() {
93         new CpsAdminPersistenceServiceImpl(dataspaceRepository, anchorRepository, schemaSetRepository, yangResourceRepository)
94     }
95
96     @Bean
97     CpsDataPersistenceService cpsDataPersistenceService() {
98         return (CpsDataPersistenceService) new CpsDataPersistenceServiceImpl(dataspaceRepository, anchorRepository, fragmentRepository, jsonObjectMapper, sessionManager)
99     }
100
101     @Bean
102     CpsModulePersistenceService cpsModulePersistenceService() {
103         return (CpsModulePersistenceService) new CpsModulePersistenceServiceImpl(yangResourceRepository, schemaSetRepository, dataspaceRepository, moduleReferenceRepository)
104     }
105
106     @Bean
107     JsonObjectMapper jsonObjectMapper() {
108         return new JsonObjectMapper(new ObjectMapper())
109     }
110
111     @Bean
112     YangParserHelper yangParserHelper() {
113         return new YangParserHelper()
114     }
115
116     @Bean
117     YangParser yangParser() {
118         return new YangParser(yangParserHelper, yangTextSchemaSourceSetCache)
119     }
120
121     @Bean
122     TimedYangTextSchemaSourceSetBuilder textSchemaSourceSetBuilder() {
123         return new TimedYangTextSchemaSourceSetBuilder()
124     }
125
126     @Bean
127     TimeLimiterProvider timeLimiterProvider() {
128         return new TimeLimiterProvider()
129     }
130
131 }