You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@myfaces.apache.org by lu...@apache.org on 2014/01/25 23:54:34 UTC
svn commit: r1561418 [1/3] - in /myfaces/core/trunk: ./ impl-test/
impl-test/src/ impl-test/src/main/ impl-test/src/main/java/ impl/
impl/src/test/java/org/apache/myfaces/application/contracts/
impl/src/test/java/org/apache/myfaces/application/flow/ im...
Author: lu4242
Date: Sat Jan 25 22:54:34 2014
New Revision: 1561418
URL: http://svn.apache.org/r1561418
Log:
MYFACES-3849 Create new module for JUnit Mock Testing using MyFaces Core, MyFaces Test and CDI
Added:
myfaces/core/trunk/impl-test/ (with props)
myfaces/core/trunk/impl-test/pom.xml (with props)
myfaces/core/trunk/impl-test/src/ (with props)
myfaces/core/trunk/impl-test/src/main/ (with props)
myfaces/core/trunk/impl-test/src/main/java/ (with props)
myfaces/core/trunk/impl/src/test/java/org/apache/myfaces/lifecycle/MyFacesRequestJUnitTestCase.java (with props)
myfaces/core/trunk/impl/src/test/java/org/apache/myfaces/mc/test/core/ServletMockContainer.java (with props)
myfaces/core/trunk/impl/src/test/resources/org/apache/myfaces/lifecycle/redirect1.xhtml
- copied, changed from r1556106, myfaces/core/trunk/impl/src/test/resources/org/apache/myfaces/application/contracts/view_1.xhtml
myfaces/core/trunk/impl/src/test/resources/org/apache/myfaces/lifecycle/redirect1_1.xhtml
- copied, changed from r1556106, myfaces/core/trunk/impl/src/test/resources/org/apache/myfaces/application/contracts/view_1.xhtml
Modified:
myfaces/core/trunk/impl/pom.xml
myfaces/core/trunk/impl/src/test/java/org/apache/myfaces/application/contracts/ContractsCreateResourceMyFacesRequestTestCase.java
myfaces/core/trunk/impl/src/test/java/org/apache/myfaces/application/contracts/DefaultContractsConfigMyFacesRequestTestCase.java
myfaces/core/trunk/impl/src/test/java/org/apache/myfaces/application/contracts/SingleContractMyFacesRequestTestCase.java
myfaces/core/trunk/impl/src/test/java/org/apache/myfaces/application/flow/FlowMyFacesCDIRequestTestCase.java
myfaces/core/trunk/impl/src/test/java/org/apache/myfaces/application/flow/FlowMyFacesRequestTestCase.java
myfaces/core/trunk/impl/src/test/java/org/apache/myfaces/event/PostAddToViewEventTestCase.java
myfaces/core/trunk/impl/src/test/java/org/apache/myfaces/mc/test/core/AbstractMyFacesCDIRequestTestCase.java
myfaces/core/trunk/impl/src/test/java/org/apache/myfaces/mc/test/core/AbstractMyFacesFaceletsTestCase.java
myfaces/core/trunk/impl/src/test/java/org/apache/myfaces/mc/test/core/AbstractMyFacesRequestTestCase.java
myfaces/core/trunk/impl/src/test/java/org/apache/myfaces/mc/test/core/AbstractMyFacesTestCase.java
myfaces/core/trunk/impl/src/test/java/org/apache/myfaces/mc/test/core/MockMyFacesClient.java
myfaces/core/trunk/impl/src/test/java/org/apache/myfaces/view/facelets/pool/ViewPoolMyFacesRequestTestCase.java
myfaces/core/trunk/impl/src/test/java/org/apache/myfaces/view/facelets/pss/acid/AcidMyFacesRequestTestCase.java
myfaces/core/trunk/impl/src/test/java/org/apache/myfaces/view/facelets/tag/composite/localized/LocalizedCompositeComponentTestCase.java
myfaces/core/trunk/impl/src/test/java/org/apache/myfaces/view/facelets/tag/jsf/core/reset/ResetValuesTestCase.java
myfaces/core/trunk/impl/src/test/java/org/apache/myfaces/view/facelets/test/component/FacesComponentAnnotationMyFacesRequestTestCase.java
myfaces/core/trunk/impl/src/test/java/org/apache/myfaces/view/facelets/updateheadres/UpdateHeadDynamicViewTestCase.java
myfaces/core/trunk/parent/pom.xml
myfaces/core/trunk/pom.xml
Propchange: myfaces/core/trunk/impl-test/
------------------------------------------------------------------------------
bugtraq:number = true
Added: myfaces/core/trunk/impl-test/pom.xml
URL: http://svn.apache.org/viewvc/myfaces/core/trunk/impl-test/pom.xml?rev=1561418&view=auto
==============================================================================
--- myfaces/core/trunk/impl-test/pom.xml (added)
+++ myfaces/core/trunk/impl-test/pom.xml Sat Jan 25 22:54:34 2014
@@ -0,0 +1,182 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to you under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+-->
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+
+ <parent>
+ <groupId>org.apache.myfaces.core</groupId>
+ <artifactId>myfaces-core-project</artifactId>
+ <version>2.2.1-SNAPSHOT</version>
+ <relativePath>../parent/pom.xml</relativePath>
+ </parent>
+
+ <modelVersion>4.0.0</modelVersion>
+
+ <artifactId>myfaces-impl-test</artifactId>
+ <name>Apache MyFaces JSF-2.2 Impl Test</name>
+
+ <scm>
+ <connection>scm:svn:http://svn.apache.org/repos/asf/myfaces/core/trunk/impl-test</connection>
+ <developerConnection>scm:svn:https://svn.apache.org/repos/asf/myfaces/core/trunk/impl-test</developerConnection>
+ <url>http://svn.apache.org/repos/asf/myfaces/core/trunk/impl-test</url>
+ </scm>
+
+ <properties>
+ <openwebbeans.version>1.2.1</openwebbeans.version>
+ </properties>
+
+ <build>
+ <plugins>
+ <plugin>
+ <artifactId>maven-source-plugin</artifactId>
+ <executions>
+ <execution>
+ <id>attach-source</id>
+ <goals>
+ <goal>jar</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+ <plugin>
+ <groupId>org.codehaus.mojo</groupId>
+ <artifactId>build-helper-maven-plugin</artifactId>
+ <executions>
+ <execution>
+ <id>add-source</id>
+ <phase>generate-sources</phase>
+ <goals>
+ <goal>add-source</goal>
+ </goals>
+ <configuration>
+ <sources>
+ <source>
+ ${project.build.directory}/generated-sources/myfaces-impl
+ </source>
+ </sources>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
+ <plugin>
+ <groupId>org.apache.myfaces.buildtools</groupId>
+ <artifactId>myfaces-builder-plugin</artifactId>
+ <executions>
+ <execution>
+ <id>unpack-impl-test</id>
+ <phase>generate-sources</phase>
+ <goals>
+ <goal>unpack</goal>
+ </goals>
+ <configuration>
+ <scanModel>false</scanModel>
+ <artifactItems>
+ <artifactItem>
+ <groupId>org.apache.myfaces.core</groupId>
+ <artifactId>myfaces-impl</artifactId>
+ <version>${project.version}</version>
+ <classifier>test-sources</classifier>
+ <outputDirectory>${project.build.directory}/generated-sources/myfaces-impl</outputDirectory>
+ <includes>org/apache/myfaces/mc/**/*.java</includes>
+ <excludes>**/*.class,**/META-INF/**</excludes>
+ </artifactItem>
+ </artifactItems>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+ <dependencies>
+ <!-- include myfaces-api and myfaces-impl in the bundle -->
+ <dependency>
+ <groupId>org.apache.myfaces.core</groupId>
+ <artifactId>myfaces-api</artifactId>
+ <scope>provided</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.myfaces.core</groupId>
+ <artifactId>myfaces-impl</artifactId>
+ <scope>provided</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.myfaces.test</groupId>
+ <artifactId>myfaces-test22</artifactId>
+ <scope>provided</scope>
+ </dependency>
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <scope>provided</scope>
+ </dependency>
+
+ <!-- Servlet 3.0 by default. Use the -Pee5 compile for servlet-2.5 -->
+ <dependency>
+ <groupId>org.apache.geronimo.specs</groupId>
+ <artifactId>geronimo-servlet_3.0_spec</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.geronimo.specs</groupId>
+ <artifactId>geronimo-el_2.2_spec</artifactId>
+ </dependency>
+
+ <!-- Openwebbeans for CDI Test -->
+ <dependency>
+ <groupId>org.apache.geronimo.specs</groupId>
+ <artifactId>geronimo-interceptor_1.1_spec</artifactId>
+ <version>1.0</version>
+ <scope>provided</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.openwebbeans</groupId>
+ <artifactId>openwebbeans-impl</artifactId>
+ <version>${openwebbeans.version}</version>
+ <optional>true</optional>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.openwebbeans</groupId>
+ <artifactId>openwebbeans-jsf</artifactId>
+ <version>${openwebbeans.version}</version>
+ <optional>true</optional>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.openwebbeans</groupId>
+ <artifactId>openwebbeans-web</artifactId>
+ <version>${openwebbeans.version}</version>
+ <optional>true</optional>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.openwebbeans</groupId>
+ <artifactId>openwebbeans-spi</artifactId>
+ <version>${openwebbeans.version}</version>
+ <optional>true</optional>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.openwebbeans</groupId>
+ <artifactId>openwebbeans-resource</artifactId>
+ <version>${openwebbeans.version}</version>
+ <optional>true</optional>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.openwebbeans</groupId>
+ <artifactId>openwebbeans-clustering</artifactId>
+ <version>${openwebbeans.version}</version>
+ <optional>true</optional>
+ </dependency>
+ </dependencies>
+
+</project>
Propchange: myfaces/core/trunk/impl-test/pom.xml
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: myfaces/core/trunk/impl-test/src/
------------------------------------------------------------------------------
bugtraq:number = true
Propchange: myfaces/core/trunk/impl-test/src/main/
------------------------------------------------------------------------------
bugtraq:number = true
Propchange: myfaces/core/trunk/impl-test/src/main/java/
------------------------------------------------------------------------------
bugtraq:number = true
Modified: myfaces/core/trunk/impl/pom.xml
URL: http://svn.apache.org/viewvc/myfaces/core/trunk/impl/pom.xml?rev=1561418&r1=1561417&r2=1561418&view=diff
==============================================================================
--- myfaces/core/trunk/impl/pom.xml (original)
+++ myfaces/core/trunk/impl/pom.xml Sat Jan 25 22:54:34 2014
@@ -57,6 +57,24 @@
<plugins>
+ <plugin>
+ <artifactId>maven-source-plugin</artifactId>
+ <executions>
+ <execution>
+ <id>attach-source</id>
+ <goals>
+ <goal>jar</goal>
+ </goals>
+ </execution>
+ <execution>
+ <id>attach-test-source</id>
+ <goals>
+ <goal>test-jar</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+
<!-- license checker needs to exclude some kinds of files -->
<plugin>
<groupId>org.apache.rat</groupId>
Modified: myfaces/core/trunk/impl/src/test/java/org/apache/myfaces/application/contracts/ContractsCreateResourceMyFacesRequestTestCase.java
URL: http://svn.apache.org/viewvc/myfaces/core/trunk/impl/src/test/java/org/apache/myfaces/application/contracts/ContractsCreateResourceMyFacesRequestTestCase.java?rev=1561418&r1=1561417&r2=1561418&view=diff
==============================================================================
--- myfaces/core/trunk/impl/src/test/java/org/apache/myfaces/application/contracts/ContractsCreateResourceMyFacesRequestTestCase.java (original)
+++ myfaces/core/trunk/impl/src/test/java/org/apache/myfaces/application/contracts/ContractsCreateResourceMyFacesRequestTestCase.java Sat Jan 25 22:54:34 2014
@@ -55,7 +55,7 @@ public class ContractsCreateResourceMyFa
@Test
public void testDefaultConfiguration() throws Exception
{
- setupRequest("/index.xhtml");
+ startViewRequest("/index.xhtml");
RuntimeConfig runtimeConfig = RuntimeConfig.getCurrentInstance(externalContext);
Set<String> allContracts = runtimeConfig.getResourceLibraryContracts();
@@ -93,7 +93,7 @@ public class ContractsCreateResourceMyFa
Resource resource2 = resourceHandler.createResource("myjs.js", "mylib");
Assert.assertNotNull(resource2);
- tearDownRequest();
+ endRequest();
}
}
Modified: myfaces/core/trunk/impl/src/test/java/org/apache/myfaces/application/contracts/DefaultContractsConfigMyFacesRequestTestCase.java
URL: http://svn.apache.org/viewvc/myfaces/core/trunk/impl/src/test/java/org/apache/myfaces/application/contracts/DefaultContractsConfigMyFacesRequestTestCase.java?rev=1561418&r1=1561417&r2=1561418&view=diff
==============================================================================
--- myfaces/core/trunk/impl/src/test/java/org/apache/myfaces/application/contracts/DefaultContractsConfigMyFacesRequestTestCase.java (original)
+++ myfaces/core/trunk/impl/src/test/java/org/apache/myfaces/application/contracts/DefaultContractsConfigMyFacesRequestTestCase.java Sat Jan 25 22:54:34 2014
@@ -51,7 +51,7 @@ public class DefaultContractsConfigMyFac
@Test
public void testDefaultConfiguration() throws Exception
{
- setupRequest("/index.xhtml");
+ startViewRequest("/index.xhtml");
RuntimeConfig runtimeConfig = RuntimeConfig.getCurrentInstance(externalContext);
Set<String> allContracts = runtimeConfig.getResourceLibraryContracts();
@@ -80,7 +80,7 @@ public class DefaultContractsConfigMyFac
Assert.assertTrue(contractsList.contains("blue"));
Assert.assertTrue(contractsList.contains("red"));
- tearDownRequest();
+ endRequest();
}
}
Modified: myfaces/core/trunk/impl/src/test/java/org/apache/myfaces/application/contracts/SingleContractMyFacesRequestTestCase.java
URL: http://svn.apache.org/viewvc/myfaces/core/trunk/impl/src/test/java/org/apache/myfaces/application/contracts/SingleContractMyFacesRequestTestCase.java?rev=1561418&r1=1561417&r2=1561418&view=diff
==============================================================================
--- myfaces/core/trunk/impl/src/test/java/org/apache/myfaces/application/contracts/SingleContractMyFacesRequestTestCase.java (original)
+++ myfaces/core/trunk/impl/src/test/java/org/apache/myfaces/application/contracts/SingleContractMyFacesRequestTestCase.java Sat Jan 25 22:54:34 2014
@@ -57,7 +57,7 @@ public class SingleContractMyFacesReques
@Test
public void testDefaultConfiguration() throws Exception
{
- setupRequest("/index.xhtml");
+ startViewRequest("/index.xhtml");
RuntimeConfig runtimeConfig = RuntimeConfig.getCurrentInstance(externalContext);
Set<String> allContracts = runtimeConfig.getResourceLibraryContracts();
@@ -81,13 +81,13 @@ public class SingleContractMyFacesReques
executeViewHandlerRender(facesContext);
executeAfterRender(facesContext);
- tearDownRequest();
+ endRequest();
}
@Test
public void testView1() throws Exception
{
- setupRequest("/view_1.xhtml");
+ startViewRequest("/view_1.xhtml");
processLifecycleExecute();
executeBuildViewCycle(facesContext);
@@ -99,7 +99,7 @@ public class SingleContractMyFacesReques
executeAfterRender(facesContext);
UICommand submitButton = (UICommand) facesContext.getViewRoot().findComponent("mainForm:submit");
- submit(submitButton);
+ client.submit(submitButton);
processLifecycleExecute();
@@ -110,7 +110,7 @@ public class SingleContractMyFacesReques
@Test
public void testView2() throws Exception
{
- setupRequest("/view_2.xhtml");
+ startViewRequest("/view_2.xhtml");
processLifecycleExecute();
executeBuildViewCycle(facesContext);
@@ -121,7 +121,7 @@ public class SingleContractMyFacesReques
executeAfterRender(facesContext);
UICommand submitButton = (UICommand) facesContext.getViewRoot().findComponent("mainForm:submit");
- submit(submitButton);
+ client.submit(submitButton);
processLifecycleExecute();
@@ -132,7 +132,7 @@ public class SingleContractMyFacesReques
@Test
public void testView3() throws Exception
{
- setupRequest("/view_3.xhtml");
+ startViewRequest("/view_3.xhtml");
processLifecycleExecute();
executeBuildViewCycle(facesContext);
@@ -143,7 +143,7 @@ public class SingleContractMyFacesReques
executeAfterRender(facesContext);
UICommand submitButton = (UICommand) facesContext.getViewRoot().findComponent("mainForm:submit");
- submit(submitButton);
+ client.submit(submitButton);
processLifecycleExecute();
@@ -154,7 +154,7 @@ public class SingleContractMyFacesReques
@Test
public void testView1_3() throws Exception
{
- setupRequest("/view_1.xhtml");
+ startViewRequest("/view_1.xhtml");
processLifecycleExecute();
executeBuildViewCycle(facesContext);
@@ -168,9 +168,9 @@ public class SingleContractMyFacesReques
String content1 = new String(writer1.content());
Assert.assertTrue(content1.contains("header_yellow"));
- tearDownRequest();
+ endRequest();
- setupRequest("/view_3.xhtml");
+ startViewRequest("/view_3.xhtml");
processLifecycleExecute();
executeBuildViewCycle(facesContext);
@@ -185,6 +185,6 @@ public class SingleContractMyFacesReques
executeAfterRender(facesContext);
- tearDownRequest();
+ endRequest();
}
}
Modified: myfaces/core/trunk/impl/src/test/java/org/apache/myfaces/application/flow/FlowMyFacesCDIRequestTestCase.java
URL: http://svn.apache.org/viewvc/myfaces/core/trunk/impl/src/test/java/org/apache/myfaces/application/flow/FlowMyFacesCDIRequestTestCase.java?rev=1561418&r1=1561417&r2=1561418&view=diff
==============================================================================
--- myfaces/core/trunk/impl/src/test/java/org/apache/myfaces/application/flow/FlowMyFacesCDIRequestTestCase.java (original)
+++ myfaces/core/trunk/impl/src/test/java/org/apache/myfaces/application/flow/FlowMyFacesCDIRequestTestCase.java Sat Jan 25 22:54:34 2014
@@ -18,17 +18,12 @@
*/
package org.apache.myfaces.application.flow;
-import javax.el.ExpressionFactory;
import javax.enterprise.context.ContextNotActiveException;
-import javax.enterprise.inject.spi.BeanManager;
import javax.faces.application.ConfigurableNavigationHandler;
import javax.faces.application.NavigationCase;
import javax.faces.application.StateManager;
import javax.faces.component.UICommand;
import javax.faces.flow.Flow;
-import javax.faces.flow.FlowHandler;
-import javax.faces.render.ResponseStateManager;
-import org.apache.myfaces.cdi.util.CDIUtils;
import org.apache.myfaces.mc.test.core.AbstractMyFacesCDIRequestTestCase;
import org.apache.myfaces.shared.config.MyfacesConfig;
import org.junit.Test;
@@ -62,7 +57,7 @@ public class FlowMyFacesCDIRequestTestCa
@Test
public void testFlow1_1() throws Exception
{
- setupRequest("/flow1_1.xhtml");
+ startViewRequest("/flow1_1.xhtml");
processLifecycleExecute();
ConfigurableNavigationHandler handler = (ConfigurableNavigationHandler) facesContext.getApplication().getNavigationHandler();
@@ -78,11 +73,11 @@ public class FlowMyFacesCDIRequestTestCa
// Check begin view node
Assert.assertEquals("/flow1/begin.xhtml", navCase.getToViewId(facesContext));
- processRender();
+ renderResponse();
//Enter flow 1
UICommand button = (UICommand) facesContext.getViewRoot().findComponent("mainForm:startFlow1");
- submit(button);
+ client.submit(button);
processLifecycleExecute();
@@ -103,7 +98,7 @@ public class FlowMyFacesCDIRequestTestCa
@Test
public void testFlow1_2() throws Exception
{
- setupRequest("/flow1_2.xhtml");
+ startViewRequest("/flow1_2.xhtml");
processLifecycleExecute();
ConfigurableNavigationHandler handler = (ConfigurableNavigationHandler) facesContext.getApplication().getNavigationHandler();
@@ -119,11 +114,11 @@ public class FlowMyFacesCDIRequestTestCa
// Check begin view node
Assert.assertEquals("/flow1/begin.xhtml", navCase.getToViewId(facesContext));
- processRender();
+ renderResponse();
//Enter flow 1
UICommand button = (UICommand) facesContext.getViewRoot().findComponent("mainForm:startFlow1");
- submit(button);
+ client.submit(button);
processLifecycleExecute();
@@ -140,10 +135,10 @@ public class FlowMyFacesCDIRequestTestCa
Assert.assertEquals(bean1.getPostConstructCalled(), "true");
bean1.setName("John");
- processRender();
+ renderResponse();
UICommand button2 = (UICommand) facesContext.getViewRoot().findComponent("mainForm:call_flow2");
- submit(button2);
+ client.submit(button2);
processLifecycleExecute();
@@ -168,15 +163,15 @@ public class FlowMyFacesCDIRequestTestCa
Assert.assertEquals(bean2_1.getPostConstructCalled(), "true");
Assert.assertNotNull(bean2_1.getFlow1Bean());
- processRender();
+ renderResponse();
//Check current view is the begin of flow2
Assert.assertEquals("/flow2/begin.xhtml", facesContext.getViewRoot().getViewId());
UICommand button3 = (UICommand) facesContext.getViewRoot().findComponent("mainForm:content");
- submit(button3);
+ client.submit(button3);
processLifecycleExecute();
- processRender();
+ renderResponse();
currentFlow = facesContext.getApplication().getFlowHandler().getCurrentFlow(facesContext);
Assert.assertNotNull(currentFlow);
@@ -186,7 +181,7 @@ public class FlowMyFacesCDIRequestTestCa
Assert.assertNotNull(endCase);
UICommand button4 = (UICommand) facesContext.getViewRoot().findComponent("mainForm:end_flow");
- submit(button4);
+ client.submit(button4);
processLifecycleExecute();
Modified: myfaces/core/trunk/impl/src/test/java/org/apache/myfaces/application/flow/FlowMyFacesRequestTestCase.java
URL: http://svn.apache.org/viewvc/myfaces/core/trunk/impl/src/test/java/org/apache/myfaces/application/flow/FlowMyFacesRequestTestCase.java?rev=1561418&r1=1561417&r2=1561418&view=diff
==============================================================================
--- myfaces/core/trunk/impl/src/test/java/org/apache/myfaces/application/flow/FlowMyFacesRequestTestCase.java (original)
+++ myfaces/core/trunk/impl/src/test/java/org/apache/myfaces/application/flow/FlowMyFacesRequestTestCase.java Sat Jan 25 22:54:34 2014
@@ -59,7 +59,7 @@ public class FlowMyFacesRequestTestCase
@Test
public void testFlow1_1() throws Exception
{
- setupRequest("/flow1_1.xhtml");
+ startViewRequest("/flow1_1.xhtml");
processLifecycleExecute();
ConfigurableNavigationHandler handler = (ConfigurableNavigationHandler) facesContext.getApplication().getNavigationHandler();
@@ -75,11 +75,11 @@ public class FlowMyFacesRequestTestCase
// Check begin view node
Assert.assertEquals("/flow1/begin.xhtml", navCase.getToViewId(facesContext));
- processRender();
+ renderResponse();
//Enter flow 1
UICommand button = (UICommand) facesContext.getViewRoot().findComponent("mainForm:startFlow1");
- submit(button);
+ client.submit(button);
processLifecycleExecute();
@@ -94,7 +94,7 @@ public class FlowMyFacesRequestTestCase
@Test
public void testFlow1_2() throws Exception
{
- setupRequest("/flow1_2.xhtml");
+ startViewRequest("/flow1_2.xhtml");
processLifecycleExecute();
ConfigurableNavigationHandler handler = (ConfigurableNavigationHandler) facesContext.getApplication().getNavigationHandler();
@@ -110,11 +110,11 @@ public class FlowMyFacesRequestTestCase
// Check begin view node
Assert.assertEquals("/flow1/begin.xhtml", navCase.getToViewId(facesContext));
- processRender();
+ renderResponse();
//Enter flow 1
UICommand button = (UICommand) facesContext.getViewRoot().findComponent("mainForm:startFlow1");
- submit(button);
+ client.submit(button);
processLifecycleExecute();
@@ -124,10 +124,10 @@ public class FlowMyFacesRequestTestCase
facesContext.getApplication().getFlowHandler().getCurrentFlowScope().put("flow1","value1");
- processRender();
+ renderResponse();
UICommand button2 = (UICommand) facesContext.getViewRoot().findComponent("mainForm:call_flow2");
- submit(button2);
+ client.submit(button2);
processLifecycleExecute();
@@ -137,15 +137,15 @@ public class FlowMyFacesRequestTestCase
Assert.assertFalse(facesContext.getApplication().getFlowHandler().getCurrentFlowScope().containsKey("flow1"));
facesContext.getApplication().getFlowHandler().getCurrentFlowScope().put("flow2","value2");
- processRender();
+ renderResponse();
//Check current view is the begin of flow2
Assert.assertEquals("/flow2/begin.xhtml", facesContext.getViewRoot().getViewId());
UICommand button3 = (UICommand) facesContext.getViewRoot().findComponent("mainForm:content");
- submit(button3);
+ client.submit(button3);
processLifecycleExecute();
- processRender();
+ renderResponse();
currentFlow = facesContext.getApplication().getFlowHandler().getCurrentFlow(facesContext);
Assert.assertNotNull(currentFlow);
@@ -155,7 +155,7 @@ public class FlowMyFacesRequestTestCase
Assert.assertNotNull(endCase);
UICommand button4 = (UICommand) facesContext.getViewRoot().findComponent("mainForm:end_flow");
- submit(button4);
+ client.submit(button4);
processLifecycleExecute();
@@ -170,7 +170,7 @@ public class FlowMyFacesRequestTestCase
@Test
public void testFlow1_3() throws Exception
{
- setupRequest("/flow1_2.xhtml");
+ startViewRequest("/flow1_2.xhtml");
processLifecycleExecute();
ConfigurableNavigationHandler handler = (ConfigurableNavigationHandler) facesContext.getApplication().getNavigationHandler();
@@ -186,11 +186,11 @@ public class FlowMyFacesRequestTestCase
// Check begin view node
Assert.assertEquals("/flow1/begin.xhtml", navCase.getToViewId(facesContext));
- processRender();
+ renderResponse();
//Enter flow 1
UICommand button = (UICommand) facesContext.getViewRoot().findComponent("mainForm:startFlow1");
- submit(button);
+ client.submit(button);
processLifecycleExecute();
@@ -200,10 +200,10 @@ public class FlowMyFacesRequestTestCase
facesContext.getApplication().getFlowHandler().getCurrentFlowScope().put("flow1","value1");
- processRender();
+ renderResponse();
UICommand button2 = (UICommand) facesContext.getViewRoot().findComponent("mainForm:call_flow2");
- submit(button2);
+ client.submit(button2);
processLifecycleExecute();
@@ -213,15 +213,15 @@ public class FlowMyFacesRequestTestCase
Assert.assertFalse(facesContext.getApplication().getFlowHandler().getCurrentFlowScope().containsKey("flow1"));
facesContext.getApplication().getFlowHandler().getCurrentFlowScope().put("flow2","value2");
- processRender();
+ renderResponse();
//Check current view is the begin of flow2
Assert.assertEquals("/flow2/begin.xhtml", facesContext.getViewRoot().getViewId());
UICommand button3 = (UICommand) facesContext.getViewRoot().findComponent("mainForm:content");
- submit(button3);
+ client.submit(button3);
processLifecycleExecute();
- processRender();
+ renderResponse();
currentFlow = facesContext.getApplication().getFlowHandler().getCurrentFlow(facesContext);
Assert.assertNotNull(currentFlow);
@@ -231,7 +231,7 @@ public class FlowMyFacesRequestTestCase
Assert.assertNotNull(endCase);
UICommand button4 = (UICommand) facesContext.getViewRoot().findComponent("mainForm:back_flow");
- submit(button4);
+ client.submit(button4);
processLifecycleExecute();
@@ -243,13 +243,13 @@ public class FlowMyFacesRequestTestCase
// Check lastDisplayedViewId
Assert.assertEquals("/flow1/begin.xhtml", facesContext.getViewRoot().getViewId());
- processRender();
+ renderResponse();
endCase = handler.getNavigationCase(facesContext, null, "back");
Assert.assertNotNull(endCase);
UICommand button5 = (UICommand) facesContext.getViewRoot().findComponent("mainForm:back_flow");
- submit(button5);
+ client.submit(button5);
processLifecycleExecute();
@@ -262,7 +262,7 @@ public class FlowMyFacesRequestTestCase
@Test
public void testFlow1_4() throws Exception
{
- setupRequest("/flow1_2.xhtml");
+ startViewRequest("/flow1_2.xhtml");
processLifecycleExecute();
ConfigurableNavigationHandler handler = (ConfigurableNavigationHandler) facesContext.getApplication().getNavigationHandler();
@@ -274,11 +274,11 @@ public class FlowMyFacesRequestTestCase
// Check begin view node
Assert.assertEquals("/flow1/begin.xhtml", navCase.getToViewId(facesContext));
- processRender();
+ renderResponse();
//Enter flow 1
UICommand button = (UICommand) facesContext.getViewRoot().findComponent("mainForm:startFlow1");
- submit(button);
+ client.submit(button);
processLifecycleExecute();
@@ -288,10 +288,10 @@ public class FlowMyFacesRequestTestCase
facesContext.getApplication().getFlowHandler().getCurrentFlowScope().put("flow1","value1");
- processRender();
+ renderResponse();
UICommand button2 = (UICommand) facesContext.getViewRoot().findComponent("mainForm:call_flow2");
- submit(button2);
+ client.submit(button2);
processLifecycleExecute();
@@ -301,15 +301,15 @@ public class FlowMyFacesRequestTestCase
Assert.assertFalse(facesContext.getApplication().getFlowHandler().getCurrentFlowScope().containsKey("flow1"));
facesContext.getApplication().getFlowHandler().getCurrentFlowScope().put("flow2","value2");
- processRender();
+ renderResponse();
//Check current view is the begin of flow2
Assert.assertEquals("/flow2/begin.xhtml", facesContext.getViewRoot().getViewId());
UICommand button3 = (UICommand) facesContext.getViewRoot().findComponent("mainForm:content");
- submit(button3);
+ client.submit(button3);
processLifecycleExecute();
- processRender();
+ renderResponse();
currentFlow = facesContext.getApplication().getFlowHandler().getCurrentFlow(facesContext);
Assert.assertNotNull(currentFlow);
@@ -321,8 +321,8 @@ public class FlowMyFacesRequestTestCase
String fromOutcome = endCase.getFromOutcome();
String clientWindowId = facesContext.getExternalContext().getClientWindow().getId();
- tearDownRequest();
- setupRequest(toViewId);
+ endRequest();
+ startViewRequest(toViewId);
request.addParameter(FlowHandler.TO_FLOW_DOCUMENT_ID_REQUEST_PARAM_NAME, FlowHandler.NULL_FLOW);
request.addParameter(FlowHandler.FLOW_ID_REQUEST_PARAM_NAME, fromOutcome);
request.addParameter(ResponseStateManager.CLIENT_WINDOW_URL_PARAM, clientWindowId);
@@ -337,7 +337,7 @@ public class FlowMyFacesRequestTestCase
// Check lastDisplayedViewId
//Assert.assertEquals("/flow1/begin.xhtml", facesContext.getViewRoot().getViewId());
- processRender();
+ renderResponse();
endCase = handler.getNavigationCase(facesContext, null, "back");
Assert.assertNotNull(endCase);
@@ -346,8 +346,8 @@ public class FlowMyFacesRequestTestCase
fromOutcome = endCase.getFromOutcome();
clientWindowId = facesContext.getExternalContext().getClientWindow().getId();
- tearDownRequest();
- setupRequest(toViewId);
+ endRequest();
+ startViewRequest(toViewId);
request.addParameter(FlowHandler.TO_FLOW_DOCUMENT_ID_REQUEST_PARAM_NAME, FlowHandler.NULL_FLOW);
request.addParameter(FlowHandler.FLOW_ID_REQUEST_PARAM_NAME, fromOutcome);
request.addParameter(ResponseStateManager.CLIENT_WINDOW_URL_PARAM, clientWindowId);
@@ -362,7 +362,7 @@ public class FlowMyFacesRequestTestCase
@Test
public void testFlow1_5() throws Exception
{
- setupRequest("/flow1_2.xhtml");
+ startViewRequest("/flow1_2.xhtml");
processLifecycleExecute();
ConfigurableNavigationHandler handler = (ConfigurableNavigationHandler) facesContext.getApplication().getNavigationHandler();
@@ -374,10 +374,10 @@ public class FlowMyFacesRequestTestCase
// Check begin view node
Assert.assertEquals("/flow1/begin.xhtml", navCase.getToViewId(facesContext));
- processRender();
+ renderResponse();
String clientWindowId = facesContext.getExternalContext().getClientWindow().getId();
- setupRequest(navCase.getToViewId(facesContext));
+ startViewRequest(navCase.getToViewId(facesContext));
request.addParameter(FlowHandler.TO_FLOW_DOCUMENT_ID_REQUEST_PARAM_NAME, navCase.getToFlowDocumentId());
request.addParameter(FlowHandler.FLOW_ID_REQUEST_PARAM_NAME, navCase.getFromOutcome());
request.addParameter(ResponseStateManager.CLIENT_WINDOW_URL_PARAM, clientWindowId);
@@ -394,7 +394,7 @@ public class FlowMyFacesRequestTestCase
facesContext.getApplication().getFlowHandler().getCurrentFlowScope().put("flow1","value1");
- processRender();
+ renderResponse();
//UICommand button2 = (UICommand) facesContext.getViewRoot().findComponent("mainForm:call_flow2");
//submit(button2);
@@ -402,7 +402,7 @@ public class FlowMyFacesRequestTestCase
clientWindowId = facesContext.getExternalContext().getClientWindow().getId();
- setupRequest(navCase.getToViewId(facesContext));
+ startViewRequest(navCase.getToViewId(facesContext));
request.addParameter(FlowHandler.TO_FLOW_DOCUMENT_ID_REQUEST_PARAM_NAME, navCase.getToFlowDocumentId());
request.addParameter(FlowHandler.FLOW_ID_REQUEST_PARAM_NAME, navCase.getFromOutcome());
request.addParameter(ResponseStateManager.CLIENT_WINDOW_URL_PARAM, clientWindowId);
@@ -415,15 +415,15 @@ public class FlowMyFacesRequestTestCase
Assert.assertFalse(facesContext.getApplication().getFlowHandler().getCurrentFlowScope().containsKey("flow1"));
facesContext.getApplication().getFlowHandler().getCurrentFlowScope().put("flow2","value2");
- processRender();
+ renderResponse();
//Check current view is the begin of flow2
Assert.assertEquals("/flow2/begin.xhtml", facesContext.getViewRoot().getViewId());
UICommand button3 = (UICommand) facesContext.getViewRoot().findComponent("mainForm:content");
- submit(button3);
+ client.submit(button3);
processLifecycleExecute();
- processRender();
+ renderResponse();
currentFlow = facesContext.getApplication().getFlowHandler().getCurrentFlow(facesContext);
Assert.assertNotNull(currentFlow);
@@ -435,8 +435,8 @@ public class FlowMyFacesRequestTestCase
String fromOutcome = endCase.getFromOutcome();
clientWindowId = facesContext.getExternalContext().getClientWindow().getId();
- tearDownRequest();
- setupRequest(toViewId);
+ endRequest();
+ startViewRequest(toViewId);
request.addParameter(FlowHandler.TO_FLOW_DOCUMENT_ID_REQUEST_PARAM_NAME, FlowHandler.NULL_FLOW);
request.addParameter(FlowHandler.FLOW_ID_REQUEST_PARAM_NAME, fromOutcome);
request.addParameter(ResponseStateManager.CLIENT_WINDOW_URL_PARAM, clientWindowId);
@@ -451,7 +451,7 @@ public class FlowMyFacesRequestTestCase
// Check lastDisplayedViewId (since it was GET, it should be the start viewId)
Assert.assertEquals("/flow2/begin.xhtml", facesContext.getViewRoot().getViewId());
- processRender();
+ renderResponse();
endCase = handler.getNavigationCase(facesContext, null, "switchBack");
Assert.assertNotNull(endCase);
@@ -462,8 +462,8 @@ public class FlowMyFacesRequestTestCase
fromOutcome = endCase.getFromOutcome();
clientWindowId = facesContext.getExternalContext().getClientWindow().getId();
- tearDownRequest();
- setupRequest(toViewId);
+ endRequest();
+ startViewRequest(toViewId);
request.addParameter(FlowHandler.TO_FLOW_DOCUMENT_ID_REQUEST_PARAM_NAME, FlowHandler.NULL_FLOW);
request.addParameter(FlowHandler.FLOW_ID_REQUEST_PARAM_NAME, fromOutcome);
request.addParameter(ResponseStateManager.CLIENT_WINDOW_URL_PARAM, clientWindowId);
@@ -496,7 +496,7 @@ public class FlowMyFacesRequestTestCase
@Test
public void testFlow1_6() throws Exception
{
- setupRequest("/flow_base.xhtml");
+ startViewRequest("/flow_base.xhtml");
processLifecycleExecute();
ConfigurableNavigationHandler handler = (ConfigurableNavigationHandler) facesContext.getApplication().getNavigationHandler();
@@ -508,11 +508,11 @@ public class FlowMyFacesRequestTestCase
// Check begin view node
Assert.assertEquals("/flow1/begin.xhtml", navCase.getToViewId(facesContext));
- processRender();
+ renderResponse();
//Enter flow 1
UICommand button = (UICommand) facesContext.getViewRoot().findComponent("mainForm:startFlow1");
- submit(button);
+ client.submit(button);
processLifecycleExecute();
@@ -520,22 +520,22 @@ public class FlowMyFacesRequestTestCase
Assert.assertNotNull(currentFlow);
Assert.assertEquals(currentFlow.getId(), "flow1");
- processRender();
+ renderResponse();
NavigationCase goFlowBase = handler.getNavigationCase(facesContext, null, "flow_base");
Assert.assertNotNull(goFlowBase);
UICommand button2 = (UICommand) facesContext.getViewRoot().findComponent("mainForm:go_flow_base");
- submit(button2);
+ client.submit(button2);
processLifecycleExecute();
Assert.assertEquals("/flow_base.xhtml", facesContext.getViewRoot().getViewId());
- processRender();
+ renderResponse();
UICommand button3 = (UICommand) facesContext.getViewRoot().findComponent("mainForm:startFlow2");
- submit(button3);
+ client.submit(button3);
processLifecycleExecute();
@@ -543,19 +543,19 @@ public class FlowMyFacesRequestTestCase
Assert.assertNotNull(currentFlow2);
Assert.assertEquals(currentFlow2.getId(), "flow2");
- processRender();
+ renderResponse();
UICommand button4 = (UICommand) facesContext.getViewRoot().findComponent("mainForm:go_flow_base");
- submit(button4);
+ client.submit(button4);
processLifecycleExecute();
Assert.assertEquals("/flow_base.xhtml", facesContext.getViewRoot().getViewId());
- processRender();
+ renderResponse();
UICommand button5 = (UICommand) facesContext.getViewRoot().findComponent("mainForm:returnFlow1");
- submit(button5);
+ client.submit(button5);
processLifecycleExecute();
@@ -565,17 +565,17 @@ public class FlowMyFacesRequestTestCase
Assert.assertNotNull(currentFlow3);
Assert.assertEquals(currentFlow3.getId(), "flow2");
- processRender();
+ renderResponse();
UICommand button6 = (UICommand) facesContext.getViewRoot().findComponent("mainForm:returnFlow2");
- submit(button6);
+ client.submit(button6);
processLifecycleExecute();
Flow currentFlow4 = facesContext.getApplication().getFlowHandler().getCurrentFlow(facesContext);
Assert.assertNull(currentFlow4);
- processRender();
+ renderResponse();
}
/**
@@ -592,7 +592,7 @@ public class FlowMyFacesRequestTestCase
@Test
public void testFlow1_7() throws Exception
{
- setupRequest("/flow_base.xhtml");
+ startViewRequest("/flow_base.xhtml");
processLifecycleExecute();
ConfigurableNavigationHandler handler = (ConfigurableNavigationHandler) facesContext.getApplication().getNavigationHandler();
@@ -604,11 +604,11 @@ public class FlowMyFacesRequestTestCase
// Check begin view node
Assert.assertEquals("/flow1/begin.xhtml", navCase.getToViewId(facesContext));
- processRender();
+ renderResponse();
//Enter flow 1
UICommand button = (UICommand) facesContext.getViewRoot().findComponent("mainForm:startFlow1");
- submit(button);
+ client.submit(button);
processLifecycleExecute();
@@ -616,10 +616,10 @@ public class FlowMyFacesRequestTestCase
Assert.assertNotNull(currentFlow);
Assert.assertEquals(currentFlow.getId(), "flow1");
- processRender();
+ renderResponse();
UICommand button3 = (UICommand) facesContext.getViewRoot().findComponent("mainForm:call_flow2");
- submit(button3);
+ client.submit(button3);
processLifecycleExecute();
@@ -627,19 +627,19 @@ public class FlowMyFacesRequestTestCase
Assert.assertNotNull(currentFlow2);
Assert.assertEquals(currentFlow2.getId(), "flow2");
- processRender();
+ renderResponse();
UICommand button4 = (UICommand) facesContext.getViewRoot().findComponent("mainForm:go_flow_base");
- submit(button4);
+ client.submit(button4);
processLifecycleExecute();
Assert.assertEquals("/flow_base.xhtml", facesContext.getViewRoot().getViewId());
- processRender();
+ renderResponse();
UICommand button5 = (UICommand) facesContext.getViewRoot().findComponent("mainForm:returnFlow1");
- submit(button5);
+ client.submit(button5);
processLifecycleExecute();
@@ -665,16 +665,16 @@ public class FlowMyFacesRequestTestCase
@Test
public void testFlow1_8() throws Exception
{
- setupRequest("/flow_base.xhtml");
+ startViewRequest("/flow_base.xhtml");
processLifecycleExecute();
ConfigurableNavigationHandler handler = (ConfigurableNavigationHandler) facesContext.getApplication().getNavigationHandler();
- processRender();
+ renderResponse();
//Enter flow 1
UICommand button = (UICommand) facesContext.getViewRoot().findComponent("mainForm:startFlow3");
- submit(button);
+ client.submit(button);
processLifecycleExecute();
@@ -682,10 +682,10 @@ public class FlowMyFacesRequestTestCase
Assert.assertNotNull(currentFlow);
Assert.assertEquals(currentFlow.getId(), "flow1");
- processRender();
+ renderResponse();
UICommand button3 = (UICommand) facesContext.getViewRoot().findComponent("mainForm:call_flow2");
- submit(button3);
+ client.submit(button3);
processLifecycleExecute();
@@ -693,19 +693,19 @@ public class FlowMyFacesRequestTestCase
Assert.assertNotNull(currentFlow2);
Assert.assertEquals(currentFlow2.getId(), "flow2");
- processRender();
+ renderResponse();
UICommand button4 = (UICommand) facesContext.getViewRoot().findComponent("mainForm:go_flow_base");
- submit(button4);
+ client.submit(button4);
processLifecycleExecute();
Assert.assertEquals("/flow_base.xhtml", facesContext.getViewRoot().getViewId());
- processRender();
+ renderResponse();
UICommand button5 = (UICommand) facesContext.getViewRoot().findComponent("mainForm:returnFlow1");
- submit(button5);
+ client.submit(button5);
processLifecycleExecute();
@@ -729,16 +729,16 @@ public class FlowMyFacesRequestTestCase
@Test
public void testFlow1_9() throws Exception
{
- setupRequest("/flow_base.xhtml");
+ startViewRequest("/flow_base.xhtml");
processLifecycleExecute();
ConfigurableNavigationHandler handler = (ConfigurableNavigationHandler) facesContext.getApplication().getNavigationHandler();
- processRender();
+ renderResponse();
//Enter flow 1
UICommand button = (UICommand) facesContext.getViewRoot().findComponent("mainForm:startFlow2");
- submit(button);
+ client.submit(button);
processLifecycleExecute();
@@ -746,22 +746,22 @@ public class FlowMyFacesRequestTestCase
Assert.assertNotNull(currentFlow);
Assert.assertEquals(currentFlow.getId(), "flow2");
- processRender();
+ renderResponse();
NavigationCase goFlowBase = handler.getNavigationCase(facesContext, null, "flow_base");
Assert.assertNotNull(goFlowBase);
UICommand button2 = (UICommand) facesContext.getViewRoot().findComponent("mainForm:go_flow_base");
- submit(button2);
+ client.submit(button2);
processLifecycleExecute();
Assert.assertEquals("/flow_base.xhtml", facesContext.getViewRoot().getViewId());
- processRender();
+ renderResponse();
UICommand button3 = (UICommand) facesContext.getViewRoot().findComponent("mainForm:startFlow3");
- submit(button3);
+ client.submit(button3);
processLifecycleExecute();
@@ -769,19 +769,19 @@ public class FlowMyFacesRequestTestCase
Assert.assertNotNull(currentFlow2);
Assert.assertEquals(currentFlow2.getId(), "flow1");
- processRender();
+ renderResponse();
UICommand button4 = (UICommand) facesContext.getViewRoot().findComponent("mainForm:go_flow_base");
- submit(button4);
+ client.submit(button4);
processLifecycleExecute();
Assert.assertEquals("/flow_base.xhtml", facesContext.getViewRoot().getViewId());
- processRender();
+ renderResponse();
UICommand button5 = (UICommand) facesContext.getViewRoot().findComponent("mainForm:returnFlow1_3");
- submit(button5);
+ client.submit(button5);
processLifecycleExecute();
@@ -791,17 +791,17 @@ public class FlowMyFacesRequestTestCase
Assert.assertNotNull(currentFlow3);
Assert.assertEquals(currentFlow3.getId(), "flow2");
- processRender();
+ renderResponse();
UICommand button6 = (UICommand) facesContext.getViewRoot().findComponent("mainForm:returnFlow2");
- submit(button6);
+ client.submit(button6);
processLifecycleExecute();
Flow currentFlow4 = facesContext.getApplication().getFlowHandler().getCurrentFlow(facesContext);
Assert.assertNull(currentFlow4);
- processRender();
+ renderResponse();
}
/**
@@ -817,16 +817,16 @@ public class FlowMyFacesRequestTestCase
@Test
public void testFlow1_9_1() throws Exception
{
- setupRequest("/flow_base.xhtml");
+ startViewRequest("/flow_base.xhtml");
processLifecycleExecute();
ConfigurableNavigationHandler handler = (ConfigurableNavigationHandler) facesContext.getApplication().getNavigationHandler();
- processRender();
+ renderResponse();
//Enter flow 1
UICommand button = (UICommand) facesContext.getViewRoot().findComponent("mainForm:startFlow2");
- submit(button);
+ client.submit(button);
processLifecycleExecute();
@@ -834,22 +834,22 @@ public class FlowMyFacesRequestTestCase
Assert.assertNotNull(currentFlow);
Assert.assertEquals(currentFlow.getId(), "flow2");
- processRender();
+ renderResponse();
NavigationCase goFlowBase = handler.getNavigationCase(facesContext, null, "flow_base");
Assert.assertNotNull(goFlowBase);
UICommand button2 = (UICommand) facesContext.getViewRoot().findComponent("mainForm:go_flow_base");
- submit(button2);
+ client.submit(button2);
processLifecycleExecute();
Assert.assertEquals("/flow_base.xhtml", facesContext.getViewRoot().getViewId());
- processRender();
+ renderResponse();
UICommand button3 = (UICommand) facesContext.getViewRoot().findComponent("mainForm:startFlow3");
- submit(button3);
+ client.submit(button3);
processLifecycleExecute();
@@ -857,16 +857,16 @@ public class FlowMyFacesRequestTestCase
Assert.assertNotNull(currentFlow2);
Assert.assertEquals(currentFlow2.getId(), "flow1");
- processRender();
+ renderResponse();
UICommand button4 = (UICommand) facesContext.getViewRoot().findComponent("mainForm:go_flow_base");
- submit(button4);
+ client.submit(button4);
processLifecycleExecute();
Assert.assertEquals("/flow_base.xhtml", facesContext.getViewRoot().getViewId());
- processRender();
+ renderResponse();
//UICommand button5 = (UICommand) facesContext.getViewRoot().findComponent("mainForm:returnFlow1_3");
//submit(button5);
@@ -880,8 +880,8 @@ public class FlowMyFacesRequestTestCase
String fromOutcome = endCase.getFromOutcome();
String clientWindowId = facesContext.getExternalContext().getClientWindow().getId();
- tearDownRequest();
- setupRequest(toViewId);
+ endRequest();
+ startViewRequest(toViewId);
request.addParameter(FlowHandler.TO_FLOW_DOCUMENT_ID_REQUEST_PARAM_NAME, FlowHandler.NULL_FLOW);
request.addParameter(FlowHandler.FLOW_ID_REQUEST_PARAM_NAME, fromOutcome);
request.addParameter(ResponseStateManager.CLIENT_WINDOW_URL_PARAM, clientWindowId);
@@ -894,17 +894,17 @@ public class FlowMyFacesRequestTestCase
Assert.assertNotNull(currentFlow3);
Assert.assertEquals(currentFlow3.getId(), "flow2");
- processRender();
+ renderResponse();
UICommand button6 = (UICommand) facesContext.getViewRoot().findComponent("mainForm:returnFlow2");
- submit(button6);
+ client.submit(button6);
processLifecycleExecute();
Flow currentFlow4 = facesContext.getApplication().getFlowHandler().getCurrentFlow(facesContext);
Assert.assertNull(currentFlow4);
- processRender();
+ renderResponse();
}
@@ -921,16 +921,16 @@ public class FlowMyFacesRequestTestCase
@Test
public void testFlow1_10() throws Exception
{
- setupRequest("/flow_base.xhtml");
+ startViewRequest("/flow_base.xhtml");
processLifecycleExecute();
ConfigurableNavigationHandler handler = (ConfigurableNavigationHandler) facesContext.getApplication().getNavigationHandler();
- processRender();
+ renderResponse();
//Enter flow 1
UICommand button = (UICommand) facesContext.getViewRoot().findComponent("mainForm:startFlow3");
- submit(button);
+ client.submit(button);
processLifecycleExecute();
@@ -938,22 +938,22 @@ public class FlowMyFacesRequestTestCase
Assert.assertNotNull(currentFlow);
Assert.assertEquals(currentFlow.getId(), "flow1");
- processRender();
+ renderResponse();
NavigationCase goFlowBase = handler.getNavigationCase(facesContext, null, "flow_base");
Assert.assertNotNull(goFlowBase);
UICommand button2 = (UICommand) facesContext.getViewRoot().findComponent("mainForm:go_flow_base");
- submit(button2);
+ client.submit(button2);
processLifecycleExecute();
Assert.assertEquals("/flow_base.xhtml", facesContext.getViewRoot().getViewId());
- processRender();
+ renderResponse();
UICommand button3 = (UICommand) facesContext.getViewRoot().findComponent("mainForm:startFlow2");
- submit(button3);
+ client.submit(button3);
processLifecycleExecute();
@@ -961,19 +961,19 @@ public class FlowMyFacesRequestTestCase
Assert.assertNotNull(currentFlow2);
Assert.assertEquals(currentFlow2.getId(), "flow2");
- processRender();
+ renderResponse();
UICommand button4 = (UICommand) facesContext.getViewRoot().findComponent("mainForm:go_flow_base");
- submit(button4);
+ client.submit(button4);
processLifecycleExecute();
Assert.assertEquals("/flow_base.xhtml", facesContext.getViewRoot().getViewId());
- processRender();
+ renderResponse();
UICommand button5 = (UICommand) facesContext.getViewRoot().findComponent("mainForm:returnFlow2");
- submit(button5);
+ client.submit(button5);
processLifecycleExecute();
@@ -983,17 +983,17 @@ public class FlowMyFacesRequestTestCase
Assert.assertNotNull(currentFlow3);
Assert.assertEquals(currentFlow3.getId(), "flow1");
- processRender();
+ renderResponse();
UICommand button6 = (UICommand) facesContext.getViewRoot().findComponent("mainForm:returnFlow1_3");
- submit(button6);
+ client.submit(button6);
processLifecycleExecute();
Flow currentFlow4 = facesContext.getApplication().getFlowHandler().getCurrentFlow(facesContext);
Assert.assertNull(currentFlow4);
- processRender();
+ renderResponse();
}
/**
@@ -1009,16 +1009,16 @@ public class FlowMyFacesRequestTestCase
@Test
public void testFlow1_10_1() throws Exception
{
- setupRequest("/flow_base.xhtml");
+ startViewRequest("/flow_base.xhtml");
processLifecycleExecute();
ConfigurableNavigationHandler handler = (ConfigurableNavigationHandler) facesContext.getApplication().getNavigationHandler();
- processRender();
+ renderResponse();
//Enter flow 1
UICommand button = (UICommand) facesContext.getViewRoot().findComponent("mainForm:startFlow3");
- submit(button);
+ client.submit(button);
processLifecycleExecute();
@@ -1026,22 +1026,22 @@ public class FlowMyFacesRequestTestCase
Assert.assertNotNull(currentFlow);
Assert.assertEquals(currentFlow.getId(), "flow1");
- processRender();
+ renderResponse();
NavigationCase goFlowBase = handler.getNavigationCase(facesContext, null, "flow_base");
Assert.assertNotNull(goFlowBase);
UICommand button2 = (UICommand) facesContext.getViewRoot().findComponent("mainForm:go_flow_base");
- submit(button2);
+ client.submit(button2);
processLifecycleExecute();
Assert.assertEquals("/flow_base.xhtml", facesContext.getViewRoot().getViewId());
- processRender();
+ renderResponse();
UICommand button3 = (UICommand) facesContext.getViewRoot().findComponent("mainForm:startFlow2");
- submit(button3);
+ client.submit(button3);
processLifecycleExecute();
@@ -1049,19 +1049,19 @@ public class FlowMyFacesRequestTestCase
Assert.assertNotNull(currentFlow2);
Assert.assertEquals(currentFlow2.getId(), "flow2");
- processRender();
+ renderResponse();
UICommand button4 = (UICommand) facesContext.getViewRoot().findComponent("mainForm:go_flow_base");
- submit(button4);
+ client.submit(button4);
processLifecycleExecute();
Assert.assertEquals("/flow_base.xhtml", facesContext.getViewRoot().getViewId());
- processRender();
+ renderResponse();
UICommand button5 = (UICommand) facesContext.getViewRoot().findComponent("mainForm:returnFlow1_3");
- submit(button5);
+ client.submit(button5);
processLifecycleExecute();
@@ -1071,17 +1071,17 @@ public class FlowMyFacesRequestTestCase
Assert.assertNotNull(currentFlow3);
Assert.assertEquals(currentFlow3.getId(), "flow2");
- processRender();
+ renderResponse();
UICommand button6 = (UICommand) facesContext.getViewRoot().findComponent("mainForm:returnFlow2");
- submit(button6);
+ client.submit(button6);
processLifecycleExecute();
Flow currentFlow4 = facesContext.getApplication().getFlowHandler().getCurrentFlow(facesContext);
Assert.assertNull(currentFlow4);
- processRender();
+ renderResponse();
}
/**
@@ -1097,16 +1097,16 @@ public class FlowMyFacesRequestTestCase
@Test
public void testFlow1_10_2() throws Exception
{
- setupRequest("/flow_base.xhtml");
+ startViewRequest("/flow_base.xhtml");
processLifecycleExecute();
ConfigurableNavigationHandler handler = (ConfigurableNavigationHandler) facesContext.getApplication().getNavigationHandler();
- processRender();
+ renderResponse();
//Enter flow 1
UICommand button = (UICommand) facesContext.getViewRoot().findComponent("mainForm:startFlow3");
- submit(button);
+ client.submit(button);
processLifecycleExecute();
@@ -1114,22 +1114,22 @@ public class FlowMyFacesRequestTestCase
Assert.assertNotNull(currentFlow);
Assert.assertEquals(currentFlow.getId(), "flow1");
- processRender();
+ renderResponse();
NavigationCase goFlowBase = handler.getNavigationCase(facesContext, null, "flow_base");
Assert.assertNotNull(goFlowBase);
UICommand button2 = (UICommand) facesContext.getViewRoot().findComponent("mainForm:go_flow_base");
- submit(button2);
+ client.submit(button2);
processLifecycleExecute();
Assert.assertEquals("/flow_base.xhtml", facesContext.getViewRoot().getViewId());
- processRender();
+ renderResponse();
UICommand button3 = (UICommand) facesContext.getViewRoot().findComponent("mainForm:startFlow2");
- submit(button3);
+ client.submit(button3);
processLifecycleExecute();
@@ -1137,16 +1137,16 @@ public class FlowMyFacesRequestTestCase
Assert.assertNotNull(currentFlow2);
Assert.assertEquals(currentFlow2.getId(), "flow2");
- processRender();
+ renderResponse();
UICommand button4 = (UICommand) facesContext.getViewRoot().findComponent("mainForm:go_flow_base");
- submit(button4);
+ client.submit(button4);
processLifecycleExecute();
Assert.assertEquals("/flow_base.xhtml", facesContext.getViewRoot().getViewId());
- processRender();
+ renderResponse();
//UICommand button5 = (UICommand) facesContext.getViewRoot().findComponent("mainForm:returnFlow1_3");
//submit(button5);
@@ -1159,8 +1159,8 @@ public class FlowMyFacesRequestTestCase
String fromOutcome = endCase.getFromOutcome();
String clientWindowId = facesContext.getExternalContext().getClientWindow().getId();
- tearDownRequest();
- setupRequest(toViewId);
+ endRequest();
+ startViewRequest(toViewId);
request.addParameter(FlowHandler.TO_FLOW_DOCUMENT_ID_REQUEST_PARAM_NAME, FlowHandler.NULL_FLOW);
request.addParameter(FlowHandler.FLOW_ID_REQUEST_PARAM_NAME, fromOutcome);
request.addParameter(ResponseStateManager.CLIENT_WINDOW_URL_PARAM, clientWindowId);
@@ -1173,17 +1173,17 @@ public class FlowMyFacesRequestTestCase
Assert.assertNotNull(currentFlow3);
Assert.assertEquals(currentFlow3.getId(), "flow2");
- processRender();
+ renderResponse();
UICommand button6 = (UICommand) facesContext.getViewRoot().findComponent("mainForm:returnFlow2");
- submit(button6);
+ client.submit(button6);
processLifecycleExecute();
Flow currentFlow4 = facesContext.getApplication().getFlowHandler().getCurrentFlow(facesContext);
Assert.assertNull(currentFlow4);
- processRender();
+ renderResponse();
}
/**
@@ -1200,16 +1200,16 @@ public class FlowMyFacesRequestTestCase
@Test
public void testFlow1_11() throws Exception
{
- setupRequest("/flow_base.xhtml");
+ startViewRequest("/flow_base.xhtml");
processLifecycleExecute();
ConfigurableNavigationHandler handler = (ConfigurableNavigationHandler) facesContext.getApplication().getNavigationHandler();
- processRender();
+ renderResponse();
//Enter flow 1
UICommand button = (UICommand) facesContext.getViewRoot().findComponent("mainForm:startFlow4");
- submit(button);
+ client.submit(button);
processLifecycleExecute();
@@ -1219,22 +1219,22 @@ public class FlowMyFacesRequestTestCase
Assert.assertNotNull(currentFlow);
Assert.assertEquals(currentFlow.getId(), "flow4");
- processRender();
+ renderResponse();
NavigationCase goFlowBase = handler.getNavigationCase(facesContext, null, "flow_base");
Assert.assertNotNull(goFlowBase);
UICommand button2 = (UICommand) facesContext.getViewRoot().findComponent("mainForm:go_flow_base");
- submit(button2);
+ client.submit(button2);
processLifecycleExecute();
Assert.assertEquals("/flow_base.xhtml", facesContext.getViewRoot().getViewId());
- processRender();
+ renderResponse();
UICommand button3 = (UICommand) facesContext.getViewRoot().findComponent("mainForm:startFlow2");
- submit(button3);
+ client.submit(button3);
processLifecycleExecute();
@@ -1242,19 +1242,19 @@ public class FlowMyFacesRequestTestCase
Assert.assertNotNull(currentFlow2);
Assert.assertEquals(currentFlow2.getId(), "flow2");
- processRender();
+ renderResponse();
UICommand button4 = (UICommand) facesContext.getViewRoot().findComponent("mainForm:go_flow_base");
- submit(button4);
+ client.submit(button4);
processLifecycleExecute();
Assert.assertEquals("/flow_base.xhtml", facesContext.getViewRoot().getViewId());
- processRender();
+ renderResponse();
UICommand button5 = (UICommand) facesContext.getViewRoot().findComponent("mainForm:startFlow1_4");
- submit(button5);
+ client.submit(button5);
processLifecycleExecute();
@@ -1262,20 +1262,20 @@ public class FlowMyFacesRequestTestCase
Assert.assertNotNull(currentFlow3);
Assert.assertEquals(currentFlow3.getId(), "flow1");
- processRender();
+ renderResponse();
UICommand button6 = (UICommand) facesContext.getViewRoot().findComponent("mainForm:go_flow_base");
- submit(button6);
+ client.submit(button6);
processLifecycleExecute();
Assert.assertEquals("/flow_base.xhtml", facesContext.getViewRoot().getViewId());
- processRender();
+ renderResponse();
UICommand button7 = (UICommand) facesContext.getViewRoot().findComponent("mainForm:returnFlow1_4");
- submit(button7);
+ client.submit(button7);
processLifecycleExecute();
@@ -1285,17 +1285,17 @@ public class FlowMyFacesRequestTestCase
Assert.assertNotNull(currentFlow4);
Assert.assertEquals(currentFlow4.getId(), "flow2");
- processRender();
+ renderResponse();
UICommand button8 = (UICommand) facesContext.getViewRoot().findComponent("mainForm:returnFlow2");
- submit(button8);
+ client.submit(button8);
processLifecycleExecute();
Flow currentFlow5 = facesContext.getApplication().getFlowHandler().getCurrentFlow(facesContext);
Assert.assertNull(currentFlow5);
- processRender();
+ renderResponse();
}
@@ -1313,16 +1313,16 @@ public class FlowMyFacesRequestTestCase
@Test
public void testFlow1_11_1() throws Exception
{
- setupRequest("/flow_base.xhtml");
+ startViewRequest("/flow_base.xhtml");
processLifecycleExecute();
ConfigurableNavigationHandler handler = (ConfigurableNavigationHandler) facesContext.getApplication().getNavigationHandler();
- processRender();
+ renderResponse();
//Enter flow 1
UICommand button = (UICommand) facesContext.getViewRoot().findComponent("mainForm:startFlow4");
- submit(button);
+ client.submit(button);
processLifecycleExecute();
@@ -1332,22 +1332,22 @@ public class FlowMyFacesRequestTestCase
Assert.assertNotNull(currentFlow);
Assert.assertEquals(currentFlow.getId(), "flow4");
- processRender();
+ renderResponse();
NavigationCase goFlowBase = handler.getNavigationCase(facesContext, null, "flow_base");
Assert.assertNotNull(goFlowBase);
UICommand button2 = (UICommand) facesContext.getViewRoot().findComponent("mainForm:go_flow_base");
- submit(button2);
+ client.submit(button2);
processLifecycleExecute();
Assert.assertEquals("/flow_base.xhtml", facesContext.getViewRoot().getViewId());
- processRender();
+ renderResponse();
UICommand button3 = (UICommand) facesContext.getViewRoot().findComponent("mainForm:startFlow2");
- submit(button3);
+ client.submit(button3);
processLifecycleExecute();
@@ -1355,19 +1355,19 @@ public class FlowMyFacesRequestTestCase
Assert.assertNotNull(currentFlow2);
Assert.assertEquals(currentFlow2.getId(), "flow2");
- processRender();
+ renderResponse();
UICommand button4 = (UICommand) facesContext.getViewRoot().findComponent("mainForm:go_flow_base");
- submit(button4);
+ client.submit(button4);
processLifecycleExecute();
Assert.assertEquals("/flow_base.xhtml", facesContext.getViewRoot().getViewId());
- processRender();
+ renderResponse();
UICommand button5 = (UICommand) facesContext.getViewRoot().findComponent("mainForm:startFlow1_4");
- submit(button5);
+ client.submit(button5);
processLifecycleExecute();
@@ -1375,16 +1375,16 @@ public class FlowMyFacesRequestTestCase
Assert.assertNotNull(currentFlow3);
Assert.assertEquals(currentFlow3.getId(), "flow1");
- processRender();
+ renderResponse();
UICommand button6 = (UICommand) facesContext.getViewRoot().findComponent("mainForm:go_flow_base");
- submit(button6);
+ client.submit(button6);
processLifecycleExecute();
Assert.assertEquals("/flow_base.xhtml", facesContext.getViewRoot().getViewId());
- processRender();
+ renderResponse();
//UICommand button7 = (UICommand) facesContext.getViewRoot().findComponent("mainForm:returnFlow1_4");
//submit(button7);
@@ -1398,8 +1398,8 @@ public class FlowMyFacesRequestTestCase
String fromOutcome = endCase.getFromOutcome();
String clientWindowId = facesContext.getExternalContext().getClientWindow().getId();
- tearDownRequest();
- setupRequest(toViewId);
+ endRequest();
+ startViewRequest(toViewId);
request.addParameter(FlowHandler.TO_FLOW_DOCUMENT_ID_REQUEST_PARAM_NAME, FlowHandler.NULL_FLOW);
request.addParameter(FlowHandler.FLOW_ID_REQUEST_PARAM_NAME, fromOutcome);
request.addParameter(ResponseStateManager.CLIENT_WINDOW_URL_PARAM, clientWindowId);
@@ -1412,17 +1412,17 @@ public class FlowMyFacesRequestTestCase
Assert.assertNotNull(currentFlow4);
Assert.assertEquals(currentFlow4.getId(), "flow2");
- processRender();
+ renderResponse();
UICommand button8 = (UICommand) facesContext.getViewRoot().findComponent("mainForm:returnFlow2");
- submit(button8);
+ client.submit(button8);
processLifecycleExecute();
Flow currentFlow5 = facesContext.getApplication().getFlowHandler().getCurrentFlow(facesContext);
Assert.assertNull(currentFlow5);
- processRender();
+ renderResponse();
}
}
Modified: myfaces/core/trunk/impl/src/test/java/org/apache/myfaces/event/PostAddToViewEventTestCase.java
URL: http://svn.apache.org/viewvc/myfaces/core/trunk/impl/src/test/java/org/apache/myfaces/event/PostAddToViewEventTestCase.java?rev=1561418&r1=1561417&r2=1561418&view=diff
==============================================================================
--- myfaces/core/trunk/impl/src/test/java/org/apache/myfaces/event/PostAddToViewEventTestCase.java (original)
+++ myfaces/core/trunk/impl/src/test/java/org/apache/myfaces/event/PostAddToViewEventTestCase.java Sat Jan 25 22:54:34 2014
@@ -56,7 +56,7 @@ public class PostAddToViewEventTestCase
@Test
public void testPostAddToViewOnViewRoot() throws Exception
{
- setupRequest("/postAddToViewEvent_1.xhtml");
+ startViewRequest("/postAddToViewEvent_1.xhtml");
PostAddToViewEventBean bean = EasyMock.createMock(PostAddToViewEventBean.class);
bean.invokePostAddToViewEvent(EasyMock.isA(ComponentSystemEvent.class));
@@ -78,7 +78,7 @@ public class PostAddToViewEventTestCase
EasyMock.verify(bean);
UICommand button = (UICommand) facesContext.getViewRoot().findComponent("mainForm:submit");
- submit(button);
+ client.submit(button);
bean = EasyMock.createMock(PostAddToViewEventBean.class);
bean.invokePostAddToViewEvent(EasyMock.isA(ComponentSystemEvent.class));
@@ -134,7 +134,7 @@ public class PostAddToViewEventTestCase
@Test
public void testPostAddToViewOnComponent() throws Exception
{
- setupRequest("/postAddToViewEvent_2.xhtml");
+ startViewRequest("/postAddToViewEvent_2.xhtml");
PostAddToViewEventBean bean = EasyMock.createMock(PostAddToViewEventBean.class);
bean.invokePostAddToViewEvent(EasyMock.isA(ComponentSystemEvent.class));
@@ -156,7 +156,7 @@ public class PostAddToViewEventTestCase
EasyMock.verify(bean);
UICommand button = (UICommand) facesContext.getViewRoot().findComponent("mainForm:submit");
- submit(button);
+ client.submit(button);
bean = EasyMock.createMock(PostAddToViewEventBean.class);
bean.invokePostAddToViewEvent(EasyMock.isA(ComponentSystemEvent.class));
@@ -207,7 +207,7 @@ public class PostAddToViewEventTestCase
@Test
public void testPostAddToViewOnComponentCif() throws Exception
{
- setupRequest("/postAddToViewEvent_3.xhtml");
+ startViewRequest("/postAddToViewEvent_3.xhtml");
PostAddToViewEventBean bean = EasyMock.createMock(PostAddToViewEventBean.class);
bean.invokePostAddToViewEvent(EasyMock.isA(ComponentSystemEvent.class));
@@ -227,7 +227,7 @@ public class PostAddToViewEventTestCase
EasyMock.verify(bean);
UICommand button = (UICommand) facesContext.getViewRoot().findComponent("mainForm:submit");
- submit(button);
+ client.submit(button);
bean = EasyMock.createMock(PostAddToViewEventBean.class);
bean.invokePostAddToViewEvent(EasyMock.isA(ComponentSystemEvent.class));
@@ -263,7 +263,7 @@ public class PostAddToViewEventTestCase
request.setAttribute("postAddToViewEventBean", bean);
request.setAttribute("condition", Boolean.TRUE);
- processRender();
+ renderResponse();
EasyMock.verify(bean);
}
}
Added: myfaces/core/trunk/impl/src/test/java/org/apache/myfaces/lifecycle/MyFacesRequestJUnitTestCase.java
URL: http://svn.apache.org/viewvc/myfaces/core/trunk/impl/src/test/java/org/apache/myfaces/lifecycle/MyFacesRequestJUnitTestCase.java?rev=1561418&view=auto
==============================================================================
--- myfaces/core/trunk/impl/src/test/java/org/apache/myfaces/lifecycle/MyFacesRequestJUnitTestCase.java (added)
+++ myfaces/core/trunk/impl/src/test/java/org/apache/myfaces/lifecycle/MyFacesRequestJUnitTestCase.java Sat Jan 25 22:54:34 2014
@@ -0,0 +1,44 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.myfaces.lifecycle;
+
+import javax.faces.component.UIComponent;
+import org.apache.myfaces.mc.test.core.AbstractMyFacesRequestTestCase;
+import org.junit.Assert;
+import org.junit.Test;
+
+/**
+ * This class test
+ */
+public class MyFacesRequestJUnitTestCase extends AbstractMyFacesRequestTestCase
+{
+ @Test
+ public void testRedirect1() throws Exception
+ {
+ startViewRequest("/redirect1.xhtml");
+ processLifecycleExecute();
+ renderResponse();
+ client.submit("mainForm:submit");
+ processLifecycleExecuteAndRender();
+ client.processRedirect();
+ processLifecycleExecuteAndRender();
+ String redirectedContent = getRenderedContent();
+ Assert.assertTrue(redirectedContent.contains("Redirected Page"));
+ }
+}
Propchange: myfaces/core/trunk/impl/src/test/java/org/apache/myfaces/lifecycle/MyFacesRequestJUnitTestCase.java
------------------------------------------------------------------------------
svn:eol-style = native
Modified: myfaces/core/trunk/impl/src/test/java/org/apache/myfaces/mc/test/core/AbstractMyFacesCDIRequestTestCase.java
URL: http://svn.apache.org/viewvc/myfaces/core/trunk/impl/src/test/java/org/apache/myfaces/mc/test/core/AbstractMyFacesCDIRequestTestCase.java?rev=1561418&r1=1561417&r2=1561418&view=diff
==============================================================================
--- myfaces/core/trunk/impl/src/test/java/org/apache/myfaces/mc/test/core/AbstractMyFacesCDIRequestTestCase.java (original)
+++ myfaces/core/trunk/impl/src/test/java/org/apache/myfaces/mc/test/core/AbstractMyFacesCDIRequestTestCase.java Sat Jan 25 22:54:34 2014
@@ -18,10 +18,14 @@
*/
package org.apache.myfaces.mc.test.core;
-import javax.servlet.ServletContextEvent;
-import javax.servlet.ServletRequestEvent;
-import javax.servlet.http.HttpSessionEvent;
+import javax.faces.FacesException;
+import javax.faces.context.ExternalContext;
+import javax.servlet.ServletContext;
+import org.apache.myfaces.spi.InjectionProvider;
+import org.apache.myfaces.spi.InjectionProviderException;
+import org.apache.myfaces.spi.InjectionProviderFactory;
import org.apache.myfaces.spi.impl.CDIAnnotationDelegateInjectionProvider;
+import org.apache.myfaces.webapp.AbstractFacesInitializer;
import org.apache.webbeans.servlet.WebBeansConfigurationListener;
/**
@@ -30,8 +34,10 @@ import org.apache.webbeans.servlet.WebBe
public class AbstractMyFacesCDIRequestTestCase extends AbstractMyFacesRequestTestCase
{
- private WebBeansConfigurationListener owbListener;
-
+ protected WebBeansConfigurationListener owbListener;
+ protected InjectionProvider injectionProvider;
+
+ @Override
protected void setUpWebConfigParams() throws Exception
{
super.setUpWebConfigParams();
@@ -43,7 +49,7 @@ public class AbstractMyFacesCDIRequestTe
protected void setUpServletListeners() throws Exception
{
owbListener = new WebBeansConfigurationListener();
- owbListener.contextInitialized(new ServletContextEvent(servletContext));
+ webContainer.subscribeListener(owbListener);
super.setUpServletListeners();
}
@@ -51,22 +57,57 @@ public class AbstractMyFacesCDIRequestTe
protected void tearDownServletListeners() throws Exception
{
super.tearDownServletListeners();
- owbListener.contextDestroyed(new ServletContextEvent(servletContext));
+ owbListener = null;
}
@Override
- protected void setupRequest(String pathInfo, String query) throws Exception
+ protected AbstractFacesInitializer createFacesInitializer()
{
- owbListener.requestInitialized(new ServletRequestEvent(servletContext, request));
- super.setupRequest(pathInfo, query);
- owbListener.sessionCreated(new HttpSessionEvent(session));
+ return new CDIJUnitFacesInitializer(this);
}
-
- @Override
- protected void tearDownRequest()
+
+ protected class CDIJUnitFacesInitializer extends AbstractMyFacesTestCase.JUnitFacesInitializer
{
- super.tearDownRequest();
- owbListener.requestDestroyed(new ServletRequestEvent(servletContext, request));
- }
+ private Object testCaseCreationMetadata;
+ public CDIJUnitFacesInitializer(AbstractMyFacesTestCase testCase)
+ {
+ super(testCase);
+ }
+
+ @Override
+ protected void initContainerIntegration(ServletContext servletContext, ExternalContext externalContext)
+ {
+ super.initContainerIntegration(servletContext, externalContext);
+
+ InjectionProviderFactory ipf = InjectionProviderFactory.getInjectionProviderFactory();
+ injectionProvider = ipf.getInjectionProvider(externalContext);
+ AbstractMyFacesTestCase testCase = getTestCase();
+ try
+ {
+ testCaseCreationMetadata = injectionProvider.inject(testCase);
+ injectionProvider.postConstruct(testCase, testCaseCreationMetadata);
+ }
+ catch (InjectionProviderException ex)
+ {
+ throw new FacesException("Cannot inject JUnit Test case", ex);
+ }
+ }
+
+ @Override
+ public void destroyFaces(ServletContext servletContext)
+ {
+ try
+ {
+ injectionProvider.preDestroy(getTestCase(), testCaseCreationMetadata);
+ }
+ catch (InjectionProviderException ex)
+ {
+ throw new FacesException("Cannot call @PreDestroy over inject JUnit Test case", ex);
+ }
+ super.destroyFaces(servletContext);
+ }
+
+
+ }
}
Modified: myfaces/core/trunk/impl/src/test/java/org/apache/myfaces/mc/test/core/AbstractMyFacesFaceletsTestCase.java
URL: http://svn.apache.org/viewvc/myfaces/core/trunk/impl/src/test/java/org/apache/myfaces/mc/test/core/AbstractMyFacesFaceletsTestCase.java?rev=1561418&r1=1561417&r2=1561418&view=diff
==============================================================================
--- myfaces/core/trunk/impl/src/test/java/org/apache/myfaces/mc/test/core/AbstractMyFacesFaceletsTestCase.java (original)
+++ myfaces/core/trunk/impl/src/test/java/org/apache/myfaces/mc/test/core/AbstractMyFacesFaceletsTestCase.java Sat Jan 25 22:54:34 2014
@@ -20,13 +20,15 @@ package org.apache.myfaces.mc.test.core;
import javax.faces.FactoryFinder;
import javax.faces.component.UIViewRoot;
+import javax.faces.event.PhaseId;
import javax.faces.view.ViewDeclarationLanguageFactory;
/**
* <p>Abstract JUnit test case base class, which provide a var called vdl, that
* can be used to build facelet views calling for example:</p>
* <p>vdl.buildView(facesContext, facesContext.getViewRoot(), "/hello.xhtml");</p>
- * <p>It already set up a request.</p>
+ * <p>It already initalize a request, and keep in mind there is no any lifecycle
+ * execution. This test case is used to check the view structure.</p>
*
* @author Leonardo Uribe
*
@@ -38,31 +40,39 @@ public abstract class AbstractMyFacesFac
{
super.setUp();
- setupFaceletRequest();
-
setUpVDL();
+
+ startFaceletRequest();
}
- protected void setUpVDL() throws Exception
+ protected void setUpVDL()
{
- ViewDeclarationLanguageFactory vdlFactory = (ViewDeclarationLanguageFactory) FactoryFinder.getFactory(FactoryFinder.VIEW_DECLARATION_LANGUAGE_FACTORY);
- vdl = (MockMyFacesFaceletViewDeclarationLanguage) vdlFactory.getViewDeclarationLanguage("/a.xhtml");
+ ViewDeclarationLanguageFactory vdlFactory = (ViewDeclarationLanguageFactory)
+ FactoryFinder.getFactory(FactoryFinder.VIEW_DECLARATION_LANGUAGE_FACTORY);
+ vdl = (MockMyFacesFaceletViewDeclarationLanguage)
+ vdlFactory.getViewDeclarationLanguage("/a.xhtml");
}
- protected void setupFaceletRequest() throws Exception
+ /**
+ * Initialize a request providing an empty UIViewRoot without enter into the
+ * lifecycle.
+ */
+ public void startFaceletRequest()
{
- setupRequest();
+ startRequest();
// Create a new UIViewRoot to work with it later
UIViewRoot root = new UIViewRoot();
root.setViewId("/test");
root.setRenderKitId("HTML_BASIC");
facesContext.setViewRoot(root);
+ // Set the current phase to render response.
+ facesContext.setCurrentPhaseId(PhaseId.RENDER_RESPONSE);
}
@Override
public void tearDown() throws Exception
{
- tearDownRequest();
+ endRequest();
super.tearDown();
}