Seam SVN: r14338 - branches/community/Seam_2_3/jboss-seam-parent.
by seam-commits@lists.jboss.org
Author: maschmid
Date: 2012-02-28 09:13:14 -0500 (Tue, 28 Feb 2012)
New Revision: 14338
Modified:
branches/community/Seam_2_3/jboss-seam-parent/pom.xml
Log:
enable the seam-integration-tests-ee6 in the jsf2 profile
Modified: branches/community/Seam_2_3/jboss-seam-parent/pom.xml
===================================================================
--- branches/community/Seam_2_3/jboss-seam-parent/pom.xml 2012-02-28 14:06:06 UTC (rev 14337)
+++ branches/community/Seam_2_3/jboss-seam-parent/pom.xml 2012-02-28 14:13:14 UTC (rev 14338)
@@ -1832,7 +1832,6 @@
<module>../jboss-seam-ioc</module>
<module>../jboss-seam-jul</module>
<module>../jboss-embedded-bootstrap</module>
- <module>../seam-integration-tests</module>
<module>../functional-tests</module>
</modules>
@@ -1882,7 +1881,8 @@
<module>../jboss-seam</module>
<module>../jboss-seam-ui</module>
<module>../jboss-seam-debug</module>
- <module>../examples</module>
+ <module>../examples</module>
+ <module>../seam-integration-tests</module>
</modules>
</profile>
<profile>
@@ -1892,6 +1892,7 @@
<module>../jboss-seam-ui-jsf2</module>
<module>../jboss-seam-debug-jsf2</module>
<module>../examples-ee6</module>
+ <module>../seam-integration-tests-ee6</module>
</modules>
</profile>
<profile>
12 years, 10 months
Seam SVN: r14337 - branches/community/Seam_2_3/jboss-seam-jsf2/src/main/java/org/jboss/seam/mock.
by seam-commits@lists.jboss.org
Author: maschmid
Date: 2012-02-28 09:06:06 -0500 (Tue, 28 Feb 2012)
New Revision: 14337
Modified:
branches/community/Seam_2_3/jboss-seam-jsf2/src/main/java/org/jboss/seam/mock/MockFacesContext.java
Log:
mock missing isPostback method in the MockFacesContext
Modified: branches/community/Seam_2_3/jboss-seam-jsf2/src/main/java/org/jboss/seam/mock/MockFacesContext.java
===================================================================
--- branches/community/Seam_2_3/jboss-seam-jsf2/src/main/java/org/jboss/seam/mock/MockFacesContext.java 2012-02-28 14:01:22 UTC (rev 14336)
+++ branches/community/Seam_2_3/jboss-seam-jsf2/src/main/java/org/jboss/seam/mock/MockFacesContext.java 2012-02-28 14:06:06 UTC (rev 14337)
@@ -127,8 +127,8 @@
@Override
public RenderKit getRenderKit()
- {
- if (getViewRoot() == null || getViewRoot().getRenderKitId() == null)
+ {
+ if (getViewRoot() == null || getViewRoot().getRenderKitId() == null || renderKitFactory == null)
{
return MockRenderKit.INSTANCE;
}
@@ -239,6 +239,11 @@
elContext.putContext(FacesContext.class, this);
}
return elContext;
- }
+ }
+
+ @Override
+ public boolean isPostback() {
+ return false;
+ }
}
12 years, 10 months
Seam SVN: r14336 - in branches/community/Seam_2_3/jboss-seam-jsf2/src/main/java/org/jboss/seam: mock and 1 other directory.
by seam-commits@lists.jboss.org
Author: maschmid
Date: 2012-02-28 09:01:22 -0500 (Tue, 28 Feb 2012)
New Revision: 14336
Modified:
branches/community/Seam_2_3/jboss-seam-jsf2/src/main/java/org/jboss/seam/jsf/SeamApplication.java
branches/community/Seam_2_3/jboss-seam-jsf2/src/main/java/org/jboss/seam/mock/MockApplication.java
Log:
add missing createComponent method from jsf2 to SeamApplication and MockApplication
Modified: branches/community/Seam_2_3/jboss-seam-jsf2/src/main/java/org/jboss/seam/jsf/SeamApplication.java
===================================================================
--- branches/community/Seam_2_3/jboss-seam-jsf2/src/main/java/org/jboss/seam/jsf/SeamApplication.java 2012-02-28 13:59:49 UTC (rev 14335)
+++ branches/community/Seam_2_3/jboss-seam-jsf2/src/main/java/org/jboss/seam/jsf/SeamApplication.java 2012-02-28 14:01:22 UTC (rev 14336)
@@ -14,6 +14,7 @@
import javax.faces.FacesException;
import javax.faces.application.Application;
import javax.faces.application.NavigationHandler;
+import javax.faces.application.Resource;
import javax.faces.application.StateManager;
import javax.faces.application.ViewHandler;
import javax.faces.component.UIComponent;
@@ -99,6 +100,19 @@
{
return application.createComponent(componentBinding, context, componentType);
}
+
+ @Override
+ public UIComponent createComponent(FacesContext context,
+ String componentType, String rendererType)
+ {
+ return application.createComponent(context, componentType, rendererType);
+ }
+
+ @Override
+ public UIComponent createComponent(FacesContext context, Resource resource)
+ {
+ return application.createComponent(context, resource);
+ }
@Override
public Converter createConverter(String converterId)
Modified: branches/community/Seam_2_3/jboss-seam-jsf2/src/main/java/org/jboss/seam/mock/MockApplication.java
===================================================================
--- branches/community/Seam_2_3/jboss-seam-jsf2/src/main/java/org/jboss/seam/mock/MockApplication.java 2012-02-28 13:59:49 UTC (rev 14335)
+++ branches/community/Seam_2_3/jboss-seam-jsf2/src/main/java/org/jboss/seam/mock/MockApplication.java 2012-02-28 14:01:22 UTC (rev 14336)
@@ -267,11 +267,11 @@
{
try
{
- return (UIComponent) Class.forName(name).newInstance();
+ return (UIComponent) Thread.currentThread().getContextClassLoader().loadClass(name).newInstance();
}
catch (Exception e)
- {
- throw new UnsupportedOperationException("Unable to create component " + name);
+ {
+ throw new UnsupportedOperationException("Unable to create component " + name, e);
}
}
else
@@ -280,6 +280,12 @@
return new UIOutput();
}
}
+
+ @Override
+ public UIComponent createComponent(FacesContext context, String componentType, String rendererType)
+ {
+ return createComponent(componentType);
+ }
@Override
public UIComponent createComponent(ValueBinding vb, FacesContext fc, String x)
12 years, 10 months
Seam SVN: r14335 - in branches/community/Seam_2_3/jboss-seam-jsf2: src/main/java/org/jboss/seam/mock and 1 other directory.
by seam-commits@lists.jboss.org
Author: maschmid
Date: 2012-02-28 08:59:49 -0500 (Tue, 28 Feb 2012)
New Revision: 14335
Added:
branches/community/Seam_2_3/jboss-seam-jsf2/src/main/java/org/jboss/seam/mock/JUnitSeamTest.java
branches/community/Seam_2_3/jboss-seam-jsf2/src/main/java/org/jboss/seam/mock/ServletContextWrapper.java
Modified:
branches/community/Seam_2_3/jboss-seam-jsf2/pom.xml
branches/community/Seam_2_3/jboss-seam-jsf2/src/main/java/org/jboss/seam/mock/AbstractSeamTest.java
Log:
Add JUnitSeamTest and ServletContextWrapper, update AbstractSeamTest to use the ServletContextWrapper
Modified: branches/community/Seam_2_3/jboss-seam-jsf2/pom.xml
===================================================================
--- branches/community/Seam_2_3/jboss-seam-jsf2/pom.xml 2012-02-28 13:57:52 UTC (rev 14334)
+++ branches/community/Seam_2_3/jboss-seam-jsf2/pom.xml 2012-02-28 13:59:49 UTC (rev 14335)
@@ -357,6 +357,11 @@
</dependency>
<dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ </dependency>
+
+ <dependency>
<groupId>org.dbunit</groupId>
<artifactId>dbunit</artifactId>
<optional>true</optional>
@@ -436,18 +441,18 @@
<version>1.6.1</version>
</dependency>
- <dependency>
- <groupId>com.sun.faces</groupId>
- <artifactId>jsf-api</artifactId>
- <optional>true</optional>
- <scope>provided</scope>
- </dependency>
+ <dependency>
+ <groupId>com.sun.faces</groupId>
+ <artifactId>jsf-api</artifactId>
+ <optional>true</optional>
+ <scope>provided</scope>
+ </dependency>
- <dependency>
- <groupId>com.sun.faces</groupId>
- <artifactId>jsf-impl</artifactId>
- <optional>true</optional>
- </dependency>
+ <dependency>
+ <groupId>com.sun.faces</groupId>
+ <artifactId>jsf-impl</artifactId>
+ <optional>true</optional>
+ </dependency>
</dependencies>
<profiles>
Modified: branches/community/Seam_2_3/jboss-seam-jsf2/src/main/java/org/jboss/seam/mock/AbstractSeamTest.java
===================================================================
--- branches/community/Seam_2_3/jboss-seam-jsf2/src/main/java/org/jboss/seam/mock/AbstractSeamTest.java 2012-02-28 13:57:52 UTC (rev 14334)
+++ branches/community/Seam_2_3/jboss-seam-jsf2/src/main/java/org/jboss/seam/mock/AbstractSeamTest.java 2012-02-28 13:59:49 UTC (rev 14335)
@@ -79,6 +79,8 @@
private Map<String, Map> conversationViewRootAttributes;
protected Filter seamFilter;
+ private static ServletContext realServletContext = null;
+
static
{
phases = new SeamPhaseListener();
@@ -933,19 +935,34 @@
*/
protected void startSeam() throws Exception
{
- startJbossEmbeddedIfNecessary();
- this.servletContext = createServletContext();
+ // If the Seam Filter is already initialized, we can grab the real servlet context
+ if (realServletContext == null && ServletLifecycle.getServletContext() != null) {
+ realServletContext = ServletLifecycle.getServletContext();
+ }
+
+ ServletContext realContext = realServletContext;
+ this.servletContext = createServletContext(realContext);
ServletLifecycle.beginApplication(servletContext);
FactoryFinder.setFactory(FactoryFinder.APPLICATION_FACTORY, MockApplicationFactory.class.getName());
new Initialization(servletContext).create().init();
((Init) servletContext.getAttribute(Seam.getComponentName(Init.class))).setDebug(false);
}
- protected ServletContext createServletContext()
+ protected ServletContext createServletContext(ServletContext realContext)
{
- MockServletContext mockServletContext = new MockServletContext();
- initServletContext(mockServletContext.getInitParameters());
- return mockServletContext;
+ if (realContext != null)
+ {
+ ServletContextWrapper wrappedServletContext = new ServletContextWrapper(realContext);
+ // TODO:
+ //initServletContext(wrappedServletContext.getInitParameters());
+ return wrappedServletContext;
+ }
+ else
+ {
+ MockServletContext mockServletContext = new MockServletContext();
+ initServletContext(mockServletContext.getInitParameters());
+ return mockServletContext;
+ }
}
/**
@@ -987,7 +1004,7 @@
{
seamFilter.destroy();
conversationViewRootAttributes = null;
- applicationFactory.setApplication(null);
+ // applicationFactory.setApplication(null);
}
protected Filter createSeamFilter() throws ServletException
@@ -1038,29 +1055,6 @@
private static boolean started;
- protected void startJbossEmbeddedIfNecessary() throws Exception
- {
- if (!started && embeddedJBossAvailable())
- {
- new EmbeddedBootstrap().startAndDeployResources();
- }
-
- started = true;
- }
-
- private boolean embeddedJBossAvailable()
- {
- try
- {
- Class.forName("org.jboss.embedded.Bootstrap");
- return true;
- }
- catch (ClassNotFoundException e)
- {
- return false;
- }
- }
-
protected ELResolver[] getELResolvers()
{
return new ELResolver[0];
Added: branches/community/Seam_2_3/jboss-seam-jsf2/src/main/java/org/jboss/seam/mock/JUnitSeamTest.java
===================================================================
--- branches/community/Seam_2_3/jboss-seam-jsf2/src/main/java/org/jboss/seam/mock/JUnitSeamTest.java (rev 0)
+++ branches/community/Seam_2_3/jboss-seam-jsf2/src/main/java/org/jboss/seam/mock/JUnitSeamTest.java 2012-02-28 13:59:49 UTC (rev 14335)
@@ -0,0 +1,61 @@
+/*
+ * JBoss, Home of Professional Open Source
+ *
+ * Distributable under LGPL license.
+ * See terms of license at gnu.org.
+ */
+package org.jboss.seam.mock;
+
+import org.junit.After;
+import org.junit.Before;
+
+/**
+ * Provides BaseSeamTest functionality for TestNG integration tests.
+ *
+ * @author Gavin King
+ * @author <a href="mailto:theute@jboss.org">Thomas Heute</a>
+ * @author Mike Youngstrom
+ * @author <a href="http://community.jboss.org/people/jharting">Jozef Hartinger</a>
+ * @author <a href="http://community.jboss.org/people/maschmid">Marek Schmidt</a>
+ */
+public class JUnitSeamTest extends AbstractSeamTest
+{
+
+ @Before
+ @Override
+ public void begin()
+ {
+ try {
+ startSeam();
+ setupClass();
+ }
+ catch (Exception x) {
+ throw new RuntimeException(x);
+ }
+ super.begin();
+ }
+
+ @After
+ @Override
+ public void end()
+ {
+ super.end();
+ try {
+ cleanupClass();
+ stopSeam();
+ }
+ catch (Exception x) {
+ throw new RuntimeException(x);
+ }
+ }
+
+ /**
+ * Call this method within a test method to end the previous
+ * mock session and start another one.
+ */
+ public void reset()
+ {
+ end();
+ begin();
+ }
+}
Added: branches/community/Seam_2_3/jboss-seam-jsf2/src/main/java/org/jboss/seam/mock/ServletContextWrapper.java
===================================================================
--- branches/community/Seam_2_3/jboss-seam-jsf2/src/main/java/org/jboss/seam/mock/ServletContextWrapper.java (rev 0)
+++ branches/community/Seam_2_3/jboss-seam-jsf2/src/main/java/org/jboss/seam/mock/ServletContextWrapper.java 2012-02-28 13:59:49 UTC (rev 14335)
@@ -0,0 +1,147 @@
+/*
+ * JBoss, Home of Professional Open Source
+ *
+ * Distributable under LGPL license.
+ * See terms of license at gnu.org.
+ */
+
+package org.jboss.seam.mock;
+
+import java.io.InputStream;
+import java.net.MalformedURLException;
+import java.net.URL;
+import java.util.Enumeration;
+import java.util.HashMap;
+import java.util.Map;
+import java.util.Set;
+
+import javax.servlet.RequestDispatcher;
+import javax.servlet.Servlet;
+import javax.servlet.ServletContext;
+import javax.servlet.ServletException;
+
+import org.jboss.seam.util.IteratorEnumeration;
+
+/**
+ * Wraps a ServletContext with own attributes.
+ *
+ * @author Marek Schmidt
+ */
+public class ServletContextWrapper implements ServletContext {
+
+ private ServletContext delegate;
+
+ private Map<String, Object> attributes = new HashMap<String, Object>();
+
+ public ServletContextWrapper(ServletContext delegate) {
+ this.delegate = delegate;
+ }
+
+ public Object getAttribute(String arg0) {
+ return attributes.get(arg0);
+ }
+
+ public Enumeration getAttributeNames() {
+ return new IteratorEnumeration(attributes.keySet().iterator());
+ }
+
+ public ServletContext getContext(String arg0) {
+ return delegate.getContext(arg0);
+ }
+
+ public String getContextPath() {
+ return delegate.getContextPath();
+ }
+
+ public String getInitParameter(String arg0) {
+ return delegate.getInitParameter(arg0);
+ }
+
+ public Enumeration getInitParameterNames() {
+ return delegate.getInitParameterNames();
+ }
+
+ public int getMajorVersion() {
+ return delegate.getMajorVersion();
+ }
+
+ public String getMimeType(String arg0) {
+ return delegate.getMimeType(arg0);
+ }
+
+ public int getMinorVersion() {
+ return delegate.getMinorVersion();
+ }
+
+ public RequestDispatcher getNamedDispatcher(String arg0) {
+ return delegate.getNamedDispatcher(arg0);
+ }
+
+ public String getRealPath(String arg0) {
+ return delegate.getRealPath(arg0);
+ }
+
+ public RequestDispatcher getRequestDispatcher(String arg0) {
+ return delegate.getRequestDispatcher(arg0);
+ }
+
+ public URL getResource(String arg0) throws MalformedURLException {
+ return delegate.getResource(arg0);
+ }
+
+ public InputStream getResourceAsStream(String arg0) {
+ InputStream ret = delegate.getResourceAsStream(arg0);
+ return ret;
+ }
+
+ public Set getResourcePaths(String arg0) {
+ return delegate.getResourcePaths(arg0);
+ }
+
+ public String getServerInfo() {
+ return delegate.getServerInfo();
+ }
+
+ public Servlet getServlet(String arg0) throws ServletException {
+ return delegate.getServlet(arg0);
+ }
+
+ public String getServletContextName() {
+ return "Wrap";
+ }
+
+ public Enumeration getServletNames() {
+ return delegate.getServletNames();
+ }
+
+ public Enumeration getServlets() {
+ return delegate.getServlets();
+ }
+
+ public void log(String arg0) {
+ delegate.log(arg0);
+ }
+
+ public void log(Exception arg0, String arg1) {
+ delegate.log(arg0, arg1);
+ }
+
+ public void log(String arg0, Throwable arg1) {
+ delegate.log(arg0, arg1);
+ }
+
+ public void removeAttribute(String arg0) {
+ attributes.remove(arg0);
+ }
+
+ public void setAttribute(String key, Object value) {
+ if (value == null)
+ {
+ attributes.remove(key);
+ }
+ else
+ {
+ attributes.put(key, value);
+ }
+ }
+}
12 years, 10 months
Seam SVN: r14334 - branches/community/Seam_2_3/jboss-seam-parent.
by seam-commits@lists.jboss.org
Author: maschmid
Date: 2012-02-28 08:57:52 -0500 (Tue, 28 Feb 2012)
New Revision: 14334
Modified:
branches/community/Seam_2_3/jboss-seam-parent/pom.xml
Log:
add junit and arquillian to the jboss-seam-parent pom
Modified: branches/community/Seam_2_3/jboss-seam-parent/pom.xml
===================================================================
--- branches/community/Seam_2_3/jboss-seam-parent/pom.xml 2012-02-28 13:53:30 UTC (rev 14333)
+++ branches/community/Seam_2_3/jboss-seam-parent/pom.xml 2012-02-28 13:57:52 UTC (rev 14334)
@@ -39,6 +39,7 @@
<pdf.name>${project.artifactId}.pdf</pdf.name>
<!-- Version string properties -->
+ <version.arquillian_core>1.0.0.CR7</version.arquillian_core>
<version.richfaces>3.3.3.Final</version.richfaces>
<version.wicket>1.4.14</version.wicket>
<version.drools>5.0.1</version.drools>
@@ -46,9 +47,11 @@
<version.resteasy>2.0-beta-2</version.resteasy>
<version.spring>2.5.6.SEC02</version.spring>
<version.jbossembedded>beta3.SP15</version.jbossembedded>
- <version.emma>2.0.5312</version.emma>
- <version.jsf12>1.2_12</version.jsf12>
- <version.jsf2>2.1.5</version.jsf2>
+ <version.jbossas7>7.1.0.Final</version.jbossas7>
+ <version.emma>2.0.5312</version.emma>
+ <version.jsf12>1.2_12</version.jsf12>
+ <version.jsf2>2.1.5</version.jsf2>
+ <version.junit>4.8.1</version.junit>
<!-- ***************** -->
<!-- Repository Deployment URLs -->
@@ -63,7 +66,16 @@
that versions are only specified here, not in sub project poms. All dependencies
for all modules should be listed out here -->
<dependencies>
+
<dependency>
+ <groupId>org.jboss.arquillian</groupId>
+ <artifactId>arquillian-bom</artifactId>
+ <version>${version.arquillian_core}</version>
+ <type>pom</type>
+ <scope>import</scope>
+ </dependency>
+
+ <dependency>
<groupId>org.jboss.seam</groupId>
<artifactId>distribution</artifactId>
<version>${project.version}</version>
@@ -131,17 +143,17 @@
</exclusions>
</dependency>
- <dependency>
- <groupId>org.jboss.seam</groupId>
- <artifactId>jboss-seam-ui-jsf2</artifactId>
- <version>${project.version}</version>
- <exclusions>
- <exclusion>
- <groupId>commons-logging</groupId>
- <artifactId>commons-logging</artifactId>
- </exclusion>
- </exclusions>
- </dependency>
+ <dependency>
+ <groupId>org.jboss.seam</groupId>
+ <artifactId>jboss-seam-ui-jsf2</artifactId>
+ <version>${project.version}</version>
+ <exclusions>
+ <exclusion>
+ <groupId>commons-logging</groupId>
+ <artifactId>commons-logging</artifactId>
+ </exclusion>
+ </exclusions>
+ </dependency>
<dependency>
<groupId>org.jboss.seam</groupId>
@@ -150,10 +162,10 @@
</dependency>
<dependency>
- <groupId>org.jboss.seam</groupId>
- <artifactId>jboss-seam-debug-jsf2</artifactId>
- <version>${project.version}</version>
- </dependency>
+ <groupId>org.jboss.seam</groupId>
+ <artifactId>jboss-seam-debug-jsf2</artifactId>
+ <version>${project.version}</version>
+ </dependency>
<dependency>
<groupId>org.jboss.seam</groupId>
@@ -279,7 +291,7 @@
</exclusions>
</dependency>
- <dependency>
+ <dependency>
<groupId>org.jbpm</groupId>
<artifactId>jbpm-jpdl</artifactId>
<version>3.2.2</version>
@@ -888,7 +900,7 @@
</exclusion>
</exclusions>
</dependency>
-
+
<dependency>
<groupId>org.drools</groupId>
<artifactId>drools-api</artifactId>
@@ -1116,36 +1128,35 @@
</exclusions>
</dependency>
- <dependency>
- <groupId>org.openid4java</groupId>
- <artifactId>openid4java-consumer</artifactId>
- <version>0.9.6</version>
- <type>pom</type>
- <exclusions>
- <exclusion>
- <groupId>log4j</groupId>
- <artifactId>log4j</artifactId>
- </exclusion>
+ <dependency>
+ <groupId>org.openid4java</groupId>
+ <artifactId>openid4java-consumer</artifactId>
+ <version>0.9.6</version>
+ <type>pom</type>
+ <exclusions>
+ <exclusion>
+ <groupId>log4j</groupId>
+ <artifactId>log4j</artifactId>
+ </exclusion>
- <exclusion>
- <groupId>xerces</groupId>
- <artifactId>xercesImpl</artifactId>
- </exclusion>
-
- </exclusions>
- </dependency>
-
+ <exclusion>
+ <groupId>xerces</groupId>
+ <artifactId>xercesImpl</artifactId>
+ </exclusion>
+ </exclusions>
+ </dependency>
+
<dependency>
<groupId>com.google.gwt</groupId>
<artifactId>gwt-servlet</artifactId>
<version>1.5.2</version>
</dependency>
-
- <dependency>
- <groupId>com.google.gwt</groupId>
- <artifactId>gwt-user</artifactId>
- <version>1.5.2</version>
- </dependency>
+
+ <dependency>
+ <groupId>com.google.gwt</groupId>
+ <artifactId>gwt-user</artifactId>
+ <version>1.5.2</version>
+ </dependency>
<dependency>
<groupId>dom4j</groupId>
@@ -1370,160 +1381,166 @@
<version>${version.testng}</version>
<classifier>jdk15</classifier>
</dependency>
-
- <dependency>
- <groupId>org.seleniumhq.selenium.server</groupId>
- <artifactId>selenium-server</artifactId>
- <version>1.0.1</version>
- <classifier>standalone</classifier>
- <exclusions>
- <exclusion>
- <groupId>org.seleniumhq.selenium.core</groupId>
- <artifactId>selenium-core</artifactId>
- </exclusion>
- <exclusion>
- <groupId>org.seleniumhq.selenium.server</groupId>
- <artifactId>selenium-server-coreless</artifactId>
- </exclusion>
- <exclusion>
- <groupId>org.apache.ant</groupId>
- <artifactId>ant-trax</artifactId>
- </exclusion>
- <exclusion>
- <groupId>org.apache.ant</groupId>
- <artifactId>ant-nodeps</artifactId>
- </exclusion>
- </exclusions>
- </dependency>
-
- <dependency>
- <groupId>org.seleniumhq.selenium.client-drivers</groupId>
- <artifactId>selenium-java-client-driver</artifactId>
- <version>1.0.1</version>
- <exclusions>
- <exclusion>
- <groupId>org.codehaus.groovy.maven.runtime</groupId>
- <artifactId>gmaven-runtime-default</artifactId>
- </exclusion>
- </exclusions>
- </dependency>
-
- <dependency>
- <groupId>org.seleniumhq.webdriver</groupId>
- <artifactId>webdriver-firefox</artifactId>
- <version>0.9.7376</version>
- </dependency>
-
- <dependency>
- <groupId>org.seleniumhq.webdriver</groupId>
- <artifactId>webdriver-support</artifactId>
- <version>0.9.7376</version>
- </dependency>
-
- <dependency>
- <groupId>org.seleniumhq.webdriver</groupId>
- <artifactId>webdriver-ie</artifactId>
- <version>0.9.7376</version>
- </dependency>
-
- <dependency>
- <groupId>org.jboss.seam</groupId>
- <artifactId>functional-tests</artifactId>
- <version>${project.version}</version>
- <scope>test</scope>
- </dependency>
-
- <dependency>
- <groupId>javax.servlet</groupId>
- <artifactId>jstl</artifactId>
- <version>1.1.2</version>
- </dependency>
-
- <dependency>
- <groupId>commons-digester</groupId>
- <artifactId>commons-digester</artifactId>
- <version>2.1</version>
- </dependency>
-
- <dependency>
- <groupId>org.eclipse.jdt</groupId>
- <artifactId>core</artifactId>
- <version>3.4.2.v_883_R34x</version>
- </dependency>
-
- <dependency>
- <groupId>commons-fileupload</groupId>
- <artifactId>commons-fileupload</artifactId>
- <version>1.2.1</version>
- </dependency>
-
- <dependency>
- <groupId>commons-logging</groupId>
- <artifactId>commons-logging-api</artifactId>
- <version>1.1</version>
- </dependency>
-
- <dependency>
- <groupId>org.icefaces</groupId>
- <artifactId>icefaces</artifactId>
- <version>1.8.2</version>
- </dependency>
-
- <dependency>
- <groupId>org.icefaces</groupId>
- <artifactId>icefaces-comps</artifactId>
- <version>1.8.2</version>
- </dependency>
-
- <dependency>
- <groupId>org.icefaces</groupId>
- <artifactId>icefaces-facelets</artifactId>
- <version>1.8.2</version>
- </dependency>
-
- <dependency>
- <groupId>org.apache.myfaces.trinidad</groupId>
- <artifactId>trinidad-api</artifactId>
- <version>1.2.5</version>
- </dependency>
- <dependency>
- <groupId>org.apache.myfaces.trinidad</groupId>
- <artifactId>trinidad-impl</artifactId>
- <version>1.2.5</version>
- </dependency>
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <version>${version.junit}</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.seleniumhq.selenium.server</groupId>
+ <artifactId>selenium-server</artifactId>
+ <version>1.0.1</version>
+ <classifier>standalone</classifier>
+ <exclusions>
+ <exclusion>
+ <groupId>org.seleniumhq.selenium.core</groupId>
+ <artifactId>selenium-core</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>org.seleniumhq.selenium.server</groupId>
+ <artifactId>selenium-server-coreless</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>org.apache.ant</groupId>
+ <artifactId>ant-trax</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>org.apache.ant</groupId>
+ <artifactId>ant-nodeps</artifactId>
+ </exclusion>
+ </exclusions>
+ </dependency>
+
+ <dependency>
+ <groupId>org.seleniumhq.selenium.client-drivers</groupId>
+ <artifactId>selenium-java-client-driver</artifactId>
+ <version>1.0.1</version>
+ <exclusions>
+ <exclusion>
+ <groupId>org.codehaus.groovy.maven.runtime</groupId>
+ <artifactId>gmaven-runtime-default</artifactId>
+ </exclusion>
+ </exclusions>
+ </dependency>
+
+ <dependency>
+ <groupId>org.seleniumhq.webdriver</groupId>
+ <artifactId>webdriver-firefox</artifactId>
+ <version>0.9.7376</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.seleniumhq.webdriver</groupId>
+ <artifactId>webdriver-support</artifactId>
+ <version>0.9.7376</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.seleniumhq.webdriver</groupId>
+ <artifactId>webdriver-ie</artifactId>
+ <version>0.9.7376</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.jboss.seam</groupId>
+ <artifactId>functional-tests</artifactId>
+ <version>${project.version}</version>
+ <scope>test</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>javax.servlet</groupId>
+ <artifactId>jstl</artifactId>
+ <version>1.1.2</version>
+ </dependency>
+
+ <dependency>
+ <groupId>commons-digester</groupId>
+ <artifactId>commons-digester</artifactId>
+ <version>2.1</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.eclipse.jdt</groupId>
+ <artifactId>core</artifactId>
+ <version>3.4.2.v_883_R34x</version>
+ </dependency>
+
+ <dependency>
+ <groupId>commons-fileupload</groupId>
+ <artifactId>commons-fileupload</artifactId>
+ <version>1.2.1</version>
+ </dependency>
+
+ <dependency>
+ <groupId>commons-logging</groupId>
+ <artifactId>commons-logging-api</artifactId>
+ <version>1.1</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.icefaces</groupId>
+ <artifactId>icefaces</artifactId>
+ <version>1.8.2</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.icefaces</groupId>
+ <artifactId>icefaces-comps</artifactId>
+ <version>1.8.2</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.icefaces</groupId>
+ <artifactId>icefaces-facelets</artifactId>
+ <version>1.8.2</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.myfaces.trinidad</groupId>
+ <artifactId>trinidad-api</artifactId>
+ <version>1.2.5</version>
+ </dependency>
- <dependency>
- <groupId>org.codehaus.jettison</groupId>
- <artifactId>jettison</artifactId>
- <version>1.1</version>
- <exclusions>
- <exclusion>
- <groupId>stax</groupId>
- <artifactId>stax-api</artifactId>
- </exclusion>
- </exclusions>
- </dependency>
+ <dependency>
+ <groupId>org.apache.myfaces.trinidad</groupId>
+ <artifactId>trinidad-impl</artifactId>
+ <version>1.2.5</version>
+ </dependency>
- <dependency>
- <groupId>org.metawidget</groupId>
- <artifactId>metawidget-backend</artifactId>
- <version>0.95</version>
- </dependency>
-
- <dependency>
- <groupId>org.metawidget</groupId>
- <artifactId>metawidget-frontend</artifactId>
- <version>0.95</version>
- </dependency>
-
- <dependency>
- <groupId>org.metawidget</groupId>
- <artifactId>metawidget</artifactId>
- <version>0.95</version>
- </dependency>
+ <dependency>
+ <groupId>org.codehaus.jettison</groupId>
+ <artifactId>jettison</artifactId>
+ <version>1.1</version>
+ <exclusions>
+ <exclusion>
+ <groupId>stax</groupId>
+ <artifactId>stax-api</artifactId>
+ </exclusion>
+ </exclusions>
+ </dependency>
<dependency>
+ <groupId>org.metawidget</groupId>
+ <artifactId>metawidget-backend</artifactId>
+ <version>0.95</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.metawidget</groupId>
+ <artifactId>metawidget-frontend</artifactId>
+ <version>0.95</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.metawidget</groupId>
+ <artifactId>metawidget</artifactId>
+ <version>0.95</version>
+ </dependency>
+
+ <dependency>
<groupId>javax.faces</groupId>
<artifactId>jsf-api</artifactId>
<version>${version.jsf12}</version>
@@ -1547,25 +1564,46 @@
<artifactId>commons-digester</artifactId>
</exclusion>
</exclusions>
- </dependency>
- <dependency>
- <groupId>com.sun.faces</groupId>
- <artifactId>jsf-api</artifactId>
- <version>${version.jsf2}</version>
- </dependency>
+ </dependency>
+ <dependency>
+ <groupId>com.sun.faces</groupId>
+ <artifactId>jsf-api</artifactId>
+ <version>${version.jsf2}</version>
+ </dependency>
- <dependency>
- <groupId>com.sun.faces</groupId>
- <artifactId>jsf-impl</artifactId>
- <version>${version.jsf2}</version>
- </dependency>
-
- <dependency>
- <groupId>org.jboss.seam</groupId>
- <artifactId>jboss-seam-jsf2</artifactId>
- <version>${project.version}</version>
- <type>ejb</type>
- </dependency>
+ <dependency>
+ <groupId>com.sun.faces</groupId>
+ <artifactId>jsf-impl</artifactId>
+ <version>${version.jsf2}</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.jboss.seam</groupId>
+ <artifactId>jboss-seam-jsf2</artifactId>
+ <version>${project.version}</version>
+ <type>ejb</type>
+ </dependency>
+
+ <dependency>
+ <groupId>org.jboss.spec</groupId>
+ <artifactId>jboss-javaee-6.0</artifactId>
+ <version>1.0.0.Final</version>
+ <type>pom</type>
+ <scope>provided</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.jboss.as</groupId>
+ <artifactId>jboss-as-arquillian-container-managed</artifactId>
+ <version>${version.jbossas7}</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.jboss.as</groupId>
+ <artifactId>jboss-as-arquillian-container-remote</artifactId>
+ <version>${version.jbossas7}</version>
+ </dependency>
+
</dependencies>
</dependencyManagement>
@@ -1606,7 +1644,7 @@
<build>
<defaultGoal>package</defaultGoal>
- <finalName>${project.artifactId}</finalName>
+ <finalName>${project.artifactId}</finalName>
<pluginManagement>
<plugins>
<plugin>
@@ -1782,7 +1820,7 @@
</build>
<modules>
- <module>../jboss-seam-gen</module>
+ <module>../jboss-seam-gen</module>
<module>../jboss-seam-excel</module>
<module>../jboss-seam-flex</module>
<module>../jboss-seam-mail</module>
12 years, 10 months
Seam SVN: r14333 - in branches/community/Seam_2_3: seam-integration-tests-ee6 and 17 other directories.
by seam-commits@lists.jboss.org
Author: maschmid
Date: 2012-02-28 08:53:30 -0500 (Tue, 28 Feb 2012)
New Revision: 14333
Added:
branches/community/Seam_2_3/seam-integration-tests-ee6/
branches/community/Seam_2_3/seam-integration-tests-ee6/pom.xml
branches/community/Seam_2_3/seam-integration-tests-ee6/readme.txt
branches/community/Seam_2_3/seam-integration-tests-ee6/src/
branches/community/Seam_2_3/seam-integration-tests-ee6/src/test/
branches/community/Seam_2_3/seam-integration-tests-ee6/src/test/java/
branches/community/Seam_2_3/seam-integration-tests-ee6/src/test/java/org/
branches/community/Seam_2_3/seam-integration-tests-ee6/src/test/java/org/jboss/
branches/community/Seam_2_3/seam-integration-tests-ee6/src/test/java/org/jboss/seam/
branches/community/Seam_2_3/seam-integration-tests-ee6/src/test/java/org/jboss/seam/test/
branches/community/Seam_2_3/seam-integration-tests-ee6/src/test/java/org/jboss/seam/test/integration/
branches/community/Seam_2_3/seam-integration-tests-ee6/src/test/java/org/jboss/seam/test/integration/Action.java
branches/community/Seam_2_3/seam-integration-tests-ee6/src/test/java/org/jboss/seam/test/integration/BeanA.java
branches/community/Seam_2_3/seam-integration-tests-ee6/src/test/java/org/jboss/seam/test/integration/BeanB.java
branches/community/Seam_2_3/seam-integration-tests-ee6/src/test/java/org/jboss/seam/test/integration/BusinessProcessTest.java
branches/community/Seam_2_3/seam-integration-tests-ee6/src/test/java/org/jboss/seam/test/integration/ConcurrentFactoryTest.java
branches/community/Seam_2_3/seam-integration-tests-ee6/src/test/java/org/jboss/seam/test/integration/ConversationTest.java
branches/community/Seam_2_3/seam-integration-tests-ee6/src/test/java/org/jboss/seam/test/integration/Country.java
branches/community/Seam_2_3/seam-integration-tests-ee6/src/test/java/org/jboss/seam/test/integration/CountryHome.java
branches/community/Seam_2_3/seam-integration-tests-ee6/src/test/java/org/jboss/seam/test/integration/Deployments.java
branches/community/Seam_2_3/seam-integration-tests-ee6/src/test/java/org/jboss/seam/test/integration/ELTest.java
branches/community/Seam_2_3/seam-integration-tests-ee6/src/test/java/org/jboss/seam/test/integration/EntityPassivationTest.java
branches/community/Seam_2_3/seam-integration-tests-ee6/src/test/java/org/jboss/seam/test/integration/EntityTest.java
branches/community/Seam_2_3/seam-integration-tests-ee6/src/test/java/org/jboss/seam/test/integration/EventTest.java
branches/community/Seam_2_3/seam-integration-tests-ee6/src/test/java/org/jboss/seam/test/integration/Foo.java
branches/community/Seam_2_3/seam-integration-tests-ee6/src/test/java/org/jboss/seam/test/integration/IdentifierTest.java
branches/community/Seam_2_3/seam-integration-tests-ee6/src/test/java/org/jboss/seam/test/integration/ImportTest.java
branches/community/Seam_2_3/seam-integration-tests-ee6/src/test/java/org/jboss/seam/test/integration/JavaBeanEqualsTest.java
branches/community/Seam_2_3/seam-integration-tests-ee6/src/test/java/org/jboss/seam/test/integration/MessagingTest.java
branches/community/Seam_2_3/seam-integration-tests-ee6/src/test/java/org/jboss/seam/test/integration/NamespaceResolverTest.java
branches/community/Seam_2_3/seam-integration-tests-ee6/src/test/java/org/jboss/seam/test/integration/NamespaceTest.java
branches/community/Seam_2_3/seam-integration-tests-ee6/src/test/java/org/jboss/seam/test/integration/PageContextTest.java
branches/community/Seam_2_3/seam-integration-tests-ee6/src/test/java/org/jboss/seam/test/integration/PageParamTest.java
branches/community/Seam_2_3/seam-integration-tests-ee6/src/test/java/org/jboss/seam/test/integration/People.java
branches/community/Seam_2_3/seam-integration-tests-ee6/src/test/java/org/jboss/seam/test/integration/Person.java
branches/community/Seam_2_3/seam-integration-tests-ee6/src/test/java/org/jboss/seam/test/integration/Thing.java
branches/community/Seam_2_3/seam-integration-tests-ee6/src/test/java/org/jboss/seam/test/integration/UnversionedThing.java
branches/community/Seam_2_3/seam-integration-tests-ee6/src/test/java/org/jboss/seam/test/integration/bpm/
branches/community/Seam_2_3/seam-integration-tests-ee6/src/test/java/org/jboss/seam/test/integration/bpm/SeamExpressionEvaluatorTest.java
branches/community/Seam_2_3/seam-integration-tests-ee6/src/test/java/org/jboss/seam/test/integration/bpm/SeamExpressionEvaluatorTestController.java
branches/community/Seam_2_3/seam-integration-tests-ee6/src/test/java/org/jboss/seam/test/integration/databinding/
branches/community/Seam_2_3/seam-integration-tests-ee6/src/test/java/org/jboss/seam/test/integration/databinding/DataModelTest.java
branches/community/Seam_2_3/seam-integration-tests-ee6/src/test/java/org/jboss/seam/test/integration/i8ln/
branches/community/Seam_2_3/seam-integration-tests-ee6/src/test/java/org/jboss/seam/test/integration/i8ln/LocaleTest.java
branches/community/Seam_2_3/seam-integration-tests-ee6/src/test/java/org/jboss/seam/test/integration/i8ln/TimeZoneTest.java
branches/community/Seam_2_3/seam-integration-tests-ee6/src/test/java/org/jboss/seam/test/integration/mock/
branches/community/Seam_2_3/seam-integration-tests-ee6/src/test/java/org/jboss/seam/test/integration/mock/SeamMockELResolverTest.java
branches/community/Seam_2_3/seam-integration-tests-ee6/src/test/java/org/jboss/seam/test/integration/mock/SeamTestTest.java
branches/community/Seam_2_3/seam-integration-tests-ee6/src/test/java/org/jboss/seam/test/integration/security/
branches/community/Seam_2_3/seam-integration-tests-ee6/src/test/java/org/jboss/seam/test/integration/security/SecurityTest.java
branches/community/Seam_2_3/seam-integration-tests-ee6/src/test/resources-jbossas-7/
branches/community/Seam_2_3/seam-integration-tests-ee6/src/test/resources-jbossas-7/arquillian.xml
branches/community/Seam_2_3/seam-integration-tests-ee6/src/test/resources/
branches/community/Seam_2_3/seam-integration-tests-ee6/src/test/resources/META-INF/
branches/community/Seam_2_3/seam-integration-tests-ee6/src/test/resources/META-INF/ejb-jar.xml
branches/community/Seam_2_3/seam-integration-tests-ee6/src/test/resources/META-INF/persistence.xml
branches/community/Seam_2_3/seam-integration-tests-ee6/src/test/resources/WEB-INF/
branches/community/Seam_2_3/seam-integration-tests-ee6/src/test/resources/WEB-INF/components-jbpm.xml
branches/community/Seam_2_3/seam-integration-tests-ee6/src/test/resources/WEB-INF/components.xml
branches/community/Seam_2_3/seam-integration-tests-ee6/src/test/resources/WEB-INF/pages.xml
branches/community/Seam_2_3/seam-integration-tests-ee6/src/test/resources/WEB-INF/web.xml
branches/community/Seam_2_3/seam-integration-tests-ee6/src/test/resources/components.properties
branches/community/Seam_2_3/seam-integration-tests-ee6/src/test/resources/hibernate.cfg.xml
branches/community/Seam_2_3/seam-integration-tests-ee6/src/test/resources/jboss-seam-integration-tests-ds.xml
branches/community/Seam_2_3/seam-integration-tests-ee6/src/test/resources/jbpm.cfg.xml
branches/community/Seam_2_3/seam-integration-tests-ee6/src/test/resources/messages_en.properties
branches/community/Seam_2_3/seam-integration-tests-ee6/src/test/resources/test-destinations-service.xml
branches/community/Seam_2_3/seam-integration-tests-ee6/src/test/resources/testProcess1.jpdl.xml
branches/community/Seam_2_3/seam-integration-tests-ee6/src/test/resources/testProcess2.jpdl.xml
branches/community/Seam_2_3/seam-integration-tests-ee6/src/test/resources/testProcess3.jpdl.xml
branches/community/Seam_2_3/seam-integration-tests-ee6/src/test/resources/testProcess4.jpdl.xml
Log:
Initial import of the arquillian integration testsuite
Added: branches/community/Seam_2_3/seam-integration-tests-ee6/pom.xml
===================================================================
--- branches/community/Seam_2_3/seam-integration-tests-ee6/pom.xml (rev 0)
+++ branches/community/Seam_2_3/seam-integration-tests-ee6/pom.xml 2012-02-28 13:53:30 UTC (rev 14333)
@@ -0,0 +1,343 @@
+<?xml version="1.0"?>
+<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">
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <artifactId>jboss-seam-parent</artifactId>
+ <groupId>org.jboss.seam</groupId>
+ <version>2.3.0-SNAPSHOT</version>
+ <relativePath>../jboss-seam-parent/pom.xml</relativePath>
+ </parent>
+ <groupId>org.jboss.seam</groupId>
+ <artifactId>seam-integration-tests-ee6</artifactId>
+ <name>Seam Integration Tests</name>
+
+ <properties>
+ </properties>
+
+ <build>
+ <testResources>
+ <testResource>
+ <directory>src/test/resources</directory>
+ <filtering>true</filtering>
+ </testResource>
+ </testResources>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-surefire-plugin</artifactId>
+ <configuration>
+ <skipTests>true</skipTests>
+ </configuration>
+
+ <executions>
+ <execution>
+ <id>surefire-it</id>
+ <phase>integration-test</phase>
+ <goals>
+ <goal>test</goal>
+ </goals>
+ <configuration>
+ <skip>true</skip>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
+
+ <plugin>
+ <artifactId>maven-clean-plugin</artifactId>
+ <configuration>
+ <filesets>
+ <fileset>
+ <directory>${project.build.directory}/bootstrap</directory>
+ </fileset>
+ <fileset>
+ <directory>${basedir}/src/test/META-INF</directory>
+ </fileset>
+ </filesets>
+ </configuration>
+ </plugin>
+ </plugins>
+
+
+ </build>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.jbpm</groupId>
+ <artifactId>jbpm-jpdl</artifactId>
+ </dependency>
+
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <scope>test</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>javassist</groupId>
+ <artifactId>javassist</artifactId>
+ <scope>test</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.jboss.arquillian.junit</groupId>
+ <artifactId>arquillian-junit-container</artifactId>
+ <scope>test</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.jboss.arquillian.protocol</groupId>
+ <artifactId>arquillian-protocol-servlet</artifactId>
+ <scope>test</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.jboss.shrinkwrap.resolver</groupId>
+ <artifactId>shrinkwrap-resolver-api-maven</artifactId>
+ <scope>test</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.jboss.shrinkwrap.resolver</groupId>
+ <artifactId>shrinkwrap-resolver-impl-maven</artifactId>
+ <scope>test</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.jboss.spec</groupId>
+ <artifactId>jboss-javaee-6.0</artifactId>
+ <type>pom</type>
+ <scope>provided</scope>
+ </dependency>
+
+ </dependencies>
+
+ <profiles>
+ <profile>
+ <id>code-coverage</id>
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-surefire-plugin</artifactId>
+ <executions>
+ <execution>
+ <id>default-test</id>
+ <phase>none</phase>
+ </execution>
+ </executions>
+ </plugin>
+ <plugin>
+ <groupId>org.sonatype.maven.plugin</groupId>
+ <artifactId>emma4it-maven-plugin</artifactId>
+ <executions>
+ <execution>
+ <id>merge</id>
+ <phase>post-integration-test</phase>
+ <goals>
+ <goal>merge</goal>
+ </goals>
+ <configuration>
+ <searchPath>${basedir}/../</searchPath>
+ </configuration>
+ </execution>
+ <execution>
+ <id>report</id>
+ <phase>verify</phase>
+ <goals>
+ <goal>report</goal>
+ </goals>
+ <configuration>
+ <sourceSets>
+ <sourceSet>
+ <directory>${basedir}/../jboss-seam-jsf2/src/main/java</directory>
+ <directory>${basedir}/../jboss-seam-debug/src/main/java</directory>
+ <directory>${basedir}/../jboss-seam-excel/src/main/java</directory>
+ <directory>${basedir}/../jboss-seam-flex/src/main/java</directory>
+ <directory>${basedir}/../jboss-seam-gen/src/main/java</directory>
+ <directory>${basedir}/../jboss-seam-ioc/src/main/java</directory>
+ <directory>${basedir}/../jboss-seam-jul/src/main/java</directory>
+ <directory>${basedir}/../jboss-seam-mail/src/main/java</directory>
+ <directory>${basedir}/../jboss-seam-pdf/src/main/java</directory>
+ <directory>${basedir}/../jboss-seam-remoting/src/main/java</directory>
+ <directory>${basedir}/../jboss-seam-resteasy/src/main/java</directory>
+ <directory>${basedir}/../jboss-seam-rss/src/main/java</directory>
+ <directory>${basedir}/../jboss-seam-ui/src/main/java</directory>
+ <directory>${basedir}/../jboss-seam-wicket/src/main/java</directory>
+ </sourceSet>
+ </sourceSets>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+ </profile>
+ <profile>
+ <id>jsf2</id>
+ <activation>
+ <activeByDefault>true</activeByDefault>
+ </activation>
+ <dependencies>
+ <dependency>
+ <groupId>com.sun.faces</groupId>
+ <artifactId>jsf-api</artifactId>
+ </dependency>
+
+ <dependency>
+ <groupId>com.sun.faces</groupId>
+ <artifactId>jsf-impl</artifactId>
+ </dependency>
+
+ <dependency>
+ <groupId>org.jboss.seam</groupId>
+ <artifactId>jboss-seam-jsf2</artifactId>
+ <version>${project.version}</version>
+
+ <exclusions>
+ <exclusion>
+ <groupId>org.testng</groupId>
+ <artifactId>testng</artifactId>
+ </exclusion>
+ </exclusions>
+ </dependency>
+
+ <dependency>
+ <groupId>org.hibernate</groupId>
+ <artifactId>hibernate-core</artifactId>
+ </dependency>
+
+ </dependencies>
+ <build>
+ <testResources>
+ <testResource>
+ <directory>src/test/resources</directory>
+ <filtering>true</filtering>
+ </testResource>
+ </testResources>
+ </build>
+ </profile>
+
+ <profile>
+ <id>integration-test</id>
+ <activation>
+ <activeByDefault>true</activeByDefault>
+ <property>
+ <name>arquillian</name>
+ </property>
+ </activation>
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-surefire-plugin</artifactId>
+ <configuration>
+ <skip>true</skip>
+ <skipTests>false</skipTests>
+ </configuration>
+
+ <executions>
+ <execution>
+ <id>surefire-it</id>
+ <phase>integration-test</phase>
+ <goals>
+ <goal>test</goal>
+ </goals>
+ <configuration>
+ <redirectTestOutputToFile>true</redirectTestOutputToFile>
+ <skip>false</skip>
+ <systemProperties>
+ <!-- used by the jbossas-managed-7 profile in arquillian.xml for the jbossHome property-->
+ <version.jbossas7>${version.jbossas7}</version.jbossas7>
+ </systemProperties>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+ </profile>
+
+ <profile>
+ <id>arq-jbossas-7-managed</id>
+ <activation>
+ <activeByDefault>true</activeByDefault>
+ <property>
+ <name>arquillian</name>
+ <value>jbossas-managed-7</value>
+ </property>
+ </activation>
+ <dependencies>
+ <dependency>
+ <groupId>org.jboss.as</groupId>
+ <artifactId>jboss-as-arquillian-container-managed</artifactId>
+ </dependency>
+ </dependencies>
+ <build>
+ <testResources>
+ <testResource>
+ <directory>src/test/resources</directory>
+ </testResource>
+ <testResource>
+ <directory>src/test/resources-jbossas-7</directory>
+ </testResource>
+ </testResources>
+
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-dependency-plugin</artifactId>
+ <executions>
+ <execution>
+ <id>unpack-as7</id>
+ <phase>process-test-classes</phase>
+ <goals>
+ <goal>unpack</goal>
+ </goals>
+ <configuration>
+ <artifactItems>
+ <artifactItem>
+ <groupId>org.jboss.as</groupId>
+ <artifactId>jboss-as-dist</artifactId>
+ <version>${version.jbossas7}</version>
+ <type>zip</type>
+ <overWrite>false</overWrite>
+ <outputDirectory>${project.build.directory}</outputDirectory>
+ </artifactItem>
+ </artifactItems>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+ </profile>
+
+ <profile>
+ <id>arq-jbossas-7-remote</id>
+ <activation>
+ <property>
+ <name>arquillian</name>
+ <value>jbossas-remote-7</value>
+ </property>
+ </activation>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.jboss.as</groupId>
+ <artifactId>jboss-as-arquillian-container-remote</artifactId>
+ </dependency>
+ </dependencies>
+ <build>
+ <testResources>
+ <testResource>
+ <directory>src/test/resources</directory>
+ </testResource>
+ <testResource>
+ <directory>src/test/resources-jbossas-7</directory>
+ </testResource>
+ </testResources>
+ </build>
+ </profile>
+ </profiles>
+</project>
Added: branches/community/Seam_2_3/seam-integration-tests-ee6/readme.txt
===================================================================
--- branches/community/Seam_2_3/seam-integration-tests-ee6/readme.txt (rev 0)
+++ branches/community/Seam_2_3/seam-integration-tests-ee6/readme.txt 2012-02-28 13:53:30 UTC (rev 14333)
@@ -0,0 +1 @@
+Core integration tests for Seam (those not associated with a particular example)
\ No newline at end of file
Added: branches/community/Seam_2_3/seam-integration-tests-ee6/src/test/java/org/jboss/seam/test/integration/Action.java
===================================================================
--- branches/community/Seam_2_3/seam-integration-tests-ee6/src/test/java/org/jboss/seam/test/integration/Action.java (rev 0)
+++ branches/community/Seam_2_3/seam-integration-tests-ee6/src/test/java/org/jboss/seam/test/integration/Action.java 2012-02-28 13:53:30 UTC (rev 14333)
@@ -0,0 +1,11 @@
+package org.jboss.seam.test.integration;
+
+import org.jboss.seam.annotations.Name;
+
+@Name("action")
+public class Action {
+
+ public String go() {
+ return "success";
+ }
+}
Added: branches/community/Seam_2_3/seam-integration-tests-ee6/src/test/java/org/jboss/seam/test/integration/BeanA.java
===================================================================
--- branches/community/Seam_2_3/seam-integration-tests-ee6/src/test/java/org/jboss/seam/test/integration/BeanA.java (rev 0)
+++ branches/community/Seam_2_3/seam-integration-tests-ee6/src/test/java/org/jboss/seam/test/integration/BeanA.java 2012-02-28 13:53:30 UTC (rev 14333)
@@ -0,0 +1,38 @@
+package org.jboss.seam.test.integration;
+
+import java.io.Serializable;
+import org.jboss.seam.ScopeType;
+import org.jboss.seam.annotations.AutoCreate;
+import org.jboss.seam.annotations.Create;
+import org.jboss.seam.annotations.Name;
+import org.jboss.seam.annotations.Observer;
+import org.jboss.seam.annotations.Scope;
+import org.jboss.seam.core.Events;
+
+@Name("beanA")
+(a)Scope(ScopeType.CONVERSATION)
+@AutoCreate
+public class BeanA implements Serializable {
+
+ private String myValue;
+
+ public String getMyValue() {
+ return myValue;
+ }
+
+ public void setMyValue(String myValue) {
+ this.myValue = myValue;
+ }
+
+ @Create
+ public void create() {
+ myValue = "Foo";
+ }
+
+ @Observer(value = "BeanA.refreshMyValue")
+ public void refreshMyValue() {
+ myValue = "Bar";
+ Events.instance().raiseEvent("BeanA.valueModified");
+ }
+
+}
Added: branches/community/Seam_2_3/seam-integration-tests-ee6/src/test/java/org/jboss/seam/test/integration/BeanB.java
===================================================================
--- branches/community/Seam_2_3/seam-integration-tests-ee6/src/test/java/org/jboss/seam/test/integration/BeanB.java (rev 0)
+++ branches/community/Seam_2_3/seam-integration-tests-ee6/src/test/java/org/jboss/seam/test/integration/BeanB.java 2012-02-28 13:53:30 UTC (rev 14333)
@@ -0,0 +1,33 @@
+package org.jboss.seam.test.integration;
+
+import java.io.Serializable;
+
+import org.jboss.seam.Component;
+import org.jboss.seam.ScopeType;
+import org.jboss.seam.annotations.AutoCreate;
+import org.jboss.seam.annotations.Name;
+import org.jboss.seam.annotations.Observer;
+import org.jboss.seam.annotations.Scope;
+
+@Name("beanB")
+(a)Scope(ScopeType.PAGE)
+@AutoCreate
+public class BeanB implements Serializable {
+
+ private String myValue;
+
+ public String getMyValue() {
+ return myValue;
+ }
+
+ public void setMyValue(String myValue) {
+ this.myValue = myValue;
+ }
+
+ @Observer(value = "BeanA.valueModified")
+ public void takeValueFromBeanA() {
+ BeanA beanA = (BeanA) Component.getInstance("beanA");
+ myValue = beanA.getMyValue();
+ }
+
+}
\ No newline at end of file
Added: branches/community/Seam_2_3/seam-integration-tests-ee6/src/test/java/org/jboss/seam/test/integration/BusinessProcessTest.java
===================================================================
--- branches/community/Seam_2_3/seam-integration-tests-ee6/src/test/java/org/jboss/seam/test/integration/BusinessProcessTest.java (rev 0)
+++ branches/community/Seam_2_3/seam-integration-tests-ee6/src/test/java/org/jboss/seam/test/integration/BusinessProcessTest.java 2012-02-28 13:53:30 UTC (rev 14333)
@@ -0,0 +1,73 @@
+package org.jboss.seam.test.integration;
+
+import org.jboss.arquillian.container.test.api.Deployment;
+import org.jboss.arquillian.container.test.api.OverProtocol;
+import org.jboss.arquillian.junit.Arquillian;
+import org.jboss.seam.annotations.Name;
+import org.jboss.seam.annotations.bpm.CreateProcess;
+import org.jboss.seam.mock.JUnitSeamTest;
+import org.jboss.shrinkwrap.api.Archive;
+import org.junit.Ignore;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+
+@Ignore
+(a)RunWith(Arquillian.class)
+public class BusinessProcessTest
+ extends JUnitSeamTest
+{
+ @Deployment(name="BusinessProcessTest")
+ @OverProtocol("Servlet 3.0")
+ public static Archive<?> createDeployment()
+ {
+ return Deployments.jbpmSeamDeployment().addClasses(ProcessComponent.class);
+ }
+
+ @Test
+ public void noProcessDefinition()
+ throws Exception
+ {
+ new FacesRequest() {
+ @Override
+ protected void invokeApplication() throws Exception {
+ try {
+ invokeAction("#{bpmTest.startInvalid}");
+ assert false;
+ } catch (Exception e) {
+ // expected
+ }
+ }
+
+ }.run();
+ }
+
+ @Test
+ public void noVariableStart()
+ throws Exception
+ {
+ new FacesRequest() {
+ @Override
+ protected void invokeApplication() throws Exception {
+ try {
+ invokeAction("#{bpmTest.startOne}");
+ } catch (Exception e) {
+ e.printStackTrace();
+ assert false;
+ }
+ }
+
+ }.run();
+ }
+
+
+ @Name("bpmTest")
+ static public class ProcessComponent {
+ @CreateProcess(definition="NoSuchProcess")
+ public void startInvalid() {
+ }
+
+ @CreateProcess(definition="TestProcess1")
+ public void startOne() {
+ }
+ }
+}
Added: branches/community/Seam_2_3/seam-integration-tests-ee6/src/test/java/org/jboss/seam/test/integration/ConcurrentFactoryTest.java
===================================================================
--- branches/community/Seam_2_3/seam-integration-tests-ee6/src/test/java/org/jboss/seam/test/integration/ConcurrentFactoryTest.java (rev 0)
+++ branches/community/Seam_2_3/seam-integration-tests-ee6/src/test/java/org/jboss/seam/test/integration/ConcurrentFactoryTest.java 2012-02-28 13:53:30 UTC (rev 14333)
@@ -0,0 +1,76 @@
+package org.jboss.seam.test.integration;
+
+import static org.jboss.seam.ScopeType.APPLICATION;
+
+import org.jboss.arquillian.container.test.api.Deployment;
+import org.jboss.arquillian.container.test.api.OverProtocol;
+import org.jboss.arquillian.junit.Arquillian;
+import org.jboss.seam.annotations.Factory;
+import org.jboss.seam.annotations.In;
+import org.jboss.seam.annotations.Name;
+import org.jboss.seam.contexts.ServletLifecycle;
+import org.jboss.seam.mock.JUnitSeamTest;
+import org.junit.Ignore;
+import org.junit.Test;
+import org.junit.After;
+import org.junit.runner.RunWith;
+
+public class ConcurrentFactoryTest
+ extends JUnitSeamTest
+{
+
+ // TODO: Implement a different way to run concurrent test for junit
+ // @Test(threadPoolSize = 2, invocationCount = 2)
+ @Test
+ @Ignore
+ public void concurrentFactoryCall()
+ throws Exception
+ {
+ new ComponentTest() {
+ @Override
+ protected void testComponents() throws Exception {
+ assert "slowly created String".equals(getValue("#{concurrentFactoryTest.component.injectedString}"));
+ }
+ }.run();
+ }
+
+ @After
+ @Override
+ public void end()
+ {
+ if (session != null) {
+ // Because we run in threads. Only the first thread that finishes ends the session.
+ ServletLifecycle.endSession(session);
+ }
+ session = null;
+ }
+
+ @Name("concurrentFactoryTest.component")
+ static public class Component {
+ @In(value = "concurrentFactoryTest.slowlyCreatedString") String injectedString;
+
+ public String getInjectedString() {
+ return injectedString;
+ }
+ }
+
+ @Name("concurrentFactoryTest.SlowFactory")
+ static public class SlowFactory {
+ @Factory(value = "concurrentFactoryTest.slowlyCreatedString", scope = APPLICATION, autoCreate = true)
+ public String slowlyCreateString() {
+ try
+ {
+ Thread.sleep(1000);
+ return "slowly created String";
+ }
+ catch (InterruptedException e)
+ {
+ e.printStackTrace();
+ return null;
+ }
+ }
+ }
+
+
+
+}
Added: branches/community/Seam_2_3/seam-integration-tests-ee6/src/test/java/org/jboss/seam/test/integration/ConversationTest.java
===================================================================
--- branches/community/Seam_2_3/seam-integration-tests-ee6/src/test/java/org/jboss/seam/test/integration/ConversationTest.java (rev 0)
+++ branches/community/Seam_2_3/seam-integration-tests-ee6/src/test/java/org/jboss/seam/test/integration/ConversationTest.java 2012-02-28 13:53:30 UTC (rev 14333)
@@ -0,0 +1,460 @@
+package org.jboss.seam.test.integration;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import javax.faces.model.SelectItem;
+
+import org.jboss.arquillian.container.test.api.Deployment;
+import org.jboss.arquillian.container.test.api.OverProtocol;
+import org.jboss.arquillian.junit.Arquillian;
+import org.jboss.seam.core.ConversationEntries;
+import org.jboss.seam.core.ConversationEntry;
+import org.jboss.seam.core.Manager;
+import org.jboss.seam.faces.Switcher;
+import org.jboss.seam.mock.JUnitSeamTest;
+import org.jboss.shrinkwrap.api.Archive;
+import org.jboss.shrinkwrap.api.ShrinkWrap;
+import org.jboss.shrinkwrap.api.asset.StringAsset;
+import org.jboss.shrinkwrap.api.spec.WebArchive;
+
+import org.junit.After;
+import org.junit.Before;
+import org.junit.BeforeClass;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+
+(a)RunWith(Arquillian.class)
+public class ConversationTest
+ extends JUnitSeamTest
+{
+ @Deployment(name="ConversationTest")
+ @OverProtocol("Servlet 3.0")
+ public static Archive<?> createDeployment()
+ {
+ return Deployments.defaultSeamDeployment();
+ }
+
+ @Test
+ public void conversationStack()
+ throws Exception
+ {
+ // no conversation, no stack
+ new FacesRequest("/pageWithDescription.xhtml") {
+ @Override
+ protected void renderResponse() throws Exception {
+ List<ConversationEntry> entries = (List<ConversationEntry>) getValue("#{conversationStack}");
+ assert entries.size() == 0;
+ }
+ }.run();
+
+ // no conversation, no stack
+ new FacesRequest("/pageWithoutDescription.xhtml") {
+ @Override
+ protected void invokeApplication() throws Exception {
+ Manager.instance().beginConversation();
+ }
+
+ @Override
+ protected void renderResponse() throws Exception {
+ List<ConversationEntry> entries = (List<ConversationEntry>) getValue("#{conversationStack}");
+ assert entries.size() == 0;
+ }
+ }.run();
+
+ // new conversation, stack = 1
+ String rootId = new FacesRequest("/pageWithDescription.xhtml") {
+ @Override
+ protected void invokeApplication() throws Exception {
+ Manager.instance().beginConversation();
+ }
+
+ @Override
+ protected void renderResponse() throws Exception {
+ List<ConversationEntry> entries = (List<ConversationEntry>) getValue("#{conversationStack}");
+ assert entries.size() == 1;
+ }
+ }.run();
+
+ // nested conversation, stack =2
+ String nested1 = new FacesRequest("/pageWithDescription.xhtml", rootId) {
+ @Override
+ protected void invokeApplication() throws Exception {
+ Manager.instance().beginNestedConversation();
+ }
+
+ @Override
+ protected void renderResponse() throws Exception {
+ List<ConversationEntry> entries = (List<ConversationEntry>) getValue("#{conversationStack}");
+ assert entries.size() == 2;
+ }
+
+ }.run();
+
+ // nested conversation without description, not added to stack
+ String nested2 = new FacesRequest("/pageWithoutDescription.xhtml", nested1) {
+ @Override
+ protected void invokeApplication() throws Exception {
+ Manager.instance().beginNestedConversation();
+ }
+
+ @Override
+ protected void renderResponse() throws Exception {
+ List<ConversationEntry> entries = (List<ConversationEntry>) getValue("#{conversationStack}");
+ assert entries.size() == 2;
+ }
+ }.run();
+
+ // access a page, now it's on the stack
+ new FacesRequest("/pageWithDescription.xhtml", nested2) {
+ @Override
+ protected void renderResponse() throws Exception {
+ List<ConversationEntry> entries = (List<ConversationEntry>) getValue("#{conversationStack}");
+ assert entries.size() == 3;
+ }
+ }.run();
+
+ // end conversation, stack goes down
+ new FacesRequest("/pageWithDescription.xhtml", nested2) {
+ @Override
+ protected void invokeApplication() throws Exception {
+ Manager.instance().endConversation(false);
+ }
+
+ @Override
+ protected void renderResponse() throws Exception {
+ List<ConversationEntry> entries = (List<ConversationEntry>) getValue("#{conversationStack}");
+ assert entries.size() == 2;
+ }
+ }.run();
+
+ // end another one, size is 1
+ new FacesRequest("/pageWithDescription.xhtml", nested1) {
+ @Override
+ protected void invokeApplication() throws Exception {
+ Manager.instance().endConversation(false);
+ }
+
+ @Override
+ protected void renderResponse() throws Exception {
+ List<ConversationEntry> entries = (List<ConversationEntry>) getValue("#{conversationStack}");
+ assert entries.size() == 1;
+ }
+ }.run();
+ }
+
+ @Test
+ public void conversationList()
+ throws Exception
+ {
+ new FacesRequest("/pageWithDescription.xhtml") {
+ @Override
+ protected void renderResponse() throws Exception {
+ List<ConversationEntry> entries = (List<ConversationEntry>) getValue("#{conversationList}");
+ assert entries.size() == 0;
+ }
+ }.run();
+
+ new FacesRequest("/pageWithoutDescription.xhtml") {
+ @Override
+ protected void invokeApplication() throws Exception {
+ Manager.instance().beginConversation();
+ }
+
+ @Override
+ protected void renderResponse() throws Exception {
+ List<ConversationEntry> entries = (List<ConversationEntry>) getValue("#{conversationList}");
+ assert entries.size() == 0;
+ }
+ }.run();
+
+ String conv1 = new FacesRequest("/pageWithDescription.xhtml") {
+ @Override
+ protected void invokeApplication() throws Exception {
+ Manager.instance().beginConversation();
+ }
+
+ @Override
+ protected void renderResponse() throws Exception {
+ List<ConversationEntry> entries = (List<ConversationEntry>) getValue("#{conversationList}");
+ assert entries.size() == 1;
+ }
+ }.run();
+
+ String conv2 = new FacesRequest("/pageWithDescription.xhtml") {
+ @Override
+ protected void invokeApplication() throws Exception {
+ Manager.instance().beginConversation();
+ }
+
+ @Override
+ protected void renderResponse() throws Exception {
+ List<ConversationEntry> entries = (List<ConversationEntry>) getValue("#{conversationList}");
+ assert entries.size() == 2;
+ }
+ }.run();
+
+ String conv3 = new FacesRequest("/pageWithDescription.xhtml") {
+ @Override
+ protected void invokeApplication() throws Exception {
+ Manager.instance().beginConversation();
+ }
+
+ @Override
+ protected void renderResponse() throws Exception {
+ List<ConversationEntry> entries = (List<ConversationEntry>) getValue("#{conversationList}");
+ assert entries.size() == 3;
+ }
+ }.run();
+
+
+ new FacesRequest("/pageWithDescription", conv2) {
+ @Override
+ protected void invokeApplication() throws Exception {
+ Manager.instance().endConversation(true);
+ }
+
+ @Override
+ protected void renderResponse() throws Exception {
+ List<ConversationEntry> entries = (List<ConversationEntry>) getValue("#{conversationList}");
+ assert entries.size() == 2;
+ }
+ }.run();
+
+ new FacesRequest("/pageWithDescription", conv1) {
+ @Override
+ protected void invokeApplication() throws Exception {
+ Manager.instance().endConversation(true);
+ }
+
+ @Override
+ protected void renderResponse() throws Exception {
+ List<ConversationEntry> entries = (List<ConversationEntry>) getValue("#{conversationList}");
+ assert entries.size() == 1;
+ }
+ }.run();
+
+
+ new FacesRequest("/pageWithDescription", conv3) {
+ @Override
+ protected void invokeApplication() throws Exception {
+ Manager.instance().endConversation(true);
+ }
+
+ @Override
+ protected void renderResponse() throws Exception {
+ List<ConversationEntry> entries = (List<ConversationEntry>) getValue("#{conversationList}");
+ assert entries.size() == 0;
+ }
+ }.run();
+ }
+
+
+ @Test
+ public void switcher()
+ throws Exception
+ {
+ new FacesRequest("/pageWithDescription.xhtml") {
+ @Override
+ protected void renderResponse() throws Exception {
+ Switcher switcher = (Switcher) getValue("#{switcher}");
+ assert switcher.getSelectItems().size() == 0;
+ assert switcher.getConversationIdOrOutcome() == null;
+ }
+ }.run();
+
+
+ final String conv1 = new FacesRequest("/pageWithDescription.xhtml") {
+ @Override
+ protected void invokeApplication() throws Exception {
+ Manager.instance().beginConversation();
+ }
+
+ @Override
+ protected void renderResponse() throws Exception {
+ Switcher switcher = (Switcher) getValue("#{switcher}");
+ assert switcher.getSelectItems().size() == 1;
+ }
+ }.run();
+
+ final String conv2 = new FacesRequest("/pageWithDescription.xhtml") {
+ @Override
+ protected void invokeApplication() throws Exception {
+ Manager.instance().beginConversation();
+ }
+
+ @Override
+ protected void renderResponse() throws Exception {
+ Switcher switcher = (Switcher) getValue("#{switcher}");
+ assert switcher.getSelectItems().size() == 2;
+ }
+ }.run();
+
+ final String conv3 = new FacesRequest("/pageWithDescription.xhtml") {
+ @Override
+ protected void invokeApplication() throws Exception {
+ Manager.instance().beginConversation();
+ }
+
+ @Override
+ protected void renderResponse() throws Exception {
+ Switcher switcher = (Switcher) getValue("#{switcher}");
+ assert switcher.getSelectItems().size() == 3;
+ }
+ }.run();
+
+ new FacesRequest() {
+ @Override
+ protected void renderResponse() throws Exception {
+ Switcher switcher = (Switcher) getValue("#{switcher}");
+ assert switcher.getSelectItems().size() == 3;
+
+ List<SelectItem> items = switcher.getSelectItems();
+ List<String> values = new ArrayList<String>();
+ for (SelectItem item: items) {
+ assert item.getLabel().equals("page description");
+ values.add((String) item.getValue());
+ }
+
+ assert values.contains(conv1);
+ assert values.contains(conv2);
+ assert values.contains(conv3);
+ }
+ }.run();
+
+ new FacesRequest("/pageWithDescription.xhtml", conv1) {
+ @Override
+ protected void invokeApplication() throws Exception {
+ Manager.instance().endConversation(true);
+ }
+ }.run();
+
+ new FacesRequest("/pageWithDescription.xhtml", conv2) {
+ @Override
+ protected void invokeApplication() throws Exception {
+ Manager.instance().endConversation(true);
+ }
+
+ @Override
+ protected void renderResponse() throws Exception {
+ Switcher switcher = (Switcher) getValue("#{switcher}");
+ assert switcher.getSelectItems().size() == 1;
+ assert switcher.getSelectItems().get(0).getLabel().equals("page description");
+ assert switcher.getSelectItems().get(0).getValue().equals(conv3);
+ }
+ }.run();
+
+ new FacesRequest("/pageWithAnotherDescription.xhtml", conv3) {
+ @Override
+ protected void renderResponse() throws Exception {
+ Switcher switcher = (Switcher) getValue("#{switcher}");
+ assert switcher.getSelectItems().size() == 1;
+
+ assert switcher.getSelectItems().get(0).getLabel().equals("another page description");
+ assert switcher.getSelectItems().get(0).getValue().equals(conv3);
+ }
+ }.run();
+ }
+
+ @Test
+ public void killAllOthers() throws Exception
+ {
+ new FacesRequest("/pageWithAnotherDescription.xhtml") {
+ @Override
+ protected void invokeApplication() throws Exception
+ {
+ Manager.instance().beginConversation();
+ }
+
+ @Override
+ protected void renderResponse() throws Exception
+ {
+ assert ConversationEntries.instance().size() == 1;
+ }
+ }.run();
+
+ new FacesRequest("/pageWithoutDescription.xhtml") {
+ @Override
+ protected void invokeApplication() throws Exception
+ {
+ Manager.instance().beginConversation();
+ }
+
+ @Override
+ protected void renderResponse() throws Exception
+ {
+ assert ConversationEntries.instance().size() == 2;
+ }
+ }.run();
+
+ new FacesRequest("/pageWithDescription.xhtml") {
+ @Override
+ protected void invokeApplication() throws Exception
+ {
+ Manager.instance().beginConversation();
+ Manager.instance().killAllOtherConversations();
+ }
+
+ @Override
+ protected void renderResponse() throws Exception
+ {
+ assert ConversationEntries.instance().size() == 1;
+ }
+ }.run();
+
+ }
+
+ @Test
+ public void nestedKillAllOthers() throws Exception
+ {
+
+ final String unrelated = new FacesRequest("/pageWithoutDescription.xhtml") {
+ @Override
+ protected void invokeApplication() throws Exception
+ {
+ Manager.instance().beginConversation();
+ }
+
+ @Override
+ protected void renderResponse() throws Exception
+ {
+ assert ConversationEntries.instance().size() == 1;
+ }
+ }.run();
+
+ String root = new FacesRequest("/pageWithDescription.xhtml") {
+ @Override
+ protected void invokeApplication() throws Exception
+ {
+ Manager.instance().beginConversation();
+ }
+
+ @Override
+ protected void renderResponse() throws Exception
+ {
+ assert ConversationEntries.instance().size() == 2;
+ }
+ }.run();
+
+ // nested conversation
+ new FacesRequest("/pageWithDescription.xhtml", root) {
+ @Override
+ protected void invokeApplication() throws Exception
+ {
+ Manager.instance().beginNestedConversation();
+ }
+
+ @Override
+ protected void renderResponse() throws Exception
+ {
+ assert ConversationEntries.instance().size() == 3;
+
+ Manager.instance().killAllOtherConversations();
+ assert ConversationEntries.instance().size() == 2;
+ assert ConversationEntries.instance().getConversationIds()
+ .contains(unrelated) == false;
+ }
+
+ }.run();
+ }
+}
Added: branches/community/Seam_2_3/seam-integration-tests-ee6/src/test/java/org/jboss/seam/test/integration/Country.java
===================================================================
--- branches/community/Seam_2_3/seam-integration-tests-ee6/src/test/java/org/jboss/seam/test/integration/Country.java (rev 0)
+++ branches/community/Seam_2_3/seam-integration-tests-ee6/src/test/java/org/jboss/seam/test/integration/Country.java 2012-02-28 13:53:30 UTC (rev 14333)
@@ -0,0 +1,54 @@
+package org.jboss.seam.test.integration;
+
+import javax.persistence.Entity;
+import javax.persistence.GeneratedValue;
+import javax.persistence.Id;
+
+/**
+ * @author Pete Muir
+ *
+ */
+@Entity
+public class Country
+{
+
+ @Id @GeneratedValue
+ private Integer id;
+
+ private String name;
+
+ /**
+ * @return the id
+ */
+ public Integer getId()
+ {
+ return this.id;
+ }
+
+ /**
+ * @param id the id to set
+ */
+ public void setId(Integer id)
+ {
+ this.id = id;
+ }
+
+ /**
+ * @return the name
+ */
+ public String getName()
+ {
+ return this.name;
+ }
+
+ /**
+ * @param name the name to set
+ */
+ public void setName(String name)
+ {
+ this.name = name;
+ }
+
+
+
+}
Added: branches/community/Seam_2_3/seam-integration-tests-ee6/src/test/java/org/jboss/seam/test/integration/CountryHome.java
===================================================================
--- branches/community/Seam_2_3/seam-integration-tests-ee6/src/test/java/org/jboss/seam/test/integration/CountryHome.java (rev 0)
+++ branches/community/Seam_2_3/seam-integration-tests-ee6/src/test/java/org/jboss/seam/test/integration/CountryHome.java 2012-02-28 13:53:30 UTC (rev 14333)
@@ -0,0 +1,14 @@
+package org.jboss.seam.test.integration;
+
+import org.jboss.seam.annotations.Name;
+import org.jboss.seam.framework.EntityHome;
+
+/**
+ * @author Pete Muir
+ *
+ */
+@Name("countryHome")
+public class CountryHome extends EntityHome<Country>
+{
+
+}
Added: branches/community/Seam_2_3/seam-integration-tests-ee6/src/test/java/org/jboss/seam/test/integration/Deployments.java
===================================================================
--- branches/community/Seam_2_3/seam-integration-tests-ee6/src/test/java/org/jboss/seam/test/integration/Deployments.java (rev 0)
+++ branches/community/Seam_2_3/seam-integration-tests-ee6/src/test/java/org/jboss/seam/test/integration/Deployments.java 2012-02-28 13:53:30 UTC (rev 14333)
@@ -0,0 +1,82 @@
+package org.jboss.seam.test.integration;
+
+import org.jboss.seam.test.integration.bpm.SeamExpressionEvaluatorTestController;
+import org.jboss.shrinkwrap.api.Archive;
+import org.jboss.shrinkwrap.api.ShrinkWrap;
+import org.jboss.shrinkwrap.api.asset.StringAsset;
+import org.jboss.shrinkwrap.api.spec.WebArchive;
+
+import org.jboss.shrinkwrap.resolver.api.DependencyResolvers;
+import org.jboss.shrinkwrap.resolver.api.maven.MavenDependencyResolver;
+
+public class Deployments {
+ public static WebArchive defaultSeamDeployment() {
+ return ShrinkWrap.create(WebArchive.class, "test.war")
+ .addAsWebInfResource(new StringAsset(
+ "<jboss-deployment-structure>" +
+ "<deployment>" +
+ "<dependencies>" +
+ "<module name=\"org.javassist\"/>" +
+ "<module name=\"org.dom4j\"/>" +
+ "</dependencies>" +
+ "</deployment>" +
+ "</jboss-deployment-structure>"), "jboss-deployment-structure.xml")
+ .addAsResource("seam.properties")
+ .addAsResource("components.properties")
+ .addAsResource("messages_en.properties")
+ .addAsResource("META-INF/persistence.xml")
+
+ //.addAsWebInfResource(new StringAsset("org.jboss.seam.mock.MockFacesContextFactory"), "classes/META-INF/services/javax.faces.context.FacesContextFactory")
+ //.addAsWebInfResource(new StringAsset("org.jboss.seam.mock.MockApplicationFactory"), "classes/META-INF/services/javax.faces.application.ApplicationFactory")
+
+ .addAsResource("hibernate.cfg.xml")
+ .addAsWebInfResource("WEB-INF/components.xml", "components.xml")
+ .addAsWebInfResource("WEB-INF/pages.xml", "pages.xml")
+
+ .addAsWebInfResource("WEB-INF/web.xml", "web.xml")
+
+ .addAsLibraries(DependencyResolvers.use(MavenDependencyResolver.class)
+ .configureFrom("pom.xml")
+ .goOffline()
+ .artifact("org.jboss.seam:jboss-seam-jsf2:2.3.0-SNAPSHOT")
+ .resolveAsFiles());
+ }
+
+ public static WebArchive jbpmSeamDeployment() {
+ return ShrinkWrap.create(WebArchive.class, "test.war")
+ .addAsWebInfResource(new StringAsset(
+ "<jboss-deployment-structure>" +
+ "<deployment>" +
+ "<dependencies>" +
+ "<module name=\"org.javassist\"/>" +
+ "<module name=\"org.dom4j\"/>" +
+ "<module name=\"org.apache.commons.collections\"/>" +
+ "</dependencies>" +
+ "</deployment>" +
+ "</jboss-deployment-structure>"), "jboss-deployment-structure.xml")
+ .addAsResource("seam.properties")
+ .addAsResource("components.properties")
+ .addAsResource("messages_en.properties")
+ .addAsResource("META-INF/persistence.xml")
+ .addAsResource("testProcess1.jpdl.xml")
+ .addAsResource("testProcess2.jpdl.xml")
+ .addAsResource("testProcess3.jpdl.xml")
+ .addAsResource("testProcess4.jpdl.xml")
+
+ .addAsResource("jbpm.cfg.xml")
+
+ .addAsResource("hibernate.cfg.xml")
+ .addAsWebInfResource("WEB-INF/components-jbpm.xml", "components.xml")
+ .addAsWebInfResource("WEB-INF/pages.xml", "pages.xml")
+
+ .addAsWebInfResource("WEB-INF/web.xml", "web.xml")
+
+ .addAsLibraries(DependencyResolvers.use(MavenDependencyResolver.class)
+ .configureFrom("pom.xml")
+ .goOffline()
+ .artifact("org.jboss.seam:jboss-seam-jsf2:2.3.0-SNAPSHOT")
+ .artifact("org.jbpm.jbpm3:jbpm-jpdl:3.2.10.SP3-seam2")
+ .exclusion("org.hibernate:hibernate-core")
+ .resolveAsFiles());
+ }
+}
Added: branches/community/Seam_2_3/seam-integration-tests-ee6/src/test/java/org/jboss/seam/test/integration/ELTest.java
===================================================================
--- branches/community/Seam_2_3/seam-integration-tests-ee6/src/test/java/org/jboss/seam/test/integration/ELTest.java (rev 0)
+++ branches/community/Seam_2_3/seam-integration-tests-ee6/src/test/java/org/jboss/seam/test/integration/ELTest.java 2012-02-28 13:53:30 UTC (rev 14333)
@@ -0,0 +1,143 @@
+package org.jboss.seam.test.integration;
+
+import javax.el.ELException;
+import javax.faces.el.MethodBinding;
+import javax.faces.el.ValueBinding;
+
+import org.jboss.arquillian.container.test.api.Deployment;
+import org.jboss.arquillian.container.test.api.OverProtocol;
+import org.jboss.arquillian.junit.Arquillian;
+import org.jboss.seam.jsf.UnifiedELMethodBinding;
+import org.jboss.seam.jsf.UnifiedELValueBinding;
+import org.jboss.seam.mock.JUnitSeamTest;
+import org.jboss.shrinkwrap.api.Archive;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+
+
+/**
+ *
+ * @author Pete Muir
+ *
+ */
+public class ELTest extends JUnitSeamTest
+{
+ @Test
+ public void testUnifiedELMethodBinding() throws Exception
+ {
+ new FacesRequest()
+ {
+ @SuppressWarnings("deprecation")
+ @Override
+ protected void invokeApplication() throws Exception
+ {
+ MethodBinding methodBinding = new UnifiedELMethodBinding("#{action.go}", new Class[0]);
+
+ assert "#{action.go}".equals(methodBinding.getExpressionString());
+
+ assert String.class.equals(methodBinding.getType(getFacesContext()));
+
+ Object result = methodBinding.invoke(getFacesContext(), new Object[0]);
+
+ assert result instanceof String;
+ assert "success".equals(result);
+ }
+ }.run();
+ }
+
+ @Test
+ public void testUnifiedELMethodBindingWithNull() throws Exception
+ {
+ new FacesRequest()
+ {
+ @SuppressWarnings("deprecation")
+ @Override
+ protected void invokeApplication() throws Exception
+ {
+
+ MethodBinding methodBinding = new UnifiedELMethodBinding("#{action.go}", null);
+
+ assert String.class.equals(methodBinding.getType(getFacesContext()));
+
+ Object result = methodBinding.invoke(getFacesContext(), null);
+
+ assert result instanceof String;
+ assert "success".equals(result);
+ }
+ }.run();
+ }
+
+ @Test
+ public void testEmptyUnifiedELMethodBinding() throws Exception
+ {
+ new FacesRequest()
+ {
+ @SuppressWarnings("deprecation")
+ @Override
+ protected void invokeApplication() throws Exception
+ {
+
+ MethodBinding methodBinding = new UnifiedELMethodBinding();
+ boolean failed = false;
+ try
+ {
+ methodBinding.invoke(getFacesContext(), null);
+ }
+ catch (ELException e) {
+ failed = true;
+ }
+ assert failed;
+ }
+ }.run();
+ }
+
+ @Test
+ public void testUnifiedELValueBinding() throws Exception
+ {
+ new FacesRequest()
+ {
+ @SuppressWarnings("deprecation")
+ @Override
+ protected void invokeApplication() throws Exception
+ {
+ ValueBinding valueBinding = new UnifiedELValueBinding("#{person.name}");
+
+ assert "#{person.name}".equals(valueBinding.getExpressionString());
+
+ assert !valueBinding.isReadOnly(getFacesContext());
+
+ assert String.class.equals(valueBinding.getType(getFacesContext()));
+
+ valueBinding.setValue(getFacesContext(), "Pete");
+
+ assert "Pete".equals(valueBinding.getValue(getFacesContext()));
+ }
+ }.run();
+ }
+
+ @Test
+ public void testEmptyUnifiedELValueBinding() throws Exception
+ {
+ new FacesRequest()
+ {
+ @SuppressWarnings("deprecation")
+ @Override
+ protected void invokeApplication() throws Exception
+ {
+
+ ValueBinding valueBinding = new UnifiedELValueBinding();
+ boolean failed = false;
+ try
+ {
+ valueBinding.setValue(getFacesContext(), "Pete");
+ valueBinding.getValue(getFacesContext());
+ }
+ catch (ELException e) {
+ failed = true;
+ }
+ assert failed;
+ }
+ }.run();
+ }
+
+}
Added: branches/community/Seam_2_3/seam-integration-tests-ee6/src/test/java/org/jboss/seam/test/integration/EntityPassivationTest.java
===================================================================
--- branches/community/Seam_2_3/seam-integration-tests-ee6/src/test/java/org/jboss/seam/test/integration/EntityPassivationTest.java (rev 0)
+++ branches/community/Seam_2_3/seam-integration-tests-ee6/src/test/java/org/jboss/seam/test/integration/EntityPassivationTest.java 2012-02-28 13:53:30 UTC (rev 14333)
@@ -0,0 +1,265 @@
+package org.jboss.seam.test.integration;
+
+import java.io.Serializable;
+import java.util.Arrays;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+
+import javax.persistence.EntityManager;
+
+import org.jboss.arquillian.container.test.api.Deployment;
+import org.jboss.arquillian.container.test.api.OverProtocol;
+import org.jboss.arquillian.junit.Arquillian;
+import org.jboss.seam.Component;
+import org.jboss.seam.ScopeType;
+import org.jboss.seam.annotations.AutoCreate;
+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.contexts.Contexts;
+import org.jboss.seam.core.Conversation;
+import org.jboss.seam.mock.JUnitSeamTest;
+import org.jboss.seam.persistence.ManagedEntityInterceptor;
+import org.jboss.shrinkwrap.api.Archive;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+
+/**
+ * Verifies the work of the ManagedEntityInterceptor. Specifically that
+ * collections containing entity instances are properly put into the session and
+ * pulled back into the conversation-scoped component between requests (during a
+ * potential period of passivation of the SFSB). The test also verifies that
+ * when a component in a nested conversation calls a component in a parent
+ * conversation, that the passivated state is kept with the parent conversation.
+ *
+ * @author Norman Richards
+ * @author Dan Allen
+ */
+(a)RunWith(Arquillian.class)
+public class EntityPassivationTest extends JUnitSeamTest
+{
+ @Deployment(name="EntityPassivationTest")
+ @OverProtocol("Servlet 3.0")
+ public static Archive<?> createDeployment()
+ {
+ return Deployments.defaultSeamDeployment()
+ .addClasses(SomeComponent.class, NestedComponent.class, UnversionedThing.class);
+ }
+
+ @Test
+ public void testEntityList() throws Exception
+ {
+ String pid = new FacesRequest("/test.xhtml")
+ {
+ @Override
+ protected void invokeApplication() throws Exception
+ {
+ // MEI is not installed by default, so we need to enable it
+ Component.forName("entitytest.someComponent").addInterceptor(new ManagedEntityInterceptor());
+ Component.forName("entitytest.nestedComponent").addInterceptor(new ManagedEntityInterceptor());
+
+ Conversation.instance().begin(true, false);
+
+ invokeAction("#{entitytest.someComponent.createSomeThings}");
+ invokeAction("#{entitytest.someComponent.loadThings}");
+ }
+
+ @Override
+ protected void renderResponse() throws Exception
+ {
+ Object thing = getValue("#{entitytest.someComponent.thing}");
+ assert thing != null;
+
+ List thingList = (List) getValue("#{entitytest.someComponent.thingsAsList}");
+ assert thingList != null && !thingList.isEmpty();
+ assert thingList.get(0) != null;
+
+ Set thingSet = (Set) getValue("#{entitytest.someComponent.thingsAsSet}");
+ assert thingSet != null && thingSet.size() > 0;
+ assert thingSet.iterator().next() != null;
+
+ Map thingMap = (Map) getValue("#{entitytest.someComponent.thingsAsMap}");
+ assert thingMap != null && thingMap.size() > 0;
+ }
+ }.run();
+
+ new FacesRequest("/test.xhtml", pid)
+ {
+ // the entities should be passivated
+ }.run();
+
+ new FacesRequest("/test.xhtml", pid)
+ {
+ // passivated a second time
+ }.run();
+
+ new FacesRequest("/test.xhtml", pid)
+ {
+ @Override
+ protected void renderResponse() throws Exception
+ {
+ Object thing = getValue("#{entitytest.someComponent.thing}");
+ assert thing != null;
+
+ List thingList = (List) getValue("#{entitytest.someComponent.thingsAsList}");
+ assert thingList != null && !thingList.isEmpty();
+ assert thingList.get(0) != null;
+
+ Set thingSet = (Set) getValue("#{entitytest.someComponent.thingsAsSet}");
+ assert thingSet != null && thingSet.size() > 0;
+ assert thingSet.iterator().next() != null;
+
+ Map thingMap = (Map) getValue("#{entitytest.someComponent.thingsAsMap}");
+ assert thingMap != null && thingMap.size() > 0;
+ }
+
+ }.run();
+
+ // Start a nested conversation to verify that calls to a component in a parent conversation
+ // will passivate that component's state in the parent conversation context and not in
+ // the nested conversation. Thus, when the parent conversation is restored, its state
+ // will be properly restored.
+ String nid = new FacesRequest("/test.xhtml", pid)
+ {
+ @Override
+ protected void invokeApplication() throws Exception
+ {
+ invokeMethod("#{entitytest.nestedComponent.nest}");
+ }
+
+ @Override
+ protected void renderResponse() throws Exception
+ {
+ assert Conversation.instance().isNested();
+ }
+
+ }.run();
+
+ new FacesRequest("/test.xhtml", nid)
+ {
+ @Override
+ protected void invokeApplication() throws Exception
+ {
+ // invoke component in parent conversation from nested conversation
+ invokeMethod("#{entitytest.someComponent.removeFirstThingFromList}");
+ }
+
+ @Override
+ protected void renderResponse() throws Exception
+ {
+ // the nested conversation should not hold the serialized property of the component in the parent conversation
+ assert !Arrays.asList(Contexts.getConversationContext().getNames()).contains("entitytest.someComponent.thingList");
+ List thingList = (List) getValue("#{entitytest.someComponent.thingsAsList}");
+ assert thingList.size() == 1;
+ }
+ }.run();
+
+ new FacesRequest("/test.xhtml", nid)
+ {
+ @Override
+ protected void invokeApplication() throws Exception
+ {
+ invokeMethod("#{entitytest.nestedComponent.end}");
+ }
+ }.run();
+
+ new FacesRequest("/test.xhtml", pid)
+ {
+ @Override
+ protected void renderResponse() throws Exception
+ {
+ // The state of the component in the parent conversation should be preserved.
+ List thingList = (List) getValue("#{entitytest.someComponent.thingsAsList}");
+ assert thingList.size() == 1;
+ }
+ }.run();
+ }
+
+ @Name("entitytest.someComponent")
+ @Scope(ScopeType.CONVERSATION)
+ @AutoCreate
+ public static class SomeComponent implements Serializable
+ {
+ @In
+ EntityManager entityManager;
+
+ Set<UnversionedThing> thingSet;
+ List<UnversionedThing> thingList;
+ Map<Long, UnversionedThing> thingMap;
+ UnversionedThing thing;
+
+ public void loadThings()
+ {
+ thingList = entityManager.createQuery("select t from UnversionedThing t").getResultList();
+ thingSet = new HashSet<UnversionedThing>(thingList);
+
+ thingMap = new HashMap<Long, UnversionedThing>();
+ for (UnversionedThing thing : thingList)
+ {
+ thingMap.put(thing.getId(), thing);
+ }
+
+ thing = thingList.get(0);
+ }
+
+ public List<UnversionedThing> getThingsAsList()
+ {
+ return thingList;
+ }
+
+ public Set<UnversionedThing> getThingsAsSet()
+ {
+ return thingSet;
+ }
+
+ public Map<Long, UnversionedThing> getThingsAsMap()
+ {
+ return thingMap;
+ }
+
+ public UnversionedThing getThing()
+ {
+ return thing;
+ }
+
+ public void removeFirstThingFromList()
+ {
+ loadThings();
+ thingList.remove(0);
+ }
+
+ public void createSomeThings()
+ {
+ UnversionedThing thing1 = new UnversionedThing();
+ thing1.setName("thing one");
+ entityManager.persist(thing1);
+
+ UnversionedThing thing2 = new UnversionedThing();
+ thing2.setName("thing two");
+ entityManager.persist(thing2);
+ }
+ }
+
+ @Name("entitytest.nestedComponent")
+ @Scope(ScopeType.CONVERSATION)
+ @AutoCreate
+ public static class NestedComponent implements Serializable
+ {
+ @In
+ EntityManager entityManager;
+
+ @Begin(nested = true)
+ public void nest()
+ {
+ }
+
+ public void end()
+ {
+ Conversation.instance().end();
+ }
+ }
+}
Added: branches/community/Seam_2_3/seam-integration-tests-ee6/src/test/java/org/jboss/seam/test/integration/EntityTest.java
===================================================================
--- branches/community/Seam_2_3/seam-integration-tests-ee6/src/test/java/org/jboss/seam/test/integration/EntityTest.java (rev 0)
+++ branches/community/Seam_2_3/seam-integration-tests-ee6/src/test/java/org/jboss/seam/test/integration/EntityTest.java 2012-02-28 13:53:30 UTC (rev 14333)
@@ -0,0 +1,166 @@
+package org.jboss.seam.test.integration;
+
+import org.jboss.arquillian.container.test.api.Deployment;
+import org.jboss.arquillian.container.test.api.OverProtocol;
+import org.jboss.arquillian.junit.Arquillian;
+import org.jboss.seam.mock.JUnitSeamTest;
+import java.util.HashMap;
+import java.util.Map;
+
+import javax.persistence.EntityManager;
+
+import org.jboss.seam.annotations.Name;
+import org.jboss.seam.annotations.Observer;
+import org.jboss.seam.contexts.Contexts;
+import org.jboss.seam.core.Manager;
+import org.jboss.shrinkwrap.api.Archive;
+import org.junit.Assert;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+
+(a)RunWith(Arquillian.class)
+public class EntityTest
+ extends JUnitSeamTest
+{
+ @Deployment(name="EntityTest")
+ @OverProtocol("Servlet 3.0")
+ public static Archive<?> createDeployment()
+ {
+ return Deployments.defaultSeamDeployment()
+ .addClasses(Thing.class);
+ }
+
+ @Test
+ public void entityUpdatedInNestedConversation() throws Exception {
+ String parentConversation = new FacesRequest("/page.xhtml") {
+ @Override
+ protected void invokeApplication() throws Exception {
+ Thing thing = new Thing();
+ thing.setName("thing");
+ EntityManager entityManager = (EntityManager) getValue("#{entityManager}");
+ entityManager.persist(thing);
+ Contexts.getConversationContext().set("thing", thing);
+ Manager.instance().beginConversation();
+ }
+ }.run();
+
+
+ new FacesRequest("/page.xhtml", parentConversation) {
+ }.run();
+
+ // nested conversation
+ String nestedId = new FacesRequest("/page.xhtml", parentConversation) {
+ @Override
+ protected void invokeApplication() throws Exception {
+ Manager.instance().beginNestedConversation();
+ }
+ }.run();
+
+ // update entity in nested conversation
+ new FacesRequest("/page.xhtml", nestedId) {
+ @Override
+ protected void invokeApplication() throws Exception {
+ Thing thing = (Thing) Contexts.getConversationContext().get("thing");
+ thing.setName("foo");
+ EntityManager entityManager = (EntityManager) getValue("#{entityManager}");
+ entityManager.flush();
+ }
+ }.run();
+
+ // end nested conversation
+ assert new FacesRequest("/page.xhtml", nestedId) {
+ @Override
+ protected void invokeApplication() throws Exception {
+ Manager.instance().endConversation(false);
+ }
+ }.run().equals(parentConversation);
+
+
+ // This tests that the activation in the parent conversation
+ // doesn't fail
+ new FacesRequest("/page.xhtml",parentConversation) {
+ @Override
+ protected void renderResponse() throws Exception {
+ Thing thing = (Thing) Contexts.getConversationContext().get("thing");
+ assert thing.getName().equals("foo");
+ }
+ }.run();
+ }
+
+ @Test
+ public void testStale() throws Exception {
+
+ final Map<String, Long> holder = new HashMap<String, Long>();
+
+ final String conversation1 = new FacesRequest("/page.xhtml") {
+ @Override
+ protected void invokeApplication() throws Exception {
+ Thing thing = new Thing();
+ thing.setName("thing");
+ EntityManager entityManager = (EntityManager) getValue("#{entityManager}");
+ entityManager.persist(thing);
+ holder.put("id", thing.getId());
+ Contexts.getConversationContext().set("thing", thing);
+ Manager.instance().beginConversation();
+ }
+ }.run();
+
+ new FacesRequest("/page.xhtml", conversation1) {
+ }.run();
+
+ // update in second conversation
+ new FacesRequest("/page.xhtml") {
+ @Override
+ @SuppressWarnings("cast")
+ protected void invokeApplication() throws Exception {
+ EntityManager entityManager = (EntityManager) getValue("#{entityManager}");
+ Thing thing = (Thing) entityManager.find(Thing.class, holder.get("id"));
+ thing.setName("foo");
+ entityManager.flush();
+ }
+ }.run();
+
+ new FacesRequest("/page.xhtml", conversation1) {
+ EntityExceptionObserver observer;
+
+ @Override
+ protected void invokeApplication() throws Exception {
+ Thing thing = (Thing) Contexts.getConversationContext().get("thing");
+ thing.setName("bar");
+
+ observer = (EntityExceptionObserver) getValue("#{entityExceptionObserver}");
+ assert observer != null;
+ }
+
+ @Override
+ protected void renderResponse() throws Exception {
+ Assert.fail("page rendered without redirect, expected StaleStateException!");
+ }
+
+ @Override
+ protected void afterRequest() {
+ assert observer.getOptimisticLockExceptionSeen();
+ }
+ }.run();
+ }
+
+ @Name("entityExceptionObserver")
+ public static class EntityExceptionObserver {
+
+ private boolean exceptionSeen;
+
+ @Observer(value="org.jboss.seam.exceptionHandled.javax.persistence.OptimisticLockException")
+ public void handleException(Exception e) {
+ exceptionSeen=true;
+ }
+
+ public boolean getOptimisticLockExceptionSeen() {
+ return exceptionSeen;
+ }
+
+ @Override
+ public String toString() {
+ return "EntityExceptionObserver[" + exceptionSeen + "]";
+ }
+ }
+}
Added: branches/community/Seam_2_3/seam-integration-tests-ee6/src/test/java/org/jboss/seam/test/integration/EventTest.java
===================================================================
--- branches/community/Seam_2_3/seam-integration-tests-ee6/src/test/java/org/jboss/seam/test/integration/EventTest.java (rev 0)
+++ branches/community/Seam_2_3/seam-integration-tests-ee6/src/test/java/org/jboss/seam/test/integration/EventTest.java 2012-02-28 13:53:30 UTC (rev 14333)
@@ -0,0 +1,61 @@
+package org.jboss.seam.test.integration;
+
+import org.jboss.arquillian.container.test.api.Deployment;
+import org.jboss.arquillian.container.test.api.OverProtocol;
+import org.jboss.arquillian.junit.Arquillian;
+import org.jboss.seam.Component;
+import org.jboss.seam.core.Events;
+import org.jboss.seam.mock.JUnitSeamTest;
+import org.jboss.shrinkwrap.api.Archive;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+
+
+/**
+ *
+ * @author Pete Muir
+ *
+ */
+(a)RunWith(Arquillian.class)
+public class EventTest extends JUnitSeamTest {
+
+ @Deployment(name="IdentifierTest")
+ @OverProtocol("Servlet 3.0")
+ public static Archive<?> createDeployment()
+ {
+ return Deployments.defaultSeamDeployment()
+ .addClasses(BeanA.class, BeanB.class);
+ }
+
+ @Test
+ public void testEventChain() throws Exception {
+
+ new FacesRequest("/index.xhtml") {
+
+ @Override
+ protected void invokeApplication() throws Exception {
+ BeanA beanA = (BeanA) Component.getInstance("beanA");
+ BeanB beanB = (BeanB) Component.getInstance("beanB");
+
+ assert "Foo".equals(beanA.getMyValue());
+ assert beanB.getMyValue() == null;
+
+ Events.instance().raiseEvent("BeanA.refreshMyValue");
+
+ beanA = (BeanA) Component.getInstance("beanA");
+
+ assert "Bar".equals(beanA.getMyValue());
+ }
+
+ @Override
+ protected void renderResponse() throws Exception
+ {
+ BeanB beanB = (BeanB) Component.getInstance("beanB");
+ assert "Bar".equals(beanB.getMyValue());
+ }
+ }.run();
+ }
+
+}
+
+
Added: branches/community/Seam_2_3/seam-integration-tests-ee6/src/test/java/org/jboss/seam/test/integration/Foo.java
===================================================================
--- branches/community/Seam_2_3/seam-integration-tests-ee6/src/test/java/org/jboss/seam/test/integration/Foo.java (rev 0)
+++ branches/community/Seam_2_3/seam-integration-tests-ee6/src/test/java/org/jboss/seam/test/integration/Foo.java 2012-02-28 13:53:30 UTC (rev 14333)
@@ -0,0 +1,94 @@
+/*
+ * JBoss, Home of Professional Open Source
+ *
+ * Distributable under LGPL license.
+ * See terms of license at gnu.org.
+ */
+package org.jboss.seam.test.integration;
+
+import java.io.Serializable;
+
+import javax.ejb.Remove;
+
+import javax.validation.constraints.NotNull;
+import org.jboss.seam.ScopeType;
+import org.jboss.seam.annotations.Begin;
+import org.jboss.seam.annotations.End;
+import org.jboss.seam.annotations.Name;
+import org.jboss.seam.annotations.Scope;
+
+/**
+ * @author <a href="mailto:theute@jboss.org">Thomas Heute </a>
+ * @version $Revision: 6435 $
+ */
+@Name("foo")
+(a)Scope(ScopeType.SESSION)
+@SuppressWarnings("deprecation")
+public class Foo implements Serializable
+{
+ private static final long serialVersionUID = -5448030633067107049L;
+
+ private String value;
+
+ public String foo() { return "foo"; }
+
+ @Remove
+ public void destroy() {}
+
+ @NotNull
+ public String getValue()
+ {
+ return value;
+ }
+
+ public void setValue(String value)
+ {
+ this.value = value;
+ }
+
+ public String bar()
+ {
+ return "bar";
+ }
+
+ @Begin
+ public String begin()
+ {
+ return "begun";
+ }
+ @End
+ public String end()
+ {
+ return "ended";
+ }
+
+ @Begin
+ public String beginNull()
+ {
+ return null;
+ }
+ @End
+ public String endNull()
+ {
+ return null;
+ }
+
+ @Begin
+ public void beginVoid() { }
+ @End
+ public void endVoid() { }
+
+ @Begin(ifOutcome="success")
+ public String beginIf()
+ {
+ return "success";
+ }
+ @End(ifOutcome="success")
+ public String endIf()
+ {
+ return "success";
+ }
+
+}
+
+
Added: branches/community/Seam_2_3/seam-integration-tests-ee6/src/test/java/org/jboss/seam/test/integration/IdentifierTest.java
===================================================================
--- branches/community/Seam_2_3/seam-integration-tests-ee6/src/test/java/org/jboss/seam/test/integration/IdentifierTest.java (rev 0)
+++ branches/community/Seam_2_3/seam-integration-tests-ee6/src/test/java/org/jboss/seam/test/integration/IdentifierTest.java 2012-02-28 13:53:30 UTC (rev 14333)
@@ -0,0 +1,77 @@
+package org.jboss.seam.test.integration;
+
+import javax.persistence.EntityManager;
+
+import org.hibernate.Session;
+import org.jboss.arquillian.container.test.api.Deployment;
+import org.jboss.arquillian.container.test.api.OverProtocol;
+import org.jboss.arquillian.junit.Arquillian;
+import org.jboss.seam.framework.EntityIdentifier;
+import org.jboss.seam.framework.HibernateEntityIdentifier;
+import org.jboss.seam.mock.JUnitSeamTest;
+import org.jboss.shrinkwrap.api.Archive;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+
+/**
+ * @author Pete Muir
+ *
+ */
+(a)RunWith(Arquillian.class)
+public class IdentifierTest extends JUnitSeamTest
+{
+ @Deployment(name="IdentifierTest")
+ @OverProtocol("Servlet 3.0")
+ public static Archive<?> createDeployment()
+ {
+ return Deployments.defaultSeamDeployment()
+ .addClasses(Country.class, CountryHome.class);
+ }
+
+ @Test
+ public void testEntityIdentifier() throws Exception
+ {
+ new ComponentTest()
+ {
+
+ @Override
+ protected void testComponents() throws Exception
+ {
+ setValue("#{countryHome.instance.name}", "foo");
+ invokeMethod("#{countryHome.persist}");
+ Country country = (Country) getValue("#{countryHome.instance}");
+ EntityManager entityManager = (EntityManager) getValue("#{countryHome.entityManager}");
+
+ EntityIdentifier entityIdentifier = new EntityIdentifier(country, entityManager);
+ assert "foo".equals(((Country) entityIdentifier.find(entityManager)).getName());
+ EntityIdentifier entityIdentifier2 = new EntityIdentifier(country, entityManager);
+ assert entityIdentifier.equals(entityIdentifier2);
+ }
+
+ }.run();
+ }
+
+ @Test
+ public void testHibernateEntityIdentifier() throws Exception
+ {
+ new ComponentTest()
+ {
+
+ @Override
+ protected void testComponents() throws Exception
+ {
+ setValue("#{countryHome.instance.name}", "foo");
+ invokeMethod("#{countryHome.persist}");
+ Country country = (Country) getValue("#{countryHome.instance}");
+ Session session = (Session) getValue("#{countryHome.entityManager.delegate}");
+
+ HibernateEntityIdentifier hibernateEntityIdentifier = new HibernateEntityIdentifier(country, session);
+ assert "foo".equals(((Country) hibernateEntityIdentifier.find(session)).getName());
+ HibernateEntityIdentifier hibernateEntityIdentifier2 = new HibernateEntityIdentifier(country, session);
+ assert hibernateEntityIdentifier.equals(hibernateEntityIdentifier2);
+ }
+
+ }.run();
+ }
+
+}
Added: branches/community/Seam_2_3/seam-integration-tests-ee6/src/test/java/org/jboss/seam/test/integration/ImportTest.java
===================================================================
--- branches/community/Seam_2_3/seam-integration-tests-ee6/src/test/java/org/jboss/seam/test/integration/ImportTest.java (rev 0)
+++ branches/community/Seam_2_3/seam-integration-tests-ee6/src/test/java/org/jboss/seam/test/integration/ImportTest.java 2012-02-28 13:53:30 UTC (rev 14333)
@@ -0,0 +1,57 @@
+package org.jboss.seam.test.integration;
+
+import org.jboss.arquillian.container.test.api.Deployment;
+import org.jboss.arquillian.container.test.api.OverProtocol;
+import org.jboss.arquillian.junit.Arquillian;
+import org.jboss.seam.annotations.Factory;
+import org.jboss.seam.annotations.Import;
+import org.jboss.seam.annotations.In;
+import org.jboss.seam.annotations.Name;
+import org.jboss.seam.mock.JUnitSeamTest;
+import org.jboss.shrinkwrap.api.Archive;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+
+(a)RunWith(Arquillian.class)
+public class ImportTest
+ extends JUnitSeamTest
+{
+ @Deployment(name="IdentifierTest")
+ @OverProtocol("Servlet 3.0")
+ public static Archive<?> createDeployment()
+ {
+ return Deployments.defaultSeamDeployment()
+ .addClasses(Importer.class);
+ }
+
+ @Test
+ public void testImport()
+ throws Exception
+ {
+ new FacesRequest() {
+ @Override
+ protected void invokeApplication()
+ throws Exception
+ {
+ assert getValue("#{importTest.otherValue}").equals("foobar2");
+ }
+ }.run();
+ }
+
+
+ @Name("importTest")
+ @Import("importTest.ns2")
+ public static class Importer {
+ @In
+ String otherValue;
+
+ public String getOtherValue() {
+ return otherValue;
+ }
+
+ @Factory(value="importTest.ns2.otherValue", autoCreate=true)
+ public String createOtherValue() {
+ return "foobar2";
+ }
+ }
+}
Added: branches/community/Seam_2_3/seam-integration-tests-ee6/src/test/java/org/jboss/seam/test/integration/JavaBeanEqualsTest.java
===================================================================
--- branches/community/Seam_2_3/seam-integration-tests-ee6/src/test/java/org/jboss/seam/test/integration/JavaBeanEqualsTest.java (rev 0)
+++ branches/community/Seam_2_3/seam-integration-tests-ee6/src/test/java/org/jboss/seam/test/integration/JavaBeanEqualsTest.java 2012-02-28 13:53:30 UTC (rev 14333)
@@ -0,0 +1,43 @@
+package org.jboss.seam.test.integration;
+
+import org.jboss.arquillian.container.test.api.Deployment;
+import org.jboss.arquillian.container.test.api.OverProtocol;
+import org.jboss.arquillian.junit.Arquillian;
+import org.jboss.seam.mock.JUnitSeamTest;
+import org.jboss.shrinkwrap.api.Archive;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+
+/**
+ * @author Pete Muir
+ *
+ */
+(a)RunWith(Arquillian.class)
+public class JavaBeanEqualsTest extends JUnitSeamTest
+{
+ @Deployment(name="JavaBeanEqualsTest")
+ @OverProtocol("Servlet 3.0")
+ public static Archive<?> createDeployment()
+ {
+ return Deployments.defaultSeamDeployment()
+ .addClasses(BeanA.class);
+ }
+
+ @Test
+ // Test for JBSEAM-1257
+ public void testReflexiveEquals() throws Exception
+ {
+ new ComponentTest()
+ {
+
+ @Override
+ protected void testComponents() throws Exception
+ {
+ assert getInstance("beanA").equals(getInstance("beanA"));
+ assert getValue("#{beanA.component}").equals(getValue("#{beanA.component}"));
+ }
+
+ }.run();
+ }
+
+}
Added: branches/community/Seam_2_3/seam-integration-tests-ee6/src/test/java/org/jboss/seam/test/integration/MessagingTest.java
===================================================================
--- branches/community/Seam_2_3/seam-integration-tests-ee6/src/test/java/org/jboss/seam/test/integration/MessagingTest.java (rev 0)
+++ branches/community/Seam_2_3/seam-integration-tests-ee6/src/test/java/org/jboss/seam/test/integration/MessagingTest.java 2012-02-28 13:53:30 UTC (rev 14333)
@@ -0,0 +1,170 @@
+package org.jboss.seam.test.integration;
+
+import javax.ejb.ActivationConfigProperty;
+import javax.ejb.MessageDriven;
+import javax.jms.JMSException;
+import javax.jms.Message;
+import javax.jms.MessageListener;
+import javax.jms.QueueSender;
+import javax.jms.QueueSession;
+import javax.jms.TextMessage;
+import javax.jms.TopicPublisher;
+import javax.jms.TopicSession;
+
+import org.jboss.arquillian.container.test.api.Deployment;
+import org.jboss.arquillian.container.test.api.OverProtocol;
+import org.jboss.arquillian.junit.Arquillian;
+import org.jboss.seam.annotations.In;
+import org.jboss.seam.annotations.Name;
+import org.jboss.seam.contexts.Contexts;
+import org.jboss.seam.mock.JUnitSeamTest;
+import org.jboss.shrinkwrap.api.Archive;
+import org.junit.Ignore;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+
+(a)RunWith(Arquillian.class)
+@Ignore
+public class MessagingTest
+ extends JUnitSeamTest
+{
+ @Deployment(name="MessagingTest")
+ @OverProtocol("Servlet 3.0")
+ public static Archive<?> createDeployment()
+ {
+ return Deployments.defaultSeamDeployment();
+ }
+
+ @Test
+ public void publishToTopic()
+ throws Exception
+ {
+ final SimpleReference<String> messageText = new SimpleReference<String>();
+
+ new FacesRequest() {
+ @Override
+ protected void invokeApplication()
+ throws Exception
+ {
+ Contexts.getApplicationContext().set("testMessage", messageText);
+ invokeAction("#{testTopic.publish}");
+ }
+ }.run();
+
+ // need to delay a bit to make sure the message is delivered
+ // might need
+ Thread.sleep(2000);
+
+ assert messageText.getValue().equals("message for topic");
+ }
+
+ @Test
+ public void sendToQueue()
+ throws Exception
+ {
+ final SimpleReference<String> messageText = new SimpleReference<String>();
+
+ new FacesRequest() {
+ @Override
+ protected void invokeApplication()
+ throws Exception
+ {
+ Contexts.getApplicationContext().set("testMessage", messageText);
+ invokeAction("#{testQueue.send}");
+ }
+ }.run();
+
+ // need to delay a bit to make sure the message is delivered
+ // might need
+ Thread.sleep(2000);
+
+ assert messageText.getValue().equals("message for queue");
+ }
+
+
+ @Name("testTopic")
+ public static class TopicBean {
+ @In
+ private TopicPublisher testPublisher;
+
+ @In
+ private TopicSession topicSession;
+
+ public void publish()
+ throws JMSException
+ {
+ testPublisher.publish(topicSession.createTextMessage("message for topic"));
+ }
+ }
+
+ @Name("testQueue")
+ public static class QueueBean {
+ @In
+ private QueueSender testSender;
+
+ @In
+ private QueueSession queueSession;
+
+ public void send() throws JMSException {
+ testSender.send(queueSession.createTextMessage("message for queue"));
+ }
+ }
+
+ @MessageDriven(activationConfig={
+ @ActivationConfigProperty(propertyName="destinationType", propertyValue="javax.jms.Topic"),
+ @ActivationConfigProperty(propertyName="destination", propertyValue="topic/testTopic")
+ })
+ @Name("testTopicListener")
+ static public class TestTopicListener
+ implements MessageListener
+ {
+ @In
+ private SimpleReference<String> testMessage;
+
+ public void onMessage(Message msg)
+ {
+ try {
+ testMessage.setValue(((TextMessage) msg).getText());
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+ }
+ }
+
+ @MessageDriven(activationConfig={
+ @ActivationConfigProperty(propertyName="destinationType", propertyValue="javax.jms.Queue"),
+ @ActivationConfigProperty(propertyName="destination", propertyValue="queue/testQueue")
+ })
+ @Name("testQueueListener")
+ static public class TestQueueListener
+ implements MessageListener
+ {
+ @In
+ private SimpleReference<String> testMessage;
+
+ public void onMessage(Message msg)
+ {
+ try {
+ testMessage.setValue(((TextMessage) msg).getText());
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+ }
+ }
+
+
+ static class SimpleReference<T> {
+ T value;
+ public SimpleReference() {
+ }
+ public SimpleReference(T value) {
+ setValue(value);
+ }
+ public T getValue() {
+ return value;
+ }
+ public void setValue(T value) {
+ this.value = value;
+ }
+ }
+}
Added: branches/community/Seam_2_3/seam-integration-tests-ee6/src/test/java/org/jboss/seam/test/integration/NamespaceResolverTest.java
===================================================================
--- branches/community/Seam_2_3/seam-integration-tests-ee6/src/test/java/org/jboss/seam/test/integration/NamespaceResolverTest.java (rev 0)
+++ branches/community/Seam_2_3/seam-integration-tests-ee6/src/test/java/org/jboss/seam/test/integration/NamespaceResolverTest.java 2012-02-28 13:53:30 UTC (rev 14333)
@@ -0,0 +1,64 @@
+package org.jboss.seam.test.integration;
+
+import org.jboss.arquillian.container.test.api.Deployment;
+import org.jboss.arquillian.container.test.api.OverProtocol;
+import org.jboss.arquillian.junit.Arquillian;
+import org.jboss.seam.init.NamespacePackageResolver;
+import org.jboss.seam.mock.JUnitSeamTest;
+import org.jboss.shrinkwrap.api.Archive;
+import org.junit.runner.RunWith;
+import org.junit.Assert;
+import org.junit.Test;
+
+(a)RunWith(Arquillian.class)
+public class NamespaceResolverTest
+ extends JUnitSeamTest
+{
+ @Deployment(name="NamespaceResolverTest")
+ @OverProtocol("Servlet 3.0")
+ public static Archive<?> createDeployment()
+ {
+ return Deployments.defaultSeamDeployment();
+ }
+
+ NamespacePackageResolver resolver = new NamespacePackageResolver();
+
+ @Test
+ public void testResolver() {
+
+ test("java:foo", "foo");
+ test("java:com.company.department",
+ "com.company.department");
+ test("java:com.company.department.product",
+ "com.company.department.product");
+ test("http://www.company.com/department/product",
+ "com.company.department.product");
+ test("https://my-company.com/department/product",
+ "com.my_company.department.product");
+ test("http://ericjung:password@www.company.com:8080/foo/bar/baz#anchor?param1=3...",
+ "com.company.foo.bar.baz");
+ test("http://cats.import.com",
+ "com.import.cats");
+
+
+ //testFail("http://bar#foo#com");
+
+ testFail("java:");
+
+ // need to think about this one
+ //testFail("java:foo!bar");
+
+ testFail("mailto:java-net@java.sun.com");
+ testFail("news:comp.lang.java");
+ testFail("urn:isbn:096139210x");
+
+ }
+
+ private void test(String namespace, String packageName) {
+ Assert.assertEquals(packageName, resolver.resolve(namespace));
+ }
+
+ private void testFail(String namespace) {
+ Assert.assertNull(namespace, resolver.resolve(namespace));
+ }
+}
Added: branches/community/Seam_2_3/seam-integration-tests-ee6/src/test/java/org/jboss/seam/test/integration/NamespaceTest.java
===================================================================
--- branches/community/Seam_2_3/seam-integration-tests-ee6/src/test/java/org/jboss/seam/test/integration/NamespaceTest.java (rev 0)
+++ branches/community/Seam_2_3/seam-integration-tests-ee6/src/test/java/org/jboss/seam/test/integration/NamespaceTest.java 2012-02-28 13:53:30 UTC (rev 14333)
@@ -0,0 +1,106 @@
+package org.jboss.seam.test.integration;
+
+import org.jboss.arquillian.container.test.api.Deployment;
+import org.jboss.arquillian.container.test.api.OverProtocol;
+import org.jboss.arquillian.junit.Arquillian;
+import org.jboss.seam.ScopeType;
+import org.jboss.seam.annotations.Factory;
+import org.jboss.seam.annotations.Name;
+import org.jboss.seam.annotations.Out;
+import org.jboss.seam.core.Init;
+import org.jboss.seam.mock.JUnitSeamTest;
+import org.jboss.shrinkwrap.api.Archive;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+
+public class NamespaceTest
+ extends JUnitSeamTest
+{
+ @Test
+ public void nameSpaceComponent()
+ throws Exception
+ {
+ new ComponentTest() {
+ @Override
+ protected void testComponents() throws Exception {
+ assert getValue("#{namespaceTest.fooFactory}") != null;
+ }
+ }.run();
+ }
+
+ @Test
+ public void nameSpaceFactory()
+ throws Exception
+ {
+ new ComponentTest() {
+ @Override
+ protected void testComponents() throws Exception {
+ assert getValue("#{namespaceTest.ns1.factory}") != null;
+ }
+ }.run();
+ }
+
+
+ @Test
+ public void namespaceOutjection()
+ throws Exception
+ {
+ new ComponentTest() {
+ @Override
+ protected void testComponents() throws Exception {
+ FooFactory factory = (FooFactory) getValue("#{namespaceTest.fooFactory}");
+ factory.someMethod();
+ assert getValue("#{namespaceTest.ns2.outject}") != null;
+ }
+ }.run();
+ }
+
+
+ @Test
+ public void factoryMethodExpression()
+ throws Exception
+ {
+ new ComponentTest() {
+ @Override
+ protected void testComponents() throws Exception {
+ Init init = Init.instance();
+ init.addFactoryMethodExpression("namespaceTest.ns3.factory", "#{namespaceTest.fooFactory.createFoo}", ScopeType.SESSION);
+
+ assert getValue("#{namespaceTest.ns3.factory}") != null;
+ }
+ }.run();
+ }
+
+ @Test
+ public void factoryValueExpression()
+ throws Exception
+ {
+ new ComponentTest() {
+ @Override
+ protected void testComponents() throws Exception {
+ Init init = Init.instance();
+ init.addFactoryValueExpression("namespaceTest.ns4.factory", "#{namespaceTest.fooFactory.createFoo()}", ScopeType.SESSION);
+
+ assert getValue("#{namespaceTest.ns4.factory}") != null;
+ }
+ }.run();
+ }
+
+ @Name("namespaceTest.fooFactory")
+ public static class FooFactory {
+ public class Foo {}
+
+ @Factory("namespaceTest.ns1.factory")
+ public Foo createFoo() {
+ return new Foo();
+ }
+
+ @Out("namespaceTest.ns2.outject")
+ public Foo outjectFoo() {
+ return new Foo();
+ }
+
+ public void someMethod() {
+ }
+ }
+}
Added: branches/community/Seam_2_3/seam-integration-tests-ee6/src/test/java/org/jboss/seam/test/integration/PageContextTest.java
===================================================================
--- branches/community/Seam_2_3/seam-integration-tests-ee6/src/test/java/org/jboss/seam/test/integration/PageContextTest.java (rev 0)
+++ branches/community/Seam_2_3/seam-integration-tests-ee6/src/test/java/org/jboss/seam/test/integration/PageContextTest.java 2012-02-28 13:53:30 UTC (rev 14333)
@@ -0,0 +1,49 @@
+package org.jboss.seam.test.integration;
+
+import org.jboss.arquillian.container.test.api.Deployment;
+import org.jboss.arquillian.container.test.api.OverProtocol;
+import org.jboss.arquillian.junit.Arquillian;
+import org.jboss.seam.contexts.Contexts;
+import org.jboss.seam.mock.JUnitSeamTest;
+import org.jboss.shrinkwrap.api.Archive;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+
+/**
+ *
+ * @author Pete Muir
+ *
+ */
+(a)RunWith(Arquillian.class)
+public class PageContextTest extends JUnitSeamTest
+{
+ @Deployment(name="PageContextTest")
+ @OverProtocol("Servlet 3.0")
+ public static Archive<?> createDeployment()
+ {
+ return Deployments.defaultSeamDeployment();
+ }
+
+ @Test
+ public void pageContextTest() throws Exception {
+
+ new FacesRequest("/index.xhtml") {
+
+ @Override
+ protected void invokeApplication() throws Exception
+ {
+ Contexts.getPageContext().set("foo", "bar");
+ assert Contexts.getPageContext().get("foo") == null;
+ }
+
+ @Override
+ protected void renderResponse() throws Exception
+ {
+ assert Contexts.getPageContext().get("foo") != null;
+ assert "bar".equals(Contexts.getPageContext().get("foo"));
+ }
+ }.run();
+
+ }
+
+}
Added: branches/community/Seam_2_3/seam-integration-tests-ee6/src/test/java/org/jboss/seam/test/integration/PageParamTest.java
===================================================================
--- branches/community/Seam_2_3/seam-integration-tests-ee6/src/test/java/org/jboss/seam/test/integration/PageParamTest.java (rev 0)
+++ branches/community/Seam_2_3/seam-integration-tests-ee6/src/test/java/org/jboss/seam/test/integration/PageParamTest.java 2012-02-28 13:53:30 UTC (rev 14333)
@@ -0,0 +1,125 @@
+package org.jboss.seam.test.integration;
+
+import java.util.List;
+
+import javax.faces.application.FacesMessage;
+
+import org.jboss.arquillian.container.test.api.Deployment;
+import org.jboss.arquillian.container.test.api.OverProtocol;
+import org.jboss.arquillian.junit.Arquillian;
+import org.jboss.seam.mock.JUnitSeamTest;
+import org.jboss.shrinkwrap.api.Archive;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+
+/**
+ * @author Pete Muir
+ * @author Dan Allen
+ */
+(a)RunWith(Arquillian.class)
+public class PageParamTest extends JUnitSeamTest
+{
+ @Deployment(name="PageParamTest")
+ @OverProtocol("Servlet 3.0")
+ public static Archive<?> createDeployment()
+ {
+ return Deployments.defaultSeamDeployment()
+ .addClasses(Person.class);
+ }
+
+ @Test
+ public void testPageParameter() throws Exception
+ {
+ new FacesRequest("/pageWithParameter.xhtml")
+ {
+ @Override
+ protected void beforeRequest()
+ {
+ setParameter("personName", "pete");
+ }
+
+ @Override
+ protected void invokeApplication() throws Exception
+ {
+ assert "pete".equals(getValue("#{person.name}"));
+ }
+ }.run();
+
+ new FacesRequest("/pageWithParameter.xhtml")
+ {
+ @Override
+ protected void beforeRequest()
+ {
+ setParameter("anotherPersonName", "pete");
+ }
+
+ @Override
+ protected void invokeApplication() throws Exception
+ {
+ assert getValue("#{person.name}") == null;
+ }
+ }.run();
+ }
+
+ @Test
+ public void testPageParameterFailsModelValidation() throws Exception
+ {
+ new FacesRequest("/pageWithParameter.xhtml")
+ {
+ @Override
+ protected void beforeRequest()
+ {
+ setParameter("personName", "pe");
+ }
+
+ @Override
+ protected void invokeApplication() throws Exception
+ {
+ List<FacesMessage> messages = (List<FacesMessage>) getValue("#{facesMessages.currentMessages}");
+ assert messages.size() == 1;
+ assert messages.get(0).getDetail().startsWith("'personName' parameter is invalid");
+ assert getValue("#{person.name}") == null;
+ }
+ }.run();
+ }
+
+ @Test
+ public void testPageParameterModelValidationDisabled() throws Exception
+ {
+ new FacesRequest("/pageWithValidateModelDisabledParameter.xhtml")
+ {
+ @Override
+ protected void beforeRequest()
+ {
+ setParameter("personName", "pe");
+ }
+
+ @Override
+ protected void invokeApplication() throws Exception
+ {
+ assert "pe".equals(getValue("#{person.name}"));
+ }
+ }.run();
+ }
+
+ @Test
+ public void testRequiredPageParameter() throws Exception
+ {
+ new FacesRequest("/pageWithRequiredParameter.xhtml")
+ {
+ @Override
+ protected void beforeRequest()
+ {
+ setParameter("personName", "pete");
+ }
+
+ @Override
+ protected void invokeApplication() throws Exception
+ {
+ assert "pete".equals(getValue("#{person.name}"));
+ }
+ }.run();
+
+ }
+
+}
Added: branches/community/Seam_2_3/seam-integration-tests-ee6/src/test/java/org/jboss/seam/test/integration/People.java
===================================================================
--- branches/community/Seam_2_3/seam-integration-tests-ee6/src/test/java/org/jboss/seam/test/integration/People.java (rev 0)
+++ branches/community/Seam_2_3/seam-integration-tests-ee6/src/test/java/org/jboss/seam/test/integration/People.java 2012-02-28 13:53:30 UTC (rev 14333)
@@ -0,0 +1,35 @@
+package org.jboss.seam.test.integration;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.jboss.seam.ScopeType;
+import org.jboss.seam.annotations.Factory;
+import org.jboss.seam.annotations.Name;
+import org.jboss.seam.annotations.datamodel.DataModelSelection;
+
+@Name("people")
+public class People
+{
+ @org.jboss.seam.annotations.datamodel.DataModel(scope=ScopeType.PAGE)
+ private List<Person> peopleList;
+
+ @DataModelSelection
+ private Person selectedPerson;
+
+ @Factory("peopleList")
+ public void peopleFactory()
+ {
+ peopleList = new ArrayList<Person>();
+ peopleList.add(new Person("Gavin"));
+ peopleList.add(new Person("Pete"));
+ peopleList.add(new Person("Shane"));
+ peopleList.add(new Person("Norman"));
+ }
+
+ public Person getSelectedPerson()
+ {
+ return selectedPerson;
+ }
+
+}
Added: branches/community/Seam_2_3/seam-integration-tests-ee6/src/test/java/org/jboss/seam/test/integration/Person.java
===================================================================
--- branches/community/Seam_2_3/seam-integration-tests-ee6/src/test/java/org/jboss/seam/test/integration/Person.java (rev 0)
+++ branches/community/Seam_2_3/seam-integration-tests-ee6/src/test/java/org/jboss/seam/test/integration/Person.java 2012-02-28 13:53:30 UTC (rev 14333)
@@ -0,0 +1,47 @@
+package org.jboss.seam.test.integration;
+
+import java.io.Serializable;
+import javax.validation.constraints.Size;
+
+import org.jboss.seam.annotations.Name;
+
+
+@Name("person")
+public class Person implements Serializable
+{
+
+ public Person(String name)
+ {
+ this.name = name;
+ }
+
+ public Person() {}
+
+ private String name;
+
+ @Size(min = 3, max = 10)
+ public String getName()
+ {
+ return name;
+ }
+
+ public void setName(String name)
+ {
+ this.name = name;
+ }
+
+ @Override
+ public boolean equals(Object other)
+ {
+ if (other instanceof Person)
+ {
+ Person that = (Person) other;
+ return (this.name == null && that.name == null) || (this.name != null && this.name.equals(that.name));
+ }
+ else
+ {
+ return false;
+ }
+ }
+
+}
Added: branches/community/Seam_2_3/seam-integration-tests-ee6/src/test/java/org/jboss/seam/test/integration/Thing.java
===================================================================
--- branches/community/Seam_2_3/seam-integration-tests-ee6/src/test/java/org/jboss/seam/test/integration/Thing.java (rev 0)
+++ branches/community/Seam_2_3/seam-integration-tests-ee6/src/test/java/org/jboss/seam/test/integration/Thing.java 2012-02-28 13:53:30 UTC (rev 14333)
@@ -0,0 +1,49 @@
+package org.jboss.seam.test.integration;
+
+import javax.persistence.Entity;
+import javax.persistence.GeneratedValue;
+import javax.persistence.Id;
+import javax.persistence.Version;
+
+@Entity
+public class Thing {
+ public Thing() {}
+
+ @GeneratedValue
+ @Id
+ private Long id;
+
+ @Version
+ private Integer version;
+
+ private String name;
+
+ public Long getId() {
+ return id;
+ }
+
+ public void setId(Long id) {
+ this.id = id;
+ }
+
+ public String getName() {
+ return name;
+ }
+
+ public void setName(String name) {
+ this.name = name;
+ }
+
+ public Integer getVersion() {
+ return version;
+ }
+
+ public void setVersion(Integer version) {
+ this.version = version;
+ }
+
+ @Override
+ public String toString() {
+ return "Thing#" + id + "[v=" + version + "]";
+ }
+}
\ No newline at end of file
Added: branches/community/Seam_2_3/seam-integration-tests-ee6/src/test/java/org/jboss/seam/test/integration/UnversionedThing.java
===================================================================
--- branches/community/Seam_2_3/seam-integration-tests-ee6/src/test/java/org/jboss/seam/test/integration/UnversionedThing.java (rev 0)
+++ branches/community/Seam_2_3/seam-integration-tests-ee6/src/test/java/org/jboss/seam/test/integration/UnversionedThing.java 2012-02-28 13:53:30 UTC (rev 14333)
@@ -0,0 +1,35 @@
+package org.jboss.seam.test.integration;
+
+import javax.persistence.Entity;
+import javax.persistence.GeneratedValue;
+import javax.persistence.Id;
+
+@Entity
+public class UnversionedThing {
+ @GeneratedValue
+ @Id
+ private Long id;
+
+ private String name;
+
+ public Long getId() {
+ return id;
+ }
+
+ public void setId(Long id) {
+ this.id = id;
+ }
+
+ public String getName() {
+ return name;
+ }
+
+ public void setName(String name) {
+ this.name = name;
+ }
+
+ @Override
+ public String toString() {
+ return "UnversionedThing#" + id + "]";
+ }
+}
\ No newline at end of file
Added: branches/community/Seam_2_3/seam-integration-tests-ee6/src/test/java/org/jboss/seam/test/integration/bpm/SeamExpressionEvaluatorTest.java
===================================================================
--- branches/community/Seam_2_3/seam-integration-tests-ee6/src/test/java/org/jboss/seam/test/integration/bpm/SeamExpressionEvaluatorTest.java (rev 0)
+++ branches/community/Seam_2_3/seam-integration-tests-ee6/src/test/java/org/jboss/seam/test/integration/bpm/SeamExpressionEvaluatorTest.java 2012-02-28 13:53:30 UTC (rev 14333)
@@ -0,0 +1,101 @@
+package org.jboss.seam.test.integration.bpm;
+
+import org.jboss.arquillian.container.test.api.Deployment;
+import org.jboss.arquillian.container.test.api.OverProtocol;
+import org.jboss.arquillian.junit.Arquillian;
+import org.jboss.seam.mock.JUnitSeamTest;
+import org.jboss.seam.test.integration.Deployments;
+import org.jboss.shrinkwrap.api.Archive;
+import org.jbpm.jpdl.el.ELException;
+import org.junit.Ignore;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+
+/**
+ * @author Pete Muir
+ *
+ */
+@Ignore
+(a)RunWith(Arquillian.class)
+public class SeamExpressionEvaluatorTest extends JUnitSeamTest
+{
+ @Deployment(name="SeamExpressionEvaluatorTest")
+ @OverProtocol("Servlet 3.0")
+ public static Archive<?> createDeployment()
+ {
+ return Deployments.jbpmSeamDeployment()
+ .addClasses(SeamExpressionEvaluatorTestController.class);
+ }
+
+ // Test for JBSEAM-1937
+ @Test
+ public void testValueExpression() throws Exception
+ {
+ new FacesRequest()
+ {
+
+ @Override
+ protected void invokeApplication() throws Exception
+ {
+ invokeAction("#{seamExpressionEvaluatorTestController.createProcess2}");
+ }
+
+ }.run();
+ }
+
+ // Test for JBSEAM-3250
+ @Test
+ public void testUnqualifiedValueExpression() throws Exception
+ {
+ new FacesRequest()
+ {
+
+ @Override
+ protected void invokeApplication() throws Exception
+ {
+ invokeAction("#{seamExpressionEvaluatorTestController.createProcess4}");
+ }
+
+ }.run();
+ }
+
+ // Test for JBSEAM-2152
+ @Test
+ public void testMissingMethod() throws Exception
+ {
+ new FacesRequest()
+ {
+
+ @Override
+ protected void invokeApplication() throws Exception
+ {
+ try
+ {
+ invokeAction("#{seamExpressionEvaluatorTestController.createProcess3}");
+ }
+ catch (Exception e)
+ {
+ if (!(isRootCause(e, ELException.class) || isRootCause(e, javax.el.ELException.class)))
+ {
+ e.printStackTrace();
+ assert false;
+ }
+ }
+ }
+
+ }.run();
+ }
+
+ private static boolean isRootCause(Throwable t, Class clazz)
+ {
+ for (Throwable cause = t.getCause(); cause != null && cause != cause.getCause(); cause = cause.getCause())
+ {
+ if (clazz.isAssignableFrom(cause.getClass()))
+ {
+ return true;
+ }
+ }
+ return false;
+ }
+
+}
Added: branches/community/Seam_2_3/seam-integration-tests-ee6/src/test/java/org/jboss/seam/test/integration/bpm/SeamExpressionEvaluatorTestController.java
===================================================================
--- branches/community/Seam_2_3/seam-integration-tests-ee6/src/test/java/org/jboss/seam/test/integration/bpm/SeamExpressionEvaluatorTestController.java (rev 0)
+++ branches/community/Seam_2_3/seam-integration-tests-ee6/src/test/java/org/jboss/seam/test/integration/bpm/SeamExpressionEvaluatorTestController.java 2012-02-28 13:53:30 UTC (rev 14333)
@@ -0,0 +1,50 @@
+package org.jboss.seam.test.integration.bpm;
+
+import org.jboss.seam.ScopeType;
+import org.jboss.seam.annotations.Factory;
+import org.jboss.seam.annotations.Name;
+import org.jboss.seam.annotations.bpm.CreateProcess;
+
+@Name("seamExpressionEvaluatorTestController")
+public class SeamExpressionEvaluatorTestController {
+
+ private String name = "foo";
+
+ @Factory(value="testBoolean", scope=ScopeType.BUSINESS_PROCESS)
+ public Boolean testNameFactory()
+ {
+ return false;
+ }
+
+ @CreateProcess(definition="TestProcess2")
+ public void createProcess2()
+ {
+ }
+
+ @CreateProcess(definition="TestProcess3")
+ public void createProcess3()
+ {
+ }
+
+ @CreateProcess(definition="TestProcess4")
+ public void createProcess4()
+ {
+ }
+
+ public void logTrue()
+ {
+ System.out.println("true");
+ }
+
+ public String getName()
+ {
+ return this.name;
+ }
+
+ public void setName(String name)
+ {
+ this.name = name;
+ }
+
+
+}
\ No newline at end of file
Added: branches/community/Seam_2_3/seam-integration-tests-ee6/src/test/java/org/jboss/seam/test/integration/databinding/DataModelTest.java
===================================================================
--- branches/community/Seam_2_3/seam-integration-tests-ee6/src/test/java/org/jboss/seam/test/integration/databinding/DataModelTest.java (rev 0)
+++ branches/community/Seam_2_3/seam-integration-tests-ee6/src/test/java/org/jboss/seam/test/integration/databinding/DataModelTest.java 2012-02-28 13:53:30 UTC (rev 14333)
@@ -0,0 +1,345 @@
+package org.jboss.seam.test.integration.databinding;
+
+
+import java.io.ByteArrayInputStream;
+import java.io.ByteArrayOutputStream;
+import java.io.IOException;
+import java.io.NotSerializableException;
+import java.io.ObjectInputStream;
+import java.io.ObjectOutputStream;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+
+import javax.faces.model.DataModel;
+import javax.faces.model.ListDataModel;
+
+import org.jboss.arquillian.container.test.api.Deployment;
+import org.jboss.arquillian.container.test.api.OverProtocol;
+import org.jboss.arquillian.junit.Arquillian;
+import org.jboss.seam.faces.DataModels;
+import org.jboss.seam.jsf.ArrayDataModel;
+import org.jboss.seam.jsf.MapDataModel;
+import org.jboss.seam.jsf.SetDataModel;
+import org.jboss.seam.mock.JUnitSeamTest;
+import org.jboss.seam.test.integration.Deployments;
+import org.jboss.seam.test.integration.Foo;
+import org.jboss.seam.test.integration.People;
+import org.jboss.seam.test.integration.Person;
+import org.jboss.shrinkwrap.api.Archive;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+
+(a)RunWith(Arquillian.class)
+public class DataModelTest extends JUnitSeamTest
+{
+ @Deployment(name="DataModelTest")
+ @OverProtocol("Servlet 3.0")
+ public static Archive<?> createDeployment()
+ {
+ return Deployments.defaultSeamDeployment()
+ .addClasses(Foo.class, Person.class, People.class);
+ }
+
+ @Test
+ public void testDataModels() throws Exception
+ {
+
+ new FacesRequest()
+ {
+ @Override
+ protected void invokeApplication() throws Exception
+ {
+ DataModels dataModels = DataModels.instance();
+
+ assert dataModels.getDataModel(new ArrayList()) instanceof ListDataModel;
+ assert dataModels.getDataModel(new HashMap()) instanceof MapDataModel;
+ assert dataModels.getDataModel(new HashSet()) instanceof SetDataModel;
+ assert dataModels.getDataModel(new Object[0]) instanceof ArrayDataModel;
+ // TODO assert dataModels.getDataModel(query) instanceof ListDataModel;
+
+ boolean failed = false;
+ try
+ {
+ dataModels.getDataModel(new Foo());
+ }
+ catch (IllegalArgumentException e)
+ {
+ failed = true;
+ }
+ assert failed;
+ }
+ }.run();
+ }
+
+ @Test
+ public void testArrayDataModelSerialization() throws Exception
+ {
+ String[] array = {"Seam", "Hibernate"};
+ javax.faces.model.ArrayDataModel arrayDataModel = new ArrayDataModel(array);
+ arrayDataModel.setRowIndex(1);
+
+ Object object = null;
+ try
+ {
+ object = serialize(arrayDataModel);
+ }
+ catch (NotSerializableException e)
+ {
+ assert false;
+ }
+ assert object instanceof javax.faces.model.ArrayDataModel;
+
+ javax.faces.model.ArrayDataModel serializedArrayDataModel = (javax.faces.model.ArrayDataModel) object;
+
+ assert serializedArrayDataModel.getRowIndex() == 1;
+
+ String[] serializedArray = (String[]) serializedArrayDataModel.getWrappedData();
+
+ assert array[0].equals(serializedArray[0]);
+
+ assert array[1].equals(serializedArray[1]);
+ }
+
+ // Utility to serialize an object
+ private Object serialize(Object object) throws Exception
+ {
+ ByteArrayOutputStream bos = new ByteArrayOutputStream();
+ ObjectOutputStream oos = new ObjectOutputStream(bos);
+ oos.writeObject(object);
+ ByteArrayInputStream bis = new ByteArrayInputStream(bos.toByteArray());
+ ObjectInputStream ois = new ObjectInputStream(bis);
+ return ois.readObject();
+ }
+
+ @Test
+ public void testListDataModelSerialization() throws Exception
+ {
+
+ List<String> list = Arrays.asList("Seam", "Hibernate");
+ javax.faces.model.ListDataModel listDataModel = new org.jboss.seam.jsf.ListDataModel(list);
+ listDataModel.setRowIndex(1);
+
+ Object object = null;
+ try
+ {
+ object = serialize(listDataModel);
+ }
+ catch (NotSerializableException e)
+ {
+ assert false;
+ }
+
+ assert object instanceof javax.faces.model.ListDataModel;
+ javax.faces.model.ListDataModel serializedListDataModel = (javax.faces.model.ListDataModel) object;
+ List<String> serializedList = (List<String>) serializedListDataModel.getWrappedData();
+
+ assert serializedListDataModel.getRowIndex() == 1;
+ assert list.get(0).equals(serializedList.get(0));
+ assert list.get(1).equals(serializedList.get(1));
+ }
+
+ @Test
+ public void testMapDataModel() throws IOException, ClassNotFoundException
+ {
+ Map<String, Person> map = new HashMap<String, Person>();
+ map.put("0", new Person("Gavin"));
+ map.put("1", new Person("Tom"));
+
+ javax.faces.model.DataModel mapDataModel = new MapDataModel();
+
+ assert mapDataModel.getRowCount() == -1;
+ assert mapDataModel.getRowData() == null;
+ assert !mapDataModel.isRowAvailable();
+
+ mapDataModel = new MapDataModel(map);
+
+ assert mapDataModel.getWrappedData() instanceof Map;
+
+ assert map.get("0").equals(((Map) mapDataModel.getWrappedData()).get("0"));
+ assert map.get("1").equals(((Map) mapDataModel.getWrappedData()).get("1"));
+
+ mapDataModel.setRowIndex(10);
+
+ assert !mapDataModel.isRowAvailable();
+
+ boolean failed = false;
+ try
+ {
+ mapDataModel.getRowData();
+ }
+ catch (IllegalArgumentException e)
+ {
+ failed = true;
+ }
+
+ assert failed;
+
+ mapDataModel.setRowIndex(1);
+
+ assert mapDataModel.isRowAvailable();
+ assert mapDataModel.getRowIndex() == 1;
+ assert mapDataModel.getRowCount() == 2;
+
+ // JBSEAM-1660
+ try
+ {
+ mapDataModel.setWrappedData(null);
+ }
+ catch (NullPointerException e)
+ {
+ // Spec allows passing null
+ assert false;
+ }
+ }
+
+ /**
+ * JBSEAM-1659
+ */
+ @Test
+ public void testMapDataModelSerialization() throws Exception
+ {
+
+ Map<String, Person> map = new HashMap<String, Person>();
+ map.put("0", new Person("Gavin"));
+ map.put("1", new Person("Tom"));
+
+ javax.faces.model.DataModel mapDataModel = new MapDataModel(map);
+ mapDataModel.setRowIndex(1);
+
+ Object object = null;
+ try
+ {
+ object = serialize(mapDataModel);
+ }
+ catch (NotSerializableException e)
+ {
+ assert false;
+ }
+
+
+ assert object instanceof javax.faces.model.DataModel;
+ javax.faces.model.DataModel serializedMapDataModel = (javax.faces.model.DataModel) object;
+ Map<String, Person> serializedMap = (Map<String, Person>) serializedMapDataModel.getWrappedData();
+
+ assert serializedMapDataModel.getRowIndex() == 1;
+ assert map.get("0").equals(serializedMap.get("0"));
+ assert map.get("1").equals(serializedMap.get("1"));
+ }
+
+ @Test
+ public void testSetDataModel() throws IOException, ClassNotFoundException
+ {
+ Person gavin = new Person("Gavin");
+ Person tom = new Person("Tom");
+
+ Set<Person> set = new HashSet<Person>();
+ set.add(gavin);
+ set.add(tom);
+
+ javax.faces.model.DataModel setDataModel = new SetDataModel();
+
+ assert setDataModel.getRowCount() == -1;
+ assert setDataModel.getRowData() == null;
+ assert !setDataModel.isRowAvailable();
+
+ setDataModel = new SetDataModel(set);
+
+ assert setDataModel.getWrappedData() instanceof Set;
+
+ assert set.contains(gavin);
+ assert set.contains(tom);
+
+ setDataModel.setRowIndex(10);
+
+ assert !setDataModel.isRowAvailable();
+
+ boolean failed = false;
+ try
+ {
+ setDataModel.getRowData();
+ }
+ catch (IllegalArgumentException e)
+ {
+ failed = true;
+ }
+
+ assert failed;
+
+ setDataModel.setRowIndex(1);
+
+ assert setDataModel.isRowAvailable();
+ assert setDataModel.getRowIndex() == 1;
+ assert setDataModel.getRowCount() == 2;
+
+ // JBSEAM-1660
+ try
+ {
+ setDataModel.setWrappedData(null);
+ }
+ catch (NullPointerException e)
+ {
+ // Spec allows passing null
+ assert false;
+ }
+ }
+
+ @Test
+ public void testSetDataModelSerialization() throws Exception
+ {
+
+ Person gavin = new Person("Gavin");
+ Person tom = new Person("Tom");
+
+ Set<Person> set = new HashSet<Person>();
+ set.add(gavin);
+ set.add(tom);
+
+ javax.faces.model.DataModel setDataModel = new SetDataModel(set);
+ setDataModel.setRowIndex(1);
+
+ Object object = null;
+ try
+ {
+ object = serialize(setDataModel);
+ }
+ catch (NotSerializableException e)
+ {
+ assert false;
+ }
+
+
+ assert object instanceof javax.faces.model.DataModel;
+ javax.faces.model.DataModel serializedSetDataModel = (javax.faces.model.DataModel) object;
+ Set<Person> serializedSet = (Set<Person>) serializedSetDataModel.getWrappedData();
+
+ assert serializedSetDataModel.getRowIndex() == 1;
+ assert serializedSet.contains(gavin);
+ assert serializedSet.contains(tom);
+ }
+
+ @Test
+ public void testDataModelOutjection() throws Exception
+ {
+ new FacesRequest()
+ {
+
+ @Override
+ protected void renderResponse() throws Exception
+ {
+ Object people = getValue("#{peopleList}");
+ assert people instanceof DataModel;
+ DataModel dataModel = (DataModel) people;
+ assert dataModel.getRowCount() == 4;
+ dataModel.setRowIndex(1);
+ }
+
+ }.run();
+
+ }
+
+}
Added: branches/community/Seam_2_3/seam-integration-tests-ee6/src/test/java/org/jboss/seam/test/integration/i8ln/LocaleTest.java
===================================================================
--- branches/community/Seam_2_3/seam-integration-tests-ee6/src/test/java/org/jboss/seam/test/integration/i8ln/LocaleTest.java (rev 0)
+++ branches/community/Seam_2_3/seam-integration-tests-ee6/src/test/java/org/jboss/seam/test/integration/i8ln/LocaleTest.java 2012-02-28 13:53:30 UTC (rev 14333)
@@ -0,0 +1,140 @@
+package org.jboss.seam.test.integration.i8ln;
+
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Locale;
+
+import javax.faces.component.UIOutput;
+import javax.faces.event.ValueChangeEvent;
+
+import org.jboss.arquillian.container.test.api.Deployment;
+import org.jboss.arquillian.container.test.api.OverProtocol;
+import org.jboss.arquillian.junit.Arquillian;
+import org.jboss.seam.international.LocaleConfig;
+import org.jboss.seam.international.LocaleSelector;
+import org.jboss.seam.Seam;
+import org.jboss.seam.contexts.Contexts;
+import org.jboss.seam.mock.JUnitSeamTest;
+import org.jboss.seam.test.integration.Deployments;
+import org.jboss.shrinkwrap.api.Archive;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+
+(a)RunWith(Arquillian.class)
+public class LocaleTest extends JUnitSeamTest
+{
+ @Deployment(name="LocaleTest")
+ @OverProtocol("Servlet 3.0")
+ public static Archive<?> createDeployment()
+ {
+ return Deployments.defaultSeamDeployment();
+ }
+
+ @Test
+ public void localeTest() throws Exception
+ {
+ new NonFacesRequest()
+ {
+ @Override
+ protected void renderResponse() throws Exception
+ {
+ // it's necessary to emulate the startup behavior of LocaleConfig since it alters the JSF Application
+ // and we cannot be sure that the JSF Application wasn't cleared by an earlier class
+ // NOTE: I wish this test suite had some better place of initializing the application context
+ Contexts.getApplicationContext().remove(Seam.getComponentName(LocaleConfig.class));
+ LocaleConfig.instance();
+ }
+ }.run();
+
+ new FacesRequest()
+ {
+
+ @Override
+ protected void invokeApplication() throws Exception
+ {
+ // <i18:locale-config default-locale="fr_CA" supported-locales="fr_CA fr_FR en"/>
+ List<Locale> supportedLocales = new ArrayList<Locale>();
+ for (Iterator<Locale> iter = getFacesContext().getApplication().getSupportedLocales(); iter.hasNext();)
+ {
+ supportedLocales.add(iter.next());
+ }
+ assert supportedLocales.size() == 3;
+ assert supportedLocales.contains(Locale.CANADA_FRENCH);
+ assert supportedLocales.contains(Locale.ENGLISH);
+ assert supportedLocales.contains(Locale.FRANCE);
+ assert getFacesContext().getApplication().getDefaultLocale().equals(Locale.CANADA_FRENCH);
+
+ // why not? I guess be default locale means different things in different contexts (server vs user)
+ //assert org.jboss.seam.international.Locale.instance().equals(Locale.CANADA_FRENCH);
+
+ // reset the locale configuration (as it would be w/o <i18n:locale-config>)
+ getFacesContext().getApplication().setDefaultLocale(Locale.ENGLISH);
+ getFacesContext().getApplication().setSupportedLocales(null);
+
+ assert org.jboss.seam.international.Locale.instance().equals(Locale.getDefault());
+
+ LocaleSelector.instance().setLocale(Locale.UK);
+
+ assert org.jboss.seam.international.Locale.instance().equals(Locale.UK);
+
+ LocaleSelector.instance().setLocaleString(Locale.FRANCE.toString());
+
+ assert LocaleSelector.instance().getLanguage().equals(Locale.FRANCE.getLanguage());
+ assert LocaleSelector.instance().getCountry().equals(Locale.FRANCE.getCountry());
+ assert LocaleSelector.instance().getVariant().equals(Locale.FRANCE.getVariant());
+
+ assert org.jboss.seam.international.Locale.instance().equals(Locale.FRANCE);
+ assert LocaleSelector.instance().getLocaleString().equals(Locale.FRANCE.toString());
+
+ LocaleSelector.instance().select();
+ assert org.jboss.seam.international.Locale.instance().equals(Locale.FRANCE);
+
+ LocaleSelector.instance().selectLanguage(Locale.JAPANESE.getLanguage());
+ assert org.jboss.seam.international.Locale.instance().getLanguage().equals(Locale.JAPANESE.getLanguage());
+
+ ValueChangeEvent valueChangeEvent = new ValueChangeEvent(new UIOutput(), Locale.JAPANESE.toString(), Locale.TAIWAN.toString());
+ LocaleSelector.instance().select(valueChangeEvent);
+ assert org.jboss.seam.international.Locale.instance().equals(Locale.TAIWAN);
+
+ Locale uk_posix = new Locale(Locale.UK.getLanguage(), Locale.UK.getCountry(), "POSIX");
+ LocaleSelector.instance().setLocale(uk_posix);
+
+ assert org.jboss.seam.international.Locale.instance().equals(uk_posix);
+ assert LocaleSelector.instance().getLanguage().equals(uk_posix.getLanguage());
+ assert LocaleSelector.instance().getCountry().equals(uk_posix.getCountry());
+ assert LocaleSelector.instance().getVariant().equals(uk_posix.getVariant());
+
+ LocaleSelector.instance().setLanguage(Locale.CHINA.getLanguage());
+ LocaleSelector.instance().setCountry(Locale.CHINA.getCountry());
+ LocaleSelector.instance().setVariant(null);
+
+ assert org.jboss.seam.international.Locale.instance().equals(Locale.CHINA);
+
+ LocaleSelector.instance().setLanguage(Locale.ITALIAN.getLanguage());
+ LocaleSelector.instance().setCountry(null);
+ LocaleSelector.instance().setVariant(null);
+
+ assert org.jboss.seam.international.Locale.instance().equals(Locale.ITALIAN);
+
+ assert LocaleSelector.instance().getSupportedLocales().size() == 1;
+ assert LocaleSelector.instance().getSupportedLocales().get(0).getValue().equals(Locale.ENGLISH.toString());
+ assert LocaleSelector.instance().getSupportedLocales().get(0).getLabel().equals(Locale.ENGLISH.getDisplayName());
+
+ boolean failed = false;
+ try
+ {
+ LocaleSelector.instance().setLocale(null);
+ }
+ catch (NullPointerException e)
+ {
+ failed = true;
+ }
+ assert failed;
+
+ // TODO Test cookie stuff (need to extend Mocks for this)
+
+ }
+ }.run();
+ }
+}
Added: branches/community/Seam_2_3/seam-integration-tests-ee6/src/test/java/org/jboss/seam/test/integration/i8ln/TimeZoneTest.java
===================================================================
--- branches/community/Seam_2_3/seam-integration-tests-ee6/src/test/java/org/jboss/seam/test/integration/i8ln/TimeZoneTest.java (rev 0)
+++ branches/community/Seam_2_3/seam-integration-tests-ee6/src/test/java/org/jboss/seam/test/integration/i8ln/TimeZoneTest.java 2012-02-28 13:53:30 UTC (rev 14333)
@@ -0,0 +1,64 @@
+package org.jboss.seam.test.integration.i8ln;
+
+import java.util.TimeZone;
+
+import javax.faces.component.UIOutput;
+import javax.faces.event.ValueChangeEvent;
+
+import org.jboss.arquillian.container.test.api.Deployment;
+import org.jboss.arquillian.container.test.api.OverProtocol;
+import org.jboss.arquillian.junit.Arquillian;
+import org.jboss.seam.international.TimeZoneSelector;
+import org.jboss.seam.mock.JUnitSeamTest;
+import org.jboss.seam.test.integration.Deployments;
+import org.jboss.shrinkwrap.api.Archive;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+
+/**
+ *
+ * @author Pete Muir
+ *
+ */
+(a)RunWith(Arquillian.class)
+public class TimeZoneTest extends JUnitSeamTest
+{
+ @Deployment(name="TimeZoneTest")
+ @OverProtocol("Servlet 3.0")
+ public static Archive<?> createDeployment()
+ {
+ return Deployments.defaultSeamDeployment();
+ }
+
+ @Test
+ public void timeZoneTest() throws Exception
+ {
+ new FacesRequest()
+ {
+ @Override
+ protected void invokeApplication() throws Exception
+ {
+ assert org.jboss.seam.international.TimeZone.instance().equals(java.util.TimeZone.getDefault());
+
+ TimeZone cet = TimeZone.getTimeZone("CET");
+ TimeZoneSelector.instance().setTimeZone(cet);
+
+ assert org.jboss.seam.international.TimeZone.instance().equals(cet);
+
+ TimeZoneSelector.instance().setTimeZoneId("CET");
+
+ assert org.jboss.seam.international.TimeZone.instance().equals(cet);
+
+ TimeZoneSelector.instance().selectTimeZone("GMT");
+ assert org.jboss.seam.international.TimeZone.instance().getID().equals("GMT");
+
+ ValueChangeEvent valueChangeEvent = new ValueChangeEvent(new UIOutput(), "GMT", "PST");
+ TimeZoneSelector.instance().select(valueChangeEvent);
+ assert org.jboss.seam.international.TimeZone.instance().getID().equals("PST");
+
+ // TODO Test cookie stuff (need to extend Mocks for this)
+
+ }
+ }.run();
+ }
+}
Added: branches/community/Seam_2_3/seam-integration-tests-ee6/src/test/java/org/jboss/seam/test/integration/mock/SeamMockELResolverTest.java
===================================================================
--- branches/community/Seam_2_3/seam-integration-tests-ee6/src/test/java/org/jboss/seam/test/integration/mock/SeamMockELResolverTest.java (rev 0)
+++ branches/community/Seam_2_3/seam-integration-tests-ee6/src/test/java/org/jboss/seam/test/integration/mock/SeamMockELResolverTest.java 2012-02-28 13:53:30 UTC (rev 14333)
@@ -0,0 +1,166 @@
+package org.jboss.seam.test.integration.mock;
+
+import java.beans.FeatureDescriptor;
+import java.util.Iterator;
+
+import javax.el.ELContext;
+import javax.el.ELException;
+import javax.el.ELResolver;
+import javax.el.PropertyNotFoundException;
+import javax.el.PropertyNotWritableException;
+
+import org.jboss.arquillian.container.test.api.Deployment;
+import org.jboss.arquillian.container.test.api.OverProtocol;
+import org.jboss.arquillian.junit.Arquillian;
+import org.jboss.seam.mock.JUnitSeamTest;
+import org.jboss.seam.test.integration.Deployments;
+import org.jboss.shrinkwrap.api.Archive;
+import org.junit.runner.RunWith;
+import org.junit.Test;
+
+
+/**
+ * Test for adding EL resolvers to Seam MockFacesContext
+ *
+ * @author Pete Muir
+ *
+ */
+(a)RunWith(Arquillian.class)
+public class SeamMockELResolverTest extends JUnitSeamTest
+{
+ @Deployment(name="SecurityTest")
+ @OverProtocol("Servlet 3.0")
+ public static Archive<?> createDeployment()
+ {
+ return Deployments.defaultSeamDeployment();
+ }
+
+ private static final String property = "customELResolverTest";
+
+ @Override
+ protected ELResolver[] getELResolvers()
+ {
+ ELResolver[] resolvers = new ELResolver[2];
+ resolvers[0] = new ELResolver()
+ {
+
+ @Override
+ public Class<?> getCommonPropertyType(ELContext arg0, Object arg1)
+ {
+ return null;
+ }
+
+ @Override
+ public Iterator<FeatureDescriptor> getFeatureDescriptors(ELContext arg0, Object arg1)
+ {
+ return null;
+ }
+
+ @Override
+ public Class<?> getType(ELContext arg0, Object base, Object property)
+ throws NullPointerException, PropertyNotFoundException, ELException
+ {
+ return null;
+ }
+
+ @Override
+ public Object getValue(ELContext context, Object base, Object property)
+ throws NullPointerException, PropertyNotFoundException, ELException
+ {
+ if (SeamMockELResolverTest.property.equals(property))
+ {
+ context.setPropertyResolved(true);
+ return "found";
+ }
+ return null;
+ }
+
+ @Override
+ public boolean isReadOnly(ELContext arg0, Object base, Object property)
+ throws NullPointerException, PropertyNotFoundException, ELException
+ {
+ if (SeamMockELResolverTest.property.equals(property))
+ {
+ return false;
+ }
+ return false;
+ }
+
+ @Override
+ public void setValue(ELContext context, Object base, Object property, Object value)
+ throws NullPointerException, PropertyNotFoundException,
+ PropertyNotWritableException, ELException
+ {
+ if (SeamMockELResolverTest.property.equals(property))
+ {
+ throw new PropertyNotWritableException();
+ }
+ }
+
+ };
+ resolvers[1] = new ELResolver() {
+
+ @Override
+ public Class<?> getCommonPropertyType(ELContext arg0, Object arg1)
+ {
+ return null;
+ }
+
+ @Override
+ public Iterator<FeatureDescriptor> getFeatureDescriptors(ELContext arg0, Object arg1)
+ {
+ return null;
+ }
+
+ @Override
+ public Class<?> getType(ELContext arg0, Object base, Object property)
+ throws NullPointerException, PropertyNotFoundException, ELException
+ {
+ return null;
+ }
+
+ @Override
+ public Object getValue(ELContext context, Object base, Object property)
+ throws NullPointerException, PropertyNotFoundException, ELException
+ {
+ if (base != null && "className".equals(property))
+ {
+ context.setPropertyResolved(true);
+ return base.getClass().getSimpleName();
+ }
+ return null;
+ }
+
+ @Override
+ public boolean isReadOnly(ELContext arg0, Object base, Object property)
+ throws NullPointerException, PropertyNotFoundException, ELException
+ {
+ return true;
+ }
+
+ @Override
+ public void setValue(ELContext context, Object base, Object property, Object value)
+ throws NullPointerException, PropertyNotFoundException,
+ PropertyNotWritableException, ELException
+ {
+ throw new PropertyNotWritableException();
+ }
+ };
+ return resolvers;
+ }
+
+ @Test
+ public void testCustomELResolver() throws Exception
+ {
+ new FacesRequest()
+ {
+ @Override
+ protected void invokeApplication() throws Exception
+ {
+ assert "found".equals(getValue("#{" + property + "}"));
+ assert "String".equals(getValue("#{" + property + ".className}"));
+ }
+ }.run();
+ }
+
+}
Added: branches/community/Seam_2_3/seam-integration-tests-ee6/src/test/java/org/jboss/seam/test/integration/mock/SeamTestTest.java
===================================================================
--- branches/community/Seam_2_3/seam-integration-tests-ee6/src/test/java/org/jboss/seam/test/integration/mock/SeamTestTest.java (rev 0)
+++ branches/community/Seam_2_3/seam-integration-tests-ee6/src/test/java/org/jboss/seam/test/integration/mock/SeamTestTest.java 2012-02-28 13:53:30 UTC (rev 14333)
@@ -0,0 +1,67 @@
+package org.jboss.seam.test.integration.mock;
+
+import org.jboss.arquillian.container.test.api.Deployment;
+import org.jboss.arquillian.container.test.api.OverProtocol;
+import org.jboss.arquillian.junit.Arquillian;
+import org.jboss.seam.mock.JUnitSeamTest;
+import org.jboss.seam.test.integration.Action;
+import org.jboss.seam.test.integration.Deployments;
+import org.jboss.seam.test.integration.Person;
+import org.jboss.shrinkwrap.api.Archive;
+import org.junit.runner.RunWith;
+import org.junit.Test;
+
+public class SeamTestTest extends JUnitSeamTest
+{
+ private static final String PETER_NAME = "Pete Muir";
+ private static final String PETER_USERNAME = "pmuir";
+
+ @Test
+ public void testEl() throws Exception
+ {
+ new FacesRequest()
+ {
+
+ @Override
+ protected void updateModelValues() throws Exception
+ {
+ setValue("#{person.name}", PETER_NAME);
+ }
+
+ @Override
+ protected void renderResponse() throws Exception
+ {
+ assert getValue("#{person.name}").equals(PETER_NAME);
+ }
+
+ @Override
+ protected void invokeApplication() throws Exception
+ {
+ invokeAction("#{action.go}");
+ String result = getOutcome();
+ assert "success".equals(result);
+ }
+ }.run();
+ }
+
+ @Test
+ public void testSeamSecurity() throws Exception
+ {
+ new FacesRequest()
+ {
+
+ @Override
+ protected void updateModelValues() throws Exception
+ {
+ setValue("#{identity.username}", PETER_USERNAME);
+ }
+
+ @Override
+ protected void renderResponse() throws Exception
+ {
+ assert getValue("#{identity.username}").equals(PETER_USERNAME);
+ }
+ }.run();
+ }
+
+}
Added: branches/community/Seam_2_3/seam-integration-tests-ee6/src/test/java/org/jboss/seam/test/integration/security/SecurityTest.java
===================================================================
--- branches/community/Seam_2_3/seam-integration-tests-ee6/src/test/java/org/jboss/seam/test/integration/security/SecurityTest.java (rev 0)
+++ branches/community/Seam_2_3/seam-integration-tests-ee6/src/test/java/org/jboss/seam/test/integration/security/SecurityTest.java 2012-02-28 13:53:30 UTC (rev 14333)
@@ -0,0 +1,182 @@
+package org.jboss.seam.test.integration.security;
+
+import java.util.HashMap;
+
+import javax.security.auth.login.AppConfigurationEntry;
+import javax.security.auth.login.Configuration;
+import javax.security.auth.login.LoginContext;
+import javax.security.auth.login.LoginException;
+import javax.security.auth.login.AppConfigurationEntry.LoginModuleControlFlag;
+
+import org.jboss.arquillian.container.test.api.Deployment;
+import org.jboss.arquillian.container.test.api.OverProtocol;
+import org.jboss.arquillian.junit.Arquillian;
+import org.jboss.seam.Component;
+import org.jboss.seam.contexts.Contexts;
+import org.jboss.seam.contexts.Lifecycle;
+import org.jboss.seam.mock.JUnitSeamTest;
+import org.jboss.seam.mock.MockLoginModule;
+import org.jboss.seam.security.AuthorizationException;
+import org.jboss.seam.security.Identity;
+import org.jboss.seam.security.NotLoggedInException;
+import org.jboss.seam.test.integration.Deployments;
+import org.jboss.seam.web.Session;
+import org.jboss.shrinkwrap.api.Archive;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+
+/**
+ * Seam Security Unit Tests
+ *
+ * @author Shane Bryzak
+ */
+(a)RunWith(Arquillian.class)
+public class SecurityTest extends JUnitSeamTest
+{
+ @Deployment(name="SecurityTest")
+ @OverProtocol("Servlet 3.0")
+ public static Archive<?> createDeployment()
+ {
+ return Deployments.defaultSeamDeployment();
+ }
+
+ private Configuration createMockJAASConfiguration()
+ {
+ return new Configuration()
+ {
+ private AppConfigurationEntry[] aces = { new AppConfigurationEntry(
+ MockLoginModule.class.getName(),
+ LoginModuleControlFlag.REQUIRED,
+ new HashMap<String,String>()
+ ) };
+
+ @Override
+ public AppConfigurationEntry[] getAppConfigurationEntry(String name)
+ {
+ return aces;
+ }
+
+ @Override
+ public void refresh() {}
+ };
+ }
+
+ public class MockIdentity extends Identity
+ {
+ @Override
+ protected LoginContext getLoginContext() throws LoginException
+ {
+ return new LoginContext("default", getSubject(), getCredentials().createCallbackHandler(),
+ createMockJAASConfiguration());
+ }
+ }
+
+ @Test
+ public void testLogin()
+ {
+ try
+ {
+ Lifecycle.beginApplication(new HashMap<String,Object>());
+ Lifecycle.beginCall();
+
+ // Create a mock session
+ Contexts.getSessionContext().set(Component.getComponentName(Session.class), new Session());
+
+ Identity identity = new MockIdentity();
+ identity.create();
+
+ // Put the identity into our session context
+ Contexts.getSessionContext().set(Component.getComponentName(Identity.class), identity);
+
+ // Test addRole()
+ identity.addRole("admin");
+
+ assert(!identity.hasRole("admin"));
+
+ try
+ {
+ // This should throw a NotLoggedInException
+ identity.checkRole("admin");
+ assert(false);
+ }
+ catch (NotLoggedInException ex)
+ {
+ // expected
+ }
+
+ identity.getCredentials().setUsername("foo");
+ identity.getCredentials().setPassword("bar");
+
+ assert("foo".equals(identity.getCredentials().getUsername()));
+ assert("bar".equals(identity.getCredentials().getPassword()));
+
+ assert("loggedIn".equals(identity.login()));
+ assert(identity.isLoggedIn());
+
+ // Pre-authenticated roles are cleared before authenticating,
+ // so this should still return false
+ assert(!identity.hasRole("admin"));
+
+ // The foo role is added by MockLoginModule
+ assert(identity.hasRole("foo"));
+
+ identity.removeRole("foo");
+ assert(!identity.hasRole("foo"));
+
+ try
+ {
+ // This should throw an AuthorizationException
+ identity.checkRole("foo");
+ assert(false);
+ }
+ catch (AuthorizationException ex)
+ {
+ // expected
+ }
+
+ // Now that we're authenticated, adding a role should have an immediate effect
+ identity.addRole("admin");
+ assert(identity.hasRole("admin"));
+
+ identity.logout();
+
+ assert(!identity.hasRole("admin"));
+ assert(!identity.isLoggedIn());
+ }
+ finally
+ {
+ Lifecycle.endApplication();
+ }
+ }
+
+ @Test
+ public void testDisableSecurity()
+ {
+ try
+ {
+ Identity identity = new Identity();
+ identity.create();
+
+ // Disable security
+ Identity.setSecurityEnabled(false);
+
+ assert(!Identity.isSecurityEnabled());
+ assert(identity.hasRole("admin"));
+ assert(identity.hasPermission("foo", "bar"));
+
+ // This shouldn't throw an exception while security is disabled
+ identity.checkRestriction("foo");
+
+ // Enable security
+ Identity.setSecurityEnabled(true);
+ assert(Identity.isSecurityEnabled());
+ assert(!identity.hasRole("admin"));
+ assert(!identity.hasPermission("foo", "bar"));
+ }
+ finally
+ {
+ Identity.setSecurityEnabled(true);
+ }
+ }
+
+}
Added: branches/community/Seam_2_3/seam-integration-tests-ee6/src/test/resources/META-INF/ejb-jar.xml
===================================================================
--- branches/community/Seam_2_3/seam-integration-tests-ee6/src/test/resources/META-INF/ejb-jar.xml (rev 0)
+++ branches/community/Seam_2_3/seam-integration-tests-ee6/src/test/resources/META-INF/ejb-jar.xml 2012-02-28 13:53:30 UTC (rev 14333)
@@ -0,0 +1,20 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<ejb-jar xmlns="http://java.sun.com/xml/ns/javaee"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/ejb-jar_3_0.xsd"
+ version="3.0">
+
+ <interceptors>
+ <interceptor>
+ <interceptor-class>org.jboss.seam.ejb.SeamInterceptor</interceptor-class>
+ </interceptor>
+ </interceptors>
+
+ <assembly-descriptor>
+ <interceptor-binding>
+ <ejb-name>*</ejb-name>
+ <interceptor-class>org.jboss.seam.ejb.SeamInterceptor</interceptor-class>
+ </interceptor-binding>
+ </assembly-descriptor>
+
+</ejb-jar>
\ No newline at end of file
Added: branches/community/Seam_2_3/seam-integration-tests-ee6/src/test/resources/META-INF/persistence.xml
===================================================================
--- branches/community/Seam_2_3/seam-integration-tests-ee6/src/test/resources/META-INF/persistence.xml (rev 0)
+++ branches/community/Seam_2_3/seam-integration-tests-ee6/src/test/resources/META-INF/persistence.xml 2012-02-28 13:53:30 UTC (rev 14333)
@@ -0,0 +1,20 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!-- Persistence deployment descriptor for dev profile -->
+<persistence xmlns="http://java.sun.com/xml/ns/persistence"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://java.sun.com/xml/ns/persistence http://java.sun.com/xml/ns/persistence/persistence_1_0.xsd"
+ version="1.0">
+
+ <persistence-unit name="integration">
+ <provider>org.hibernate.ejb.HibernatePersistence</provider>
+ <jta-data-source>java:jboss/datasources/ExampleDS</jta-data-source>
+ <properties>
+ <property name="hibernate.hbm2ddl.auto" value="create-drop"/>
+ <property name="hibernate.cache.use_query_cache" value="false"/>
+ <property name="hibernate.cache.use_second_level_cache" value="false"/>
+ <property name="hibernate.show_sql" value="true"/>
+ <property name="jboss.entity.manager.factory.jndi.name" value="java:/integrationEntityManagerFactory"/>
+ </properties>
+ </persistence-unit>
+
+</persistence>
Added: branches/community/Seam_2_3/seam-integration-tests-ee6/src/test/resources/WEB-INF/components-jbpm.xml
===================================================================
--- branches/community/Seam_2_3/seam-integration-tests-ee6/src/test/resources/WEB-INF/components-jbpm.xml (rev 0)
+++ branches/community/Seam_2_3/seam-integration-tests-ee6/src/test/resources/WEB-INF/components-jbpm.xml 2012-02-28 13:53:30 UTC (rev 14333)
@@ -0,0 +1,58 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<components xmlns="http://jboss.com/products/seam/components"
+ xmlns:bpm="http://jboss.com/products/seam/bpm"
+ xmlns:core="http://jboss.com/products/seam/core"
+ xmlns:i18n="http://jboss.com/products/seam/international"
+ xmlns:security="http://jboss.com/products/seam/security"
+ xmlns:persistence="http://jboss.com/products/seam/persistence"
+ xmlns:web="http://jboss.com/products/seam/web"
+ xmlns:framework="http://jboss.com/products/seam/framework"
+ xmlns:jms="http://jboss.com/products/seam/jms"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation=
+ "http://jboss.com/products/seam/core http://jboss.com/products/seam/core-2.3.xsd
+ http://jboss.com/products/seam/bpm http://jboss.com/products/seam/bpm-2.3.xsd
+ http://jboss.com/products/seam/international http://jboss.com/products/seam/international-2.3.xsd
+ http://jboss.com/products/seam/security http://jboss.com/products/seam/security-2.3.xsd
+ http://jboss.com/products/seam/persistence http://jboss.com/products/seam/persistence-2.3.xsd
+ http://jboss.com/products/seam/components http://jboss.com/products/seam/components-2.3.xsd
+ http://jboss.com/products/seam/web http://jboss.com/products/seam/web-2.3.xsd
+ http://jboss.com/products/seam/jms http://jboss.com/products/seam/jms-2.3.xsd
+ http://jboss.com/products/seam/framework http://jboss.com/products/seam/framework-2.3.xsd">
+
+ <core:init debug="false" jndi-pattern="@jndiPattern@" />
+
+ <core:manager concurrent-request-timeout="500"
+ conversation-timeout="120000"
+ conversation-id-parameter="cid"/>
+
+ <i18n:locale-config default-locale="fr_CA" supported-locales="fr_CA fr_FR en"/>
+
+ <persistence:managed-persistence-context name="entityManager"
+ auto-create="true"
+ persistence-unit-jndi-name="java:/integrationEntityManagerFactory" />
+
+
+ <bpm:jbpm>
+ <bpm:process-definitions>
+ <value>testProcess1.jpdl.xml</value>
+ <value>testProcess2.jpdl.xml</value>
+ <value>testProcess3.jpdl.xml</value>
+ <value>testProcess4.jpdl.xml</value>
+ </bpm:process-definitions>
+ </bpm:jbpm>
+
+
+ <jms:topic-connection topic-connection-factory-jndi-name="/ConnectionFactory" />
+ <jms:queue-connection queue-connection-factory-jndi-name="/ConnectionFactory" />
+
+ <jms:managed-topic-publisher name="testPublisher"
+ auto-create="true"
+ topic-jndi-name="/topic/testTopic" />
+
+ <jms:managed-queue-sender name="testSender"
+ auto-create="true"
+ queue-jndi-name="/queue/testQueue" />
+
+
+</components>
Added: branches/community/Seam_2_3/seam-integration-tests-ee6/src/test/resources/WEB-INF/components.xml
===================================================================
--- branches/community/Seam_2_3/seam-integration-tests-ee6/src/test/resources/WEB-INF/components.xml (rev 0)
+++ branches/community/Seam_2_3/seam-integration-tests-ee6/src/test/resources/WEB-INF/components.xml 2012-02-28 13:53:30 UTC (rev 14333)
@@ -0,0 +1,47 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<components xmlns="http://jboss.com/products/seam/components"
+ xmlns:bpm="http://jboss.com/products/seam/bpm"
+ xmlns:core="http://jboss.com/products/seam/core"
+ xmlns:i18n="http://jboss.com/products/seam/international"
+ xmlns:security="http://jboss.com/products/seam/security"
+ xmlns:persistence="http://jboss.com/products/seam/persistence"
+ xmlns:web="http://jboss.com/products/seam/web"
+ xmlns:framework="http://jboss.com/products/seam/framework"
+ xmlns:jms="http://jboss.com/products/seam/jms"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation=
+ "http://jboss.com/products/seam/core http://jboss.com/products/seam/core-2.3.xsd
+ http://jboss.com/products/seam/bpm http://jboss.com/products/seam/bpm-2.3.xsd
+ http://jboss.com/products/seam/international http://jboss.com/products/seam/international-2.3.xsd
+ http://jboss.com/products/seam/security http://jboss.com/products/seam/security-2.3.xsd
+ http://jboss.com/products/seam/persistence http://jboss.com/products/seam/persistence-2.3.xsd
+ http://jboss.com/products/seam/components http://jboss.com/products/seam/components-2.3.xsd
+ http://jboss.com/products/seam/web http://jboss.com/products/seam/web-2.3.xsd
+ http://jboss.com/products/seam/jms http://jboss.com/products/seam/jms-2.3.xsd
+ http://jboss.com/products/seam/framework http://jboss.com/products/seam/framework-2.3.xsd">
+
+ <core:init debug="false" jndi-pattern="java:app/test/#{ejbName}" />
+
+ <core:manager concurrent-request-timeout="500"
+ conversation-timeout="120000"
+ conversation-id-parameter="cid"/>
+
+ <i18n:locale-config default-locale="fr_CA" supported-locales="fr_CA fr_FR en"/>
+
+ <persistence:managed-persistence-context name="entityManager"
+ auto-create="true"
+ persistence-unit-jndi-name="java:/integrationEntityManagerFactory" />
+
+ <jms:topic-connection topic-connection-factory-jndi-name="/ConnectionFactory" />
+ <jms:queue-connection queue-connection-factory-jndi-name="/ConnectionFactory" />
+
+ <jms:managed-topic-publisher name="testPublisher"
+ auto-create="true"
+ topic-jndi-name="/topic/testTopic" />
+
+ <jms:managed-queue-sender name="testSender"
+ auto-create="true"
+ queue-jndi-name="/queue/testQueue" />
+
+
+</components>
Added: branches/community/Seam_2_3/seam-integration-tests-ee6/src/test/resources/WEB-INF/pages.xml
===================================================================
--- branches/community/Seam_2_3/seam-integration-tests-ee6/src/test/resources/WEB-INF/pages.xml (rev 0)
+++ branches/community/Seam_2_3/seam-integration-tests-ee6/src/test/resources/WEB-INF/pages.xml 2012-02-28 13:53:30 UTC (rev 14333)
@@ -0,0 +1,64 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<pages xmlns="http://jboss.com/products/seam/pages"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://jboss.com/products/seam/pages http://jboss.com/products/seam/pages-2.3.xsd"
+ no-conversation-view-id="/home.xhtml"
+ login-view-id="/login.xhtml">
+
+ <page view-id="/pageWithDescription.xhtml">
+ <description>page description</description>
+ </page>
+
+ <page view-id="/pageWithAnotherDescription.xhtml">
+ <description>another page description</description>
+ </page>
+
+ <page view-id="/pageWithParameter.xhtml">
+ <param name="personName" value="#{person.name}" />
+ </page>
+
+ <page view-id="/pageWithRequiredParameter.xhtml">
+ <param name="personName" value="#{person.name}" required="true"/>
+ </page>
+
+ <page view-id="/pageWithValidateModelDisabledParameter.xhtml">
+ <param name="personName" value="#{person.name}" validateModel="false"/>
+ </page>
+
+ <exception class="org.jboss.seam.framework.EntityNotFoundException">
+ <redirect view-id="/error.xhtml">
+ <message>Not found</message>
+ </redirect>
+ </exception>
+
+ <exception class="javax.persistence.EntityNotFoundException">
+ <redirect view-id="/error.xhtml">
+ <message>Not found</message>
+ </redirect>
+ </exception>
+
+ <exception class="javax.persistence.OptimisticLockException">
+ <end-conversation/>
+ <redirect view-id="/error.xhtml">
+ <message>Another user changed the same data, please try again</message>
+ </redirect>
+ </exception>
+
+ <exception class="org.jboss.seam.security.AuthorizationException">
+ <redirect>
+ <message>You don't have permission to do this</message>
+ </redirect>
+ </exception>
+
+ <exception class="org.jboss.seam.security.NotLoggedInException">
+ <redirect view-id="/login.xhtml">
+ <message>Please log in first</message>
+ </redirect>
+ </exception>
+
+ <exception>
+ <redirect view-id="/error.xhtml">
+ <message>Unexpected error, please try again</message>
+ </redirect>
+ </exception>
+</pages>
Added: branches/community/Seam_2_3/seam-integration-tests-ee6/src/test/resources/WEB-INF/web.xml
===================================================================
--- branches/community/Seam_2_3/seam-integration-tests-ee6/src/test/resources/WEB-INF/web.xml (rev 0)
+++ branches/community/Seam_2_3/seam-integration-tests-ee6/src/test/resources/WEB-INF/web.xml 2012-02-28 13:53:30 UTC (rev 14333)
@@ -0,0 +1,11 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<web-app version="3.0"
+ xmlns="http://java.sun.com/xml/ns/javaee"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd">
+
+ <listener>
+ <listener-class>org.jboss.seam.servlet.SeamListener</listener-class>
+ </listener>
+
+</web-app>
Added: branches/community/Seam_2_3/seam-integration-tests-ee6/src/test/resources/components.properties
===================================================================
--- branches/community/Seam_2_3/seam-integration-tests-ee6/src/test/resources/components.properties (rev 0)
+++ branches/community/Seam_2_3/seam-integration-tests-ee6/src/test/resources/components.properties 2012-02-28 13:53:30 UTC (rev 14333)
@@ -0,0 +1,3 @@
+# The pattern in components.xml is replaced by an application server specific value in the ant build. This value is used for running tests
+
+jndiPattern \#{ejbName}/local
\ No newline at end of file
Added: branches/community/Seam_2_3/seam-integration-tests-ee6/src/test/resources/hibernate.cfg.xml
===================================================================
--- branches/community/Seam_2_3/seam-integration-tests-ee6/src/test/resources/hibernate.cfg.xml (rev 0)
+++ branches/community/Seam_2_3/seam-integration-tests-ee6/src/test/resources/hibernate.cfg.xml 2012-02-28 13:53:30 UTC (rev 14333)
@@ -0,0 +1,175 @@
+<?xml version='1.0' encoding='utf-8'?>
+
+<!DOCTYPE hibernate-configuration PUBLIC
+ "-//Hibernate/Hibernate Configuration DTD 3.0//EN"
+ "http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd">
+
+<hibernate-configuration>
+ <session-factory>
+
+ <property name="show_sql">false</property>
+ <property name="connection.datasource">java:jboss/datasources/ExampleDS</property>
+ <property name="transaction.factory_class">org.hibernate.transaction.JTATransactionFactory</property>
+ <property name="transaction.manager_lookup_class">org.hibernate.transaction.JBossTransactionManagerLookup</property>
+ <property name="cache.provider_class">org.hibernate.cache.HashtableCacheProvider</property>
+ <property name="hbm2ddl.auto">create-drop</property>
+
+ <property name="hibernate.cache.use_query_cache">false</property>
+ <property name="hibernate.cache.use_second_level_cache">false</property>
+
+ <!--property name="transaction.flush_before_completion">true</property-->
+
+ <!-- ############################################ -->
+ <!-- # mapping files with external dependencies # -->
+ <!-- ############################################ -->
+
+ <!-- following mapping file has a dependendy on -->
+ <!-- 'bsh-{version}.jar'. -->
+ <!-- uncomment this if you don't have bsh on your -->
+ <!-- classpath. you won't be able to use the -->
+ <!-- script element in process definition files -->
+ <mapping resource="org/jbpm/graph/action/Script.hbm.xml"/>
+
+ <!-- following mapping files have a dependendy on -->
+ <!-- 'jbpm-identity.jar', mapping files -->
+ <!-- of the pluggable jbpm identity component. -->
+ <!-- Uncomment the following 3 lines if you -->
+ <!-- want to use the jBPM identity mgmgt -->
+ <!-- component. -->
+ <!-- identity mappings (begin) ===
+ <mapping resource="org/jbpm/identity/User.hbm.xml"/>
+ <mapping resource="org/jbpm/identity/Group.hbm.xml"/>
+ <mapping resource="org/jbpm/identity/Membership.hbm.xml"/>
+ ==== identity mappings (end) -->
+
+ <!-- following mapping files have a dependendy on -->
+ <!-- the JCR API -->
+ <!-- jcr mappings (begin) ===
+ <mapping resource="org/jbpm/context/exe/variableinstance/JcrNodeInstance.hbm.xml"/>
+ ==== jcr mappings (end) -->
+
+
+ <!-- ###################### -->
+ <!-- # jbpm mapping files # -->
+ <!-- ###################### -->
+
+ <mapping resource="org/jbpm/db/hibernate.types.hbm.xml" />
+
+ <!-- hql queries and type defs -->
+ <mapping resource="org/jbpm/db/hibernate.queries.hbm.xml" />
+
+ <!-- graph.action mapping files -->
+ <mapping resource="org/jbpm/graph/action/MailAction.hbm.xml"/>
+
+ <!-- graph.def mapping files -->
+ <mapping resource="org/jbpm/graph/def/ProcessDefinition.hbm.xml"/>
+ <mapping resource="org/jbpm/graph/def/Node.hbm.xml"/>
+ <mapping resource="org/jbpm/graph/def/Transition.hbm.xml"/>
+ <mapping resource="org/jbpm/graph/def/Event.hbm.xml"/>
+ <mapping resource="org/jbpm/graph/def/Action.hbm.xml"/>
+ <mapping resource="org/jbpm/graph/def/SuperState.hbm.xml"/>
+ <mapping resource="org/jbpm/graph/def/ExceptionHandler.hbm.xml"/>
+ <mapping resource="org/jbpm/instantiation/Delegation.hbm.xml"/>
+
+ <!-- graph.node mapping files -->
+ <mapping resource="org/jbpm/graph/node/StartState.hbm.xml"/>
+ <mapping resource="org/jbpm/graph/node/EndState.hbm.xml"/>
+ <mapping resource="org/jbpm/graph/node/ProcessState.hbm.xml"/>
+ <mapping resource="org/jbpm/graph/node/Decision.hbm.xml"/>
+ <mapping resource="org/jbpm/graph/node/Fork.hbm.xml"/>
+ <mapping resource="org/jbpm/graph/node/Join.hbm.xml"/>
+ <mapping resource="org/jbpm/graph/node/MailNode.hbm.xml"/>
+ <mapping resource="org/jbpm/graph/node/State.hbm.xml"/>
+ <mapping resource="org/jbpm/graph/node/TaskNode.hbm.xml"/>
+
+ <!-- context.def mapping files -->
+ <mapping resource="org/jbpm/context/def/ContextDefinition.hbm.xml"/>
+ <mapping resource="org/jbpm/context/def/VariableAccess.hbm.xml"/>
+
+ <!-- taskmgmt.def mapping files -->
+ <mapping resource="org/jbpm/taskmgmt/def/TaskMgmtDefinition.hbm.xml"/>
+ <mapping resource="org/jbpm/taskmgmt/def/Swimlane.hbm.xml"/>
+ <mapping resource="org/jbpm/taskmgmt/def/Task.hbm.xml"/>
+ <mapping resource="org/jbpm/taskmgmt/def/TaskController.hbm.xml"/>
+
+ <!-- module.def mapping files -->
+ <mapping resource="org/jbpm/module/def/ModuleDefinition.hbm.xml"/>
+
+ <!-- bytes mapping files -->
+ <mapping resource="org/jbpm/bytes/ByteArray.hbm.xml"/>
+
+ <!-- file.def mapping files -->
+ <mapping resource="org/jbpm/file/def/FileDefinition.hbm.xml"/>
+
+ <!-- scheduler.def mapping files -->
+ <mapping resource="org/jbpm/scheduler/def/CreateTimerAction.hbm.xml"/>
+ <mapping resource="org/jbpm/scheduler/def/CancelTimerAction.hbm.xml"/>
+
+ <!-- graph.exe mapping files -->
+ <mapping resource="org/jbpm/graph/exe/Comment.hbm.xml"/>
+ <mapping resource="org/jbpm/graph/exe/ProcessInstance.hbm.xml"/>
+ <mapping resource="org/jbpm/graph/exe/Token.hbm.xml"/>
+ <mapping resource="org/jbpm/graph/exe/RuntimeAction.hbm.xml"/>
+
+ <!-- module.exe mapping files -->
+ <mapping resource="org/jbpm/module/exe/ModuleInstance.hbm.xml"/>
+
+ <!-- context.exe mapping files -->
+ <mapping resource="org/jbpm/context/exe/ContextInstance.hbm.xml"/>
+ <mapping resource="org/jbpm/context/exe/TokenVariableMap.hbm.xml"/>
+ <mapping resource="org/jbpm/context/exe/VariableInstance.hbm.xml"/>
+ <mapping resource="org/jbpm/context/exe/variableinstance/ByteArrayInstance.hbm.xml"/>
+ <mapping resource="org/jbpm/context/exe/variableinstance/DateInstance.hbm.xml"/>
+ <mapping resource="org/jbpm/context/exe/variableinstance/DoubleInstance.hbm.xml"/>
+ <mapping resource="org/jbpm/context/exe/variableinstance/HibernateLongInstance.hbm.xml"/>
+ <mapping resource="org/jbpm/context/exe/variableinstance/HibernateStringInstance.hbm.xml"/>
+ <mapping resource="org/jbpm/context/exe/variableinstance/LongInstance.hbm.xml"/>
+ <mapping resource="org/jbpm/context/exe/variableinstance/NullInstance.hbm.xml"/>
+ <mapping resource="org/jbpm/context/exe/variableinstance/StringInstance.hbm.xml"/>
+
+ <!-- job mapping files -->
+ <mapping resource="org/jbpm/job/Job.hbm.xml"/>
+ <mapping resource="org/jbpm/job/Timer.hbm.xml"/>
+ <mapping resource="org/jbpm/job/ExecuteNodeJob.hbm.xml"/>
+ <mapping resource="org/jbpm/job/ExecuteActionJob.hbm.xml"/>
+
+ <!-- taskmgmt.exe mapping files -->
+ <mapping resource="org/jbpm/taskmgmt/exe/TaskMgmtInstance.hbm.xml"/>
+ <mapping resource="org/jbpm/taskmgmt/exe/TaskInstance.hbm.xml"/>
+ <mapping resource="org/jbpm/taskmgmt/exe/PooledActor.hbm.xml"/>
+ <mapping resource="org/jbpm/taskmgmt/exe/SwimlaneInstance.hbm.xml"/>
+
+ <!-- logging mapping files -->
+ <mapping resource="org/jbpm/logging/log/ProcessLog.hbm.xml"/>
+ <mapping resource="org/jbpm/logging/log/MessageLog.hbm.xml"/>
+ <mapping resource="org/jbpm/logging/log/CompositeLog.hbm.xml"/>
+ <mapping resource="org/jbpm/graph/log/ActionLog.hbm.xml"/>
+ <mapping resource="org/jbpm/graph/log/NodeLog.hbm.xml"/>
+ <mapping resource="org/jbpm/graph/log/ProcessInstanceCreateLog.hbm.xml"/>
+ <mapping resource="org/jbpm/graph/log/ProcessInstanceEndLog.hbm.xml"/>
+ <mapping resource="org/jbpm/graph/log/ProcessStateLog.hbm.xml"/>
+ <mapping resource="org/jbpm/graph/log/SignalLog.hbm.xml"/>
+ <mapping resource="org/jbpm/graph/log/TokenCreateLog.hbm.xml"/>
+ <mapping resource="org/jbpm/graph/log/TokenEndLog.hbm.xml"/>
+ <mapping resource="org/jbpm/graph/log/TransitionLog.hbm.xml"/>
+ <mapping resource="org/jbpm/context/log/VariableLog.hbm.xml"/>
+ <mapping resource="org/jbpm/context/log/VariableCreateLog.hbm.xml"/>
+ <mapping resource="org/jbpm/context/log/VariableDeleteLog.hbm.xml"/>
+ <mapping resource="org/jbpm/context/log/VariableUpdateLog.hbm.xml"/>
+ <mapping resource="org/jbpm/context/log/variableinstance/ByteArrayUpdateLog.hbm.xml"/>
+ <mapping resource="org/jbpm/context/log/variableinstance/DateUpdateLog.hbm.xml"/>
+ <mapping resource="org/jbpm/context/log/variableinstance/DoubleUpdateLog.hbm.xml"/>
+ <mapping resource="org/jbpm/context/log/variableinstance/HibernateLongUpdateLog.hbm.xml"/>
+ <mapping resource="org/jbpm/context/log/variableinstance/HibernateStringUpdateLog.hbm.xml"/>
+ <mapping resource="org/jbpm/context/log/variableinstance/LongUpdateLog.hbm.xml"/>
+ <mapping resource="org/jbpm/context/log/variableinstance/StringUpdateLog.hbm.xml"/>
+ <mapping resource="org/jbpm/taskmgmt/log/TaskLog.hbm.xml"/>
+ <mapping resource="org/jbpm/taskmgmt/log/TaskCreateLog.hbm.xml"/>
+ <mapping resource="org/jbpm/taskmgmt/log/TaskAssignLog.hbm.xml"/>
+ <mapping resource="org/jbpm/taskmgmt/log/TaskEndLog.hbm.xml"/>
+ <mapping resource="org/jbpm/taskmgmt/log/SwimlaneLog.hbm.xml"/>
+ <mapping resource="org/jbpm/taskmgmt/log/SwimlaneCreateLog.hbm.xml"/>
+ <mapping resource="org/jbpm/taskmgmt/log/SwimlaneAssignLog.hbm.xml"/>
+
+ </session-factory>
+</hibernate-configuration>
Added: branches/community/Seam_2_3/seam-integration-tests-ee6/src/test/resources/jboss-seam-integration-tests-ds.xml
===================================================================
--- branches/community/Seam_2_3/seam-integration-tests-ee6/src/test/resources/jboss-seam-integration-tests-ds.xml (rev 0)
+++ branches/community/Seam_2_3/seam-integration-tests-ee6/src/test/resources/jboss-seam-integration-tests-ds.xml 2012-02-28 13:53:30 UTC (rev 14333)
@@ -0,0 +1,18 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!DOCTYPE datasources
+ PUBLIC "-//JBoss//DTD JBOSS JCA Config 1.5//EN"
+ "http://www.jboss.org/j2ee/dtd/jboss-ds_1_5.dtd">
+
+<datasources>
+
+ <local-tx-datasource>
+ <jndi-name>integrationDatasource</jndi-name>
+ <connection-url>jdbc:hsqldb:.</connection-url>
+ <driver-class>org.hsqldb.jdbcDriver</driver-class>
+ <user-name>sa</user-name>
+ <password></password>
+ </local-tx-datasource>
+
+</datasources>
+
Added: branches/community/Seam_2_3/seam-integration-tests-ee6/src/test/resources/jbpm.cfg.xml
===================================================================
--- branches/community/Seam_2_3/seam-integration-tests-ee6/src/test/resources/jbpm.cfg.xml (rev 0)
+++ branches/community/Seam_2_3/seam-integration-tests-ee6/src/test/resources/jbpm.cfg.xml 2012-02-28 13:53:30 UTC (rev 14333)
@@ -0,0 +1,18 @@
+<jbpm-configuration>
+
+ <jbpm-context>
+ <service name="persistence">
+ <factory>
+ <bean class="org.jbpm.persistence.db.DbPersistenceServiceFactory">
+ <field name="isTransactionEnabled"><false/></field>
+ </bean>
+ </factory>
+ </service>
+ <service name="tx" factory="org.jbpm.tx.TxServiceFactory" />
+ <service name="message" factory="org.jbpm.msg.db.DbMessageServiceFactory" />
+ <service name="scheduler" factory="org.jbpm.scheduler.db.DbSchedulerServiceFactory" />
+ <service name="logging" factory="org.jbpm.logging.db.DbLoggingServiceFactory" />
+ <service name="authentication" factory="org.jbpm.security.authentication.DefaultAuthenticationServiceFactory" />
+ </jbpm-context>
+
+</jbpm-configuration>
Added: branches/community/Seam_2_3/seam-integration-tests-ee6/src/test/resources/messages_en.properties
===================================================================
--- branches/community/Seam_2_3/seam-integration-tests-ee6/src/test/resources/messages_en.properties (rev 0)
+++ branches/community/Seam_2_3/seam-integration-tests-ee6/src/test/resources/messages_en.properties 2012-02-28 13:53:30 UTC (rev 14333)
@@ -0,0 +1,116 @@
+up=\u2191
+down=\u2193
+left=\u2039
+right=\u203A
+
+validator.assertFalse=validation failed
+validator.assertTrue=validation failed
+validator.future=must be a future date
+validator.length=length must be between {min} and {max}
+validator.max=must be less than or equal to {value}
+validator.min=must be greater than or equal to {value}
+validator.notNull=may not be null
+validator.past=must be a past date
+validator.pattern=must match "{regex}"
+validator.range=must be between {min} and {max}
+validator.size=size must be between {min} and {max}
+validator.email=must be a well-formed email address
+
+org.jboss.seam.loginFailed=Login failed
+org.jboss.seam.loginSuccessful=Welcome, #0
+
+org.jboss.seam.TransactionFailed=Transaction failed
+org.jboss.seam.NoConversation=The conversation ended, timed out or was processing another request
+org.jboss.seam.IllegalNavigation=Illegal navigation
+org.jboss.seam.ProcessEnded=Process #0 already ended
+org.jboss.seam.ProcessNotFound=Process #0 not found
+org.jboss.seam.TaskEnded=Task #0 already ended
+org.jboss.seam.TaskNotFound=Task #0 not found
+org.jboss.seam.NotLoggedIn=Please log in first
+
+javax.faces.component.UIInput.CONVERSION=value could not be converted to the expected type
+javax.faces.component.UIInput.REQUIRED=value is required
+javax.faces.component.UIInput.UPDATE=an error occurred when processing your submitted information
+javax.faces.component.UISelectOne.INVALID=value is not valid
+javax.faces.component.UISelectMany.INVALID=value is not valid
+
+javax.faces.converter.BigDecimalConverter.DECIMAL=value must be a number
+javax.faces.converter.BigDecimalConverter.DECIMAL_detail=value must be a signed decimal number consisting of zero or more digits, optionally followed by a decimal point and fraction, eg. {1}
+javax.faces.converter.BigIntegerConverter.BIGINTEGER=value must be an integer
+javax.faces.converter.BigIntegerConverter.BIGINTEGER_detail=value must be a signed integer number consisting of zero or more digits
+javax.faces.converter.BooleanConverter.BOOLEAN=value must be true or false
+javax.faces.converter.BooleanConverter.BOOLEAN_detail=value must be true or false (any value other than true will evaluate to false)
+javax.faces.converter.ByteConverter.BYTE=value must be a number between 0 and 255
+javax.faces.converter.ByteConverter.BYTE_detail=value must be a number between 0 and 255
+javax.faces.converter.CharacterConverter.CHARACTER=value must be a character
+javax.faces.converter.CharacterConverter.CHARACTER_detail=value must be a valid ASCII character
+javax.faces.converter.DateTimeConverter.DATE=value must be a date
+javax.faces.converter.DateTimeConverter.DATE_detail=value must be a date, eg. {1}
+javax.faces.converter.DateTimeConverter.TIME=value must be a time
+javax.faces.converter.DateTimeConverter.TIME_detail=value must be a time, eg. {1}
+javax.faces.converter.DateTimeConverter.DATETIME=value must be a date and time
+javax.faces.converter.DateTimeConverter.DATETIME_detail=value must be a date and time, eg. {1}
+javax.faces.converter.DateTimeConverter.PATTERN_TYPE=a pattern or type attribute must be specified to convert the value
+javax.faces.converter.DoubleConverter.DOUBLE=value must be a number
+javax.faces.converter.DoubleConverter.DOUBLE_detail=value must be a number between 4.9E-324 and 1.7976931348623157E308
+javax.faces.converter.EnumConverter.ENUM=value must be convertible to an enum
+javax.faces.converter.EnumConverter.ENUM_detail=value must be convertible to an enum or from the enum that contains the constant {1}
+javax.faces.converter.EnumConverter.ENUM_NO_CLASS=value must be convertible to an enum or from the enum, but no enum class provided
+javax.faces.converter.EnumConverter.ENUM_NO_CLASS_detail=value must be convertible to an enum or from the enum, but no enum class provided
+javax.faces.converter.FloatConverter.FLOAT=value must be a number
+javax.faces.converter.FloatConverter.FLOAT_detail=value must be a number between 1.4E-45 and 3.4028235E38
+javax.faces.converter.IntegerConverter.INTEGER=value must be an integer
+javax.faces.converter.IntegerConverter.INTEGER_detail=value must be an integer number between -2147483648 and 2147483647
+javax.faces.converter.LongConverter.LONG=value must be an integer
+javax.faces.converter.LongConverter.LONG_detail=must be an integer number between -9223372036854775808 and 9223372036854775807
+javax.faces.converter.NumberConverter.CURRENCY=value must be a currency amount
+javax.faces.converter.NumberConverter.CURRENCY_detail=value must be a currency amount, eg. {1}
+javax.faces.converter.NumberConverter.PERCENT=value must be a percentage amount
+javax.faces.converter.NumberConverter.PERCENT_detail=value must be a percentage amount, eg. {1}
+javax.faces.converter.NumberConverter.NUMBER=value must be a number
+javax.faces.converter.NumberConverter.NUMBER_detail=value must be a number
+javax.faces.converter.NumberConverter.PATTERN=value must be a number
+javax.faces.converter.NumberConverter.PATTERN_detail=value must be a number
+javax.faces.converter.ShortConverter.SHORT=value must be an integer
+javax.faces.converter.ShortConverter.SHORT_detail=value must be an integer number between -32768 and 32767
+
+javax.faces.validator.DoubleRangeValidator.MAXIMUM=value must be less than or equal to {0}
+javax.faces.validator.DoubleRangeValidator.MINIMUM=value must be greater than or equal to {0}
+javax.faces.validator.DoubleRangeValidator.NOT_IN_RANGE=value must be between {0} and {1}
+javax.faces.validator.DoubleRangeValidator.TYPE=value is not of the correct type
+javax.faces.validator.LengthValidator.MAXIMUM=value is must be shorter than or equal to {0} characters
+javax.faces.validator.LengthValidator.MINIMUM=value is must be longer than or equal to {0} characters
+javax.faces.validator.LongRangeValidator.MAXIMUM=value must be less than or equal to {0}
+javax.faces.validator.LongRangeValidator.MINIMUM=value must be greater than or equal to {0}
+javax.faces.validator.LongRangeValidator.NOT_IN_RANGE=value must be between {0} and {1}
+javax.faces.validator.LongRangeValidator.TYPE=value is not of the correct type
+
+javax.faces.validator.NOT_IN_RANGE=value must be between {0} and {1}
+javax.faces.converter.STRING=value could not be converted to a string
+
+#JSF 1.1:
+javax.faces.convert.BigDecimalConverter.CONVERSION value must be a number
+javax.faces.convert.BigDecimalConverter.CONVERSION_detail value must be a number
+javax.faces.convert.BigIntegerConverter.CONVERSION value must be an integre
+javax.faces.convert.BigIntegerConverter.CONVERSION_detail value must be a number
+javax.faces.convert.BooleanConverter.CONVERSION value must be true or false
+javax.faces.convert.BooleanConverter.CONVERSION_detail value must be true or false
+javax.faces.convert.ByteConverter.CONVERSION value must be a byte
+javax.faces.convert.ByteConverter.CONVERSION_detail value must be a byte
+javax.faces.convert.CharacterConverter.CONVERSION value must be a character
+javax.faces.convert.CharacterConverter.CONVERSION_detail value must be a character
+javax.faces.convert.DateTimeConverter.CONVERSION value must be a datetime
+javax.faces.convert.DateTimeConverter.CONVERSION_detail value must be a datetime
+javax.faces.convert.DoubleConverter.CONVERSION value must be a number
+javax.faces.convert.DoubleConverter.CONVERSION_detail value must be a number
+javax.faces.convert.FloatConverter.CONVERSION value must be a number
+javax.faces.convert.FloatConverter.CONVERSION_detail value must be a number
+javax.faces.convert.IntegerConverter.CONVERSION value must be an integer
+javax.faces.convert.IntegerConverter.CONVERSION_detail value must be an integer
+javax.faces.convert.LongConverter.CONVERSION value must be an integer
+javax.faces.convert.LongConverter.CONVERSION_detail value must be a long integer
+javax.faces.convert.NumberConverter.CONVERSION value must be a number
+javax.faces.convert.NumberConverter.CONVERSION_detail value must be a number
+javax.faces.convert.ShortConverter.CONVERSION value must be an integer
+javax.faces.convert.ShortConverter.CONVERSION_detail value must be a short integer
+descriptionError=Less than \#{disc.name}
\ No newline at end of file
Added: branches/community/Seam_2_3/seam-integration-tests-ee6/src/test/resources/test-destinations-service.xml
===================================================================
--- branches/community/Seam_2_3/seam-integration-tests-ee6/src/test/resources/test-destinations-service.xml (rev 0)
+++ branches/community/Seam_2_3/seam-integration-tests-ee6/src/test/resources/test-destinations-service.xml 2012-02-28 13:53:30 UTC (rev 14333)
@@ -0,0 +1,17 @@
+<server>
+ <mbean code="org.jboss.mq.server.jmx.Topic"
+ name="jboss.mq.destination:service=Topic,name=testTopic">
+ <depends optional-attribute-name="ServerPeer">
+ jboss.messaging:service=ServerPeer
+ </depends>
+ <depends>jboss.messaging:service=PostOffice</depends>
+ </mbean>
+
+ <mbean code="org.jboss.mq.server.jmx.Queue"
+ name="jboss.mq.destination:service=Queue,name=testQueue">
+ <depends optional-attribute-name="ServerPeer">
+ jboss.messaging:service=ServerPeer
+ </depends>
+ <depends>jboss.messaging:service=PostOffice</depends>
+ </mbean>
+</server>
Added: branches/community/Seam_2_3/seam-integration-tests-ee6/src/test/resources/testProcess1.jpdl.xml
===================================================================
--- branches/community/Seam_2_3/seam-integration-tests-ee6/src/test/resources/testProcess1.jpdl.xml (rev 0)
+++ branches/community/Seam_2_3/seam-integration-tests-ee6/src/test/resources/testProcess1.jpdl.xml 2012-02-28 13:53:30 UTC (rev 14333)
@@ -0,0 +1,12 @@
+<process-definition name="TestProcess1"
+ xmlns="urn:jbpm.org:jpdl-3.2"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="urn:jbpm.org:jpdl-3.2 http://jbpm.org/xsd/jpdl-3.2.xsd">
+
+ <start-state name="start">
+ <transition to="done"/>
+ </start-state>
+
+ <end-state name="done"/>
+
+</process-definition>
Added: branches/community/Seam_2_3/seam-integration-tests-ee6/src/test/resources/testProcess2.jpdl.xml
===================================================================
--- branches/community/Seam_2_3/seam-integration-tests-ee6/src/test/resources/testProcess2.jpdl.xml (rev 0)
+++ branches/community/Seam_2_3/seam-integration-tests-ee6/src/test/resources/testProcess2.jpdl.xml 2012-02-28 13:53:30 UTC (rev 14333)
@@ -0,0 +1,17 @@
+<process-definition name="TestProcess2"
+ xmlns="urn:jbpm.org:jpdl-3.2"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="urn:jbpm.org:jpdl-3.2 http://jbpm.org/xsd/jpdl-3.2.xsd">
+
+ <start-state name="start">
+ <transition to="decision" />
+ </start-state>
+
+ <decision name="decision" expression="#{seamExpressionEvaluatorTestController.name eq 'foo'}">
+ <transition to="done" name="true" />
+ <transition to="done" name="false" />
+ </decision>
+
+ <end-state name="done"/>
+
+</process-definition>
Added: branches/community/Seam_2_3/seam-integration-tests-ee6/src/test/resources/testProcess3.jpdl.xml
===================================================================
--- branches/community/Seam_2_3/seam-integration-tests-ee6/src/test/resources/testProcess3.jpdl.xml (rev 0)
+++ branches/community/Seam_2_3/seam-integration-tests-ee6/src/test/resources/testProcess3.jpdl.xml 2012-02-28 13:53:30 UTC (rev 14333)
@@ -0,0 +1,14 @@
+<process-definition name="TestProcess3"
+ xmlns="urn:jbpm.org:jpdl-3.2"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="urn:jbpm.org:jpdl-3.2 http://jbpm.org/xsd/jpdl-3.2.xsd">
+
+ <start-state name="start">
+ <transition to="done">
+ <action expression="#{seamExpressionEvaluatorTestController.nonExistentMethod}" />
+ </transition>
+ </start-state>
+
+ <end-state name="done"/>
+
+</process-definition>
Added: branches/community/Seam_2_3/seam-integration-tests-ee6/src/test/resources/testProcess4.jpdl.xml
===================================================================
--- branches/community/Seam_2_3/seam-integration-tests-ee6/src/test/resources/testProcess4.jpdl.xml (rev 0)
+++ branches/community/Seam_2_3/seam-integration-tests-ee6/src/test/resources/testProcess4.jpdl.xml 2012-02-28 13:53:30 UTC (rev 14333)
@@ -0,0 +1,19 @@
+<process-definition name="TestProcess4"
+ xmlns="urn:jbpm.org:jpdl-3.2"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="urn:jbpm.org:jpdl-3.2 http://jbpm.org/xsd/jpdl-3.2.xsd">
+
+ <start-state name="start">
+ <transition to="decision" />
+ </start-state>
+
+ <decision name="decision" expression="#{testBoolean}">
+ <transition to="done" name="true">
+ <action expression="#{seamExpressionEvaluatorTestController.logTrue}" />
+ </transition>
+ <transition to="done" name="false" />
+ </decision>
+
+ <end-state name="done"/>
+
+</process-definition>
Added: branches/community/Seam_2_3/seam-integration-tests-ee6/src/test/resources-jbossas-7/arquillian.xml
===================================================================
--- branches/community/Seam_2_3/seam-integration-tests-ee6/src/test/resources-jbossas-7/arquillian.xml (rev 0)
+++ branches/community/Seam_2_3/seam-integration-tests-ee6/src/test/resources-jbossas-7/arquillian.xml 2012-02-28 13:53:30 UTC (rev 14333)
@@ -0,0 +1,17 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<arquillian xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xmlns="http://jboss.org/schema/arquillian"
+ xsi:schemaLocation="http://jboss.org/schema/arquillian http://jboss.org/schema/arquillian/arquillian_1_0.xsd">
+
+ <engine>
+ <property name="deploymentExportPath">target/</property>
+ </engine>
+
+ <container qualifier="jboss" default="true">
+ <configuration>
+ <property name="javaVmArguments">-Xmx1024m -XX:MaxPermSize=512m</property>
+ <property name="jbossHome">target/jboss-as-${version.jbossas7}</property>
+ </configuration>
+ </container>
+
+</arquillian>
12 years, 10 months