2 * ============LICENSE_START=======================================================
3 * Copyright (C) 2021-2022 Nordix Foundation
4 * Modifications Copyright (C) 2021 Pantheon.tech
5 * Modifications Copyright (C) 2021 Bell Canada.
6 * Modifications Copyright (C) 2023 TechMahindra Ltd.
7 * ================================================================================
8 * Licensed under the Apache License, Version 2.0 (the 'License');
9 * you may not use this file except in compliance with the License.
10 * You may obtain a copy of the License at
12 * http://www.apache.org/licenses/LICENSE-2.0
14 * Unless required by applicable law or agreed to in writing, software
15 * distributed under the License is distributed on an 'AS IS' BASIS,
16 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17 * See the License for the specific language governing permissions and
18 * limitations under the License.
20 * SPDX-License-Identifier: Apache-2.0
21 * ============LICENSE_END=========================================================
24 package org.onap.cps.spi.impl
26 import com.fasterxml.jackson.databind.ObjectMapper
27 import org.onap.cps.DatabaseTestContainer
28 import org.onap.cps.spi.repository.AnchorRepository
29 import org.onap.cps.spi.repository.DataspaceRepository
30 import org.onap.cps.spi.repository.FragmentRepository
31 import org.onap.cps.spi.repository.YangResourceRepository
32 import org.onap.cps.utils.JsonObjectMapper
33 import org.spockframework.spring.SpringBean
34 import org.springframework.beans.factory.annotation.Autowired
35 import org.springframework.boot.test.context.SpringBootTest
36 import org.testcontainers.spock.Testcontainers
37 import spock.lang.Shared
38 import spock.lang.Specification
42 class CpsPersistenceSpecBase extends Specification {
45 DatabaseTestContainer databaseTestContainer = DatabaseTestContainer.getInstance()
48 DataspaceRepository dataspaceRepository
51 YangResourceRepository yangResourceRepository
54 AnchorRepository anchorRepository
57 FragmentRepository fragmentRepository
60 JsonObjectMapper jsonObjectMapper = new JsonObjectMapper(new ObjectMapper())
62 protected static final String CLEAR_DATA = '/data/clear-all.sql'
64 static def DATASPACE_NAME = 'DATASPACE-001'
65 static def SCHEMA_SET_NAME1 = 'SCHEMA-SET-001'
66 static def SCHEMA_SET_NAME2 = 'SCHEMA-SET-002'
67 static def ANCHOR_NAME1 = 'ANCHOR-001'
68 static def ANCHOR_NAME2 = 'ANCHOR-002'
69 static def ANCHOR_NAME3 = 'ANCHOR-003'
70 static def ANCHOR_FOR_DATA_NODES_WITH_LEAVES = 'ANCHOR-003'
71 static def ANCHOR_FOR_SHOP_EXAMPLE = 'ANCHOR-004'
72 static def ANCHOR_HAVING_SINGLE_TOP_LEVEL_FRAGMENT = 'ANCHOR-005'
73 static def ANCHOR_WITH_MULTIPLE_TOP_LEVEL_FRAGMENTS = 'ANCHOR-006'