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
9 * http://www.apache.org/licenses/LICENSE-2.0
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.
17 * SPDX-License-Identifier: Apache-2.0
18 * ============LICENSE_END=========================================================
21 package org.onap.cps.integration
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.utils.JsonObjectMapper
38 import org.springframework.beans.factory.annotation.Autowired
39 import org.springframework.context.annotation.Bean
40 import org.springframework.context.annotation.Configuration
41 import org.springframework.context.annotation.Lazy
42 import spock.lang.Specification
45 class TestConfig extends Specification{
48 DataspaceRepository dataspaceRepository
52 AnchorRepository anchorRepository
56 SchemaSetRepository schemaSetRepository
60 YangResourceRepository yangResourceRepository
64 FragmentRepository fragmentRepository
68 ModuleReferenceRepository moduleReferenceRepository
72 JsonObjectMapper jsonObjectMapper
76 NotificationService stubbedNotificationService
80 SessionManager stubbedSessionManager
83 CpsAdminPersistenceServiceImpl cpsAdminPersistenceService() {
84 new CpsAdminPersistenceServiceImpl(dataspaceRepository, anchorRepository, schemaSetRepository, yangResourceRepository)
88 CpsDataPersistenceService cpsDataPersistenceService() {
89 return (CpsDataPersistenceService) new CpsDataPersistenceServiceImpl(dataspaceRepository, anchorRepository, fragmentRepository, jsonObjectMapper, stubbedSessionManager)
93 CpsModulePersistenceService cpsModulePersistenceService() {
94 return (CpsModulePersistenceService) new CpsModulePersistenceServiceImpl(yangResourceRepository, schemaSetRepository, dataspaceRepository, cpsAdminPersistenceService(), moduleReferenceRepository)
98 JsonObjectMapper jsonObjectMapper() {
99 return new JsonObjectMapper(new ObjectMapper())
103 NotificationService notificationService() {
104 return Stub(NotificationService)
108 SessionManager sessionManager() {
109 return Stub(SessionManager)