You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@jspwiki.apache.org by ju...@apache.org on 2020/12/08 22:13:16 UTC
[jspwiki] 01/02: small refactor on test to not use deprecated code
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 fd3524ed8c142bf75d91beb428f7c0cd18e0b153
Author: juanpablo <ju...@apache.org>
AuthorDate: Tue Dec 8 23:04:18 2020 +0100
small refactor on test to not use deprecated code
---
.../org/apache/wiki/auth/AuthorizationManagerTest.java | 16 +++++++++-------
1 file changed, 9 insertions(+), 7 deletions(-)
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 2f86374..cc73b5e 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,11 +21,12 @@ package org.apache.wiki.auth;
import org.apache.commons.lang3.ArrayUtils;
import org.apache.wiki.TestEngine;
import org.apache.wiki.WikiSessionTest;
+import org.apache.wiki.api.core.Attachment;
import org.apache.wiki.api.core.Page;
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;
+import org.apache.wiki.api.spi.Wiki;
import org.apache.wiki.attachment.AttachmentManager;
import org.apache.wiki.auth.acl.UnresolvedPrincipal;
import org.apache.wiki.auth.authorize.Group;
@@ -86,7 +87,7 @@ public class AuthorizationManagerTest
// Initialize the test engine
m_engine = new TestEngine( props );
m_auth = m_engine.getManager( AuthorizationManager.class );
- m_groupMgr = m_engine.getGroupManager();
+ m_groupMgr = m_engine.getManager( GroupManager.class );
m_session = WikiSessionTest.adminSession( m_engine );
}
@@ -94,7 +95,8 @@ public class AuthorizationManagerTest
* Tests the default policy. Anonymous users can read, Authenticated can
* edit, etc. Uses the default tests/etc/jspwiki.policy file installed by
* the JRE at startup.
- * @throws Exception
+ *
+ * @throws Exception test failed
*/
@Test
public void testDefaultPermissions() throws Exception
@@ -264,7 +266,7 @@ public class AuthorizationManagerTest
m_engine.saveText( "Test", src );
final File f = m_engine.makeAttachmentFile();
- final Attachment att = new Attachment( m_engine, "Test", "test1.txt" );
+ final Attachment att = Wiki.contents().attachment( m_engine, "Test", "test1.txt" );
att.setAuthor( "FirstPost" );
m_engine.getManager( AttachmentManager.class ).storeAttachment( att, f );
@@ -295,7 +297,7 @@ public class AuthorizationManagerTest
m_engine.saveText( "Test", src );
final File f = m_engine.makeAttachmentFile();
- final Attachment att = new Attachment( m_engine, "Test", "test1.txt" );
+ final Attachment att = Wiki.contents().attachment( m_engine, "Test", "test1.txt" );
att.setAuthor( "FirstPost" );
m_engine.getManager( AttachmentManager.class ).storeAttachment( att, f );
@@ -482,7 +484,7 @@ public class AuthorizationManagerTest
// This should not resolve because there's no built-in role Admin
principal = new WikiPrincipal( "Admin" );
- Assertions.assertFalse( principal.equals( m_auth.resolvePrincipal( "Admin" ) ) );
+ Assertions.assertNotEquals( m_auth.resolvePrincipal( "Admin" ), principal );
}
@Test
@@ -670,7 +672,7 @@ public class AuthorizationManagerTest
// Initialize the test engine
m_engine = new TestEngine( props );
m_auth = m_engine.getManager( AuthorizationManager.class );
- m_groupMgr = m_engine.getGroupManager();
+ m_groupMgr = m_engine.getManager( GroupManager.class );
m_session = WikiSessionTest.adminSession( m_engine );
Session s = WikiSessionTest.anonymousSession( m_engine );