jspwiki-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jalka...@apache.org
Subject svn commit: r723968 - in /incubator/jspwiki/branches/JSPWIKI_JCR_BRANCH: ./ etc/ src/com/ecyrd/jspwiki/ src/com/ecyrd/jspwiki/attachment/ src/com/ecyrd/jspwiki/ui/migrator/ src/com/ecyrd/jspwiki/xmlrpc/ tests/com/ecyrd/jspwiki/ tests/com/ecyrd/jspwiki/...
Date Sat, 06 Dec 2008 10:56:34 GMT
Author: jalkanen
Date: Sat Dec  6 02:56:33 2008
New Revision: 723968

URL: http://svn.apache.org/viewvc?rev=723968&view=rev
Log:
Merged from trunk.

Removed:
    incubator/jspwiki/branches/JSPWIKI_JCR_BRANCH/tests/com/ecyrd/jspwiki/ui/migrator/JspMigratorTest.java
Modified:
    incubator/jspwiki/branches/JSPWIKI_JCR_BRANCH/ChangeLog
    incubator/jspwiki/branches/JSPWIKI_JCR_BRANCH/etc/web.xml
    incubator/jspwiki/branches/JSPWIKI_JCR_BRANCH/src/com/ecyrd/jspwiki/WikiEngine.java
    incubator/jspwiki/branches/JSPWIKI_JCR_BRANCH/src/com/ecyrd/jspwiki/attachment/AttachmentServlet.java
    incubator/jspwiki/branches/JSPWIKI_JCR_BRANCH/src/com/ecyrd/jspwiki/ui/migrator/JspMigrator.java
    incubator/jspwiki/branches/JSPWIKI_JCR_BRANCH/src/com/ecyrd/jspwiki/xmlrpc/RPCServlet.java
    incubator/jspwiki/branches/JSPWIKI_JCR_BRANCH/tests/com/ecyrd/jspwiki/TestEngine.java
    incubator/jspwiki/branches/JSPWIKI_JCR_BRANCH/tests/com/ecyrd/jspwiki/plugin/DenouncePluginTest.java
    incubator/jspwiki/branches/JSPWIKI_JCR_BRANCH/tests/com/ecyrd/jspwiki/search/SearchManagerTest.java
    incubator/jspwiki/branches/JSPWIKI_JCR_BRANCH/tests/com/ecyrd/jspwiki/ui/migrator/AllTests.java
    incubator/jspwiki/branches/JSPWIKI_JCR_BRANCH/tests/com/ecyrd/jspwiki/ui/migrator/JspParserTest.java
    incubator/jspwiki/branches/JSPWIKI_JCR_BRANCH/tests/com/ecyrd/jspwiki/ui/migrator/StripesJspTransformerTest.java

Modified: incubator/jspwiki/branches/JSPWIKI_JCR_BRANCH/ChangeLog
URL: http://svn.apache.org/viewvc/incubator/jspwiki/branches/JSPWIKI_JCR_BRANCH/ChangeLog?rev=723968&r1=723967&r2=723968&view=diff
==============================================================================
--- incubator/jspwiki/branches/JSPWIKI_JCR_BRANCH/ChangeLog (original)
+++ incubator/jspwiki/branches/JSPWIKI_JCR_BRANCH/ChangeLog Sat Dec  6 02:56:33 2008
@@ -1,3 +1,10 @@
+2008-12-05  Andrew Jaquith <ajaquith AT apache DOT org>
+
+        * 3.0.0-svn-25
+
+        * Fixed failing unit tests (plus or minus a few). Minor refinements
+        to WikiContext.createContext().
+
 2008-12-05  Janne Jalkanen <jalkanen@apache.org>
 
         * 3.0.0-svn-24

Modified: incubator/jspwiki/branches/JSPWIKI_JCR_BRANCH/etc/web.xml
URL: http://svn.apache.org/viewvc/incubator/jspwiki/branches/JSPWIKI_JCR_BRANCH/etc/web.xml?rev=723968&r1=723967&r2=723968&view=diff
==============================================================================
--- incubator/jspwiki/branches/JSPWIKI_JCR_BRANCH/etc/web.xml (original)
+++ incubator/jspwiki/branches/JSPWIKI_JCR_BRANCH/etc/web.xml Sat Dec  6 02:56:33 2008
@@ -65,7 +65,7 @@
            implementations for JSPWiki-specific types. -->
       <init-param>
          <param-name>Extension.Packages</param-name>
-         <param-value>com.ecyrd.jspwiki.action</param-value>
+         <param-value>com.ecyrd.jspwiki.ui.stripes</param-value>
       </init-param>
       <!-- We override Stripes' normal resource bundle to use ours instead. -->
       <init-param>
@@ -89,7 +89,7 @@
       <!-- Exception handler classes -->
       <init-param>
         <param-name>ExceptionHandler.Class</param-name>
-        <param-value>com.ecyrd.jspwiki.action.WikiExceptionHandler</param-value>
+        <param-value>com.ecyrd.jspwiki.ui.stripes.WikiExceptionHandler</param-value>
       </init-param>
    </filter>
 

