Expose REST endpoint to update YANG schema set using moduleSetTag
[cps.git] / integration-test / src / test / groovy / org / onap / cps / integration / base / TestConfig.groovy
1 /*
2  *  ============LICENSE_START=======================================================
3  *  Copyright (C) 2023 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.notification.NotificationService
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.TimedYangParser
40 import org.onap.cps.yang.TimedYangTextSchemaSourceSetBuilder
41 import org.springframework.beans.factory.annotation.Autowired
42 import org.springframework.context.annotation.Bean
43 import org.springframework.context.annotation.Configuration
44 import org.springframework.context.annotation.Lazy
45 import spock.lang.Specification
46
47 @Configuration
48 class TestConfig extends Specification{
49     @Autowired
50     @Lazy
51     DataspaceRepository dataspaceRepository
52
53     @Autowired
54     @Lazy
55     AnchorRepository anchorRepository
56
57     @Autowired
58     @Lazy
59     SchemaSetRepository schemaSetRepository
60
61     @Autowired
62     @Lazy
63     YangResourceRepository yangResourceRepository
64
65     @Autowired
66     @Lazy
67     FragmentRepository fragmentRepository
68
69     @Autowired
70     @Lazy
71     ModuleReferenceRepository moduleReferenceRepository
72
73     @Autowired
74     @Lazy
75     JsonObjectMapper jsonObjectMapper
76
77     @Autowired
78     @Lazy
79     SessionManager sessionManager
80
81     @Bean
82     CpsAdminPersistenceServiceImpl cpsAdminPersistenceService() {
83         new CpsAdminPersistenceServiceImpl(dataspaceRepository, anchorRepository, schemaSetRepository, yangResourceRepository)
84     }
85
86     @Bean
87     CpsDataPersistenceService cpsDataPersistenceService() {
88         return (CpsDataPersistenceService) new CpsDataPersistenceServiceImpl(dataspaceRepository, anchorRepository, fragmentRepository, jsonObjectMapper, sessionManager)
89     }
90
91     @Bean
92     CpsModulePersistenceService cpsModulePersistenceService() {
93         return (CpsModulePersistenceService) new CpsModulePersistenceServiceImpl(yangResourceRepository, schemaSetRepository, dataspaceRepository, moduleReferenceRepository)
94     }
95
96     @Bean
97     JsonObjectMapper jsonObjectMapper() {
98         return new JsonObjectMapper(new ObjectMapper())
99     }
100
101     @Bean
102     NotificationService notificationService() {
103         return Stub(NotificationService)
104     }
105
106     @Bean
107     TimedYangParser timedYangParser() {
108         return new TimedYangParser()
109     }
110
111     @Bean
112     TimedYangTextSchemaSourceSetBuilder textSchemaSourceSetBuilder() {
113         return new TimedYangTextSchemaSourceSetBuilder()
114     }
115
116     @Bean
117     TimeLimiterProvider timeLimiterProvider() {
118         return new TimeLimiterProvider()
119     }
120
121 }