This is an automated email from the ASF dual-hosted git repository.

juanpablo pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/jspwiki.git

commit 33570413b6f34167cfc4d9474e166b7fa5f7eb60
Author: juanpablo <[email protected]>
AuthorDate: Wed Mar 4 21:40:53 2020 +0100

    JSPWIKI-303: begin to use Session instead of WikiSession (3)
---
 .../src/test/java/org/apache/wiki/TestEngine.java  |  45 ++++-----
 .../test/java/org/apache/wiki/WikiSessionTest.java | 108 ++++++++++-----------
 .../wiki/auth/AuthenticationManagerTest.java       |  21 ++--
 .../apache/wiki/auth/AuthorizationManagerTest.java |  76 +++++----------
 .../java/org/apache/wiki/auth/TestAuthorizer.java  |  14 ++-
 .../java/org/apache/wiki/auth/UserManagerTest.java |  14 +--
 .../java/org/apache/wiki/auth/acl/AclImplTest.java |  79 +++++++--------
 .../wiki/auth/authorize/GroupManagerTest.java      |  21 ++--
 .../java/org/apache/wiki/plugin/IfPluginTest.java  |  28 ++----
 .../apache/wiki/workflow/DecisionQueueTest.java    |  35 +++----
 10 files changed, 200 insertions(+), 241 deletions(-)

diff --git a/jspwiki-main/src/test/java/org/apache/wiki/TestEngine.java 
b/jspwiki-main/src/test/java/org/apache/wiki/TestEngine.java
index 7178bdd..e83b1b5 100644
--- a/jspwiki-main/src/test/java/org/apache/wiki/TestEngine.java
+++ b/jspwiki-main/src/test/java/org/apache/wiki/TestEngine.java
@@ -24,6 +24,7 @@ import net.sourceforge.stripes.mock.MockHttpSession;
 import net.sourceforge.stripes.mock.MockServletContext;
 import org.apache.commons.lang3.StringUtils;
 import org.apache.log4j.Logger;
+import org.apache.wiki.api.core.Session;
 import org.apache.wiki.api.exceptions.ProviderException;
 import org.apache.wiki.api.exceptions.WikiException;
 import org.apache.wiki.attachment.Attachment;
