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