aboutsummaryrefslogtreecommitdiffstats
path: root/POLICY-SDK-APP
diff options
context:
space:
mode:
authorHOCKLA <ah999m@att.com>2020-01-17 16:20:01 -0600
committerHOCKLA <ah999m@att.com>2020-01-20 10:34:32 -0600
commite37f5a70bcf3fd8073418c13416cc79c0ef47d59 (patch)
tree4c9c9e0c4c341b2311e4c24311aa9cbffd5dedf1 /POLICY-SDK-APP
parentc8856ab39a6d8376e6ad700b6acabdc7736c714f (diff)
policy/engine jdk11 upgrades
Issue-ID: POLICY-1590 Change-Id: I4da8324a065ac9babe16368e69b76a4cbe9504ef Signed-off-by: HOCKLA <ah999m@att.com>
Diffstat (limited to 'POLICY-SDK-APP')
-rw-r--r--POLICY-SDK-APP/pom.xml7
-rw-r--r--POLICY-SDK-APP/src/test/java/org/onap/policy/admin/PolicyManagerServletTest.java9
-rw-r--r--POLICY-SDK-APP/src/test/java/org/onap/policy/admin/PolicyRestControllerTest.java2
-rw-r--r--POLICY-SDK-APP/src/test/java/org/onap/policy/controller/AdminTabControllerTest.java4
-rw-r--r--POLICY-SDK-APP/src/test/java/org/onap/policy/controller/AutoPushControllerTest.java6
-rw-r--r--POLICY-SDK-APP/src/test/java/org/onap/policy/controller/PolicyExportAndImportControllerTest.java8
-rw-r--r--POLICY-SDK-APP/src/test/java/org/onap/policy/controller/PolicyNotificationControllerTest.java8
-rw-r--r--POLICY-SDK-APP/src/test/java/org/onap/policy/daoImp/CommonClassDaoImplTest.java11
-rw-r--r--POLICY-SDK-APP/src/test/java/org/onap/policy/daoImp/SystemLogDbDaoImplTest.java8
9 files changed, 40 insertions, 23 deletions
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.
@@ -75,6 +75,11 @@
</properties>
<dependencies>
<dependency>
+ <groupId>org.powermock</groupId>
+ <artifactId>powermock-api-mockito2</artifactId>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
<groupId>ch.qos.logback</groupId>
<artifactId>logback-classic</artifactId>
</dependency>
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);
}