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 org.onap.cps.integration.performance.base.CpsPerfTestBase
 
  24 import org.springframework.dao.DataAccessResourceFailureException
 
  26 class CpsAdminServiceLimits extends CpsPerfTestBase {
 
  30     def setup() { objectUnderTest = cpsAdminService }
 
  32     def 'Get anchors from multiple schema set names limit exceeded: 32,766 (~ 2^15) schema set names.'() {
 
  33         given: 'more than 32,766 schema set names'
 
  34             def schemaSetNames = (0..32_766).collect { "size-of-this-name-does-not-matter-for-limit-" + it }
 
  35         when: 'single get is executed to get all the anchors'
 
  36             objectUnderTest.getAnchors(CPS_PERFORMANCE_TEST_DATASPACE, schemaSetNames)
 
  37         then: 'a database exception is thrown'
 
  38             thrown(DataAccessResourceFailureException.class)
 
  41     def 'Querying anchor names limit exceeded: 32,766 (~ 2^15) modules.'() {
 
  42         given: 'more than 32,766 module names'
 
  43             def moduleNames = (0..32_766).collect { "size-of-this-name-does-not-matter-for-limit-" + it }
 
  44         when: 'single query is executed to get all the anchors'
 
  45             objectUnderTest.queryAnchorNames(CPS_PERFORMANCE_TEST_DATASPACE, moduleNames)
 
  46         then: 'a database exception is thrown'
 
  47             thrown(DataAccessResourceFailureException.class)