[seam-commits] Seam SVN: r12262 - in branches/enterprise/JBPAPP_4_2_CP01: src/main/org/jboss/seam/mock and 1 other directory.
seam-commits at lists.jboss.org
seam-commits at lists.jboss.org
Wed Mar 24 09:59:06 EDT 2010
Author: manaRH
Date: 2010-03-24 09:59:05 -0400 (Wed, 24 Mar 2010)
New Revision: 12262
Modified:
branches/enterprise/JBPAPP_4_2_CP01/examples/blog/src/test/BlogTest.java
branches/enterprise/JBPAPP_4_2_CP01/src/main/org/jboss/seam/mock/MockStateManager.java
branches/enterprise/JBPAPP_4_2_CP01/src/main/org/jboss/seam/mock/SeamTest.java
Log:
JBPAPP-3138 - fixing Blog example test
Modified: branches/enterprise/JBPAPP_4_2_CP01/examples/blog/src/test/BlogTest.java
===================================================================
--- branches/enterprise/JBPAPP_4_2_CP01/examples/blog/src/test/BlogTest.java 2010-03-24 12:36:35 UTC (rev 12261)
+++ branches/enterprise/JBPAPP_4_2_CP01/examples/blog/src/test/BlogTest.java 2010-03-24 13:59:05 UTC (rev 12262)
@@ -8,6 +8,7 @@
import org.jboss.seam.jsf.SeamPhaseListener;
import org.jboss.seam.jsf.TransactionalSeamPhaseListener;
import org.jboss.seam.mock.SeamTest;
+import org.jboss.seam.security.Identity;
import org.testng.annotations.Test;
import actions.BlogService;
@@ -21,6 +22,20 @@
@Test
public void testPost() throws Exception
{
+ new FacesRequest()
+ {
+ @Override
+ protected void updateModelValues() throws Exception
+ {
+ Identity.instance().setPassword("tokyo");
+ }
+ @Override
+ protected void invokeApplication() throws Exception
+ {
+ Identity.instance().authenticate();
+ }
+ }.run();
+
new FacesRequest("/post.xhtml")
{
Modified: branches/enterprise/JBPAPP_4_2_CP01/src/main/org/jboss/seam/mock/MockStateManager.java
===================================================================
--- branches/enterprise/JBPAPP_4_2_CP01/src/main/org/jboss/seam/mock/MockStateManager.java 2010-03-24 12:36:35 UTC (rev 12261)
+++ branches/enterprise/JBPAPP_4_2_CP01/src/main/org/jboss/seam/mock/MockStateManager.java 2010-03-24 13:59:05 UTC (rev 12262)
@@ -8,7 +8,16 @@
public class MockStateManager extends StateManager {
+
@Override
+ public void writeState(FacesContext ctx, Object state) throws IOException {}
+
+ @Override
+ public Object saveView(FacesContext ctx) {
+ return null;
+ }
+
+ @Override
public SerializedView saveSerializedView(FacesContext ctx) {
return null;
}
Modified: branches/enterprise/JBPAPP_4_2_CP01/src/main/org/jboss/seam/mock/SeamTest.java
===================================================================
--- branches/enterprise/JBPAPP_4_2_CP01/src/main/org/jboss/seam/mock/SeamTest.java 2010-03-24 12:36:35 UTC (rev 12261)
+++ branches/enterprise/JBPAPP_4_2_CP01/src/main/org/jboss/seam/mock/SeamTest.java 2010-03-24 13:59:05 UTC (rev 12262)
@@ -1,9 +1,9 @@
/*
- * JBoss, Home of Professional Open Source
- *
- * Distributable under LGPL license.
- * See terms of license at gnu.org.
- */
+�* JBoss, Home of Professional Open Source
+�*
+�* Distributable under LGPL license.
+�* See terms of license at gnu.org.
+�*/
package org.jboss.seam.mock;
import java.lang.reflect.Field;
@@ -415,6 +415,16 @@
beforeRequest();
+// Map<String, String> params = new HashMap<String, String>();
+// for (Map.Entry<String, String[]> e: ( (Map<String, String[]>) request.getParameterMap() ).entrySet())
+// {
+// if ( e.getValue().length==1 )
+// {
+// params.put( e.getKey(), e.getValue()[0] );
+// }
+// }
+// request.setAttribute("param", params);
+
phases.beforePhase( new PhaseEvent(facesContext, PhaseId.RESTORE_VIEW, MockLifecycle.INSTANCE) );
UIViewRoot viewRoot = facesContext.getApplication().getViewHandler().createView( facesContext, getViewId() );
@@ -437,8 +447,12 @@
}
}
}
- if ( !isGetRequest() )
+ if ( isGetRequest() )
{
+ facesContext.renderResponse();
+ }
+ else
+ {
restoredViewRootAttributes.putAll(pageParameters);
}
More information about the seam-commits
mailing list