From seam-commits at lists.jboss.org Thu Aug 23 06:07:12 2012 Content-Type: multipart/mixed; boundary="===============6685526397027826290==" MIME-Version: 1.0 From: seam-commits at lists.jboss.org To: seam-commits at lists.jboss.org Subject: [seam-commits] Seam SVN: r15066 - branches/community/Seam_2_3/seam-integration-tests/src/test/java/org/jboss/seam/test/integration/faces. Date: Thu, 23 Aug 2012 06:07:12 -0400 Message-ID: <201208231007.q7NA7CDN023222@svn01.web.mwc.hst.phx2.redhat.com> --===============6685526397027826290== Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Author: maschmid Date: 2012-08-23 06:07:12 -0400 (Thu, 23 Aug 2012) New Revision: 15066 Added: branches/community/Seam_2_3/seam-integration-tests/src/test/java/org/jbo= ss/seam/test/integration/faces/BoundComponentConversationTest.java Log: Test for JBSEAM-5020 Added: branches/community/Seam_2_3/seam-integration-tests/src/test/java/org= /jboss/seam/test/integration/faces/BoundComponentConversationTest.java =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- branches/community/Seam_2_3/seam-integration-tests/src/test/java/org/jb= oss/seam/test/integration/faces/BoundComponentConversationTest.java = (rev 0) +++ branches/community/Seam_2_3/seam-integration-tests/src/test/java/org/jb= oss/seam/test/integration/faces/BoundComponentConversationTest.java 2012-08= -23 10:07:12 UTC (rev 15066) @@ -0,0 +1,130 @@ +package org.jboss.seam.test.integration.faces; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertTrue; + +import java.io.Serializable; +import java.net.URL; +import java.util.regex.Matcher; +import java.util.regex.Pattern; + +import javax.faces.component.UIInput; + +import org.jboss.arquillian.container.test.api.Deployment; +import org.jboss.arquillian.container.test.api.OverProtocol; +import org.jboss.arquillian.container.test.api.RunAsClient; +import org.jboss.arquillian.junit.Arquillian; +import org.jboss.arquillian.test.api.ArquillianResource; +import org.jboss.seam.ScopeType; +import org.jboss.seam.annotations.Begin; +import org.jboss.seam.annotations.Create; +import org.jboss.seam.annotations.Name; +import org.jboss.seam.annotations.Scope; +import org.jboss.seam.test.integration.Deployments; +import org.jboss.shrinkwrap.api.Archive; +import org.jboss.shrinkwrap.api.asset.StringAsset; +import org.junit.Ignore; +import org.junit.Test; +import org.junit.runner.RunWith; + +import com.gargoylesoftware.htmlunit.WebClient; +import com.gargoylesoftware.htmlunit.html.HtmlPage; + + +// JBSEAM-5020 +(a)RunWith(Arquillian.class) +(a)RunAsClient +public class BoundComponentConversationTest +{ + private final WebClient client =3D new WebClient(); + = + @ArquillianResource + URL contextPath; + = + @Deployment(name=3D"BoundComponentConversationTest") + @OverProtocol("Servlet 3.0") = + public static Archive createDeployment() + { + // This is a client test, use a real (non-mocked) Seam deployment + return Deployments.realSeamDeployment() + .addClasses(MyComponent.class, MyBackingBean.class) + .addAsWebResource(new StringAsset( + "" + + "" + + "" + + "" + + "" + + "" + + "" + + "" + + "" + = + ""), "test.xhtml"); + } + = + @Ignore + @Test + public void testConversationRestoration() throws Exception + { + Pattern conversationIdPattern =3D Pattern.compile("Conversation id: = (\\d+)\\."); + HtmlPage page =3D client.getPage(contextPath + "test.seam"); + = + Matcher conversationIdMatcher =3D conversationIdPattern.matcher(page= .getBody().getTextContent()); + assertTrue(conversationIdMatcher.find()); + = + String firstConversationId =3D conversationIdMatcher.group(1); + + page =3D page.getElementById("form:test").click(); + = + conversationIdMatcher =3D conversationIdPattern.matcher(page.getBody= ().getTextContent()); + assertTrue(conversationIdMatcher.find()); + = + String secondConversationId =3D conversationIdMatcher.group(1); + assertEquals(firstConversationId, secondConversationId); + } + = + @Scope(ScopeType.CONVERSATION) + @Name("myComponent") + public static class MyComponent implements Serializable + { + private static final long serialVersionUID =3D 1L; + = + public String value; + = + @Create + @Begin + public void begin() + { + } + + public String getValue() + { + return value; + } + = + public void setValue(String value) + { + this.value =3D value; + } + = + } + = + @Scope(ScopeType.EVENT) + @Name("myBackingBean") + public static class MyBackingBean = + { + private UIInput input; + + public UIInput getInput() + { + return input; + } + = + public void setInput(UIInput input) + { + this.input =3D input; + } + } +} --===============6685526397027826290==--