summaryrefslogtreecommitdiffstats
path: root/cps-ri/src/test/groovy/org/onap/cps/spi/impl/utils/CpsValidatorSpec.groovy
diff options
context:
space:
mode:
authorrajesh.kumar <rk00747546@techmahindra.com>2023-04-25 11:58:35 +0530
committerrajesh.kumar <rk00747546@techmahindra.com>2023-08-02 18:15:16 +0530
commitf248b5d9b794d5bdff59145406e0398d6fdcafa4 (patch)
treef99670f0911b4c6e5f13ec5590fe15eb205f0dc3 /cps-ri/src/test/groovy/org/onap/cps/spi/impl/utils/CpsValidatorSpec.groovy
parent7fcffe5ae6753bfb6746d18d41ec536092603a76 (diff)
Support pagination in query across all anchors(ep4)
Add pagination query parameters in query across all anchors API pagination parameters (pageIndex and pageSize) are optional default is to query all fragments each pageSize represents number of records(number of anchors) TotalRecords is returned in response header to find number of pages. - If pagination option is provided in request then query number of anchors equal to pageSize. pageIndex is used for setting offset. - return number of records(one anchor per record) as per pagesize and pageSize Issue-ID: CPS-1605 Change-ID: I73f97f986a817d423f93a8d922dcd9647b2504bc Signed-off-by: rajesh.kumar <rk00747546@techmahindra.com>
Diffstat (limited to 'cps-ri/src/test/groovy/org/onap/cps/spi/impl/utils/CpsValidatorSpec.groovy')
-rw-r--r--cps-ri/src/test/groovy/org/onap/cps/spi/impl/utils/CpsValidatorSpec.groovy10
1 files changed, 10 insertions, 0 deletions
diff --git a/cps-ri/src/test/groovy/org/onap/cps/spi/impl/utils/CpsValidatorSpec.groovy b/cps-ri/src/test/groovy/org/onap/cps/spi/impl/utils/CpsValidatorSpec.groovy
index 345089c93..8d348443c 100644
--- a/cps-ri/src/test/groovy/org/onap/cps/spi/impl/utils/CpsValidatorSpec.groovy
+++ b/cps-ri/src/test/groovy/org/onap/cps/spi/impl/utils/CpsValidatorSpec.groovy
@@ -20,6 +20,7 @@
package org.onap.cps.spi.impl.utils
+import org.onap.cps.spi.PaginationOption
import org.onap.cps.spi.exceptions.DataValidationException
import spock.lang.Specification
@@ -64,4 +65,13 @@ class CpsValidatorSpec extends Specification {
then: 'a data validation exception is thrown'
thrown(DataValidationException)
}
+
+ def 'Validate Pagination option with invalid page index and size.'() {
+ when: 'the pagination option is validated using invalid options'
+ objectUnderTest.validatePaginationOption(new PaginationOption(-5, -2))
+ then: 'a data validation exception is thrown'
+ def exceptionThrown = thrown(DataValidationException)
+ and: 'the error was encountered at the following index in #scenario'
+ assert exceptionThrown.getDetails().contains("Invalid page index or size")
+ }
}