summaryrefslogtreecommitdiffstats
path: root/adapters
diff options
context:
space:
mode:
authorBOSLET, CORY <cory.boslet@att.com>2021-03-15 11:25:54 -0400
committerAT&T Open Source <g22940@att.com>2021-03-15 11:25:54 -0400
commit8b98eb93f7b0c4dc1885a70db3ea8dd7bb84cc77 (patch)
tree9aabba6929b28e0dc31d2e8e46b08c2ed0dafdbf /adapters
parent42218d946ea8a87ae4dccac3fd6b8dbeafd22c37 (diff)
update swagger to v3 open api version
Upgraded all projects and services to use the new v3 swagger, discontinued use of old swagger. Updated unit test to account for swagger change and removed apis Issue-ID: SO-3587 Signed-off-by: AT&T Open Source <g22940@att.com> Change-Id: Iddcfe92f8ab240691f92ce2bf23e1ab2ad159780
Diffstat (limited to 'adapters')
-rw-r--r--adapters/mso-openstack-adapters/pom.xml2
-rw-r--r--adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/cloudregion/CloudRegionRestV1.java48
-rw-r--r--adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/openstack/CXFConfiguration.java26
-rw-r--r--adapters/mso-requests-db-adapter/pom.xml2
-rw-r--r--adapters/mso-requests-db-adapter/src/main/java/org/onap/so/adapters/requestsdb/application/CXFConfiguration.java24
-rw-r--r--adapters/mso-sdnc-adapter/pom.xml6
-rw-r--r--adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/CXFConfiguration.java24
7 files changed, 68 insertions, 64 deletions
diff --git a/adapters/mso-openstack-adapters/pom.xml b/adapters/mso-openstack-adapters/pom.xml
index 32448d31dc..6dcc1a43bf 100644
--- a/adapters/mso-openstack-adapters/pom.xml
+++ b/adapters/mso-openstack-adapters/pom.xml
@@ -150,7 +150,7 @@
</dependency>
<dependency>
<groupId>org.apache.cxf</groupId>
- <artifactId>cxf-rt-rs-service-description-swagger</artifactId>
+ <artifactId>cxf-rt-rs-service-description-openapi-v3</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
diff --git a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/cloudregion/CloudRegionRestV1.java b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/cloudregion/CloudRegionRestV1.java
index 6cf42e1433..49cc0190db 100644
--- a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/cloudregion/CloudRegionRestV1.java
+++ b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/cloudregion/CloudRegionRestV1.java
@@ -39,15 +39,18 @@ import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
-import io.swagger.annotations.Api;
-import io.swagger.annotations.ApiOperation;
-import io.swagger.annotations.ApiParam;
-import io.swagger.annotations.ApiResponse;
-import io.swagger.annotations.ApiResponses;
+import io.swagger.v3.oas.annotations.OpenAPIDefinition;
+import io.swagger.v3.oas.annotations.Operation;
+import io.swagger.v3.oas.annotations.Parameter;
+import io.swagger.v3.oas.annotations.info.Info;
+import io.swagger.v3.oas.annotations.media.Content;
+import io.swagger.v3.oas.annotations.media.Schema;
+import io.swagger.v3.oas.annotations.responses.ApiResponse;
+import io.swagger.v3.oas.annotations.responses.ApiResponses;
@Path("/v1/cloud-region")
-@Api(value = "/v1/cloud-region", description = "root of cloud region adapter")
+@OpenAPIDefinition(info = @Info(title = "/v1/cloud-region", description = "root of cloud region adapter"))
@Component
public class CloudRegionRestV1 {
private static Logger logger = LoggerFactory.getLogger(CloudRegionRestV1.class);
@@ -58,13 +61,12 @@ public class CloudRegionRestV1 {
@POST
@Consumes({MediaType.APPLICATION_JSON})
@Produces({MediaType.APPLICATION_JSON})
- @ApiOperation(value = "CreateCloudRegion", response = Response.class,
- notes = "Create a cloud site in MSO and Region In AAI")
- @ApiResponses({@ApiResponse(code = 201, message = "Cloud Region has been created"),
- @ApiResponse(code = 500, message = "Create Cloud Region has failed")})
+ @Operation(description = "CreateCloudRegion", summary = "Create a cloud site in MSO and Region In AAI")
+ @ApiResponses({@ApiResponse(responseCode = "201", description = "Cloud Region has been created"),
+ @ApiResponse(responseCode = "500", description = "Create Cloud Region has failed")})
public Response createCloudRegion(
- @ApiParam(value = "cloud-region-id", required = true) @PathParam("cloud-region-id") String cloudRegionId,
- @ApiParam(value = "CloudSite", required = true) final CloudSite cloudSite) {
+ @Parameter(name = "cloud-region-id", required = true) @PathParam("cloud-region-id") String cloudRegionId,
+ @Parameter(name = "CloudSite", required = true) final CloudSite cloudSite) {
cloudRestImpl.createCloudRegion(cloudSite);
return Response.status(HttpStatus.SC_CREATED).build();
}
@@ -73,12 +75,12 @@ public class CloudRegionRestV1 {
@Path("{cloud-region-id}/{cloud-owner}")
@Consumes({MediaType.APPLICATION_JSON})
@Produces({MediaType.APPLICATION_JSON})
- @ApiOperation(value = "CreateCloudRegion", response = Response.class, notes = "Delete an cloud Region in SO")
- @ApiResponses({@ApiResponse(code = 204, message = "cloud Region has been deleted"),
- @ApiResponse(code = 500, message = "Cloud Region delete has failed")})
+ @Operation(description = "CreateCloudRegion", summary = "Delete an cloud Region in SO")
+ @ApiResponses({@ApiResponse(responseCode = "204", description = "cloud Region has been deleted"),
+ @ApiResponse(responseCode = "500", description = "Cloud Region delete has failed")})
public Response deleteCloudRegion(
- @ApiParam(value = "cloud-region-id", required = true) @PathParam("cloud-region-id") String cloudRegionId,
- @ApiParam(value = "cloud-owner", required = true) @PathParam("cloud-owner") String cloudOwner) {
+ @Parameter(name = "cloud-region-id", required = true) @PathParam("cloud-region-id") String cloudRegionId,
+ @Parameter(name = "cloud-owner", required = true) @PathParam("cloud-owner") String cloudOwner) {
cloudRestImpl.deleteCloudRegion(cloudRegionId);
return Response.status(HttpStatus.SC_NO_CONTENT).build();
}
@@ -87,13 +89,13 @@ public class CloudRegionRestV1 {
@Path("{cloud-region-id}/{cloud-owner}")
@Consumes({MediaType.APPLICATION_JSON})
@Produces({MediaType.APPLICATION_JSON})
- @ApiOperation(value = "CreateCloudRegion", response = Response.class, notes = "Update an existing Cloud Region")
- @ApiResponses({@ApiResponse(code = 200, message = "Cloud Region has been updated"),
- @ApiResponse(code = 500, message = "Update Cloud Region has failed examine entity object for details")})
+ @Operation(description = "CreateCloudRegion", summary = "Update an existing Cloud Region")
+ @ApiResponses({@ApiResponse(responseCode = "200", description = "Cloud Region has been updated"), @ApiResponse(
+ responseCode = "500", description = "Update Cloud Region has failed examine entity object for details")})
public Response updateCloudRegion(
- @ApiParam(value = "cloud-region-id", required = true) @PathParam("cloud-region-id") String cloudRegionId,
- @ApiParam(value = "cloud-owner", required = true) @PathParam("cloud-owner") String cloudOwner,
- @ApiParam(value = "CloudSite", required = true) final CloudSite cloudSite) {
+ @Parameter(name = "cloud-region-id", required = true) @PathParam("cloud-region-id") String cloudRegionId,
+ @Parameter(name = "cloud-owner", required = true) @PathParam("cloud-owner") String cloudOwner,
+ @Parameter(name = "CloudSite", required = true) final CloudSite cloudSite) {
cloudRestImpl.updateCloudRegion(cloudSite);
return Response.status(HttpStatus.SC_OK).build();
}
diff --git a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/openstack/CXFConfiguration.java b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/openstack/CXFConfiguration.java
index 1446047ebd..942da2937b 100644
--- a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/openstack/CXFConfiguration.java
+++ b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/openstack/CXFConfiguration.java
@@ -23,13 +23,14 @@
package org.onap.so.adapters.openstack;
import java.util.Arrays;
+import java.util.HashSet;
import javax.xml.ws.Endpoint;
import org.apache.cxf.Bus;
import org.apache.cxf.bus.spring.SpringBus;
import org.apache.cxf.endpoint.Server;
import org.apache.cxf.feature.LoggingFeature;
import org.apache.cxf.jaxrs.JAXRSServerFactoryBean;
-import org.apache.cxf.jaxrs.swagger.Swagger2Feature;
+import org.apache.cxf.jaxrs.openapi.OpenApiFeature;
import org.apache.cxf.jaxws.EndpointImpl;
import org.apache.cxf.transport.servlet.CXFServlet;
import org.onap.so.adapters.cloudregion.CloudRegionRestV1;
@@ -101,18 +102,17 @@ public class CXFConfiguration {
return endpoint.create();
}
-
@Bean
- public Swagger2Feature createSwaggerFeature() {
- Swagger2Feature swagger2Feature = new Swagger2Feature();
- swagger2Feature.setPrettyPrint(true);
- swagger2Feature.setTitle("SO Orchestration Application");
- swagger2Feature.setContact("The ONAP SO team");
- swagger2Feature.setDescription("This project is the SO Orchestration Engine");
- swagger2Feature.setVersion("1.0.0");
- swagger2Feature.setResourcePackage(
- "org.onap.so.adapters.network,org.onap.so.adapters.tenant,org.onap.so.adapters.vnf");
- swagger2Feature.setScan(true);
- return swagger2Feature;
+ public OpenApiFeature createSwaggerFeature() {
+ OpenApiFeature openApiFeature = new OpenApiFeature();
+ openApiFeature.setPrettyPrint(true);
+ openApiFeature.setTitle("SO Orchestration Application");
+ openApiFeature.setContactName("The ONAP SO team");
+ openApiFeature.setDescription("This project is the SO Orchestration Engine");
+ openApiFeature.setVersion("1.0.0");
+ openApiFeature.setResourcePackages(
+ new HashSet<String>(Arrays.asList("org.onap.so.adapters.network,org.onap.so.adapters.vnf")));
+ openApiFeature.setScan(true);
+ return openApiFeature;
}
}
diff --git a/adapters/mso-requests-db-adapter/pom.xml b/adapters/mso-requests-db-adapter/pom.xml
index 09e2cc26d7..45acf2484d 100644
--- a/adapters/mso-requests-db-adapter/pom.xml
+++ b/adapters/mso-requests-db-adapter/pom.xml
@@ -19,7 +19,7 @@
</dependency>
<dependency>
<groupId>org.apache.cxf</groupId>
- <artifactId>cxf-rt-rs-service-description-swagger</artifactId>
+ <artifactId>cxf-rt-rs-service-description-openapi-v3</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
diff --git a/adapters/mso-requests-db-adapter/src/main/java/org/onap/so/adapters/requestsdb/application/CXFConfiguration.java b/adapters/mso-requests-db-adapter/src/main/java/org/onap/so/adapters/requestsdb/application/CXFConfiguration.java
index 06d75befd9..2325ffaa14 100644
--- a/adapters/mso-requests-db-adapter/src/main/java/org/onap/so/adapters/requestsdb/application/CXFConfiguration.java
+++ b/adapters/mso-requests-db-adapter/src/main/java/org/onap/so/adapters/requestsdb/application/CXFConfiguration.java
@@ -20,10 +20,12 @@
package org.onap.so.adapters.requestsdb.application;
+import java.util.Arrays;
+import java.util.HashSet;
import javax.xml.ws.Endpoint;
import org.apache.cxf.Bus;
import org.apache.cxf.feature.LoggingFeature;
-import org.apache.cxf.jaxrs.swagger.Swagger2Feature;
+import org.apache.cxf.jaxrs.openapi.OpenApiFeature;
import org.apache.cxf.jaxws.EndpointImpl;
import org.apache.cxf.transport.servlet.CXFServlet;
import org.onap.so.adapters.requestsdb.MsoRequestsDbAdapter;
@@ -65,16 +67,16 @@ public class CXFConfiguration {
}
@Bean
- public Swagger2Feature createSwaggerFeature() {
- Swagger2Feature swagger2Feature = new Swagger2Feature();
- swagger2Feature.setPrettyPrint(true);
- swagger2Feature.setTitle("SO Request Adapter");
- swagger2Feature.setContact("The ONAP SO team");
- swagger2Feature.setDescription("This project is the SO Orchestration Engine");
- swagger2Feature.setVersion("1.0.0");
- swagger2Feature.setResourcePackage("org.onap.so.adapters.requestdb");
- swagger2Feature.setScan(true);
- return swagger2Feature;
+ public OpenApiFeature createSwaggerFeature() {
+ OpenApiFeature openApiFeature = new OpenApiFeature();
+ openApiFeature.setPrettyPrint(true);
+ openApiFeature.setTitle("SO Request Adapter");
+ openApiFeature.setContactName("The ONAP SO team");
+ openApiFeature.setDescription("This project is the SO Orchestration Engine");
+ openApiFeature.setVersion("1.0.0");
+ openApiFeature.setResourcePackages(new HashSet<String>(Arrays.asList("org.onap.so.adapters.requestdb")));
+ openApiFeature.setScan(true);
+ return openApiFeature;
}
}
diff --git a/adapters/mso-sdnc-adapter/pom.xml b/adapters/mso-sdnc-adapter/pom.xml
index 358b14e37a..62ba731873 100644
--- a/adapters/mso-sdnc-adapter/pom.xml
+++ b/adapters/mso-sdnc-adapter/pom.xml
@@ -132,8 +132,8 @@
</dependencyManagement>
<dependencies>
<dependency>
- <groupId>io.swagger</groupId>
- <artifactId>swagger-jersey2-jaxrs</artifactId>
+ <groupId>io.swagger.core.v3</groupId>
+ <artifactId>swagger-jaxrs2</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
@@ -159,7 +159,7 @@
</dependency>
<dependency>
<groupId>org.apache.cxf</groupId>
- <artifactId>cxf-rt-rs-service-description-swagger</artifactId>
+ <artifactId>cxf-rt-rs-service-description-openapi-v3</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
diff --git a/adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/CXFConfiguration.java b/adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/CXFConfiguration.java
index dd1da98dd8..65eb39d019 100644
--- a/adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/CXFConfiguration.java
+++ b/adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/CXFConfiguration.java
@@ -21,12 +21,13 @@
package org.onap.so.adapters.sdnc;
import java.util.Arrays;
+import java.util.HashSet;
import javax.xml.ws.Endpoint;
import org.apache.cxf.Bus;
import org.apache.cxf.endpoint.Server;
import org.apache.cxf.feature.LoggingFeature;
import org.apache.cxf.jaxrs.JAXRSServerFactoryBean;
-import org.apache.cxf.jaxrs.swagger.Swagger2Feature;
+import org.apache.cxf.jaxrs.openapi.OpenApiFeature;
import org.apache.cxf.jaxws.EndpointImpl;
import org.apache.cxf.transport.servlet.CXFServlet;
import org.onap.so.adapters.sdnc.sdncrest.SNIROResponse;
@@ -91,16 +92,15 @@ public class CXFConfiguration {
@Bean
- public Swagger2Feature createSwaggerFeature() {
- Swagger2Feature swagger2Feature = new Swagger2Feature();
- swagger2Feature.setBasePath("/services/rest");
- swagger2Feature.setPrettyPrint(true);
- swagger2Feature.setTitle("SO Orchestration Application");
- swagger2Feature.setContact("The ONAP SO team");
- swagger2Feature.setDescription("This project is the SO Orchestration Engine");
- swagger2Feature.setVersion("1.0.0");
- swagger2Feature.setResourcePackage("org.onap.so.adapters.sdnc");
- swagger2Feature.setScan(true);
- return swagger2Feature;
+ public OpenApiFeature createSwaggerFeature() {
+ OpenApiFeature openApiFeature = new OpenApiFeature();
+ openApiFeature.setPrettyPrint(true);
+ openApiFeature.setTitle("SO Orchestration Application");
+ openApiFeature.setContactName("The ONAP SO team");
+ openApiFeature.setDescription("This project is the SO Orchestration Engine");
+ openApiFeature.setVersion("1.0.0");
+ openApiFeature.setResourcePackages(new HashSet<String>(Arrays.asList("org.onap.so.adapters.sdnc")));
+ openApiFeature.setScan(true);
+ return openApiFeature;
}
}