@@ -57,9 +58,9 @@ public class TestEngine extends WikiEngine
 {
     static Logger log = Logger.getLogger( TestEngine.class );
 
-    private WikiSession m_adminWikiSession = null;
-    private WikiSession m_janneWikiSession = null;
-    private WikiSession m_guestWikiSession = null;
+    private Session m_adminWikiSession = null;
+    private Session m_janneWikiSession = null;
+    private Session m_guestWikiSession = null;
 
     // combined properties file (jspwiki.properties + custom override, if any)
     private static Properties combinedProperties = null;
@@ -70,12 +71,12 @@ public class TestEngine extends WikiEngine
      * @return the wiki session
      * @throws WikiSecurityException
      */
-    public WikiSession adminSession() throws WikiSecurityException
+    public Session adminSession() throws WikiSecurityException
     {
         if ( m_adminWikiSession == null )
         {
             // Set up long-running admin session
-            HttpServletRequest request = newHttpRequest();
+            final HttpServletRequest request = newHttpRequest();
             m_adminWikiSession = WikiSession.getWikiSession( this, request );
             this.getAuthenticationManager().login( m_adminWikiSession, request,
                                                    Users.ADMIN,
@@ -89,12 +90,12 @@ public class TestEngine extends WikiEngine
      * For testing purposes, obviously.
      * @return the wiki session
      */
-    public WikiSession guestSession()
+    public Session guestSession()
     {
         if ( m_guestWikiSession == null )
         {
             // Set up guest session
-            HttpServletRequest request = newHttpRequest();
+            final HttpServletRequest request = newHttpRequest();
             m_guestWikiSession = WikiSession.getWikiSession( this, request );
         }
         return m_guestWikiSession;
@@ -106,12 +107,12 @@ public class TestEngine extends WikiEngine
      * @return the wiki session
      * @throws WikiSecurityException
      */
-    public WikiSession janneSession() throws WikiSecurityException
+    public Session janneSession() throws WikiSecurityException
     {
         if ( m_janneWikiSession == null )
         {
             // Set up a test Janne session
-            HttpServletRequest request = newHttpRequest();
+            final HttpServletRequest request = newHttpRequest();
             m_janneWikiSession = WikiSession.getWikiSession( this, request );
             this.getAuthenticationManager().login( m_janneWikiSession, 
request, Users.JANNE, Users.JANNE_PASS );
         }
@@ -134,11 +135,11 @@ public class TestEngine extends WikiEngine
         this( getTestProperties() );
     }
 
-    public TestEngine( Properties props ) throws WikiException {
+    public TestEngine( final Properties props ) throws WikiException {
         super( createServletContext( "test" ), "test", cleanTestProps( props ) 
);
 
         // Stash the WikiEngine in the servlet context
-        ServletContext servletContext = this.getServletContext();
+        final ServletContext servletContext = this.getServletContext();
         servletContext.setAttribute("org.apache.wiki.WikiEngine", this);
     }
 
@@ -172,8 +173,8 @@ public class TestEngine extends WikiEngine
      * @param path the path relative to the wiki context, for example 
"/Wiki.jsp"
      * @return the new request
      */
-    public MockHttpServletRequest newHttpRequest( String path ) {
-        MockHttpServletRequest request = new MockHttpServletRequest( 
"/JSPWiki", path ) {
+    public MockHttpServletRequest newHttpRequest( final String path ) {
+        final MockHttpServletRequest request = new MockHttpServletRequest( 
"/JSPWiki", path ) {
             @Override
             public ServletContext getServletContext() { // stripes mock 
returns null
                 return new MockServletContext( "/JSPWiki" ) {
@@ -198,9 +199,9 @@ public class TestEngine extends WikiEngine
             properties = getTestProperties();
         }
 
-        String workdir = properties.getProperty( WikiEngine.PROP_WORKDIR );
+        final String workdir = properties.getProperty( WikiEngine.PROP_WORKDIR 
);
         if ( workdir != null ) {
-            File f = new File( workdir );
+            final File f = new File( workdir );
 
             if (f.exists() && f.isDirectory() && new File( f, "refmgr.ser" 
).exists()) {
                 // System.out.println( "Deleting " + f.getAbsolutePath() );
@@ -218,9 +219,9 @@ public class TestEngine extends WikiEngine
             properties = getTestProperties();
         }
 
-        String wikidir = properties.getProperty( 
AbstractFileProvider.PROP_PAGEDIR );
+        final String wikidir = properties.getProperty( 
AbstractFileProvider.PROP_PAGEDIR );
         if ( wikidir != null ) {
-            File f = new File( wikidir );
+            final File f = new File( wikidir );
 
             if (f.exists() && f.isDirectory()) {
                 deleteAll( f );
@@ -234,12 +235,12 @@ public class TestEngine extends WikiEngine
         }
         // better to make a copy via putAll instead of Properties(properties)
         // constructor, see http://stackoverflow.com/a/2004900
-        Properties propCopy = new Properties();
+        final Properties propCopy = new Properties();
         propCopy.putAll(combinedProperties);
         return propCopy;
     }
 
-    public static final Properties getTestProperties(String customPropFile) {
+    public static final Properties getTestProperties( final String 
customPropFile) {
         return PropertyReader.getCombinedProperties(customPropFile);
     }
 /*
@@ -260,17 +261,17 @@ public class TestEngine extends WikiEngine
     /**
      *  Deletes all files under this directory, and does them recursively.
      */
-    public static void deleteAll( File file )
+    public static void deleteAll( final File file )
     {
         if( file != null )
         {
             if( file.isDirectory() )
             {
-                File[] files = file.listFiles();
+                final File[] files = file.listFiles();
 
                 if( files != null )
                 {
-                    for (File file2 : files) {
+                    for ( final File file2 : files) {
                         if( file2.isDirectory() )
                         {
                             deleteAll(file2);
diff --git a/jspwiki-main/src/test/java/org/apache/wiki/WikiSessionTest.java 
b/jspwiki-main/src/test/java/org/apache/wiki/WikiSessionTest.java
index 24ce6a7..1fea90b 100644
--- a/jspwiki-main/src/test/java/org/apache/wiki/WikiSessionTest.java
+++ b/jspwiki-main/src/test/java/org/apache/wiki/WikiSessionTest.java
@@ -17,12 +17,14 @@
     under the License.
  */
 package org.apache.wiki;
+
 import net.sourceforge.stripes.mock.MockFilterChain;
 import net.sourceforge.stripes.mock.MockFilterConfig;
 import net.sourceforge.stripes.mock.MockHttpServletRequest;
 import net.sourceforge.stripes.mock.MockHttpServletResponse;
 import net.sourceforge.stripes.mock.MockServletContext;
 import org.apache.commons.lang3.ArrayUtils;
+import org.apache.wiki.api.core.Session;
 import org.apache.wiki.api.exceptions.WikiException;
 import org.apache.wiki.auth.AuthenticationManager;
 import org.apache.wiki.auth.Users;
@@ -58,14 +60,14 @@ public class WikiSessionTest
     @BeforeEach
     public void setUp() throws Exception
     {
-        Properties props = TestEngine.getTestProperties();
+        final Properties props = TestEngine.getTestProperties();
         m_engine = new TestEngine( props );
     }
 
     @Test
     public void testRoles() throws Exception
     {
-        WikiSession session;
+        Session session;
         Principal[] principals;
 
         // Test roles for guest session
@@ -113,23 +115,10 @@ public class WikiSessionTest
     }
 
     @Test
-    public void testIsIPAddress()
-    {
-        Assertions.assertFalse( WikiSession.isIPV4Address( "Me" ) );
-        Assertions.assertFalse( WikiSession.isIPV4Address( "Guest" ) );
-        Assertions.assertTrue( WikiSession.isIPV4Address( "127.0.0.1" ) );
-        Assertions.assertFalse( WikiSession.isIPV4Address( "1207.0.0.1" ) );
-        Assertions.assertFalse( WikiSession.isIPV4Address( "127..0.1" ) );
-        Assertions.assertFalse( WikiSession.isIPV4Address( "1207.0.0." ) );
-        Assertions.assertFalse( WikiSession.isIPV4Address( ".0.0.1" ) );
-        Assertions.assertFalse( WikiSession.isIPV4Address( "..." ) );
-    }
-
-    @Test
     public void testIPAddress() throws ServletException, IOException
     {
-        MockHttpServletRequest request;
-        WikiSession wikiSession;
+        final MockHttpServletRequest request;
+        final Session wikiSession;
 
         // A naked HTTP request without userPrincipal/remoteUser should be 
anonymous
         request = m_engine.newHttpRequest();
@@ -142,8 +131,8 @@ public class WikiSessionTest
     @Test
     public void testUserPrincipal() throws ServletException, IOException
     {
-        MockHttpServletRequest request;
-        WikiSession wikiSession;
+        final MockHttpServletRequest request;
+        final Session wikiSession;
 
         // Changing the UserPrincipal value should cause the user to be 
authenticated...
         request = m_engine.newHttpRequest();
@@ -157,13 +146,13 @@ public class WikiSessionTest
     @Test
     public void testAssertionCookie() throws ServletException, IOException
     {
-        MockHttpServletRequest request;
-        WikiSession wikiSession;
+        final MockHttpServletRequest request;
+        final Session wikiSession;
 
         // Adding the magic "assertion cookie" should  set asserted status.
         request = m_engine.newHttpRequest();
         request.setUserPrincipal( null );
-        String cookieName = CookieAssertionLoginModule.PREFS_COOKIE_NAME;
+        final String cookieName = CookieAssertionLoginModule.PREFS_COOKIE_NAME;
         request.setCookies( new Cookie[] { new Cookie( cookieName, 
"FredFlintstone" ) } );
         runSecurityFilter(m_engine, request);
         wikiSession = WikiSession.getWikiSession( m_engine, request );
@@ -174,15 +163,15 @@ public class WikiSessionTest
     @Test
     public void testAuthenticationCookieDefaults() throws ServletException, 
IOException
     {
-        MockHttpServletRequest request;
-        WikiSession wikiSession;
+        final MockHttpServletRequest request;
+        final Session wikiSession;
 
         // Set the authentication cookie first
         MockHttpServletResponse response = new MockHttpServletResponse();
         CookieAuthenticationLoginModule.setLoginCookie( m_engine, response, 
"Fred Flintstone" );
-        Cookie[] cookies = response.getCookies();
+        final Cookie[] cookies = response.getCookies();
         Assertions.assertEquals(1, cookies.length);
-        String uid = cookies[0].getValue();
+        final String uid = cookies[0].getValue();
 
         // Adding the magic "authentication cookie" should NOT count as 
authenticated in the default case
         // (because cookie authentication is OFF).
@@ -203,19 +192,19 @@ public class WikiSessionTest
     @Test
     public void testAuthenticationCookieWhenOn() throws WikiException, 
ServletException, IOException
     {
-        Properties props = TestEngine.getTestProperties();
+        final Properties props = TestEngine.getTestProperties();
         props.setProperty( AuthenticationManager.PROP_ALLOW_COOKIE_AUTH, 
"true");
         m_engine = new TestEngine( props );
 
-        MockHttpServletRequest request;
-        WikiSession wikiSession;
+        final MockHttpServletRequest request;
+        final Session wikiSession;
 
         // Set the authentication cookie first
         MockHttpServletResponse response = new MockHttpServletResponse();
         CookieAuthenticationLoginModule.setLoginCookie( m_engine, response, 
"Fred Flintstone" );
-        Cookie[] cookies = response.getCookies();
+        final Cookie[] cookies = response.getCookies();
         Assertions.assertEquals(1, cookies.length);
-        String uid = cookies[0].getValue();
+        final String uid = cookies[0].getValue();
 
         // Adding the magic "authentication cookie" should count as 
authenticated
         request = m_engine.newHttpRequest();
@@ -238,16 +227,16 @@ public class WikiSessionTest
      * @return the new session
      * @throws Exception
      */
-    public static WikiSession anonymousSession( TestEngine engine ) throws 
Exception
+    public static Session anonymousSession( final TestEngine engine ) throws 
Exception
     {
         // Build anon session
-        MockHttpServletRequest request = engine.newHttpRequest();
+        final MockHttpServletRequest request = engine.newHttpRequest();
 
         // Log in
         runSecurityFilter( engine, request );
 
         // Make sure the user is actually anonymous
-        WikiSession session = WikiSession.getWikiSession( engine, request );
+        final Session session = WikiSession.getWikiSession( engine, request );
         if ( !session.isAnonymous() )
         {
             throw new IllegalStateException( "Session is not anonymous." );
@@ -255,12 +244,12 @@ public class WikiSessionTest
         return session;
     }
 
-    public static WikiSession assertedSession( TestEngine engine, String name 
) throws Exception
+    public static Session assertedSession( final TestEngine engine, final 
String name ) throws Exception
     {
         return assertedSession( engine, name, new Principal[0] );
     }
 
-    public static WikiSession assertedSession( TestEngine engine, String name, 
Principal[] roles ) throws Exception
+    public static Session assertedSession( final TestEngine engine, final 
String name, final Principal[] roles ) throws Exception
     {
         // We can use cookies right?
         if ( !engine.getAuthenticationManager().allowsCookieAssertions() )
@@ -269,8 +258,8 @@ public class WikiSessionTest
         }
 
         // Build anon session
-        MockHttpServletRequest request = engine.newHttpRequest();
-        Set<String> r = new HashSet<String>();
+        final MockHttpServletRequest request = engine.newHttpRequest();
+        final Set<String> r = new HashSet<>();
         for ( int i = 0; i < roles.length; i++ )
         {
             r.add( roles[i].getName() );
@@ -278,32 +267,31 @@ public class WikiSessionTest
         request.setRoles( r );
 
         // Set cookie
-        Cookie cookie = new Cookie( 
CookieAssertionLoginModule.PREFS_COOKIE_NAME, name );
+        final Cookie cookie = new Cookie( 
CookieAssertionLoginModule.PREFS_COOKIE_NAME, name );
         request.setCookies( new Cookie[] { cookie } );
 
         // Log in
         runSecurityFilter(engine, request);
 
         // Make sure the user is actually asserted
-        WikiSession session = WikiSession.getWikiSession( engine, request );
-        return session;
+        return WikiSession.getWikiSession( engine, request );
     }
 
-    public static WikiSession adminSession( TestEngine engine ) throws 
Exception
+    public static Session adminSession( final TestEngine engine ) throws 
Exception
     {
         return authenticatedSession( engine, Users.ADMIN, Users.ADMIN_PASS );
     }
 
-    public static WikiSession authenticatedSession( TestEngine engine, String 
id, String password ) throws Exception
+    public static Session authenticatedSession( final TestEngine engine, final 
String id, final String password ) throws Exception
     {
         // Build anon session
-        MockHttpServletRequest request = engine.newHttpRequest();
+        final MockHttpServletRequest request = engine.newHttpRequest();
 
         // Log in as anon
         runSecurityFilter(engine, request);
 
         // Log in the user with credentials
-        WikiSession session = WikiSession.getWikiSession( engine, request );
+        final Session session = WikiSession.getWikiSession( engine, request );
         engine.getAuthenticationManager().login( session, request, id, 
password );
 
         // Make sure the user is actually authenticated
@@ -314,11 +302,11 @@ public class WikiSessionTest
         return session;
     }
 
-    public static WikiSession containerAuthenticatedSession( TestEngine 
engine, String id, Principal[] roles ) throws Exception
+    public static Session containerAuthenticatedSession( final TestEngine 
engine, final String id, final Principal[] roles ) throws Exception
     {
         // Build container session
-        MockHttpServletRequest request = engine.newHttpRequest();
-        Set<String> r = new HashSet<String>();
+        final MockHttpServletRequest request = engine.newHttpRequest();
+        final Set<String> r = new HashSet<>();
         for ( int i = 0; i < roles.length; i++ )
         {
             r.add( roles[i].getName() );
@@ -330,7 +318,7 @@ public class WikiSessionTest
         runSecurityFilter(engine,request);
 
         // Make sure the user is actually authenticated
-        WikiSession session = WikiSession.getWikiSession( engine, request );
+        final Session session = WikiSession.getWikiSession( engine, request );
         if ( !session.isAuthenticated() )
         {
             throw new IllegalStateException( "Could not log in authenticated 
user '" + id + "'" );
@@ -346,22 +334,22 @@ public class WikiSessionTest
      * @throws ServletException
      * @throws IOException
      */
-    private static void runSecurityFilter(WikiEngine engine, 
HttpServletRequest request) throws ServletException, IOException
+    private static void runSecurityFilter( final WikiEngine engine, final 
HttpServletRequest request) throws ServletException, IOException
     {
         // Create a mock servlet context and stash the wiki engine in it
-        ServletContext servletCtx = new MockServletContext( "JSPWiki" );
+        final ServletContext servletCtx = new MockServletContext( "JSPWiki" );
         servletCtx.setAttribute( "org.apache.wiki.WikiEngine", engine );
 
         // Create a mock filter configuration and add the servlet context we 
just created
-        MockFilterConfig filterConfig = new MockFilterConfig();
+        final MockFilterConfig filterConfig = new MockFilterConfig();
         filterConfig.setFilterName( "WikiServletFilter" );
         filterConfig.setServletContext( servletCtx );
 
         // Create the security filter and run the request  through it
-        Filter filter = new WikiServletFilter();
-        MockFilterChain chain = new MockFilterChain();
+        final Filter filter = new WikiServletFilter();
+        final MockFilterChain chain = new MockFilterChain();
         chain.addFilter( filter );
-        Servlet servlet = new MockServlet();
+        final Servlet servlet = new MockServlet();
         chain.setServlet( servlet );
         filter.init(filterConfig);
         filter.doFilter(request, null, chain );
@@ -371,24 +359,28 @@ public class WikiSessionTest
     {
         private ServletConfig m_config;
 
+        @Override
         public void destroy() { }
 
+        @Override
         public ServletConfig getServletConfig()
         {
             return m_config;
         }
 
+        @Override
         public String getServletInfo()
         {
             return "Mock servlet";
         }
 
-        public void init( ServletConfig config ) throws ServletException
-        {
+        @Override
+        public void init( final ServletConfig config ) throws ServletException 
{
             m_config = config;
         }
 
-        public void service( ServletRequest request, ServletResponse response 
) throws ServletException, IOException { }
+        @Override
+        public void service( final ServletRequest request, final 
ServletResponse response ) throws ServletException, IOException {}
     }
 
 }
diff --git 
a/jspwiki-main/src/test/java/org/apache/wiki/auth/AuthenticationManagerTest.java
 
b/jspwiki-main/src/test/java/org/apache/wiki/auth/AuthenticationManagerTest.java
index 0c1a106..b8da2f6 100644
--- 
a/jspwiki-main/src/test/java/org/apache/wiki/auth/AuthenticationManagerTest.java
+++ 
b/jspwiki-main/src/test/java/org/apache/wiki/auth/AuthenticationManagerTest.java
@@ -23,6 +23,7 @@ import org.apache.wiki.WikiEngine;
 import org.apache.wiki.WikiSession;
 import org.apache.wiki.WikiSessionTest;
 import org.apache.wiki.api.core.Engine;
+import org.apache.wiki.api.core.Session;
 import org.apache.wiki.auth.authorize.Group;
 import org.apache.wiki.auth.authorize.GroupManager;
 import org.apache.wiki.auth.authorize.Role;
@@ -56,18 +57,22 @@ public class AuthenticationManagerTest {
             return null;
         }
 
-        @Override public Principal[] getRoles() {
+        @Override
+        public Principal[] getRoles() {
             return m_roles;
         }
 
-        @Override public void initialize( final Engine engine, final 
Properties props ) throws WikiSecurityException {
+        @Override
+        public void initialize( final Engine engine, final Properties props ) 
throws WikiSecurityException {
         }
 
-        @Override public boolean isUserInRole( final HttpServletRequest 
request, final Principal role ) {
+        @Override
+        public boolean isUserInRole( final HttpServletRequest request, final 
Principal role ) {
             return request != null && "ContainerRole".equals( role.getName() );
         }
 
-        @Override public boolean isUserInRole( final WikiSession session, 
final Principal role ) {
+        @Override
+        public boolean isUserInRole( final Session session, final Principal 
role ) {
             return session != null && "AuthorizerRole".equals( role.getName() 
);
         }
     }
@@ -78,7 +83,7 @@ public class AuthenticationManagerTest {
 
     private GroupManager m_groupMgr;
 
-    private WikiSession m_session;
+    private Session m_session;
 
     @BeforeEach
     public void setUp() throws Exception {
@@ -101,7 +106,7 @@ public class AuthenticationManagerTest {
         m_engine = new TestEngine( props );
 
         // Start a session without any container roles: DummyAuthorizer should 
ALWAYS allow AuthorizerRole
-        WikiSession session = WikiSessionTest.authenticatedSession( m_engine, 
Users.JANNE, Users.JANNE_PASS );
+        Session session = WikiSessionTest.authenticatedSession( m_engine, 
Users.JANNE, Users.JANNE_PASS );
         Assertions.assertTrue( session.hasPrincipal( Role.ALL ) );
         Assertions.assertTrue( session.hasPrincipal( Role.AUTHENTICATED ) );
         Assertions.assertTrue( session.hasPrincipal( new WikiPrincipal( 
Users.JANNE, WikiPrincipal.LOGIN_NAME ) ) );
@@ -170,7 +175,7 @@ public class AuthenticationManagerTest {
 
     @Test
     public void testLoginCustom() throws Exception {
-        final WikiSession session = WikiSessionTest.authenticatedSession( 
m_engine, Users.JANNE, Users.JANNE_PASS );
+        final Session session = WikiSessionTest.authenticatedSession( 
m_engine, Users.JANNE, Users.JANNE_PASS );
         Assertions.assertTrue( session.hasPrincipal( Role.ALL ) );
         Assertions.assertTrue( session.hasPrincipal( Role.AUTHENTICATED ) );
         Assertions.assertTrue( session.hasPrincipal( new WikiPrincipal( 
Users.JANNE, WikiPrincipal.LOGIN_NAME ) ) );
@@ -190,7 +195,7 @@ public class AuthenticationManagerTest {
 
         // Log in 'janne' and verify there are 5 principals in the subject
         // (ALL, AUTHENTICATED, login, fullname, wikiname Principals)
-        final WikiSession session = WikiSession.guestSession( m_engine );
+        final Session session = WikiSession.guestSession( m_engine );
         m_auth.login( session, null, Users.JANNE, Users.JANNE_PASS );
         Assertions.assertEquals( 3, session.getPrincipals().length );
         Assertions.assertEquals( 2, session.getRoles().length );
diff --git 
a/jspwiki-main/src/test/java/org/apache/wiki/auth/AuthorizationManagerTest.java 
b/jspwiki-main/src/test/java/org/apache/wiki/auth/AuthorizationManagerTest.java
index 096315c..1b673b8 100644
--- 
a/jspwiki-main/src/test/java/org/apache/wiki/auth/AuthorizationManagerTest.java
+++ 
b/jspwiki-main/src/test/java/org/apache/wiki/auth/AuthorizationManagerTest.java
@@ -21,8 +21,8 @@ package org.apache.wiki.auth;
 import org.apache.commons.lang3.ArrayUtils;
 import org.apache.wiki.TestEngine;
 import org.apache.wiki.WikiPage;
-import org.apache.wiki.WikiSession;
 import org.apache.wiki.WikiSessionTest;
+import org.apache.wiki.api.core.Session;
 import org.apache.wiki.api.exceptions.ProviderException;
 import org.apache.wiki.api.exceptions.WikiException;
 import org.apache.wiki.attachment.Attachment;
@@ -56,7 +56,7 @@ public class AuthorizationManagerTest
 
     private GroupManager         m_groupMgr;
 
-    private WikiSession          m_session;
+    private Session m_session;
 
     private static class TestPrincipal implements Principal
     {
@@ -102,10 +102,8 @@ public class AuthorizationManagerTest
         m_engine.saveText( "TestDefaultPage", "Foo" );
         final Permission view = PermissionFactory.getPagePermission( 
"*:TestDefaultPage", "view" );
         final Permission edit = PermissionFactory.getPagePermission( 
"*:TestDefaultPage", "edit" );
-        WikiSession session;
-
         // Alice is asserted
-        session = WikiSessionTest.assertedSession( m_engine, Users.ALICE );
+        Session session = WikiSessionTest.assertedSession( m_engine, 
Users.ALICE );
         Assertions.assertTrue( m_auth.checkPermission( session, view ), "Alice 
view" );
         Assertions.assertTrue( m_auth.checkPermission( session, edit ), "Alice 
edit" );
 
@@ -115,24 +113,19 @@ public class AuthorizationManagerTest
         Assertions.assertTrue( m_auth.checkPermission( session, edit ), "Bob 
edit" );
 
         // Delete the test page
-        try
-        {
+        try {
             m_engine.getManager( PageManager.class ).deletePage( 
"TestDefaultPage" );
-        }
-        catch( final ProviderException e )
-        {
+        } catch( final ProviderException e ) {
             Assertions.fail( e.getMessage() );
         }
     }
 
     @Test
-    public void testGetRoles() throws Exception
-    {
-        WikiSession session;
+    public void testGetRoles() throws Exception {
         Principal[] principals;
 
         // Create a new "asserted" session for Bob
-        session = WikiSessionTest.assertedSession( m_engine, Users.BOB );
+        Session session = WikiSessionTest.assertedSession( m_engine, Users.BOB 
);
 
         // Set up a group without Bob in it
         Group test = m_groupMgr.parseGroup( "Test", "Alice \n Charlie", true );
@@ -181,10 +174,7 @@ public class AuthorizationManagerTest
         final Role engineering = new Role( "Engineering" );
         final Role finance = new Role( "Finance" );
         final Principal admin = new GroupPrincipal( "Admin" );
-        final WikiSession session = WikiSessionTest.assertedSession(
-                m_engine,
-                Users.ALICE,
-                new Principal[] { it, engineering, admin } );
+        final Session session = WikiSessionTest.assertedSession( m_engine, 
Users.ALICE, new Principal[] { it, engineering, admin } );
 
         // Create two groups: Alice should be part of group Bar, but not Foo
         final Group fooGroup = m_groupMgr.parseGroup( "Foo", "", true );
@@ -229,10 +219,7 @@ public class AuthorizationManagerTest
         final Role engineering = new Role( "Engineering" );
         final Role finance = new Role( "Finance" );
         final Principal admin = new GroupPrincipal( "Admin" );
-        final WikiSession session = 
WikiSessionTest.containerAuthenticatedSession(
-                m_engine,
-                Users.ALICE,
-                new Principal[] { it, engineering, admin } );
+        final Session session = WikiSessionTest.containerAuthenticatedSession( 
m_engine, Users.ALICE, new Principal[] { it, engineering, admin } );
 
         // Create two groups: Alice should be part of group Bar, but not Foo
         final Group fooGroup = m_groupMgr.parseGroup( "Foo", "", true );
@@ -285,8 +272,7 @@ public class AuthorizationManagerTest
         final Permission edit = PermissionFactory.getPagePermission( p, "edit" 
);
 
         // Create authenticated session with user 'Alice', who can read & edit 
(in ACL)
-        WikiSession session;
-        session = WikiSessionTest.authenticatedSession( m_engine, Users.ALICE, 
Users.ALICE_PASS );
+        Session session = WikiSessionTest.authenticatedSession( m_engine, 
Users.ALICE, Users.ALICE_PASS );
         Assertions.assertTrue( m_auth.checkPermission( session, view ), "Alice 
view Test/test1.txt" );
         Assertions.assertTrue( m_auth.checkPermission( session, edit ), "Alice 
view Test/test1.txt" );
 
@@ -317,8 +303,7 @@ public class AuthorizationManagerTest
         final Permission edit = PermissionFactory.getPagePermission( p, "edit" 
);
 
         // Create session with user 'Alice', who can read (in ACL)
-        WikiSession session;
-        session = WikiSessionTest.authenticatedSession( m_engine, Users.ALICE, 
Users.ALICE_PASS );
+        Session session = WikiSessionTest.authenticatedSession( m_engine, 
Users.ALICE, Users.ALICE_PASS );
         Assertions.assertTrue( m_auth.checkPermission( session, view ), "Foo 
view Test" );
         Assertions.assertFalse( m_auth.checkPermission( session, edit ),"Foo 
!edit Test" );
 
@@ -341,7 +326,7 @@ public class AuthorizationManagerTest
         final Role finance = new Role( "Finance" );
 
         // Create Group1 with Alice in it, Group2 without
-        WikiSession session = WikiSessionTest.adminSession( m_engine );
+        Session session = WikiSessionTest.adminSession( m_engine );
         final Group g1 = m_groupMgr.parseGroup( "Group1", "Alice", true );
         m_groupMgr.setGroup( session, g1 );
         final Principal group1 = g1.getPrincipal();
@@ -398,7 +383,7 @@ public class AuthorizationManagerTest
         final Role finance = new Role( "Finance" );
 
         // Create Group1 with Alice in it, Group2 without
-        WikiSession session = WikiSessionTest.adminSession( m_engine );
+        Session session = WikiSessionTest.adminSession( m_engine );
         final Group g1 = m_groupMgr.parseGroup( "Group1", "Alice", true );
         m_groupMgr.setGroup( session, g1 );
         final Principal group1 = g1.getPrincipal();
@@ -458,8 +443,7 @@ public class AuthorizationManagerTest
         final Permission edit = PermissionFactory.getPagePermission( p, "edit" 
);
 
         // Create session with authenticated user 'Alice', who can read & edit 
(in ACL)
-        WikiSession session;
-        session = WikiSessionTest.authenticatedSession( m_engine, Users.ALICE, 
Users.ALICE_PASS );
+        Session session = WikiSessionTest.authenticatedSession( m_engine, 
Users.ALICE, Users.ALICE_PASS );
         Assertions.assertTrue( m_auth.checkPermission( session, view ), "Alice 
view Test" );
         Assertions.assertTrue( m_auth.checkPermission( session, edit ), "Alice 
edit Test" );
 
@@ -580,8 +564,7 @@ public class AuthorizationManagerTest
         final Permission edit = PermissionFactory.getPagePermission( p, "edit" 
);
 
         // Create session with authenticated user 'Alice', who can read & edit
-        WikiSession session;
-        session = WikiSessionTest.authenticatedSession( m_engine, Users.ALICE, 
Users.ALICE_PASS );
+        Session session = WikiSessionTest.authenticatedSession( m_engine, 
Users.ALICE, Users.ALICE_PASS );
         Assertions.assertTrue( m_auth.checkPermission( session, view ), "Alice 
view Test" );
         Assertions.assertTrue( m_auth.checkPermission( session, edit ), "Alice 
edit Test" );
 
@@ -591,20 +574,16 @@ public class AuthorizationManagerTest
         Assertions.assertFalse( m_auth.checkPermission( session, edit ), "Bob 
!edit Test" );
 
         // Cleanup
-        try
-        {
+        try {
             m_engine.getManager( PageManager.class ).deletePage( "Test" );
-        }
-        catch( final ProviderException e )
-        {
+        } catch( final ProviderException e ) {
             Assertions.fail( e.getMessage() );
         }
     }
 
     @Test
-    public void testStaticPermission() throws Exception
-    {
-        WikiSession s = WikiSessionTest.anonymousSession( m_engine );
+    public void testStaticPermission() throws Exception {
+        Session s = WikiSessionTest.anonymousSession( m_engine );
         Assertions.assertTrue( m_auth.checkStaticPermission( s, 
PagePermission.VIEW ), "Anonymous view" );
         Assertions.assertTrue( m_auth.checkStaticPermission( s, 
PagePermission.EDIT ), "Anonymous edit" );
         Assertions.assertTrue( m_auth.checkStaticPermission( s, 
PagePermission.COMMENT ), "Anonymous comment" );
@@ -660,27 +639,20 @@ public class AuthorizationManagerTest
     }
 
     @Test
-    public void testAdminView()
-       throws Exception
-    {
+    public void testAdminView() throws Exception {
         m_engine.saveText( "TestDefaultPage", "Foo [{ALLOW view FooBar}]" );
 
         final Principal admin = new GroupPrincipal( "Admin" );
-        final WikiSession session = 
WikiSessionTest.containerAuthenticatedSession(
-                m_engine,
-                Users.ALICE,
-                new Principal[] { admin } );
+        final Session session = WikiSessionTest.containerAuthenticatedSession( 
m_engine, Users.ALICE, new Principal[] { admin } );
 
         Assertions.assertTrue( m_auth.checkPermission( session, new 
AllPermission( m_engine.getApplicationName() ) ), "Alice has AllPermission" );
         Assertions.assertTrue( m_auth.checkPermission( session, new 
PagePermission("TestDefaultPage","view") ), "Alice cannot read" );
     }
 
     @Test
-    public void testAdminView2() throws Exception
-    {
+    public void testAdminView2() throws Exception {
         m_engine.saveText( "TestDefaultPage", "Foo [{ALLOW view FooBar}]" );
-
-        final WikiSession session = WikiSessionTest.adminSession(m_engine);
+        final Session session = WikiSessionTest.adminSession(m_engine);
 
         Assertions.assertTrue( m_auth.checkPermission( session, new 
AllPermission( m_engine.getApplicationName() ) ), "Alice has AllPermission" );
         Assertions.assertTrue( m_auth.checkPermission( session, new 
PagePermission("TestDefaultPage","view") ),"Alice cannot read" );
@@ -700,7 +672,7 @@ public class AuthorizationManagerTest
         m_groupMgr = m_engine.getGroupManager();
         m_session = WikiSessionTest.adminSession( m_engine );
 
-        WikiSession s = WikiSessionTest.anonymousSession( m_engine );
+        Session s = WikiSessionTest.anonymousSession( m_engine );
         Assertions.assertFalse( m_auth.checkStaticPermission( s, 
PagePermission.VIEW ), "Anonymous view" );
         Assertions.assertFalse( m_auth.checkStaticPermission( s, 
PagePermission.EDIT ), "Anonymous edit" );
         Assertions.assertFalse( m_auth.checkStaticPermission( s, 
PagePermission.COMMENT ), "Anonymous comment" );
diff --git 
a/jspwiki-main/src/test/java/org/apache/wiki/auth/TestAuthorizer.java 
b/jspwiki-main/src/test/java/org/apache/wiki/auth/TestAuthorizer.java
index 5b272e7..7e1ef75 100644
--- a/jspwiki-main/src/test/java/org/apache/wiki/auth/TestAuthorizer.java
+++ b/jspwiki-main/src/test/java/org/apache/wiki/auth/TestAuthorizer.java
@@ -18,8 +18,8 @@
  */
 package org.apache.wiki.auth;
 
-import org.apache.wiki.WikiSession;
 import org.apache.wiki.api.core.Engine;
+import org.apache.wiki.api.core.Session;
 import org.apache.wiki.auth.authorize.Role;
 import org.apache.wiki.auth.authorize.WebAuthorizer;
 
@@ -47,19 +47,22 @@ public class TestAuthorizer implements WebAuthorizer {
         super();
     }
 
-    @Override public Principal findRole( final String role )
+    @Override
+    public Principal findRole( final String role )
     {
         return null;
     }
 
-    @Override public void initialize( final Engine engine, final Properties 
props ) {
+    @Override
+    public void initialize( final Engine engine, final Properties props ) {
     }
 
     /**
      * Returns an array of Principal objects containing five elements: Role 
"Admin", Role.AUTHENTICATED, Role "IT", Role "Finance" and
      * Role "Engineering."
      */
-    @Override public Principal[] getRoles()
+    @Override
+    public Principal[] getRoles()
     {
         return m_roles;
     }
@@ -67,7 +70,8 @@ public class TestAuthorizer implements WebAuthorizer {
     /**
      * Returns <code>true</code> if the WikiSession's Subject contains a 
particular role principal.
      */
-    @Override public boolean isUserInRole( final WikiSession session, final 
Principal role ) {
+    @Override
+    public boolean isUserInRole( final Session session, final Principal role ) 
{
         if ( session == null || role == null ) {
             return false;
         }
diff --git 
a/jspwiki-main/src/test/java/org/apache/wiki/auth/UserManagerTest.java 
b/jspwiki-main/src/test/java/org/apache/wiki/auth/UserManagerTest.java
index 0cd9264..3473e81 100644
--- a/jspwiki-main/src/test/java/org/apache/wiki/auth/UserManagerTest.java
+++ b/jspwiki-main/src/test/java/org/apache/wiki/auth/UserManagerTest.java
@@ -21,8 +21,8 @@ package org.apache.wiki.auth;
 import org.apache.commons.lang3.ArrayUtils;
 import org.apache.wiki.TestEngine;
 import org.apache.wiki.WikiPage;
-import org.apache.wiki.WikiSession;
 import org.apache.wiki.WikiSessionTest;
+import org.apache.wiki.api.core.Session;
 import org.apache.wiki.auth.authorize.Group;
 import org.apache.wiki.auth.authorize.GroupManager;
 import org.apache.wiki.auth.permissions.PermissionFactory;
@@ -107,7 +107,7 @@ public class UserManagerTest {
         final int oldPageCount = pageManager.getTotalPageCount();
 
         // Setup Step 1: create a new user with random name
-        final WikiSession session = m_engine.guestSession();
+        final Session session = m_engine.guestSession();
         final long now = System.currentTimeMillis();
         final String oldLogin = "TestLogin" + now;
         final String oldName = "Test User " + now;
@@ -151,7 +151,7 @@ public class UserManagerTest {
         Assertions.assertNull( p.getAcl().getEntry( new WikiPrincipal( 
newLogin ) ) );
         Assertions.assertNull( p.getAcl().getEntry( new WikiPrincipal( newName 
) ) );
         Assertions.assertTrue( authManager.checkPermission( session, 
PermissionFactory.getPagePermission( p, "view" ) ), "Test User view page" );
-        final WikiSession bobSession = WikiSessionTest.authenticatedSession( 
m_engine, Users.BOB, Users.BOB_PASS );
+        final Session bobSession = WikiSessionTest.authenticatedSession( 
m_engine, Users.BOB, Users.BOB_PASS );
         Assertions.assertFalse( authManager.checkPermission( bobSession, 
PermissionFactory.getPagePermission( p, "view" ) ), "Bob !view page" );
 
         // Setup Step 4: change the user name in the profile and see what 
happens
@@ -269,7 +269,7 @@ public class UserManagerTest {
         final int oldUserCount = m_db.getWikiNames().length;
 
         // Create a new user with random name
-        final WikiSession session = m_engine.guestSession();
+        final Session session = m_engine.guestSession();
         final String loginName = "TestUser" + String.valueOf( 
System.currentTimeMillis() );
         UserProfile profile = m_db.newProfile();
         profile.setEmail( "[email protected]" );
@@ -296,7 +296,7 @@ public class UserManagerTest {
         final int oldUserCount = m_db.getWikiNames().length;
 
         // Create a new user with random name
-        final WikiSession session = m_engine.guestSession();
+        final Session session = m_engine.guestSession();
         final String loginName = "TestUser" + String.valueOf( 
System.currentTimeMillis() );
         final UserProfile profile = m_db.newProfile();
         profile.setEmail( "[email protected]" );
@@ -347,7 +347,7 @@ public class UserManagerTest {
         final int oldUserCount = m_db.getWikiNames().length;
 
         // Create a new user with random name
-        final WikiSession session = m_engine.guestSession();
+        final Session session = m_engine.guestSession();
         final String loginName = "TestUser" + String.valueOf( 
System.currentTimeMillis() );
         final UserProfile profile = m_db.newProfile();
         profile.setEmail( "[email protected]" );
@@ -392,7 +392,7 @@ public class UserManagerTest {
         final int oldUserCount = m_db.getWikiNames().length;
 
         // Create a new user with random name
-        final WikiSession session = m_engine.guestSession();
+        final Session session = m_engine.guestSession();
         final String loginName = "TestUser" + String.valueOf( 
System.currentTimeMillis() );
         final UserProfile profile = m_db.newProfile();
         profile.setEmail( "[email protected]" );
diff --git 
a/jspwiki-main/src/test/java/org/apache/wiki/auth/acl/AclImplTest.java 
b/jspwiki-main/src/test/java/org/apache/wiki/auth/acl/AclImplTest.java
index 41c2e5a..4a072ea 100644
--- a/jspwiki-main/src/test/java/org/apache/wiki/auth/acl/AclImplTest.java
+++ b/jspwiki-main/src/test/java/org/apache/wiki/auth/acl/AclImplTest.java
@@ -17,19 +17,10 @@
     under the License.
  */
 package org.apache.wiki.auth.acl;
-import java.io.ByteArrayInputStream;
-import java.io.ByteArrayOutputStream;
-import java.io.IOException;
-import java.io.ObjectInputStream;
-import java.io.ObjectOutputStream;
-import java.security.Principal;
-import java.util.HashMap;
-import java.util.Map;
-import java.util.Properties;
 
 import org.apache.wiki.TestEngine;
-import org.apache.wiki.WikiSession;
 import org.apache.wiki.WikiSessionTest;
+import org.apache.wiki.api.core.Session;
 import org.apache.wiki.auth.GroupPrincipal;
 import org.apache.wiki.auth.WikiPrincipal;
 import org.apache.wiki.auth.authorize.Group;
@@ -40,6 +31,16 @@ import org.junit.jupiter.api.Assertions;
 import org.junit.jupiter.api.BeforeEach;
 import org.junit.jupiter.api.Test;
 
+import java.io.ByteArrayInputStream;
+import java.io.ByteArrayOutputStream;
+import java.io.IOException;
+import java.io.ObjectInputStream;
+import java.io.ObjectOutputStream;
+import java.security.Principal;
+import java.util.HashMap;
+import java.util.Map;
+import java.util.Properties;
+
 public class AclImplTest
 {
     private AclImpl m_acl;
@@ -50,7 +51,7 @@ public class AclImplTest
 
     private GroupManager m_groupMgr;
 
-    private WikiSession m_session;
+    private Session m_session;
 
     /**
      * We setup the following rules: Alice = may view Bob = may view, may edit
@@ -61,37 +62,37 @@ public class AclImplTest
     public void setUp() throws Exception
     {
 
-        Properties props = TestEngine.getTestProperties();
-        TestEngine engine  = new TestEngine( props );
+        final Properties props = TestEngine.getTestProperties();
+        final TestEngine engine  = new TestEngine( props );
         m_groupMgr = engine.getGroupManager();
         m_session = WikiSessionTest.adminSession( engine );
 
         m_acl = new AclImpl();
         m_aclGroup = new AclImpl();
-        m_groups = new HashMap<String, Group>();
-        Principal uAlice = new WikiPrincipal( "Alice" );
-        Principal uBob = new WikiPrincipal( "Bob" );
-        Principal uCharlie = new WikiPrincipal( "Charlie" );
-        Principal uDave = new WikiPrincipal( "Dave" );
+        m_groups = new HashMap<>();
+        final Principal uAlice = new WikiPrincipal( "Alice" );
+        final Principal uBob = new WikiPrincipal( "Bob" );
+        final Principal uCharlie = new WikiPrincipal( "Charlie" );
+        final Principal uDave = new WikiPrincipal( "Dave" );
 
         //  Alice can view
-        AclEntry ae = new AclEntryImpl();
+        final AclEntry ae = new AclEntryImpl();
         ae.addPermission( PagePermission.VIEW );
         ae.setPrincipal( uAlice );
 
         //  Charlie can view
-        AclEntry ae2 = new AclEntryImpl();
+        final AclEntry ae2 = new AclEntryImpl();
         ae2.addPermission( PagePermission.VIEW );
         ae2.setPrincipal( uCharlie );
 
         //  Bob can view and edit (and by implication, comment)
-        AclEntry ae3 = new AclEntryImpl();
+        final AclEntry ae3 = new AclEntryImpl();
         ae3.addPermission( PagePermission.VIEW );
         ae3.addPermission( PagePermission.EDIT );
         ae3.setPrincipal( uBob );
 
         // Dave can view and comment
-        AclEntry ae4 = new AclEntryImpl();
+        final AclEntry ae4 = new AclEntryImpl();
         ae4.addPermission( PagePermission.VIEW );
         ae4.addPermission( PagePermission.COMMENT );
         ae4.setPrincipal( uDave );
@@ -103,22 +104,22 @@ public class AclImplTest
         m_acl.addEntry( ae4 );
 
         // Foo group includes Alice and Bob
-        Group foo = m_groupMgr.parseGroup( "FooGroup", "", true );
+        final Group foo = m_groupMgr.parseGroup( "FooGroup", "", true );
         m_groupMgr.setGroup( m_session, foo );
         foo.add( uAlice );
         foo.add( uBob );
-        AclEntry ag1 = new AclEntryImpl();
+        final AclEntry ag1 = new AclEntryImpl();
         ag1.setPrincipal( foo.getPrincipal() );
         ag1.addPermission( PagePermission.EDIT );
         m_aclGroup.addEntry( ag1 );
         m_groups.put( "FooGroup", foo );
 
         // Bar group includes Bob and Charlie
-        Group bar = m_groupMgr.parseGroup( "BarGroup", "", true );
+        final Group bar = m_groupMgr.parseGroup( "BarGroup", "", true );
         m_groupMgr.setGroup( m_session, bar );
         bar.add( uBob );
         bar.add( uCharlie );
-        AclEntry ag2 = new AclEntryImpl();
+        final AclEntry ag2 = new AclEntryImpl();
         ag2.setPrincipal( bar.getPrincipal() );
         ag2.addPermission( PagePermission.VIEW );
         m_aclGroup.addEntry( ag2 );
@@ -132,7 +133,7 @@ public class AclImplTest
         m_groupMgr.removeGroup( "BarGroup" );
     }
 
-    private boolean inArray( Object[] array, Object key )
+    private boolean inArray( final Object[] array, final Object key )
     {
         for( int i = 0; i < array.length; i++ )
         {
@@ -144,14 +145,14 @@ public class AclImplTest
         return false;
     }
 
-    private boolean inGroup( Object[] array, Principal key )
+    private boolean inGroup( final Object[] array, final Principal key )
     {
         for( int i = 0; i < array.length; i++ )
         {
             if ( array[i] instanceof GroupPrincipal )
             {
-                String groupName = ((GroupPrincipal)array[i]).getName();
-                Group group = m_groups.get( groupName );
+                final String groupName = ((GroupPrincipal)array[i]).getName();
+                final Group group = m_groups.get( groupName );
                 if ( group != null && group.isMember( key ) )
                 {
                     return true;
@@ -165,7 +166,7 @@ public class AclImplTest
     public void testAlice()
     {
         // Alice should be able to view but not edit or comment
-        Principal wup = new WikiPrincipal( "Alice" );
+        final Principal wup = new WikiPrincipal( "Alice" );
         Assertions.assertTrue( inArray( m_acl.findPrincipals( 
PagePermission.VIEW ), wup ) );
         Assertions.assertFalse( inArray( m_acl.findPrincipals( 
PagePermission.EDIT ), wup ) );
         Assertions.assertFalse( inArray( m_acl.findPrincipals( 
PagePermission.COMMENT ), wup ) );
@@ -175,7 +176,7 @@ public class AclImplTest
     public void testBob()
     {
         // Bob should be able to view, edit, and comment but not delete
-        Principal wup = new WikiPrincipal( "Bob" );
+        final Principal wup = new WikiPrincipal( "Bob" );
         Assertions.assertTrue( inArray( m_acl.findPrincipals( 
PagePermission.VIEW ), wup ) );
         Assertions.assertTrue( inArray( m_acl.findPrincipals( 
PagePermission.EDIT ), wup ) );
         Assertions.assertTrue( inArray( m_acl.findPrincipals( 
PagePermission.COMMENT ), wup ) );
@@ -186,7 +187,7 @@ public class AclImplTest
     public void testCharlie()
     {
         // Charlie should be able to view, but not edit, comment or delete
-        Principal wup = new WikiPrincipal( "Charlie" );
+        final Principal wup = new WikiPrincipal( "Charlie" );
         Assertions.assertTrue( inArray( m_acl.findPrincipals( 
PagePermission.VIEW ), wup ) );
         Assertions.assertFalse( inArray( m_acl.findPrincipals( 
PagePermission.EDIT ), wup ) );
         Assertions.assertFalse( inArray( m_acl.findPrincipals( 
PagePermission.COMMENT ), wup ) );
@@ -197,7 +198,7 @@ public class AclImplTest
     public void testDave()
     {
         // Dave should be able to view and comment but not edit or delete
-        Principal wup = new WikiPrincipal( "Dave" );
+        final Principal wup = new WikiPrincipal( "Dave" );
         Assertions.assertTrue( inArray( m_acl.findPrincipals( 
PagePermission.VIEW ), wup ) );
         Assertions.assertFalse( inArray( m_acl.findPrincipals( 
PagePermission.EDIT ), wup ) );
         Assertions.assertTrue( inArray( m_acl.findPrincipals( 
PagePermission.COMMENT ), wup ) );
@@ -235,19 +236,19 @@ public class AclImplTest
     @Test
     public void testSerialization() throws IOException, ClassNotFoundException
     {
-        ByteArrayOutputStream out = new ByteArrayOutputStream();
+        final ByteArrayOutputStream out = new ByteArrayOutputStream();
 
-        ObjectOutputStream out2 = new ObjectOutputStream(out);
+        final ObjectOutputStream out2 = new ObjectOutputStream(out);
 
         out2.writeObject( m_acl );
 
         out2.close();
 
-        byte[] stuff = out.toByteArray();
+        final byte[] stuff = out.toByteArray();
 
-        ObjectInputStream in = new ObjectInputStream( new 
ByteArrayInputStream(stuff) );
+        final ObjectInputStream in = new ObjectInputStream( new 
ByteArrayInputStream(stuff) );
 
-        AclImpl newacl = (AclImpl) in.readObject();
+        final AclImpl newacl = (AclImpl) in.readObject();
         Assertions.assertEquals( newacl.toString(), m_acl.toString() );
     }
 
diff --git 
a/jspwiki-main/src/test/java/org/apache/wiki/auth/authorize/GroupManagerTest.java
 
b/jspwiki-main/src/test/java/org/apache/wiki/auth/authorize/GroupManagerTest.java
index 252d01a..25d9dc0 100644
--- 
a/jspwiki-main/src/test/java/org/apache/wiki/auth/authorize/GroupManagerTest.java
+++ 
b/jspwiki-main/src/test/java/org/apache/wiki/auth/authorize/GroupManagerTest.java
@@ -17,10 +17,11 @@
     under the License.
  */
 package org.apache.wiki.auth.authorize;
+
 import org.apache.commons.lang3.ArrayUtils;
 import org.apache.wiki.TestEngine;
-import org.apache.wiki.WikiSession;
 import org.apache.wiki.WikiSessionTest;
+import org.apache.wiki.api.core.Session;
 import org.apache.wiki.api.exceptions.WikiException;
 import org.apache.wiki.auth.GroupPrincipal;
 import org.apache.wiki.auth.NoSuchPrincipalException;
@@ -45,12 +46,12 @@ public class GroupManagerTest
 
     private SecurityEventTrap m_trap = new SecurityEventTrap();
 
-    private WikiSession       m_session;
+    private Session m_session;
 
     @BeforeEach
     public void setUp() throws Exception
     {
-        Properties props = TestEngine.getTestProperties();
+        final Properties props = TestEngine.getTestProperties();
 
         m_engine = new TestEngine( props );
         m_groupMgr = m_engine.getGroupManager();
@@ -63,7 +64,7 @@ public class GroupManagerTest
             m_groupMgr.removeGroup( "Test2" );
             m_groupMgr.removeGroup( "Test3" );
         }
-        catch ( NoSuchPrincipalException e )
+        catch ( final NoSuchPrincipalException e )
         {
             // It's not a problem if we can't find the principals...
         }
@@ -112,7 +113,7 @@ public class GroupManagerTest
     @Test
     public void testGetRoles()
     {
-        Principal[] roles = m_groupMgr.getRoles();
+        final Principal[] roles = m_groupMgr.getRoles();
         Assertions.assertTrue( ArrayUtils.contains( roles, new GroupPrincipal( 
"Test" ) ), "Found Test" );
         Assertions.assertTrue( ArrayUtils.contains( roles, new GroupPrincipal( 
"Test2" ) ), "Found Test2" );
         Assertions.assertTrue( ArrayUtils.contains( roles, new GroupPrincipal( 
"Test3" ) ), "Found Test3" );
@@ -121,10 +122,8 @@ public class GroupManagerTest
     @Test
     public void testGroupMembership() throws Exception
     {
-        WikiSession s;
-
         // Anonymous; should belong to NO groups
-        s = WikiSessionTest.anonymousSession( m_engine );
+        Session s = WikiSessionTest.anonymousSession( m_engine );
         Assertions.assertFalse( m_groupMgr.isUserInRole( s, new 
GroupPrincipal( "Test" ) ) );
         Assertions.assertFalse( m_groupMgr.isUserInRole( s, new 
GroupPrincipal( "Test2" ) ) );
         Assertions.assertFalse( m_groupMgr.isUserInRole( s, new 
GroupPrincipal( "Test3" ) ) );
@@ -181,7 +180,7 @@ public class GroupManagerTest
         {
             m_groupMgr.removeGroup( "Events" );
         }
-        catch ( NoSuchPrincipalException e )
+        catch ( final NoSuchPrincipalException e )
         {
             // It's not a problem if we get here...
         }
@@ -189,14 +188,14 @@ public class GroupManagerTest
 
         Group group = m_groupMgr.parseGroup( "Events", "", true );
         m_groupMgr.setGroup( m_session, group );
-        WikiSecurityEvent event;
+        final WikiSecurityEvent event;
         group = m_groupMgr.getGroup( "Events" );
         group.add( new WikiPrincipal( "Alice" ) );
         group.add( new WikiPrincipal( "Bob" ) );
         group.add( new WikiPrincipal( "Charlie" ) );
 
         // We should see a GROUP_ADD event
-        WikiSecurityEvent[] events = m_trap.events();
+        final WikiSecurityEvent[] events = m_trap.events();
         Assertions.assertEquals( 1, events.length );
         event = events[0];
         Assertions.assertEquals( m_groupMgr, event.getSrc() );
diff --git 
a/jspwiki-main/src/test/java/org/apache/wiki/plugin/IfPluginTest.java 
b/jspwiki-main/src/test/java/org/apache/wiki/plugin/IfPluginTest.java
index 81b9240..1afd5a9 100644
--- a/jspwiki-main/src/test/java/org/apache/wiki/plugin/IfPluginTest.java
+++ b/jspwiki-main/src/test/java/org/apache/wiki/plugin/IfPluginTest.java
@@ -23,6 +23,7 @@ import org.apache.wiki.TestEngine;
 import org.apache.wiki.WikiContext;
 import org.apache.wiki.WikiPage;
 import org.apache.wiki.WikiSession;
+import org.apache.wiki.api.core.Session;
 import org.apache.wiki.api.exceptions.WikiException;
 import org.apache.wiki.auth.Users;
 import org.apache.wiki.pages.PageManager;
@@ -47,15 +48,10 @@ public class IfPluginTest {
      * @return {@link WikiContext} associated to given {@link WikiPage}.
      * @throws WikiException problems while logging in.
      */
-    WikiContext getJanneBasedWikiContextFor( final WikiPage page ) throws 
WikiException
-    {
+    WikiContext getJanneBasedWikiContextFor( final WikiPage page ) throws 
WikiException {
         final MockHttpServletRequest request = testEngine.newHttpRequest();
-        final WikiSession session =  WikiSession.getWikiSession( testEngine, 
request );
-        testEngine.getAuthenticationManager().login( session,
-                                                     request,
-                                                     Users.JANNE,
-                                                     Users.JANNE_PASS );
-
+        final Session session =  WikiSession.getWikiSession( testEngine, 
request );
+        testEngine.getAuthenticationManager().login( session, request, 
Users.JANNE, Users.JANNE_PASS );
         return new WikiContext( testEngine, request, page );
     }
 
@@ -67,9 +63,7 @@ public class IfPluginTest {
     @Test
     public void testIfPluginUserAllowed() throws WikiException
     {
-        final String src = "[{IfPlugin user='Janne Jalkanen'\n" +
-                            "\n" +
-                            "Content visible for Janne Jalkanen}]";
+        final String src = "[{IfPlugin user='Janne Jalkanen'\n\nContent 
visible for Janne Jalkanen}]";
         final String expected = "<p>Content visible for Janne Jalkanen</p>\n";
 
         testEngine.saveText( "Test", src );
@@ -88,9 +82,7 @@ public class IfPluginTest {
     @Test
     public void testIfPluginUserNotAllowed() throws WikiException
     {
-        final String src = "[{IfPlugin user='!Janne Jalkanen'\n" +
-                     "\n" +
-                     "Content NOT visible for Janne Jalkanen}]";
+        final String src = "[{IfPlugin user='!Janne Jalkanen'\n\nContent NOT 
visible for Janne Jalkanen}]";
         final String expected = "\n";
 
         testEngine.saveText( "Test", src );
@@ -108,9 +100,7 @@ public class IfPluginTest {
      */
     @Test
     public void testIfPluginIPAllowed() throws WikiException {
-        final String src = "[{IfPlugin ip='127.0.0.1'\n" +
-                     "\n" +
-                     "Content visible for 127.0.0.1}]";
+        final String src = "[{IfPlugin ip='127.0.0.1'\n\nContent visible for 
127.0.0.1}]";
         final String expected = "<p>Content visible for 127.0.0.1</p>\n";
 
         testEngine.saveText( "Test", src );
@@ -128,9 +118,7 @@ public class IfPluginTest {
      */
     @Test
     public void testIfPluginIPNotAllowed() throws WikiException {
-        final String src = "[{IfPlugin ip='!127.0.0.1'\n" +
-                     "\n" +
-                     "Content NOT visible for 127.0.0.1}]";
+        final String src = "[{IfPlugin ip='!127.0.0.1'\n\nContent NOT visible 
for 127.0.0.1}]";
         final String expected = "\n";
 
         testEngine.saveText( "Test", src );
diff --git 
a/jspwiki-main/src/test/java/org/apache/wiki/workflow/DecisionQueueTest.java 
b/jspwiki-main/src/test/java/org/apache/wiki/workflow/DecisionQueueTest.java
index a19241b..cb34b85 100644
--- a/jspwiki-main/src/test/java/org/apache/wiki/workflow/DecisionQueueTest.java
+++ b/jspwiki-main/src/test/java/org/apache/wiki/workflow/DecisionQueueTest.java
@@ -18,22 +18,19 @@
  */
 package org.apache.wiki.workflow;
 
+import org.apache.wiki.TestEngine;
+import org.apache.wiki.api.core.Session;
+import org.apache.wiki.api.exceptions.WikiException;
+import org.apache.wiki.auth.GroupPrincipal;
+import org.apache.wiki.auth.WikiPrincipal;
+import org.junit.jupiter.api.Assertions;
 import org.junit.jupiter.api.BeforeEach;
-
 import org.junit.jupiter.api.Test;
 
 import java.security.Principal;
 import java.util.Collection;
 import java.util.Properties;
 
-import org.junit.jupiter.api.Assertions;
-
-import org.apache.wiki.TestEngine;
-import org.apache.wiki.WikiSession;
-import org.apache.wiki.api.exceptions.WikiException;
-import org.apache.wiki.auth.GroupPrincipal;
-import org.apache.wiki.auth.WikiPrincipal;
-
 public class DecisionQueueTest
 {
 
@@ -49,15 +46,15 @@ public class DecisionQueueTest
 
     Decision d3;
 
-    WikiSession janneSession;
+    Session janneSession;
 
-    WikiSession adminSession;
+    Session adminSession;
 
     @BeforeEach
     public void setUp() throws Exception
     {
 
-        Properties props = TestEngine.getTestProperties();
+        final Properties props = TestEngine.getTestProperties();
         m_engine = new TestEngine(props);
         m_queue = m_engine.getWorkflowManager().getDecisionQueue();
         adminSession = m_engine.adminSession();
@@ -75,7 +72,7 @@ public class DecisionQueueTest
     @Test
     public void testAdd()
     {
-        Decision[] decisions = m_queue.decisions();
+        final Decision[] decisions = m_queue.decisions();
         Assertions.assertEquals(d1, decisions[0]);
         Assertions.assertEquals(d2, decisions[1]);
         Assertions.assertEquals(d3, decisions[2]);
@@ -142,7 +139,7 @@ public class DecisionQueueTest
     @Test
     public void testDecisions()
     {
-        Decision[] decisions = m_queue.decisions();
+        final Decision[] decisions = m_queue.decisions();
         Assertions.assertEquals(3, decisions.length);
         Assertions.assertEquals(d1, decisions[0]);
         Assertions.assertEquals(d2, decisions[1]);
@@ -162,7 +159,7 @@ public class DecisionQueueTest
     @Test
     public void testDecisionWorkflow() throws WikiException
     {
-        Principal janne = janneSession.getUserPrincipal();
+        final Principal janne = janneSession.getUserPrincipal();
 
         // Clean out the queue first
         m_queue.remove(d1);
@@ -172,9 +169,9 @@ public class DecisionQueueTest
         // Create a workflow with 3 steps, with a Decision for Janne in the 
middle
         w = new Workflow("workflow.key", new WikiPrincipal("Owner1"));
         w.setWorkflowManager(m_engine.getWorkflowManager());
-        Step startTask = new TaskTest.NormalTask(w);
-        Step endTask = new TaskTest.NormalTask(w);
-        Decision decision = new SimpleDecision(w, "decision.Actor1Decision", 
janne);
+        final Step startTask = new TaskTest.NormalTask(w);
+        final Step endTask = new TaskTest.NormalTask(w);
+        final Decision decision = new SimpleDecision(w, 
"decision.Actor1Decision", janne);
         startTask.addSuccessor(Outcome.STEP_COMPLETE, decision);
         decision.addSuccessor(Outcome.DECISION_APPROVE, endTask);
         w.setFirstStep(startTask);
@@ -186,7 +183,7 @@ public class DecisionQueueTest
         // Verify that it's also in Janne's DecisionQueue
         Collection< Decision > decisions = 
m_queue.getActorDecisions(janneSession);
         Assertions.assertEquals(1, decisions.size());
-        Decision d = (Decision)decisions.iterator().next();
+        final Decision d = (Decision)decisions.iterator().next();
         Assertions.assertEquals(decision, d);
 
         // Make Decision, and verify that it's gone from the queue

Reply via email to