From e37f5a70bcf3fd8073418c13416cc79c0ef47d59 Mon Sep 17 00:00:00 2001 From: HOCKLA Date: Fri, 17 Jan 2020 16:20:01 -0600 Subject: [PATCH] policy/engine jdk11 upgrades Issue-ID: POLICY-1590 Change-Id: I4da8324a065ac9babe16368e69b76a4cbe9504ef Signed-off-by: HOCKLA --- BRMSGateway/pom.xml | 6 ++-- .../java/org/onap/policy/brms/BrmsPushTest.java | 26 +++++++-------- .../org/onap/policy/brms/api/BrmsHandlerTest.java | 10 +++--- .../org/onap/policy/brms/api/BrmsPushTest.java | 8 +++-- LogParser/pom.xml | 4 +-- .../java/org/onap/xacml/parser/ParseLogTest.java | 6 ++-- ONAP-PAP-REST/pom.xml | 26 +++++++++++++-- .../onap/policy/pap/test/UpdateOthersPAPSTest.java | 9 +++-- .../pap/xacml/rest/handler/DeleteHandlerTest.java | 9 +++-- .../pap/xacml/rest/service/MetricServiceTest.java | 5 ++- .../onap/policy/pdp/rest/PapUrlResolverTest.java | 26 +++++++-------- .../onap/policy/pdp/rest/XACMLPdpServletTest.java | 4 ++- ONAP-PDP/checkstyle-suppressions.xml | 33 ++++++++++++++++++ ONAP-PDP/pom.xml | 5 +-- .../policy/xacml/pdp/OnapPdpEngineFactoryTest.java | 9 +++-- ONAP-SDK-APP/pom.xml | 7 +++- ONAP-XACML/pom.xml | 28 +++++++++++++++- POLICY-SDK-APP/pom.xml | 7 +++- .../policy/admin/PolicyManagerServletTest.java | 9 ++--- .../policy/admin/PolicyRestControllerTest.java | 2 ++ .../policy/controller/AdminTabControllerTest.java | 4 +-- .../policy/controller/AutoPushControllerTest.java | 6 ++-- .../PolicyExportAndImportControllerTest.java | 8 +++-- .../PolicyNotificationControllerTest.java | 8 +++-- .../onap/policy/daoImp/CommonClassDaoImplTest.java | 11 +++--- .../onap/policy/daoImp/SystemLogDbDaoImplTest.java | 8 +++-- PolicyEngineAPI/pom.xml | 39 +++++++++++++++++++--- .../org/onap/policy/std/StdPolicyEngineTest.java | 9 +++-- packages/docker/src/main/docker/Dockerfile | 8 ++--- pom.xml | 17 ++++------ 30 files changed, 256 insertions(+), 101 deletions(-) create mode 100644 ONAP-PDP/checkstyle-suppressions.xml diff --git a/BRMSGateway/pom.xml b/BRMSGateway/pom.xml index 5b344af8a..8f6a79df1 100644 --- a/BRMSGateway/pom.xml +++ b/BRMSGateway/pom.xml @@ -2,7 +2,7 @@ ============LICENSE_START======================================================= ONAP Policy Engine ================================================================================ - Copyright (C) 2017-2018 AT&T Intellectual Property. All rights reserved. + Copyright (C) 2017-2018, 2020 AT&T Intellectual Property. All rights reserved. ================================================================================ Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -109,7 +109,7 @@ onap-checkstyle/onap-java-style.xml - ${project.build.sourceDirectory} + ${project.build.sourceDirectory} true true true @@ -123,7 +123,7 @@ org.onap.oparent checkstyle - 0.1.1 + ${oparent.version} compile diff --git a/BRMSGateway/src/test/java/org/onap/policy/brms/BrmsPushTest.java b/BRMSGateway/src/test/java/org/onap/policy/brms/BrmsPushTest.java index de1a7d6eb..994e97368 100644 --- a/BRMSGateway/src/test/java/org/onap/policy/brms/BrmsPushTest.java +++ b/BRMSGateway/src/test/java/org/onap/policy/brms/BrmsPushTest.java @@ -2,7 +2,7 @@ * ============LICENSE_START======================================================= * ONAP Policy Engine * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * Copyright (C) 2017, 2020 AT&T Intellectual Property. All rights reserved. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -81,7 +81,7 @@ public class BrmsPushTest { } @Test(expected = PolicyException.class) - public void brmsHandlerFailTest2() throws PolicyException { + public void testBrmsHandlerFail2() throws PolicyException { final PropertyChange prop = new PropertyChange(); prop.key = "defaultName"; prop.remove = true; @@ -92,7 +92,7 @@ public class BrmsPushTest { } @Test(expected = PolicyException.class) - public void brmsHandlerFailTest3() throws PolicyException { + public void testBrmsHandlerFail3() throws PolicyException { PropertyChange prop = new PropertyChange(); prop.key = "repositoryID"; prop.remove = true; @@ -107,7 +107,7 @@ public class BrmsPushTest { } @Test(expected = PolicyException.class) - public void brmsHandlerFailTest4() throws PolicyException { + public void testBrmsHandlerFail4() throws PolicyException { final PropertyChange prop = new PropertyChange(); prop.key = "repositoryURL"; prop.remove = true; @@ -118,7 +118,7 @@ public class BrmsPushTest { } @Test(expected = PolicyException.class) - public void brmsHandlerFailTest5() throws PolicyException { + public void testBrmsHandlerFail5() throws PolicyException { final PropertyChange prop = new PropertyChange(); prop.key = "repositoryName"; prop.remove = true; @@ -129,7 +129,7 @@ public class BrmsPushTest { } @Test(expected = PolicyException.class) - public void brmsHandlerFailTest6() throws PolicyException { + public void testBrmsHandlerFail6() throws PolicyException { PropertyChange prop = new PropertyChange(); prop.key = "repositoryURL"; prop.value = "http://nexus:8081/nexus/content/repositories/releases," @@ -146,7 +146,7 @@ public class BrmsPushTest { } @Test(expected = PolicyException.class) - public void brmsHandlerFailTest7() throws PolicyException { + public void testBrmsHandlerFail7() throws PolicyException { final PropertyChange prop = new PropertyChange(); prop.key = "repositoryPassword"; prop.remove = true; @@ -157,7 +157,7 @@ public class BrmsPushTest { } @Test(expected = PolicyException.class) - public void brmsHandlerFailTest8() throws PolicyException { + public void testBrmsHandlerFail8() throws PolicyException { final PropertyChange prop = new PropertyChange(); prop.key = "policyKeyID"; prop.remove = true; @@ -168,7 +168,7 @@ public class BrmsPushTest { } @Test(expected = PolicyException.class) - public void brmsHandlerFailTest9() throws PolicyException { + public void testBrmsHandlerFail9() throws PolicyException { PropertyChange prop = new PropertyChange(); prop.key = "sync"; prop.value = "true"; @@ -188,7 +188,7 @@ public class BrmsPushTest { } @Test(expected = PolicyException.class) - public void brmsHandlerFailTest10() throws PolicyException { + public void testBrmsHandlerFail10() throws PolicyException { final PropertyChange prop = new PropertyChange(); prop.key = "groupNames"; prop.value = ""; @@ -200,7 +200,7 @@ public class BrmsPushTest { } @Test(expected = PolicyException.class) - public void brmsHandlerFailTest11() throws PolicyException { + public void testBrmsHandlerFail11() throws PolicyException { final PropertyChange prop = new PropertyChange(); prop.key = "default.groupID"; prop.remove = true; @@ -211,7 +211,7 @@ public class BrmsPushTest { } @Test(expected = PolicyException.class) - public void brmsHandlerFailTest12() throws PolicyException { + public void testBrmsHandlerFail12() throws PolicyException { final PropertyChange prop = new PropertyChange(); prop.key = "default.artifactID"; prop.remove = true; @@ -222,7 +222,7 @@ public class BrmsPushTest { } @Test(expected = PolicyException.class) - public void brmsHandlerFailTest13() throws PolicyException { + public void testBrmsHandlerFail13() throws PolicyException { PropertyChange prop = new PropertyChange(); prop.key = "NOTIFICATION_TYPE"; prop.value = "dmaap"; diff --git a/BRMSGateway/src/test/java/org/onap/policy/brms/api/BrmsHandlerTest.java b/BRMSGateway/src/test/java/org/onap/policy/brms/api/BrmsHandlerTest.java index 8fda22e26..079db2109 100644 --- a/BRMSGateway/src/test/java/org/onap/policy/brms/api/BrmsHandlerTest.java +++ b/BRMSGateway/src/test/java/org/onap/policy/brms/api/BrmsHandlerTest.java @@ -2,7 +2,7 @@ * ============LICENSE_START======================================================= * ONAP Policy Engine * ================================================================================ - * Copyright (C) 2018 AT&T Intellectual Property. All rights reserved. + * Copyright (C) 2018, 2020 AT&T Intellectual Property. All rights reserved. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -23,7 +23,7 @@ package org.onap.policy.brms.api; import static org.junit.Assert.assertNotNull; import static org.junit.Assert.assertNull; import static org.junit.Assert.fail; -import static org.mockito.Matchers.any; +import static org.mockito.ArgumentMatchers.any; import javax.persistence.EntityManager; import javax.persistence.EntityManagerFactory; @@ -38,14 +38,16 @@ import org.onap.policy.api.NotificationType; import org.onap.policy.std.StdPDPNotification; import org.onap.policy.utils.BackUpMonitor; import org.powermock.api.mockito.PowerMockito; +import org.powermock.core.classloader.annotations.PowerMockIgnore; import org.powermock.core.classloader.annotations.PrepareForTest; import org.powermock.modules.junit4.PowerMockRunner; @RunWith(PowerMockRunner.class) +@PowerMockIgnore({"com.sun.org.apache.xerces.*", "jdk.internal.reflect.*", "javax.xml.*", "org.xml.*", "org.w3c.*"}) +@PrepareForTest({Persistence.class, BackUpMonitor.class}) public class BrmsHandlerTest { - @PrepareForTest({Persistence.class, BackUpMonitor.class}) @Test - public void negativeTestNotifications() throws Exception { + public void testNegativeTestNotifications() throws Exception { // Mock emf, persistence, and query final EntityManagerFactory emf = Mockito.mock(EntityManagerFactory.class); final EntityManager em = Mockito.mock(EntityManager.class); diff --git a/BRMSGateway/src/test/java/org/onap/policy/brms/api/BrmsPushTest.java b/BRMSGateway/src/test/java/org/onap/policy/brms/api/BrmsPushTest.java index 4141a8bd2..3adc55700 100644 --- a/BRMSGateway/src/test/java/org/onap/policy/brms/api/BrmsPushTest.java +++ b/BRMSGateway/src/test/java/org/onap/policy/brms/api/BrmsPushTest.java @@ -2,7 +2,7 @@ * ============LICENSE_START======================================================= * ONAP Policy Engine * ================================================================================ - * Copyright (C) 2018-2019 AT&T Intellectual Property. All rights reserved. + * Copyright (C) 2018-2020 AT&T Intellectual Property. All rights reserved. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -23,7 +23,7 @@ package org.onap.policy.brms.api; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertNotNull; import static org.junit.Assert.fail; -import static org.mockito.Matchers.any; +import static org.mockito.ArgumentMatchers.any; import java.util.HashMap; import java.util.List; @@ -46,15 +46,17 @@ import org.onap.policy.utils.BackUpHandler; import org.onap.policy.utils.BackUpMonitor; import org.onap.policy.utils.BackUpMonitorException; import org.powermock.api.mockito.PowerMockito; +import org.powermock.core.classloader.annotations.PowerMockIgnore; import org.powermock.core.classloader.annotations.PrepareForTest; import org.powermock.modules.junit4.PowerMockRunner; @RunWith(PowerMockRunner.class) +@PowerMockIgnore({"com.sun.org.apache.xerces.*", "jdk.internal.reflect.*", "javax.xml.*", "org.xml.*", "org.w3c.*"}) +@PrepareForTest({Persistence.class, BackUpMonitor.class}) public class BrmsPushTest { @Rule public ExpectedException thrown = ExpectedException.none(); - @PrepareForTest({Persistence.class, BackUpMonitor.class}) @Test public void testPush() throws BackUpMonitorException, PolicyException { // Mock emf, persistence, and query diff --git a/LogParser/pom.xml b/LogParser/pom.xml index b0281ba88..24ebb6d38 100644 --- a/LogParser/pom.xml +++ b/LogParser/pom.xml @@ -3,7 +3,7 @@ ============LICENSE_START======================================================= ONAP Policy Engine ================================================================================ - Copyright (C) 2017-2018 AT&T Intellectual Property. All rights reserved. + Copyright (C) 2017-2018, 2020 AT&T Intellectual Property. All rights reserved. ================================================================================ Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -135,7 +135,7 @@ onap-checkstyle/onap-java-style.xml - ${project.build.sourceDirectory} + ${project.build.sourceDirectory} true true true diff --git a/LogParser/src/test/java/org/onap/xacml/parser/ParseLogTest.java b/LogParser/src/test/java/org/onap/xacml/parser/ParseLogTest.java index 313750eeb..6609778a0 100644 --- a/LogParser/src/test/java/org/onap/xacml/parser/ParseLogTest.java +++ b/LogParser/src/test/java/org/onap/xacml/parser/ParseLogTest.java @@ -2,7 +2,7 @@ * ============LICENSE_START======================================================= * LogParser * ================================================================================ - * Copyright (C) 2017-2018 AT&T Intellectual Property. All rights reserved. + * Copyright (C) 2017-2018, 2020 AT&T Intellectual Property. All rights reserved. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -47,11 +47,13 @@ import org.onap.policy.common.logging.flexlogger.FlexLogger; import org.onap.policy.common.logging.flexlogger.Logger; import org.onap.xacml.parser.LogEntryObject.LogType; import org.powermock.api.mockito.PowerMockito; +import org.powermock.core.classloader.annotations.PowerMockIgnore; import org.powermock.core.classloader.annotations.PrepareForTest; import org.powermock.modules.junit4.PowerMockRunner; -@PrepareForTest({ ParseLogTest.class, IntegrityMonitor.class }) @RunWith(PowerMockRunner.class) +@PowerMockIgnore({"com.sun.org.apache.xerces.*", "jdk.internal.reflect.*", "javax.xml.*", "org.xml.*"}) +@PrepareForTest({ ParseLogTest.class, IntegrityMonitor.class }) public class ParseLogTest { private static Logger logger = FlexLogger.getLogger(ParseLogTest.class); diff --git a/ONAP-PAP-REST/pom.xml b/ONAP-PAP-REST/pom.xml index 33c6e84dc..111c24201 100644 --- a/ONAP-PAP-REST/pom.xml +++ b/ONAP-PAP-REST/pom.xml @@ -3,7 +3,7 @@ ============LICENSE_START======================================================= ONAP Policy Engine ================================================================================ - Copyright (C) 2017-2019 AT&T Intellectual Property. All rights reserved. + Copyright (C) 2017-2020 AT&T Intellectual Property. All rights reserved. Modifications Copyright (C) 2019 Nordix Foundation. ================================================================================ Licensed under the Apache License, Version 2.0 (the "License"); @@ -54,8 +54,7 @@ org.apache.maven.plugins maven-compiler-plugin - 1.8 - 1.8 + ${java.version} @@ -114,6 +113,27 @@ javax.servlet javax.servlet-api + + javax.xml.bind + jaxb-api + ${version.javax.bind} + + + org.glassfish.jaxb + jaxb-runtime + 2.3.2 + test + + + javax.activation + javax.activation-api + 1.2.0 + + + javax.xml + jaxp-api + 1.4.2 + commons-logging commons-logging diff --git a/ONAP-PAP-REST/src/test/java/org/onap/policy/pap/test/UpdateOthersPAPSTest.java b/ONAP-PAP-REST/src/test/java/org/onap/policy/pap/test/UpdateOthersPAPSTest.java index ffac655a6..fcec4a652 100644 --- a/ONAP-PAP-REST/src/test/java/org/onap/policy/pap/test/UpdateOthersPAPSTest.java +++ b/ONAP-PAP-REST/src/test/java/org/onap/policy/pap/test/UpdateOthersPAPSTest.java @@ -2,7 +2,7 @@ * ============LICENSE_START======================================================= * ONAP-PAP-REST * ================================================================================ - * Copyright (C) 2018-2019 AT&T Intellectual Property. All rights reserved. + * Copyright (C) 2018-2020 AT&T Intellectual Property. All rights reserved. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -24,6 +24,7 @@ import static org.junit.Assert.assertTrue; import static org.junit.Assert.fail; import static org.mockito.Mockito.mock; import static org.mockito.Mockito.when; +import static org.mockito.ArgumentMatchers.anyString; import java.io.File; import java.util.ArrayList; @@ -35,7 +36,6 @@ import org.json.JSONObject; import org.junit.Before; import org.junit.Test; import org.junit.runner.RunWith; -import org.mockito.Matchers; import org.mockito.Mockito; import org.onap.policy.common.logging.flexlogger.FlexLogger; import org.onap.policy.common.logging.flexlogger.Logger; @@ -45,11 +45,14 @@ import org.onap.policy.pap.xacml.rest.components.Policy; import org.onap.policy.rest.dao.CommonClassDao; import org.onap.policy.rest.jpa.PolicyDbDaoEntity; import org.powermock.api.mockito.PowerMockito; +import org.powermock.core.classloader.annotations.PowerMockIgnore; import org.powermock.core.classloader.annotations.PrepareForTest; import org.powermock.modules.junit4.PowerMockRunner; import org.springframework.mock.web.MockHttpServletResponse; @RunWith(PowerMockRunner.class) +@PowerMockIgnore({"com.sun.org.apache.xalan.*", "com.sun.org.apache.xerces.*", "jdk.internal.reflect.*", "javax.xml.*", "org.xml.*", "org.w3c.*"}) +@PrepareForTest(UpdateOthersPAPS.class) public class UpdateOthersPAPSTest { private static Logger logger = FlexLogger.getLogger(UpdateOthersPAPSTest.class); @@ -110,7 +113,7 @@ public class UpdateOthersPAPSTest { when(Policy.getActionHome()).thenReturn("test"); File mockedFile = Mockito.mock(File.class); Mockito.when(mockedFile.exists()).thenReturn(true); - PowerMockito.whenNew(File.class).withParameterTypes(String.class).withArguments(Matchers.anyString()) + PowerMockito.whenNew(File.class).withParameterTypes(String.class).withArguments(anyString()) .thenReturn(mockedFile); updateOtherPaps.updateConfiguration(data, response); assertTrue(response.getStatus() == 200); diff --git a/ONAP-PAP-REST/src/test/java/org/onap/policy/pap/xacml/rest/handler/DeleteHandlerTest.java b/ONAP-PAP-REST/src/test/java/org/onap/policy/pap/xacml/rest/handler/DeleteHandlerTest.java index d0e4416f9..885230da4 100644 --- a/ONAP-PAP-REST/src/test/java/org/onap/policy/pap/xacml/rest/handler/DeleteHandlerTest.java +++ b/ONAP-PAP-REST/src/test/java/org/onap/policy/pap/xacml/rest/handler/DeleteHandlerTest.java @@ -2,7 +2,7 @@ * ============LICENSE_START======================================================= * ONAP-PAP-REST * ================================================================================ - * Copyright (C) 2018-2019 AT&T Intellectual Property. All rights reserved. + * Copyright (C) 2018-2020 AT&T Intellectual Property. All rights reserved. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -24,8 +24,8 @@ import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertNotNull; import static org.junit.Assert.assertNull; import static org.junit.Assert.assertTrue; -import static org.mockito.Matchers.any; -import static org.mockito.Matchers.eq; +import static org.mockito.ArgumentMatchers.any; +import static org.mockito.ArgumentMatchers.eq; import static org.mockito.Mockito.when; import com.mockrunner.mock.web.MockHttpServletRequest; @@ -51,10 +51,13 @@ import org.onap.policy.rest.jpa.PolicyVersion; import org.onap.policy.xacml.api.pap.PAPPolicyEngine; import org.onap.policy.xacml.std.pap.StdEngine; import org.powermock.api.mockito.PowerMockito; +import org.powermock.core.classloader.annotations.PowerMockIgnore; import org.powermock.core.classloader.annotations.PrepareForTest; import org.powermock.modules.junit4.PowerMockRunner; @RunWith(PowerMockRunner.class) +@PowerMockIgnore({"com.sun.org.apache.xerces.*", "jdk.internal.reflect.*", "javax.xml.*", "org.xml.*", "org.w3c.*"}) +@PrepareForTest(DeleteHandler.class) public class DeleteHandlerTest { @Before public void setUp() { diff --git a/ONAP-PAP-REST/src/test/java/org/onap/policy/pap/xacml/rest/service/MetricServiceTest.java b/ONAP-PAP-REST/src/test/java/org/onap/policy/pap/xacml/rest/service/MetricServiceTest.java index ebd3292aa..8136c8329 100644 --- a/ONAP-PAP-REST/src/test/java/org/onap/policy/pap/xacml/rest/service/MetricServiceTest.java +++ b/ONAP-PAP-REST/src/test/java/org/onap/policy/pap/xacml/rest/service/MetricServiceTest.java @@ -2,7 +2,7 @@ * ============LICENSE_START======================================================= * ONAP-PAP-REST * ================================================================================ - * Copyright (C) 2018-2019 AT&T Intellectual Property. All rights reserved. + * Copyright (C) 2018-2020 AT&T Intellectual Property. All rights reserved. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -35,10 +35,13 @@ import org.onap.policy.pap.xacml.rest.XACMLPapServlet; import org.onap.policy.rest.dao.CommonClassDao; import org.onap.policy.rest.jpa.PolicyVersion; import org.powermock.api.mockito.PowerMockito; +import org.powermock.core.classloader.annotations.PowerMockIgnore; import org.powermock.core.classloader.annotations.PrepareForTest; import org.powermock.modules.junit4.PowerMockRunner; @RunWith(PowerMockRunner.class) +@PowerMockIgnore({"com.sun.org.apache.xerces.*", "jdk.internal.reflect.*", "javax.xml.*", "org.xml.*", "org.w3c.*"}) +@PrepareForTest(CommonClassDao.class) public class MetricServiceTest { @PrepareForTest({XACMLPapServlet.class}) @Test diff --git a/ONAP-PDP-REST/src/test/java/org/onap/policy/pdp/rest/PapUrlResolverTest.java b/ONAP-PDP-REST/src/test/java/org/onap/policy/pdp/rest/PapUrlResolverTest.java index fb768f7d7..841fad641 100644 --- a/ONAP-PDP-REST/src/test/java/org/onap/policy/pdp/rest/PapUrlResolverTest.java +++ b/ONAP-PDP-REST/src/test/java/org/onap/policy/pdp/rest/PapUrlResolverTest.java @@ -2,7 +2,7 @@ * ============LICENSE_START======================================================= * ONAP-PDP-REST * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * Copyright (C) 2017, 2020 AT&T Intellectual Property. All rights reserved. * ================================================================================ * Modifications Copyright (C) 2019 Samsung * ================================================================================ @@ -59,6 +59,9 @@ public class PapUrlResolverTest { succeeded = prop.getProperty(XacmlRestProperties.PROP_PAP_SUCCEEDED_URLS); rs = PapUrlResolver.getInstance(urls, failed, succeeded); Assert.assertTrue(rs.hasMoreUrls()); + Assert.assertEquals("http://one.localhost.com", rs.getUrl()); + rs.getNext(); + Assert.assertTrue(rs.hasMoreUrls()); Assert.assertEquals("http://two.localhost.com", rs.getUrl()); rs.getNext(); Assert.assertTrue(rs.hasMoreUrls()); @@ -66,9 +69,6 @@ public class PapUrlResolverTest { rs.getNext(); Assert.assertTrue(rs.hasMoreUrls()); Assert.assertEquals("http://four.localhost.com", rs.getUrl()); - rs.getNext(); - Assert.assertTrue(rs.hasMoreUrls()); - Assert.assertEquals("http://one.localhost.com", rs.getUrl()); rs.succeeded(); rs.getNext(); Assert.assertFalse(rs.hasMoreUrls()); @@ -128,13 +128,13 @@ public class PapUrlResolverTest { String succeeded = "-1,8/13/15 5:41 PM,8/13/15 4:41 PM,-1"; PapUrlResolver rs = PapUrlResolver.getInstance(urls, failed, succeeded); Assert.assertTrue(rs.hasMoreUrls()); - Assert.assertEquals("http://two.localhost.com", rs.getUrl()); + Assert.assertEquals("http://one.localhost.com", rs.getUrl()); rs.getNext(); Assert.assertTrue(rs.hasMoreUrls()); - Assert.assertEquals("http://three.localhost.com", rs.getUrl()); + Assert.assertEquals("http://two.localhost.com", rs.getUrl()); rs.getNext(); Assert.assertTrue(rs.hasMoreUrls()); - Assert.assertEquals("http://one.localhost.com", rs.getUrl()); + Assert.assertEquals("http://three.localhost.com", rs.getUrl()); rs.getNext(); Assert.assertTrue(rs.hasMoreUrls()); Assert.assertEquals("http://four.localhost.com", rs.getUrl()); @@ -186,13 +186,13 @@ public class PapUrlResolverTest { succeeded = "-1,-1,-1,-1"; rs = PapUrlResolver.getInstance(urls, failed, succeeded); Assert.assertTrue(rs.hasMoreUrls()); - Assert.assertEquals("http://two.localhost.com", rs.getUrl()); + Assert.assertEquals("http://one.localhost.com", rs.getUrl()); rs.getNext(); Assert.assertTrue(rs.hasMoreUrls()); - Assert.assertEquals("http://three.localhost.com", rs.getUrl()); + Assert.assertEquals("http://two.localhost.com", rs.getUrl()); rs.getNext(); Assert.assertTrue(rs.hasMoreUrls()); - Assert.assertEquals("http://one.localhost.com", rs.getUrl()); + Assert.assertEquals("http://three.localhost.com", rs.getUrl()); rs.getNext(); Assert.assertTrue(rs.hasMoreUrls()); Assert.assertEquals("http://four.localhost.com", rs.getUrl()); @@ -204,6 +204,9 @@ public class PapUrlResolverTest { succeeded = "-1,-1,-1,-1"; rs = PapUrlResolver.getInstance(urls, failed, succeeded); Assert.assertTrue(rs.hasMoreUrls()); + Assert.assertEquals("http://one.localhost.com", rs.getUrl()); + rs.getNext(); + Assert.assertTrue(rs.hasMoreUrls()); Assert.assertEquals("http://two.localhost.com", rs.getUrl()); rs.getNext(); Assert.assertTrue(rs.hasMoreUrls()); @@ -212,9 +215,6 @@ public class PapUrlResolverTest { Assert.assertTrue(rs.hasMoreUrls()); Assert.assertEquals("http://four.localhost.com", rs.getUrl()); rs.getNext(); - Assert.assertTrue(rs.hasMoreUrls()); - Assert.assertEquals("http://one.localhost.com", rs.getUrl()); - rs.getNext(); Assert.assertFalse(rs.hasMoreUrls()); urls = "http://one.localhost.com,http://two.localhost.com,http://three.localhost.com,http://four.localhost.com"; diff --git a/ONAP-PDP-REST/src/test/java/org/onap/policy/pdp/rest/XACMLPdpServletTest.java b/ONAP-PDP-REST/src/test/java/org/onap/policy/pdp/rest/XACMLPdpServletTest.java index 17601a280..eb6910ca7 100644 --- a/ONAP-PDP-REST/src/test/java/org/onap/policy/pdp/rest/XACMLPdpServletTest.java +++ b/ONAP-PDP-REST/src/test/java/org/onap/policy/pdp/rest/XACMLPdpServletTest.java @@ -2,7 +2,7 @@ * ============LICENSE_START======================================================= * ONAP-PDP-REST * ================================================================================ - * Copyright (C) 2017-2019 AT&T Intellectual Property. All rights reserved. + * Copyright (C) 2017-2020 AT&T Intellectual Property. All rights reserved. * ================================================================================ * Modifications Copyright (C) 2019 Samsung * ================================================================================ @@ -47,6 +47,7 @@ import org.onap.policy.common.logging.flexlogger.Logger; import org.onap.policy.xacml.std.pap.StdPDPPolicy; import org.onap.policy.xacml.std.pap.StdPDPStatus; import org.powermock.api.mockito.PowerMockito; +import org.powermock.core.classloader.annotations.PowerMockIgnore; import org.powermock.core.classloader.annotations.PrepareForTest; import org.powermock.modules.junit4.PowerMockRunner; import org.springframework.mock.web.MockHttpServletResponse; @@ -56,6 +57,7 @@ import com.mockrunner.mock.web.MockServletInputStream; import junit.framework.TestCase; @RunWith(PowerMockRunner.class) +@PowerMockIgnore({"com.sun.org.apache.xerces.*", "javax.xml.*", "org.xml.*", "javax.management.*", "org.w3c.dom.*"}) @PrepareForTest({IntegrityMonitor.class}) public class XACMLPdpServletTest extends TestCase { private static Logger LOGGER = FlexLogger.getLogger(XACMLPdpServletTest.class); diff --git a/ONAP-PDP/checkstyle-suppressions.xml b/ONAP-PDP/checkstyle-suppressions.xml new file mode 100644 index 000000000..ee01ae5ae --- /dev/null +++ b/ONAP-PDP/checkstyle-suppressions.xml @@ -0,0 +1,33 @@ + + + + + + + + diff --git a/ONAP-PDP/pom.xml b/ONAP-PDP/pom.xml index 044219523..7613258f0 100644 --- a/ONAP-PDP/pom.xml +++ b/ONAP-PDP/pom.xml @@ -3,7 +3,7 @@ ============LICENSE_START======================================================= ONAP Policy Engine ================================================================================ - Copyright (C) 2017-2018 AT&T Intellectual Property. All rights reserved. + Copyright (C) 2017-2018, 2020 AT&T Intellectual Property. All rights reserved. ================================================================================ Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -99,12 +99,13 @@ onap-checkstyle/onap-java-style.xml - ${project.build.sourceDirectory} + ${project.build.sourceDirectory} true true true + /checkstyle-suppressions.xml true true warning diff --git a/ONAP-PDP/src/test/java/org/onap/policy/xacml/pdp/OnapPdpEngineFactoryTest.java b/ONAP-PDP/src/test/java/org/onap/policy/xacml/pdp/OnapPdpEngineFactoryTest.java index d3ee544a5..9447a951a 100644 --- a/ONAP-PDP/src/test/java/org/onap/policy/xacml/pdp/OnapPdpEngineFactoryTest.java +++ b/ONAP-PDP/src/test/java/org/onap/policy/xacml/pdp/OnapPdpEngineFactoryTest.java @@ -2,7 +2,7 @@ * ============LICENSE_START======================================================= * ONAP-PDP * ================================================================================ - * Copyright (C) 2017-2018 AT&T Intellectual Property. All rights reserved. + * Copyright (C) 2017-2018, 2020 AT&T Intellectual Property. All rights reserved. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -33,10 +33,13 @@ import org.junit.Test; import org.junit.runner.RunWith; import org.mockito.Mockito; import org.powermock.api.mockito.PowerMockito; +import org.powermock.core.classloader.annotations.PowerMockIgnore; import org.powermock.core.classloader.annotations.PrepareForTest; import org.powermock.modules.junit4.PowerMockRunner; @RunWith(PowerMockRunner.class) +@PowerMockIgnore({"com.sun.org.apache.xerces.*", "jdk.internal.reflect.*", "javax.xml.*", "org.xml.*"}) +@PrepareForTest(OnapPdpEngineFactory.class) public class OnapPdpEngineFactoryTest { @Test public final void testNewEngine() { @@ -61,7 +64,7 @@ public class OnapPdpEngineFactoryTest { @PrepareForTest({ EvaluationContextFactory.class, FactoryFinder.class }) @Test(expected = FactoryException.class) - public void negTestEngine() throws FactoryException { + public void testNegTestEngine() throws FactoryException { // Setup test data PowerMockito.mockStatic(FactoryFinder.class); PowerMockito.when(FactoryFinder.find(Mockito.any(), Mockito.any(), Mockito.any())).thenReturn(null); @@ -74,7 +77,7 @@ public class OnapPdpEngineFactoryTest { @PrepareForTest({ EvaluationContextFactory.class, FactoryFinder.class }) @Test(expected = FactoryException.class) - public void negTestEngine2() throws FactoryException { + public void testNegTestEngine2() throws FactoryException { // Setup test data PowerMockito.mockStatic(FactoryFinder.class); PowerMockito.when(FactoryFinder.find(Mockito.any(), Mockito.any(), Mockito.any())).thenReturn(null); diff --git a/ONAP-SDK-APP/pom.xml b/ONAP-SDK-APP/pom.xml index 240ee7f65..fa41d92fe 100644 --- a/ONAP-SDK-APP/pom.xml +++ b/ONAP-SDK-APP/pom.xml @@ -2,7 +2,7 @@ ============LICENSE_START======================================================= ONAP Policy Engine ================================================================================ - Copyright (C) 2017-2018 AT&T Intellectual Property. All rights reserved. + Copyright (C) 2017-2018, 2020 AT&T Intellectual Property. All rights reserved. ================================================================================ Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -185,6 +185,11 @@ + + org.powermock + powermock-api-mockito2 + test + org.onap.policy.engine diff --git a/ONAP-XACML/pom.xml b/ONAP-XACML/pom.xml index 75bf1c036..8bb78f6c0 100644 --- a/ONAP-XACML/pom.xml +++ b/ONAP-XACML/pom.xml @@ -3,7 +3,7 @@ ============LICENSE_START======================================================= ONAP Policy Engine ================================================================================ - Copyright (C) 2017-2018 AT&T Intellectual Property. All rights reserved. + Copyright (C) 2017-2018, 2020 AT&T Intellectual Property. All rights reserved. ================================================================================ Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -47,6 +47,32 @@ org.apache.httpcomponents httpcore + + javax.xml.bind + jaxb-api + ${version.javax.bind} + + + org.glassfish.jaxb + jaxb-runtime + 2.3.2 + test + + + javax.activation + javax.activation-api + 1.2.0 + + + javax.xml + jaxp-api + 1.4.2 + + + javax.xml.parsers + jaxp-api + 1.4.5 + com.att.research.xacml xacml diff --git a/POLICY-SDK-APP/pom.xml b/POLICY-SDK-APP/pom.xml index 6a98e0f6e..9c8716b6d 100644 --- a/POLICY-SDK-APP/pom.xml +++ b/POLICY-SDK-APP/pom.xml @@ -2,7 +2,7 @@ ============LICENSE_START======================================================= ONAP Policy Engine ================================================================================ - Copyright (C) 2017-2018 AT&T Intellectual Property. All rights reserved. + Copyright (C) 2017-2018, 2020 AT&T Intellectual Property. All rights reserved. ================================================================================ Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -74,6 +74,11 @@ **/gen/**,**/generated-sources/**,**/yang-gen**,**/pax/**,src/main/webapp/app/policyApp/CSS/**/*,src/main/webapp/app/policyApp/libs.bower_components/**/* + + org.powermock + powermock-api-mockito2 + test + ch.qos.logback logback-classic diff --git a/POLICY-SDK-APP/src/test/java/org/onap/policy/admin/PolicyManagerServletTest.java b/POLICY-SDK-APP/src/test/java/org/onap/policy/admin/PolicyManagerServletTest.java index d8c691ad5..cf85186a0 100644 --- a/POLICY-SDK-APP/src/test/java/org/onap/policy/admin/PolicyManagerServletTest.java +++ b/POLICY-SDK-APP/src/test/java/org/onap/policy/admin/PolicyManagerServletTest.java @@ -73,12 +73,14 @@ import org.onap.portalsdk.core.domain.User; import org.onap.portalsdk.core.util.SystemProperties; import org.onap.portalsdk.core.web.support.UserUtils; import org.powermock.api.mockito.PowerMockito; +import org.powermock.core.classloader.annotations.PowerMockIgnore; import org.powermock.core.classloader.annotations.PrepareForTest; import org.powermock.modules.junit4.PowerMockRunner; import org.powermock.reflect.Whitebox; import org.springframework.mock.web.MockHttpServletResponse; @RunWith(PowerMockRunner.class) +@PowerMockIgnore({"com.sun.org.apache.xerces.*", "jdk.internal.reflect.*", "javax.xml.*", "org.xml.*", "org.w3c.*"}) public class PolicyManagerServletTest extends Mockito { private static Logger logger = FlexLogger.getLogger(PolicyManagerServletTest.class); @@ -834,7 +836,6 @@ public class PolicyManagerServletTest extends Mockito { PowerMockito.mockStatic(ServletFileUpload.class); when(ServletFileUpload.isMultipartContent(mockRequest)).thenReturn(true); servlet.doPost(mockRequest, mockResponse); - PowerMockito.verifyStatic(ServletFileUpload.class, Mockito.times(1)); } @SuppressWarnings("unchecked") @@ -939,9 +940,9 @@ public class PolicyManagerServletTest extends Mockito { mockPolicyController, resultList); assertTrue(result); - verify(mockPolicyController, atLeast(1)).getRoles(any(String.class)); - verify(mockPolicyController, atLeast(1)).getRoles(any(String.class)); - verify(mockPolicyController, atLeast(1)).getData(any(Class.class)); + verify(mockPolicyController, atLeast(1)).getRoles(any()); + verify(mockPolicyController, atLeast(1)).getRoles(any()); + verify(mockPolicyController, atLeast(1)).getData(any()); verify(mockPolicyController, atLeast(1)).getEntityItem(UserInfo.class, "userLoginId", "sampleUserName"); verify(mockPolicyVersion, atLeast(1)).getPolicyName(); verify(mockPolicyVersion, atLeast(1)).getModifiedDate(); diff --git a/POLICY-SDK-APP/src/test/java/org/onap/policy/admin/PolicyRestControllerTest.java b/POLICY-SDK-APP/src/test/java/org/onap/policy/admin/PolicyRestControllerTest.java index be38e799c..b2e1b9228 100644 --- a/POLICY-SDK-APP/src/test/java/org/onap/policy/admin/PolicyRestControllerTest.java +++ b/POLICY-SDK-APP/src/test/java/org/onap/policy/admin/PolicyRestControllerTest.java @@ -62,12 +62,14 @@ import org.onap.portalsdk.core.domain.User; import org.onap.portalsdk.core.util.SystemProperties; import org.onap.portalsdk.core.web.support.UserUtils; import org.powermock.api.mockito.PowerMockito; +import org.powermock.core.classloader.annotations.PowerMockIgnore; import org.powermock.core.classloader.annotations.PrepareForTest; import org.powermock.modules.junit4.PowerMockRunner; import org.powermock.reflect.Whitebox; import org.springframework.mock.web.MockHttpServletResponse; @RunWith(PowerMockRunner.class) +@PowerMockIgnore({"com.sun.org.apache.xerces.*", "jdk.internal.reflect.*", "javax.xml.*", "org.xml.*", "org.w3c.*"}) public class PolicyRestControllerTest { private String clRequestString; diff --git a/POLICY-SDK-APP/src/test/java/org/onap/policy/controller/AdminTabControllerTest.java b/POLICY-SDK-APP/src/test/java/org/onap/policy/controller/AdminTabControllerTest.java index b4a4130ab..eccab040c 100644 --- a/POLICY-SDK-APP/src/test/java/org/onap/policy/controller/AdminTabControllerTest.java +++ b/POLICY-SDK-APP/src/test/java/org/onap/policy/controller/AdminTabControllerTest.java @@ -2,7 +2,7 @@ * ============LICENSE_START======================================================= * ONAP Policy Engine * ================================================================================ - * Copyright (C) 2017, 2019 AT&T Intellectual Property. All rights reserved. + * Copyright (C) 2017, 2019-2020 AT&T Intellectual Property. All rights reserved. * ================================================================================ * Modifications Copyright (C) 2019 Samsung * ================================================================================ @@ -115,7 +115,7 @@ public class AdminTabControllerTest { @Test public void testGetAdminTabEntityDataException() throws IOException { HttpServletResponse mockResponse = Mockito.mock(HttpServletResponse.class); - when(mockResponse.getWriter()).thenThrow(Exception.class); + when(mockResponse.getWriter()).thenThrow(IOException.class); admin.getAdminTabEntityData(request, mockResponse); verify(mockResponse).getWriter(); } diff --git a/POLICY-SDK-APP/src/test/java/org/onap/policy/controller/AutoPushControllerTest.java b/POLICY-SDK-APP/src/test/java/org/onap/policy/controller/AutoPushControllerTest.java index 5e390da53..95d566278 100644 --- a/POLICY-SDK-APP/src/test/java/org/onap/policy/controller/AutoPushControllerTest.java +++ b/POLICY-SDK-APP/src/test/java/org/onap/policy/controller/AutoPushControllerTest.java @@ -2,7 +2,7 @@ * ============LICENSE_START======================================================= * ONAP Policy Engine * ================================================================================ - * Copyright (C) 2018-2019 AT&T Intellectual Property. All rights reserved. + * Copyright (C) 2018-2020 AT&T Intellectual Property. All rights reserved. * ================================================================================ * Modifications Copyright (C) 2019 Samsung * ================================================================================ @@ -24,7 +24,7 @@ package org.onap.policy.controller; import static org.junit.Assert.assertEquals; import static org.junit.Assert.fail; -import static org.mockito.Matchers.any; +import static org.mockito.ArgumentMatchers.any; import static org.mockito.Mockito.atLeast; import static org.mockito.Mockito.verify; import static org.mockito.Mockito.when; @@ -53,10 +53,12 @@ import org.onap.portalsdk.core.domain.User; import org.onap.portalsdk.core.web.support.AppUtils; import org.onap.portalsdk.core.web.support.UserUtils; import org.powermock.api.mockito.PowerMockito; +import org.powermock.core.classloader.annotations.PowerMockIgnore; import org.powermock.core.classloader.annotations.PrepareForTest; import org.powermock.modules.junit4.PowerMockRunner; @RunWith(PowerMockRunner.class) +@PowerMockIgnore({"com.sun.org.apache.xerces.*", "jdk.internal.reflect.*", "javax.xml.*", "org.xml.*", "org.w3c.*"}) public class AutoPushControllerTest { private PolicyController controller = new PolicyController(); private AutoPushController apController = new AutoPushController(); diff --git a/POLICY-SDK-APP/src/test/java/org/onap/policy/controller/PolicyExportAndImportControllerTest.java b/POLICY-SDK-APP/src/test/java/org/onap/policy/controller/PolicyExportAndImportControllerTest.java index 84e9ccf84..4b348cf2b 100644 --- a/POLICY-SDK-APP/src/test/java/org/onap/policy/controller/PolicyExportAndImportControllerTest.java +++ b/POLICY-SDK-APP/src/test/java/org/onap/policy/controller/PolicyExportAndImportControllerTest.java @@ -2,7 +2,7 @@ * ============LICENSE_START======================================================= * ONAP Policy Engine * ================================================================================ - * Copyright (C) 2018-2019 AT&T Intellectual Property. All rights reserved. + * Copyright (C) 2018-2020 AT&T Intellectual Property. All rights reserved. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -23,8 +23,8 @@ package org.onap.policy.controller; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertNull; import static org.junit.Assert.assertTrue; -import static org.mockito.Matchers.any; -import static org.mockito.Matchers.eq; +import static org.mockito.ArgumentMatchers.any; +import static org.mockito.ArgumentMatchers.eq; import static org.mockito.Mockito.when; import com.mockrunner.mock.web.MockHttpServletRequest; @@ -48,10 +48,12 @@ import org.onap.policy.rest.jpa.UserInfo; import org.onap.portalsdk.core.domain.User; import org.onap.portalsdk.core.web.support.UserUtils; import org.powermock.api.mockito.PowerMockito; +import org.powermock.core.classloader.annotations.PowerMockIgnore; import org.powermock.core.classloader.annotations.PrepareForTest; import org.powermock.modules.junit4.PowerMockRunner; @RunWith(PowerMockRunner.class) +@PowerMockIgnore({"com.sun.org.apache.xerces.*", "jdk.internal.reflect.*", "javax.xml.*", "org.xml.*", "org.w3c.*"}) public class PolicyExportAndImportControllerTest { @Test public void testSetAndGet() { diff --git a/POLICY-SDK-APP/src/test/java/org/onap/policy/controller/PolicyNotificationControllerTest.java b/POLICY-SDK-APP/src/test/java/org/onap/policy/controller/PolicyNotificationControllerTest.java index 509f4a692..31b2dffb3 100644 --- a/POLICY-SDK-APP/src/test/java/org/onap/policy/controller/PolicyNotificationControllerTest.java +++ b/POLICY-SDK-APP/src/test/java/org/onap/policy/controller/PolicyNotificationControllerTest.java @@ -2,7 +2,7 @@ * ============LICENSE_START======================================================= * ONAP Policy Engine * ================================================================================ - * Copyright (C) 2018-2019 AT&T Intellectual Property. All rights reserved. + * Copyright (C) 2018-2020 AT&T Intellectual Property. All rights reserved. * ================================================================================ * Modifications Copyright (C) 2019 Samsung * ================================================================================ @@ -24,7 +24,7 @@ package org.onap.policy.controller; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertNull; -import static org.mockito.Matchers.any; +import static org.mockito.ArgumentMatchers.any; import static org.mockito.Mockito.when; import com.mockrunner.mock.web.MockHttpServletRequest; @@ -42,13 +42,15 @@ import org.onap.policy.rest.dao.CommonClassDao; import org.onap.portalsdk.core.domain.User; import org.onap.portalsdk.core.web.support.UserUtils; import org.powermock.api.mockito.PowerMockito; +import org.powermock.core.classloader.annotations.PowerMockIgnore; import org.powermock.core.classloader.annotations.PrepareForTest; import org.powermock.modules.junit4.PowerMockRunner; import org.springframework.web.servlet.ModelAndView; @RunWith(PowerMockRunner.class) +@PowerMockIgnore({"com.sun.org.apache.xerces.*", "jdk.internal.reflect.*", "javax.xml.*", "org.xml.*", "org.w3c.*"}) +@PrepareForTest({UserUtils.class}) public class PolicyNotificationControllerTest { - @PrepareForTest({UserUtils.class}) @Test public void testWatch() throws IOException { // Mock user utilities diff --git a/POLICY-SDK-APP/src/test/java/org/onap/policy/daoImp/CommonClassDaoImplTest.java b/POLICY-SDK-APP/src/test/java/org/onap/policy/daoImp/CommonClassDaoImplTest.java index dbe49c7c3..2b1052044 100644 --- a/POLICY-SDK-APP/src/test/java/org/onap/policy/daoImp/CommonClassDaoImplTest.java +++ b/POLICY-SDK-APP/src/test/java/org/onap/policy/daoImp/CommonClassDaoImplTest.java @@ -2,7 +2,7 @@ * ============LICENSE_START======================================================= * ONAP Policy Engine * ================================================================================ - * Copyright (C) 2017, 2019 AT&T Intellectual Property. All rights reserved. + * Copyright (C) 2017, 2019-2020 AT&T Intellectual Property. All rights reserved. * ================================================================================ * Modifications Copyright (C) 2019 Samsung * ================================================================================ @@ -40,6 +40,7 @@ import javax.script.SimpleBindings; import org.apache.tomcat.dbcp.dbcp2.BasicDataSource; import org.h2.tools.Server; import org.hibernate.Criteria; +import org.hibernate.HibernateException; import org.hibernate.Session; import org.hibernate.SessionFactory; import org.hibernate.Transaction; @@ -463,7 +464,7 @@ public class CommonClassDaoImplTest { @SuppressWarnings("unchecked") @Test - public void testExceptions() { + public void testExceptions() throws HibernateException { SessionFactory sfMock = Mockito.mock(SessionFactory.class); Session mockSession = Mockito.mock(Session.class); Criteria crMock = Mockito.mock(Criteria.class); @@ -474,11 +475,11 @@ public class CommonClassDaoImplTest { when(sfMock.openSession()).thenReturn(mockSession); when(mockSession.createCriteria(OnapName.class)).thenReturn(crMock); - when(crMock.list()).thenThrow(Exception.class); - when(mockSession.close()).thenThrow(Exception.class); + when(crMock.list()).thenThrow(HibernateException.class); + when(mockSession.close()).thenThrow(HibernateException.class); when(mockSession.beginTransaction()).thenReturn(mockTransaction); - doThrow(Exception.class).when(mockTransaction).commit(); + doThrow(HibernateException.class).when(mockTransaction).commit(); List dataList = commonClassDao.getData(OnapName.class); assertNull(dataList); diff --git a/POLICY-SDK-APP/src/test/java/org/onap/policy/daoImp/SystemLogDbDaoImplTest.java b/POLICY-SDK-APP/src/test/java/org/onap/policy/daoImp/SystemLogDbDaoImplTest.java index 5675d3fc9..44f034c20 100644 --- a/POLICY-SDK-APP/src/test/java/org/onap/policy/daoImp/SystemLogDbDaoImplTest.java +++ b/POLICY-SDK-APP/src/test/java/org/onap/policy/daoImp/SystemLogDbDaoImplTest.java @@ -2,7 +2,7 @@ * ============LICENSE_START======================================================= * ONAP Policy Engine * ================================================================================ - * Copyright (C) 2019 AT&T Intellectual Property. All rights reserved. + * Copyright (C) 2019-2020 AT&T Intellectual Property. All rights reserved. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -25,6 +25,8 @@ import static org.mockito.Mockito.doThrow; import static org.mockito.Mockito.when; import java.util.List; + +import org.hibernate.HibernateException; import org.hibernate.Session; import org.hibernate.SessionFactory; import org.hibernate.Transaction; @@ -50,8 +52,8 @@ public class SystemLogDbDaoImplTest { when(sfMock.openSession()).thenReturn(mockSession); when(mockSession.beginTransaction()).thenReturn(mockTransaction); - doThrow(Exception.class).when(mockTransaction).commit(); - when(mockSession.close()).thenThrow(Exception.class); + doThrow(HibernateException.class).when(mockTransaction).commit(); + when(mockSession.close()).thenThrow(HibernateException.class); PolicyController.setjUnit(true); } diff --git a/PolicyEngineAPI/pom.xml b/PolicyEngineAPI/pom.xml index 6bde8fb07..94c06b79e 100644 --- a/PolicyEngineAPI/pom.xml +++ b/PolicyEngineAPI/pom.xml @@ -3,7 +3,7 @@ ============LICENSE_START======================================================= ONAP Policy Engine ================================================================================ - Copyright (C) 2017-2019 AT&T Intellectual Property. All rights reserved. + Copyright (C) 2017-2020 AT&T Intellectual Property. All rights reserved. ================================================================================ Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -31,7 +31,39 @@ org.glassfish javax.json - 1.0.4 + 1.1.4 + + + javax.xml.bind + jaxb-api + ${version.javax.bind} + + + org.glassfish.jaxb + jaxb-runtime + 2.3.2 + test + + + javax.activation + javax.activation-api + 1.2.0 + + + javax.xml.ws + jaxws-api + 2.3.1 + test + + + javax.xml + jaxp-api + 1.4.2 + + + javax.xml.parsers + jaxp-api + 1.4.5 org.apache.httpcomponents @@ -90,8 +122,7 @@ org.apache.maven.plugins maven-compiler-plugin - 1.8 - 1.8 + ${java.version} diff --git a/PolicyEngineAPI/src/test/java/org/onap/policy/std/StdPolicyEngineTest.java b/PolicyEngineAPI/src/test/java/org/onap/policy/std/StdPolicyEngineTest.java index 90e00c2c3..a7f609904 100644 --- a/PolicyEngineAPI/src/test/java/org/onap/policy/std/StdPolicyEngineTest.java +++ b/PolicyEngineAPI/src/test/java/org/onap/policy/std/StdPolicyEngineTest.java @@ -5,6 +5,7 @@ * Copyright (C) 2018 Ericsson. All rights reserved. * ================================================================================ * Modifications Copyright (C) 2019 Samsung + * Modifications Copyright (C) 2020 AT&T Intellectual Property. All rights reserved. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -24,8 +25,8 @@ package org.onap.policy.std; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertNotNull; -import static org.mockito.Matchers.any; -import static org.mockito.Matchers.eq; +import static org.mockito.ArgumentMatchers.any; +import static org.mockito.ArgumentMatchers.eq; import static org.mockito.Mockito.doReturn; import static org.mockito.Mockito.doThrow; import static org.mockito.Mockito.spy; @@ -103,6 +104,8 @@ import org.onap.policy.api.PushPolicyParameters; import org.onap.policy.models.APIDictionaryResponse; import org.onap.policy.models.APIPolicyConfigResponse; import org.onap.policy.std.utils.PolicyConfigConstants; +import org.powermock.core.classloader.annotations.PowerMockIgnore; +import org.powermock.core.classloader.annotations.PrepareForTest; import org.powermock.modules.junit4.PowerMockRunner; import org.springframework.http.HttpMethod; import org.springframework.http.HttpStatus; @@ -111,6 +114,8 @@ import org.springframework.web.client.HttpClientErrorException; import org.springframework.web.client.RestClientException; @RunWith(PowerMockRunner.class) +@PowerMockIgnore({"com.sun.org.apache.xerces.*", "jdk.internal.reflect.*", "javax.xml.*", "org.xml.*", "org.w3c.*"}) +@PrepareForTest(StdPolicyEngine.class) public class StdPolicyEngineTest { private static final String ONAP_NAME_VAL = "ONAP_NAME"; diff --git a/packages/docker/src/main/docker/Dockerfile b/packages/docker/src/main/docker/Dockerfile index 7ef47b423..580beccb6 100644 --- a/packages/docker/src/main/docker/Dockerfile +++ b/packages/docker/src/main/docker/Dockerfile @@ -1,4 +1,4 @@ -FROM onap/policy-common-alpine:1.4.0 +FROM onap/policy-jdk-debian LABEL maintainer="Policy Team" @@ -8,9 +8,9 @@ ARG POLICY_LOGS=/var/log/onap ENV BUILD_VERSION_ENGINE ${BUILD_VERSION_ENGINE} ENV POLICY_LOGS ${POLICY_LOGS} -RUN apk add --no-cache mariadb-client - -RUN mkdir -p /tmp/policy-install ${POLICY_LOGS} && \ +RUN apt update && \ + apt-get install -y mariadb-client && \ + mkdir -p /tmp/policy-install ${POLICY_LOGS} && \ chown policy:policy /tmp/policy-install ${POLICY_LOGS} && \ rmdir ${POLICY_HOME}/etc/ssl && \ rmdir ${POLICY_HOME}/etc diff --git a/pom.xml b/pom.xml index 893a2fcce..8541ee216 100644 --- a/pom.xml +++ b/pom.xml @@ -24,7 +24,7 @@ org.onap.policy.parent integration - 3.1.0 + 3.1.1-SNAPSHOT org.onap.policy.engine @@ -35,8 +35,6 @@ The ONAP Policy Engine main pom - 1.8 - 1.8 UTF-8 UTF-8 @@ -60,8 +58,8 @@ 1.3.3 1.18 6.8.2 - 1.6.1 - 2.2.0 + 1.6.2-SNAPSHOT + 2.2.1-SNAPSHOT PolicyEngineUtils @@ -113,7 +111,7 @@ xml-apis xml-apis - 1.3.03 + 1.4.01 @@ -146,7 +144,7 @@ org.powermock - powermock-api-mockito + powermock-api-mockito2 test @@ -163,7 +161,7 @@ org.easymock easymock - 3.1 + 4.1 test @@ -221,8 +219,7 @@ maven-compiler-plugin ${project.encoding} - ${project.source.version} - ${project.target.version} + ${java.version} -- 2.16.6