Extend capability of distributed cache
[cps.git] / integration-test / src / test / groovy / org / onap / cps / integration / performance / cps / CpsAdminServiceLimits.groovy
1 /*
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
8  *
9  *        http://www.apache.org/licenses/LICENSE-2.0
10  *
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.
16  *
17  *  SPDX-License-Identifier: Apache-2.0
18  *  ============LICENSE_END=========================================================
19  */
20
21 package org.onap.cps.integration.performance.cps
22
23 import org.onap.cps.api.CpsAdminService
24 import org.onap.cps.integration.performance.base.CpsPerfTestBase
25 import org.springframework.dao.DataAccessResourceFailureException
26
27 class CpsAdminServiceLimits extends CpsPerfTestBase {
28
29     CpsAdminService objectUnderTest
30
31     def setup() { objectUnderTest = cpsAdminService }
32
33     def 'Get anchors from multiple schema set names limit exceeded: 32,766 (~ 2^15) schema set names.'() {
34         given: 'more than 32,766 schema set names'
35             def schemaSetNames = (0..32_766).collect { "size-of-this-name-does-not-matter-for-limit-" + it }
36         when: 'single get is executed to get all the anchors'
37             objectUnderTest.getAnchors(CPS_PERFORMANCE_TEST_DATASPACE, schemaSetNames)
38         then: 'a database exception is thrown'
39             thrown(DataAccessResourceFailureException.class)
40     }
41
42     def 'Querying anchor names limit exceeded: 32,766 (~ 2^15) modules.'() {
43         given: 'more than 32,766 module names'
44             def moduleNames = (0..32_766).collect { "size-of-this-name-does-not-matter-for-limit-" + it }
45         when: 'single query is executed to get all the anchors'
46             objectUnderTest.queryAnchorNames(CPS_PERFORMANCE_TEST_DATASPACE, moduleNames)
47         then: 'a database exception is thrown'
48             thrown(DataAccessResourceFailureException.class)
49     }
50
51 }