From 9eeb8e9641163e1c7fc9bba85fedaa965a5d7e2f Mon Sep 17 00:00:00 2001 From: sourabh_sourabh Date: Thu, 24 Oct 2024 14:24:54 +0100 Subject: Removing ONAP O-Parent as parent from CPS - Fixed checkstyle and license validation. - Updated checkstyle configuration (`onap-java-style.xml` and `check-license.xml`) to ensure compatibility with Maven Checkstyle Plugin version 3.3.1 - Removed obsolete properties causing build failures. - Improved code style rules to meet ONAP Java guidelines. - Vulnerabilities scan are now configured on parent pom.xml - Fixed all code style. Issue-ID: CPS-2470 Change-Id: I1e72af604415aa7587cbe1dff471ed0323e29aa3 Signed-off-by: sourabh_sourabh --- .../src/main/resources/apache-license-2.regexp.txt | 15 + .../resources/cps-checkstyle/check-license.xml | 38 +++ .../resources/cps-checkstyle/cps-java-style.xml | 342 +++++++++++++++++++++ checkstyle/src/main/resources/cps-java-style.xml | 35 --- cps-ncmp-rest/pom.xml | 2 + .../onap/cps/ncmp/rest/util/DeprecationHelper.java | 17 +- .../impl/utils/http/WebClientConfiguration.java | 2 +- cps-parent/pom.xml | 210 ++++++++----- .../java/org/onap/cps/api/CpsModuleService.java | 4 +- pom.xml | 7 +- 10 files changed, 542 insertions(+), 130 deletions(-) create mode 100644 checkstyle/src/main/resources/apache-license-2.regexp.txt create mode 100644 checkstyle/src/main/resources/cps-checkstyle/check-license.xml create mode 100644 checkstyle/src/main/resources/cps-checkstyle/cps-java-style.xml delete mode 100644 checkstyle/src/main/resources/cps-java-style.xml diff --git a/checkstyle/src/main/resources/apache-license-2.regexp.txt b/checkstyle/src/main/resources/apache-license-2.regexp.txt new file mode 100644 index 0000000000..80f7be3fd8 --- /dev/null +++ b/checkstyle/src/main/resources/apache-license-2.regexp.txt @@ -0,0 +1,15 @@ +^/[*]+$ +^ \* Copyright .*$ +^ \*( )?$ +^ \* 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$ +^ \*( )?$ +^ \* 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. +^ [*]+/$ \ No newline at end of file diff --git a/checkstyle/src/main/resources/cps-checkstyle/check-license.xml b/checkstyle/src/main/resources/cps-checkstyle/check-license.xml new file mode 100644 index 0000000000..a19dbe98e8 --- /dev/null +++ b/checkstyle/src/main/resources/cps-checkstyle/check-license.xml @@ -0,0 +1,38 @@ + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/checkstyle/src/main/resources/cps-checkstyle/cps-java-style.xml b/checkstyle/src/main/resources/cps-checkstyle/cps-java-style.xml new file mode 100644 index 0000000000..6e1664a4a3 --- /dev/null +++ b/checkstyle/src/main/resources/cps-checkstyle/cps-java-style.xml @@ -0,0 +1,342 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/checkstyle/src/main/resources/cps-java-style.xml b/checkstyle/src/main/resources/cps-java-style.xml deleted file mode 100644 index d10484c31e..0000000000 --- a/checkstyle/src/main/resources/cps-java-style.xml +++ /dev/null @@ -1,35 +0,0 @@ - - - - - - - - - - - - - - - - diff --git a/cps-ncmp-rest/pom.xml b/cps-ncmp-rest/pom.xml index c78fe55a59..681d1e52b4 100644 --- a/cps-ncmp-rest/pom.xml +++ b/cps-ncmp-rest/pom.xml @@ -35,6 +35,7 @@ 0.99 + 3.2.0 @@ -211,6 +212,7 @@ org.apache.maven.plugins maven-resources-plugin + ${maven-resources-plugin.version} copy-resources diff --git a/cps-ncmp-rest/src/main/java/org/onap/cps/ncmp/rest/util/DeprecationHelper.java b/cps-ncmp-rest/src/main/java/org/onap/cps/ncmp/rest/util/DeprecationHelper.java index 7492c1fcac..f5804d73ad 100644 --- a/cps-ncmp-rest/src/main/java/org/onap/cps/ncmp/rest/util/DeprecationHelper.java +++ b/cps-ncmp-rest/src/main/java/org/onap/cps/ncmp/rest/util/DeprecationHelper.java @@ -36,13 +36,19 @@ public class DeprecationHelper { private final JsonObjectMapper jsonObjectMapper; /** - * Convert the old condition properties to the new schema. - * !!! remove it after the old condition removed !!! - * it only works for module names + * Converts the old condition properties from {@link CmHandleQueryParameters} + * to the new schema defined in {@link CmHandleQueryApiParameters}. * - * @deprecated this method will be removed in Release 12 (No Name know yet) + *

This method transforms the old module name-based condition properties to the new format. + * It should only be used for backward compatibility until the old conditions + * are removed in future releases. * - * @param cmHandleQueryParameters the original input parameter + *

Important: This method will be removed in next release(release name not finalized yet).

+ * + * @param cmHandleQueryParameters the original query parameters containing old condition properties + * @return an instance of {@link CmHandleQueryApiParameters} with the transformed condition properties + * @deprecated This method is deprecated and will be removed in Release 12. + * Use the new condition handling approach instead. */ @Deprecated public CmHandleQueryApiParameters mapOldConditionProperties( @@ -69,7 +75,6 @@ public class DeprecationHelper { } ); } - return cmHandleQueryApiParameters; } } diff --git a/cps-ncmp-service/src/main/java/org/onap/cps/ncmp/impl/utils/http/WebClientConfiguration.java b/cps-ncmp-service/src/main/java/org/onap/cps/ncmp/impl/utils/http/WebClientConfiguration.java index 8ae942eb7b..eefabd1079 100644 --- a/cps-ncmp-service/src/main/java/org/onap/cps/ncmp/impl/utils/http/WebClientConfiguration.java +++ b/cps-ncmp-service/src/main/java/org/onap/cps/ncmp/impl/utils/http/WebClientConfiguration.java @@ -57,7 +57,7 @@ public class WebClientConfiguration { .option(ChannelOption.CONNECT_TIMEOUT_MILLIS, serviceConfig.getConnectionTimeoutInSeconds() * 1000) .doOnConnected(connection -> connection.addHandlerLast(new ReadTimeoutHandler( serviceConfig.getReadTimeoutInSeconds(), TimeUnit.SECONDS)).addHandlerLast( - new WriteTimeoutHandler(serviceConfig.getWriteTimeoutInSeconds(), TimeUnit.SECONDS))) + new WriteTimeoutHandler(serviceConfig.getWriteTimeoutInSeconds(), TimeUnit.SECONDS))) .resolver(DefaultAddressResolverGroup.INSTANCE) .compress(true); } diff --git a/cps-parent/pom.xml b/cps-parent/pom.xml index a83278d6cd..6776008acf 100644 --- a/cps-parent/pom.xml +++ b/cps-parent/pom.xml @@ -22,33 +22,76 @@ - - org.onap.oparent - oparent - 3.2.0 - - - 4.0.0 + + 4.0.0 org.onap.cps cps-parent 3.5.5-SNAPSHOT pom + + UTF-8 + + org.onap.cps.Application + + + ${project.basedir}/.. + + + 1.5.0 + 9.2.0 + 9.0.0 + 4.0.1 + 0.8.11 17 - 1.00 + 1.2.1 + 3.3.1 + 3.13.0 + 17 + 4.0.0-M13 + 3.2.5 42.5.1 + 2.0.6 + 4.0.0.4121 + 4.8.6.4 + 4.8.6 + 3.2.4 + 1.2.1 + + ${project.build.directory}/code-coverage/jacoco-ut.exec + ${project.reporting.outputDirectory}/jacoco-ut ${project.reporting.outputDirectory}/jacoco-aggregate + 1.00 ../jacoco-report/target/site/jacoco-aggregate/jacoco.xml - ${project.basedir}/.. - 17 + + + + + + org.onap.cps + cps-dependencies + ${project.version} + pom + import + + + org.onap.cps + cps-bom + ${project.version} + pom + import + + + + Windows @@ -72,27 +115,27 @@ python3 + + dependency-vulnerability-check + + + + org.owasp + dependency-check-maven + ${dependency.check.version} + + + + aggregate + + + + + + + - - - - org.onap.cps - cps-dependencies - ${project.version} - pom - import - - - org.onap.cps - cps-bom - ${project.version} - pom - import - - - - @@ -118,7 +161,7 @@ org.springframework.boot spring-boot-maven-plugin - 3.2.4 + ${spring.boot.maven.plugin.version} @@ -130,7 +173,7 @@ io.github.git-commit-id git-commit-id-maven-plugin - 9.0.0 + ${git.commit.id.version} get-git-info @@ -141,11 +184,6 @@ - - org.apache.maven.plugins - maven-surefire-plugin - 3.0.0-M5 - io.swagger.codegen.v3 @@ -167,12 +205,12 @@ com.github.spotbugs spotbugs-maven-plugin - 4.8.6.4 + ${spotbugs.plugin.version} com.github.spotbugs spotbugs - 4.8.6 + ${spotbugs.version} ${project.groupId} @@ -183,7 +221,7 @@ org.slf4j slf4j-simple - 2.0.6 + ${slf4j.simple.version} @@ -191,7 +229,7 @@ jp.skypencil.findbugs.slf4j bug-pattern - 1.5.0 + ${bug.pattern.version} org.codehaus.gmavenplus gmavenplus-plugin - 1.9.0 + ${gmavenplus.plugin.version} @@ -343,6 +361,7 @@ org.apache.maven.plugins maven-surefire-plugin + ${maven.surefire.plugin.version} ${surefireArgLine} @@ -371,17 +390,18 @@ org.jacoco jacoco-maven-plugin - 0.8.10 + ${jacoco.version} - + - org/onap/cps/event/model/* + org/onap/cps/events/model/* org/onap/cps/rest/model/* org/onap/cps/cpspath/parser/antlr4/* org/onap/cps/ncmp/rest/model/* org/onap/cps/**/*MapperImpl.class org/onap/cps/ncmp/rest/stub/* org/onap/cps/policyexecutor/stub/model/* + **/pom.xml @@ -390,14 +410,19 @@ prepare-agent + + ${jacoco.execFile} + surefireArgLine + coverage-check + test check - ${project.build.directory}/code-coverage/jacoco-ut.exec + ${jacoco.execFile} BUNDLE @@ -412,17 +437,42 @@ + + post-unit-test + test + + report + + + + ${jacoco.execFile} + + ${jacoco.outputDirectory} + + - - com.github.spotbugs - spotbugs-maven-plugin - + + org.sonarsource.scanner.maven sonar-maven-plugin - 3.9.1.2184 + ${sonar.version} + + + + + org.apache.maven.plugins + maven-site-plugin + ${maven.site.plugin.version} + + + default-site + site + site + + - + \ No newline at end of file diff --git a/cps-service/src/main/java/org/onap/cps/api/CpsModuleService.java b/cps-service/src/main/java/org/onap/cps/api/CpsModuleService.java index 931209c998..bbfe496d85 100644 --- a/cps-service/src/main/java/org/onap/cps/api/CpsModuleService.java +++ b/cps-service/src/main/java/org/onap/cps/api/CpsModuleService.java @@ -178,8 +178,8 @@ public interface CpsModuleService { * an attribute key-value pair used in the WHERE clause for parent fragments. * @param childAttributes a map of attributes to filter child fragments. Each entry in this map represents * an attribute key-value pair used in the WHERE clause for child fragments. - * @return a collection of {@link ModuleReference} objects that match the given criteria. Each - * {@code ModuleReference} contains information about a module's name and revision. + * @return a collection of {@link ModuleReference} objects that match the given criteria. + * Each {@code ModuleReference} contains information about a module's name and revision. * @implNote The method assumes that both `parentAttributes` and `childAttributes` maps contain at least * one entry. The first entry from `parentAttributes` is used to filter parent fragments, * and the first entry from `childAttributes` is used to filter child fragments. diff --git a/pom.xml b/pom.xml index 6c34a19ed1..27a9a216ae 100644 --- a/pom.xml +++ b/pom.xml @@ -23,13 +23,8 @@ - 4.0.0 - - org.onap.oparent - oparent - 3.2.0 - + 4.0.0 org.onap.cps cps-aggregator 3.5.5-SNAPSHOT -- cgit 1.2.3-korg