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.ncmp.api.impl.utils
23 import static org.onap.cps.ncmp.api.impl.ncmppersistence.NcmpPersistence.NCMP_DATASPACE_NAME
25 import org.onap.cps.spi.model.DataNodeBuilder
26 import spock.lang.Specification
28 class DataNodeBaseSpec extends Specification {
30 def leaves1 = [status:'PENDING', cmHandleId:'CMHandle3', details:'Subscription forwarded to dmi plugin'] as Map
31 def dataNode1 = createDataNodeWithLeaves(leaves1)
33 def leaves2 = [status:'ACCEPTED', cmHandleId:'CMHandle2', details:''] as Map
34 def dataNode2 = createDataNodeWithLeaves(leaves2)
36 def leaves3 = [status:'REJECTED', cmHandleId:'CMHandle1', details:'Cm handle does not exist'] as Map
37 def dataNode3 = createDataNodeWithLeaves(leaves3)
39 def leaves4 = [datastore:'passthrough-running'] as Map
40 def dataNode4 = createDataNodeWithLeavesAndChildDataNodes(leaves4, [dataNode1, dataNode2, dataNode3])
42 static def createDataNodeWithLeaves(leaves) {
43 return new DataNodeBuilder().withDataspace(NCMP_DATASPACE_NAME)
44 .withAnchor('AVC-Subscriptions').withXpath('/subscription-registry/subscription')
45 .withLeaves(leaves).build()
48 static def createDataNodeWithLeavesAndChildDataNodes(leaves, dataNodes) {
49 return new DataNodeBuilder().withDataspace(NCMP_DATASPACE_NAME)
50 .withAnchor('AVC-Subscriptions').withXpath('/subscription-registry/subscription')
51 .withLeaves(leaves).withChildDataNodes(dataNodes)