Modified: incubator/jspwiki/branches/JSPWIKI_JCR_BRANCH/src/com/ecyrd/jspwiki/WikiEngine.java
URL: http://svn.apache.org/viewvc/incubator/jspwiki/branches/JSPWIKI_JCR_BRANCH/src/com/ecyrd/jspwiki/WikiEngine.java?rev=723968&r1=723967&r2=723968&view=diff
==============================================================================
--- incubator/jspwiki/branches/JSPWIKI_JCR_BRANCH/src/com/ecyrd/jspwiki/WikiEngine.java (original)
+++ incubator/jspwiki/branches/JSPWIKI_JCR_BRANCH/src/com/ecyrd/jspwiki/WikiEngine.java Sat
Dec  6 02:56:33 2008
@@ -38,6 +38,7 @@
 import org.apache.jspwiki.api.FilterException;
 import org.apache.jspwiki.api.WikiException;
 
+import com.ecyrd.jspwiki.action.WikiActionBean;
 import com.ecyrd.jspwiki.action.WikiContextFactory;
 import com.ecyrd.jspwiki.attachment.Attachment;
 import com.ecyrd.jspwiki.attachment.AttachmentManager;
@@ -72,6 +73,7 @@
 import com.ecyrd.jspwiki.ui.admin.AdminBeanManager;
 import com.ecyrd.jspwiki.ui.progress.ProgressManager;
 import com.ecyrd.jspwiki.ui.stripes.WikiActionBeanContext;
+import com.ecyrd.jspwiki.ui.stripes.WikiInterceptor;
 import com.ecyrd.jspwiki.url.URLConstructor;
 import com.ecyrd.jspwiki.util.ClassUtil;
 import com.ecyrd.jspwiki.util.TextUtil;
@@ -2110,12 +2112,39 @@
     }
 
     /**
-     *  Shortcut to create a WikiContext from a supplied HTTP request,
-     *  using a default wiki context.
+     *  <p>Factory method to create a named WikiContext from a supplied HTTP request.
+     *  This method is designed to be called <em>only</em> from within JSP scriptlets;
+     *  core classes in JSPWiki itself are expected to use either
+     *  {@link com.ecyrd.jspwiki.action.WikiContextFactory#newContext(HttpServletRequest,
HttpServletResponse, String)}
+     *  or
+     *  {@link com.ecyrd.jspwiki.action.WikiContextFactory#newViewContext(HttpServletRequest,
HttpServletResponse, WikiPage)}
+     *  instead.</p>
+     *  <p>Note to JSP authors: JSPs that are bound to a {@link com.ecyrd.jspwiki.action.WikiActionBean}
+     *  and/or contain a <code>&lt;stripes:useActionBean&gt;</code> tag
will automatically
+     *  cause a WikiActionBean and {@link com.ecyrd.jspwiki.ui.stripes.WikiActionBeanContext}
+     *  (a WikiContext object) to be created and bound in request scope. This WikiContext
+     *  instance will already exist by the time this method is called. So that the Stripes-provided
+     *  WikiContext is not overwritten inadvertently, this method uses the following algorithm
+     *  to safely return the WikiContext:</p>
+     *  <ul>
+     *  <li>If the request scope is non-null, it is examined for the presence of an
ActionBean bound using the
+     *  key {@link com.ecyrd.jspwiki.ui.stripes.WikiInterceptor#ATTR_ACTIONBEAN})</li>
+     *  <li>If an ActionBean is found, its WikiActionBeanContext is returned
+     *  (via {@link com.ecyrd.jspwiki.action.WikiActionBean#getContext()}</li>
+     *  <li>Otherwise, a new WikiContext is created by delegating to
+     *  {@link com.ecyrd.jspwiki.action.WikiContextFactory#newContext(HttpServletRequest,
HttpServletResponse, String)}</li>
+     *  </ul>
+     *  <p>JSPs that are bound to WikiActionBeans can also recover the Stripes-stashed
+     *  WikiActionBean by calling
+     *  {@link com.ecyrd.jspwiki.action.WikiContextFactory#findContext(javax.servlet.jsp.PageContext)}
+     *  instead of this method.</p>
      *  @param request the HTTP request
-     *  @param requestContext the default context to use
-     *  @return a new WikiContext object.
+     *  @param requestContext the named context to use
+     *  @return the WikiActionBeanContext previously stashed by Stripes, or a new WikiContext
if one was not found
+     *  @see com.ecyrd.jspwiki.action.WikiContextFactory#newContext(HttpServletRequest, HttpServletResponse,
String)
+     *  @see com.ecyrd.jspwiki.action.WikiContextFactory#newViewContext(HttpServletRequest,
HttpServletResponse, WikiPage)
      *  @since 2.1.15.
+     *  @deprecated this method is retained for backwards compatibility with JSPs
      */
     // FIXME: We need to have a version which takes a fixed page
     //        name as well, or check it elsewhere.
@@ -2127,10 +2156,26 @@
             throw new InternalWikiException("WikiEngine has not been properly started.  It
is likely that the configuration is faulty.  Please check all logs for the possible reason.");
         }
         
