Migrate to springboot 3 74/10374/3
authorPatrikBuhr <patrik.buhr@est.tech>
Fri, 3 Feb 2023 10:28:59 +0000 (11:28 +0100)
committerPatrik Buhr <patrik.buhr@est.tech>
Mon, 27 Feb 2023 13:10:09 +0000 (13:10 +0000)
Java 17 is needed

Signed-off-by: PatrikBuhr <patrik.buhr@est.tech>
Issue-ID: NONRTRIC-841
Change-Id: I942a5756052b1724803c2c9309511f51a1cf9660

Dockerfile
api/ics-api.json
api/ics-api.yaml
pom.xml
src/main/java/org/oransc/ics/SwaggerConfig.java
src/test/java/org/oransc/ics/ApplicationTest.java
src/test/java/org/oransc/ics/MockInformationService.java

index cc8813e..79c6380 100644 (file)
@@ -17,7 +17,7 @@
 # SPDX-License-Identifier: Apache-2.0
 # ============LICENSE_END=========================================================
 #
-FROM openjdk:11-jre-slim
+FROM openjdk:17-jdk-slim
 
 ARG JAR
 
index 722097b..db6d45e 100644 (file)
@@ -32,7 +32,6 @@
             "description": "Information for an EI type",
             "type": "object"
         },
