summaryrefslogtreecommitdiffstats
path: root/cps-rest
diff options
context:
space:
mode:
authorshivasubedi <shiva.subedi@est.tech>2021-04-29 12:48:05 +0100
committerShiva Subedi <shiva.subedi@est.tech>2021-04-29 11:54:59 +0000
commit8a74ced574d566024513044859f433d263e3cc1b (patch)
treeded9f6e3ebffad554fc184ca231d4a0fa78e8c3f /cps-rest
parentff7ba3a74265b62b116abb2fc34767f87444a655 (diff)
Investigate and update Spock version
Issue-ID: CPS-368 Signed-off-by: shivasubedi <shiva.subedi@est.tech> Change-Id: Ie8505cf29068660af6bc6b9887f593f7e3be074f
Diffstat (limited to 'cps-rest')
-rwxr-xr-xcps-rest/pom.xml5
-rwxr-xr-xcps-rest/src/test/groovy/org/onap/cps/rest/controller/AdminRestControllerSpec.groovy3
-rwxr-xr-xcps-rest/src/test/groovy/org/onap/cps/rest/controller/DataRestControllerSpec.groovy8
-rw-r--r--cps-rest/src/test/groovy/org/onap/cps/rest/controller/QueryRestControllerSpec.groovy2
-rw-r--r--cps-rest/src/test/groovy/org/onap/cps/rest/exceptions/CpsRestExceptionHandlerSpec.groovy3
-rw-r--r--cps-rest/src/test/groovy/org/onap/cps/rest/utils/MultipartFileUtilSpec.groovy3
6 files changed, 6 insertions, 18 deletions
diff --git a/cps-rest/pom.xml b/cps-rest/pom.xml
index ce304f3328..1e535c4369 100755
--- a/cps-rest/pom.xml
+++ b/cps-rest/pom.xml
@@ -80,6 +80,11 @@
<scope>test</scope>
</dependency>
<dependency>
+ <groupId>org.codehaus.groovy</groupId>
+ <artifactId>groovy-json</artifactId>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
<groupId>org.spockframework</groupId>
<artifactId>spock-core</artifactId>
<scope>test</scope>
diff --git a/cps-rest/src/test/groovy/org/onap/cps/rest/controller/AdminRestControllerSpec.groovy b/cps-rest/src/test/groovy/org/onap/cps/rest/controller/AdminRestControllerSpec.groovy
index 1ccd3ba661..e158ebdedc 100755
--- a/cps-rest/src/test/groovy/org/onap/cps/rest/controller/AdminRestControllerSpec.groovy
+++ b/cps-rest/src/test/groovy/org/onap/cps/rest/controller/AdminRestControllerSpec.groovy
@@ -47,7 +47,6 @@ import org.springframework.test.web.servlet.MockMvc
import org.springframework.util.LinkedMultiValueMap
import org.springframework.util.MultiValueMap
import spock.lang.Specification
-import spock.lang.Unroll
@WebMvcTest
class AdminRestControllerSpec extends Specification {
@@ -171,7 +170,6 @@ class AdminRestControllerSpec extends Specification {
response.status == HttpStatus.CREATED.value()
}
- @Unroll
def 'Create schema set from zip archive having #caseDescriptor.'() {
given: 'an endpoint'
def schemaSetEndpoint = "$basePath/v1/dataspaces/$dataspaceName/schema-sets"
@@ -206,7 +204,6 @@ class AdminRestControllerSpec extends Specification {
response.status == HttpStatus.BAD_REQUEST.value()
}
- @Unroll
def 'Create schema set from #fileType file with IOException occurrence on processing.'() {
given: 'an endpoint'
def schemaSetEndpoint = "$basePath/v1/dataspaces/$dataspaceName/schema-sets"
diff --git a/cps-rest/src/test/groovy/org/onap/cps/rest/controller/DataRestControllerSpec.groovy b/cps-rest/src/test/groovy/org/onap/cps/rest/controller/DataRestControllerSpec.groovy
index b7337e02a5..b64b56178a 100755
--- a/cps-rest/src/test/groovy/org/onap/cps/rest/controller/DataRestControllerSpec.groovy
+++ b/cps-rest/src/test/groovy/org/onap/cps/rest/controller/DataRestControllerSpec.groovy
@@ -48,7 +48,6 @@ import org.springframework.http.MediaType
import org.springframework.test.web.servlet.MockMvc
import spock.lang.Shared
import spock.lang.Specification
-import spock.lang.Unroll
@WebMvcTest
class DataRestControllerSpec extends Specification {
@@ -90,7 +89,6 @@ class DataRestControllerSpec extends Specification {
dataNodeBaseEndpoint = "$basePath/v1/dataspaces/$dataspaceName"
}
- @Unroll
def 'Create a node: #scenario.'() {
given: 'some json to create a data node'
def endpoint = "$dataNodeBaseEndpoint/anchors/$anchorName/nodes"
@@ -133,7 +131,6 @@ class DataRestControllerSpec extends Specification {
1 * mockCpsDataService.saveData(dataspaceName, anchorName, parentNodeXpath, json)
}
- @Unroll
def 'Get data node with leaves'() {
given: 'the service returns data node leaves'
def xpath = 'some xPath'
@@ -151,7 +148,6 @@ class DataRestControllerSpec extends Specification {
response.contentAsString.contains('"leafList":["leaveListElement1","leaveListElement2"]')
}
- @Unroll
def 'Get data node with #scenario.'() {
given: 'the service returns data node with #scenario'
def xpath = 'some xPath'
@@ -174,8 +170,7 @@ class DataRestControllerSpec extends Specification {
'no descendant explicitly' | dataNodeWithLeavesNoChildren | 'false' || OMIT_DESCENDANTS | false
'with descendants' | dataNodeWithChild | 'true' || INCLUDE_ALL_DESCENDANTS | true
}
-
- @Unroll
+
def 'Update data node leaves: #scenario.'() {
given: 'json data'
def jsonData = 'json data'
@@ -199,7 +194,6 @@ class DataRestControllerSpec extends Specification {
'some xpath by parent' | '/some/xpath' || '/some/xpath'
}
- @Unroll
def 'Replace data node tree: #scenario.'() {
given: 'json data'
def jsonData = 'json data'
diff --git a/cps-rest/src/test/groovy/org/onap/cps/rest/controller/QueryRestControllerSpec.groovy b/cps-rest/src/test/groovy/org/onap/cps/rest/controller/QueryRestControllerSpec.groovy
index f3f1417f13..e42c75c2a1 100644
--- a/cps-rest/src/test/groovy/org/onap/cps/rest/controller/QueryRestControllerSpec.groovy
+++ b/cps-rest/src/test/groovy/org/onap/cps/rest/controller/QueryRestControllerSpec.groovy
@@ -38,7 +38,6 @@ import org.springframework.boot.test.autoconfigure.web.servlet.WebMvcTest
import org.springframework.http.HttpStatus
import org.springframework.test.web.servlet.MockMvc
import spock.lang.Specification
-import spock.lang.Unroll
@WebMvcTest
class QueryRestControllerSpec extends Specification {
@@ -64,7 +63,6 @@ class QueryRestControllerSpec extends Specification {
@Value('${rest.api.cps-base-path}')
def basePath
- @Unroll
def 'Query data node by cps path for the given dataspace and anchor with #scenario.'() {
given: 'service method returns a list containing a data node'
def dataNode = new DataNodeBuilder().withXpath('/xpath').build()
diff --git a/cps-rest/src/test/groovy/org/onap/cps/rest/exceptions/CpsRestExceptionHandlerSpec.groovy b/cps-rest/src/test/groovy/org/onap/cps/rest/exceptions/CpsRestExceptionHandlerSpec.groovy
index 30d5b62a26..6c14dde466 100644
--- a/cps-rest/src/test/groovy/org/onap/cps/rest/exceptions/CpsRestExceptionHandlerSpec.groovy
+++ b/cps-rest/src/test/groovy/org/onap/cps/rest/exceptions/CpsRestExceptionHandlerSpec.groovy
@@ -48,7 +48,6 @@ import org.springframework.boot.test.autoconfigure.web.servlet.WebMvcTest
import org.springframework.test.web.servlet.MockMvc
import spock.lang.Shared
import spock.lang.Specification
-import spock.lang.Unroll
@WebMvcTest
class CpsRestExceptionHandlerSpec extends Specification {
@@ -121,7 +120,6 @@ class CpsRestExceptionHandlerSpec extends Specification {
"Anchor with name ${existingObjectName} already exists for ${dataspaceName}.")
}
- @Unroll
def 'Get request with a #exceptionThrown.class.simpleName returns HTTP Status Bad Request'() {
when: 'CPS validation exception is thrown by the service'
setupTestException(exceptionThrown)
@@ -134,7 +132,6 @@ class CpsRestExceptionHandlerSpec extends Specification {
new CpsPathException(errorMessage, errorDetails)]
}
- @Unroll
def 'Delete request with a #exceptionThrown.class.simpleName returns HTTP Status Conflict'() {
when: 'CPS validation exception is thrown by the service'
setupTestException(exceptionThrown)
diff --git a/cps-rest/src/test/groovy/org/onap/cps/rest/utils/MultipartFileUtilSpec.groovy b/cps-rest/src/test/groovy/org/onap/cps/rest/utils/MultipartFileUtilSpec.groovy
index 2c3d46e5db..3f4729ec79 100644
--- a/cps-rest/src/test/groovy/org/onap/cps/rest/utils/MultipartFileUtilSpec.groovy
+++ b/cps-rest/src/test/groovy/org/onap/cps/rest/utils/MultipartFileUtilSpec.groovy
@@ -26,7 +26,6 @@ import org.onap.cps.utils.DataMapUtils
import org.springframework.mock.web.MockMultipartFile
import org.springframework.web.multipart.MultipartFile
import spock.lang.Specification
-import spock.lang.Unroll
class MultipartFileUtilSpec extends Specification {
@@ -61,7 +60,6 @@ class MultipartFileUtilSpec extends Specification {
assert result["component.yang"] == "fake component content 1\n"
}
- @Unroll
def 'Extract resources from zip archive having #caseDescriptor.'() {
when: 'attempt to extract resources from zip file is performed'
MultipartFileUtil.extractYangResourcesMap(multipartFile)
@@ -82,7 +80,6 @@ class MultipartFileUtilSpec extends Specification {
thrown(ModelValidationException)
}
- @Unroll
def 'IOException thrown during yang resources extraction from #fileType file.'() {
when: 'attempt to extract resources from the file is performed'
MultipartFileUtil.extractYangResourcesMap(multipartFileForIOException(fileType))