summaryrefslogtreecommitdiffstats
path: root/cps-rest/src/test/groovy
diff options
context:
space:
mode:
authorniamhcore <niamh.core@est.tech>2021-04-07 11:35:19 +0100
committerniamhcore <niamh.core@est.tech>2021-04-07 14:14:24 +0100
commit49a609c8e2d359b62d1b27058e663c1dbf7344c6 (patch)
treeeac671d03aa1b04afea8debb37716b1e52bb8005 /cps-rest/src/test/groovy
parentd138529fe66f39b17047091d7e54117845ba9b50 (diff)
Fix upload size to be greater than 1MB
Issue-ID: CPS-308 Signed-off-by: niamhcore <niamh.core@est.tech> Change-Id: I1de6efa882f85cf6f9054e3ef38ed6e0bd99d7be
Diffstat (limited to 'cps-rest/src/test/groovy')
-rwxr-xr-xcps-rest/src/test/groovy/org/onap/cps/rest/controller/AdminRestControllerSpec.groovy23
1 files changed, 23 insertions, 0 deletions
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 3387fb4e1e..ab4cf7c1f2 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
@@ -153,6 +153,24 @@ class AdminRestControllerSpec extends Specification {
response.status == HttpStatus.CREATED.value()
}
+ def 'Create a schema set from a yang file that is greater than 1MB.'() {
+ given: 'a yang file greater than 1MB'
+ def multipartFile = createMultipartFileFromResource("/model-over-1mb.yang")
+ and: 'an endpoint'
+ def schemaSetEndpoint = "$basePath/v1/dataspaces/$dataspaceName/schema-sets"
+ when: 'a file is uploaded to the create schema set endpoint'
+ def response =
+ mvc.perform(
+ multipart(schemaSetEndpoint)
+ .file(multipartFile)
+ .param('schema-set-name', schemaSetName))
+ .andReturn().response
+ then: 'the associated service method is invoked'
+ 1 * mockCpsModuleService.createSchemaSet(dataspaceName, schemaSetName, _)
+ and: 'the response code indicates success'
+ response.status == HttpStatus.CREATED.value()
+ }
+
@Unroll
def 'Create schema set from zip archive having #caseDescriptor.'() {
given: 'an endpoint'
@@ -299,6 +317,11 @@ class AdminRestControllerSpec extends Specification {
getClass().getResource(resourcePath).getBytes())
}
+ def createMultipartFileFromResource(resourcePath) {
+ return new MockMultipartFile("file", "test.yang", "application/text",
+ getClass().getResource(resourcePath).getBytes())
+ }
+
def createMultipartFileForIOException(extension) {
def multipartFile = Mock(MockMultipartFile)
multipartFile.getOriginalFilename() >> "TEST." + extension