From seam-commits at lists.jboss.org Thu Aug 23 11:57:09 2012
Content-Type: multipart/mixed; boundary="===============1059544089174648326=="
MIME-Version: 1.0
From: seam-commits at lists.jboss.org
To: seam-commits at lists.jboss.org
Subject: [seam-commits] Seam SVN: r15075 -
branches/community/Seam_2_3/seam-integration-tests/src/test/java/org/jboss/seam/test/integration/faces.
Date: Thu, 23 Aug 2012 11:57:08 -0400
Message-ID: <201208231557.q7NFv8Gh022602@svn01.web.mwc.hst.phx2.redhat.com>
--===============1059544089174648326==
Content-Type: text/plain; charset="utf-8"
MIME-Version: 1.0
Content-Transfer-Encoding: quoted-printable
Author: maschmid
Date: 2012-08-23 11:57:07 -0400 (Thu, 23 Aug 2012)
New Revision: 15075
Added:
branches/community/Seam_2_3/seam-integration-tests/src/test/java/org/jbo=
ss/seam/test/integration/faces/SessionScopedOutjectionOverwriteTest.java
Log:
JBSEAM-4966 test
Added: branches/community/Seam_2_3/seam-integration-tests/src/test/java/org=
/jboss/seam/test/integration/faces/SessionScopedOutjectionOverwriteTest.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/SessionScopedOutjectionOverwriteTest.java =
(rev 0)
+++ branches/community/Seam_2_3/seam-integration-tests/src/test/java/org/jb=
oss/seam/test/integration/faces/SessionScopedOutjectionOverwriteTest.java 2=
012-08-23 15:57:07 UTC (rev 15075)
@@ -0,0 +1,102 @@
+package org.jboss.seam.test.integration.faces;
+
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertTrue;
+
+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.Name;
+import org.jboss.seam.annotations.Out;
+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;
+
+/**
+ * Test for JBSEAM-4966
+ */
+(a)RunWith(Arquillian.class)
+(a)RunAsClient
+public class SessionScopedOutjectionOverwriteTest
+{
+ private final WebClient client =3D new WebClient();
+ =
+ @ArquillianResource
+ URL contextPath;
+ =
+ @Deployment(name=3D"SessionScopedIdlingTest", testable=3Dfalse)
+ @OverProtocol("Servlet 3.0") =
+ public static Archive> createDeployment()
+ {
+ // This is a client test, use a real (non-mocked) Seam deployment
+ return Deployments.realSeamDeployment()
+ .addClasses(Foo.class, Bar.class)
+ .addAsWebResource(new StringAsset(
+ "" +
+ "" +
+ "" +
+ "" +
+ "" +
+ "" +
+ "" +
+ "" +
+ "" +
+ "" + =
+ ""), "test.xhtml");
+ }
+ =
+ @Test
+ public void testJBSEAM4966() throws Exception {
+ HtmlPage page =3D client.getPage(contextPath + "test.seam");
+
+ page =3D page.getElementById("form:foo").click();
+ assertTrue(page.getBody().getTextContent().contains("Output: foo"));
+ =
+ page =3D page.getElementById("form:bar").click();
+ assertTrue(page.getBody().getTextContent().contains("Output: bar"));
+ =
+ page =3D page.getElementById("form:nop").click();
+ assertFalse("Output should stay 'bar' after a 'nop' operation.", pag=
e.getBody().getTextContent().contains("Output: foo"));
+ assertTrue(page.getBody().getTextContent().contains("Output: bar"));
+ }
+
+ @Scope(ScopeType.SESSION)
+ @Name("foo")
+ public static class Foo
+ {
+ @Out(scope=3DScopeType.SESSION)
+ private String output;
+ =
+ public void foo()
+ {
+ output =3D "foo";
+ }
+ }
+ =
+ @Scope(ScopeType.EVENT)
+ @Name("bar")
+ public static class Bar
+ {
+ @Out(scope=3DScopeType.SESSION)
+ private String output;
+ =
+ public void bar()
+ {
+ output =3D "bar";
+ }
+ }
+}
--===============1059544089174648326==--