From seam-commits at lists.jboss.org Tue Feb 19 11:04:21 2013
Content-Type: multipart/mixed; boundary="===============2441244349132630771=="
MIME-Version: 1.0
From: seam-commits at lists.jboss.org
To: seam-commits at lists.jboss.org
Subject: [seam-commits] Seam SVN: r15405 -
branches/enterprise/WFK-2_1/seam-integration-tests/src/test/java/org/jboss/seam/test/integration/faces.
Date: Tue, 19 Feb 2013 11:04:20 -0500
Message-ID: <201302191604.r1JG4Kiq014831@svn01.web.mwc.hst.phx2.redhat.com>
--===============2441244349132630771==
Content-Type: text/plain; charset="utf-8"
MIME-Version: 1.0
Content-Transfer-Encoding: quoted-printable
Author: manaRH
Date: 2013-02-19 11:04:20 -0500 (Tue, 19 Feb 2013)
New Revision: 15405
Added:
branches/enterprise/WFK-2_1/seam-integration-tests/src/test/java/org/jbo=
ss/seam/test/integration/faces/ConversationContextFlushTest.java
Log:
test for JBSEAM-5067
Added: branches/enterprise/WFK-2_1/seam-integration-tests/src/test/java/org=
/jboss/seam/test/integration/faces/ConversationContextFlushTest.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/enterprise/WFK-2_1/seam-integration-tests/src/test/java/org/jb=
oss/seam/test/integration/faces/ConversationContextFlushTest.java =
(rev 0)
+++ branches/enterprise/WFK-2_1/seam-integration-tests/src/test/java/org/jb=
oss/seam/test/integration/faces/ConversationContextFlushTest.java 2013-02-1=
9 16:04:20 UTC (rev 15405)
@@ -0,0 +1,133 @@
+package org.jboss.seam.test.integration.faces;
+
+import static org.junit.Assert.assertTrue;
+
+import java.io.Serializable;
+import java.net.URL;
+
+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.In;
+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.Test;
+import org.junit.runner.RunWith;
+
+import com.gargoylesoftware.htmlunit.WebClient;
+import com.gargoylesoftware.htmlunit.html.HtmlPage;
+
+/**
+ * JBSEAM-5067, handling exception in ExceptionFilter while long-running c=
onversation with =
+ * Page-scoped injection throws an exception in ServerConversationContext.=
flush
+ *
+ */
+(a)RunWith(Arquillian.class)
+(a)RunAsClient
+public class ConversationContextFlushTest
+{
+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(TestComponent.class, PageScopedComponent.class)
+ .addAsWebResource(new StringAsset(
+ "" +
+ "" +
+ "" +
+ "" +
+ "" +
+ "" +
+ "" +
+ "" + =
+ ""), "test.xhtml")
+ .addAsWebResource(new StringAsset(
+ "" +
+ "" +
+ "" +
+ " Exception handled, state: " + =
+ "" + =
+ ""), "error.xhtml")
+ .addAsWebInfResource(new StringAsset(
+ "\n" +
+ "\n" +
+ "" + =
+ ""+
+ ""+
+ ""), "pages.xml");
+ }
+ =
+ public static class TestException extends Exception
+ {
+ private static final long serialVersionUID =3D 1L;
+ }
+ =
+ @Scope(ScopeType.CONVERSATION)
+ @Name("testComponent")
+ public static class TestComponent implements Serializable
+ {
+ private static final long serialVersionUID =3D 1L;
+ =
+ public String state =3D "";
+ =
+ @In(create=3Dtrue)
+ private PageScopedComponent pageScoped;
+ =
+ @Begin
+ public void begin()
+ {
+ state +=3D "begin;";
+ }
+ =
+ public void throwTestException() throws TestException
+ {
+ state +=3D "throwTestException;";
+ throw new TestException();
+ }
+
+ public String getState()
+ {
+ return state;
+ }
+ }
+ =
+ @Scope(ScopeType.PAGE)
+ @Name("pageScoped")
+ public static class PageScopedComponent implements Serializable
+ {
+ private static final long serialVersionUID =3D 1L;
+ }
+ =
+ @Test
+ public void testExceptionHandingDuringConversationWithPageScopedInjecti=
on() throws Exception
+ {
+ HtmlPage page =3D client.getPage(contextPath + "test.seam");
+ =
+ page =3D page.getElementById("form:begin").click();
+ page =3D page.getElementById("form:throw").click();
+ =
+ assertTrue(page.getBody().getTextContent().contains("Exception handl=
ed, state: begin;throwTestException;"));
+ }
+}
--===============2441244349132630771==--