aboutsummaryrefslogtreecommitdiffstats
path: root/cps-tbdmt-rest
diff options
context:
space:
mode:
authoregernug <gerard.nugent@est.tech>2023-10-31 16:05:35 +0000
committeregernug <gerard.nugent@est.tech>2023-10-31 16:05:35 +0000
commit4e3e0c14f614f9d3486b90b235a778e583cd763b (patch)
tree41310db3c447949093b2ce2928814bf20b6958b0 /cps-tbdmt-rest
parent8ae32a8b0c161905b8534c2d1f96257ffa4af9e4 (diff)
TBDMT Package Upgrades
- Java 17 - Springboot 3.1.2 - Fixed code where needed because of dependency updates Issue-ID: CPS-1911 Signed-off-by: egernug <gerard.nugent@est.tech> Change-Id: Ie0c474c720e408a9b325cec6c4a11f259b3d4102
Diffstat (limited to 'cps-tbdmt-rest')
-rw-r--r--cps-tbdmt-rest/pom.xml52
-rw-r--r--cps-tbdmt-rest/src/main/java/org/onap/cps/tbdmt/exception/TemplateExceptionHandler.java38
-rw-r--r--cps-tbdmt-rest/src/main/java/org/onap/cps/tbdmt/rest/ExecutionController.java39
-rw-r--r--cps-tbdmt-rest/src/main/java/org/onap/cps/tbdmt/rest/TemplateController.java35
4 files changed, 71 insertions, 93 deletions
diff --git a/cps-tbdmt-rest/pom.xml b/cps-tbdmt-rest/pom.xml
index 8327d33..5ffcc84 100644
--- a/cps-tbdmt-rest/pom.xml
+++ b/cps-tbdmt-rest/pom.xml
@@ -29,15 +29,12 @@
<artifactId>cps-tbdmt-rest</artifactId>
- <properties>
- <jetty.version>11.0.12</jetty.version>
- </properties>
-
<dependencies>
<dependency>
<groupId>${project.groupId}</groupId>
<artifactId>cps-tbdmt-service</artifactId>
</dependency>
+ <!-- S P R I N G D E P E N D E N C I E S -->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
@@ -50,51 +47,28 @@
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
- <artifactId>spring-boot-starter-jetty</artifactId>
- <version>2.5.5</version>
- <exclusions>
- <exclusion>
- <groupId>org.eclipse.jetty</groupId>
- <artifactId>jetty-io</artifactId>
- </exclusion>
- <exclusion>
- <groupId>org.eclipse.jetty</groupId>
- <artifactId>jetty-servlets</artifactId>
- </exclusion>
- <exclusion>
- <groupId>org.eclipse.jetty</groupId>
- <artifactId>jetty-http</artifactId>
- </exclusion>
- <exclusion>
- <groupId>org.glassfish</groupId>
- <artifactId>jakarta.el</artifactId>
- </exclusion>
- </exclusions>
+ <artifactId>spring-boot-starter-validation</artifactId>
</dependency>
<dependency>
- <groupId>org.eclipse.jetty</groupId>
- <artifactId>jetty-io</artifactId>
- <version>${jetty.version}</version>
- </dependency>
- <dependency>
- <groupId>org.eclipse.jetty</groupId>
- <artifactId>jetty-servlets</artifactId>
- <version>${jetty.version}</version>
- </dependency>
- <dependency>
- <groupId>org.eclipse.jetty</groupId>
- <artifactId>jetty-http</artifactId>
- <version>${jetty.version}</version>
+ <groupId>org.springframework.boot</groupId>
+ <artifactId>spring-boot-starter-jetty</artifactId>
</dependency>
+ <!-- T E S T - D E P E N D E N C I E S -->
<dependency>
- <groupId>junit</groupId>
- <artifactId>junit</artifactId>
+ <groupId>org.junit.vintage</groupId>
+ <artifactId>junit-vintage-engine</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.jupiter</groupId>
+ <artifactId>junit-jupiter</artifactId>
+ </exclusion>
+ </exclusions>
</dependency>
</dependencies>
</project>
diff --git a/cps-tbdmt-rest/src/main/java/org/onap/cps/tbdmt/exception/TemplateExceptionHandler.java b/cps-tbdmt-rest/src/main/java/org/onap/cps/tbdmt/exception/TemplateExceptionHandler.java
index fa6fa28..d20e9f3 100644
--- a/cps-tbdmt-rest/src/main/java/org/onap/cps/tbdmt/exception/TemplateExceptionHandler.java
+++ b/cps-tbdmt-rest/src/main/java/org/onap/cps/tbdmt/exception/TemplateExceptionHandler.java
@@ -1,21 +1,22 @@
-/*-
- * ============LICENSE_START=======================================================
- * ONAP
- * ================================================================================
- * Copyright (C) 2021 Wipro Limited.
- * ================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
+/*
+ * ============LICENSE_START=======================================================
+ * Copyright (C) 2021 Wipro Limited.
+ * Modifications Copyright (C) 2023 Nordix Foundation
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
*
- * http://www.apache.org/licenses/LICENSE-2.0
+ * http://www.apache.org/licenses/LICENSE-2.0
*
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- * ============LICENSE_END=========================================================
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ * SPDX-License-Identifier: Apache-2.0
+ * ============LICENSE_END=========================================================
*/
package org.onap.cps.tbdmt.exception;
@@ -25,6 +26,7 @@ import java.util.List;
import org.onap.cps.tbdmt.model.ErrorResponse;
import org.springframework.http.HttpHeaders;
import org.springframework.http.HttpStatus;
+import org.springframework.http.HttpStatusCode;
import org.springframework.http.ResponseEntity;
import org.springframework.validation.ObjectError;
import org.springframework.web.bind.MethodArgumentNotValidException;
@@ -70,8 +72,8 @@ public class TemplateExceptionHandler extends ResponseEntityExceptionHandler {
@Override
protected ResponseEntity<Object> handleMethodArgumentNotValid(
- final MethodArgumentNotValidException methodArgumentNotValidException, final HttpHeaders httpHeaders,
- final HttpStatus httpStatus, final WebRequest webRequest) {
+ final MethodArgumentNotValidException methodArgumentNotValidException, final HttpHeaders httpHeaders,
+ final HttpStatusCode httpStatus, final WebRequest webRequest) {
final List<String> details = new ArrayList<>();
for (final ObjectError objectError : methodArgumentNotValidException.getBindingResult().getAllErrors()) {
details.add(objectError.getDefaultMessage());
diff --git a/cps-tbdmt-rest/src/main/java/org/onap/cps/tbdmt/rest/ExecutionController.java b/cps-tbdmt-rest/src/main/java/org/onap/cps/tbdmt/rest/ExecutionController.java
index b7dc4f6..2d717ae 100644
--- a/cps-tbdmt-rest/src/main/java/org/onap/cps/tbdmt/rest/ExecutionController.java
+++ b/cps-tbdmt-rest/src/main/java/org/onap/cps/tbdmt/rest/ExecutionController.java
@@ -1,26 +1,27 @@
-/*-
- * ============LICENSE_START=======================================================
- * ONAP
- * ================================================================================
- * Copyright (C) 2021 Wipro Limited.
- * ================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
+/*
+ * ============LICENSE_START=======================================================
+ * Copyright (C) 2021 Wipro Limited.
+ * Modifications Copyright (C) 2023 Nordix Foundation
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
*
- * http://www.apache.org/licenses/LICENSE-2.0
+ * http://www.apache.org/licenses/LICENSE-2.0
*
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- * ============LICENSE_END=========================================================
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ * SPDX-License-Identifier: Apache-2.0
+ * ============LICENSE_END=========================================================
*/
package org.onap.cps.tbdmt.rest;
-import javax.validation.Valid;
+import jakarta.validation.Valid;
import org.onap.cps.tbdmt.model.ExecutionRequest;
import org.onap.cps.tbdmt.service.ExecutionBusinessLogic;
import org.springframework.beans.factory.annotation.Autowired;
@@ -47,8 +48,8 @@ public class ExecutionController {
*/
@PostMapping(path = "/execute/{model}/{templateId}")
public ResponseEntity<String> executeTemplate(@Valid @PathVariable final String model,
- @Valid @PathVariable final String templateId,
- @Valid @RequestBody final ExecutionRequest executionRequest) {
+ @Valid @PathVariable final String templateId,
+ @Valid @RequestBody final ExecutionRequest executionRequest) {
final String result = executionBusinessLogic.executeTemplate(model, templateId, executionRequest);
return new ResponseEntity<>(result, HttpStatus.OK);
}
diff --git a/cps-tbdmt-rest/src/main/java/org/onap/cps/tbdmt/rest/TemplateController.java b/cps-tbdmt-rest/src/main/java/org/onap/cps/tbdmt/rest/TemplateController.java
index a17130f..cdb5f9c 100644
--- a/cps-tbdmt-rest/src/main/java/org/onap/cps/tbdmt/rest/TemplateController.java
+++ b/cps-tbdmt-rest/src/main/java/org/onap/cps/tbdmt/rest/TemplateController.java
@@ -1,27 +1,28 @@
-/*-
- * ============LICENSE_START=======================================================
- * ONAP
- * ================================================================================
- * Copyright (C) 2021 Wipro Limited.
- * ================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
+/*
+ * ============LICENSE_START=======================================================
+ * Copyright (C) 2021 Wipro Limited.
+ * Modifications Copyright (C) 2023 Nordix Foundation
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
*
- * http://www.apache.org/licenses/LICENSE-2.0
+ * http://www.apache.org/licenses/LICENSE-2.0
*
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- * ============LICENSE_END=========================================================
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ * SPDX-License-Identifier: Apache-2.0
+ * ============LICENSE_END=========================================================
*/
package org.onap.cps.tbdmt.rest;
+import jakarta.validation.Valid;
import java.util.Collection;
-import javax.validation.Valid;
import org.onap.cps.tbdmt.exception.TemplateNotFoundException;
import org.onap.cps.tbdmt.model.Template;
import org.onap.cps.tbdmt.model.TemplateKey;