You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@jspwiki.apache.org by aj...@apache.org on 2008/02/23 20:46:00 UTC
svn commit: r630521 - in
/incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/tests/com/ecyrd/jspwiki:
attachment/ auth/ auth/acl/ auth/authorize/ auth/login/ diff/ parser/
plugin/ providers/
Author: ajaquith
Date: Sat Feb 23 11:45:56 2008
New Revision: 630521
URL: http://svn.apache.org/viewvc?rev=630521&view=rev
Log:
Initial Stripes component commit.
Added:
incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/tests/com/ecyrd/jspwiki/parser/AndyTest.java
Modified:
incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/tests/com/ecyrd/jspwiki/attachment/AttachmentManagerTest.java
incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/tests/com/ecyrd/jspwiki/auth/GroupManagerTest.java
incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/tests/com/ecyrd/jspwiki/auth/SecurityEventTrap.java
incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/tests/com/ecyrd/jspwiki/auth/acl/AclImplTest.java
incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/tests/com/ecyrd/jspwiki/auth/authorize/JDBCGroupDatabaseTest.java
incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/tests/com/ecyrd/jspwiki/auth/authorize/XMLGroupDatabaseTest.java
incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/tests/com/ecyrd/jspwiki/auth/login/AnonymousLoginModuleTest.java
incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/tests/com/ecyrd/jspwiki/auth/login/CookieAssertionLoginModuleTest.java
incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/tests/com/ecyrd/jspwiki/auth/login/WebContainerLoginModuleTest.java
incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/tests/com/ecyrd/jspwiki/diff/ContextualDiffProviderTest.java
incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/tests/com/ecyrd/jspwiki/parser/JSPWikiMarkupParserTest.java
incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/tests/com/ecyrd/jspwiki/plugin/CounterPluginTest.java
incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/tests/com/ecyrd/jspwiki/plugin/GroupsTest.java
incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/tests/com/ecyrd/jspwiki/plugin/PluginManagerTest.java
incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/tests/com/ecyrd/jspwiki/plugin/ReferringPagesPluginTest.java
incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/tests/com/ecyrd/jspwiki/plugin/UndefinedPagesPluginTest.java
incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/tests/com/ecyrd/jspwiki/providers/RCSFileProviderTest.java
incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/tests/com/ecyrd/jspwiki/providers/VersioningFileProviderTest.java
Modified: incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/tests/com/ecyrd/jspwiki/attachment/AttachmentManagerTest.java
URL: http://svn.apache.org/viewvc/incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/tests/com/ecyrd/jspwiki/attachment/AttachmentManagerTest.java?rev=630521&r1=630520&r2=630521&view=diff
==============================================================================
--- incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/tests/com/ecyrd/jspwiki/attachment/AttachmentManagerTest.java (original)
+++ incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/tests/com/ecyrd/jspwiki/attachment/AttachmentManagerTest.java Sat Feb 23 11:45:56 2008
@@ -76,8 +76,8 @@
m_manager.storeAttachment( att, makeAttachmentFile() );
- Attachment att2 = m_manager.getAttachmentInfo( new WikiContext(m_engine,
- new WikiPage(m_engine, NAME1)),
+ Attachment att2 = m_manager.getAttachmentInfo( m_engine.getWikiActionBeanFactory().newViewActionBean(
+ new WikiPage(m_engine, NAME1)),
"test1.txt" );
assertNotNull( "attachment disappeared", att2 );
@@ -107,8 +107,8 @@
m_manager.storeAttachment( att, makeAttachmentFile() );
- Attachment att2 = m_manager.getAttachmentInfo( new WikiContext(m_engine,
- new WikiPage(m_engine, NAME1)),
+ Attachment att2 = m_manager.getAttachmentInfo( m_engine.getWikiActionBeanFactory().newViewActionBean(
+ new WikiPage(m_engine, NAME1)),
"test file.txt" );
assertNotNull( "attachment disappeared", att2 );
@@ -138,8 +138,8 @@
m_manager.storeAttachment( att, makeAttachmentFile() );
- Attachment att2 = m_manager.getAttachmentInfo( new WikiContext(m_engine,
- new WikiPage(m_engine, NAME1)),
+ Attachment att2 = m_manager.getAttachmentInfo( m_engine.getWikiActionBeanFactory().newViewActionBean(
+ new WikiPage(m_engine, NAME1)),
"test1.txt", 1 );
assertNotNull( "attachment disappeared", att2 );
@@ -173,8 +173,8 @@
att.setAuthor( "FooBar" );
m_manager.storeAttachment( att, makeAttachmentFile() );
- Attachment att2 = m_manager.getAttachmentInfo( new WikiContext(m_engine,
- new WikiPage(m_engine, NAME1)),
+ Attachment att2 = m_manager.getAttachmentInfo( m_engine.getWikiActionBeanFactory().newViewActionBean(
+ new WikiPage(m_engine, NAME1)),
"test1.txt" );
assertNotNull( "attachment disappeared", att2 );
@@ -199,8 +199,8 @@
// Check that first author did not disappear
//
- Attachment att3 = m_manager.getAttachmentInfo( new WikiContext(m_engine,
- new WikiPage(m_engine, NAME1)),
+ Attachment att3 = m_manager.getAttachmentInfo( m_engine.getWikiActionBeanFactory().newViewActionBean(
+ new WikiPage(m_engine, NAME1)),
"test1.txt",
1 );
assertEquals( "version of v1", 1, att3.getVersion() );
@@ -234,8 +234,8 @@
m_manager.storeAttachment( att, makeAttachmentFile() );
- Attachment att2 = m_manager.getAttachmentInfo( new WikiContext(m_engine,
- new WikiPage(m_engine, NAME1)),
+ Attachment att2 = m_manager.getAttachmentInfo( m_engine.getWikiActionBeanFactory().newViewActionBean(
+ new WikiPage(m_engine, NAME1)),
"test1" );
assertNotNull( "attachment disappeared", att2 );
Modified: incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/tests/com/ecyrd/jspwiki/auth/GroupManagerTest.java
URL: http://svn.apache.org/viewvc/incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/tests/com/ecyrd/jspwiki/auth/GroupManagerTest.java?rev=630521&r1=630520&r2=630521&view=diff
==============================================================================
--- incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/tests/com/ecyrd/jspwiki/auth/GroupManagerTest.java (original)
+++ incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/tests/com/ecyrd/jspwiki/auth/GroupManagerTest.java Sat Feb 23 11:45:56 2008
@@ -81,12 +81,12 @@
{
String members = "Biff";
Group group = m_groupMgr.parseGroup( "Group1", members, true );
- assertEquals( 1, group.members().length );
+ assertEquals( 1, group.getMembers().size() );
assertTrue ( group.isMember( new WikiPrincipal( "Biff" ) ) );
members = "Biff \n SteveAustin \n FredFlintstone";
group = m_groupMgr.parseGroup( "Group2", members, true );
- assertEquals( 3, group.members().length );
+ assertEquals( 3, group.getMembers().size() );
assertTrue ( group.isMember( new WikiPrincipal( "Biff" ) ) );
assertTrue ( group.isMember( new WikiPrincipal( "SteveAustin" ) ) );
assertTrue ( group.isMember( new WikiPrincipal( "FredFlintstone" ) ) );
Modified: incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/tests/com/ecyrd/jspwiki/auth/SecurityEventTrap.java
URL: http://svn.apache.org/viewvc/incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/tests/com/ecyrd/jspwiki/auth/SecurityEventTrap.java?rev=630521&r1=630520&r2=630521&view=diff
==============================================================================
--- incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/tests/com/ecyrd/jspwiki/auth/SecurityEventTrap.java (original)
+++ incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/tests/com/ecyrd/jspwiki/auth/SecurityEventTrap.java Sat Feb 23 11:45:56 2008
@@ -15,14 +15,14 @@
public class SecurityEventTrap implements WikiEventListener
{
private WikiSecurityEvent m_lastEvent = null;
- private List m_events = new ArrayList();
+ private List<WikiSecurityEvent> m_events = new ArrayList<WikiSecurityEvent>();
public void actionPerformed( WikiEvent event )
{
if ( event instanceof WikiSecurityEvent )
{
m_lastEvent = (WikiSecurityEvent)event;
- m_events.add( event );
+ m_events.add( (WikiSecurityEvent)event );
}
else
{
@@ -42,7 +42,7 @@
public WikiSecurityEvent[] events()
{
- return (WikiSecurityEvent[])m_events.toArray(new WikiSecurityEvent[m_events.size()]);
+ return m_events.toArray(new WikiSecurityEvent[m_events.size()]);
}
}
Modified: incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/tests/com/ecyrd/jspwiki/auth/acl/AclImplTest.java
URL: http://svn.apache.org/viewvc/incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/tests/com/ecyrd/jspwiki/auth/acl/AclImplTest.java?rev=630521&r1=630520&r2=630521&view=diff
==============================================================================
--- incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/tests/com/ecyrd/jspwiki/auth/acl/AclImplTest.java (original)
+++ incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/tests/com/ecyrd/jspwiki/auth/acl/AclImplTest.java Sat Feb 23 11:45:56 2008
@@ -47,7 +47,7 @@
private AclImpl m_aclGroup;
- private Map m_groups;
+ private Map<String,Group> m_groups;
private GroupManager m_groupMgr;
@@ -68,13 +68,13 @@
super.setUp();
Properties props = new Properties();
props.load( TestEngine.findTestProperties() );
- WikiEngine engine = new TestEngine( props );
+ 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();
+ m_groups = new HashMap<String,Group>();
Principal uAlice = new WikiPrincipal( "Alice" );
Principal uBob = new WikiPrincipal( "Bob" );
Principal uCharlie = new WikiPrincipal( "Charlie" );
@@ -156,7 +156,7 @@
if ( array[i] instanceof GroupPrincipal )
{
String groupName = ((GroupPrincipal)array[i]).getName();
- Group group = (Group)m_groups.get( groupName );
+ Group group = m_groups.get( groupName );
if ( group != null && group.isMember( key ) )
{
return true;
Modified: incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/tests/com/ecyrd/jspwiki/auth/authorize/JDBCGroupDatabaseTest.java
URL: http://svn.apache.org/viewvc/incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/tests/com/ecyrd/jspwiki/auth/authorize/JDBCGroupDatabaseTest.java?rev=630521&r1=630520&r2=630521&view=diff
==============================================================================
--- incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/tests/com/ecyrd/jspwiki/auth/authorize/JDBCGroupDatabaseTest.java (original)
+++ incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/tests/com/ecyrd/jspwiki/auth/authorize/JDBCGroupDatabaseTest.java Sat Feb 23 11:45:56 2008
@@ -4,6 +4,7 @@
import java.security.Principal;
import java.sql.Connection;
import java.sql.SQLException;
+import java.util.List;
import java.util.Properties;
import javax.naming.Context;
@@ -111,23 +112,23 @@
// Group TV has 3 members
group = backendGroup( "TV" );
assertEquals("TV", group.getName() );
- assertEquals( 3, group.members().length );
+ assertEquals( 3, group.getMembers().size() );
// Group Literature has 2 members
group = backendGroup( "Literature" );
assertEquals("Literature", group.getName() );
- assertEquals( 2, group.members().length );
+ assertEquals( 2, group.getMembers().size() );
// Group Art has no members
group = backendGroup( "Art" );
assertEquals("Art", group.getName() );
- assertEquals( 0, group.members().length );
+ assertEquals( 0, group.getMembers().size() );
// Group Admin has 1 member (Administrator)
group = backendGroup( "Admin" );
assertEquals("Admin", group.getName() );
- assertEquals( 1, group.members().length );
- assertEquals( "Administrator", group.members()[0].getName() );
+ assertEquals( 1, group.getMembers().size() );
+ assertEquals( "Administrator", group.getMembers().get(0).getName() );
// Group Archaeology doesn't exist
try
@@ -158,7 +159,7 @@
// Make sure the profile saved successfully
group = backendGroup( name );
assertEquals( name, group.getName() );
- assertEquals( 3, group.members().length );
+ assertEquals( 3, group.getMembers().size() );
assertTrue( group.isMember( new WikiPrincipal( "Al" ) ) );
assertTrue( group.isMember( new WikiPrincipal( "Bob" ) ) );
assertTrue( group.isMember( new WikiPrincipal( "Cookie" ) ) );
@@ -200,8 +201,8 @@
m_db.save(group, new WikiPrincipal( "SecondTester" ) );
// We should see 4 members and new timestamp info
- Principal[] members = group.members();
- assertEquals( 4, members.length );
+ List<Principal> members = group.getMembers();
+ assertEquals( 4, members.size() );
assertNotNull( group.getCreator() );
assertEquals( "Tester", group.getCreator() );
assertNotNull( group.getCreated() );
@@ -211,8 +212,8 @@
// Check the back-end; We should see the same thing
group = backendGroup( name );
- members = group.members();
- assertEquals( 4, members.length );
+ members = group.getMembers();
+ assertEquals( 4, members.size() );
assertNotNull( group.getCreator() );
assertEquals( "Tester", group.getCreator() );
assertNotNull( group.getCreated() );
Modified: incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/tests/com/ecyrd/jspwiki/auth/authorize/XMLGroupDatabaseTest.java
URL: http://svn.apache.org/viewvc/incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/tests/com/ecyrd/jspwiki/auth/authorize/XMLGroupDatabaseTest.java?rev=630521&r1=630520&r2=630521&view=diff
==============================================================================
--- incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/tests/com/ecyrd/jspwiki/auth/authorize/XMLGroupDatabaseTest.java (original)
+++ incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/tests/com/ecyrd/jspwiki/auth/authorize/XMLGroupDatabaseTest.java Sat Feb 23 11:45:56 2008
@@ -1,5 +1,6 @@
package com.ecyrd.jspwiki.auth.authorize;
import java.security.Principal;
+import java.util.List;
import java.util.Properties;
import junit.framework.TestCase;
@@ -72,23 +73,23 @@
// Group TV has 3 members
group = backendGroup( "TV" );
assertEquals("TV", group.getName() );
- assertEquals( 3, group.members().length );
+ assertEquals( 3, group.getMembers().size() );
// Group Literature has 2 members
group = backendGroup( "Literature" );
assertEquals("Literature", group.getName() );
- assertEquals( 2, group.members().length );
+ assertEquals( 2, group.getMembers().size() );
// Group Art has no members
group = backendGroup( "Art" );
assertEquals("Art", group.getName() );
- assertEquals( 0, group.members().length );
+ assertEquals( 0, group.getMembers().size() );
// Group Admin has 1 member (Administrator)
group = backendGroup( "Admin" );
assertEquals("Admin", group.getName() );
- assertEquals( 1, group.members().length );
- assertEquals( "Administrator", group.members()[0].getName() );
+ assertEquals( 1, group.getMembers().size() );
+ assertEquals( "Administrator", group.getMembers().get(0).getName() );
// Group Archaeology doesn't exist
try
@@ -119,7 +120,7 @@
// Make sure the profile saved successfully
group = backendGroup( name );
assertEquals( name, group.getName() );
- assertEquals( 3, group.members().length );
+ assertEquals( 3, group.getMembers().size() );
assertTrue( group.isMember( new WikiPrincipal( "Al" ) ) );
assertTrue( group.isMember( new WikiPrincipal( "Bob" ) ) );
assertTrue( group.isMember( new WikiPrincipal( "Cookie" ) ) );
@@ -161,8 +162,8 @@
m_db.save(group, new WikiPrincipal( "SecondTester" ) );
// We should see 4 members and new timestamp info
- Principal[] members = group.members();
- assertEquals( 4, members.length );
+ List<Principal> members = group.getMembers();
+ assertEquals( 4, members.size() );
assertNotNull( group.getCreator() );
assertEquals( "Tester", group.getCreator() );
assertNotNull( group.getCreated() );
@@ -172,8 +173,8 @@
// Check the back-end; We should see the same thing
group = backendGroup( name );
- members = group.members();
- assertEquals( 4, members.length );
+ members = group.getMembers();
+ assertEquals( 4, members.size() );
assertNotNull( group.getCreator() );
assertEquals( "Tester", group.getCreator() );
assertNotNull( group.getCreated() );
Modified: incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/tests/com/ecyrd/jspwiki/auth/login/AnonymousLoginModuleTest.java
URL: http://svn.apache.org/viewvc/incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/tests/com/ecyrd/jspwiki/auth/login/AnonymousLoginModuleTest.java?rev=630521&r1=630520&r2=630521&view=diff
==============================================================================
--- incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/tests/com/ecyrd/jspwiki/auth/login/AnonymousLoginModuleTest.java (original)
+++ incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/tests/com/ecyrd/jspwiki/auth/login/AnonymousLoginModuleTest.java Sat Feb 23 11:45:56 2008
@@ -9,12 +9,12 @@
import javax.security.auth.login.LoginException;
import junit.framework.TestCase;
+import net.sourceforge.stripes.mock.MockHttpServletRequest;
import com.ecyrd.jspwiki.NoRequiredPropertyException;
import com.ecyrd.jspwiki.TestAuthorizer;
import com.ecyrd.jspwiki.TestEngine;
-import com.ecyrd.jspwiki.TestHttpServletRequest;
-import com.ecyrd.jspwiki.WikiEngine;
+import com.ecyrd.jspwiki.action.ViewActionBean;
import com.ecyrd.jspwiki.auth.Authorizer;
import com.ecyrd.jspwiki.auth.WikiPrincipal;
import com.ecyrd.jspwiki.auth.authorize.Role;
@@ -32,12 +32,11 @@
Subject subject;
- private WikiEngine m_engine;
+ private TestEngine m_engine;
public final void testLogin()
{
- TestHttpServletRequest request = new TestHttpServletRequest();
- request.setRemoteAddr( "53.33.128.9" );
+ MockHttpServletRequest request = m_engine.guestTrip( ViewActionBean.class ).getRequest();
try
{
// Test using IP address (AnonymousLoginModule succeeds)
@@ -46,7 +45,7 @@
context.login();
Set principals = subject.getPrincipals();
assertEquals( 3, principals.size() );
- assertTrue( principals.contains( new WikiPrincipal( "53.33.128.9" ) ) );
+ assertTrue( principals.contains( new WikiPrincipal( "127.0.0.1" ) ) );
assertTrue( principals.contains( Role.ANONYMOUS ) );
assertTrue( principals.contains( Role.ALL ) );
}
@@ -59,8 +58,7 @@
public final void testLogout()
{
- TestHttpServletRequest request = new TestHttpServletRequest();
- request.setRemoteAddr( "53.33.128.9" );
+ MockHttpServletRequest request = m_engine.guestTrip( ViewActionBean.class ).getRequest();
try
{
CallbackHandler handler = new WebContainerCallbackHandler( m_engine, request, authorizer );
@@ -68,7 +66,7 @@
context.login();
Set principals = subject.getPrincipals();
assertEquals( 3, principals.size() );
- assertTrue( principals.contains( new WikiPrincipal( "53.33.128.9" ) ) );
+ assertTrue( principals.contains( new WikiPrincipal( "127.0.0.1" ) ) );
assertTrue( principals.contains( Role.ANONYMOUS ) );
assertTrue( principals.contains( Role.ALL ) );
context.logout();
Modified: incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/tests/com/ecyrd/jspwiki/auth/login/CookieAssertionLoginModuleTest.java
URL: http://svn.apache.org/viewvc/incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/tests/com/ecyrd/jspwiki/auth/login/CookieAssertionLoginModuleTest.java?rev=630521&r1=630520&r2=630521&view=diff
==============================================================================
--- incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/tests/com/ecyrd/jspwiki/auth/login/CookieAssertionLoginModuleTest.java (original)
+++ incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/tests/com/ecyrd/jspwiki/auth/login/CookieAssertionLoginModuleTest.java Sat Feb 23 11:45:56 2008
@@ -10,12 +10,12 @@
import javax.servlet.http.Cookie;
import junit.framework.TestCase;
+import net.sourceforge.stripes.mock.MockHttpServletRequest;
import com.ecyrd.jspwiki.NoRequiredPropertyException;
import com.ecyrd.jspwiki.TestAuthorizer;
import com.ecyrd.jspwiki.TestEngine;
-import com.ecyrd.jspwiki.TestHttpServletRequest;
-import com.ecyrd.jspwiki.WikiEngine;
+import com.ecyrd.jspwiki.action.ViewActionBean;
import com.ecyrd.jspwiki.auth.AuthenticationManager;
import com.ecyrd.jspwiki.auth.Authorizer;
import com.ecyrd.jspwiki.auth.WikiPrincipal;
@@ -34,12 +34,11 @@
Subject subject;
- private WikiEngine m_engine;
+ private TestEngine m_engine;
public final void testLogin()
{
- TestHttpServletRequest request = new TestHttpServletRequest();
- request.setRemoteAddr( "53.33.128.9" );
+ MockHttpServletRequest request = m_engine.guestTrip( ViewActionBean.class ).getRequest();
try
{
// We can use cookies right?
@@ -68,8 +67,7 @@
public final void testLogout()
{
- TestHttpServletRequest request = new TestHttpServletRequest();
- request.setRemoteAddr( "53.33.128.9" );
+ MockHttpServletRequest request = m_engine.guestTrip( ViewActionBean.class ).getRequest();
try
{
CallbackHandler handler = new WebContainerCallbackHandler( m_engine, request, authorizer );
@@ -77,7 +75,7 @@
context.login();
Set principals = subject.getPrincipals();
assertEquals( 3, principals.size() );
- assertTrue( principals.contains( new WikiPrincipal( "53.33.128.9" ) ) );
+ assertTrue( principals.contains( new WikiPrincipal( "127.0.0.1" ) ) ); // Stripes mock requests always return this
assertTrue( principals.contains( Role.ANONYMOUS ) );
assertTrue( principals.contains( Role.ALL ) );
context.logout();
Modified: incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/tests/com/ecyrd/jspwiki/auth/login/WebContainerLoginModuleTest.java
URL: http://svn.apache.org/viewvc/incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/tests/com/ecyrd/jspwiki/auth/login/WebContainerLoginModuleTest.java?rev=630521&r1=630520&r2=630521&view=diff
==============================================================================
--- incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/tests/com/ecyrd/jspwiki/auth/login/WebContainerLoginModuleTest.java (original)
+++ incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/tests/com/ecyrd/jspwiki/auth/login/WebContainerLoginModuleTest.java Sat Feb 23 11:45:56 2008
@@ -1,6 +1,7 @@
package com.ecyrd.jspwiki.auth.login;
import java.security.Principal;
+import java.util.HashSet;
import java.util.Properties;
import java.util.Set;
@@ -10,12 +11,12 @@
import javax.security.auth.login.LoginException;
import junit.framework.TestCase;
+import net.sourceforge.stripes.mock.MockHttpServletRequest;
import com.ecyrd.jspwiki.NoRequiredPropertyException;
import com.ecyrd.jspwiki.TestAuthorizer;
import com.ecyrd.jspwiki.TestEngine;
-import com.ecyrd.jspwiki.TestHttpServletRequest;
-import com.ecyrd.jspwiki.WikiEngine;
+import com.ecyrd.jspwiki.action.ViewActionBean;
import com.ecyrd.jspwiki.auth.Authorizer;
import com.ecyrd.jspwiki.auth.WikiPrincipal;
import com.ecyrd.jspwiki.auth.authorize.Role;
@@ -33,13 +34,13 @@
Subject subject;
- private WikiEngine m_engine;
+ private TestEngine m_engine;
public final void testLogin()
{
Principal principal = new WikiPrincipal( "Andrew Jaquith" );
Principal wrapper = new PrincipalWrapper( principal );
- TestHttpServletRequest request = new TestHttpServletRequest();
+ MockHttpServletRequest request = m_engine.guestTrip( ViewActionBean.class ).getRequest();
request.setUserPrincipal( principal );
try
{
@@ -57,8 +58,8 @@
// Test using remote user (WebContainerLoginModule succeeds)
subject = new Subject();
- request = new TestHttpServletRequest();
- request.setRemoteUser( "Andrew Jaquith" );
+ request = m_engine.guestTrip( ViewActionBean.class ).getRequest();
+ request.setUserPrincipal( new WikiPrincipal( "Andrew Jaquith" ) );
handler = new WebContainerCallbackHandler( m_engine, request, authorizer );
context = new LoginContext( "JSPWiki-container", subject, handler );
context.login();
@@ -72,8 +73,7 @@
// Test using IP address (AnonymousLoginModule succeeds)
subject = new Subject();
- request = new TestHttpServletRequest();
- request.setRemoteAddr( "53.33.128.9" );
+ request = m_engine.guestTrip( ViewActionBean.class ).getRequest();
handler = new WebContainerCallbackHandler( m_engine, request, authorizer );
context = new LoginContext( "JSPWiki-container", subject, handler );
context.login();
@@ -97,9 +97,12 @@
// Create user with 2 container roles; TestAuthorizer knows about these
Principal principal = new WikiPrincipal( "Andrew Jaquith" );
Principal wrapper = new PrincipalWrapper( principal );
- TestHttpServletRequest request = new TestHttpServletRequest();
+ MockHttpServletRequest request = m_engine.guestTrip( ViewActionBean.class ).getRequest();
request.setUserPrincipal( principal );
- request.setRoles( new String[] { "IT", "Engineering" } );
+ Set<String> roles = new HashSet<String>();
+ roles.add( "IT" );
+ roles.add( "Engineering" );
+ request.setRoles( roles );
// Test using Principal (WebContainerLoginModule succeeds)
CallbackHandler handler = new WebContainerCallbackHandler( m_engine, request, authorizer );
@@ -120,7 +123,7 @@
{
Principal principal = new WikiPrincipal( "Andrew Jaquith" );
Principal wrapper = new PrincipalWrapper( principal );
- TestHttpServletRequest request = new TestHttpServletRequest();
+ MockHttpServletRequest request = m_engine.guestTrip( ViewActionBean.class ).getRequest();
request.setUserPrincipal( principal );
try
{
Modified: incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/tests/com/ecyrd/jspwiki/diff/ContextualDiffProviderTest.java
URL: http://svn.apache.org/viewvc/incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/tests/com/ecyrd/jspwiki/diff/ContextualDiffProviderTest.java?rev=630521&r1=630520&r2=630521&view=diff
==============================================================================
--- incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/tests/com/ecyrd/jspwiki/diff/ContextualDiffProviderTest.java (original)
+++ incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/tests/com/ecyrd/jspwiki/diff/ContextualDiffProviderTest.java Sat Feb 23 11:45:56 2008
@@ -182,7 +182,7 @@
PropertyConfigurator.configure(props);
TestEngine engine = new TestEngine(props);
- WikiContext ctx = new WikiContext( engine, new WikiPage(engine,"Dummy") );
+ WikiContext ctx = engine.getWikiActionBeanFactory().newViewActionBean( new WikiPage(engine,"Dummy") );
String actualDiff = diff.makeDiffHtml( ctx, oldText, newText);
assertEquals(expectedDiff, actualDiff);
Added: incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/tests/com/ecyrd/jspwiki/parser/AndyTest.java
URL: http://svn.apache.org/viewvc/incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/tests/com/ecyrd/jspwiki/parser/AndyTest.java?rev=630521&view=auto
==============================================================================
--- incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/tests/com/ecyrd/jspwiki/parser/AndyTest.java (added)
+++ incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/tests/com/ecyrd/jspwiki/parser/AndyTest.java Sat Feb 23 11:45:56 2008
@@ -0,0 +1,269 @@
+package com.ecyrd.jspwiki.parser;
+
+import java.io.BufferedReader;
+import java.io.File;
+import java.io.IOException;
+import java.io.StringReader;
+import java.util.Collection;
+import java.util.Iterator;
+import java.util.Properties;
+import java.util.Vector;
+
+import javax.servlet.ServletException;
+
+import junit.framework.Test;
+import junit.framework.TestCase;
+import junit.framework.TestSuite;
+import stress.Benchmark;
+
+import com.ecyrd.jspwiki.*;
+import com.ecyrd.jspwiki.attachment.Attachment;
+import com.ecyrd.jspwiki.providers.BasicAttachmentProvider;
+import com.ecyrd.jspwiki.render.XHTMLRenderer;
+
+public class AndyTest extends TestCase
+{
+ // This is a random find: the following page text caused an eternal loop in V2.0.x.
+ private static final String brokenPageText =
+ "Please ''check [RecentChanges].\n" +
+ "\n" +
+ "Testing. fewfwefe\n" +
+ "\n" +
+ "CHeck [testpage]\n" +
+ "\n" +
+ "More testing.\n" +
+ "dsadsadsa''\n" +
+ "Is this {{truetype}} or not?\n" +
+ "What about {{{This}}}?\n" +
+ "How about {{this?\n" +
+ "\n" +
+ "{{{\n" +
+ "{{text}}\n" +
+ "}}}\n" +
+ "goo\n" +
+ "\n" +
+ "<b>Not bold</b>\n" +
+ "\n" +
+ "motto\n" +
+ "\n" +
+ "* This is a list which we\n" +
+ "shall continue on a other line.\n" +
+ "* There is a list item here.\n" +
+ "* Another item.\n" +
+ "* More stuff, which continues\n" +
+ "on a second line. And on\n" +
+ "a third line as well.\n" +
+ "And a fourth line.\n" +
+ "* Third item.\n" +
+ "\n" +
+ "Foobar.\n" +
+ "\n" +
+ "----\n" +
+ "\n" +
+ "!!!Really big heading\n" +
+ "Text.\n" +
+ "!! Just a normal heading [with a hyperlink|Main]\n" +
+ "More text.\n" +
+ "!Just a small heading.\n" +
+ "\n" +
+ "This should be __bold__ text.\n" +
+ "\n" +
+ "__more bold text continuing\n" +
+ "on the next line.__\n" +
+ "\n" +
+ "__more bold text continuing\n" +
+ "\n" +
+ "on the next paragraph.__\n" +
+ "\n" +
+ "\n" +
+ "This should be normal.\n" +
+ "\n" +
+ "Now, let's try ''italic text''.\n" +
+ "\n" +
+ "Bulleted lists:\n" +
+ "* One\n" +
+ "Or more.\n" +
+ "* Two\n" +
+ "\n" +
+ "** Two.One\n" +
+ "\n" +
+ "*** Two.One.One\n" +
+ "\n" +
+ "* Three\n" +
+ "\n" +
+ "Numbered lists.\n" +
+ "# One\n" +
+ "# Two\n" +
+ "# Three\n" +
+ "## Three.One\n" +
+ "## Three.Two\n" +
+ "## Three.Three\n" +
+ "### Three.Three.One\n" +
+ "# Four\n" +
+ "\n" +
+ "End?\n" +
+ "\n" +
+ "No, let's {{break}} things.\\ {{{ {{{ {{text}} }}} }}}\n" +
+ "\n" +
+ "More breaking.\n" +
+ "\n" +
+ "{{{\n" +
+ "code.}}\n" +
+ "----\n" +
+ "author: [Asser], [Ebu], [JanneJalkanen], [Jarmo|mailto:jarmo@regex.com.au]\n";
+ static final String PAGE_NAME = "testpage";
+
+ public static void main( String[] argv )
+ {
+ if( argv.length > 0 )
+ junit.textui.TestRunner.run(suiteSingle(argv[0]));
+ else
+ junit.textui.TestRunner.run(suite());
+ }
+
+ public static Test suite()
+ {
+ return new TestSuite( AndyTest.class );
+ }
+
+
+ public static Test suiteSingle( String test )
+ {
+ return new TestSuite( AndyTest.class, test );
+ }
+
+ Properties props = new Properties();
+
+ Vector created = new Vector();
+
+ TestEngine testEngine;
+
+ public AndyTest( String s )
+ {
+ super( s );
+ }
+
+ public void setUp()
+ throws Exception
+ {
+ props.load( TestEngine.findTestProperties() );
+
+ props.setProperty( "jspwiki.translatorReader.matchEnglishPlurals", "true" );
+ testEngine = new TestEngine( props );
+ }
+
+ public void tearDown()
+ {
+ deleteCreatedPages();
+ }
+
+
+ public void testAttachmentLink()
+ throws Exception
+ {
+ newPage("Test");
+
+ Attachment att = new Attachment( testEngine, "Test", "TestAtt.txt" );
+ att.setAuthor( "FirstPost" );
+ testEngine.getAttachmentManager().storeAttachment( att, testEngine.makeAttachmentFile() );
+
+ String src = "This should be an [attachment link|Test/TestAtt.txt]";
+
+ String dest = translate(src);
+
+ assertEquals( "This should be an <a class=\"attachment\" href=\"/attach/Test/TestAtt.txt\">attachment link</a>"+
+ "<a href=\"/PageInfo.jsp?page=Test/TestAtt.txt\"><img src=\"/images/attachment_small.png\" border=\"0\" alt=\"(info)\" /></a>",
+ dest );
+ }
+
+ public void testHyperlinks2()
+ throws Exception
+ {
+ newPage("Hyperlink");
+
+ String src = "This should be a [hyperlink]";
+
+ assertEquals( "This should be a <a class=\"wikipage\" href=\"/Wiki.jsp?page=Hyperlink\">hyperlink</a>",
+ translate(src) );
+ }
+
+ private void deleteCreatedPages()
+ {
+ for( Iterator i = created.iterator(); i.hasNext(); )
+ {
+ String name = (String) i.next();
+
+ TestEngine.deleteTestPage(name);
+ testEngine.deleteAttachments(name);
+ }
+
+ created.clear();
+ }
+
+ private void newPage( String name )
+ throws WikiException
+ {
+ testEngine.saveText( name, "<test>" );
+
+ created.addElement( name );
+ }
+
+ private String translate( String src )
+ throws IOException,
+ NoRequiredPropertyException,
+ ServletException
+ {
+ return translate( new WikiPage(testEngine, PAGE_NAME), src );
+ }
+
+ private String translate( WikiEngine e, String src )
+ throws IOException,
+ NoRequiredPropertyException,
+ ServletException
+ {
+ return translate( e, new WikiPage(testEngine, PAGE_NAME), src );
+ }
+
+ private String translate( WikiEngine e, WikiPage p, String src )
+ throws IOException,
+ NoRequiredPropertyException,
+ ServletException
+ {
+ WikiContext context = e.getWikiActionBeanFactory().newViewActionBean( p );
+ JSPWikiMarkupParser tr = new JSPWikiMarkupParser( context,
+ new BufferedReader( new StringReader(src)) );
+
+ XHTMLRenderer conv = new XHTMLRenderer( context, tr.parse() );
+
+ return conv.getString();
+ }
+
+ private String translate( WikiPage p, String src )
+ throws IOException,
+ NoRequiredPropertyException,
+ ServletException
+ {
+ return translate( testEngine, p, src );
+ }
+ private String translate_nofollow( String src )
+ throws IOException,
+ NoRequiredPropertyException,
+ ServletException,
+ WikiException
+ {
+ props.load( TestEngine.findTestProperties() );
+
+ props.setProperty( "jspwiki.translatorReader.useRelNofollow", "true" );
+ TestEngine testEngine2 = new TestEngine( props );
+
+ WikiContext context = testEngine2.getWikiActionBeanFactory().newViewActionBean(
+ new WikiPage(testEngine2, PAGE_NAME) );
+ JSPWikiMarkupParser r = new JSPWikiMarkupParser( context,
+ new BufferedReader( new StringReader(src)) );
+
+ XHTMLRenderer conv = new XHTMLRenderer( context, r.parse() );
+
+ return conv.getString();
+ }
+}
+
Modified: incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/tests/com/ecyrd/jspwiki/parser/JSPWikiMarkupParserTest.java
URL: http://svn.apache.org/viewvc/incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/tests/com/ecyrd/jspwiki/parser/JSPWikiMarkupParserTest.java?rev=630521&r1=630520&r2=630521&view=diff
==============================================================================
--- incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/tests/com/ecyrd/jspwiki/parser/JSPWikiMarkupParserTest.java (original)
+++ incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/tests/com/ecyrd/jspwiki/parser/JSPWikiMarkupParserTest.java Sat Feb 23 11:45:56 2008
@@ -101,8 +101,8 @@
NoRequiredPropertyException,
ServletException
{
- WikiContext context = new WikiContext( e, p );
- JSPWikiMarkupParser tr = new JSPWikiMarkupParser( context,
+ WikiContext context = e.getWikiActionBeanFactory().newViewActionBean( p );
+ JSPWikiMarkupParser tr = new JSPWikiMarkupParser( context,
new BufferedReader( new StringReader(src)) );
XHTMLRenderer conv = new XHTMLRenderer( context, tr.parse() );
@@ -121,7 +121,7 @@
props.setProperty( "jspwiki.translatorReader.useRelNofollow", "true" );
TestEngine testEngine2 = new TestEngine( props );
- WikiContext context = new WikiContext( testEngine2,
+ WikiContext context = testEngine2.getWikiActionBeanFactory().newViewActionBean(
new WikiPage(testEngine2, PAGE_NAME) );
JSPWikiMarkupParser r = new JSPWikiMarkupParser( context,
new BufferedReader( new StringReader(src)) );
@@ -539,7 +539,7 @@
String src = "Onko t\u00e4m\u00e4 hyperlinkki: \u00c4itiSy\u00f6\u00d6ljy\u00e4?";
- assertEquals( "Onko t\u00e4m\u00e4 hyperlinkki: <a class=\"wikipage\" href=\"/Wiki.jsp?page=%C4itiSy%F6%D6ljy%E4\">\u00c4itiSy\u00f6\u00d6ljy\u00e4</a>?",
+ assertEquals( "Onko t\u00e4m\u00e4 hyperlinkki: <a class=\"wikipage\" href=\"/Wiki.jsp?page=%C3%84itiSy%C3%B6%C3%96ljy%C3%A4\">\u00c4itiSy\u00f6\u00d6ljy\u00e4</a>?",
translate(src) );
}
@@ -889,7 +889,7 @@
newPage("\u00C5\u00E4Test"); // FIXME: Should be capital
- assertEquals("Link <a class=\"wikipage\" href=\"/Wiki.jsp?page=%C5%E4Test\">\u00c5\u00e4Test</a>",
+ assertEquals("Link <a class=\"wikipage\" href=\"/Wiki.jsp?page=%C3%85%C3%A4Test\">\u00c5\u00e4Test</a>",
translate(src));
}
@@ -2115,7 +2115,7 @@
{
LinkCollector coll = new LinkCollector();
String src = "[Test]";
- WikiContext context = new WikiContext( testEngine,
+ WikiContext context = testEngine.getWikiActionBeanFactory().newViewActionBean(
new WikiPage(testEngine,PAGE_NAME) );
MarkupParser p = new JSPWikiMarkupParser( context,
@@ -2138,7 +2138,7 @@
LinkCollector coll = new LinkCollector();
String src = "["+PAGE_NAME+"/Test.txt]";
- WikiContext context = new WikiContext( testEngine,
+ WikiContext context = testEngine.getWikiActionBeanFactory().newViewActionBean(
new WikiPage(testEngine,PAGE_NAME) );
MarkupParser p = new JSPWikiMarkupParser( context,
@@ -2171,7 +2171,7 @@
LinkCollector coll_others = new LinkCollector();
String src = "[TestAtt.txt]";
- WikiContext context = new WikiContext( testEngine,
+ WikiContext context = testEngine.getWikiActionBeanFactory().newViewActionBean(
new WikiPage(testEngine,PAGE_NAME) );
MarkupParser p = new JSPWikiMarkupParser( context,
Modified: incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/tests/com/ecyrd/jspwiki/plugin/CounterPluginTest.java
URL: http://svn.apache.org/viewvc/incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/tests/com/ecyrd/jspwiki/plugin/CounterPluginTest.java?rev=630521&r1=630520&r2=630521&view=diff
==============================================================================
--- incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/tests/com/ecyrd/jspwiki/plugin/CounterPluginTest.java (original)
+++ incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/tests/com/ecyrd/jspwiki/plugin/CounterPluginTest.java Sat Feb 23 11:45:56 2008
@@ -48,7 +48,7 @@
NoRequiredPropertyException,
ServletException
{
- WikiContext context = new WikiContext( testEngine,
+ WikiContext context = testEngine.getWikiActionBeanFactory().newViewActionBean(
new WikiPage(testEngine, "TestPage") );
MarkupParser p = new JSPWikiMarkupParser( context, new StringReader(src) );
Modified: incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/tests/com/ecyrd/jspwiki/plugin/GroupsTest.java
URL: http://svn.apache.org/viewvc/incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/tests/com/ecyrd/jspwiki/plugin/GroupsTest.java?rev=630521&r1=630520&r2=630521&view=diff
==============================================================================
--- incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/tests/com/ecyrd/jspwiki/plugin/GroupsTest.java (original)
+++ incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/tests/com/ecyrd/jspwiki/plugin/GroupsTest.java Sat Feb 23 11:45:56 2008
@@ -42,10 +42,10 @@
String res = testEngine.getHTML( "Test" );
- assertEquals( "<a href=\"/Group.jsp?group=Admin\">Admin</a>, "
- + "<a href=\"/Group.jsp?group=Art\">Art</a>, "
- + "<a href=\"/Group.jsp?group=Literature\">Literature</a>, "
- + "<a href=\"/Group.jsp?group=TV\">TV</a>\n"
+ assertEquals( "<a href=\"/Group.action?group=Admin\">Admin</a>, "
+ + "<a href=\"/Group.action?group=Art\">Art</a>, "
+ + "<a href=\"/Group.action?group=Literature\">Literature</a>, "
+ + "<a href=\"/Group.action?group=TV\">TV</a>\n"
, res );
}
Modified: incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/tests/com/ecyrd/jspwiki/plugin/PluginManagerTest.java
URL: http://svn.apache.org/viewvc/incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/tests/com/ecyrd/jspwiki/plugin/PluginManagerTest.java?rev=630521&r1=630520&r2=630521&view=diff
==============================================================================
--- incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/tests/com/ecyrd/jspwiki/plugin/PluginManagerTest.java (original)
+++ incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/tests/com/ecyrd/jspwiki/plugin/PluginManagerTest.java Sat Feb 23 11:45:56 2008
@@ -36,7 +36,7 @@
props.load( TestEngine.findTestProperties() );
engine = new TestEngine(props);
- context = new WikiContext( engine, new WikiPage(engine, "Testpage") );
+ context = engine.getWikiActionBeanFactory().newViewActionBean( new WikiPage(engine, "Testpage") );
manager = new PluginManager( engine, props );
}
Modified: incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/tests/com/ecyrd/jspwiki/plugin/ReferringPagesPluginTest.java
URL: http://svn.apache.org/viewvc/incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/tests/com/ecyrd/jspwiki/plugin/ReferringPagesPluginTest.java?rev=630521&r1=630520&r2=630521&view=diff
==============================================================================
--- incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/tests/com/ecyrd/jspwiki/plugin/ReferringPagesPluginTest.java (original)
+++ incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/tests/com/ecyrd/jspwiki/plugin/ReferringPagesPluginTest.java Sat Feb 23 11:45:56 2008
@@ -40,7 +40,7 @@
engine.saveText( "Foobar6", "Reference to [TestPage]." );
engine.saveText( "Foobar7", "Reference to [TestPage]." );
- context = new WikiContext( engine, new WikiPage(engine,"TestPage") );
+ context = engine.getWikiActionBeanFactory().newViewActionBean( new WikiPage(engine,"TestPage") );
manager = new PluginManager( engine, props );
}
@@ -69,7 +69,7 @@
public void testSingleReferral()
throws Exception
{
- WikiContext context2 = new WikiContext( engine, new WikiPage(engine, "Foobar") );
+ WikiContext context2 = engine.getWikiActionBeanFactory().newViewActionBean( new WikiPage(engine, "Foobar") );
String res = manager.execute( context2,
"{INSERT com.ecyrd.jspwiki.plugin.ReferringPagesPlugin WHERE max=5}");
@@ -106,7 +106,7 @@
public void testReferenceWidth()
throws Exception
{
- WikiContext context2 = new WikiContext( engine, new WikiPage(engine, "Foobar") );
+ WikiContext context2 = engine.getWikiActionBeanFactory().newViewActionBean( new WikiPage(engine, "Foobar") );
String res = manager.execute( context2,
"{INSERT com.ecyrd.jspwiki.plugin.ReferringPagesPlugin WHERE maxwidth=5}");
Modified: incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/tests/com/ecyrd/jspwiki/plugin/UndefinedPagesPluginTest.java
URL: http://svn.apache.org/viewvc/incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/tests/com/ecyrd/jspwiki/plugin/UndefinedPagesPluginTest.java?rev=630521&r1=630520&r2=630521&view=diff
==============================================================================
--- incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/tests/com/ecyrd/jspwiki/plugin/UndefinedPagesPluginTest.java (original)
+++ incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/tests/com/ecyrd/jspwiki/plugin/UndefinedPagesPluginTest.java Sat Feb 23 11:45:56 2008
@@ -33,7 +33,7 @@
engine.saveText( "TestPage", "Reference to [Foobar]." );
engine.saveText( "Foobar", "Reference to [Foobar 2], [Foobars]" );
- context = new WikiContext( engine, new WikiPage(engine, "TestPage") );
+ context = engine.getWikiActionBeanFactory().newViewActionBean( new WikiPage(engine, "TestPage") );
manager = new PluginManager( engine, props );
}
@@ -41,6 +41,7 @@
{
TestEngine.deleteTestPage( "TestPage" );
TestEngine.deleteTestPage( "Foobar" );
+ TestEngine.emptyPageDir();
TestEngine.emptyWorkDir();
}
@@ -57,7 +58,7 @@
public void testSimpleUndefined()
throws Exception
{
- WikiContext context2 = new WikiContext( engine, new WikiPage(engine, "Foobar") );
+ WikiContext context2 = engine.getWikiActionBeanFactory().newViewActionBean( new WikiPage(engine, "Foobar") );
String res = manager.execute( context2,
"{INSERT com.ecyrd.jspwiki.plugin.UndefinedPagesPlugin");
Modified: incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/tests/com/ecyrd/jspwiki/providers/RCSFileProviderTest.java
URL: http://svn.apache.org/viewvc/incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/tests/com/ecyrd/jspwiki/providers/RCSFileProviderTest.java?rev=630521&r1=630520&r2=630521&view=diff
==============================================================================
--- incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/tests/com/ecyrd/jspwiki/providers/RCSFileProviderTest.java (original)
+++ incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/tests/com/ecyrd/jspwiki/providers/RCSFileProviderTest.java Sat Feb 23 11:45:56 2008
@@ -201,7 +201,7 @@
{
WikiPage p = new WikiPage( engine, NAME1 );
p.setAttribute(WikiPage.CHANGENOTE, "Test change" );
- WikiContext context = new WikiContext(engine,p);
+ WikiContext context = engine.getWikiActionBeanFactory().newViewActionBean(p);
engine.saveText( context, "test" );
@@ -214,7 +214,7 @@
throws Exception
{
WikiPage p = new WikiPage( engine, NAME1 );
- WikiContext context = new WikiContext(engine,p);
+ WikiContext context = engine.getWikiActionBeanFactory().newViewActionBean(p);
context.getPage().setAttribute(WikiPage.CHANGENOTE, "Test change" );
engine.saveText( context, "test" );
Modified: incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/tests/com/ecyrd/jspwiki/providers/VersioningFileProviderTest.java
URL: http://svn.apache.org/viewvc/incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/tests/com/ecyrd/jspwiki/providers/VersioningFileProviderTest.java?rev=630521&r1=630520&r2=630521&view=diff
==============================================================================
--- incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/tests/com/ecyrd/jspwiki/providers/VersioningFileProviderTest.java (original)
+++ incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/tests/com/ecyrd/jspwiki/providers/VersioningFileProviderTest.java Sat Feb 23 11:45:56 2008
@@ -272,7 +272,7 @@
{
WikiPage p = new WikiPage( engine, NAME1 );
p.setAttribute(WikiPage.CHANGENOTE, "Test change" );
- WikiContext context = new WikiContext(engine,p);
+ WikiContext context = engine.getWikiActionBeanFactory().newViewActionBean(p);
engine.saveText( context, "test" );
@@ -286,8 +286,7 @@
{
WikiPage p = new WikiPage( engine, NAME1 );
-
- WikiContext context = new WikiContext(engine,p);
+ WikiContext context = engine.getWikiActionBeanFactory().newViewActionBean(p);
context.getPage().setAttribute(WikiPage.CHANGENOTE, "Test change" );
engine.saveText( context, "test" );
@@ -308,7 +307,7 @@
{
WikiPage p = new WikiPage( engine, NAME1 );
- WikiContext context = new WikiContext(engine,p);
+ WikiContext context = engine.getWikiActionBeanFactory().newViewActionBean( p );
context.getPage().setAttribute( WikiPage.CHANGENOTE, "Test change" );