diff options
Diffstat (limited to 'policy-management')
5 files changed, 35 insertions, 89 deletions
diff --git a/policy-management/pom.xml b/policy-management/pom.xml index 64e9f6b4..fb203580 100644 --- a/policy-management/pom.xml +++ b/policy-management/pom.xml @@ -20,13 +20,14 @@ ============LICENSE_END========================================================= --> -<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> +<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> <modelVersion>4.0.0</modelVersion> <parent> <groupId>org.onap.policy.drools-pdp</groupId> <artifactId>drools-pdp</artifactId> - <version>2.0.0-SNAPSHOT</version> + <version>2.0.1-SNAPSHOT</version> </parent> <artifactId>policy-management</artifactId> @@ -74,7 +75,6 @@ <useRepositoryLayout>false</useRepositoryLayout> <addParentPoms>false</addParentPoms> <copyPom>false</copyPom> - <excludeGroupIds>javax.inject</excludeGroupIds> <includeScope>runtime</includeScope> </configuration> </execution> @@ -175,7 +175,7 @@ PolicyTypeController=org.onap.policy.drools.lifecycle.PolicyTypeController, Properties=java.util.Properties, ProtocolCoderToolset=org.onap.policy.drools.protocol.coders.ProtocolCoderToolset, - Response=javax.ws.rs.core.Response, + Response=jakarta.ws.rs.core.Response, TopicEndpoint=org.onap.policy.common.endpoints.event.comm.TopicEndpoint, TopicSink=org.onap.policy.common.endpoints.event.comm.TopicSink, TopicSource=org.onap.policy.common.endpoints.event.comm.TopicSource, @@ -186,10 +186,11 @@ </typeMappings> <configOptions> <sourceFolder>src/gen/java</sourceFolder> - <dateLibrary>java11</dateLibrary> + <dateLibrary>java17</dateLibrary> <interfaceOnly>true</interfaceOnly> <useTags>true</useTags> <skipIfSpecIsUnchanged>false</skipIfSpecIsUnchanged> + <jakarta>true</jakarta> </configOptions> </configuration> </execution> @@ -199,13 +200,11 @@ </build> <dependencies> - <dependency> <groupId>org.onap.policy.drools-pdp</groupId> <artifactId>policy-core</artifactId> <version>${project.version}</version> </dependency> - <dependency> <groupId>org.onap.policy.drools-pdp</groupId> <artifactId>policy-domains</artifactId> @@ -217,7 +216,11 @@ <artifactId>policy-endpoints</artifactId> <version>${policy.common.version}</version> </dependency> - + <dependency> + <groupId>org.onap.policy.common</groupId> + <artifactId>gson</artifactId> + <version>${policy.common.version}</version> + </dependency> <dependency> <groupId>org.onap.policy.common</groupId> <artifactId>utils</artifactId> @@ -234,34 +237,24 @@ <groupId>org.eclipse.jetty</groupId> <artifactId>jetty-server</artifactId> </dependency> - <dependency> <groupId>org.eclipse.jetty</groupId> <artifactId>jetty-servlet</artifactId> </dependency> <dependency> - <groupId>org.onap.policy.common</groupId> - <artifactId>gson</artifactId> - <version>${policy.common.version}</version> - </dependency> - - <dependency> <groupId>com.google.code.gson</groupId> <artifactId>gson</artifactId> </dependency> - <dependency> <groupId>com.fatboyindustrial.gson-javatime-serialisers</groupId> <artifactId>gson-javatime-serialisers</artifactId> - <version>1.1.1</version> + <version>1.1.2</version> </dependency> - <dependency> <groupId>com.jayway.jsonpath</groupId> <artifactId>json-path</artifactId> </dependency> - <dependency> <groupId>org.apache.commons</groupId> <artifactId>commons-collections4</artifactId> @@ -275,37 +268,16 @@ <groupId>commons-codec</groupId> <artifactId>commons-codec</artifactId> </dependency> - <dependency> <groupId>ch.qos.logback</groupId> <artifactId>logback-classic</artifactId> </dependency> - - <dependency> - <groupId>junit</groupId> - <artifactId>junit</artifactId> - <scope>test</scope> - </dependency> - - <dependency> - <groupId>org.mockito</groupId> - <artifactId>mockito-core</artifactId> - <scope>test</scope> - </dependency> - <dependency> <groupId>org.springframework</groupId> <artifactId>spring-test</artifactId> <scope>test</scope> </dependency> - <dependency> - <groupId>org.onap.policy.common</groupId> - <artifactId>utils-test</artifactId> - <version>${policy.common.version}</version> - <scope>test</scope> - </dependency> - <!-- The following dependencies are for features and drools applications usage @@ -315,54 +287,28 @@ <groupId>org.mariadb.jdbc</groupId> <artifactId>mariadb-java-client</artifactId> </dependency> - <dependency> - <groupId>org.hibernate</groupId> + <groupId>org.hibernate.orm</groupId> <artifactId>hibernate-core</artifactId> - <!-- - Exclude this because it's incompatible with eclipselink, which already - includes the same classes. - --> - <exclusions> - <exclusion> - <groupId>javax.persistence</groupId> - <artifactId>javax.persistence-api</artifactId> - </exclusion> - </exclusions> </dependency> - <dependency> <groupId>org.hibernate.common</groupId> <artifactId>hibernate-commons-annotations</artifactId> </dependency> - <dependency> <groupId>commons-io</groupId> <artifactId>commons-io</artifactId> </dependency> - <dependency> <groupId>io.prometheus</groupId> <artifactId>simpleclient_logback</artifactId> </dependency> - <dependency> - <groupId>org.assertj</groupId> - <artifactId>assertj-core</artifactId> - <scope>test</scope> - </dependency> - - <dependency> - <groupId>org.awaitility</groupId> - <artifactId>awaitility</artifactId> - <scope>test</scope> - </dependency> - <!-- Swagger v3 annotations --> <dependency> <groupId>io.swagger.core.v3</groupId> <artifactId>swagger-annotations</artifactId> </dependency> - </dependencies> + </project> diff --git a/policy-management/src/main/java/org/onap/policy/drools/server/restful/RestManager.java b/policy-management/src/main/java/org/onap/policy/drools/server/restful/RestManager.java index 11840a7e..b5cf319e 100644 --- a/policy-management/src/main/java/org/onap/policy/drools/server/restful/RestManager.java +++ b/policy-management/src/main/java/org/onap/policy/drools/server/restful/RestManager.java @@ -23,6 +23,19 @@ package org.onap.policy.drools.server.restful; import ch.qos.logback.classic.LoggerContext; import com.google.re2j.Pattern; +import jakarta.ws.rs.Consumes; +import jakarta.ws.rs.DELETE; +import jakarta.ws.rs.DefaultValue; +import jakarta.ws.rs.GET; +import jakarta.ws.rs.POST; +import jakarta.ws.rs.PUT; +import jakarta.ws.rs.Path; +import jakarta.ws.rs.PathParam; +import jakarta.ws.rs.Produces; +import jakarta.ws.rs.QueryParam; +import jakarta.ws.rs.core.MediaType; +import jakarta.ws.rs.core.Response; +import jakarta.ws.rs.core.Response.Status; import java.io.BufferedReader; import java.io.IOException; import java.io.InputStream; @@ -33,24 +46,12 @@ import java.util.Collections; import java.util.HashMap; import java.util.List; import java.util.Map; +import java.util.Objects; import java.util.Properties; import java.util.UUID; import java.util.function.Function; import java.util.function.Supplier; import java.util.stream.Collectors; -import javax.ws.rs.Consumes; -import javax.ws.rs.DELETE; -import javax.ws.rs.DefaultValue; -import javax.ws.rs.GET; -import javax.ws.rs.POST; -import javax.ws.rs.PUT; -import javax.ws.rs.Path; -import javax.ws.rs.PathParam; -import javax.ws.rs.Produces; -import javax.ws.rs.QueryParam; -import javax.ws.rs.core.MediaType; -import javax.ws.rs.core.Response; -import javax.ws.rs.core.Response.Status; import lombok.AllArgsConstructor; import lombok.Getter; import lombok.Setter; @@ -145,7 +146,8 @@ public class RestManager implements SwaggerApi, DefaultApi, FeaturesApi, InputsA public Response swagger() { try (InputStream inputStream = getClass().getResourceAsStream(SWAGGER); - BufferedReader reader = new BufferedReader(new InputStreamReader(inputStream))) { + BufferedReader reader = new BufferedReader( + new InputStreamReader(Objects.requireNonNull(inputStream)))) { String contents = reader.lines() .collect(Collectors.joining(System.lineSeparator())); return Response.status(Response.Status.OK) @@ -1720,12 +1722,11 @@ public class RestManager implements SwaggerApi, DefaultApi, FeaturesApi, InputsA @Path("engine/tools/loggers") public Response loggers() { final List<String> names = new ArrayList<>(); - if (!(LoggerFactory.getILoggerFactory() instanceof LoggerContext)) { + if (!(LoggerFactory.getILoggerFactory() instanceof LoggerContext context)) { logger.warn("The SLF4J logger factory is not configured for logback"); return Response.status(Status.INTERNAL_SERVER_ERROR).entity(names).build(); } - final LoggerContext context = (LoggerContext) LoggerFactory.getILoggerFactory(); for (final Logger lgr : context.getLoggerList()) { names.add(lgr.getName()); } @@ -1743,12 +1744,11 @@ public class RestManager implements SwaggerApi, DefaultApi, FeaturesApi, InputsA @Path("engine/tools/loggers/{logger}") @Produces(MediaType.TEXT_PLAIN) public Response loggerName1(@PathParam("logger") String loggerName) { - if (!(LoggerFactory.getILoggerFactory() instanceof LoggerContext)) { + if (!(LoggerFactory.getILoggerFactory() instanceof LoggerContext context)) { logger.warn("The SLF4J logger factory is not configured for logback"); return Response.status(Status.INTERNAL_SERVER_ERROR).build(); } - final LoggerContext context = (LoggerContext) LoggerFactory.getILoggerFactory(); var lgr = context.getLogger(loggerName); if (lgr == null) { return Response.status(Status.NOT_FOUND).build(); diff --git a/policy-management/src/main/java/org/onap/policy/drools/server/restful/aaf/AafTelemetryAuthFilter.java b/policy-management/src/main/java/org/onap/policy/drools/server/restful/aaf/AafTelemetryAuthFilter.java index f76b3de2..1f7ef8c3 100644 --- a/policy-management/src/main/java/org/onap/policy/drools/server/restful/aaf/AafTelemetryAuthFilter.java +++ b/policy-management/src/main/java/org/onap/policy/drools/server/restful/aaf/AafTelemetryAuthFilter.java @@ -20,7 +20,7 @@ package org.onap.policy.drools.server.restful.aaf; -import javax.servlet.http.HttpServletRequest; +import jakarta.servlet.http.HttpServletRequest; import org.onap.policy.common.utils.network.NetworkUtil; /** diff --git a/policy-management/src/main/java/org/onap/policy/drools/system/PolicyController.java b/policy-management/src/main/java/org/onap/policy/drools/system/PolicyController.java index 7501aed5..931e8a55 100644 --- a/policy-management/src/main/java/org/onap/policy/drools/system/PolicyController.java +++ b/policy-management/src/main/java/org/onap/policy/drools/system/PolicyController.java @@ -85,7 +85,7 @@ public interface PolicyController extends Startable, Lockable { <T> boolean offer(T event); /** - * Attempts delivering of an String over communication infrastructure "busType". + * Attempts delivering of a String over communication infrastructure "busType". * * @param busType bus type * @param topic topic diff --git a/policy-management/src/test/java/org/onap/policy/drools/server/restful/test/TestAafTelemetryAuthFilter.java b/policy-management/src/test/java/org/onap/policy/drools/server/restful/test/TestAafTelemetryAuthFilter.java index 67e16183..6a9be8a2 100644 --- a/policy-management/src/test/java/org/onap/policy/drools/server/restful/test/TestAafTelemetryAuthFilter.java +++ b/policy-management/src/test/java/org/onap/policy/drools/server/restful/test/TestAafTelemetryAuthFilter.java @@ -20,7 +20,7 @@ package org.onap.policy.drools.server.restful.test; -import javax.servlet.http.HttpServletRequest; +import jakarta.servlet.http.HttpServletRequest; import org.onap.policy.common.utils.network.NetworkUtil; import org.onap.policy.drools.server.restful.aaf.AafTelemetryAuthFilter; |