<parent>
<groupId>org.onap.policy.common</groupId>
<artifactId>common-modules</artifactId>
- <version>2.0.0-SNAPSHOT</version>
+ <version>2.0.1-SNAPSHOT</version>
</parent>
<artifactId>capabilities</artifactId>
<packaging>jar</packaging>
<properties>
- <!-- There is no code in this sub-module, only holds interfaces. So skip sonar. -->
+ <!-- There is no code in this submodule, only holds interfaces. So skip sonar. -->
<sonar.skip>true</sonar.skip>
</properties>
</project>
* policy-core
* ================================================================================
* Copyright (C) 2017-2018 AT&T Intellectual Property. All rights reserved.
+ * 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.
* Start operation. This operation starts the entity.
*
* @return boolean. true if the start operation was successful, otherwise false.
- * @throws IllegalStateException. if the element is in a state that conflicts with the start
+ * @throws IllegalStateException if the element is in a state that conflicts with the start
* operation.
*/
- public boolean start();
+ boolean start();
/**
* Stop operation. The entity can be restarted again by invoking the start operation.
*
* @return boolean. true if the stop operation was successful, otherwise false.
- * @throws IllegalStateException. if the element is in a state that conflicts with the stop
+ * @throws IllegalStateException if the element is in a state that conflicts with the stop
* operation.
*/
- public boolean stop();
+ boolean stop();
/**
* shutdown operation. The terminate operation yields the entity unusuable. It cannot be
* (re)started.
*
- * @throws IllegalStateException. if the element is in a state that conflicts with the stop
+ * @throws IllegalStateException if the element is in a state that conflicts with the stop
* operation.
*/
- public void shutdown();
+ void shutdown();
/**
* Checks if the entity is alive.
*
* @return boolean. true if alive, otherwise false
*/
- public boolean isAlive();
+ boolean isAlive();
}
<parent>
<groupId>org.onap.policy.common</groupId>
<artifactId>common-modules</artifactId>
- <version>2.0.0-SNAPSHOT</version>
+ <version>2.0.1-SNAPSHOT</version>
</parent>
<artifactId>ONAP-Logging</artifactId>
<packaging>jar</packaging>
<dependencies>
- <dependency>
- <groupId>org.projectlombok</groupId>
- <artifactId>lombok</artifactId>
- <scope>provided</scope>
- </dependency>
- <dependency>
- <groupId>com.google.re2j</groupId>
- <artifactId>re2j</artifactId>
- </dependency>
- <dependency>
- <groupId>javax.servlet</groupId>
- <artifactId>javax.servlet-api</artifactId>
- <scope>compile</scope>
- </dependency>
- <dependency>
- <groupId>org.slf4j</groupId>
- <artifactId>slf4j-api</artifactId>
- </dependency>
<dependency>
<groupId>com.att.eelf</groupId>
<artifactId>eelf-core</artifactId>
</exclusion>
</exclusions>
</dependency>
- <dependency>
- <groupId>org.apache.commons</groupId>
- <artifactId>commons-lang3</artifactId>
- </dependency>
- <dependency>
- <groupId>org.assertj</groupId>
- <artifactId>assertj-core</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>junit</groupId>
- <artifactId>junit</artifactId>
- <scope>test</scope>
- </dependency>
</dependencies>
<build>
* ONAP-Logging
* ================================================================================
* Copyright (C) 2017-2021 AT&T Intellectual Property. All rights reserved.
+ * 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.
package org.onap.policy.common.logging;
import com.google.re2j.Pattern;
-import javax.servlet.http.HttpServletRequest;
+import jakarta.servlet.http.HttpServletRequest;
import lombok.AccessLevel;
import lombok.NoArgsConstructor;
* @return the ONAPLoggingContext
*/
public static OnapLoggingContext getLoggingContextForRequest(HttpServletRequest request,
- OnapLoggingContext baseContext) {
+ OnapLoggingContext baseContext) {
var requestContext = new OnapLoggingContext(baseContext);
if (request.getLocalAddr() != null) { // may be null in junit tests
requestContext.setServerIpAddress(request.getLocalAddr());
============LICENSE_START=======================================================
Copyright (C) 2018 Ericsson. All rights reserved.
Modifications Copyright (C) 2019, 2021 AT&T Intellectual Property. All rights reserved.
+ * 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.
<parent>
<groupId>org.onap.policy.common</groupId>
<artifactId>common-modules</artifactId>
- <version>2.0.0-SNAPSHOT</version>
+ <version>2.0.1-SNAPSHOT</version>
</parent>
<artifactId>common-parameters</artifactId>
<description>[${project.parent.artifactId}] module provides common property and parameter handling the ONAP Policy Framework</description>
<dependencies>
- <dependency>
- <groupId>com.google.re2j</groupId>
- <artifactId>re2j</artifactId>
- </dependency>
- <dependency>
- <groupId>org.apache.commons</groupId>
- <artifactId>commons-lang3</artifactId>
- </dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
</dependency>
- <dependency>
- <groupId>org.assertj</groupId>
- <artifactId>assertj-core</artifactId>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>junit</groupId>
- <artifactId>junit</artifactId>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>com.google.code.gson</groupId>
- <artifactId>gson</artifactId>
- </dependency>
- <dependency>
- <groupId>jakarta.validation</groupId>
- <artifactId>jakarta.validation-api</artifactId>
- </dependency>
</dependencies>
</project>
/*-
* ============LICENSE_START=======================================================
- * Copyright (C) 2021 Nordix Foundation.
+ * Copyright (C) 2021, 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.
package org.onap.policy.common.parameters.validation;
+import jakarta.validation.Constraint;
+import jakarta.validation.Payload;
import java.lang.annotation.Documented;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
-import javax.validation.Constraint;
-import javax.validation.Payload;
@Documented
@Constraint(validatedBy = ParameterGroupValidator.class)
/*-
* ============LICENSE_START=======================================================
- * Copyright (C) 2021 Nordix Foundation.
+ * Copyright (C) 2021, 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.
package org.onap.policy.common.parameters.validation;
-import javax.validation.ConstraintValidator;
-import javax.validation.ConstraintValidatorContext;
+import jakarta.validation.ConstraintValidator;
+import jakarta.validation.ConstraintValidatorContext;
import org.onap.policy.common.parameters.BeanValidationResult;
import org.onap.policy.common.parameters.ParameterGroup;
ONAP Policy Engine - Common Modules
================================================================================
Copyright (C) 2018-2021 AT&T Intellectual Property. All rights reserved.
- Modifications Copyright (C) 2019,2023 Nordix Foundation.
+ Modifications Copyright (C) 2019, 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.
<parent>
<groupId>org.onap.policy.common</groupId>
<artifactId>common-modules</artifactId>
- <version>2.0.0-SNAPSHOT</version>
+ <version>2.0.1-SNAPSHOT</version>
</parent>
<artifactId>gson</artifactId>
<description>Common Utilities</description>
<packaging>jar</packaging>
+
<dependencies>
<dependency>
- <groupId>com.google.re2j</groupId>
- <artifactId>re2j</artifactId>
- </dependency>
- <dependency>
- <groupId>org.slf4j</groupId>
- <artifactId>slf4j-api</artifactId>
- <scope>provided</scope>
- </dependency>
- <dependency>
- <groupId>org.glassfish.jersey.core</groupId>
- <artifactId>jersey-server</artifactId>
- </dependency>
- <dependency>
- <groupId>com.google.code.gson</groupId>
- <artifactId>gson</artifactId>
- </dependency>
- <dependency>
- <groupId>javax.ws.rs</groupId>
- <artifactId>javax.ws.rs-api</artifactId>
- </dependency>
- <dependency>
- <groupId>org.projectlombok</groupId>
- <artifactId>lombok</artifactId>
- <scope>provided</scope>
- </dependency>
- <dependency>
- <groupId>org.assertj</groupId>
- <artifactId>assertj-core</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>junit</groupId>
- <artifactId>junit</artifactId>
- <scope>test</scope>
+ <groupId>jakarta.ws.rs</groupId>
+ <artifactId>jakarta.ws.rs-api</artifactId>
</dependency>
</dependencies>
</project>
* ONAP
* ================================================================================
* Copyright (C) 2019-2021 AT&T Intellectual Property. All rights reserved.
+ * 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.
import com.google.gson.Gson;
import com.google.gson.GsonBuilder;
+import jakarta.ws.rs.Consumes;
+import jakarta.ws.rs.Produces;
+import jakarta.ws.rs.core.MediaType;
+import jakarta.ws.rs.core.MultivaluedMap;
+import jakarta.ws.rs.ext.MessageBodyReader;
+import jakarta.ws.rs.ext.MessageBodyWriter;
+import jakarta.ws.rs.ext.Provider;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.time.OffsetTime;
import java.time.ZoneOffset;
import java.time.ZonedDateTime;
-import javax.ws.rs.Consumes;
-import javax.ws.rs.Produces;
-import javax.ws.rs.core.MediaType;
-import javax.ws.rs.core.MultivaluedMap;
-import javax.ws.rs.ext.MessageBodyReader;
-import javax.ws.rs.ext.MessageBodyWriter;
-import javax.ws.rs.ext.Provider;
import lombok.AccessLevel;
import lombok.Getter;
import org.slf4j.Logger;
* ONAP
* ================================================================================
* Copyright (C) 2019-2021 AT&T Intellectual Property. All rights reserved.
+ * 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.
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertTrue;
+import jakarta.ws.rs.core.MediaType;
import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.util.HashMap;
import java.util.Map;
import java.util.UUID;
-import javax.ws.rs.core.MediaType;
import lombok.ToString;
import org.junit.Before;
import org.junit.Test;
* ONAP
* ================================================================================
* Copyright (C) 2019, 2021 AT&T Intellectual Property. All rights reserved.
+ * 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.
import com.google.gson.Gson;
import com.google.gson.JsonObject;
+import jakarta.ws.rs.core.MediaType;
import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.io.StringReader;
import java.util.HashMap;
import java.util.Map;
import java.util.TreeMap;
-import javax.ws.rs.core.MediaType;
import lombok.ToString;
import org.junit.Test;
import org.onap.policy.common.gson.annotation.GsonJsonAnyGetter;
<parent>
<groupId>org.onap.policy.common</groupId>
<artifactId>common-modules</artifactId>
- <version>2.0.0-SNAPSHOT</version>
+ <version>2.0.1-SNAPSHOT</version>
</parent>
<name>Integrity Audit</name>
<dependencies>
<dependency>
- <groupId>org.projectlombok</groupId>
- <artifactId>lombok</artifactId>
+ <groupId>org.onap.policy.common</groupId>
+ <artifactId>utils</artifactId>
+ <version>${project.version}</version>
</dependency>
<dependency>
- <groupId>junit</groupId>
- <artifactId>junit</artifactId>
+ <groupId>org.onap.policy.common</groupId>
+ <artifactId>utils-test</artifactId>
+ <version>${project.version}</version>
<scope>test</scope>
</dependency>
<dependency>
- <groupId>org.mockito</groupId>
- <artifactId>mockito-core</artifactId>
- <scope>test</scope>
+ <groupId>org.onap.policy.common</groupId>
+ <artifactId>ONAP-Logging</artifactId>
+ <version>${project.version}</version>
</dependency>
<dependency>
- <groupId>org.springframework</groupId>
- <artifactId>spring-test</artifactId>
- <scope>test</scope>
+ <groupId>org.projectlombok</groupId>
+ <artifactId>lombok</artifactId>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<dependency>
<groupId>com.h2database</groupId>
<artifactId>h2</artifactId>
- </dependency>
- <dependency>
- <groupId>org.hibernate.javax.persistence</groupId>
- <artifactId>hibernate-jpa-2.1-api</artifactId>
- </dependency>
- <dependency>
- <groupId>org.hibernate</groupId>
- <artifactId>hibernate-entitymanager</artifactId>
- </dependency>
- <dependency>
- <groupId>org.onap.policy.common</groupId>
- <artifactId>utils</artifactId>
- <version>${project.version}</version>
- </dependency>
- <dependency>
- <groupId>org.onap.policy.common</groupId>
- <artifactId>utils-test</artifactId>
- <version>${project.version}</version>
<scope>test</scope>
</dependency>
- <dependency>
- <groupId>org.assertj</groupId>
- <artifactId>assertj-core</artifactId>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.onap.policy.common</groupId>
- <artifactId>ONAP-Logging</artifactId>
- <version>${project.version}</version>
- </dependency>
- <dependency>
- <groupId>org.apache.commons</groupId>
- <artifactId>commons-lang3</artifactId>
- </dependency>
</dependencies>
</project>
* Integrity Audit
* ================================================================================
* Copyright (C) 2017-2021 AT&T Intellectual Property. All rights reserved.
+ * 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.
package org.onap.policy.common.ia;
+import jakarta.persistence.Table;
import java.io.Serializable;
import java.util.Arrays;
import java.util.HashMap;
import java.util.Map.Entry;
import java.util.Properties;
import java.util.Set;
-import javax.persistence.Table;
import org.apache.commons.lang3.SerializationUtils;
import org.apache.commons.lang3.builder.RecursiveToStringStyle;
import org.apache.commons.lang3.builder.ReflectionToStringBuilder;
String tableName = entityClass.getAnnotation(Table.class).name();
String msg = "\nDB Audit Error: " + "\n Table Name: " + tableName
+ "\n Entry 1 (short prefix style): " + resourceName1 + ": "
- + new ReflectionToStringBuilder(entry1, ToStringStyle.SHORT_PREFIX_STYLE).toString()
+ + new ReflectionToStringBuilder(entry1, ToStringStyle.SHORT_PREFIX_STYLE)
+ "\n Entry 2 (short prefix style): " + resourceName2 + ": "
+ (entry2 != null
? new ReflectionToStringBuilder(entry2, ToStringStyle.SHORT_PREFIX_STYLE).toString()
: "null")
+ "\n Entry 1 (recursive style): " + resourceName1 + ": "
- + new ReflectionToStringBuilder(entry1, new RecursiveToStringStyle()).toString()
+ + new ReflectionToStringBuilder(entry1, new RecursiveToStringStyle())
+ "\n Entry 2 (recursive style): " + resourceName2 + ": "
+ (entry2 != null
? new ReflectionToStringBuilder(entry2, new RecursiveToStringStyle()).toString()
* Integrity Audit
* ================================================================================
* Copyright (C) 2017-2021 AT&T Intellectual Property. All rights reserved.
+ * 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.
package org.onap.policy.common.ia;
+import jakarta.persistence.EntityManager;
+import jakarta.persistence.EntityManagerFactory;
+import jakarta.persistence.EntityTransaction;
+import jakarta.persistence.Persistence;
+import jakarta.persistence.Query;
+import jakarta.persistence.TypedQuery;
+import jakarta.persistence.criteria.CriteriaQuery;
+import jakarta.persistence.criteria.Root;
+import jakarta.persistence.metamodel.ManagedType;
import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
import java.util.Properties;
import java.util.Set;
import java.util.function.BiConsumer;
-import javax.persistence.EntityManager;
-import javax.persistence.EntityManagerFactory;
-import javax.persistence.EntityTransaction;
-import javax.persistence.Persistence;
-import javax.persistence.Query;
-import javax.persistence.TypedQuery;
-import javax.persistence.criteria.CriteriaQuery;
-import javax.persistence.criteria.Root;
-import javax.persistence.metamodel.ManagedType;
import org.onap.policy.common.ia.jpa.IntegrityAuditEntity;
import org.onap.policy.common.logging.flexlogger.FlexLogger;
import org.onap.policy.common.logging.flexlogger.Logger;
* Integrity Audit
* ================================================================================
* Copyright (C) 2017-2021 AT&T Intellectual Property. All rights reserved.
+ * 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.
public static final int DEFAULT_AUDIT_PERIOD_SECONDS = -1; // Audit does not run
- public static final String DB_DRIVER = "javax.persistence.jdbc.driver";
- public static final String DB_URL = "javax.persistence.jdbc.url";
- public static final String DB_USER = "javax.persistence.jdbc.user";
- public static final String DB_PWD = "javax.persistence.jdbc.password"; //NOSONAR
+ public static final String DB_DRIVER = "jakarta.persistence.jdbc.driver";
+ public static final String DB_URL = "jakarta.persistence.jdbc.url";
+ public static final String DB_USER = "jakarta.persistence.jdbc.user";
+ public static final String DB_PWD = "jakarta.persistence.jdbc.password"; //NOSONAR
public static final String AUDIT_PERIOD_SECONDS = "integrity_audit_period_seconds";
package org.onap.policy.common.ia.jpa;
+import jakarta.persistence.Column;
+import jakarta.persistence.Entity;
+import jakarta.persistence.GeneratedValue;
+import jakarta.persistence.GenerationType;
+import jakarta.persistence.Id;
+import jakarta.persistence.NamedQueries;
+import jakarta.persistence.NamedQuery;
+import jakarta.persistence.PrePersist;
+import jakarta.persistence.PreUpdate;
+import jakarta.persistence.Table;
+import jakarta.persistence.Temporal;
+import jakarta.persistence.TemporalType;
import java.io.IOException;
import java.io.ObjectOutputStream;
import java.io.Serializable;
import java.util.Date;
-import javax.persistence.Column;
-import javax.persistence.Entity;
-import javax.persistence.GeneratedValue;
-import javax.persistence.GenerationType;
-import javax.persistence.Id;
-import javax.persistence.NamedQueries;
-import javax.persistence.NamedQuery;
-import javax.persistence.PrePersist;
-import javax.persistence.PreUpdate;
-import javax.persistence.Table;
-import javax.persistence.Temporal;
-import javax.persistence.TemporalType;
import lombok.AccessLevel;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;
-/*
- * The Entity class to for management of IntegrityAudits
- */
import org.onap.policy.common.ia.AuditorTime;
@Entity
xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/persistence http://xmlns.jcp.org/xml/ns/persistence/persistence_2_1.xsd">
<persistence-unit name="testPU" transaction-type="RESOURCE_LOCAL">
<!-- Limited use for generating the DB and schema files for iatest DB - uses hibernate -->
+ <provider>org.hibernate.jpa.HibernatePersistenceProvider</provider>
<class>org.onap.policy.common.ia.jpa.IntegrityAuditEntity</class>
<class>org.onap.policy.common.ia.jpa.IaTestEntity</class>
<shared-cache-mode>NONE</shared-cache-mode>
<properties>
- <property name="javax.persistence.schema-generation.database.action" value="create" />
+ <property name="jakarta.persistence.schema-generation.database.action" value="create" />
<property name="hibernate.show_sql" value="false" />
</properties>
</persistence-unit>
* Integrity Audit
* ================================================================================
* Copyright (C) 2017-2021 AT&T Intellectual Property. All rights reserved.
+ * 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.
import static org.junit.Assert.assertFalse;
import com.google.re2j.Pattern;
+import jakarta.persistence.EntityManager;
+import jakarta.persistence.EntityManagerFactory;
+import jakarta.persistence.Persistence;
import java.util.List;
import java.util.Properties;
-import javax.persistence.EntityManager;
-import javax.persistence.EntityManagerFactory;
-import javax.persistence.Persistence;
import org.junit.After;
import org.junit.AfterClass;
import org.junit.Before;
* Integrity Audit
* ================================================================================
* Copyright (C) 2017-2020 AT&T Intellectual Property. All rights reserved.
+ * 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.
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertTrue;
+import jakarta.persistence.PersistenceUnitUtil;
+import jakarta.persistence.Query;
+import jakarta.persistence.TypedQuery;
+import jakarta.persistence.criteria.CriteriaBuilder;
+import jakarta.persistence.criteria.CriteriaQuery;
+import jakarta.persistence.criteria.Root;
import java.util.Date;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Properties;
import java.util.Set;
-import javax.persistence.PersistenceUnitUtil;
-import javax.persistence.Query;
-import javax.persistence.TypedQuery;
-import javax.persistence.criteria.CriteriaBuilder;
-import javax.persistence.criteria.CriteriaQuery;
-import javax.persistence.criteria.Root;
import org.junit.After;
import org.junit.AfterClass;
import org.junit.Before;
private static final String SITE_B = "SiteB";
private static final String ENTITY_CLASS_NAME = "org.onap.policy.common.ia.jpa.IntegrityAuditEntity";
- private static String resourceName = "pdp0";
+ private static final String resourceName = "pdp0";
private DbDao dbDao;
import ch.qos.logback.classic.Level;
import ch.qos.logback.classic.Logger;
+import jakarta.persistence.EntityManager;
+import jakarta.persistence.EntityManagerFactory;
+import jakarta.persistence.EntityTransaction;
+import jakarta.persistence.Persistence;
import java.io.FileOutputStream;
import java.io.IOException;
import java.util.ArrayList;
import java.util.concurrent.Semaphore;
import java.util.concurrent.TimeUnit;
import java.util.function.Supplier;
-import javax.persistence.EntityManager;
-import javax.persistence.EntityManagerFactory;
-import javax.persistence.EntityTransaction;
-import javax.persistence.Persistence;
import org.onap.policy.common.utils.jpa.EntityMgrCloser;
import org.onap.policy.common.utils.jpa.EntityMgrFactoryCloser;
import org.onap.policy.common.utils.jpa.EntityTransCloser;
* Integrity Audit
* ================================================================================
* Copyright (C) 2017-2020 AT&T Intellectual Property. All rights reserved.
- * Modifications Copyright (C) 2021 Nordix Foundation.
+ * Modifications Copyright (C) 2021, 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.
package org.onap.policy.common.ia.jpa;
+import jakarta.persistence.Column;
+import jakarta.persistence.Entity;
+import jakarta.persistence.GeneratedValue;
+import jakarta.persistence.GenerationType;
+import jakarta.persistence.Id;
+import jakarta.persistence.NamedQueries;
+import jakarta.persistence.NamedQuery;
+import jakarta.persistence.PrePersist;
+import jakarta.persistence.PreUpdate;
+import jakarta.persistence.Table;
+import jakarta.persistence.Temporal;
+import jakarta.persistence.TemporalType;
import java.io.Serializable;
import java.util.Date;
-import javax.persistence.Column;
-import javax.persistence.Entity;
-import javax.persistence.GeneratedValue;
-import javax.persistence.GenerationType;
-import javax.persistence.Id;
-import javax.persistence.NamedQueries;
-import javax.persistence.NamedQuery;
-import javax.persistence.PrePersist;
-import javax.persistence.PreUpdate;
-import javax.persistence.Table;
-import javax.persistence.Temporal;
-import javax.persistence.TemporalType;
@Entity
@Table(name = "IaTestEntity")
<parent>
<groupId>org.onap.policy.common</groupId>
<artifactId>common-modules</artifactId>
- <version>2.0.0-SNAPSHOT</version>
+ <version>2.0.1-SNAPSHOT</version>
</parent>
<name>Integrity Monitor</name>
<dependencies>
- <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>junit</groupId>
- <artifactId>junit</artifactId>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>com.h2database</groupId>
- <artifactId>h2</artifactId>
- </dependency>
- <dependency>
- <groupId>org.hibernate.javax.persistence</groupId>
- <artifactId>hibernate-jpa-2.1-api</artifactId>
- </dependency>
- <dependency>
- <groupId>org.hibernate</groupId>
- <artifactId>hibernate-entitymanager</artifactId>
- </dependency>
- <dependency>
- <groupId>org.projectlombok</groupId>
- <artifactId>lombok</artifactId>
- <scope>provided</scope>
- </dependency>
<dependency>
<groupId>org.onap.policy.common</groupId>
<artifactId>utils</artifactId>
<version>${project.version}</version>
<scope>test</scope>
</dependency>
- <dependency>
- <groupId>org.assertj</groupId>
- <artifactId>assertj-core</artifactId>
- <scope>test</scope>
- </dependency>
<dependency>
<groupId>org.onap.policy.common</groupId>
<artifactId>ONAP-Logging</artifactId>
<dependency>
<groupId>commons-logging</groupId>
<artifactId>commons-logging</artifactId>
- <version>1.2</version>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>com.h2database</groupId>
+ <artifactId>h2</artifactId>
<scope>test</scope>
</dependency>
</dependencies>
package org.onap.policy.common.im;
import com.google.re2j.Pattern;
+import jakarta.persistence.EntityManager;
+import jakarta.persistence.EntityManagerFactory;
+import jakarta.persistence.EntityTransaction;
+import jakarta.persistence.FlushModeType;
+import jakarta.persistence.LockModeType;
+import jakarta.persistence.Persistence;
+import jakarta.persistence.TypedQuery;
import java.net.InetAddress;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.function.Supplier;
import javax.management.JMX;
import javax.management.MBeanServerConnection;
-import javax.persistence.EntityManager;
-import javax.persistence.EntityManagerFactory;
-import javax.persistence.EntityTransaction;
-import javax.persistence.FlushModeType;
-import javax.persistence.LockModeType;
-import javax.persistence.Persistence;
-import javax.persistence.TypedQuery;
import lombok.Getter;
import lombok.Setter;
import org.apache.commons.lang3.StringUtils;
* Integrity Monitor
* ================================================================================
* Copyright (C) 2017-2018, 2020-2021 AT&T Intellectual Property. All rights reserved.
+ * 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.
@NoArgsConstructor(access = AccessLevel.PRIVATE)
public final class IntegrityMonitorProperties {
- public static final String DB_DRIVER = "javax.persistence.jdbc.driver";
- public static final String DB_URL = "javax.persistence.jdbc.url";
- public static final String DB_USER = "javax.persistence.jdbc.user";
- public static final String DB_PWD = "javax.persistence.jdbc.password"; //NOSONAR
+ public static final String DB_DRIVER = "jakarta.persistence.jdbc.driver";
+ public static final String DB_URL = "jakarta.persistence.jdbc.url";
+ public static final String DB_USER = "jakarta.persistence.jdbc.user";
+ public static final String DB_PWD = "jakarta.persistence.jdbc.password"; //NOSONAR
// intervals specified are in seconds
public static final int DEFAULT_MONITOR_INTERVAL = 30;
* Integrity Monitor
* ================================================================================
* Copyright (C) 2017-2021 AT&T Intellectual Property. All rights reserved.
+ * 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.
package org.onap.policy.common.im;
+import jakarta.persistence.EntityManager;
+import jakarta.persistence.EntityManagerFactory;
+import jakarta.persistence.FlushModeType;
+import jakarta.persistence.LockModeType;
+import jakarta.persistence.TypedQuery;
import java.util.Collection;
import java.util.List;
import java.util.concurrent.ConcurrentLinkedQueue;
import java.util.concurrent.atomic.AtomicReference;
import java.util.function.Consumer;
-import javax.persistence.EntityManager;
-import javax.persistence.EntityManagerFactory;
-import javax.persistence.FlushModeType;
-import javax.persistence.LockModeType;
-import javax.persistence.TypedQuery;
import org.onap.policy.common.im.exceptions.EntityRetrievalException;
import org.onap.policy.common.im.jpa.StateManagementEntity;
import org.onap.policy.common.utils.jpa.EntityMgrCloser;
notFound.run();
}
} catch (final Exception ex) {
- logger.error("StateManagement: {} exception: {}", methodName, ex.toString(), ex);
+ logger.error("StateManagement: {} exception: {}", methodName, ex.getMessage(), ex);
}
}
* Integrity Monitor
* ================================================================================
* Copyright (C) 2021 AT&T Intellectual Property. All rights reserved.
+ * 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.
package org.onap.policy.common.im.jpa;
+import jakarta.persistence.Column;
+import jakarta.persistence.MappedSuperclass;
+import jakarta.persistence.PrePersist;
+import jakarta.persistence.PreUpdate;
+import jakarta.persistence.Temporal;
+import jakarta.persistence.TemporalType;
+import java.io.Serial;
import java.io.Serializable;
import java.util.Date;
-import javax.persistence.Column;
-import javax.persistence.MappedSuperclass;
-import javax.persistence.PrePersist;
-import javax.persistence.PreUpdate;
-import javax.persistence.Temporal;
-import javax.persistence.TemporalType;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;
@Setter
@NoArgsConstructor
public class DateEntity implements Serializable {
+ @Serial
private static final long serialVersionUID = 1L;
@Temporal(TemporalType.TIMESTAMP)
package org.onap.policy.common.im.jpa;
-import javax.persistence.Column;
-import javax.persistence.Entity;
-import javax.persistence.GeneratedValue;
-import javax.persistence.GenerationType;
-import javax.persistence.Id;
-import javax.persistence.NamedQueries;
-import javax.persistence.NamedQuery;
-import javax.persistence.PrePersist;
-import javax.persistence.Table;
+import jakarta.persistence.Column;
+import jakarta.persistence.Entity;
+import jakarta.persistence.GeneratedValue;
+import jakarta.persistence.GenerationType;
+import jakarta.persistence.Id;
+import jakarta.persistence.NamedQuery;
+import jakarta.persistence.PrePersist;
+import jakarta.persistence.Table;
+import java.io.Serial;
import lombok.AccessLevel;
import lombok.Getter;
import lombok.NoArgsConstructor;
@Entity
@Table(name = "ForwardProgressEntity")
-@NamedQueries({
- @NamedQuery(name = " ForwardProgressEntity.findAll", query = "SELECT e FROM ForwardProgressEntity e "),
- @NamedQuery(name = "ForwardProgressEntity.deleteAll", query = "DELETE FROM ForwardProgressEntity WHERE 1=1")
-})
+@NamedQuery(name = " ForwardProgressEntity.findAll", query = "SELECT e FROM ForwardProgressEntity e ")
+@NamedQuery(name = "ForwardProgressEntity.deleteAll", query = "DELETE FROM ForwardProgressEntity WHERE 1=1")
@Getter
@Setter
@NoArgsConstructor
public class ForwardProgressEntity extends DateEntity {
+ @Serial
private static final long serialVersionUID = 1L;
@Id
package org.onap.policy.common.im.jpa;
+import jakarta.persistence.Column;
+import jakarta.persistence.Entity;
+import jakarta.persistence.GeneratedValue;
+import jakarta.persistence.GenerationType;
+import jakarta.persistence.Id;
+import jakarta.persistence.NamedQueries;
+import jakarta.persistence.NamedQuery;
+import jakarta.persistence.PrePersist;
+import jakarta.persistence.PreUpdate;
+import jakarta.persistence.Table;
+import jakarta.persistence.Temporal;
+import jakarta.persistence.TemporalType;
+import java.io.Serial;
import java.io.Serializable;
import java.util.Date;
-import javax.persistence.Column;
-import javax.persistence.Entity;
-import javax.persistence.GeneratedValue;
-import javax.persistence.GenerationType;
-import javax.persistence.Id;
-import javax.persistence.NamedQueries;
-import javax.persistence.NamedQuery;
-import javax.persistence.PrePersist;
-import javax.persistence.PreUpdate;
-import javax.persistence.Table;
-import javax.persistence.Temporal;
-import javax.persistence.TemporalType;
import lombok.AccessLevel;
import lombok.Getter;
import lombok.NoArgsConstructor;
@Setter
@NoArgsConstructor
public class ImTestEntity implements Serializable {
+ @Serial
private static final long serialVersionUID = 1L;
@Id
package org.onap.policy.common.im.jpa;
-import javax.persistence.Column;
-import javax.persistence.Entity;
-import javax.persistence.GeneratedValue;
-import javax.persistence.GenerationType;
-import javax.persistence.Id;
-import javax.persistence.NamedQueries;
-import javax.persistence.NamedQuery;
-import javax.persistence.Table;
+import jakarta.persistence.Column;
+import jakarta.persistence.Entity;
+import jakarta.persistence.GeneratedValue;
+import jakarta.persistence.GenerationType;
+import jakarta.persistence.Id;
+import jakarta.persistence.NamedQueries;
+import jakarta.persistence.NamedQuery;
+import jakarta.persistence.Table;
+import java.io.Serial;
import lombok.AccessLevel;
import lombok.Getter;
import lombok.NoArgsConstructor;
@Entity
@Table(name = "ResourceRegistrationEntity")
-@NamedQueries({
- @NamedQuery(name = " ResourceRegistrationEntity.findAll", query = "SELECT e FROM ResourceRegistrationEntity e "),
- @NamedQuery(
- name = "ResourceRegistrationEntity.deleteAll",
- query = "DELETE FROM ResourceRegistrationEntity WHERE 1=1")
-})
+@NamedQuery(name = " ResourceRegistrationEntity.findAll", query = "SELECT e FROM ResourceRegistrationEntity e ")
+@NamedQuery(name = "ResourceRegistrationEntity.deleteAll", query = "DELETE FROM ResourceRegistrationEntity WHERE 1=1")
@Getter
@Setter
@NoArgsConstructor
public class ResourceRegistrationEntity extends DateEntity {
+ @Serial
private static final long serialVersionUID = 1L;
@Id
* Integrity Monitor
* ================================================================================
* Copyright (C) 2017-2021 AT&T Intellectual Property. All rights reserved.
+ * 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.
package org.onap.policy.common.im.jpa;
+import jakarta.persistence.Column;
+import jakarta.persistence.Entity;
+import jakarta.persistence.GeneratedValue;
+import jakarta.persistence.GenerationType;
+import jakarta.persistence.Id;
+import jakarta.persistence.NamedQuery;
+import jakarta.persistence.PrePersist;
+import jakarta.persistence.PreUpdate;
+import jakarta.persistence.Table;
+import jakarta.persistence.Temporal;
+import jakarta.persistence.TemporalType;
+import java.io.Serial;
import java.io.Serializable;
import java.util.Date;
-import javax.persistence.Column;
-import javax.persistence.Entity;
-import javax.persistence.GeneratedValue;
-import javax.persistence.GenerationType;
-import javax.persistence.Id;
-import javax.persistence.NamedQuery;
-import javax.persistence.PrePersist;
-import javax.persistence.PreUpdate;
-import javax.persistence.Table;
-import javax.persistence.Temporal;
-import javax.persistence.TemporalType;
import lombok.AccessLevel;
import lombok.Getter;
import lombok.NoArgsConstructor;
@Entity
@Table(name = "StateManagementEntity")
@NamedQuery(name = "StateManagementEntity.findAll", query = "SELECT e FROM StateManagementEntity e")
-
@Getter
@Setter
@NoArgsConstructor
public class StateManagementEntity implements Serializable {
+ @Serial
private static final long serialVersionUID = 1L;
@Id
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.fail;
+import jakarta.persistence.EntityTransaction;
+import jakarta.persistence.Query;
+import jakarta.persistence.TemporalType;
import java.util.Date;
import java.util.List;
import java.util.Properties;
import java.util.concurrent.Semaphore;
import java.util.concurrent.TimeUnit;
-import javax.persistence.EntityTransaction;
-import javax.persistence.Query;
-import javax.persistence.TemporalType;
import org.junit.After;
import org.junit.AfterClass;
import org.junit.Before;
import static org.junit.Assert.assertTrue;
+import jakarta.persistence.EntityManager;
+import jakarta.persistence.EntityManagerFactory;
+import jakarta.persistence.Persistence;
import java.io.FileOutputStream;
import java.io.IOException;
import java.util.Properties;
import java.util.concurrent.Semaphore;
import java.util.concurrent.TimeUnit;
-import javax.persistence.EntityManager;
-import javax.persistence.EntityManagerFactory;
-import javax.persistence.Persistence;
import org.onap.policy.common.utils.jpa.EntityTransCloser;
import org.onap.policy.common.utils.test.log.logback.ExtractAppender;
import org.onap.policy.common.utils.time.CurrentTime;
* Integrity Monitor
* ================================================================================
* Copyright (C) 2017-2020 AT&T Intellectual Property. All rights reserved.
+ * 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.
import static org.junit.Assert.assertEquals;
+import jakarta.persistence.Query;
import java.util.List;
-import javax.persistence.Query;
import org.junit.After;
import org.junit.AfterClass;
import org.junit.Before;
import org.slf4j.LoggerFactory;
public class StateManagementEntityTest extends IntegrityMonitorTestBase {
- private static Logger logger = LoggerFactory.getLogger(StateManagementEntityTest.class);
+ private static final Logger logger = LoggerFactory.getLogger(StateManagementEntityTest.class);
/**
* Set up for the test class.
* ================================================================================
* Copyright (C) 2017-2021 AT&T Intellectual Property. All rights reserved.
* Modifications Copyright (C) 2020 Bell Canada. All rights reserved.
+ * 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.
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.when;
-import javax.persistence.EntityManager;
-import javax.persistence.EntityManagerFactory;
-import javax.persistence.EntityTransaction;
-import javax.persistence.PersistenceException;
-import javax.persistence.QueryTimeoutException;
-import javax.persistence.TypedQuery;
+import jakarta.persistence.EntityManager;
+import jakarta.persistence.EntityManagerFactory;
+import jakarta.persistence.EntityTransaction;
+import jakarta.persistence.PersistenceException;
+import jakarta.persistence.QueryTimeoutException;
+import jakarta.persistence.TypedQuery;
import org.junit.After;
import org.junit.AfterClass;
import org.junit.Before;
private static final String UNLOCKED_ENABLED_NULL_PROVIDINGSERVICE = "unlocked,enabled,null,providingservice";
private static final String TEST_RESOURCE_NAME = "test_resource1";
- private static Logger logger = LoggerFactory.getLogger(StateManagementTest.class);
+ private static final Logger logger = LoggerFactory.getLogger(StateManagementTest.class);
//
@BeforeClass
@Test(expected = StateManagementException.class)
@SuppressWarnings("unchecked")
- public void test_StateManagementInitialization_ThrowStateManagementException_ifEntityManagerthrowsAnyException()
+ public void test_StateManagementInitialization_ThrowStateManagementException_ifEntityManagerThrowsAnyException()
throws Exception {
final EntityManager mockedEm = getMockedEntityManager();
final EntityManagerFactory mockedEmf = getMockedEntityManagerFactory(mockedEm);
<parent>
<groupId>org.onap.policy.common</groupId>
<artifactId>common-modules</artifactId>
- <version>2.0.0-SNAPSHOT</version>
+ <version>2.0.1-SNAPSHOT</version>
</parent>
+
<artifactId>policy-endpoints</artifactId>
<name>policy-endpoints</name>
<description>Endpoints</description>
+
<properties>
<cambria.version>1.2.1-oss</cambria.version>
</properties>
+
+ <dependencyManagement>
+ <dependencies>
+ <dependency>
+ <groupId>org.glassfish.jersey</groupId>
+ <artifactId>jersey-bom</artifactId>
+ <version>${version.jersey}</version>
+ <type>pom</type>
+ <scope>import</scope>
+ </dependency>
+ </dependencies>
+ </dependencyManagement>
+
<dependencies>
<dependency>
<groupId>org.onap.policy.common</groupId>
<artifactId>common-parameters</artifactId>
<version>${project.version}</version>
</dependency>
+ <dependency>
+ <groupId>org.onap.policy.common</groupId>
+ <artifactId>utils-test</artifactId>
+ <version>${project.version}</version>
+ <scope>test</scope>
+ </dependency>
<dependency>
<groupId>com.att.nsa</groupId>
<artifactId>cambriaClient</artifactId>
</exclusion>
</exclusions>
</dependency>
- <!-- needed by glassfish jersey which is needed by dmaap -->
<dependency>
- <groupId>com.fasterxml.jackson.core</groupId>
- <artifactId>jackson-core</artifactId>
+ <groupId>com.google.guava</groupId>
+ <artifactId>guava</artifactId>
+ <version>32.1.1-jre</version>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-databind</artifactId>
+ <version>${version.jackson}</version>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-annotations</artifactId>
+ <version>${version.jackson}</version>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.module</groupId>
<artifactId>jackson-module-jaxb-annotations</artifactId>
+ <version>${version.jackson}</version>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.dataformat</groupId>
<artifactId>jackson-dataformat-yaml</artifactId>
+ <version>${version.jackson}</version>
</dependency>
<dependency>
- <groupId>org.onap.dmaap.messagerouter.dmaapclient</groupId>
- <artifactId>dmaapClient</artifactId>
- </dependency>
- <dependency>
- <groupId>org.onap.aaf.authz</groupId>
- <artifactId>aaf-cadi-aaf</artifactId>
- </dependency>
- <dependency>
- <groupId>org.eclipse.jetty</groupId>
- <artifactId>jetty-server</artifactId>
+ <groupId>org.glassfish.jaxb</groupId>
+ <artifactId>jaxb-runtime</artifactId>
+ <version>4.0.2</version>
+ <scope>compile</scope>
</dependency>
<dependency>
- <groupId>org.eclipse.jetty</groupId>
- <artifactId>jetty-servlet</artifactId>
+ <groupId>org.glassfish.jersey.containers</groupId>
+ <artifactId>jersey-container-servlet</artifactId>
</dependency>
<dependency>
- <groupId>org.eclipse.jetty</groupId>
- <artifactId>jetty-servlets</artifactId>
+ <groupId>org.glassfish.jersey.media</groupId>
+ <artifactId>jersey-media-json-jackson</artifactId>
+ <version>${version.jersey}</version>
+ <scope>compile</scope>
</dependency>
<dependency>
<groupId>org.glassfish.jersey.core</groupId>
<artifactId>jersey-server</artifactId>
+ <version>${version.jersey}</version>
</dependency>
<dependency>
- <groupId>org.glassfish.jersey.containers</groupId>
- <artifactId>jersey-container-servlet-core</artifactId>
+ <groupId>org.glassfish.jersey.inject</groupId>
+ <artifactId>jersey-hk2</artifactId>
+ <version>${version.jersey}</version>
</dependency>
<dependency>
- <groupId>org.glassfish.jersey.containers</groupId>
- <artifactId>jersey-container-jetty-http</artifactId>
+ <groupId>org.apache.httpcomponents.client5</groupId>
+ <artifactId>httpclient5</artifactId>
</dependency>
<dependency>
- <groupId>org.glassfish.jersey.core</groupId>
- <artifactId>jersey-client</artifactId>
+ <groupId>org.apache.httpcomponents.core5</groupId>
+ <artifactId>httpcore5</artifactId>
</dependency>
<dependency>
- <groupId>org.glassfish.jersey.core</groupId>
- <artifactId>jersey-common</artifactId>
+ <groupId>jakarta.activation</groupId>
+ <artifactId>jakarta.activation-api</artifactId>
</dependency>
<dependency>
- <groupId>com.google.code.gson</groupId>
- <artifactId>gson</artifactId>
+ <groupId>jakarta.inject</groupId>
+ <artifactId>jakarta.inject-api</artifactId>
</dependency>
<dependency>
- <groupId>org.apache.httpcomponents</groupId>
- <artifactId>httpclient</artifactId>
+ <groupId>org.onap.dmaap.messagerouter.dmaapclient</groupId>
+ <artifactId>dmaapClient</artifactId>
</dependency>
<dependency>
- <groupId>org.apache.httpcomponents</groupId>
- <artifactId>httpcore</artifactId>
+ <groupId>org.onap.aaf.authz</groupId>
+ <artifactId>aaf-cadi-aaf</artifactId>
</dependency>
<dependency>
- <groupId>io.swagger</groupId>
- <artifactId>swagger-jersey2-jaxrs</artifactId>
- <exclusions>
- <exclusion>
- <groupId>org.junit.jupiter</groupId>
- <artifactId>junit-jupiter</artifactId>
- </exclusion>
- <exclusion>
- <groupId>org.junit.jupiter</groupId>
- <artifactId>junit-jupiter-api</artifactId>
- </exclusion>
- </exclusions>
+ <groupId>org.eclipse.jetty</groupId>
+ <artifactId>jetty-servlet</artifactId>
</dependency>
<dependency>
- <groupId>io.prometheus</groupId>
- <artifactId>simpleclient_hotspot</artifactId>
+ <groupId>org.eclipse.jetty</groupId>
+ <artifactId>jetty-security</artifactId>
</dependency>
<dependency>
- <groupId>io.prometheus</groupId>
- <artifactId>simpleclient_servlet</artifactId>
+ <groupId>org.apache.kafka</groupId>
+ <artifactId>kafka-clients</artifactId>
</dependency>
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-collections4</artifactId>
</dependency>
<dependency>
- <groupId>ch.qos.logback</groupId>
- <artifactId>logback-classic</artifactId>
- </dependency>
- <dependency>
- <groupId>org.onap.policy.common</groupId>
- <artifactId>utils-test</artifactId>
- <version>${project.version}</version>
- <scope>test</scope>
- </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.assertj</groupId>
- <artifactId>assertj-core</artifactId>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.glassfish.jersey.inject</groupId>
- <artifactId>jersey-hk2</artifactId>
- </dependency>
- <dependency>
- <groupId>com.openpojo</groupId>
- <artifactId>openpojo</artifactId>
- </dependency>
- <dependency>
- <groupId>org.projectlombok</groupId>
- <artifactId>lombok</artifactId>
- <scope>provided</scope>
- </dependency>
- <dependency>
- <groupId>org.apache.kafka</groupId>
- <artifactId>kafka-clients</artifactId>
+ <groupId>io.swagger.core.v3</groupId>
+ <artifactId>swagger-annotations</artifactId>
</dependency>
</dependencies>
</project>
* ONAP
* ================================================================================
* Copyright (C) 2017-2020 AT&T Intellectual Property. All rights reserved.
+ * 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.
package org.onap.policy.common.endpoints.http.client;
+import jakarta.ws.rs.client.Entity;
+import jakarta.ws.rs.client.InvocationCallback;
+import jakarta.ws.rs.client.WebTarget;
+import jakarta.ws.rs.core.Response;
import java.util.Map;
import java.util.concurrent.Future;
-import javax.ws.rs.client.Entity;
-import javax.ws.rs.client.InvocationCallback;
-import javax.ws.rs.client.WebTarget;
-import javax.ws.rs.core.Response;
import org.onap.policy.common.capabilities.Startable;
/**
String getBasePath();
/**
- * Get the user name.
+ * Get the username.
*
- * @return the user name
+ * @return the username
*/
String getUserName();
* ONAP
* ================================================================================
* Copyright (C) 2019 AT&T Intellectual Property. All rights reserved.
+ * 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.
package org.onap.policy.common.endpoints.http.client;
+import java.io.Serial;
+
/**
* Exception generated by HttpClient builder.
*/
public class HttpClientConfigException extends Exception {
+ @Serial
private static final long serialVersionUID = 1L;
public HttpClientConfigException() {
* ONAP
* ================================================================================
* Copyright (C) 2017-2019, 2021 AT&T Intellectual Property. All rights reserved.
+ * 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.
/**
* Logger.
*/
- private static Logger logger = LoggerFactory.getLogger(IndexedHttpClientFactory.class);
+ private static final Logger logger = LoggerFactory.getLogger(IndexedHttpClientFactory.class);
protected HashMap<String, HttpClient> clients = new HashMap<>();
* ================================================================================
* Copyright (C) 2017-2021 AT&T Intellectual Property. All rights reserved.
* Modifications Copyright (C) 2018 Samsung Electronics Co., Ltd.
- * Modifications Copyright (C) 2019 Nordix Foundation.
+ * Modifications Copyright (C) 2019, 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.
package org.onap.policy.common.endpoints.http.client.internal;
import com.google.re2j.Pattern;
+import jakarta.ws.rs.client.Client;
+import jakarta.ws.rs.client.ClientBuilder;
+import jakarta.ws.rs.client.Entity;
+import jakarta.ws.rs.client.Invocation.Builder;
+import jakarta.ws.rs.client.InvocationCallback;
+import jakarta.ws.rs.client.WebTarget;
+import jakarta.ws.rs.core.Response;
import java.security.KeyManagementException;
import java.security.NoSuchAlgorithmException;
import java.security.SecureRandom;
import java.util.Map.Entry;
import java.util.concurrent.Future;
import javax.net.ssl.SSLContext;
-import javax.ws.rs.client.Client;
-import javax.ws.rs.client.ClientBuilder;
-import javax.ws.rs.client.Entity;
-import javax.ws.rs.client.Invocation.Builder;
-import javax.ws.rs.client.InvocationCallback;
-import javax.ws.rs.client.WebTarget;
-import javax.ws.rs.core.Response;
import lombok.Getter;
import lombok.ToString;
import org.apache.commons.lang3.StringUtils;
/**
* Logger.
*/
- private static Logger logger = LoggerFactory.getLogger(JerseyClient.class);
+ private static final Logger logger = LoggerFactory.getLogger(JerseyClient.class);
protected static final String JERSEY_DEFAULT_SERIALIZATION_PROVIDER =
"org.onap.policy.common.gson.GsonMessageBodyHandler";
/**
* Constructor.
*
- * <p>name the name https is it https or not selfSignedCerts are there self signed certs
- * hostname the hostname port port being used basePath base context userName user
- * password password
+ * <p>name - the name
+ * https - is it https or not
+ * selfSignedCerts - are there self-signed certs
+ * hostname - the hostname
+ * port - port being used
+ * basePath - base context
+ * userName - user credentials
+ * password - password credentials
*
* @param busTopicParams Input parameters object
* @throws KeyManagementException key exception
if (this.selfSignedCerts) {
sslContext.init(null, NetworkUtil.getAlwaysTrustingManager(), new SecureRandom());
- // This falls under self signed certs which is used for non-production testing environments where
+ // This falls under self-signed certs which is used for non-production testing environments where
// the hostname in the cert is unlikely to be crafted properly. We always return true for the
- // hostname verifier. This causes a sonar vuln but we ignore it as it could cause problems in some
+ // hostname verifier. This causes a sonar vuln, but we ignore it as it could cause problems in some
// testing environments.
clientBuilder =
ClientBuilder.newBuilder().sslContext(sslContext).hostnameVerifier(
* ONAP
* ================================================================================
* Copyright (C) 2018 AT&T Intellectual Property. All rights reserved.
+ * 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.
package org.onap.policy.common.endpoints.http.server;
+import jakarta.servlet.Filter;
+import jakarta.servlet.FilterChain;
+import jakarta.servlet.ServletException;
+import jakarta.servlet.ServletRequest;
+import jakarta.servlet.ServletResponse;
+import jakarta.servlet.http.HttpServletRequest;
+import jakarta.servlet.http.HttpServletResponse;
import java.io.IOException;
-import javax.servlet.Filter;
-import javax.servlet.FilterChain;
-import javax.servlet.ServletException;
-import javax.servlet.ServletRequest;
-import javax.servlet.ServletResponse;
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
public abstract class AuthorizationFilter implements Filter {
- private static Logger logger = LoggerFactory.getLogger(AuthorizationFilter.class);
+ private static final Logger logger = LoggerFactory.getLogger(AuthorizationFilter.class);
@Override
public void doFilter(ServletRequest servletRequest, ServletResponse servletResponse, FilterChain filterChain)
/*-
* ============LICENSE_START=======================================================
* Copyright (C) 2019, 2021 AT&T Intellectual Property. All rights reserved.
+ * 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.
package org.onap.policy.common.endpoints.http.server;
import com.google.gson.JsonSyntaxException;
-import javax.ws.rs.Produces;
-import javax.ws.rs.core.MediaType;
-import javax.ws.rs.core.Response;
-import javax.ws.rs.ext.ExceptionMapper;
-import javax.ws.rs.ext.Provider;
+import jakarta.ws.rs.Produces;
+import jakarta.ws.rs.core.MediaType;
+import jakarta.ws.rs.core.Response;
+import jakarta.ws.rs.ext.ExceptionMapper;
+import jakarta.ws.rs.ext.Provider;
import lombok.AllArgsConstructor;
import lombok.Getter;
import org.slf4j.Logger;
@Provider
@Produces(MediaType.APPLICATION_JSON)
public class JsonExceptionMapper implements ExceptionMapper<JsonSyntaxException> {
- private static Logger logger = LoggerFactory.getLogger(JsonExceptionMapper.class);
+ private static final Logger logger = LoggerFactory.getLogger(JsonExceptionMapper.class);
@Override
public Response toResponse(JsonSyntaxException exception) {
package org.onap.policy.common.endpoints.http.server;
+import jakarta.servlet.Filter;
import java.util.Arrays;
import java.util.List;
import java.util.Optional;
import java.util.Properties;
import java.util.stream.Collectors;
-import javax.servlet.Filter;
import lombok.ToString;
import org.onap.policy.common.endpoints.http.server.aaf.AafAuthFilter;
import org.onap.policy.common.endpoints.parameters.RestServerParameters;
* @return the provider class names
*/
private String getProviderClassNames(List<Class<?>> jaxrsProviders) {
- return String.join(",", jaxrsProviders.stream().map(Class::getName).collect(Collectors.toList()));
+ return jaxrsProviders.stream().map(Class::getName).collect(Collectors.joining(","));
}
private String getValue(final String value) {
/*-
* ============LICENSE_START=======================================================
* Copyright (C) 2019, 2021 AT&T Intellectual Property. All rights reserved.
+ * 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.
package org.onap.policy.common.endpoints.http.server;
-import javax.ws.rs.Produces;
-import javax.ws.rs.core.Response;
-import javax.ws.rs.ext.ExceptionMapper;
-import javax.ws.rs.ext.Provider;
+import jakarta.ws.rs.Produces;
+import jakarta.ws.rs.core.Response;
+import jakarta.ws.rs.ext.ExceptionMapper;
+import jakarta.ws.rs.ext.Provider;
import lombok.AllArgsConstructor;
import lombok.Getter;
import org.slf4j.Logger;
@Provider
@Produces(YamlMessageBodyHandler.APPLICATION_YAML)
public class YamlExceptionMapper implements ExceptionMapper<YAMLException> {
- private static Logger logger = LoggerFactory.getLogger(YamlExceptionMapper.class);
+ private static final Logger logger = LoggerFactory.getLogger(YamlExceptionMapper.class);
@Override
public Response toResponse(YAMLException exception) {
* ONAP
* ================================================================================
* Copyright (C) 2019 AT&T Intellectual Property. All rights reserved.
+ * 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.
package org.onap.policy.common.endpoints.http.server;
import com.google.gson.GsonBuilder;
-import javax.ws.rs.Consumes;
-import javax.ws.rs.Produces;
-import javax.ws.rs.core.MediaType;
-import javax.ws.rs.ext.Provider;
+import jakarta.ws.rs.Consumes;
+import jakarta.ws.rs.Produces;
+import jakarta.ws.rs.core.MediaType;
+import jakarta.ws.rs.ext.Provider;
import org.onap.policy.common.gson.JacksonHandler;
import org.onap.policy.common.utils.coder.YamlJsonTranslator;
* ONAP
* ================================================================================
* Copyright (C) 2019, 2021 AT&T Intellectual Property. All rights reserved.
+ * 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.
import com.google.gson.GsonBuilder;
import com.google.gson.JsonSyntaxException;
+import jakarta.ws.rs.Consumes;
+import jakarta.ws.rs.Produces;
+import jakarta.ws.rs.core.MediaType;
+import jakarta.ws.rs.core.MultivaluedMap;
+import jakarta.ws.rs.ext.MessageBodyReader;
+import jakarta.ws.rs.ext.MessageBodyWriter;
+import jakarta.ws.rs.ext.Provider;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.lang.annotation.Annotation;
import java.lang.reflect.Type;
import java.nio.charset.StandardCharsets;
-import javax.ws.rs.Consumes;
-import javax.ws.rs.Produces;
-import javax.ws.rs.core.MediaType;
-import javax.ws.rs.core.MultivaluedMap;
-import javax.ws.rs.ext.MessageBodyReader;
-import javax.ws.rs.ext.MessageBodyWriter;
-import javax.ws.rs.ext.Provider;
import org.onap.policy.common.gson.GsonMessageBodyHandler;
import org.onap.policy.common.utils.coder.YamlJsonTranslator;
import org.slf4j.Logger;
* ONAP
* ================================================================================
* Copyright (C) 2018 AT&T Intellectual Property. All rights reserved.
+ * 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.
package org.onap.policy.common.endpoints.http.server.aaf;
-import javax.servlet.http.HttpServletRequest;
+import jakarta.servlet.http.HttpServletRequest;
import org.onap.policy.common.endpoints.http.server.AuthorizationFilter;
/**
* ONAP
* ================================================================================
* Copyright (C) 2018 AT&T Intellectual Property. All rights reserved.
+ * 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.
package org.onap.policy.common.endpoints.http.server.aaf;
-import javax.servlet.http.HttpServletRequest;
+import jakarta.servlet.http.HttpServletRequest;
import org.onap.policy.common.utils.network.NetworkUtil;
/**
package org.onap.policy.common.endpoints.http.server.internal;
-import io.swagger.jersey.config.JerseyJaxrsConfig;
import org.apache.commons.lang3.StringUtils;
+import org.eclipse.jetty.servlet.ServletContextHandler;
import org.eclipse.jetty.servlet.ServletHolder;
import org.glassfish.jersey.server.ServerProperties;
+import org.glassfish.jersey.servlet.ServletContainer;
import org.onap.policy.common.endpoints.http.server.JsonExceptionMapper;
import org.onap.policy.common.gson.GsonMessageBodyHandler;
import org.onap.policy.common.utils.network.NetworkUtil;
*
* <p>Note: the serialization provider will always be added to the server's class providers, as will the swagger
* providers (assuming swagger has been enabled). This happens whether {@link #addServletClass(String, String)} is used
- * or {@link #addServletPackage(String, String)} is used. Thus it's possible to have both the server's class provider
+ * or {@link #addServletPackage(String, String)} is used. Thus, it's possible to have both the server's class provider
* property and the server's package provider property populated.
*/
public class JettyJerseyServer extends JettyServletServer {
protected static final String JERSEY_GSON_INIT_CLASSNAMES_PARAM_VALUE =
String.join(",", GsonMessageBodyHandler.class.getName(), JsonExceptionMapper.class.getName());
- /**
- * Jersey Swagger Classes Init Param Value.
- */
- protected static final String SWAGGER_INIT_CLASSNAMES_PARAM_VALUE =
- "io.swagger.jaxrs.listing.ApiListingResource," + "io.swagger.jaxrs.listing.SwaggerSerializers";
-
/**
* Logger.
*/
*/
protected void attachSwaggerServlet(boolean https) {
- ServletHolder swaggerServlet = getServlet(JerseyJaxrsConfig.class, "/");
+ ServletContextHandler handler = new ServletContextHandler(ServletContextHandler.NO_SESSIONS);
+ handler.setContextPath("/");
+
+ ServletHolder swaggerServlet = handler.addServlet(ServletContainer.class, "/*");
String hostname = this.connector.getHost();
if (StringUtils.isBlank(hostname) || hostname.equals(NetworkUtil.IPV4_WILDCARD_ADDRESS)) {
initClasses = classProvider;
if (this.swaggerId != null) {
- initClasses += "," + SWAGGER_INIT_CLASSNAMES_PARAM_VALUE;
-
+ jerseyServlet.setInitParameter("jersey.config.server.provider.packages",
+ "io.swagger.v3.jaxrs2.integration.resources,io.swagger.sample.resource");
jerseyServlet.setInitParameter(SWAGGER_CONTEXT_ID, swaggerId);
jerseyServlet.setInitParameter(SWAGGER_SCANNER_ID, swaggerId);
}
package org.onap.policy.common.endpoints.http.server.internal;
-import io.prometheus.client.exporter.MetricsServlet;
import io.prometheus.client.hotspot.DefaultExports;
+import io.prometheus.client.servlet.jakarta.exporter.MetricsServlet;
+import jakarta.servlet.Servlet;
import java.util.EnumSet;
import java.util.HashMap;
import java.util.Map;
-import javax.servlet.DispatcherType;
-import javax.servlet.Servlet;
import lombok.Getter;
import lombok.NonNull;
import lombok.ToString;
/**
* Logger.
*/
- private static Logger logger = LoggerFactory.getLogger(JettyServletServer.class);
+ private static final Logger logger = LoggerFactory.getLogger(JettyServletServer.class);
private static final String NOT_SUPPORTED = " is not supported on this type of jetty server";
protected boolean sniHostCheck;
/**
- * Server auth user name.
+ * Server auth username.
*/
@Getter
protected String user;
* Start condition.
*/
@ToString.Exclude
- protected Object startCondition = new Object();
+ protected final Object startCondition = new Object();
/**
* Constructor.
tempFilterPath = "/*";
}
- context.addFilter(filterClass, tempFilterPath, EnumSet.of(DispatcherType.INCLUDE, DispatcherType.REQUEST));
+ context.addFilter(filterClass, tempFilterPath,
+ EnumSet.of(jakarta.servlet.DispatcherType.INCLUDE, jakarta.servlet.DispatcherType.REQUEST));
}
protected ServletHolder getServlet(@NonNull Class<? extends Servlet> servlet, @NonNull String servletPath) {
import static org.junit.Assert.assertSame;
import static org.junit.Assert.assertTrue;
-import io.prometheus.client.exporter.MetricsServlet;
+import io.prometheus.client.servlet.jakarta.exporter.MetricsServlet;
+import jakarta.ws.rs.client.Entity;
+import jakarta.ws.rs.client.InvocationCallback;
+import jakarta.ws.rs.core.MediaType;
+import jakarta.ws.rs.core.Response;
import java.util.Collections;
import java.util.HashMap;
import java.util.List;
import java.util.TreeMap;
import java.util.concurrent.CountDownLatch;
import java.util.concurrent.TimeUnit;
-import javax.ws.rs.client.Entity;
-import javax.ws.rs.client.InvocationCallback;
-import javax.ws.rs.core.MediaType;
-import javax.ws.rs.core.Response;
import lombok.Getter;
import org.junit.AfterClass;
import org.junit.Before;
response = clientPdp.get("metrics");
assertEquals(200, response.getStatus());
- response = clientPdp.get("swagger.json");
+ response = clientPdp.get("openapi.json");
assertEquals(200, response.getStatus());
assertFalse(MyGsonProvider.hasWrittenSome());
}
- class MyEntity {
+ static class MyEntity {
private String myParameter;
}
- class MyCallback implements InvocationCallback<Response> {
+ static class MyCallback implements InvocationCallback<Response> {
@Getter
private Response response;
import static org.junit.Assert.assertTrue;
import com.google.gson.Gson;
-import io.prometheus.client.exporter.MetricsServlet;
+import io.prometheus.client.servlet.jakarta.exporter.MetricsServlet;
import java.io.IOException;
import java.io.InputStream;
import java.net.HttpURLConnection;
private static final String LOCALHOST = "localhost";
private static final String JSON_MEDIA = "application/json";
private static final String YAML_MEDIA = YamlMessageBodyHandler.APPLICATION_YAML;
- private static final String SWAGGER_JSON = "/swagger.json";
+ private static final String SWAGGER_JSON = "/openapi.json";
private static final String JUNIT_ECHO_HELLO = "/junit/echo/hello";
private static final String JUNIT_ECHO_FULL_REQUEST = "/junit/echo/full/request";
private static final String SOME_TEXT = "some text";
/**
* Logger.
*/
- private static Logger logger = LoggerFactory.getLogger(HttpServerTest.class);
+ private static final Logger logger = LoggerFactory.getLogger(HttpServerTest.class);
private static final String LOCALHOST_PREFIX = "http://localhost:";
assertEquals(reqText, response);
response = http(portUrl + SWAGGER_JSON);
- assertThat(response).contains("Swagger Server");
+ assertThat(response).contains("openapi");
}
@Test
assertTrue(HttpServletServerFactoryInstance.getServerFactory().get(port).isAlive());
assertEquals(1, HttpServletServerFactoryInstance.getServerFactory().inventory().size());
- System.setProperty("cadi_longitude", "0.0");
- System.setProperty("cadi_latitude", "0.0");
- server.setAafAuthentication("/*");
- assertTrue(HttpServletServerFactoryInstance.getServerFactory().get(port).isAaf());
-
HttpServletServerFactoryInstance.getServerFactory().destroy(port);
assertEquals(0, HttpServletServerFactoryInstance.getServerFactory().inventory().size());
}
* ONAP
* ================================================================================
* Copyright (C) 2019 AT&T Intellectual Property. All rights reserved.
+ * 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.
import static org.junit.Assert.assertEquals;
import com.google.gson.JsonSyntaxException;
-import javax.ws.rs.core.Response;
+import jakarta.ws.rs.core.Response;
import org.junit.Before;
import org.junit.Test;
import org.onap.policy.common.endpoints.http.server.JsonExceptionMapper;
* ONAP
* ================================================================================
* Copyright (C) 2019 AT&T Intellectual Property. All rights reserved.
+ * 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.
package org.onap.policy.common.endpoints.http.server.test;
+import jakarta.ws.rs.core.MediaType;
+import jakarta.ws.rs.core.MultivaluedMap;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.lang.annotation.Annotation;
import java.lang.reflect.Type;
-import javax.ws.rs.core.MediaType;
-import javax.ws.rs.core.MultivaluedMap;
import lombok.AccessLevel;
import lombok.Setter;
import org.onap.policy.common.gson.GsonMessageBodyHandler;
* ONAP
* ================================================================================
* Copyright (C) 2019 AT&T Intellectual Property. All rights reserved.
+ * 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.
package org.onap.policy.common.endpoints.http.server.test;
+import jakarta.ws.rs.core.MediaType;
+import jakarta.ws.rs.core.MultivaluedMap;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.lang.annotation.Annotation;
import java.lang.reflect.Type;
-import javax.ws.rs.core.MediaType;
-import javax.ws.rs.core.MultivaluedMap;
import lombok.AccessLevel;
import lombok.Setter;
import org.onap.policy.common.endpoints.http.server.YamlMessageBodyHandler;
* ONAP
* ================================================================================
* Copyright (C) 2017-2019 AT&T Intellectual Property. All rights reserved.
+ * 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.
package org.onap.policy.common.endpoints.http.server.test;
-import io.swagger.annotations.Api;
-import io.swagger.annotations.ApiOperation;
-import javax.ws.rs.DELETE;
-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.core.MediaType;
-import javax.ws.rs.core.Response;
-import javax.ws.rs.core.Response.Status;
+import io.swagger.v3.oas.annotations.Operation;
+import io.swagger.v3.oas.annotations.media.Content;
+import io.swagger.v3.oas.annotations.media.Schema;
+import io.swagger.v3.oas.annotations.responses.ApiResponse;
+import jakarta.ws.rs.DELETE;
+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.core.MediaType;
+import jakarta.ws.rs.core.Response;
+import jakarta.ws.rs.core.Response.Status;
import org.onap.policy.common.endpoints.http.server.YamlMessageBodyHandler;
-@Api(value = "echo")
@Path("/junit/echo")
public class RestEchoService {
@GET
@Path("{word}")
@Produces(MediaType.TEXT_PLAIN)
- @ApiOperation(value = "echoes back whatever received")
+ @Operation(summary = "echoes back whatever received")
public String echo(@PathParam("word") String word) {
return word;
}
@PUT
@Path("{word}")
@Produces(MediaType.TEXT_PLAIN)
- @ApiOperation(value = "echoes back whatever received")
+ @Operation(summary = "echoes back whatever received")
public String echoPut(@PathParam("word") String word, Object entity) {
return "PUT:" + word + ":" + entity.toString();
}
@POST
@Path("/full/request")
@Produces({MediaType.APPLICATION_JSON, YamlMessageBodyHandler.APPLICATION_YAML})
- @ApiOperation(value = "echoes back the request structure", response = RestEchoReqResp.class)
+ @Operation(summary = "echoes back the request structure")
+ @ApiResponse(content = {@Content(schema = @Schema(implementation = RestEchoReqResp.class))})
public Response echoFullyPost(RestEchoReqResp reqResp) {
return Response.status(Status.OK).entity(reqResp).build();
}
@POST
@Path("{word}")
@Produces(MediaType.TEXT_PLAIN)
- @ApiOperation(value = "echoes back whatever received")
+ @Operation(summary = "echoes back whatever received")
public String echoPost(@PathParam("word") String word, Object entity) {
return "POST:" + word + ":" + entity.toString();
}
@DELETE
@Path("{word}")
@Produces(MediaType.TEXT_PLAIN)
- @ApiOperation(value = "echoes back whatever received")
+ @Operation(summary = "echoes back whatever received")
public String echoDelete(@PathParam("word") String word) {
return "DELETE:" + word;
}
* policy-endpoints
* ================================================================================
* Copyright (C) 2017, 2019-2020 AT&T Intellectual Property. All rights reserved.
+ * 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.
package org.onap.policy.common.endpoints.http.server.test;
+import jakarta.ws.rs.GET;
+import jakarta.ws.rs.Path;
+import jakarta.ws.rs.Produces;
+import jakarta.ws.rs.core.MediaType;
import java.util.List;
-import javax.ws.rs.GET;
-import javax.ws.rs.Path;
-import javax.ws.rs.Produces;
-import javax.ws.rs.core.MediaType;
import org.onap.policy.common.endpoints.http.server.HttpServletServer;
import org.onap.policy.common.endpoints.http.server.HttpServletServerFactoryInstance;
* policy-endpoints
* ================================================================================
* Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * 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.
package org.onap.policy.common.endpoints.http.server.test;
-import javax.ws.rs.GET;
-import javax.ws.rs.Path;
-import javax.ws.rs.Produces;
-import javax.ws.rs.core.MediaType;
-import javax.ws.rs.core.Response;
-import javax.ws.rs.core.Response.Status;
+import jakarta.ws.rs.GET;
+import jakarta.ws.rs.Path;
+import jakarta.ws.rs.Produces;
+import jakarta.ws.rs.core.MediaType;
+import jakarta.ws.rs.core.Response;
+import jakarta.ws.rs.core.Response.Status;
@Path("/")
public class RestMockHealthCheck {
@GET
@Path("pdp/test")
@Produces(MediaType.APPLICATION_JSON)
- public Response pdpHealthCheck() {
+ public Response pdpHealthCheck() {
return Response.status(Status.INTERNAL_SERVER_ERROR).entity("At least some Dead").build();
}
import static org.mockito.Mockito.verify;
import static org.mockito.Mockito.when;
-import io.prometheus.client.exporter.MetricsServlet;
+import io.prometheus.client.servlet.jakarta.exporter.MetricsServlet;
+import jakarta.servlet.FilterChain;
+import jakarta.servlet.ServletException;
+import jakarta.servlet.ServletRequest;
+import jakarta.servlet.ServletResponse;
+import jakarta.servlet.http.HttpServletRequest;
+import jakarta.ws.rs.Consumes;
+import jakarta.ws.rs.POST;
+import jakarta.ws.rs.Path;
+import jakarta.ws.rs.Produces;
+import jakarta.ws.rs.core.MediaType;
+import jakarta.ws.rs.core.Response;
import java.io.IOException;
import java.io.PrintWriter;
import java.net.HttpURLConnection;
import java.util.Base64;
import java.util.List;
import java.util.Properties;
-import javax.servlet.FilterChain;
-import javax.servlet.ServletException;
-import javax.servlet.ServletRequest;
-import javax.servlet.ServletResponse;
-import javax.servlet.http.HttpServletRequest;
-import javax.ws.rs.Consumes;
-import javax.ws.rs.POST;
-import javax.ws.rs.Path;
-import javax.ws.rs.Produces;
-import javax.ws.rs.core.MediaType;
-import javax.ws.rs.core.Response;
import lombok.Getter;
import org.apache.commons.io.IOUtils;
import org.junit.AfterClass;
}
}
- private static class Filter2 implements javax.servlet.Filter {
+ private static class Filter2 implements jakarta.servlet.Filter {
@Override
public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain)
throws IOException, ServletException {
* ONAP
* ================================================================================
* Copyright (C) 2018 AT&T Intellectual Property. All rights reserved.
+ * 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.
package org.onap.policy.common.endpoints.http.server.test;
-import javax.servlet.http.HttpServletRequest;
+import jakarta.servlet.http.HttpServletRequest;
import org.onap.policy.common.endpoints.http.server.aaf.AafAuthFilter;
public class TestAafAuthFilter extends AafAuthFilter {
* ONAP
* ================================================================================
* Copyright (C) 2018 AT&T Intellectual Property. All rights reserved.
+ * 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.
package org.onap.policy.common.endpoints.http.server.test;
-import javax.servlet.http.HttpServletRequest;
+import jakarta.servlet.http.HttpServletRequest;
import org.onap.policy.common.endpoints.http.server.aaf.AafGranularAuthFilter;
import org.onap.policy.common.utils.network.NetworkUtil;
* ONAP
* ================================================================================
* Copyright (C) 2018 AT&T Intellectual Property. All rights reserved.
+ * 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.
package org.onap.policy.common.endpoints.http.server.test;
-import javax.servlet.http.HttpServletRequest;
+import jakarta.servlet.http.HttpServletRequest;
import org.onap.policy.common.endpoints.http.server.AuthorizationFilter;
public class TestAuthorizationFilter extends AuthorizationFilter {
* ONAP
* ================================================================================
* Copyright (C) 2018 AT&T Intellectual Property. All rights reserved.
+ * 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.
package org.onap.policy.common.endpoints.http.server.test;
+import jakarta.servlet.Filter;
+import jakarta.servlet.FilterChain;
+import jakarta.servlet.ServletException;
+import jakarta.servlet.ServletRequest;
+import jakarta.servlet.ServletResponse;
import java.io.IOException;
-import javax.servlet.Filter;
-import javax.servlet.FilterChain;
-import javax.servlet.ServletException;
-import javax.servlet.ServletRequest;
-import javax.servlet.ServletResponse;
public class TestFilter implements Filter {
* ONAP
* ================================================================================
* Copyright (C) 2019 AT&T Intellectual Property. All rights reserved.
+ * 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.
import static org.junit.Assert.assertEquals;
-import javax.ws.rs.core.Response;
+import jakarta.ws.rs.core.Response;
import org.junit.Before;
import org.junit.Test;
import org.onap.policy.common.endpoints.http.server.YamlExceptionMapper;
* ONAP
* ================================================================================
* Copyright (C) 2019, 2021 AT&T Intellectual Property. All rights reserved.
+ * 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.
import static org.junit.Assert.assertTrue;
import com.google.gson.JsonObject;
+import jakarta.ws.rs.core.MediaType;
import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
+import java.nio.charset.StandardCharsets;
import java.util.HashMap;
import java.util.Map;
import java.util.TreeMap;
-import javax.ws.rs.core.MediaType;
import lombok.ToString;
import org.junit.Test;
import org.onap.policy.common.endpoints.http.server.YamlJacksonHandler;
ByteArrayOutputStream outstr = new ByteArrayOutputStream();
hdlr.writeTo(data, Data.class, Data.class, null, null, null, outstr);
- assertEquals("abc: def\nhello: world\nmyId: 100\nvalue: a value\n", outstr.toString("UTF-8"));
+ assertEquals("abc: def\nhello: world\nmyId: 100\nvalue: a value\n", outstr.toString(StandardCharsets.UTF_8));
/*
* Ensure everything deserializes as expected.
* ONAP
* ================================================================================
* Copyright (C) 2019-2021 AT&T Intellectual Property. All rights reserved.
+ * 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.
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertTrue;
+import jakarta.ws.rs.core.MediaType;
import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.io.OutputStream;
import java.util.HashMap;
import java.util.Map;
-import javax.ws.rs.core.MediaType;
import lombok.ToString;
import org.junit.Before;
import org.junit.Test;
* ONAP
* ================================================================================
* Copyright (C) 2019 AT&T Intellectual Property. All rights reserved.
+ * 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.
package org.onap.policy.common.endpoints.utils;
import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertNull;
import static org.junit.Assert.assertTrue;
@Test
public void testGetBoolean() {
- assertEquals(true, utils.getBoolean(".my-bool", false));
- assertEquals(false, utils.getBoolean(".my-bool2", true));
- assertEquals(true, utils.getBoolean(".empty-bool", true));
- assertEquals(false, utils.getBoolean(".invalid-bool", true));
- assertEquals(true, utils.getBoolean(".missing-bool", true));
+ assertTrue(utils.getBoolean(".my-bool", false));
+ assertFalse(utils.getBoolean(".my-bool2", true));
+ assertTrue(utils.getBoolean(".empty-bool", true));
+ assertFalse(utils.getBoolean(".invalid-bool", true));
+ assertTrue(utils.getBoolean(".missing-bool", true));
assertNull(invalidName);
assertNull(invalidValue);
ONAP policy
================================================================================
Copyright (C) 2017-2021 AT&T Intellectual Property. All rights reserved.
- Modifications Copyright (C) 2019-2020, 2022 Nordix Foundation.
+ Modifications Copyright (C) 2019-2020, 2022-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.
<parent>
<groupId>org.onap.policy.parent</groupId>
<artifactId>integration</artifactId>
- <version>4.0.0-SNAPSHOT</version>
+ <version>4.0.1-SNAPSHOT</version>
<relativePath />
</parent>
<groupId>org.onap.policy.common</groupId>
<artifactId>common-modules</artifactId>
- <version>2.0.0-SNAPSHOT</version>
+ <version>2.0.1-SNAPSHOT</version>
<packaging>pom</packaging>
<description>Common Modules for Policy-Engine in both XACML and Drools flavor</description>
<properties>
- <!-- Project common build settings -->
-
<!-- Project path properties -->
<nexusproxy>https://nexus.onap.org</nexusproxy>
<sitePath>/content/sites/site/${project.groupId}/${project.artifactId}/${project.version}</sitePath>
<module>spring-utils</module>
</modules>
+ <dependencies>
+ <dependency>
+ <groupId>org.yaml</groupId>
+ <artifactId>snakeyaml</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.slf4j</groupId>
+ <artifactId>slf4j-api</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>com.google.code.gson</groupId>
+ <artifactId>gson</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.commons</groupId>
+ <artifactId>commons-lang3</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>com.fasterxml.jackson.core</groupId>
+ <artifactId>jackson-core</artifactId>
+ </dependency>
+
+ <!-- Prometheus Client Libraries -->
+ <dependency>
+ <groupId>io.prometheus</groupId>
+ <artifactId>simpleclient</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>io.prometheus</groupId>
+ <artifactId>simpleclient_hotspot</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>io.prometheus</groupId>
+ <artifactId>simpleclient_servlet_jakarta</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>io.prometheus</groupId>
+ <artifactId>simpleclient_logback</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>com.google.re2j</groupId>
+ <artifactId>re2j</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.projectlombok</groupId>
+ <artifactId>lombok</artifactId>
+ <scope>provided</scope>
+ </dependency>
+ <dependency>
+ <groupId>jakarta.xml.bind</groupId>
+ <artifactId>jakarta.xml.bind-api</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>jakarta.servlet</groupId>
+ <artifactId>jakarta.servlet-api</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>jakarta.validation</groupId>
+ <artifactId>jakarta.validation-api</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>io.swagger.core.v3</groupId>
+ <artifactId>swagger-jaxrs2-jakarta</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>io.swagger.core.v3</groupId>
+ <artifactId>swagger-jaxrs2-servlet-initializer-v2-jakarta</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.hibernate.orm</groupId>
+ <artifactId>hibernate-core</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.hibernate</groupId>
+ <artifactId>hibernate-core-jakarta</artifactId>
+ </dependency>
+
+ <!-- Test -->
+ <dependency>
+ <groupId>org.springframework</groupId>
+ <artifactId>spring-test</artifactId>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.assertj</groupId>
+ <artifactId>assertj-core</artifactId>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.mockito</groupId>
+ <artifactId>mockito-core</artifactId>
+ <scope>test</scope>
+ </dependency>
+ </dependencies>
+
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-deploy-plugin</artifactId>
+ <version>3.1.1</version>
<configuration>
<skip />
</configuration>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-site-plugin</artifactId>
+ <version>4.0.0-M9</version>
<dependencies>
<dependency>
<groupId>org.apache.maven.wagon</groupId>
<artifactId>wagon-webdav-jackrabbit</artifactId>
- <version>2.10</version>
+ <version>3.5.3</version>
</dependency>
</dependencies>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-javadoc-plugin</artifactId>
- <version>2.10.4</version>
+ <version>3.5.0</version>
<configuration>
<failOnError>false</failOnError>
<doclet>org.umlgraph.doclet.UmlGraphDoc</doclet>
<docletArtifact>
<groupId>org.umlgraph</groupId>
<artifactId>umlgraph</artifactId>
- <version>5.6</version>
+ <version>5.6.6</version>
</docletArtifact>
<additionalparam>-views</additionalparam>
<useStandardDocletOptions>true</useStandardDocletOptions>
ONAP policy
================================================================================
Copyright (C) 2022 Bell Canada. All rights reserved.
+ 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.
<parent>
<groupId>org.onap.policy.common</groupId>
<artifactId>common-modules</artifactId>
- <version>2.0.0-SNAPSHOT</version>
+ <version>2.0.1-SNAPSHOT</version>
</parent>
<artifactId>spring-utils</artifactId>
<name>spring-utils</name>
- <description>This artifact contains the common spring related utilitiy classes to be used by multiple policy framework components.</description>
+ <description>This artifact contains the common spring related utility classes to be used by multiple policy framework components.</description>
<dependencies>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-web</artifactId>
</dependency>
-
- <dependency>
- <groupId>org.hibernate</groupId>
- <artifactId>hibernate-core</artifactId>
- </dependency>
</dependencies>
</project>
\ No newline at end of file
/*-
* ============LICENSE_START=======================================================
- * Copyright (C) 2022 Bell Canada. All rights reserved.
+ * Copyright (C) 2022 Bell Canada. All rights reserved.
+ * 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.
package org.onap.policy.common.spring.utils;
+import java.io.Serial;
import org.hibernate.boot.model.naming.Identifier;
import org.hibernate.boot.model.naming.ImplicitJoinColumnNameSource;
import org.hibernate.boot.model.naming.ImplicitNamingStrategyJpaCompliantImpl;
public class CustomImplicitNamingStrategy extends ImplicitNamingStrategyJpaCompliantImpl {
+ @Serial
private static final long serialVersionUID = 8666774028328486896L;
@Override
<parent>
<groupId>org.onap.policy.common</groupId>
<artifactId>common-modules</artifactId>
- <version>2.0.0-SNAPSHOT</version>
+ <version>2.0.1-SNAPSHOT</version>
</parent>
<artifactId>utils-test</artifactId>
<properties>
<powermock.version>2.0.4</powermock.version>
-
- <!-- this whole module is test code -->
+ <!-- this whole module is testing code -->
<sonar.skip>true</sonar.skip>
</properties>
<dependency>
<groupId>org.bouncycastle</groupId>
<artifactId>bcpkix-fips</artifactId>
- <version>1.0.5</version>
- </dependency>
- <dependency>
- <groupId>com.google.re2j</groupId>
- <artifactId>re2j</artifactId>
+ <version>1.0.7</version>
</dependency>
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-jexl3</artifactId>
<version>3.1</version>
</dependency>
- <dependency>
- <groupId>org.projectlombok</groupId>
- <artifactId>lombok</artifactId>
- <scope>provided</scope>
- </dependency>
- <dependency>
- <groupId>junit</groupId>
- <artifactId>junit</artifactId>
- <scope>provided</scope>
- </dependency>
- <dependency>
- <groupId>org.assertj</groupId>
- <artifactId>assertj-core</artifactId>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>ch.qos.logback</groupId>
- <artifactId>logback-classic</artifactId>
- </dependency>
<dependency>
<groupId>org.onap.policy.common</groupId>
<artifactId>utils</artifactId>
<version>${project.version}</version>
</dependency>
- <dependency>
- <groupId>org.onap.policy.common</groupId>
- <artifactId>gson</artifactId>
- <version>${project.version}</version>
- </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>
+
+ <!-- from parent -->
<dependency>
<groupId>org.awaitility</groupId>
<artifactId>awaitility</artifactId>
<artifactId>openpojo</artifactId>
<scope>compile</scope>
</dependency>
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <scope>compile</scope>
+ </dependency>
</dependencies>
</project>
import java.io.File;
import java.io.FileNotFoundException;
import java.io.IOException;
-import java.nio.charset.StandardCharsets;
import java.nio.file.Files;
import java.util.ArrayList;
-import java.util.Collections;
import java.util.List;
import java.util.Map.Entry;
import lombok.AccessLevel;
*
* @param object the object to be encoded
* @param expected the expected value
- * @throws Exception if the file cannot be read
*/
public void compareGson(Object object, Class<?> expected) {
compareGson(object, new File(expected.getSimpleName() + ".json"));
*
* @param object the object to be encoded
* @param expected the expected value
- * @throws Exception if the file cannot be read
*/
public void compareGson(Object object, File expected) {
// file is not required to have a full path - find it via getResource()
* @throws IOException if an error occurs
*/
protected String readFile(File file) throws IOException {
- return new String(Files.readAllBytes(file.toPath()), StandardCharsets.UTF_8);
+ return Files.readString(file.toPath());
}
// sort the keys before copying to the new object
List<Entry<String, JsonElement>> sortedSet = new ArrayList<>(jsonObj.entrySet());
- Collections.sort(sortedSet, (left, right) -> left.getKey().compareTo(right.getKey()));
+ sortedSet.sort(Entry.comparingByKey());
for (Entry<String, JsonElement> ent : sortedSet) {
JsonElement val = ent.getValue();
* Keystore, containing a self-signed certificate, valid for one day (see the argument to
* the "-valid" flag below). For use in junit tests.
*/
+@Getter
public class SelfSignedKeyStore {
public static final String KEYSTORE_PASSWORD = "Pol1cy_0nap";
public static final String PRIVATE_KEY_PASSWORD = KEYSTORE_PASSWORD;
*/
private static final String KEYSTORE_SAN = "keystore_san.txt";
- @Getter
private final String keystoreName;
var sanArray = sanString.replace("DNS:", "").replace("\r", "").split("\n");
GeneralName[] nameArray = Arrays.stream(sanArray).map(name -> new GeneralName(GeneralName.dNSName, name))
- .collect(Collectors.toList()).toArray(new GeneralName[0]);
+ .toList().toArray(new GeneralName[0]);
final var names = new GeneralNames(nameArray);
try (var ostr = new FileOutputStream(keystoreFile)) {
import java.io.File;
import java.io.FileNotFoundException;
import java.io.IOException;
+import lombok.Getter;
import lombok.ToString;
import org.apache.commons.jexl3.JexlException;
import org.junit.Before;
-->
<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/xsd/maven-4.0.0.xsd">
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.onap.policy.common</groupId>
<artifactId>common-modules</artifactId>
- <version>2.0.0-SNAPSHOT</version>
+ <version>2.0.1-SNAPSHOT</version>
</parent>
<artifactId>utils</artifactId>
<packaging>jar</packaging>
<dependencies>
- <dependency>
- <groupId>javax.xml.bind</groupId>
- <artifactId>jaxb-api</artifactId>
- </dependency>
- <dependency>
- <groupId>org.yaml</groupId>
- <artifactId>snakeyaml</artifactId>
- </dependency>
- <dependency>
- <groupId>com.google.code.gson</groupId>
- <artifactId>gson</artifactId>
- </dependency>
<dependency>
<groupId>org.onap.policy.common</groupId>
<artifactId>capabilities</artifactId>
<artifactId>gson</artifactId>
<version>${project.version}</version>
</dependency>
- <dependency>
- <groupId>org.apache.commons</groupId>
- <artifactId>commons-lang3</artifactId>
- </dependency>
- <dependency>
- <groupId>commons-net</groupId>
- <artifactId>commons-net</artifactId>
- <version>3.6</version>
- </dependency>
- <dependency>
- <groupId>com.google.guava</groupId>
- <artifactId>guava</artifactId>
- </dependency>
- <dependency>
- <groupId>com.google.re2j</groupId>
- <artifactId>re2j</artifactId>
- </dependency>
- <dependency>
- <groupId>junit</groupId>
- <artifactId>junit</artifactId>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>ch.qos.logback</groupId>
- <artifactId>logback-classic</artifactId>
- </dependency>
- <dependency>
- <groupId>org.hibernate.javax.persistence</groupId>
- <artifactId>hibernate-jpa-2.1-api</artifactId>
- </dependency>
<dependency>
<groupId>com.worldturner.medeia</groupId>
<artifactId>medeia-validator-gson</artifactId>
</dependency>
<dependency>
- <groupId>org.projectlombok</groupId>
- <artifactId>lombok</artifactId>
- <scope>provided</scope>
+ <groupId>commons-net</groupId>
+ <artifactId>commons-net</artifactId>
</dependency>
+
+ <!-- from parent -->
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
<scope>provided</scope>
</dependency>
- <dependency>
- <groupId>org.mockito</groupId>
- <artifactId>mockito-core</artifactId>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.assertj</groupId>
- <artifactId>assertj-core</artifactId>
- <scope>test</scope>
- </dependency>
<dependency>
<groupId>commons-cli</groupId>
<artifactId>commons-cli</artifactId>
*/
public CommandLineArgumentsHandler(String helpClassName, String component, Option... customOptions) {
this(helpClassName, component);
- if (customOptions != null && customOptions.length > 0) {
+ if (customOptions != null) {
for (Option option : customOptions) {
options.addOption(option);
}
}
/**
- * Construct the options with brand new options for the CLI editor.
+ * Construct the options with brand-new options for the CLI editor.
*/
public CommandLineArgumentsHandler(String helpClassName, String component, Options options) {
this.options = options;
package org.onap.policy.common.utils.cmd;
+import java.io.Serial;
+
/**
* Exception used for CommandLineArguments class.
*
/**
* Generated serialVersionUID.
*/
+ @Serial
private static final long serialVersionUID = -1200607308084606425L;
/**
* Common Utils
* ================================================================================
* Copyright (C) 2018, 2021 AT&T Intellectual Property. All rights reserved.
+ * 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.
package org.onap.policy.common.utils.jpa;
-import javax.persistence.EntityManager;
+import jakarta.persistence.EntityManager;
import lombok.AllArgsConstructor;
import lombok.Getter;
* Common Utils
* ================================================================================
* Copyright (C) 2018, 2021 AT&T Intellectual Property. All rights reserved.
+ * 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.
package org.onap.policy.common.utils.jpa;
-import javax.persistence.EntityManagerFactory;
+import jakarta.persistence.EntityManagerFactory;
import lombok.AllArgsConstructor;
import lombok.Getter;
* Common Utils
* ================================================================================
* Copyright (C) 2018, 2021 AT&T Intellectual Property. All rights reserved.
+ * 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.
package org.onap.policy.common.utils.jpa;
-import javax.persistence.EntityTransaction;
+import jakarta.persistence.EntityTransaction;
import lombok.Getter;
/**
* ONAP
* ================================================================================
* Copyright (C) 2019-2021 AT&T Intellectual Property. All rights reserved.
+ * 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.
package org.onap.policy.common.utils.security;
+import jakarta.xml.bind.DatatypeConverter;
import java.nio.charset.StandardCharsets;
import java.util.Random;
import javax.crypto.Cipher;
import javax.crypto.spec.GCMParameterSpec;
import javax.crypto.spec.SecretKeySpec;
-import javax.xml.bind.DatatypeConverter;
import org.apache.commons.lang3.ArrayUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
/*
* Cannot use a plain Runnable, because it can't throw exceptions. Could use a
- * Callable, instead, but then all of the lambda expressions become rather messy, thus
+ * Callable, instead, but then all the lambda expressions become rather messy, thus
* we'll stick with RunnableWithEx, and just disable the sonar warning.
*/
@FunctionalInterface
/*-
* ============LICENSE_START=======================================================
- * Copyright (C) 2021 Nordix Foundation.
+ * Copyright (C) 2021, 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.
@Test
public void testParse_ShouldThrowExceptionWhenFileNameNull() {
String[] nullArgs = {"-c", null};
- assertThatThrownBy(() -> testCmd.parse(nullArgs)).hasMessage(ERR_MSG_INVALID_ARGS).hasRootCauseMessage(null);
+ assertThatThrownBy(() -> testCmd.parse(nullArgs)).hasMessage(ERR_MSG_INVALID_ARGS);
}
@Test
* Common Utils
* ================================================================================
* Copyright (C) 2018-2020 AT&T Intellectual Property. All rights reserved.
+ * 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.
import static org.mockito.Mockito.never;
import static org.mockito.Mockito.verify;
-import javax.persistence.EntityManager;
+import jakarta.persistence.EntityManager;
import org.junit.Before;
import org.junit.Test;
* Common Utils
* ================================================================================
* Copyright (C) 2018-2020 AT&T Intellectual Property. All rights reserved.
+ * 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.
import static org.mockito.Mockito.never;
import static org.mockito.Mockito.verify;
-import javax.persistence.EntityManagerFactory;
+import jakarta.persistence.EntityManagerFactory;
import org.junit.Before;
import org.junit.Test;
* Common Utils
* ================================================================================
* Copyright (C) 2018-2021 AT&T Intellectual Property. All rights reserved.
+ * 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.
import static org.mockito.Mockito.verify;
import static org.mockito.Mockito.when;
-import javax.persistence.EntityTransaction;
+import jakarta.persistence.EntityTransaction;
import org.junit.Before;
import org.junit.Test;
* ============LICENSE_START=======================================================
* Copyright (C) 2018 Ericsson. All rights reserved.
* Modifications Copyright (C) 2019-2021 AT&T Intellectual Property. All rights reserved.
- * Modifications Copyright (C) 2020-2021 Nordix Foundation.
+ * Modifications Copyright (C) 2020-2021, 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.
}
/**
- * Cleandown resource utils test.
+ * Clean resource utils test.
*/
@After
- public void cleandownResourceUtilsTest() {
- tmpEmptyFile.delete();
- tmpUsedFile.delete();
+ public void cleanDownResourceUtilsTest() {
+ assertTrue(tmpEmptyFile.delete());
+ assertTrue(tmpUsedFile.delete());
}
/**
normalizePath(resultD2.iterator().next()));
Set<String> resultJ0 = ResourceUtils.getDirectoryContents("com");
- assertTrue(resultJ0.contains("com/google/gson/"));
- assertEquals("com/google/", normalizePath(resultJ0.iterator().next()));
+ assertTrue(resultJ0.contains("com/worldturner/medeia/"));
+ assertEquals("com/worldturner/", normalizePath(resultJ0.iterator().next()));
Set<String> resultJ1 = ResourceUtils.getDirectoryContents("com/google/gson");
assertTrue(resultJ1.size() > 1);
minor=2
minor=0
-patch=0
+patch=1
base_version=${major}.${minor}.${patch}