+        // Recycle/return existing WikiActionBeanContext if Stripes put ActionBean in request
scope already
+        WikiActionBeanContext context;
+        if ( request != null )
+        {
+            try
+            {
+                WikiActionBean actionBean = WikiInterceptor.findActionBean( request );
+                context = actionBean.getContext();
+                context.setRequestContext( requestContext );
+            }
+            catch ( IllegalStateException e )
+            {
+                // No actionBean previously stashed -- no worries. We will just create a
fresh one
+            }
+        }
+        
         // Build the wiki context... dummy reply and response objects will be added by WikiContextFactory
         try
         {
-            WikiActionBeanContext context = m_contextFactory.newContext( request, (HttpServletResponse)null,
requestContext );
+            context = m_contextFactory.newContext( request, (HttpServletResponse)null, requestContext
);
             
             // Stash the action bean/wiki context, and return it!
             WikiContextFactory.saveContext( context.getRequest(), context );

Modified: incubator/jspwiki/branches/JSPWIKI_JCR_BRANCH/src/com/ecyrd/jspwiki/attachment/AttachmentServlet.java
URL: http://svn.apache.org/viewvc/incubator/jspwiki/branches/JSPWIKI_JCR_BRANCH/src/com/ecyrd/jspwiki/attachment/AttachmentServlet.java?rev=723968&r1=723967&r2=723968&view=diff
==============================================================================
--- incubator/jspwiki/branches/JSPWIKI_JCR_BRANCH/src/com/ecyrd/jspwiki/attachment/AttachmentServlet.java
(original)
+++ incubator/jspwiki/branches/JSPWIKI_JCR_BRANCH/src/com/ecyrd/jspwiki/attachment/AttachmentServlet.java
Sat Dec  6 02:56:33 2008
@@ -233,7 +233,15 @@
     public void doGet( HttpServletRequest  req, HttpServletResponse res )
         throws IOException, ServletException
     {
-        WikiContext context = m_engine.createContext( req, WikiContext.ATTACH );
+        WikiContext context;
+        try
+        {
+            context = m_engine.getWikiContextFactory().newContext( req, res, WikiContext.ATTACH
);
+        }
+        catch( WikiException e )
+        {
+            throw new ServletException( e );
+        }
 
         String version  = req.getParameter( HDR_VERSION );
         String nextPage = req.getParameter( "nextpage" );
@@ -503,7 +511,15 @@
         {
             InputStream data = req.getInputStream();
 
-            WikiContext context = m_engine.createContext( req, WikiContext.UPLOAD );
+            WikiContext context;
+            try
+            {
+                context = m_engine.getWikiContextFactory().newContext( req, res, WikiContext.UPLOAD
);
+            }
+            catch( WikiException e )
+            {
+                throw new ServletException( e );
+            }
 
             String wikipage = path.get( 0 );
 
@@ -590,7 +606,15 @@
             
             // Create the context _before_ Multipart operations, otherwise
             // strict servlet containers may fail when setting encoding.
-            WikiContext context = m_engine.createContext( req, WikiContext.ATTACH );
+            WikiContext context;
+            try
+            {
+                context = m_engine.getWikiContextFactory().newContext( req, null, WikiContext.ATTACH
);
+            }
+            catch( WikiException e )
+            {
+                throw new IOException( e.getMessage() );
+            }
 
             UploadListener pl = new UploadListener();
 

Modified: incubator/jspwiki/branches/JSPWIKI_JCR_BRANCH/src/com/ecyrd/jspwiki/ui/migrator/JspMigrator.java
URL: http://svn.apache.org/viewvc/incubator/jspwiki/branches/JSPWIKI_JCR_BRANCH/src/com/ecyrd/jspwiki/ui/migrator/JspMigrator.java?rev=723968&r1=723967&r2=723968&view=diff
==============================================================================
--- incubator/jspwiki/branches/JSPWIKI_JCR_BRANCH/src/com/ecyrd/jspwiki/ui/migrator/JspMigrator.java
(original)
+++ incubator/jspwiki/branches/JSPWIKI_JCR_BRANCH/src/com/ecyrd/jspwiki/ui/migrator/JspMigrator.java
Sat Dec  6 02:56:33 2008
@@ -204,7 +204,7 @@
     public void initialize( Map<String, Object> sharedState )
     {
         // Figure out the properties to use.
-        boolean migrateForms = Boolean.getBoolean( System.getProperty( MIGRATE_FORMS, "true"
) );
+        boolean migrateForms = Boolean.getBoolean( MIGRATE_FORMS );
         setFeature( MIGRATE_FORMS, migrateForms );
 
         m_sharedState = sharedState;

Modified: incubator/jspwiki/branches/JSPWIKI_JCR_BRANCH/src/com/ecyrd/jspwiki/xmlrpc/RPCServlet.java
URL: http://svn.apache.org/viewvc/incubator/jspwiki/branches/JSPWIKI_JCR_BRANCH/src/com/ecyrd/jspwiki/xmlrpc/RPCServlet.java?rev=723968&r1=723967&r2=723968&view=diff
==============================================================================
--- incubator/jspwiki/branches/JSPWIKI_JCR_BRANCH/src/com/ecyrd/jspwiki/xmlrpc/RPCServlet.java
(original)
+++ incubator/jspwiki/branches/JSPWIKI_JCR_BRANCH/src/com/ecyrd/jspwiki/xmlrpc/RPCServlet.java
Sat Dec  6 02:56:33 2008
@@ -34,6 +34,8 @@
 
 import com.ecyrd.jspwiki.log.Logger;
 import com.ecyrd.jspwiki.log.LoggerFactory;
+
+import org.apache.jspwiki.api.WikiException;
 import org.apache.xmlrpc.*;
 
 import com.ecyrd.jspwiki.WikiContext;
@@ -121,7 +123,15 @@
 
         try
         {
-            WikiContext ctx = m_engine.createContext( request, WikiContext.NONE );
+            WikiContext ctx;
+            try
+            {
+                ctx = m_engine.getWikiContextFactory().newContext( request, response, WikiContext.NONE
);
+            }
+            catch( WikiException e )
+            {
+                throw new ServletException( e );
+            }
 
             XmlRpcContext xmlrpcContext = new WikiXmlRpcContext( m_xmlrpcServer.getHandlerMapping(),
                                                                  ctx );

Modified: incubator/jspwiki/branches/JSPWIKI_JCR_BRANCH/tests/com/ecyrd/jspwiki/TestEngine.java
URL: http://svn.apache.org/viewvc/incubator/jspwiki/branches/JSPWIKI_JCR_BRANCH/tests/com/ecyrd/jspwiki/TestEngine.java?rev=723968&r1=723967&r2=723968&view=diff
==============================================================================
--- incubator/jspwiki/branches/JSPWIKI_JCR_BRANCH/tests/com/ecyrd/jspwiki/TestEngine.java
(original)
+++ incubator/jspwiki/branches/JSPWIKI_JCR_BRANCH/tests/com/ecyrd/jspwiki/TestEngine.java
Sat Dec  6 02:56:33 2008
@@ -448,10 +448,10 @@
         // Add extension classes
         Map<String,String> filterParams = new HashMap<String,String>();
         filterParams.put("ActionResolver.Packages", "com.ecyrd.jspwiki.action");
-        filterParams.put("Extension.Packages", "com.ecyrd.jspwiki.action");
+        filterParams.put("Extension.Packages", "com.ecyrd.jspwiki.ui.stripes");
         
         // Add the exception handler class
-        filterParams.put( "ExceptionHandler.Class", "com.ecyrd.jspwiki.action.WikiExceptionHandler"
);
+        filterParams.put( "ExceptionHandler.Class", "com.ecyrd.jspwiki.ui.stripes.WikiExceptionHandler"
);
         
         // Return the configured servlet context
         servletContext.addFilter(StripesFilter.class, "StripesFilter", filterParams);

Modified: incubator/jspwiki/branches/JSPWIKI_JCR_BRANCH/tests/com/ecyrd/jspwiki/plugin/DenouncePluginTest.java
URL: http://svn.apache.org/viewvc/incubator/jspwiki/branches/JSPWIKI_JCR_BRANCH/tests/com/ecyrd/jspwiki/plugin/DenouncePluginTest.java?rev=723968&r1=723967&r2=723968&view=diff
==============================================================================
--- incubator/jspwiki/branches/JSPWIKI_JCR_BRANCH/tests/com/ecyrd/jspwiki/plugin/DenouncePluginTest.java
(original)
+++ incubator/jspwiki/branches/JSPWIKI_JCR_BRANCH/tests/com/ecyrd/jspwiki/plugin/DenouncePluginTest.java
Sat Dec  6 02:56:33 2008
@@ -54,7 +54,7 @@
         //if(host != null)
 
         request.getParameterMap().put("page", new String[]{"TestPage"});
-        context = engine.createContext( request, WikiContext.VIEW );
+        context = engine.getWikiContextFactory().newViewContext( request, null, null );
         manager = new PluginManager(engine, props);
     }
 

Modified: incubator/jspwiki/branches/JSPWIKI_JCR_BRANCH/tests/com/ecyrd/jspwiki/search/SearchManagerTest.java
URL: http://svn.apache.org/viewvc/incubator/jspwiki/branches/JSPWIKI_JCR_BRANCH/tests/com/ecyrd/jspwiki/search/SearchManagerTest.java?rev=723968&r1=723967&r2=723968&view=diff
==============================================================================
--- incubator/jspwiki/branches/JSPWIKI_JCR_BRANCH/tests/com/ecyrd/jspwiki/search/SearchManagerTest.java
(original)
+++ incubator/jspwiki/branches/JSPWIKI_JCR_BRANCH/tests/com/ecyrd/jspwiki/search/SearchManagerTest.java
Sat Dec  6 02:56:33 2008
@@ -99,7 +99,7 @@
         MockHttpServletRequest request = m_engine.newHttpRequest();
         request.getParameterMap().put( "page", new String[]{ "TestPage" } );
         
-        WikiContext ctx = m_engine.createContext( request, WikiContext.EDIT );
+        WikiContext ctx = m_engine.getWikiContextFactory().newContext( request, null, WikiContext.EDIT
);
         
         m_engine.saveText( ctx, txt );
 

Modified: incubator/jspwiki/branches/JSPWIKI_JCR_BRANCH/tests/com/ecyrd/jspwiki/ui/migrator/AllTests.java
URL: http://svn.apache.org/viewvc/incubator/jspwiki/branches/JSPWIKI_JCR_BRANCH/tests/com/ecyrd/jspwiki/ui/migrator/AllTests.java?rev=723968&r1=723967&r2=723968&view=diff
==============================================================================
--- incubator/jspwiki/branches/JSPWIKI_JCR_BRANCH/tests/com/ecyrd/jspwiki/ui/migrator/AllTests.java
(original)
+++ incubator/jspwiki/branches/JSPWIKI_JCR_BRANCH/tests/com/ecyrd/jspwiki/ui/migrator/AllTests.java
Sat Dec  6 02:56:33 2008
@@ -10,7 +10,6 @@
     {
         TestSuite suite = new TestSuite("JSP migration tests");
         suite.addTest( JspDocumentTest.suite() );
-        suite.addTest( JspMigratorTest.suite() );
         suite.addTest( JspParserTest.suite() );
         suite.addTest( JSPWikiJspTransformerTest.suite() );
         suite.addTest( StripesJspTransformerTest.suite() );

Modified: incubator/jspwiki/branches/JSPWIKI_JCR_BRANCH/tests/com/ecyrd/jspwiki/ui/migrator/JspParserTest.java
URL: http://svn.apache.org/viewvc/incubator/jspwiki/branches/JSPWIKI_JCR_BRANCH/tests/com/ecyrd/jspwiki/ui/migrator/JspParserTest.java?rev=723968&r1=723967&r2=723968&view=diff
==============================================================================
--- incubator/jspwiki/branches/JSPWIKI_JCR_BRANCH/tests/com/ecyrd/jspwiki/ui/migrator/JspParserTest.java
(original)
+++ incubator/jspwiki/branches/JSPWIKI_JCR_BRANCH/tests/com/ecyrd/jspwiki/ui/migrator/JspParserTest.java
Sat Dec  6 02:56:33 2008
@@ -325,7 +325,7 @@
         Node node;
         Node attribute;
         List<Node> nodes = doc.getNodes();
-        assertEquals( 18, nodes.size() );
+        assertEquals( 20, nodes.size() );
         int i = 0;
 
         // Test line 1 aka nodes 0+1
@@ -333,26 +333,26 @@
         assertEquals( 1, node.getLine() );
         assertEquals( 1, node.getColumn() );
         assertEquals( 0, node.getStart() );
-        assertEquals( 39, node.getEnd() );
+        assertEquals( 49, node.getEnd() );
         assertEquals( 0, node.getChildren().size() );
         assertEquals( NodeType.JSP_DIRECTIVE, node.getType() );
         assertEquals( NodeType.ROOT, node.getParent().getType() );
-        assertEquals( 17, node.getSiblings().size() );
+        assertEquals( 19, node.getSiblings().size() );
         assertEquals( "page", node.getName() );
         assertEquals( 1, ((Tag) node).getAttributes().size() );
         attribute = ((Tag) node).getAttributes().get( 0 );
         assertEquals( "import", attribute.getName() );
-        assertEquals( "org.apache.log4j.*", attribute.getValue() );
+        assertEquals( "com.ecyrd.jspwiki.log.Logger", attribute.getValue() );
         i++;
         node = nodes.get( i );
         assertEquals( 1, node.getLine() );
-        assertEquals( 40, node.getColumn() );
-        assertEquals( 39, node.getStart() );
-        assertEquals( 40, node.getEnd() );
+        assertEquals( 50, node.getColumn() );
+        assertEquals( 49, node.getStart() );
+        assertEquals( 50, node.getEnd() );
         assertEquals( 0, node.getChildren().size() );
         assertEquals( NodeType.TEXT, node.getType() );
         assertEquals( NodeType.ROOT, node.getParent().getType() );
-        assertEquals( 17, node.getSiblings().size() );
+        assertEquals( 19, node.getSiblings().size() );
         assertEquals( "(TEXT)", node.getName() );
         i++;
 
@@ -360,27 +360,27 @@
         node = nodes.get( i );
         assertEquals( 2, node.getLine() );
         assertEquals( 1, node.getColumn() );
-        assertEquals( 40, node.getStart() );
-        assertEquals( 80, node.getEnd() );
+        assertEquals( 50, node.getStart() );
+        assertEquals( 106, node.getEnd() );
         assertEquals( 0, node.getChildren().size() );
         assertEquals( NodeType.JSP_DIRECTIVE, node.getType() );
         assertEquals( NodeType.ROOT, node.getParent().getType() );
-        assertEquals( 17, node.getSiblings().size() );
+        assertEquals( 19, node.getSiblings().size() );
         assertEquals( "page", node.getName() );
         assertEquals( 1, ((Tag) node).getAttributes().size() );
         attribute = ((Tag) node).getAttributes().get( 0 );
         assertEquals( "import", attribute.getName() );
-        assertEquals( "com.ecyrd.jspwiki.*", attribute.getValue() );
+        assertEquals( "com.ecyrd.jspwiki.log.LoggerFactory", attribute.getValue() );
         i++;
         node = nodes.get( i );
         assertEquals( 2, node.getLine() );
-        assertEquals( 41, node.getColumn() );
-        assertEquals( 80, node.getStart() );
-        assertEquals( 81, node.getEnd() );
+        assertEquals( 57, node.getColumn() );
+        assertEquals( 106, node.getStart() );
+        assertEquals( 107, node.getEnd() );
         assertEquals( 0, node.getChildren().size() );
         assertEquals( NodeType.TEXT, node.getType() );
         assertEquals( NodeType.ROOT, node.getParent().getType() );
-        assertEquals( 17, node.getSiblings().size() );
+        assertEquals( 19, node.getSiblings().size() );
         assertEquals( "(TEXT)", node.getName() );
         i++;
 
@@ -388,27 +388,27 @@
         node = nodes.get( i );
         assertEquals( 3, node.getLine() );
         assertEquals( 1, node.getColumn() );
-        assertEquals( 81, node.getStart() );
-        assertEquals( 128, node.getEnd() );
+        assertEquals( 107, node.getStart() );
+        assertEquals( 147, node.getEnd() );
         assertEquals( 0, node.getChildren().size() );
         assertEquals( NodeType.JSP_DIRECTIVE, node.getType() );
         assertEquals( NodeType.ROOT, node.getParent().getType() );
-        assertEquals( 17, node.getSiblings().size() );
+        assertEquals( 19, node.getSiblings().size() );
         assertEquals( "page", node.getName() );
         assertEquals( 1, ((Tag) node).getAttributes().size() );
         attribute = ((Tag) node).getAttributes().get( 0 );
         assertEquals( "import", attribute.getName() );
-        assertEquals( "com.ecyrd.jspwiki.action.*", attribute.getValue() );
+        assertEquals( "com.ecyrd.jspwiki.*", attribute.getValue() );
         i++;
         node = nodes.get( i );
         assertEquals( 3, node.getLine() );
-        assertEquals( 48, node.getColumn() );
-        assertEquals( 128, node.getStart() );
-        assertEquals( 129, node.getEnd() );
+        assertEquals( 41, node.getColumn() );
+        assertEquals( 147, node.getStart() );
+        assertEquals( 148, node.getEnd() );
         assertEquals( 0, node.getChildren().size() );
         assertEquals( NodeType.TEXT, node.getType() );
         assertEquals( NodeType.ROOT, node.getParent().getType() );
-        assertEquals( 17, node.getSiblings().size() );
+        assertEquals( 19, node.getSiblings().size() );
         assertEquals( "(TEXT)", node.getName() );
         i++;
 
@@ -416,27 +416,27 @@
         node = nodes.get( i );
         assertEquals( 4, node.getLine() );
         assertEquals( 1, node.getColumn() );
-        assertEquals( 129, node.getStart() );
-        assertEquals( 163, node.getEnd() );
+        assertEquals( 148, node.getStart() );
+        assertEquals( 195, node.getEnd() );
         assertEquals( 0, node.getChildren().size() );
         assertEquals( NodeType.JSP_DIRECTIVE, node.getType() );
         assertEquals( NodeType.ROOT, node.getParent().getType() );
-        assertEquals( 17, node.getSiblings().size() );
+        assertEquals( 19, node.getSiblings().size() );
         assertEquals( "page", node.getName() );
         assertEquals( 1, ((Tag) node).getAttributes().size() );
         attribute = ((Tag) node).getAttributes().get( 0 );
-        assertEquals( "errorPage", attribute.getName() );
-        assertEquals( "/Error.jsp", attribute.getValue() );
+        assertEquals( "import", attribute.getName() );
+        assertEquals( "com.ecyrd.jspwiki.action.*", attribute.getValue() );
         i++;
         node = nodes.get( i );
         assertEquals( 4, node.getLine() );
-        assertEquals( 35, node.getColumn() );
-        assertEquals( 163, node.getStart() );
-        assertEquals( 164, node.getEnd() );
+        assertEquals( 48, node.getColumn() );
+        assertEquals( 195, node.getStart() );
+        assertEquals( 196, node.getEnd() );
         assertEquals( 0, node.getChildren().size() );
         assertEquals( NodeType.TEXT, node.getType() );
         assertEquals( NodeType.ROOT, node.getParent().getType() );
-        assertEquals( 17, node.getSiblings().size() );
+        assertEquals( 19, node.getSiblings().size() );
         assertEquals( "(TEXT)", node.getName() );
         i++;
 
@@ -444,12 +444,40 @@
         node = nodes.get( i );
         assertEquals( 5, node.getLine() );
         assertEquals( 1, node.getColumn() );
-        assertEquals( 164, node.getStart() );
-        assertEquals( 218, node.getEnd() );
+        assertEquals( 196, node.getStart() );
+        assertEquals( 230, node.getEnd() );
         assertEquals( 0, node.getChildren().size() );
         assertEquals( NodeType.JSP_DIRECTIVE, node.getType() );
         assertEquals( NodeType.ROOT, node.getParent().getType() );
-        assertEquals( 17, node.getSiblings().size() );
+        assertEquals( 19, node.getSiblings().size() );
+        assertEquals( "page", node.getName() );
+        assertEquals( 1, ((Tag) node).getAttributes().size() );
+        attribute = ((Tag) node).getAttributes().get( 0 );
+        assertEquals( "errorPage", attribute.getName() );
+        assertEquals( "/Error.jsp", attribute.getValue() );
+        i++;
+        node = nodes.get( i );
+        assertEquals( 5, node.getLine() );
+        assertEquals( 35, node.getColumn() );
+        assertEquals( 230, node.getStart() );
+        assertEquals( 231, node.getEnd() );
+        assertEquals( 0, node.getChildren().size() );
+        assertEquals( NodeType.TEXT, node.getType() );
+        assertEquals( NodeType.ROOT, node.getParent().getType() );
+        assertEquals( 19, node.getSiblings().size() );
+        assertEquals( "(TEXT)", node.getName() );
+        i++;
+        
+        // Test line 6 aka nodes 10+11
+        node = nodes.get( i );
+        assertEquals( 6, node.getLine() );
+        assertEquals( 1, node.getColumn() );
+        assertEquals( 231, node.getStart() );
+        assertEquals( 285, node.getEnd() );
+        assertEquals( 0, node.getChildren().size() );
+        assertEquals( NodeType.JSP_DIRECTIVE, node.getType() );
+        assertEquals( NodeType.ROOT, node.getParent().getType() );
+        assertEquals( 19, node.getSiblings().size() );
         assertEquals( "taglib", node.getName() );
         assertEquals( 2, ((Tag) node).getAttributes().size() );
         attribute = ((Tag) node).getAttributes().get( 0 );
@@ -460,27 +488,27 @@
         assertEquals( "wiki", attribute.getValue() );
         i++;
         node = nodes.get( i );
-        assertEquals( 5, node.getLine() );
+        assertEquals( 6, node.getLine() );
         assertEquals( 55, node.getColumn() );
-        assertEquals( 218, node.getStart() );
-        assertEquals( 219, node.getEnd() );
+        assertEquals( 285, node.getStart() );
+        assertEquals( 286, node.getEnd() );
         assertEquals( 0, node.getChildren().size() );
         assertEquals( NodeType.TEXT, node.getType() );
         assertEquals( NodeType.ROOT, node.getParent().getType() );
-        assertEquals( 17, node.getSiblings().size() );
+        assertEquals( 19, node.getSiblings().size() );
         assertEquals( "(TEXT)", node.getName() );
         i++;
 
-        // Test line 6 aka nodes 10+11
+        // Test line 7 aka nodes 12+13
         node = nodes.get( i );
-        assertEquals( 6, node.getLine() );
+        assertEquals( 7, node.getLine() );
         assertEquals( 1, node.getColumn() );
-        assertEquals( 219, node.getStart() );
-        assertEquals( 276, node.getEnd() );
+        assertEquals( 286, node.getStart() );
+        assertEquals( 343, node.getEnd() );
         assertEquals( 0, node.getChildren().size() );
         assertEquals( NodeType.JSP_DIRECTIVE, node.getType() );
         assertEquals( NodeType.ROOT, node.getParent().getType() );
-        assertEquals( 17, node.getSiblings().size() );
+        assertEquals( 19, node.getSiblings().size() );
         assertEquals( "taglib", node.getName() );
         assertEquals( 2, ((Tag) node).getAttributes().size() );
         attribute = ((Tag) node).getAttributes().get( 0 );
@@ -491,30 +519,30 @@
         assertEquals( "stripes", attribute.getValue() );
         i++;
         node = nodes.get( i );
-        assertEquals( 6, node.getLine() );
+        assertEquals( 7, node.getLine() );
         assertEquals( 58, node.getColumn() );
-        assertEquals( 276, node.getStart() );
-        assertEquals( 277, node.getEnd() );
+        assertEquals( 343, node.getStart() );
+        assertEquals( 344, node.getEnd() );
         assertEquals( 0, node.getChildren().size() );
         assertEquals( NodeType.TEXT, node.getType() );
         assertEquals( NodeType.ROOT, node.getParent().getType() );
-        assertEquals( 17, node.getSiblings().size() );
+        assertEquals( 19, node.getSiblings().size() );
         assertEquals( "(TEXT)", node.getName() );
         i++;
 
-        // Test line 7 aka nodes 12+13
+        // Test line 8 aka nodes 14+15
         node = nodes.get( i );
-        assertEquals( 7, node.getLine() );
+        assertEquals( 8, node.getLine() );
         assertEquals( 1, node.getColumn() );
-        assertEquals( 277, node.getStart() );
-        assertEquals( 354, node.getEnd() );
+        assertEquals( 344, node.getStart() );
+        assertEquals( 422, node.getEnd() );
         assertEquals( 0, node.getChildren().size() );
         assertEquals( NodeType.EMPTY_ELEMENT_TAG, node.getType() );
         assertEquals( NodeType.ROOT, node.getParent().getType() );
-        assertEquals( 17, node.getSiblings().size() );
+        assertEquals( 19, node.getSiblings().size() );
         assertEquals( "stripes:useActionBean", node.getName() );
 
-        // AbstractNode 12 should have 1 attribute:
+        // Node 14 should have 1 attribute:
         // beanclass="com.ecyrd.jspwiki.action.LoginActionBean"
         assertEquals( 1, ((Tag) node).getAttributes().size() );
         attribute = ((Tag) node).getAttributes().get( 0 );
@@ -524,68 +552,68 @@
         assertEquals( 'c', ((Tag) node).getAttributes().get( 0 ).getValue().charAt( 0 ) );
         i++;
 
-        // Test line 7, node 13 (line break)
+        // Test line 8, node 15 (line break)
         node = nodes.get( i );
-        assertEquals( 7, node.getLine() );
-        assertEquals( 78, node.getColumn() );
-        assertEquals( 354, node.getStart() );
-        assertEquals( 355, node.getEnd() );
+        assertEquals( 8, node.getLine() );
+        assertEquals( 79, node.getColumn() );
+        assertEquals( 422, node.getStart() );
+        assertEquals( 423, node.getEnd() );
         assertEquals( 0, node.getChildren().size() );
         assertEquals( NodeType.TEXT, node.getType() );
         assertEquals( NodeType.ROOT, node.getParent().getType() );
-        assertEquals( 17, node.getSiblings().size() );
+        assertEquals( 19, node.getSiblings().size() );
         assertEquals( "(TEXT)", node.getName() );
         i++;
 
-        // Test lines 8-19 aka nodes 14+15
+        // Test lines 9-20 aka nodes 16+17
         node = nodes.get( i );
-        assertEquals( 8, node.getLine() );
+        assertEquals( 9, node.getLine() );
         assertEquals( 1, node.getColumn() );
-        assertEquals( 355, node.getStart() );
-        assertEquals( 767, node.getEnd() );
+        assertEquals( 423, node.getStart() );
+        assertEquals( 842, node.getEnd() );
         assertEquals( NodeType.JSP_DECLARATION, node.getType() );
         assertEquals( NodeType.ROOT, node.getParent().getType() );
-        assertEquals( 17, node.getSiblings().size() );
+        assertEquals( 19, node.getSiblings().size() );
         assertEquals( "(TEXT)", node.getName() );
         i++;
         node = nodes.get( i );
-        assertEquals( 19, node.getLine() );
+        assertEquals( 20, node.getLine() );
         assertEquals( 3, node.getColumn() );
-        assertEquals( 767, node.getStart() );
-        assertEquals( 768, node.getEnd() );
+        assertEquals( 842, node.getStart() );
+        assertEquals( 843, node.getEnd() );
         assertEquals( 0, node.getChildren().size() );
         assertEquals( NodeType.TEXT, node.getType() );
         assertEquals( NodeType.ROOT, node.getParent().getType() );
-        assertEquals( 17, node.getSiblings().size() );
+        assertEquals( 19, node.getSiblings().size() );
         assertEquals( "(TEXT)", node.getName() );
         i++;
 
-        // Test line 20-33 aka node 16
+        // Test line 21-34 aka node 18
         node = nodes.get( i );
-        assertEquals( 20, node.getLine() );
+        assertEquals( 21, node.getLine() );
         assertEquals( 1, node.getColumn() );
-        assertEquals( 768, node.getStart() );
-        assertEquals( 1513, node.getEnd() );
+        assertEquals( 843, node.getStart() );
+        assertEquals( 1583, node.getEnd() );
         assertEquals( 0, node.getChildren().size() );
         assertEquals( NodeType.SCRIPTLET, node.getType() );
         assertEquals( NodeType.ROOT, node.getParent().getType() );
-        assertEquals( 17, node.getSiblings().size() );
+        assertEquals( 19, node.getSiblings().size() );
         assertEquals( "(TEXT)", node.getName() );
         i++;
 
-        // Test second tag on line 33 aka node 17
+        // Test second tag on line 34 aka node 19
         node = nodes.get( i );
-        assertEquals( 33, node.getLine() );
+        assertEquals( 34, node.getLine() );
         assertEquals( 3, node.getColumn() );
-        assertEquals( 1513, node.getStart() );
-        assertEquals( 1553, node.getEnd() );
+        assertEquals( 1583, node.getStart() );
+        assertEquals( 1623, node.getEnd() );
         assertEquals( 0, node.getChildren().size() );
         assertEquals( NodeType.EMPTY_ELEMENT_TAG, node.getType() );
         assertEquals( NodeType.ROOT, node.getParent().getType() );
-        assertEquals( 17, node.getSiblings().size() );
+        assertEquals( 19, node.getSiblings().size() );
         assertEquals( "wiki:Include", node.getName() );
 
-        // AbstractNode 17 should have 1 attribute: page="<%=contentPage%>"
+        // AbstractNode 19 should have 1 attribute: page="<%=contentPage%>"
         assertEquals( 1, ((Tag) node).getAttributes().size() );
         attribute = ((Tag) node).getAttributes().get( 0 );
         assertEquals( "page", attribute.getName() );

Modified: incubator/jspwiki/branches/JSPWIKI_JCR_BRANCH/tests/com/ecyrd/jspwiki/ui/migrator/StripesJspTransformerTest.java
URL: http://svn.apache.org/viewvc/incubator/jspwiki/branches/JSPWIKI_JCR_BRANCH/tests/com/ecyrd/jspwiki/ui/migrator/StripesJspTransformerTest.java?rev=723968&r1=723967&r2=723968&view=diff
==============================================================================
--- incubator/jspwiki/branches/JSPWIKI_JCR_BRANCH/tests/com/ecyrd/jspwiki/ui/migrator/StripesJspTransformerTest.java
(original)
+++ incubator/jspwiki/branches/JSPWIKI_JCR_BRANCH/tests/com/ecyrd/jspwiki/ui/migrator/StripesJspTransformerTest.java
Sat Dec  6 02:56:33 2008
@@ -26,6 +26,14 @@
         super( s );
     }
 
+    public void setUp()
+    {
+        System.setProperty( JspMigrator.MIGRATE_FORMS, "true" );
+        JspMigrator migrator = new JspMigrator();
+        migrator.addTransformer( m_transformer );
+        migrator.initialize( m_sharedState );
+    }
+
     public void testAddStripesTaglib() throws Exception
     {
         String s = "<form/>";



Mime
View raw message