diff options
Diffstat (limited to 'main/src/test')
11 files changed, 33 insertions, 49 deletions
diff --git a/main/src/test/java/org/onap/policy/pdpx/main/CommonRest.java b/main/src/test/java/org/onap/policy/pdpx/main/CommonRest.java index 7bdd4c47..89312cf5 100644 --- a/main/src/test/java/org/onap/policy/pdpx/main/CommonRest.java +++ b/main/src/test/java/org/onap/policy/pdpx/main/CommonRest.java @@ -23,6 +23,11 @@ package org.onap.policy.pdpx.main; +import jakarta.ws.rs.client.Client; +import jakarta.ws.rs.client.ClientBuilder; +import jakarta.ws.rs.client.Invocation; +import jakarta.ws.rs.client.WebTarget; +import jakarta.ws.rs.core.MediaType; import java.io.File; import java.io.IOException; import java.nio.charset.StandardCharsets; @@ -31,11 +36,6 @@ import java.nio.file.Path; import java.security.SecureRandom; import java.util.concurrent.atomic.AtomicBoolean; import javax.net.ssl.SSLContext; -import javax.ws.rs.client.Client; -import javax.ws.rs.client.ClientBuilder; -import javax.ws.rs.client.Invocation; -import javax.ws.rs.client.WebTarget; -import javax.ws.rs.core.MediaType; import org.glassfish.jersey.client.authentication.HttpAuthenticationFeature; import org.junit.After; import org.junit.AfterClass; diff --git a/main/src/test/java/org/onap/policy/pdpx/main/XacmlStateTest.java b/main/src/test/java/org/onap/policy/pdpx/main/XacmlStateTest.java index a1f1b8a7..8c412386 100644 --- a/main/src/test/java/org/onap/policy/pdpx/main/XacmlStateTest.java +++ b/main/src/test/java/org/onap/policy/pdpx/main/XacmlStateTest.java @@ -1,7 +1,7 @@ /*- * ============LICENSE_START======================================================= * Copyright (C) 2019, 2021-2022 AT&T Intellectual Property. All rights reserved. - * Modifications Copyright (C) 2021 Nordix Foundation. + * Modifications Copyright (C) 2021,2023 Nordix Foundation. * Modifications Copyright (C) 2023 Bell Canada. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); @@ -42,7 +42,6 @@ import org.mockito.junit.MockitoJUnitRunner; import org.onap.policy.common.endpoints.event.comm.client.TopicSinkClient; import org.onap.policy.models.pdp.concepts.PdpResponseDetails; import org.onap.policy.models.pdp.concepts.PdpStateChange; -import org.onap.policy.models.pdp.concepts.PdpStatistics; import org.onap.policy.models.pdp.concepts.PdpStatus; import org.onap.policy.models.pdp.concepts.PdpUpdate; import org.onap.policy.models.pdp.enums.PdpHealthStatus; @@ -132,26 +131,6 @@ public class XacmlStateTest { TopicSinkClient client = Mockito.mock(TopicSinkClient.class); XacmlPdpUpdatePublisher publisher = new XacmlPdpUpdatePublisher(client, state, appmgr); publisher.handlePdpUpdate(message); - - PdpStatistics stats = state.getStatistics(); - assertNotNull(stats); - assertEquals(GROUP, stats.getPdpGroupName()); - assertEquals(1, stats.getPolicyDeployCount()); - assertEquals(1, stats.getPolicyDeploySuccessCount()); - assertEquals(0, stats.getPolicyDeployFailCount()); - assertEquals(1, stats.getPolicyUndeployCount()); - assertEquals(1, stats.getPolicyUndeployFailCount()); - assertEquals(0, stats.getPolicyUndeploySuccessCount()); - - PdpStatistics test = new PdpStatistics(); - test.setTimeStamp(stats.getTimeStamp()); - test.setPdpGroupName(GROUP); - test.setPolicyDeployCount(1); - test.setPolicyDeploySuccessCount(1); - test.setPolicyUndeployCount(1); - test.setPolicyUndeployFailCount(1); - - assertEquals(stats.toString(), test.toString()); } @Test diff --git a/main/src/test/java/org/onap/policy/pdpx/main/rest/TestAbbreviateDecisionResults.java b/main/src/test/java/org/onap/policy/pdpx/main/rest/TestAbbreviateDecisionResults.java index 3e525e91..5dddec30 100644 --- a/main/src/test/java/org/onap/policy/pdpx/main/rest/TestAbbreviateDecisionResults.java +++ b/main/src/test/java/org/onap/policy/pdpx/main/rest/TestAbbreviateDecisionResults.java @@ -1,7 +1,7 @@ /*- * ============LICENSE_START======================================================= * Copyright (C) 2019-2021 AT&T Intellectual Property. All rights reserved. - * Modifications Copyright (C) 2020 Nordix Foundation + * Modifications Copyright (C) 2020,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. @@ -26,6 +26,9 @@ import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertFalse; import static org.junit.Assert.assertTrue; +import jakarta.ws.rs.client.Entity; +import jakarta.ws.rs.core.MediaType; +import jakarta.ws.rs.core.Response; import java.io.File; import java.io.IOException; import java.nio.file.Files; @@ -39,9 +42,6 @@ import java.util.HashMap; import java.util.Map; import java.util.Properties; import java.util.ServiceLoader; -import javax.ws.rs.client.Entity; -import javax.ws.rs.core.MediaType; -import javax.ws.rs.core.Response; import org.junit.AfterClass; import org.junit.BeforeClass; import org.junit.ClassRule; diff --git a/main/src/test/java/org/onap/policy/pdpx/main/rest/TestDecision.java b/main/src/test/java/org/onap/policy/pdpx/main/rest/TestDecision.java index b369ad31..93d04ce0 100644 --- a/main/src/test/java/org/onap/policy/pdpx/main/rest/TestDecision.java +++ b/main/src/test/java/org/onap/policy/pdpx/main/rest/TestDecision.java @@ -1,7 +1,7 @@ /*- * ============LICENSE_START======================================================= * Copyright (C) 2019-2022 AT&T Intellectual Property. All rights reserved. - * 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. @@ -26,6 +26,10 @@ import static org.junit.Assert.assertEquals; import com.google.gson.Gson; import com.google.gson.GsonBuilder; +import jakarta.ws.rs.client.Entity; +import jakarta.ws.rs.core.MediaType; +import jakarta.ws.rs.core.Response; +import jakarta.ws.rs.core.Response.Status; import java.io.File; import java.io.IOException; import java.nio.file.Files; @@ -37,10 +41,6 @@ import java.security.NoSuchAlgorithmException; import java.util.Collections; import java.util.HashMap; import java.util.Map; -import javax.ws.rs.client.Entity; -import javax.ws.rs.core.MediaType; -import javax.ws.rs.core.Response; -import javax.ws.rs.core.Response.Status; import org.junit.AfterClass; import org.junit.BeforeClass; import org.junit.ClassRule; diff --git a/main/src/test/java/org/onap/policy/pdpx/main/rest/TestXacmlPdpRestServer.java b/main/src/test/java/org/onap/policy/pdpx/main/rest/TestXacmlPdpRestServer.java index b626142a..2cac6dcc 100644 --- a/main/src/test/java/org/onap/policy/pdpx/main/rest/TestXacmlPdpRestServer.java +++ b/main/src/test/java/org/onap/policy/pdpx/main/rest/TestXacmlPdpRestServer.java @@ -1,6 +1,7 @@ /*- * ============LICENSE_START======================================================= * Copyright (C) 2019, 2021-2022 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. @@ -22,9 +23,9 @@ package org.onap.policy.pdpx.main.rest; import static org.junit.Assert.assertEquals; +import jakarta.ws.rs.client.Invocation; import java.util.HashMap; import java.util.Map; -import javax.ws.rs.client.Invocation; import org.junit.Test; import org.onap.policy.common.endpoints.report.HealthCheckReport; import org.onap.policy.pdpx.main.CommonRest; diff --git a/main/src/test/java/org/onap/policy/pdpx/main/rest/TestXacmlPdpServiceFilter.java b/main/src/test/java/org/onap/policy/pdpx/main/rest/TestXacmlPdpServiceFilter.java index 9f098f78..f72ae4f4 100644 --- a/main/src/test/java/org/onap/policy/pdpx/main/rest/TestXacmlPdpServiceFilter.java +++ b/main/src/test/java/org/onap/policy/pdpx/main/rest/TestXacmlPdpServiceFilter.java @@ -3,6 +3,7 @@ * ONAP * ================================================================================ * 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. @@ -25,9 +26,9 @@ import static org.mockito.Mockito.lenient; import static org.mockito.Mockito.verify; import static org.mockito.Mockito.when; -import javax.servlet.FilterChain; -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; +import jakarta.servlet.FilterChain; +import jakarta.servlet.http.HttpServletRequest; +import jakarta.servlet.http.HttpServletResponse; import org.junit.Before; import org.junit.Test; import org.junit.runner.RunWith; diff --git a/main/src/test/java/org/onap/policy/pdpx/main/rest/serialization/CommonSerialization.java b/main/src/test/java/org/onap/policy/pdpx/main/rest/serialization/CommonSerialization.java index 2b4a4fd0..2a0a5524 100644 --- a/main/src/test/java/org/onap/policy/pdpx/main/rest/serialization/CommonSerialization.java +++ b/main/src/test/java/org/onap/policy/pdpx/main/rest/serialization/CommonSerialization.java @@ -1,6 +1,7 @@ /*- * ============LICENSE_START======================================================= * Copyright (C) 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. @@ -25,9 +26,9 @@ import static org.junit.Assert.assertTrue; import com.att.research.xacml.api.Request; import com.att.research.xacml.api.Response; +import jakarta.ws.rs.core.MediaType; import java.lang.annotation.Annotation; import java.lang.reflect.Type; -import javax.ws.rs.core.MediaType; public class CommonSerialization { diff --git a/main/src/test/java/org/onap/policy/pdpx/main/rest/serialization/TestXacmlJsonExceptionMapper.java b/main/src/test/java/org/onap/policy/pdpx/main/rest/serialization/TestXacmlJsonExceptionMapper.java index 1b3cc209..31d6c60f 100644 --- a/main/src/test/java/org/onap/policy/pdpx/main/rest/serialization/TestXacmlJsonExceptionMapper.java +++ b/main/src/test/java/org/onap/policy/pdpx/main/rest/serialization/TestXacmlJsonExceptionMapper.java @@ -3,6 +3,7 @@ * ONAP * ================================================================================ * Copyright (C) 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. @@ -22,8 +23,8 @@ package org.onap.policy.pdpx.main.rest.serialization; import static org.junit.Assert.assertEquals; +import jakarta.ws.rs.core.Response; import java.io.IOException; -import javax.ws.rs.core.Response; import org.junit.Before; import org.junit.Test; import org.onap.policy.common.utils.coder.CoderException; diff --git a/main/src/test/java/org/onap/policy/pdpx/main/rest/serialization/TestXacmlXmlExceptionMapper.java b/main/src/test/java/org/onap/policy/pdpx/main/rest/serialization/TestXacmlXmlExceptionMapper.java index c9b7bac5..3fd76c3b 100644 --- a/main/src/test/java/org/onap/policy/pdpx/main/rest/serialization/TestXacmlXmlExceptionMapper.java +++ b/main/src/test/java/org/onap/policy/pdpx/main/rest/serialization/TestXacmlXmlExceptionMapper.java @@ -3,6 +3,7 @@ * ONAP * ================================================================================ * Copyright (C) 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. @@ -22,8 +23,8 @@ package org.onap.policy.pdpx.main.rest.serialization; import static org.junit.Assert.assertEquals; +import jakarta.ws.rs.core.Response; import java.io.IOException; -import javax.ws.rs.core.Response; import org.junit.Before; import org.junit.Test; import org.onap.policy.common.utils.coder.CoderException; diff --git a/main/src/test/resources/META-INF/persistence.xml b/main/src/test/resources/META-INF/persistence.xml index f97945c2..d7f9d921 100644 --- a/main/src/test/resources/META-INF/persistence.xml +++ b/main/src/test/resources/META-INF/persistence.xml @@ -28,8 +28,8 @@ <class>org.onap.policy.guard.OperationsHistory</class> <properties> - <property name="javax.persistence.schema-generation.database.action" value="drop-and-create"/> - <property name="javax.persistence.schema-generation.create-source" value="metadata"/> + <property name="jakarta.persistence.schema-generation.database.action" value="drop-and-create"/> + <property name="jakarta.persistence.schema-generation.create-source" value="metadata"/> <property name="hibernate.dialect" value="org.hibernate.dialect.H2Dialect"/> <property name="hibernate.show_sql" value="false" /> </properties> diff --git a/main/src/test/resources/apps/guard/xacml.properties b/main/src/test/resources/apps/guard/xacml.properties index 0f450fef..baed91ae 100644 --- a/main/src/test/resources/apps/guard/xacml.properties +++ b/main/src/test/resources/apps/guard/xacml.properties @@ -48,7 +48,7 @@ xacml.pip.engines=count-recent-operations,get-operation-outcome # JPA Properties # eclipselink.target-database=Auto -javax.persistence.jdbc.driver=org.h2.Driver -javax.persistence.jdbc.url=jdbc:h2:mem:testdb;DATABASE_TO_UPPER=FALSE -javax.persistence.jdbc.user=policy -javax.persistence.jdbc.password=P01icY +jakarta.persistence.jdbc.driver=org.h2.Driver +jakarta.persistence.jdbc.url=jdbc:h2:mem:testdb;DATABASE_TO_UPPER=FALSE +jakarta.persistence.jdbc.user=policy +jakarta.persistence.jdbc.password=P01icY |