You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@myfaces.apache.org by pa...@apache.org on 2007/01/01 13:09:59 UTC

svn commit: r491554 - in /myfaces/tomahawk/trunk/core/src/test/java/org/apache/myfaces: custom/tree2/AbstractTreeTestCase.java test/AbstractTomahawkJsfTestCase.java

Author: paulsp
Date: Mon Jan  1 04:09:58 2007
New Revision: 491554

URL: http://svn.apache.org/viewvc?view=rev&rev=491554
Log:
Refactor the Response Writer and Application Map setup into the abstract class

Modified:
    myfaces/tomahawk/trunk/core/src/test/java/org/apache/myfaces/custom/tree2/AbstractTreeTestCase.java
    myfaces/tomahawk/trunk/core/src/test/java/org/apache/myfaces/test/AbstractTomahawkJsfTestCase.java

Modified: myfaces/tomahawk/trunk/core/src/test/java/org/apache/myfaces/custom/tree2/AbstractTreeTestCase.java
URL: http://svn.apache.org/viewvc/myfaces/tomahawk/trunk/core/src/test/java/org/apache/myfaces/custom/tree2/AbstractTreeTestCase.java?view=diff&rev=491554&r1=491553&r2=491554
==============================================================================
--- myfaces/tomahawk/trunk/core/src/test/java/org/apache/myfaces/custom/tree2/AbstractTreeTestCase.java (original)
+++ myfaces/tomahawk/trunk/core/src/test/java/org/apache/myfaces/custom/tree2/AbstractTreeTestCase.java Mon Jan  1 04:09:58 2007
@@ -19,8 +19,6 @@
 
 package org.apache.myfaces.custom.tree2;
 
-import java.io.BufferedWriter;
-import java.io.CharArrayWriter;
 import java.io.IOException;
 import java.util.Stack;
 
@@ -30,9 +28,7 @@
 import junit.framework.Test;
 import junit.framework.TestSuite;
 
-import org.apache.myfaces.shared_tomahawk.config.MyfacesConfig;
 import org.apache.myfaces.test.AbstractTomahawkJsfTestCase;
-import org.apache.shale.test.mock.MockResponseWriter;
 
 /**
  * An abstract test case that sets up a Tree2 for testing using the structure below.
@@ -87,10 +83,6 @@
         tree = new HtmlTree();
         tree.setId(TREE_ID);
 
-        // additional setup not provided automatically by the shale mock stuff
-        facesContext.getExternalContext().getApplicationMap().put(MyfacesConfig.class.getName(), new MyfacesConfig());
-        facesContext.setResponseWriter(new MockResponseWriter(new BufferedWriter(new CharArrayWriter()), null, null));
-        
         // set up the test tree with the standard data
         rootNode = new TreeNodeBase(DEFAULT_NODE_TYPE, "Root", "Root", false);
 

Modified: myfaces/tomahawk/trunk/core/src/test/java/org/apache/myfaces/test/AbstractTomahawkJsfTestCase.java
URL: http://svn.apache.org/viewvc/myfaces/tomahawk/trunk/core/src/test/java/org/apache/myfaces/test/AbstractTomahawkJsfTestCase.java?view=diff&rev=491554&r1=491553&r2=491554
==============================================================================
--- myfaces/tomahawk/trunk/core/src/test/java/org/apache/myfaces/test/AbstractTomahawkJsfTestCase.java (original)
+++ myfaces/tomahawk/trunk/core/src/test/java/org/apache/myfaces/test/AbstractTomahawkJsfTestCase.java Mon Jan  1 04:09:58 2007
@@ -18,8 +18,13 @@
  */
 package org.apache.myfaces.test;
 
+import java.io.BufferedWriter;
+import java.io.CharArrayWriter;
+
+import org.apache.myfaces.shared_tomahawk.config.MyfacesConfig;
 import org.apache.myfaces.test.utils.TestUtils;
 import org.apache.shale.test.base.AbstractJsfTestCase;
+import org.apache.shale.test.mock.MockResponseWriter;
 
 /**
  * Abstract Shale Test base class, which sets up the JSF environment.  If the test
@@ -42,12 +47,19 @@
     /**
      *  Setup the test environment, including the following:
      *  <ul>
+     *  <li>Set the Application Map.</li>
+     *  <li>Set a response writer</li>
      *  <li>Add Tomahawk's renderers to the faces context.</li>
      *  </ul> 
      */
     protected void setUp() throws Exception
     {
         super.setUp();
+
+        // additional setup not provided automatically by the shale mock stuff
+        facesContext.getExternalContext().getApplicationMap().put(MyfacesConfig.class.getName(), new MyfacesConfig());
+        facesContext.setResponseWriter(new MockResponseWriter(new BufferedWriter(new CharArrayWriter()), null, null));
+
         TestUtils.addDefaultRenderers(facesContext);
     }