From 436a8dc7b4241b685d3f483a5d64b9f4b2000cb5 Mon Sep 17 00:00:00 2001 From: sourabh_sourabh Date: Tue, 12 Nov 2024 13:12:02 +0000 Subject: Fixed the java code checkstyle configuration and jacoco report - Removed oParent dependency. - pulled cps checkstyle and applied for all dmi modules for code style check and copyright. - Ignored checkstyle folder for to be commited. - Fixed java code styles. - Added missing plugins and configurations for jacoco report. - Configured deply plugin and related onap properties. - Temporarily disabled CSIT. Issue-ID: CPS-2471 Change-Id: I5a26c2a156b93c3e58c5c42814f1dff85831d4df Signed-off-by: sourabh_sourabh --- .gitignore | 1 + csit/plans/dmi/testplan.txt | 4 +- dmi-service/pom.xml | 119 +++++++++++++-- .../ncmp/dmi/exception/DmiExceptionHandler.java | 2 +- .../ncmp/dmi/service/client/NcmpRestClient.java | 6 +- .../ncmp/dmi/service/operation/SdncOperations.java | 2 +- dmi-stub/dmi-plugin-demo-and-csit-stub-app/pom.xml | 68 +++++++++ .../dmi-plugin-demo-and-csit-stub-service/pom.xml | 22 ++- dmi-stub/pom.xml | 7 +- pom.xml | 161 +++++++++++---------- 10 files changed, 288 insertions(+), 104 deletions(-) diff --git a/.gitignore b/.gitignore index a6e8081e..4170cafe 100644 --- a/.gitignore +++ b/.gitignore @@ -7,6 +7,7 @@ target/ log/ +checkstyle/ .idea/ .idea_modules/ diff --git a/csit/plans/dmi/testplan.txt b/csit/plans/dmi/testplan.txt index cc29ac0c..54937ac1 100644 --- a/csit/plans/dmi/testplan.txt +++ b/csit/plans/dmi/testplan.txt @@ -16,5 +16,5 @@ # Test suites are relative paths under csit/tests/. # Place the suites in run order. -actuator -dmi-integration \ No newline at end of file +# actuator +# dmi-integration \ No newline at end of file diff --git a/dmi-service/pom.xml b/dmi-service/pom.xml index 306d6118..6e740e8d 100644 --- a/dmi-service/pom.xml +++ b/dmi-service/pom.xml @@ -20,6 +20,7 @@ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> 4.0.0 + org.onap.cps ncmp-dmi-plugin @@ -29,7 +30,29 @@ dmi-service + + org.onap.cps.ncmp.dmi.Application + + ncmp-dmi-plugin + + UTF-8 + + + ${project.parent.basedir} + + + 1.5.0 + 4.0.1 + 3.3.1 + 6.6.0 + 3.1.2 + 4.4.2 + + + ${basedir}/target/code-coverage/jacoco-ut.exec 0.98 + ${project.reporting.outputDirectory}/jacoco-ut + 0.8.11 @@ -237,6 +260,7 @@ org.onap.cps cps-ncmp-events + ${cps.version} org.projectlombok @@ -289,6 +313,7 @@ test + @@ -313,7 +338,7 @@ org.openapitools openapi-generator-maven-plugin - 6.6.0 + ${openapi.generator.maven.plugin.version} dmi-code-gen @@ -396,7 +421,7 @@ org.springframework.boot spring-boot-maven-plugin - 3.1.2 + ${spring.boot.maven.plugin.version} @@ -409,7 +434,7 @@ org.codehaus.gmavenplus gmavenplus-plugin - 4.0.1 + ${gmavenplus.plugin.version} @@ -421,6 +446,7 @@ org.apache.maven.plugins maven-surefire-plugin + ${maven.surefire.plugin.version} ${surefireArgLine} @@ -442,7 +468,7 @@ com.github.spotbugs spotbugs-maven-plugin - 4.4.2 + ${spotbugs.maven.plugin.version} analyze-compile @@ -465,7 +491,7 @@ jp.skypencil.findbugs.slf4j bug-pattern - 1.5.0 + ${bug.pattern.version} Max @@ -480,7 +506,7 @@ org.jacoco jacoco-maven-plugin - 0.8.10 + ${jacoco.version} org/onap/cps/ncmp/dmi/model/* @@ -493,14 +519,19 @@ prepare-agent + + ${jacoco.execFile} + surefireArgLine + coverage-check + test check - ${basedir}/target/code-coverage/jacoco-ut.exec + ${jacoco.execFile} BUNDLE @@ -516,19 +547,81 @@ - report - verify + post-unit-test + test - report-aggregate + report - - **/code-coverage/jacoco-ut.exec - + ${project.reporting.outputEncoding} + + ${jacoco.execFile} + + ${jacoco.outputDirectory} + + + + com.google.cloud.tools + jib-maven-plugin + 3.3.2 + + + ${app} + USE_CURRENT_TIMESTAMP + + + ${base.image} + + + + latest + ${project.version}-latest + + ${docker.push.registry}/onap/${image.name}:${image.tag} + + + + + package + build + + dockerBuild + + + + deploy + buildAndPush + + build + + + + + + + + + docker + + true + + + ncmp-dmi-plugin + + + + + com.google.cloud.tools + jib-maven-plugin + + + + + \ No newline at end of file diff --git a/dmi-service/src/main/java/org/onap/cps/ncmp/dmi/exception/DmiExceptionHandler.java b/dmi-service/src/main/java/org/onap/cps/ncmp/dmi/exception/DmiExceptionHandler.java index 49db7d8b..4e75f495 100644 --- a/dmi-service/src/main/java/org/onap/cps/ncmp/dmi/exception/DmiExceptionHandler.java +++ b/dmi-service/src/main/java/org/onap/cps/ncmp/dmi/exception/DmiExceptionHandler.java @@ -58,7 +58,7 @@ public class DmiExceptionHandler { private static ResponseEntity buildErrorResponse(final HttpStatus httpStatus, final Exception exception) { logForNonDmiException(exception); - final var errorMessage = new ErrorMessage(); + final ErrorMessage errorMessage = new ErrorMessage(); errorMessage.setStatus(httpStatus.toString()); errorMessage.setMessage(exception.getMessage()); errorMessage.setDetails(exception instanceof DmiException ? ((DmiException) exception).getDetails() : diff --git a/dmi-service/src/main/java/org/onap/cps/ncmp/dmi/service/client/NcmpRestClient.java b/dmi-service/src/main/java/org/onap/cps/ncmp/dmi/service/client/NcmpRestClient.java index 94783f3b..a2a01ebd 100644 --- a/dmi-service/src/main/java/org/onap/cps/ncmp/dmi/service/client/NcmpRestClient.java +++ b/dmi-service/src/main/java/org/onap/cps/ncmp/dmi/service/client/NcmpRestClient.java @@ -47,11 +47,11 @@ public class NcmpRestClient { * @return the response entity */ public ResponseEntity registerCmHandlesWithNcmp(final String jsonData) { - final var ncmpRegistrationUrl = buildNcmpRegistrationUrl(); - final var httpHeaders = new HttpHeaders(); + final String ncmpRegistrationUrl = buildNcmpRegistrationUrl(); + final HttpHeaders httpHeaders = new HttpHeaders(); httpHeaders.setBasicAuth(cpsProperties.getAuthUsername(), cpsProperties.getAuthPassword()); httpHeaders.set(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON_VALUE); - final var httpEntity = new HttpEntity<>(jsonData, httpHeaders); + final HttpEntity httpEntity = new HttpEntity<>(jsonData, httpHeaders); return restTemplate.exchange(ncmpRegistrationUrl, HttpMethod.POST, httpEntity, String.class); } diff --git a/dmi-service/src/main/java/org/onap/cps/ncmp/dmi/service/operation/SdncOperations.java b/dmi-service/src/main/java/org/onap/cps/ncmp/dmi/service/operation/SdncOperations.java index fd94e634..1484366f 100644 --- a/dmi-service/src/main/java/org/onap/cps/ncmp/dmi/service/operation/SdncOperations.java +++ b/dmi-service/src/main/java/org/onap/cps/ncmp/dmi/service/operation/SdncOperations.java @@ -234,7 +234,7 @@ public class SdncOperations { private List convertToModuleSchemas(final String modulesListAsJson) { try { return JsonPath.using(jsonPathConfiguration).parse(modulesListAsJson).read( - PATH_TO_MODULE_SCHEMAS, new TypeRef<>() { + PATH_TO_MODULE_SCHEMAS, new TypeRef>() { }); } catch (final JsonPathException jsonPathException) { throw new SdncException("SDNC Response processing failed", diff --git a/dmi-stub/dmi-plugin-demo-and-csit-stub-app/pom.xml b/dmi-stub/dmi-plugin-demo-and-csit-stub-app/pom.xml index 4da597ba..830736b3 100644 --- a/dmi-stub/dmi-plugin-demo-and-csit-stub-app/pom.xml +++ b/dmi-stub/dmi-plugin-demo-and-csit-stub-app/pom.xml @@ -19,6 +19,7 @@ 4.0.0 + org.onap.cps dmi-plugin-demo-and-csit-stub @@ -27,6 +28,10 @@ dmi-plugin-demo-and-csit-stub-app + + org.onap.cps.ncmp.dmi.rest.stub.DmiDemoApplication + + org.springframework.boot @@ -58,4 +63,67 @@ + + + + + + com.google.cloud.tools + jib-maven-plugin + + + ${app} + USE_CURRENT_TIMESTAMP + + + ${base.image} + + + + latest + + ${docker.push.registry}/onap/${image.name}:${image.tag} + + + + + package + build + + dockerBuild + + + + deploy + buildAndPush + + build + + + + + + + + + + + docker + + true + + + dmi-plugin-demo-and-csit-stub + + + + + com.google.cloud.tools + jib-maven-plugin + 3.3.2 + + + + + \ No newline at end of file diff --git a/dmi-stub/dmi-plugin-demo-and-csit-stub-service/pom.xml b/dmi-stub/dmi-plugin-demo-and-csit-stub-service/pom.xml index 5e2886e5..82ebd24f 100644 --- a/dmi-stub/dmi-plugin-demo-and-csit-stub-service/pom.xml +++ b/dmi-stub/dmi-plugin-demo-and-csit-stub-service/pom.xml @@ -19,6 +19,7 @@ 4.0.0 + org.onap.cps dmi-plugin-demo-and-csit-stub @@ -27,6 +28,13 @@ dmi-plugin-demo-and-csit-stub-service + + 4.0.1 + 3.13.0 + 17 + 17 + + ch.qos.logback @@ -91,7 +99,7 @@ org.onap.cps cps-ncmp-events - 3.5.2 + ${cps.version} org.springframework.boot @@ -132,10 +140,20 @@ + + org.apache.maven.plugins + maven-compiler-plugin + ${maven.compiler.plugin.version} + + ${project.build.sourceEncoding} + 17 + 17 + + org.codehaus.gmavenplus gmavenplus-plugin - 4.0.1 + ${gmavenplus.plugin.version} diff --git a/dmi-stub/pom.xml b/dmi-stub/pom.xml index 64df918e..fdd01089 100644 --- a/dmi-stub/pom.xml +++ b/dmi-stub/pom.xml @@ -19,6 +19,7 @@ 4.0.0 + org.onap.cps ncmp-dmi-plugin @@ -31,22 +32,24 @@ - true + ../ true 17 17 + true dmi-plugin-demo-and-csit-stub-service dmi-plugin-demo-and-csit-stub-app + org.onap.cps cps-dependencies - 3.5.1 + ${cps.version} pom import diff --git a/pom.xml b/pom.xml index e89e1f8f..7669a92d 100644 --- a/pom.xml +++ b/pom.xml @@ -24,17 +24,13 @@ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd"> 4.0.0 - - org.onap.oparent - oparent - 3.3.0 - - + pom ONAP - CPS http://www.onap.org/ + dmi-service dmi-stub @@ -46,55 +42,86 @@ DMI Plugin Service - 3.5.2 + + UTF-8 + + org.onap.cps.ncmp.dmi.Application ${docker.pull.registry}/onap/integration-java17:12.0.0 + ncmp-dmi-plugin ${project.version}-${maven.build.timestamp} + + + 3.5.5-SNAPSHOT yyyyMMdd'T'HHmmss'Z' - UTF-8 - ncmp-dmi-plugin + + + ${project.basedir} + 3.3.1 + 3.13.0 + 17 + 17 + 3.7.1 + 3.1.2 + + + https://nexus.onap.org + https://nexus.onap.org + /content/repositories/releases/ + /content/repositories/snapshots/ - + org.apache.maven.plugins - maven-checkstyle-plugin + maven-dependency-plugin + ${maven.dependency.plugin.version} - onap-license + unpack-checkstyle-config + initialize - check + unpack - process-sources - onap-checkstyle/check-license.xml - false - true - false - - ${project.build.sourceDirectory} - - false - warning - true + + + ${project.groupId} + checkstyle + ${cps.version} + jar + true + ${project.basedir}/checkstyle + cps-checkstyle/** + + + false + + + + + org.apache.maven.plugins + maven-checkstyle-plugin + ${maven.checkstyle.plugin.version} + - onap-java-style + onap-license check process-sources - onap-checkstyle/onap-java-style.xml + ${checkstyle.config.location}/checkstyle/cps-checkstyle/check-license.xml + true + true + false ${project.build.sourceDirectory} - true - true - true false warning true @@ -107,14 +134,14 @@ process-sources - cps-java-style.xml + ${checkstyle.config.location}/checkstyle/cps-checkstyle/cps-java-style.xml ${project.build.sourceDirectory} true true true - true + false warning true @@ -128,66 +155,40 @@ + + org.apache.maven.plugins + maven-deploy-plugin + ${maven.deploy.plugin.version} + - com.google.cloud.tools - jib-maven-plugin - 3.3.2 + org.apache.maven.plugins + maven-compiler-plugin + ${maven.compiler.plugin.version} - - ${app} - USE_CURRENT_TIMESTAMP - - - ${base.image} - - - - latest - ${project.version}-latest - - ${docker.push.registry}/onap/${image.name}:${image.tag} - + ${project.build.sourceEncoding} + 17 + 17 - - - package - build - - dockerBuild - - - - deploy - buildAndPush - - build - - - - - - docker - - true - - - - - com.google.cloud.tools - jib-maven-plugin - - - - - + + + ecomp-releases + ECOMP Release Repository + ${onap.nexus.url}${releaseNexusPath} + + + ecomp-snapshots + ECOMP Snapshot Repository + ${onap.nexus.url}${snapshotNexusPath} + + -- cgit 1.2.3-korg