summaryrefslogtreecommitdiffstats
path: root/cps-ncmp-rest
diff options
context:
space:
mode:
Diffstat (limited to 'cps-ncmp-rest')
-rwxr-xr-xcps-ncmp-rest/docs/openapi/ncmproxy.yml4
-rw-r--r--cps-ncmp-rest/pom.xml256
-rwxr-xr-xcps-ncmp-rest/src/main/java/org/onap/cps/ncmp/rest/controller/NetworkCmProxyController.java2
-rw-r--r--cps-ncmp-rest/src/test/groovy/org/onap/cps/ncmp/rest/controller/NetworkCmProxyControllerSpec.groovy10
4 files changed, 138 insertions, 134 deletions
diff --git a/cps-ncmp-rest/docs/openapi/ncmproxy.yml b/cps-ncmp-rest/docs/openapi/ncmproxy.yml
index 5e2957f340..2e5eba754d 100755
--- a/cps-ncmp-rest/docs/openapi/ncmproxy.yml
+++ b/cps-ncmp-rest/docs/openapi/ncmproxy.yml
@@ -266,10 +266,10 @@ resourceDataForPassthroughRunning:
content:
application/json:
schema:
- type: object
+ type: string
application/yang-data+json:
schema:
- type: object
+ type: string
responses:
201:
$ref: 'components.yaml#/components/responses/Created'
diff --git a/cps-ncmp-rest/pom.xml b/cps-ncmp-rest/pom.xml
index c243983309..2c44c24807 100644
--- a/cps-ncmp-rest/pom.xml
+++ b/cps-ncmp-rest/pom.xml
@@ -27,139 +27,139 @@
<parent>
<groupId>org.onap.cps</groupId>
<artifactId>cps-parent</artifactId>
- <version>2.0.0-SNAPSHOT</version>
+ <version>2.0.1-SNAPSHOT</version>
<relativePath>../cps-parent/pom.xml</relativePath>
</parent>
<artifactId>cps-ncmp-rest</artifactId>
-<properties>
- <minimum-coverage>0.5</minimum-coverage>
-</properties>
+ <properties>
+ <minimum-coverage>0.95</minimum-coverage>
+ </properties>
-<dependencies>
- <dependency>
- <groupId>${project.groupId}</groupId>
- <artifactId>cps-ncmp-service</artifactId>
- <version>${project.version}</version>
- </dependency>
- <dependency>
- <groupId>org.springframework.boot</groupId>
- <artifactId>spring-boot-starter-web</artifactId>
- <exclusions>
- <exclusion>
- <groupId>org.springframework.boot</groupId>
- <artifactId>spring-boot-starter-tomcat</artifactId>
- </exclusion>
- </exclusions>
- </dependency>
- <dependency>
- <groupId>org.springframework.boot</groupId>
- <artifactId>spring-boot-starter-validation</artifactId>
- </dependency>
- <dependency>
- <groupId>org.springframework.boot</groupId>
- <artifactId>spring-boot-starter-jetty</artifactId>
- </dependency>
- <dependency>
- <groupId>io.swagger.core.v3</groupId>
- <artifactId>swagger-annotations</artifactId>
- </dependency>
- <!-- T E S T D E P E N D E N C I E S -->
- <dependency>
- <groupId>org.codehaus.groovy</groupId>
- <artifactId>groovy</artifactId>
- <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>
- </dependency>
- <dependency>
- <groupId>org.spockframework</groupId>
- <artifactId>spock-spring</artifactId>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>cglib</groupId>
- <artifactId>cglib-nodep</artifactId>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.springframework.boot</groupId>
- <artifactId>spring-boot-starter-test</artifactId>
- <scope>test</scope>
- <exclusions>
- <exclusion>
- <groupId>org.junit.vintage</groupId>
- <artifactId>junit-vintage-engine</artifactId>
- </exclusion>
- </exclusions>
- </dependency>
- <dependency>
- <groupId>com.google.code.gson</groupId>
- <artifactId>gson</artifactId>
- </dependency>
-</dependencies>
+ <dependencies>
+ <dependency>
+ <groupId>${project.groupId}</groupId>
+ <artifactId>cps-ncmp-service</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.springframework.boot</groupId>
+ <artifactId>spring-boot-starter-web</artifactId>
+ <exclusions>
+ <exclusion>
+ <groupId>org.springframework.boot</groupId>
+ <artifactId>spring-boot-starter-tomcat</artifactId>
+ </exclusion>
+ </exclusions>
+ </dependency>
+ <dependency>
+ <groupId>org.springframework.boot</groupId>
+ <artifactId>spring-boot-starter-validation</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.springframework.boot</groupId>
+ <artifactId>spring-boot-starter-jetty</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>io.swagger.core.v3</groupId>
+ <artifactId>swagger-annotations</artifactId>
+ </dependency>
+ <!-- T E S T D E P E N D E N C I E S -->
+ <dependency>
+ <groupId>org.codehaus.groovy</groupId>
+ <artifactId>groovy</artifactId>
+ <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>
+ </dependency>
+ <dependency>
+ <groupId>org.spockframework</groupId>
+ <artifactId>spock-spring</artifactId>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>cglib</groupId>
+ <artifactId>cglib-nodep</artifactId>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.springframework.boot</groupId>
+ <artifactId>spring-boot-starter-test</artifactId>
+ <scope>test</scope>
+ <exclusions>
+ <exclusion>
+ <groupId>org.junit.vintage</groupId>
+ <artifactId>junit-vintage-engine</artifactId>
+ </exclusion>
+ </exclusions>
+ </dependency>
+ <dependency>
+ <groupId>com.google.code.gson</groupId>
+ <artifactId>gson</artifactId>
+ </dependency>
+ </dependencies>
-<build>
- <plugins>
- <!-- Swagger code generation. -->
- <plugin>
- <groupId>io.swagger.codegen.v3</groupId>
- <artifactId>swagger-codegen-maven-plugin</artifactId>
- <executions>
- <execution>
- <id>code-gen</id>
- <goals>
- <goal>generate</goal>
- </goals>
- <configuration>
- <inputSpec>${project.basedir}/docs/openapi/openapi.yml</inputSpec>
- <invokerPackage>org.onap.cps.ncmp.rest.controller</invokerPackage>
- <modelPackage>org.onap.cps.ncmp.rest.model</modelPackage>
- <apiPackage>org.onap.cps.ncmp.rest.api</apiPackage>
- <language>spring</language>
- <generateSupportingFiles>false</generateSupportingFiles>
- <configOptions>
- <sourceFolder>src/gen/java</sourceFolder>
- <dateLibrary>java11</dateLibrary>
- <interfaceOnly>true</interfaceOnly>
- <useTags>true</useTags>
- </configOptions>
- </configuration>
- </execution>
- </executions>
- </plugin>
- <plugin>
- <artifactId>maven-resources-plugin</artifactId>
- <executions>
- <execution>
- <id>copy-resources</id>
- <phase>compile</phase>
- <goals>
- <goal>copy-resources</goal>
- </goals>
- <configuration>
- <outputDirectory>${project.basedir}/target/classes/static/api-docs/cps-ncmp</outputDirectory>
- <resources>
- <resource>
- <directory>${project.basedir}/target/generated-sources/swagger/</directory>
- <includes>
- <include>openapi.yaml</include>
- </includes>
- </resource>
- </resources>
- </configuration>
- </execution>
- </executions>
- </plugin>
- </plugins>
-</build>
+ <build>
+ <plugins>
+ <!-- Swagger code generation. -->
+ <plugin>
+ <groupId>io.swagger.codegen.v3</groupId>
+ <artifactId>swagger-codegen-maven-plugin</artifactId>
+ <executions>
+ <execution>
+ <id>code-gen</id>
+ <goals>
+ <goal>generate</goal>
+ </goals>
+ <configuration>
+ <inputSpec>${project.basedir}/docs/openapi/openapi.yml</inputSpec>
+ <invokerPackage>org.onap.cps.ncmp.rest.controller</invokerPackage>
+ <modelPackage>org.onap.cps.ncmp.rest.model</modelPackage>
+ <apiPackage>org.onap.cps.ncmp.rest.api</apiPackage>
+ <language>spring</language>
+ <generateSupportingFiles>false</generateSupportingFiles>
+ <configOptions>
+ <sourceFolder>src/gen/java</sourceFolder>
+ <dateLibrary>java11</dateLibrary>
+ <interfaceOnly>true</interfaceOnly>
+ <useTags>true</useTags>
+ </configOptions>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
+ <plugin>
+ <artifactId>maven-resources-plugin</artifactId>
+ <executions>
+ <execution>
+ <id>copy-resources</id>
+ <phase>compile</phase>
+ <goals>
+ <goal>copy-resources</goal>
+ </goals>
+ <configuration>
+ <outputDirectory>${project.basedir}/target/classes/static/api-docs/cps-ncmp</outputDirectory>
+ <resources>
+ <resource>
+ <directory>${project.basedir}/target/generated-sources/swagger/</directory>
+ <includes>
+ <include>openapi.yaml</include>
+ </includes>
+ </resource>
+ </resources>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
</project>
diff --git a/cps-ncmp-rest/src/main/java/org/onap/cps/ncmp/rest/controller/NetworkCmProxyController.java b/cps-ncmp-rest/src/main/java/org/onap/cps/ncmp/rest/controller/NetworkCmProxyController.java
index b78241662e..a4d94cebfd 100755
--- a/cps-ncmp-rest/src/main/java/org/onap/cps/ncmp/rest/controller/NetworkCmProxyController.java
+++ b/cps-ncmp-rest/src/main/java/org/onap/cps/ncmp/rest/controller/NetworkCmProxyController.java
@@ -214,7 +214,7 @@ public class NetworkCmProxyController implements NetworkCmProxyApi {
@Override
public ResponseEntity<Void> createResourceDataRunningForCmHandle(final String cmHandle,
final String resourceIdentifier,
- final Object requestBody,
+ final String requestBody,
final String contentType) {
networkCmProxyDataService.createResourceDataPassThroughRunningForCmHandle(cmHandle,
resourceIdentifier, requestBody, contentType);
diff --git a/cps-ncmp-rest/src/test/groovy/org/onap/cps/ncmp/rest/controller/NetworkCmProxyControllerSpec.groovy b/cps-ncmp-rest/src/test/groovy/org/onap/cps/ncmp/rest/controller/NetworkCmProxyControllerSpec.groovy
index 613243e28b..9f2b4e19a3 100644
--- a/cps-ncmp-rest/src/test/groovy/org/onap/cps/ncmp/rest/controller/NetworkCmProxyControllerSpec.groovy
+++ b/cps-ncmp-rest/src/test/groovy/org/onap/cps/ncmp/rest/controller/NetworkCmProxyControllerSpec.groovy
@@ -232,7 +232,7 @@ class NetworkCmProxyControllerSpec extends Specification {
response.getContentAsString() == '{valid-json}'
}
- def 'Create Resource Data from pass-through running using POST.' () {
+ def 'Create Resource Data from pass-through running with #scenario.' () {
given: 'resource data url'
def getUrl = "$ncmpBasePathV1/ch/testCmHandle/data/ds/ncmp-datastore:passthrough-running" +
"/testResourceIdentifier"
@@ -240,13 +240,17 @@ class NetworkCmProxyControllerSpec extends Specification {
def response = mvc.perform(
post(getUrl)
.contentType(MediaType.APPLICATION_JSON_VALUE)
- .accept(MediaType.APPLICATION_JSON_VALUE).content('{"some-json":"value"}')
+ .accept(MediaType.APPLICATION_JSON_VALUE).content(requestBody)
).andReturn().response
then: 'ncmp service method to create resource called'
1 * mockNetworkCmProxyDataService.createResourceDataPassThroughRunningForCmHandle('testCmHandle',
- 'testResourceIdentifier', ['some-json':'value'], 'application/json;charset=UTF-8')
+ 'testResourceIdentifier', requestBody, 'application/json;charset=UTF-8')
and: 'resource is created'
response.status == HttpStatus.CREATED.value()
+ where: 'given request body'
+ scenario | requestBody
+ 'body contains " and new line' | 'body with " quote and \n new line'
+ 'body contains normal string' | 'normal request body'
}
def 'Get module references for the given dataspace and cm handle.' () {