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.performance.cps
23 import java.time.OffsetDateTime
24 import org.onap.cps.integration.performance.base.CpsPerfTestBase
25 import org.springframework.dao.DataAccessResourceFailureException
26 import org.springframework.transaction.TransactionSystemException
28 import static org.onap.cps.spi.FetchDescendantsOption.INCLUDE_ALL_DESCENDANTS
30 class CpsDataServiceLimits extends CpsPerfTestBase {
34 def setup() { objectUnderTest = cpsDataService }
36 def 'Multiple get limit exceeded: 32,764 (~ 2^15) xpaths.'() {
37 given: 'more than 32,764 xpaths'
38 def xpaths = (0..32_764).collect { "/size/of/this/path/does/not/matter/for/limit[@id='" + it + "']" }
39 when: 'single operation is executed to get all datanodes with given xpaths'
40 objectUnderTest.getDataNodesForMultipleXpaths(CPS_PERFORMANCE_TEST_DATASPACE, 'bookstore1', xpaths, INCLUDE_ALL_DESCENDANTS)
41 then: 'a database exception is thrown'
42 thrown(DataAccessResourceFailureException.class)
45 def 'Delete multiple datanodes limit exceeded: 32,767 (~ 2^15) xpaths.'() {
46 given: 'more than 32,767 xpaths'
47 def xpaths = (0..32_767).collect { "/size/of/this/path/does/not/matter/for/limit[@id='" + it + "']" }
48 when: 'single operation is executed to delete all datanodes with given xpaths'
49 objectUnderTest.deleteDataNodes(CPS_PERFORMANCE_TEST_DATASPACE, 'bookstore1', xpaths, OffsetDateTime.now())
50 then: 'a database exception is thrown'
51 thrown(TransactionSystemException.class)
54 def 'Delete datanodes from multiple anchors limit exceeded: 32,766 (~ 2^15) anchors.'() {
55 given: 'more than 32,766 anchor names'
56 def anchorNames = (0..32_766).collect { "size-of-this-name-does-not-matter-for-limit-" + it }
57 when: 'single operation is executed to delete all datanodes in given anchors'
58 objectUnderTest.deleteDataNodes(CPS_PERFORMANCE_TEST_DATASPACE, anchorNames, OffsetDateTime.now())
59 then: 'a database exception is thrown'
60 thrown(DataAccessResourceFailureException.class)