[jboss-cvs] jboss-seam/src/main/org/jboss/seam/mock ...
Gavin King
gavin.king at jboss.com
Mon Jun 11 16:08:52 EDT 2007
User: gavin
Date: 07/06/11 16:08:52
Modified: src/main/org/jboss/seam/mock BaseSeamTest.java
Log:
JBSEAM-255
Revision Changes Path
1.9 +47 -11 jboss-seam/src/main/org/jboss/seam/mock/BaseSeamTest.java
(In the diff below, changes in quantity of whitespace are not shown.)
Index: BaseSeamTest.java
===================================================================
RCS file: /cvsroot/jboss/jboss-seam/src/main/org/jboss/seam/mock/BaseSeamTest.java,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -b -r1.8 -r1.9
--- BaseSeamTest.java 11 Jun 2007 19:21:19 -0000 1.8
+++ BaseSeamTest.java 11 Jun 2007 20:08:52 -0000 1.9
@@ -107,9 +107,7 @@
*/
public abstract class Script extends Request
{
- public Script()
- {
- }
+ public Script() {}
public Script(String conversationId)
{
@@ -117,8 +115,50 @@
}
}
+ public abstract class ComponentTest
+ {
+ /**
+ * Call a method binding
+ */
+ protected Object invokeMethod(String methodExpression)
+ {
+ return Expressions.instance().createMethodExpression(methodExpression).invoke();
+ }
+
+ /**
+ * Evaluate (get) a value binding
+ */
+ protected Object getValue(String valueExpression)
+ {
+ return Expressions.instance().createValueExpression(valueExpression).getValue();
+ }
+
/**
- * Script is an abstract superclass for usually anonymous inner classes that
+ * Set a value binding
+ */
+ protected void setValue(String valueExpression, Object value)
+ {
+ Expressions.instance().createValueExpression(valueExpression).setValue(value);
+ }
+
+ protected abstract void testComponents() throws Exception;
+
+ public void run() throws Exception
+ {
+ Lifecycle.beginTest( servletContext, new ServletSessionMap(session) );
+ try
+ {
+ testComponents();
+ }
+ finally
+ {
+ Lifecycle.endTest();
+ }
+ }
+ }
+
+ /**
+ * Request is an abstract superclass for usually anonymous inner classes that
* test JSF interactions.
*
* @author Gavin King
@@ -451,7 +491,7 @@
}
}
- private void init()
+ protected void init()
{
Cookie[] cookieArray = getCookies().toArray( new Cookie[]{} );
request = new MockHttpServletRequest(session, getPrincipalName(), getPrincipalRoles(), cookieArray);
@@ -689,9 +729,7 @@
public class NonFacesRequest extends Request
{
- public NonFacesRequest()
- {
- }
+ public NonFacesRequest() {}
/**
* @param viewId
@@ -743,9 +781,7 @@
public class FacesRequest extends Request
{
- public FacesRequest()
- {
- }
+ public FacesRequest() {}
/**
* @param viewId
More information about the jboss-cvs-commits
mailing list