-        "MonoResponseEntityObject": {"type": "object"},
         "authorization_result": {
             "description": "Result of authorization",
             "type": "object",
         }},
         "/actuator/threaddump": {"get": {
             "summary": "Actuator web endpoint 'threaddump'",
-            "operationId": "threaddump_2",
+            "operationId": "threaddump",
             "responses": {"200": {
                 "description": "OK",
-                "content": {"*/*": {"schema": {"type": "object"}}}
+                "content": {
+                    "text/plain;charset=UTF-8": {"schema": {"type": "object"}},
+                    "application/vnd.spring-boot.actuator.v3+json": {"schema": {"type": "object"}},
+                    "application/json": {"schema": {"type": "object"}},
+                    "application/vnd.spring-boot.actuator.v2+json": {"schema": {"type": "object"}}
+                }
             }},
             "tags": ["Actuator"]
         }},
             "operationId": "loggers",
             "responses": {"200": {
                 "description": "OK",
-                "content": {"*/*": {"schema": {"type": "object"}}}
+                "content": {
+                    "application/vnd.spring-boot.actuator.v3+json": {"schema": {"type": "object"}},
+                    "application/json": {"schema": {"type": "object"}},
+                    "application/vnd.spring-boot.actuator.v2+json": {"schema": {"type": "object"}}
+                }
             }},
             "tags": ["Actuator"]
         }},
             "operationId": "health-path",
             "responses": {"200": {
                 "description": "OK",
-                "content": {"*/*": {"schema": {"type": "object"}}}
+                "content": {
+                    "application/vnd.spring-boot.actuator.v3+json": {"schema": {"type": "object"}},
+                    "application/json": {"schema": {"type": "object"}},
+                    "application/vnd.spring-boot.actuator.v2+json": {"schema": {"type": "object"}}
+                }
             }},
             "tags": ["Actuator"]
         }},
             "operationId": "shutdown",
             "responses": {"200": {
                 "description": "OK",
-                "content": {"*/*": {"schema": {"type": "object"}}}
+                "content": {
+                    "application/vnd.spring-boot.actuator.v3+json": {"schema": {"type": "object"}},
+                    "application/json": {"schema": {"type": "object"}},
+                    "application/vnd.spring-boot.actuator.v2+json": {"schema": {"type": "object"}}
+                }
             }},
             "tags": ["Actuator"]
         }},
             "operationId": "metrics-requiredMetricName",
             "responses": {"200": {
                 "description": "OK",
-                "content": {"*/*": {"schema": {"type": "object"}}}
+                "content": {
+                    "application/vnd.spring-boot.actuator.v3+json": {"schema": {"type": "object"}},
+                    "application/json": {"schema": {"type": "object"}},
+                    "application/vnd.spring-boot.actuator.v2+json": {"schema": {"type": "object"}}
+                }
             }},
             "parameters": [{
                 "schema": {"type": "string"},
             "operationId": "links",
             "responses": {"200": {
                 "description": "OK",
-                "content": {"*/*": {"schema": {
-                    "additionalProperties": {
-                        "additionalProperties": {"$ref": "#/components/schemas/Link"},
+                "content": {
+                    "application/vnd.spring-boot.actuator.v3+json": {"schema": {
+                        "additionalProperties": {
+                            "additionalProperties": {"$ref": "#/components/schemas/Link"},
+                            "type": "object"
+                        },
                         "type": "object"
-                    },
-                    "type": "object"
-                }}}
+                    }},
+                    "application/json": {"schema": {
+                        "additionalProperties": {
+                            "additionalProperties": {"$ref": "#/components/schemas/Link"},
+                            "type": "object"
+                        },
+                        "type": "object"
+                    }},
+                    "application/vnd.spring-boot.actuator.v2+json": {"schema": {
+                        "additionalProperties": {
+                            "additionalProperties": {"$ref": "#/components/schemas/Link"},
+                            "type": "object"
+                        },
+                        "type": "object"
+                    }}
+                }
             }},
             "tags": ["Actuator"]
         }},
                 "operationId": "deleteJobsForOwner",
                 "responses": {"204": {
                     "description": "No Content",
-                    "content": {"application/json": {"schema": {"$ref": "#/components/schemas/MonoResponseEntityObject"}}}
+                    "content": {"application/json": {"schema": {"type": "object"}}}
                 }},
                 "parameters": [{
                     "schema": {"type": "string"},
         "/actuator/loggers/{name}": {
             "post": {
                 "summary": "Actuator web endpoint 'loggers-name'",
-                "operationId": "loggers-name",
+                "requestBody": {"content": {"application/json": {"schema": {
+                    "type": "string",
+                    "enum": [
+                        "TRACE",
+                        "DEBUG",
+                        "INFO",
+                        "WARN",
+                        "ERROR",
+                        "FATAL",
+                        "OFF"
+                    ]
+                }}}},
+                "operationId": "loggers-name_2",
                 "responses": {"200": {
                     "description": "OK",
                     "content": {"*/*": {"schema": {"type": "object"}}}
             },
             "get": {
                 "summary": "Actuator web endpoint 'loggers-name'",
-                "operationId": "loggers-name_2",
+                "operationId": "loggers-name",
                 "responses": {"200": {
                     "description": "OK",
-                    "content": {"*/*": {"schema": {"type": "object"}}}
+                    "content": {
+                        "application/vnd.spring-boot.actuator.v3+json": {"schema": {"type": "object"}},
+                        "application/json": {"schema": {"type": "object"}},
+                        "application/vnd.spring-boot.actuator.v2+json": {"schema": {"type": "object"}}
+                    }
                 }},
                 "parameters": [{
                     "schema": {"type": "string"},
             "operationId": "metrics",
             "responses": {"200": {
                 "description": "OK",
-                "content": {"*/*": {"schema": {"type": "object"}}}
+                "content": {
+                    "application/vnd.spring-boot.actuator.v3+json": {"schema": {"type": "object"}},
+                    "application/json": {"schema": {"type": "object"}},
+                    "application/vnd.spring-boot.actuator.v2+json": {"schema": {"type": "object"}}
+                }
             }},
             "tags": ["Actuator"]
         }},
             "operationId": "info",
             "responses": {"200": {
                 "description": "OK",
-                "content": {"*/*": {"schema": {"type": "object"}}}
+                "content": {
+                    "application/vnd.spring-boot.actuator.v3+json": {"schema": {"type": "object"}},
+                    "application/json": {"schema": {"type": "object"}},
+                    "application/vnd.spring-boot.actuator.v2+json": {"schema": {"type": "object"}}
+                }
             }},
             "tags": ["Actuator"]
         }},
             "operationId": "logfile",
             "responses": {"200": {
                 "description": "OK",
-                "content": {"*/*": {"schema": {"type": "object"}}}
+                "content": {"text/plain;charset=UTF-8": {"schema": {"type": "object"}}}
             }},
             "tags": ["Actuator"]
         }},
             "operationId": "health",
             "responses": {"200": {
                 "description": "OK",
-                "content": {"*/*": {"schema": {"type": "object"}}}
+                "content": {
+                    "application/vnd.spring-boot.actuator.v3+json": {"schema": {"type": "object"}},
+                    "application/json": {"schema": {"type": "object"}},
+                    "application/vnd.spring-boot.actuator.v2+json": {"schema": {"type": "object"}}
+                }
             }},
             "tags": ["Actuator"]
         }},
             "operationId": "heapdump",
             "responses": {"200": {
                 "description": "OK",
-                "content": {"*/*": {"schema": {"type": "object"}}}
+                "content": {"application/octet-stream": {"schema": {"type": "object"}}}
             }},
             "tags": ["Actuator"]
         }}
     },
     "info": {
         "license": {
-            "name": "Copyright (C) 2020-2022 Nordix Foundation. Licensed under the Apache License.",
+            "name": "Copyright (C) 2020-2023 Nordix Foundation. Licensed under the Apache License.",
             "url": "http://www.apache.org/licenses/LICENSE-2.0"
         },
         "description": "<h1>API documentation<\/h1><h2>General<\/h2><p>  The service is mainly a broker between data producers and data consumers. A data producer has the ability to produce one or several types of data (Information Type). One type of data can be produced by zero to many producers. <br /><br />A data consumer can have several active data subscriptions (Information Job). One Information Job consists of the type of data to produce and additional parameters for filtering of the data. These parameters are different for different data types.<\/p><h2>APIs provided by the service<\/h2><h4>A1-EI<\/h4><p>  This API is between Near-RT RIC and the Non-RT RIC.  The Near-RT RIC is a data consumer, which creates Information Jobs to subscribe for data.  In this context, the information is referred to as 'Enrichment Information', EI.<\/p><h4>Data producer API<\/h4><p>  This API is provided by the Non-RT RIC platform and is intended to be part of the O-RAN R1 interface.  The API is for use by different kinds of data producers and provides support for:<ul><li>Registry of supported information types and which parameters needed to setup a subscription.<\/li><li>Registry of existing data producers.<\/li><li>Callback API provided by producers to setup subscriptions.<\/li><\/ul><\/p><h4>Data consumer API<\/h4><p>  This API is provided by the Non-RT RIC platform and is intended to be part of the O-RAN R1 interface.  The API is for use by different kinds of data consumers and provides support for:<ul><li>Querying of available types of data to consume.<\/li><li>Management of data subscription jobs<\/li><li>Optional callback API provided by consumers to get notification on added and removed information types.<\/li><\/ul><\/p><h4>Service status<\/h4><p>  This API provides a means to monitor the health of this service.<\/p>",
index dad91b5..e7a0629 100644 (file)
@@ -24,7 +24,7 @@ info:
     added and removed information types.</li></ul></p><h4>Service status</h4><p>  This
     API provides a means to monitor the health of this service.</p>
   license:
-    name: Copyright (C) 2020-2022 Nordix Foundation. Licensed under the Apache License.
+    name: Copyright (C) 2020-2023 Nordix Foundation. Licensed under the Apache License.
     url: http://www.apache.org/licenses/LICENSE-2.0
   version: "1.0"
 servers:
@@ -73,12 +73,21 @@ paths:
       tags:
       - Actuator
       summary: Actuator web endpoint 'threaddump'
-      operationId: threaddump_2
+      operationId: threaddump
       responses:
         200:
           description: OK
           content:
-            '*/*':
+            text/plain;charset=UTF-8:
+              schema:
+                type: object
+            application/vnd.spring-boot.actuator.v3+json:
+              schema:
+                type: object
+            application/json:
+              schema:
+                type: object
+            application/vnd.spring-boot.actuator.v2+json:
               schema:
                 type: object
   /A1-EI/v1/eitypes/{eiTypeId}:
@@ -330,7 +339,13 @@ paths:
         200:
           description: OK
           content:
-            '*/*':
+            application/vnd.spring-boot.actuator.v3+json:
+              schema:
+                type: object
+            application/json:
+              schema:
+                type: object
+            application/vnd.spring-boot.actuator.v2+json:
               schema:
                 type: object
   /actuator/health/**:
@@ -343,7 +358,13 @@ paths:
         200:
           description: OK
           content:
-            '*/*':
+            application/vnd.spring-boot.actuator.v3+json:
+              schema:
+                type: object
+            application/json:
+              schema:
+                type: object
+            application/vnd.spring-boot.actuator.v2+json:
               schema:
                 type: object
   /data-consumer/v1/info-types:
@@ -393,7 +414,13 @@ paths:
         200:
           description: OK
           content:
-            '*/*':
+            application/vnd.spring-boot.actuator.v3+json:
+              schema:
+                type: object
+            application/json:
+              schema:
+                type: object
+            application/vnd.spring-boot.actuator.v2+json:
               schema:
                 type: object
   /actuator/metrics/{requiredMetricName}:
@@ -414,7 +441,13 @@ paths:
         200:
           description: OK
           content:
-            '*/*':
+            application/vnd.spring-boot.actuator.v3+json:
+              schema:
+                type: object
+            application/json:
+              schema:
+                type: object
+            application/vnd.spring-boot.actuator.v2+json:
               schema:
                 type: object
   /actuator:
@@ -427,7 +460,21 @@ paths:
         200:
           description: OK
           content:
-            '*/*':
+            application/vnd.spring-boot.actuator.v3+json:
+              schema:
+                type: object
+                additionalProperties:
+                  type: object
+                  additionalProperties:
+                    $ref: '#/components/schemas/Link'
+            application/json:
+              schema:
+                type: object
+                additionalProperties:
+                  type: object
+                  additionalProperties:
+                    $ref: '#/components/schemas/Link'
+            application/vnd.spring-boot.actuator.v2+json:
               schema:
                 type: object
                 additionalProperties:
@@ -494,13 +541,13 @@ paths:
           content:
             application/json:
               schema:
-                $ref: '#/components/schemas/MonoResponseEntityObject'
+                type: object
   /actuator/loggers/{name}:
     get:
       tags:
       - Actuator
       summary: Actuator web endpoint 'loggers-name'
-      operationId: loggers-name_2
+      operationId: loggers-name
       parameters:
       - name: name
         in: path
@@ -513,14 +560,20 @@ paths:
         200:
           description: OK
           content:
-            '*/*':
+            application/vnd.spring-boot.actuator.v3+json:
+              schema:
+                type: object
+            application/json:
+              schema:
+                type: object
+            application/vnd.spring-boot.actuator.v2+json:
               schema:
                 type: object
     post:
       tags:
       - Actuator
       summary: Actuator web endpoint 'loggers-name'
-      operationId: loggers-name
+      operationId: loggers-name_2
       parameters:
       - name: name
         in: path
@@ -529,6 +582,19 @@ paths:
         explode: false
         schema:
           type: string
+      requestBody:
+        content:
+          application/json:
+            schema:
+              type: string
+              enum:
+              - TRACE
+              - DEBUG
+              - INFO
+              - WARN
+              - ERROR
+              - FATAL
+              - OFF
       responses:
         200:
           description: OK
@@ -671,7 +737,13 @@ paths:
         200:
           description: OK
           content:
-            '*/*':
+            application/vnd.spring-boot.actuator.v3+json:
+              schema:
+                type: object
+            application/json:
+              schema:
+                type: object
+            application/vnd.spring-boot.actuator.v2+json:
               schema:
                 type: object
   /example-dataconsumer/info-jobs/{infoJobId}/status:
@@ -713,7 +785,13 @@ paths:
         200:
           description: OK
           content:
-            '*/*':
+            application/vnd.spring-boot.actuator.v3+json:
+              schema:
+                type: object
+            application/json:
+              schema:
+                type: object
+            application/vnd.spring-boot.actuator.v2+json:
               schema:
                 type: object
   /A1-EI/v1/eitypes:
@@ -994,7 +1072,7 @@ paths:
         200:
           description: OK
           content:
-            '*/*':
+            text/plain;charset=UTF-8:
               schema:
                 type: object
   /data-consumer/v1/info-jobs/{infoJobId}:
@@ -1170,7 +1248,13 @@ paths:
         200:
           description: OK
           content:
-            '*/*':
+            application/vnd.spring-boot.actuator.v3+json:
+              schema:
+                type: object
+            application/json:
+              schema:
+                type: object
+            application/vnd.spring-boot.actuator.v2+json:
               schema:
                 type: object
   /A1-EI/v1/eijobs:
@@ -1272,7 +1356,7 @@ paths:
         200:
           description: OK
           content:
-            '*/*':
+            application/octet-stream:
               schema:
                 type: object
 components:
@@ -1303,8 +1387,6 @@ components:
     EiTypeObject:
       type: object
       description: Information for an EI type
-    MonoResponseEntityObject:
-      type: object
     authorization_result:
       required:
       - result
diff --git a/pom.xml b/pom.xml
index 1e7b43a..f7daeee 100644 (file)
--- a/pom.xml
+++ b/pom.xml
@@ -26,7 +26,7 @@
     <parent>
         <groupId>org.springframework.boot</groupId>
         <artifactId>spring-boot-starter-parent</artifactId>
-        <version>2.7.6</version>
+        <version>3.0.2</version>
         <relativePath />
     </parent>
     <groupId>org.o-ran-sc.nonrtric.plt</groupId>
         </repository>
     </repositories>
     <properties>
-        <java.version>11</java.version>
-        <springfox.version>3.0.0</springfox.version>
+        <java.version>17</java.version>
         <gson.version>2.9.0</gson.version>
-        <swagger.version>2.1.13</swagger.version>
         <json.version>20211205</json.version>
         <maven-compiler-plugin.version>3.8.0</maven-compiler-plugin.version>
         <formatter-maven-plugin.version>2.12.2</formatter-maven-plugin.version>
         <swagger-codegen-maven-plugin.version>3.0.11</swagger-codegen-maven-plugin.version>
         <docker-maven-plugin>0.30.0</docker-maven-plugin>
         <sonar-maven-plugin.version>3.7.0.1746</sonar-maven-plugin.version>
-        <jacoco-maven-plugin.version>0.8.5</jacoco-maven-plugin.version>
+        <jacoco-maven-plugin.version>0.8.8</jacoco-maven-plugin.version>
+        <springdoc.version>2.0.2</springdoc.version>
         <exec.skip>true</exec.skip>
     </properties>
     <dependencies>
+        <dependency>
+            <groupId>org.springdoc</groupId>
+            <artifactId>springdoc-openapi-starter-webmvc-ui</artifactId>
+            <version>${springdoc.version}</version>
+        </dependency>
+        <dependency>
+            <groupId>org.springdoc</groupId>
+            <artifactId>springdoc-openapi-ui</artifactId>
+            <version>${springdoc.version}</version>
+        </dependency>
         <dependency>
             <groupId>org.springframework.boot</groupId>
             <artifactId>spring-boot-starter-web</artifactId>
             <groupId>org.springframework</groupId>
             <artifactId>spring-webflux</artifactId>
         </dependency>
-        <dependency>
-            <groupId>io.swagger.core.v3</groupId>
-            <artifactId>swagger-jaxrs2</artifactId>
-            <version>${swagger.version}</version>
-        </dependency>
-        <dependency>
-            <groupId>io.swagger.core.v3</groupId>
-            <artifactId>swagger-jaxrs2-servlet-initializer</artifactId>
-            <version>${swagger.version}</version>
-        </dependency>
         <dependency>
             <groupId>com.google.code.gson</groupId>
             <artifactId>gson</artifactId>
             <groupId>org.springframework.boot</groupId>
             <artifactId>spring-boot-starter-actuator</artifactId>
         </dependency>
-        <!--REQUIRED TO GENERATE DOCUMENTATION -->
-        <dependency>
-            <groupId>io.springfox</groupId>
-            <artifactId>springfox-swagger2</artifactId>
-            <version>${springfox.version}</version>
-        </dependency>
-        <dependency>
-            <groupId>io.springfox</groupId>
-            <artifactId>springfox-swagger-ui</artifactId>
-            <version>${springfox.version}</version>
-        </dependency>
         <!-- For development help -->
         <dependency>
             <groupId>org.springframework.boot</groupId>
index 30c0d4a..08f3bec 100644 (file)
@@ -36,7 +36,7 @@ import io.swagger.v3.oas.annotations.info.License;
         version = "1.0", //
         description = SwaggerConfig.DESCRIPTION, //
         license = @License(
-            name = "Copyright (C) 2020-2022 Nordix Foundation. Licensed under the Apache License.",
+            name = "Copyright (C) 2020-2023 Nordix Foundation. Licensed under the Apache License.",
             url = "http://www.apache.org/licenses/LICENSE-2.0")))
 public class SwaggerConfig {
     private SwaggerConfig() {
index d3814b5..8ddba05 100644 (file)
@@ -96,6 +96,7 @@ import org.springframework.boot.web.servlet.server.ServletWebServerFactory;
 import org.springframework.context.ApplicationContext;
 import org.springframework.context.annotation.Bean;
 import org.springframework.http.HttpStatus;
+import org.springframework.http.HttpStatusCode;
 import org.springframework.http.MediaType;
 import org.springframework.http.ResponseEntity;
 import org.springframework.test.context.TestPropertySource;
@@ -1419,7 +1420,7 @@ class ApplicationTest {
         return this.infoJobs.getJob(jobId);
     }
 
-    private HttpStatus putInfoType(String infoTypeId)
+    private HttpStatusCode putInfoType(String infoTypeId)
         throws JsonMappingException, JsonProcessingException, ServiceException {
         String url = ProducerConsts.API_ROOT + "/info-types/" + infoTypeId;
         String body = gson.toJson(ProducerInfoTypeRegistrationInfo(infoTypeId));
index 7d09a6a..caff3e2 100644 (file)
@@ -32,7 +32,9 @@ import org.springframework.test.context.TestPropertySource;
 @TestPropertySource(
     properties = { //
         "server.ssl.key-store=./config/keystore.jks", //
-        "app.webclient.trust-store=./config/truststore.jks", "app.vardata-directory=./target"})
+        "app.webclient.trust-store=./config/truststore.jks", //
+        "app.vardata-directory=./target" //
+    })
 @SuppressWarnings("squid:S3577") // Not containing any tests since it is a mock.
 class MockInformationService {
     private static final Logger logger = LoggerFactory.getLogger(ApplicationTest.class);