[seam-commits] Seam SVN: r15541 - in branches/enterprise/WFK-2_1: examples/quartz/quartz-ear and 20 other directories.

seam-commits at lists.jboss.org seam-commits at lists.jboss.org
Tue Jun 4 05:25:37 EDT 2013


Author: tremes
Date: 2013-06-04 05:25:36 -0400 (Tue, 04 Jun 2013)
New Revision: 15541

Added:
   branches/enterprise/WFK-2_1/examples/quartz/quartz-ejb/src/test/
   branches/enterprise/WFK-2_1/examples/quartz/quartz-ejb/src/test/java/
   branches/enterprise/WFK-2_1/examples/quartz/quartz-ejb/src/test/java/org/
   branches/enterprise/WFK-2_1/examples/quartz/quartz-ejb/src/test/java/org/jboss/
   branches/enterprise/WFK-2_1/examples/quartz/quartz-ejb/src/test/java/org/jboss/seam/
   branches/enterprise/WFK-2_1/examples/quartz/quartz-ejb/src/test/java/org/jboss/seam/example/
   branches/enterprise/WFK-2_1/examples/quartz/quartz-ejb/src/test/java/org/jboss/seam/example/quartz/
   branches/enterprise/WFK-2_1/examples/quartz/quartz-ejb/src/test/java/org/jboss/seam/example/quartz/test/
   branches/enterprise/WFK-2_1/examples/quartz/quartz-ejb/src/test/java/org/jboss/seam/example/quartz/test/AccountTest.java
   branches/enterprise/WFK-2_1/examples/quartz/quartz-ejb/src/test/java/org/jboss/seam/example/quartz/test/AsynchronousTest.java
   branches/enterprise/WFK-2_1/examples/quartz/quartz-ejb/src/test/java/org/jboss/seam/example/quartz/test/CronTest.java
   branches/enterprise/WFK-2_1/examples/quartz/quartz-ejb/src/test/java/org/jboss/seam/example/quartz/test/Deployments.java
   branches/enterprise/WFK-2_1/examples/quartz/quartz-ejb/src/test/java/org/jboss/seam/example/quartz/test/EventsTest.java
   branches/enterprise/WFK-2_1/examples/quartz/quartz-ejb/src/test/java/org/jboss/seam/example/quartz/test/OnceTest.java
   branches/enterprise/WFK-2_1/examples/quartz/quartz-ejb/src/test/java/org/jboss/seam/example/quartz/test/RepeatingTest.java
   branches/enterprise/WFK-2_1/examples/quartz/quartz-ejb/src/test/java/org/jboss/seam/example/quartz/test/TestPaymentController.java
   branches/enterprise/WFK-2_1/examples/quartz/quartz-ejb/src/test/java/org/jboss/seam/example/quartz/test/TestPaymentProcessor.java
   branches/enterprise/WFK-2_1/examples/quartz/quartz-ejb/src/test/java/org/jboss/seam/example/quartz/test/TransactionStatus.java
   branches/enterprise/WFK-2_1/examples/quartz/quartz-ejb/src/test/resources/
   branches/enterprise/WFK-2_1/examples/quartz/quartz-ejb/src/test/resources/BaseData.xml
   branches/enterprise/WFK-2_1/examples/quartz/quartz-ejb/src/test/resources/arquillian.xml
   branches/enterprise/WFK-2_1/examples/quartz/quartz-ejb/src/test/resources/components.xml
   branches/enterprise/WFK-2_1/examples/quartz/quartz-ejb/src/test/resources/ejb-jar.xml
   branches/enterprise/WFK-2_1/examples/quartz/quartz-ejb/src/test/resources/import.sql
   branches/enterprise/WFK-2_1/examples/quartz/quartz-ejb/src/test/resources/index.html
   branches/enterprise/WFK-2_1/examples/quartz/quartz-ejb/src/test/resources/jboss-deployment-structure.xml
   branches/enterprise/WFK-2_1/examples/quartz/quartz-ejb/src/test/resources/pages.xml
   branches/enterprise/WFK-2_1/examples/quartz/quartz-ejb/src/test/resources/persistence.xml
   branches/enterprise/WFK-2_1/examples/quartz/quartz-ejb/src/test/resources/seam.properties
   branches/enterprise/WFK-2_1/examples/quartz/quartz-ejb/src/test/resources/seam.quartz.properties
   branches/enterprise/WFK-2_1/examples/quartz/quartz-ejb/src/test/resources/search.xhtml
   branches/enterprise/WFK-2_1/examples/quartz/quartz-ejb/src/test/resources/web.xml
Removed:
   branches/enterprise/WFK-2_1/examples/quartz/quartz-tests/pom.xml
   branches/enterprise/WFK-2_1/examples/quartz/quartz-tests/src/test/java/org/jboss/seam/example/quartz/test/AccountTest.java
   branches/enterprise/WFK-2_1/examples/quartz/quartz-tests/src/test/java/org/jboss/seam/example/quartz/test/AsynchronousTest.java
   branches/enterprise/WFK-2_1/examples/quartz/quartz-tests/src/test/java/org/jboss/seam/example/quartz/test/CronTest.java
   branches/enterprise/WFK-2_1/examples/quartz/quartz-tests/src/test/java/org/jboss/seam/example/quartz/test/Deployments.java
   branches/enterprise/WFK-2_1/examples/quartz/quartz-tests/src/test/java/org/jboss/seam/example/quartz/test/EventsTest.java
   branches/enterprise/WFK-2_1/examples/quartz/quartz-tests/src/test/java/org/jboss/seam/example/quartz/test/OnceTest.java
   branches/enterprise/WFK-2_1/examples/quartz/quartz-tests/src/test/java/org/jboss/seam/example/quartz/test/RepeatingTest.java
   branches/enterprise/WFK-2_1/examples/quartz/quartz-tests/src/test/java/org/jboss/seam/example/quartz/test/TestPaymentController.java
   branches/enterprise/WFK-2_1/examples/quartz/quartz-tests/src/test/java/org/jboss/seam/example/quartz/test/TestPaymentProcessor.java
   branches/enterprise/WFK-2_1/examples/quartz/quartz-tests/src/test/java/org/jboss/seam/example/quartz/test/TransactionStatus.java
   branches/enterprise/WFK-2_1/examples/quartz/quartz-tests/src/test/java/org/jboss/seam/example/quartz/test/selenium/QuartzPaymentTest.java
   branches/enterprise/WFK-2_1/examples/quartz/quartz-tests/src/test/resources-ftest/testng.xml
   branches/enterprise/WFK-2_1/examples/quartz/quartz-tests/src/test/resources-integration/arquillian.xml
   branches/enterprise/WFK-2_1/examples/quartz/quartz-tests/src/test/resources-integration/web.xml
   branches/enterprise/WFK-2_1/examples/quartz/quartz-tests/src/test/resources/BaseData.xml
   branches/enterprise/WFK-2_1/examples/quartz/quartz-tests/src/test/resources/WEB-INF/components.xml
   branches/enterprise/WFK-2_1/examples/quartz/quartz-tests/src/test/resources/quartz.properties
   branches/enterprise/WFK-2_1/examples/quartz/quartz-tests/src/test/resources/seam.quartz.properties
Modified:
   branches/enterprise/WFK-2_1/examples/quartz/pom.xml
   branches/enterprise/WFK-2_1/examples/quartz/quartz-ear/pom.xml
   branches/enterprise/WFK-2_1/examples/quartz/quartz-ejb/pom.xml
   branches/enterprise/WFK-2_1/examples/quartz/quartz-web/pom.xml
   branches/enterprise/WFK-2_1/jboss-seam/src/main/java/org/jboss/seam/mock/ResourceRequestEnvironment.java
Log:
Quartz example migrated

Modified: branches/enterprise/WFK-2_1/examples/quartz/pom.xml
===================================================================
--- branches/enterprise/WFK-2_1/examples/quartz/pom.xml	2013-06-04 07:13:54 UTC (rev 15540)
+++ branches/enterprise/WFK-2_1/examples/quartz/pom.xml	2013-06-04 09:25:36 UTC (rev 15541)
@@ -3,25 +3,44 @@
     <modelVersion>4.0.0</modelVersion>
     <groupId>org.jboss.seam.examples</groupId>
     <artifactId>quartz</artifactId>
-    <parent>
-        <groupId>org.jboss.seam</groupId>
-        <artifactId>examples</artifactId>
-        <version>2.3.1.Final-redhat-2</version>
-    </parent>
+    <version>2.3.1.Final-redhat-2</version>
     <packaging>pom</packaging>
     <name>Quartz Example (EE6)</name>
     
-    <properties>
-        <example.name>quartz</example.name>
-    </properties>
-    
     <modules>
         <module>quartz-ear</module>
         <module>quartz-ejb</module>
         <module>quartz-web</module>
-        <module>quartz-tests</module>
     </modules>
     
+    <properties>
+		<example.name>quartz</example.name>
+		<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
+		<maven.compiler.target>1.6</maven.compiler.target>
+		<maven.compiler.source>1.6</maven.compiler.source>
+
+		<!-- To use jacoco, set jacoco.agent system property to something like 
+			-javaagent:/path/to/jacocoagent.jar=append=true,destfile=/path/to/output/jacoco.exec -->
+		<jacoco.agent />
+
+		<!-- To use custom Maven settings and profiles, uncomment and customize 
+			the following properties. This is necessary for the ShrinkWrap resolver to 
+			function properly. -->
+		<!--<maven.user.settings>/path/to/custom/settings.xml</maven.user.settings> -->
+		<!--<maven.profiles>custom,profile</maven.profiles> -->
+
+		<version.commons.logging>1.1.1</version.commons.logging>
+		<version.shrinkwrap.resolver>2.0.0-beta-4</version.shrinkwrap.resolver>
+
+		<!-- Plugin versions -->
+		<version.dependency.plugin>2.5.1</version.dependency.plugin>
+		<version.surefire.plugin>2.10</version.surefire.plugin>
+		<version.compiler.plugin>2.3.1</version.compiler.plugin>
+		<version.ear.plugin>2.6</version.ear.plugin>
+		<version.war.plugin>2.1.1</version.war.plugin>
+		<version.jboss.maven.plugin>7.4.Final</version.jboss.maven.plugin>
+	</properties>
+    
     <dependencyManagement>
         <dependencies>
             <dependency>
@@ -30,17 +49,78 @@
                 <version>${project.version}</version>
                 <type>ejb</type>
             </dependency>
+            
             <dependency>
                 <groupId>org.jboss.seam.examples.quartz</groupId>
                 <artifactId>quartz-web</artifactId>
                 <version>${project.version}</version>
                 <type>war</type>
             </dependency>
+            
             <dependency>
                 <groupId>org.jboss.seam.examples.quartz</groupId>
                 <artifactId>quartz-ear</artifactId>
                 <version>${project.version}</version>
             </dependency>
+            
+            <!-- BOMs -->
+			<dependency>
+				<groupId>org.jboss.shrinkwrap.resolver</groupId>
+				<artifactId>shrinkwrap-resolver-bom</artifactId>
+				<version>${version.shrinkwrap.resolver}</version>
+				<scope>import</scope>
+				<type>pom</type>
+			</dependency>
+
+			<dependency>
+				<groupId>org.jboss.seam</groupId>
+				<artifactId>bom</artifactId>
+				<version>${project.version}</version>
+				<type>pom</type>
+				<scope>import</scope>
+			</dependency>
+
+			<dependency>
+				<groupId>org.jboss.seam</groupId>
+				<artifactId>jboss-seam</artifactId>
+				<version>${project.version}</version>
+				<exclusions>
+					<exclusion>
+						<groupId>org.testng</groupId>
+						<artifactId>testng</artifactId>
+					</exclusion>
+				</exclusions>
+			</dependency>
         </dependencies>
     </dependencyManagement>
+    
+    <build>
+		<pluginManagement>
+			<plugins>
+				<!-- Manage plugin versions for build stability -->
+				<plugin>
+					<artifactId>maven-surefire-plugin</artifactId>
+					<version>${version.surefire.plugin}</version>
+					<configuration>
+						<systemPropertyVariables>
+							<org.apache.maven.user-settings>${maven.user.settings}</org.apache.maven.user-settings>
+							<maven.profiles>${maven.profiles}</maven.profiles>
+						</systemPropertyVariables>
+					</configuration>
+				</plugin>
+				<plugin>
+					<artifactId>maven-dependency-plugin</artifactId>
+					<version>${version.dependency.plugin}</version>
+				</plugin>
+				<plugin>
+					<artifactId>maven-compiler-plugin</artifactId>
+					<version>${version.compiler.plugin}</version>
+					<configuration>
+						<source>${maven.compiler.source}</source>
+						<target>${maven.compiler.target}</target>
+					</configuration>
+				</plugin>
+			</plugins>
+		</pluginManagement>
+	</build>
 </project>

Modified: branches/enterprise/WFK-2_1/examples/quartz/quartz-ear/pom.xml
===================================================================
--- branches/enterprise/WFK-2_1/examples/quartz/quartz-ear/pom.xml	2013-06-04 07:13:54 UTC (rev 15540)
+++ branches/enterprise/WFK-2_1/examples/quartz/quartz-ear/pom.xml	2013-06-04 09:25:36 UTC (rev 15541)
@@ -1,4 +1,4 @@
-<?xml version="1.0" encoding="UTF-8"?>
+:<?xml version="1.0" encoding="UTF-8"?>
 <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/maven-v4_0_0.xsd">
     <modelVersion>4.0.0</modelVersion>
     <parent>
@@ -52,6 +52,7 @@
             <plugin>
                 <groupId>org.apache.maven.plugins</groupId>
                 <artifactId>maven-ear-plugin</artifactId>
+                <version>${version.ear.plugin}</version>
                 <configuration>
                     <version>6</version>
                     <defaultLibBundleDir>lib</defaultLibBundleDir>

Modified: branches/enterprise/WFK-2_1/examples/quartz/quartz-ejb/pom.xml
===================================================================
--- branches/enterprise/WFK-2_1/examples/quartz/quartz-ejb/pom.xml	2013-06-04 07:13:54 UTC (rev 15540)
+++ branches/enterprise/WFK-2_1/examples/quartz/quartz-ejb/pom.xml	2013-06-04 09:25:36 UTC (rev 15541)
@@ -71,6 +71,130 @@
             <groupId>org.opensymphony.quartz</groupId>
             <artifactId>quartz</artifactId>
         </dependency>
+        
+        <!-- Test dependencies -->
+		<dependency>
+			<groupId>org.jboss.shrinkwrap.resolver</groupId>
+			<artifactId>shrinkwrap-resolver-depchain</artifactId>
+			<type>pom</type>
+			<scope>test</scope>
+		</dependency>
+
+		<dependency>
+			<groupId>junit</groupId>
+			<artifactId>junit</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.dbunit</groupId>
+            <artifactId>dbunit</artifactId>
+            <scope>test</scope>
+        </dependency>
+        
+         <dependency>
+            <groupId>org.jboss.spec.javax.el</groupId>
+            <artifactId>jboss-el-api_2.2_spec</artifactId>
+            <scope>test</scope>
+        </dependency>
+        
+        <dependency>
+				<groupId>commons-logging</groupId>
+				<artifactId>commons-logging</artifactId>
+				<version>${version.commons.logging}</version>
+				<scope>test</scope>
+			</dependency>
     </dependencies>
+    
+    <profiles>
+		<profile>
+			<id>integration-tests</id>
+			<activation>
+				<property>
+					<name>arquillian</name>
+				</property>
+			</activation>
+			<properties>
+				<jndiPattern>java:app/seam-quartz/#{ejbName}</jndiPattern>
+				<distributable>false</distributable>
+			</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>
+							<skip>false</skip>
+						</configuration>
+					</plugin>
+				</plugins>
+			</build>
+		</profile>
+
+		<profile>
+			<id>arq-jbossas-7-managed</id>
+			<activation>
+				<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>
+					<scope>test</scope>
+				</dependency>
+			</dependencies>
+		</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>
+					<scope>test</scope>
+				</dependency>
+			</dependencies>
+		</profile>
+	</profiles>
+
+	<build>
+		<plugins>
+			<!-- Skip tests by default -->
+			<plugin>
+				<groupId>org.apache.maven.plugins</groupId>
+				<artifactId>maven-surefire-plugin</artifactId>
+				<configuration>
+					<skip>true</skip>
+				</configuration>
+			</plugin>
+		</plugins>
+	</build>
    
 </project>

Copied: branches/enterprise/WFK-2_1/examples/quartz/quartz-ejb/src/test/java/org/jboss/seam/example/quartz/test/AccountTest.java (from rev 15540, branches/enterprise/WFK-2_1/examples/quartz/quartz-tests/src/test/java/org/jboss/seam/example/quartz/test/AccountTest.java)
===================================================================
--- branches/enterprise/WFK-2_1/examples/quartz/quartz-ejb/src/test/java/org/jboss/seam/example/quartz/test/AccountTest.java	                        (rev 0)
+++ branches/enterprise/WFK-2_1/examples/quartz/quartz-ejb/src/test/java/org/jboss/seam/example/quartz/test/AccountTest.java	2013-06-04 09:25:36 UTC (rev 15541)
@@ -0,0 +1,105 @@
+package org.jboss.seam.example.quartz.test;
+
+import java.util.List;
+
+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.example.quartz.Account;
+import org.jboss.seam.example.quartz.Payment;
+import org.jboss.seam.mock.DBJUnitSeamTest;
+import org.jboss.shrinkwrap.api.Archive;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+
+/**
+ * 
+ * @author Pete Muir
+ *
+ */
+ at RunWith(Arquillian.class)
+public class AccountTest 
+    extends DBJUnitSeamTest 
+{
+    @Deployment(name="AccountTest")
+    @OverProtocol("Servlet 3.0")
+    public static Archive<?> createDeployment()
+    {
+        return Deployments.quartzDeployment();
+    }
+    
+    @Override
+    protected void prepareDBUnitOperations() {
+       
+        setDatabase("HSQL");
+        setDatasourceJndiName("java:jboss/datasources/ExampleDS");
+       
+        beforeTestOperations.add(
+                new DataSetOperation("BaseData.xml")
+        );
+    }
+    
+    @Test
+    public void listAccounts() throws Exception 
+    {
+        new FacesRequest("/search.xhtml") 
+        {
+            
+            @Override
+            @SuppressWarnings("unchecked")
+            protected void renderResponse() throws Exception 
+            {
+                List<Account> accounts = (List<Account>) getValue("#{accounts.resultList}");
+                
+                assert accounts.size() == 5;
+            }
+            
+        }.run(); 
+    }
+    
+    @Test
+    public void selectAccount() throws Exception 
+    {        
+        String id = new FacesRequest("/search.xhtml") 
+        {        
+        
+            @Override
+            @SuppressWarnings("unchecked")
+            protected void renderResponse() throws Exception 
+            {
+                assert !((Boolean)getValue("#{accountHome.idDefined}"));
+            }          
+        }.run();
+        
+        new FacesRequest("/search.xhtml", id) 
+        {
+            
+            @Override
+            protected void beforeRequest() 
+            {
+                setParameter("accountId", "1");
+            }
+
+            @Override
+            protected void renderResponse() throws Exception 
+            {
+                assert ((Boolean) getValue("#{accountHome.idDefined}"));
+                
+                Account account = (Account) getValue("#{selectedAccount}");
+                assert account !=null;
+                assert account.getId() == 1;
+                assert account.getPayments().size() == 0;
+               
+                Payment payment = (Payment) getValue("#{newPayment}");
+                assert payment.getPayee().equals("Somebody");
+                assert payment.getAccount() != null;
+                assert payment.getAccount().getId() == 1;
+                
+            }            
+        }.run();
+        
+        
+        
+    }
+    
+}

Copied: branches/enterprise/WFK-2_1/examples/quartz/quartz-ejb/src/test/java/org/jboss/seam/example/quartz/test/AsynchronousTest.java (from rev 15540, branches/enterprise/WFK-2_1/examples/quartz/quartz-tests/src/test/java/org/jboss/seam/example/quartz/test/AsynchronousTest.java)
===================================================================
--- branches/enterprise/WFK-2_1/examples/quartz/quartz-ejb/src/test/java/org/jboss/seam/example/quartz/test/AsynchronousTest.java	                        (rev 0)
+++ branches/enterprise/WFK-2_1/examples/quartz/quartz-ejb/src/test/java/org/jboss/seam/example/quartz/test/AsynchronousTest.java	2013-06-04 09:25:36 UTC (rev 15541)
@@ -0,0 +1,125 @@
+package org.jboss.seam.example.quartz.test;
+
+import static org.jboss.seam.example.quartz.Payment.Frequency.ONCE;
+
+import java.math.BigDecimal;
+
+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.example.quartz.Account;
+import org.jboss.seam.example.quartz.Payment;
+import org.jboss.seam.mock.DBJUnitSeamTest;
+import org.jboss.shrinkwrap.api.Archive;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+
+/**
+ * 
+ * @author Pete Muir
+ *
+ */
+
+// Actually this doesn't happen in the example, but lets test it here to keep
+// all quartz tests in one place
+ at RunWith(Arquillian.class)
+public class AsynchronousTest extends DBJUnitSeamTest 
+{
+    @Deployment(name="AsynchronousTest")
+    @OverProtocol("Servlet 3.0")
+    public static Archive<?> createDeployment()
+    {
+        return Deployments.quartzDeployment();
+    }
+    
+    @Override
+    protected void prepareDBUnitOperations() {
+       
+        setDatabase("HSQL");
+        setDatasourceJndiName("java:jboss/datasources/ExampleDS");
+       
+        beforeTestOperations.add(
+                new DataSetOperation("BaseData.xml")
+        );
+    }
+      
+    @Test
+    public void testAsynchronous() throws Exception
+    {
+            String id = new FacesRequest("/search.xhtml") 
+            {
+                @Override
+                protected void beforeRequest() 
+                {
+                    setParameter("accountId", "1");
+                }
+                
+                @Override
+                protected void updateModelValues() throws Exception 
+                {
+                    setValue("#{newPayment.payee}", "IRS"); 
+                    setValue("#{newPayment.amount}", new BigDecimal("100.00"));
+                    setValue("#{newPayment.paymentFrequency}", ONCE);
+                }
+    
+                @Override
+                protected void invokeApplication() throws Exception 
+                {
+                    invokeMethod("#{paymentHome.scheduleAndSaveAsynchronously}");
+                }
+    
+                @Override
+                protected void renderResponse() throws Exception 
+                {
+                    assert ((Boolean)getValue("#{accountHome.idDefined}"));                
+                    Account account = (Account) getValue("#{selectedAccount}");                
+                    assert account !=null;
+                    assert account.getId() == 1;
+                    assert account.getPayments().size() == 1;               
+                }
+                
+            }.run();
+            
+            // Wait, let quartz execute the async method which schedules the job
+            // for immediate execution
+            pause(50);
+            
+            new FacesRequest("/search.xhtml", id)
+            {
+    
+                @Override
+                protected void beforeRequest() 
+                {
+                    setParameter("accountId", "1");
+                }
+                
+                @Override
+                protected void renderResponse() throws Exception
+                {
+                    assert ((Boolean)getValue("#{accountHome.idDefined}"));                
+                    Account account = (Account) getValue("#{selectedAccount}");                
+                    assert account !=null;
+                    assert account.getId() == 1;
+                    assert account.getPayments().size() == 1;
+                    Payment payment = account.getPayments().get(0);
+                    assert new BigDecimal("100.00").equals(payment.getAmount());
+                    //assert !payment.getActive();
+                    //assert payment.getLastPaid() != null;
+                    assert new BigDecimal("901.46").equals(account.getBalance());
+                }
+                
+            }.run();
+    }
+
+    
+    private void pause(long ms) {
+        try {
+            Thread.sleep(ms);
+        } catch (InterruptedException e) {
+            
+        }                
+    }
+
+    
+    
+}

Copied: branches/enterprise/WFK-2_1/examples/quartz/quartz-ejb/src/test/java/org/jboss/seam/example/quartz/test/CronTest.java (from rev 15540, branches/enterprise/WFK-2_1/examples/quartz/quartz-tests/src/test/java/org/jboss/seam/example/quartz/test/CronTest.java)
===================================================================
--- branches/enterprise/WFK-2_1/examples/quartz/quartz-ejb/src/test/java/org/jboss/seam/example/quartz/test/CronTest.java	                        (rev 0)
+++ branches/enterprise/WFK-2_1/examples/quartz/quartz-ejb/src/test/java/org/jboss/seam/example/quartz/test/CronTest.java	2013-06-04 09:25:36 UTC (rev 15541)
@@ -0,0 +1,462 @@
+package org.jboss.seam.example.quartz.test;
+
+import static org.jboss.seam.example.quartz.Payment.Frequency.EVERY_SECOND;
+
+import java.math.BigDecimal;
+
+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.async.QuartzTriggerHandle;
+import org.jboss.seam.example.quartz.Account;
+import org.jboss.seam.example.quartz.Payment;
+import org.jboss.seam.example.quartz.Payment.Frequency;
+import org.jboss.seam.mock.DBJUnitSeamTest;
+import org.jboss.shrinkwrap.api.Archive;
+import org.junit.Ignore;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+
+/**
+ * @author Pete Muir
+ * 
+ */
+ at RunWith(Arquillian.class)
+public class CronTest  extends DBJUnitSeamTest 
+{
+    private QuartzTriggerHandle quartzTriggerHandle;
+    private Long paymentId;
+    
+    private static final Frequency REPEATING = EVERY_SECOND;
+
+    @Deployment(name="CronTest")
+    @OverProtocol("Servlet 3.0")
+    public static Archive<?> createDeployment()
+    {
+        return Deployments.quartzDeployment();
+    }
+    
+    @Override
+    protected void prepareDBUnitOperations() {
+        setDatabase("HSQL");
+        setDatasourceJndiName("java:jboss/datasources/ExampleDS");
+        
+        beforeTestOperations.add(
+                new DataSetOperation("BaseData.xml")
+        );
+    }
+
+    
+    
+    
+    @Ignore
+    @Test
+    public void scheduleCron() throws Exception
+    {
+                        
+        try
+        {
+            String id = new FacesRequest("/search.xhtml") 
+            {
+                @Override
+                protected void beforeRequest() 
+                {
+                    setParameter("accountId", "1");
+                }
+                
+                @Override
+                protected void updateModelValues() throws Exception 
+                {
+                    setValue("#{newPayment.payee}", "IRS"); 
+                    setValue("#{newPayment.amount}", new BigDecimal("110.00"));
+                    setValue("#{newPayment.paymentCron}", "*/2 * * * * ?" );
+                }
+                
+                @Override
+                protected void invokeApplication() throws Exception 
+                {
+                    // schedule a the repeating job and immediately pause it
+                    // this allows you to carefully control how long the timer
+                    // runs for
+                    assert "persisted".equals(invokeMethod("#{paymentHome.saveAndScheduleCron}"));
+                    Payment payment = (Payment) getValue("#{newPayment}");
+                    quartzTriggerHandle = payment.getQuartzTriggerHandle();
+                    quartzTriggerHandle.pause();
+                }
+    
+                @Override
+                protected void renderResponse() throws Exception 
+                {
+                    // Check the job exists
+                    assert ((Boolean)getValue("#{accountHome.idDefined}"));                
+                    Account account = (Account) getValue("#{selectedAccount}");                
+                    assert account !=null;
+                    assert account.getId() == 1;
+                    assert account.getPayments().size() == 1;            
+                    
+                    Payment payment = (Payment) getValue("#{newPayment}");
+                    assert payment.getPayee().equals("IRS");
+                    assert payment.getAmount().equals(new BigDecimal("110.00"));
+                    assert payment.getAccount() != null;
+                    assert payment.getAccount().getId() == 1;
+                    assert payment.getActive();
+                }
+                
+            }.run();
+            
+            // Start the triggerHandle, wait a lot shorter than the job takes
+            // At this point the job should have executed once exactly
+            quartzTriggerHandle.resume();
+            pause((long) (REPEATING.getInterval() * 0.5));
+            quartzTriggerHandle.pause();
+            
+            new FacesRequest("/search.xhtml", id)
+            {
+    
+                @Override
+                protected void beforeRequest() 
+                {
+                    setParameter("accountId", "1");
+                }
+                
+                @Override
+                protected void renderResponse() throws Exception
+                {
+                    assert ((Boolean)getValue("#{accountHome.idDefined}"));                
+                    Account account = (Account) getValue("#{selectedAccount}");                
+                    assert account !=null;
+                    assert account.getId() == 1;
+                    assert account.getPayments().size() == 1;
+                    Payment payment = account.getPayments().get(0);
+                    assert new BigDecimal("110.00").equals(payment.getAmount());
+                    assert payment.getActive();
+                    assert "*/2 * * * * ?".equals(payment.getPaymentCron());
+                    
+                    assert new BigDecimal("891.46").equals(account.getBalance());
+                }
+                
+            }.run();
+            
+            // Start the triggerHandle, wait until some short time after the 
+            // job triggers once
+            quartzTriggerHandle.resume();
+            pause(2000l);
+            quartzTriggerHandle.pause();
+            
+            
+            new FacesRequest("/search.xhtml", id)
+            {
+    
+                @Override
+                protected void beforeRequest() 
+                {
+                    setParameter("accountId", "1");
+                }
+                
+                @Override
+                protected void renderResponse() throws Exception
+                {
+
+                    // Job should have run twice
+                    assert ((Boolean)getValue("#{accountHome.idDefined}"));                
+                    Account account = (Account) getValue("#{selectedAccount}");
+
+                    assert account !=null;
+                    assert account.getId() == 1;
+                    assert account.getPayments().size() == 1;
+                    Payment payment = account.getPayments().get(0);
+                    assert new BigDecimal("110.00").equals(payment.getAmount());
+                    assert payment.getActive();
+                    assert "*/2 * * * * ?".equals(payment.getPaymentCron());
+                    assert payment.getLastPaid() != null;
+                    assert new BigDecimal("781.46").equals(account.getBalance());
+                    paymentId = payment.getId();
+                }
+                
+            }.run();
+            
+            new FacesRequest("/search.xhtml", id)
+            {
+    
+                @Override
+                protected void beforeRequest() 
+                {
+                    setParameter("accountId", "1");
+                    setParameter("paymentId", paymentId.toString());
+                }
+                
+                @Override
+                protected void invokeApplication() throws Exception
+                {
+                    // Resume the job, then cancel it
+                    quartzTriggerHandle.resume();
+                    invokeMethod("#{paymentHome.cancel}");
+                }
+                
+                @Override
+                protected void renderResponse() throws Exception
+                {
+
+                    assert ((Boolean)getValue("#{accountHome.idDefined}"));                
+                    Account account = (Account) getValue("#{selectedAccount}");
+
+                    assert account !=null;
+                    assert account.getId() == 1;
+                    assert account.getPayments().size() == 1;
+                    Payment payment = account.getPayments().get(0);
+                    assert new BigDecimal("110.00").equals(payment.getAmount());
+                    assert !payment.getActive();
+                    assert payment.getLastPaid() != null;
+                    assert new BigDecimal("781.46").equals(account.getBalance());
+                }
+                
+            }.run();
+            
+            // Wait until some short time after another execution would
+            // have occurred to check it really stops
+            pause(2000l);
+            
+            new FacesRequest("/search.xhtml", id)
+            {
+    
+                @Override
+                protected void beforeRequest() 
+                {
+                    setParameter("accountId", "1");
+                }
+                
+                @Override
+                protected void renderResponse() throws Exception
+                {
+
+                    assert ((Boolean)getValue("#{accountHome.idDefined}"));                
+                    Account account = (Account) getValue("#{selectedAccount}");
+
+                    assert account !=null;
+                    assert account.getId() == 1;
+                    assert new BigDecimal("781.46").equals(account.getBalance());
+                }
+                
+            }.run();
+            
+        }
+        finally
+        {
+            if (quartzTriggerHandle != null)
+            {
+                quartzTriggerHandle.cancel();
+            }
+        }
+    }
+
+    @Ignore
+    @Test
+    public void scheduleCronWithStartAndEndTime() throws Exception
+    {
+                        
+        try
+        {
+            String id = new FacesRequest("/search.xhtml") 
+            {
+                @Override
+                protected void beforeRequest() 
+                {
+                    setParameter("accountId", "1");
+                }
+                
+                @Override
+                protected void updateModelValues() throws Exception 
+                {
+                    setValue("#{newPayment.payee}", "IRS"); 
+                    setValue("#{newPayment.amount}", new BigDecimal("110.00"));
+                    setValue("#{newPayment.paymentCron}", "*/2 * * * * ?" );
+                }
+                
+                @Override
+                protected void invokeApplication() throws Exception 
+                {
+                    // schedule a the repeating job and immediately pause it
+                    // this allows you to carefully control how long the timer
+                    // runs for
+                    Payment payment = (Payment) getValue("#{newPayment}");
+                    payment.setPaymentDate(new java.sql.Timestamp( System.currentTimeMillis() + REPEATING.getInterval()));
+                    payment.setPaymentEndDate(new java.sql.Timestamp( (long) (System.currentTimeMillis() + (REPEATING.getInterval() * 4.5))));
+                    assert "persisted".equals(invokeMethod("#{paymentHome.saveAndScheduleCron}"));
+                    quartzTriggerHandle = payment.getQuartzTriggerHandle();
+                    quartzTriggerHandle.pause();
+                }
+    
+                @Override
+                protected void renderResponse() throws Exception 
+                {
+                    // Check the job exists
+                    assert ((Boolean)getValue("#{accountHome.idDefined}"));                
+                    Account account = (Account) getValue("#{selectedAccount}");                
+                    assert account !=null;
+                    assert account.getId() == 1;
+                    assert account.getPayments().size() == 1;            
+                    
+                    Payment payment = (Payment) getValue("#{newPayment}");
+                    assert payment.getPayee().equals("IRS");
+                    assert payment.getAmount().equals(new BigDecimal("110.00"));
+                    assert payment.getAccount() != null;
+                    assert payment.getAccount().getId() == 1;
+                    assert payment.getActive();
+                }
+                
+            }.run();
+            
+            // Start the triggerHandle, wait a lot shorter than the job takes
+            // At this point the job should have executed once exactly
+            quartzTriggerHandle.resume();
+            pause((long) (REPEATING.getInterval() * 0.5));
+            quartzTriggerHandle.pause();
+            
+            new FacesRequest("/search.xhtml", id)
+            {
+    
+                @Override
+                protected void beforeRequest() 
+                {
+                    setParameter("accountId", "1");
+                }
+                
+                @Override
+                protected void renderResponse() throws Exception
+                {
+                    assert ((Boolean)getValue("#{accountHome.idDefined}"));                
+                    Account account = (Account) getValue("#{selectedAccount}");                
+                    assert account !=null;
+                    assert account.getId() == 1;
+                    assert account.getPayments().size() == 1;
+                    Payment payment = account.getPayments().get(0);
+                    assert new BigDecimal("110.00").equals(payment.getAmount());
+                    assert payment.getActive();
+                    assert "*/2 * * * * ?".equals(payment.getPaymentCron());
+                    
+                    assert new BigDecimal("1001.46").equals(account.getBalance());
+                }
+                
+            }.run();
+            
+            // Start the triggerHandle, wait until some short time after the initial
+            // expiration
+            quartzTriggerHandle.resume();
+            pause(REPEATING.getInterval());
+            quartzTriggerHandle.pause();
+            
+            
+            new FacesRequest("/search.xhtml", id)
+            {
+    
+                @Override
+                protected void beforeRequest() 
+                {
+                    setParameter("accountId", "1");
+                }
+                
+                @Override
+                protected void renderResponse() throws Exception
+                {
+
+                    // Job should have run twice
+                    assert ((Boolean)getValue("#{accountHome.idDefined}"));                
+                    Account account = (Account) getValue("#{selectedAccount}");
+
+                    assert account !=null;
+                    assert account.getId() == 1;
+                    assert account.getPayments().size() == 1;
+                    Payment payment = account.getPayments().get(0);
+                    assert new BigDecimal("110.00").equals(payment.getAmount());
+                    assert payment.getActive();
+                    assert "*/2 * * * * ?".equals(payment.getPaymentCron());
+                    assert new BigDecimal("891.46").equals(account.getBalance());
+                    paymentId = payment.getId();
+                }
+                
+            }.run();
+            
+            // Start the triggerHandle, wait until some short time after the 
+            // job triggers once
+            quartzTriggerHandle.resume();
+            pause(2000l);
+            
+            new FacesRequest("/search.xhtml", id)
+            {
+    
+                @Override
+                protected void beforeRequest() 
+                {
+                    setParameter("accountId", "1");
+                }
+                
+                @Override
+                protected void renderResponse() throws Exception
+                {
+
+                    // Job should have run twice
+                    assert ((Boolean)getValue("#{accountHome.idDefined}"));                
+                    Account account = (Account) getValue("#{selectedAccount}");
+
+                    assert account !=null;
+                    assert account.getId() == 1;
+                    assert account.getPayments().size() == 1;
+                    Payment payment = account.getPayments().get(0);
+                    assert new BigDecimal("110.00").equals(payment.getAmount());
+                    assert payment.getActive();
+                    assert "*/2 * * * * ?".equals(payment.getPaymentCron());
+                    assert payment.getLastPaid() != null;
+                    assert new BigDecimal("781.46").equals(account.getBalance());
+                    paymentId = payment.getId();
+                }
+                
+            }.run();
+                          
+            // Wait until some short time after another execution would
+            // have occurred to check it really stops
+            pause(2000l);
+            
+            new FacesRequest("/search.xhtml", id)
+            {
+    
+                @Override
+                protected void beforeRequest() 
+                {
+                    setParameter("accountId", "1");
+                }
+                
+                @Override
+                protected void renderResponse() throws Exception
+                {
+
+                    assert ((Boolean)getValue("#{accountHome.idDefined}"));                
+                    Account account = (Account) getValue("#{selectedAccount}");
+
+                    assert account !=null;
+                    assert account.getId() == 1;
+                    assert new BigDecimal("781.46").equals(account.getBalance());
+                }
+                
+            }.run();
+            
+        }
+        finally
+        {
+            if (quartzTriggerHandle != null)
+            {
+                quartzTriggerHandle.cancel();
+            }
+        }
+    }
+    
+    private void pause(long ms) {
+        try {
+            Thread.sleep(ms);
+        } catch (InterruptedException e) {
+            
+        }                
+    }
+
+    
+    
+}

Added: branches/enterprise/WFK-2_1/examples/quartz/quartz-ejb/src/test/java/org/jboss/seam/example/quartz/test/Deployments.java
===================================================================
--- branches/enterprise/WFK-2_1/examples/quartz/quartz-ejb/src/test/java/org/jboss/seam/example/quartz/test/Deployments.java	                        (rev 0)
+++ branches/enterprise/WFK-2_1/examples/quartz/quartz-ejb/src/test/java/org/jboss/seam/example/quartz/test/Deployments.java	2013-06-04 09:25:36 UTC (rev 15541)
@@ -0,0 +1,74 @@
+package org.jboss.seam.example.quartz.test;
+
+import java.io.File;
+
+import org.jboss.seam.example.quartz.PaymentProcessor;
+import org.jboss.shrinkwrap.api.ShrinkWrap;
+import org.jboss.shrinkwrap.api.spec.JavaArchive;
+import org.jboss.shrinkwrap.api.spec.WebArchive;
+import org.jboss.shrinkwrap.resolver.api.maven.Maven;
+
+public class Deployments {
+   /* public static EnterpriseArchive quartzDeployment() {
+        EnterpriseArchive ear = ShrinkWrap.create(ZipImporter.class, "seam-quartz.ear").importFrom(new File("../quartz-ear/target/seam-quartz.ear"))
+              .as(EnterpriseArchive.class);
+
+        // Install org.jboss.seam.mock.MockSeamListener
+        WebArchive web = ear.getAsType(WebArchive.class, "quartz-web.war");
+        web.delete("/WEB-INF/web.xml");
+        web.addAsWebInfResource("web.xml");
+        
+        web.addAsResource("BaseData.xml", "BaseData.xml");
+        
+        web.delete("/WEB-INF/components.xml");
+        web.addAsWebInfResource("WEB-INF/components.xml", "components.xml");
+        
+        JavaArchive ejb =  ear.getAsType(JavaArchive.class, "quartz-ejb.jar");
+        ejb.addClasses(TestPaymentController.class, TestPaymentProcessor.class, TransactionStatus.class);
+        
+        ear.addAsLibraries(DependencyResolvers.use(MavenDependencyResolver.class)
+              .configureFrom("pom.xml")
+              .artifact("org.dbunit:dbunit:jar:2.2")
+              .resolveAsFiles());
+
+        return ear;
+    }*/
+    
+    public static WebArchive quartzDeployment() {
+       
+       // use profiles defined in 'maven.profiles' property in pom.xml
+       String profilesString = System.getProperty("maven.profiles");
+       String[] profiles = profilesString != null ? profilesString.split(", ?") : new String[0];
+       
+       File[] libs = Maven.resolver().loadPomFromFile("pom.xml", profiles)
+             .importCompileAndRuntimeDependencies()
+             // force resolve jboss-seam, because it is provided-scoped in the pom, but we need it bundled in the WAR
+             .resolve("org.jboss.seam:jboss-seam").withTransitivity().asFile();
+       
+       File[] dbunitLibs = Maven.resolver().loadPomFromFile("pom.xml")
+             .resolve("org.dbunit:dbunit:jar:2.2")
+             .withoutTransitivity().asFile();
+       
+       JavaArchive ejb =  ShrinkWrap.create(JavaArchive.class,"quartz-ejb.jar");
+       ejb.addPackage(PaymentProcessor.class.getPackage());
+
+       return ShrinkWrap.create(WebArchive.class, "seam-quartz.war")
+               .addPackage(AsynchronousTest.class.getPackage())
+               .addPackage(PaymentProcessor.class.getPackage())
+               .addAsWebInfResource("META-INF/ejb-jar.xml", "ejb-jar.xml")
+               .addAsWebInfResource("components.xml", "components.xml")
+               .addAsWebInfResource("persistence.xml", "classes/META-INF/persistence.xml")
+               .addAsWebInfResource("import.sql", "classes/import.sql")
+               .addAsWebInfResource("jboss-deployment-structure.xml", "jboss-deployment-structure.xml")
+               .addAsWebInfResource("seam.properties", "classes/seam.properties")
+               .addAsWebInfResource("seam.quartz.properties", "classes/seam.quartz.properties")
+               .addAsWebInfResource("web.xml", "web.xml")
+               .addAsWebInfResource("pages.xml", "pages.xml")
+               .addAsResource("BaseData.xml", "BaseData.xml")
+               .addAsWebResource("index.html")
+               .addAsWebResource("search.xhtml")
+               .addAsLibraries(libs)
+               .addAsLibraries(dbunitLibs);
+       
+    }
+}

Copied: branches/enterprise/WFK-2_1/examples/quartz/quartz-ejb/src/test/java/org/jboss/seam/example/quartz/test/EventsTest.java (from rev 15540, branches/enterprise/WFK-2_1/examples/quartz/quartz-tests/src/test/java/org/jboss/seam/example/quartz/test/EventsTest.java)
===================================================================
--- branches/enterprise/WFK-2_1/examples/quartz/quartz-ejb/src/test/java/org/jboss/seam/example/quartz/test/EventsTest.java	                        (rev 0)
+++ branches/enterprise/WFK-2_1/examples/quartz/quartz-ejb/src/test/java/org/jboss/seam/example/quartz/test/EventsTest.java	2013-06-04 09:25:36 UTC (rev 15541)
@@ -0,0 +1,269 @@
+package org.jboss.seam.example.quartz.test;
+
+import static org.jboss.seam.example.quartz.Payment.Frequency.ONCE;
+
+import java.math.BigDecimal;
+
+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.example.quartz.Account;
+import org.jboss.seam.example.quartz.Payment;
+import org.jboss.seam.mock.DBJUnitSeamTest;
+import org.jboss.shrinkwrap.api.Archive;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+
+/**
+ * 
+ * @author Pete Muir
+ *
+ */
+
+// Actually this doesn't happen in the example, but lets test it here to keep
+// all quartz tests in one place
+ at RunWith(Arquillian.class)
+public class EventsTest extends DBJUnitSeamTest 
+{
+    @Deployment(name="EventsTest")
+    @OverProtocol("Servlet 3.0")
+    public static Archive<?> createDeployment()
+    {
+        return Deployments.quartzDeployment();
+    }
+   
+    @Override
+    protected void prepareDBUnitOperations() {
+        setDatabase("HSQL");
+        setDatasourceJndiName("java:jboss/datasources/ExampleDS");
+        
+        beforeTestOperations.add(
+                new DataSetOperation("BaseData.xml")
+        );
+    }
+
+    @Test
+    public void testAsynchronousEvent() throws Exception
+    {
+            String id = new FacesRequest("/search.xhtml") 
+            {
+                @Override
+                protected void beforeRequest() 
+                {
+                    setParameter("accountId", "1");
+                }
+                
+                @Override
+                protected void updateModelValues() throws Exception 
+                {
+                    setValue("#{newPayment.payee}", "IRS"); 
+                    setValue("#{newPayment.amount}", new BigDecimal("110.00"));
+                    setValue("#{newPayment.paymentFrequency}", ONCE);
+                }
+    
+                @Override
+                protected void invokeApplication() throws Exception 
+                {
+                    invokeMethod("#{paymentHome.scheduleAndSaveUsingAsynchronousEvent}");
+                }
+    
+                @Override
+                protected void renderResponse() throws Exception 
+                {
+                    assert ((Boolean)getValue("#{accountHome.idDefined}"));                
+                    Account account = (Account) getValue("#{selectedAccount}");                
+                    assert account !=null;
+                    assert account.getId() == 1;
+                    assert account.getPayments().size() == 1;               
+                }
+                
+            }.run();
+            
+            // Wait, let quartz execute the async method which schedules the job
+            // for immediate execution
+            pause(50);
+            
+            new FacesRequest("/search.xhtml", id)
+            {
+    
+                @Override
+                protected void beforeRequest() 
+                {
+                    setParameter("accountId", "1");
+                }
+                
+                @Override
+                protected void renderResponse() throws Exception
+                {
+                    System.out.println("running renderResponse");
+                    assert ((Boolean)getValue("#{accountHome.idDefined}"));                
+                    Account account = (Account) getValue("#{selectedAccount}");                
+                    assert account !=null;
+                    assert account.getId() == 1;
+                    assert account.getPayments().size() == 1;
+                    Payment payment = account.getPayments().get(0);
+                    assert new BigDecimal("110.00").equals(payment.getAmount());
+                    //assert !payment.getActive();
+                    //assert payment.getLastPaid() != null;
+                    assert new BigDecimal("891.46").equals(account.getBalance());
+                }
+                
+            }.run();
+    }
+
+    
+    @Test
+    public void testTransactionSuccessEvents() throws Exception
+    {
+            String id = new FacesRequest("/search.xhtml") 
+            {
+                @Override
+                protected void beforeRequest() 
+                {
+                    setParameter("accountId", "1");
+                }
+                
+                @Override
+                protected void updateModelValues() throws Exception 
+                {
+                    setValue("#{newPayment.payee}", "IRS"); 
+                    setValue("#{newPayment.amount}", new BigDecimal("110.00"));
+                    setValue("#{newPayment.paymentFrequency}", ONCE);
+                }
+    
+                @Override
+                protected void invokeApplication() throws Exception 
+                {
+                    invokeMethod("#{paymentHome.scheduleAndSaveWithTransactionEvents}");
+                }
+    
+                @Override
+                protected void renderResponse() throws Exception 
+                {
+                    assert ((Boolean)getValue("#{accountHome.idDefined}"));                
+                    Account account = (Account) getValue("#{selectedAccount}");                
+                    assert account !=null;
+                    assert account.getId() == 1;
+                    assert account.getPayments().size() == 1;               
+                }
+                
+            }.run();
+            
+            // Wait, let quartz execute the async method which schedules the job
+            // for immediate execution
+            pause(50);
+            
+            new FacesRequest("/search.xhtml", id)
+            {
+    
+                @Override
+                protected void beforeRequest() 
+                {
+                    setParameter("accountId", "1");
+                }
+                
+                @Override
+                protected void renderResponse() throws Exception
+                {
+                    System.out.println("running renderResponse");
+                    assert ((Boolean)getValue("#{accountHome.idDefined}"));                
+                    Account account = (Account) getValue("#{selectedAccount}");                
+                    assert account !=null;
+                    assert account.getId() == 1;
+                    assert account.getPayments().size() == 1;
+                    Payment payment = account.getPayments().get(0);
+                    assert new BigDecimal("110.00").equals(payment.getAmount());
+                    //assert !payment.getActive();
+                    //assert payment.getLastPaid() != null;
+                    assert new BigDecimal("891.46").equals(account.getBalance());
+                    assert (Boolean) getValue("#{transactionStatus.transactionCompleted}");
+                    assert (Boolean) getValue("#{transactionStatus.transactionSucceded}"); 
+                    assert payment.getId().equals(getValue("#{transactionStatus.id}"));
+                }
+                
+            }.run();
+    }
+    
+    @Test
+    public void testTimedEvent() throws Exception
+    {
+            String id = new FacesRequest("/search.xhtml") 
+            {
+                @Override
+                protected void beforeRequest() 
+                {
+                    setParameter("accountId", "1");
+                }
+                
+                @Override
+                protected void updateModelValues() throws Exception 
+                {
+                    setValue("#{newPayment.payee}", "IRS"); 
+                    setValue("#{newPayment.amount}", new BigDecimal("120.00"));
+                    setValue("#{newPayment.paymentFrequency}", ONCE);
+                }
+    
+                @Override
+                protected void invokeApplication() throws Exception 
+                {
+                    invokeMethod("#{paymentHome.scheduleAndSaveUsingTimedEvent}");
+                }
+    
+                @Override
+                protected void renderResponse() throws Exception 
+                {
+		    Thread.sleep(1000);
+                    assert ((Boolean)getValue("#{accountHome.idDefined}"));                
+                    Account account = (Account) getValue("#{selectedAccount}");                
+                    assert account !=null;
+                    assert account.getId() == 1;
+                    assert account.getPayments().size() == 1;               
+                }
+                
+            }.run();
+            
+            // Wait, let quartz execute the async method which schedules the job
+            // for immediate execution
+            pause(1000l);
+            
+            new FacesRequest("/search.xhtml", id)
+            {
+    
+                @Override
+                protected void beforeRequest() 
+                {
+                    setParameter("accountId", "1");
+                }
+                
+                @Override
+                protected void renderResponse() throws Exception
+                {
+                    System.out.println("running renderResponse");
+                    assert ((Boolean)getValue("#{accountHome.idDefined}"));                
+                    Account account = (Account) getValue("#{selectedAccount}");                
+                    assert account != null;
+                    assert account.getId() == 1;
+                    assert account.getPayments().size() == 1;
+                    Payment payment = account.getPayments().get(0);
+                    assert new BigDecimal("120.00").equals(payment.getAmount()) : "Invalid payment amount: " + payment.getAmount();
+                    //assert !payment.getActive();
+                    //assert payment.getLastPaid() != null;
+                    assert new BigDecimal("881.46").equals(account.getBalance()) : "Invalid account balance: " + account.getBalance();
+                }
+                
+            }.run();
+    }
+
+    
+    
+    private void pause(long ms) {
+        try {
+            Thread.sleep(ms);
+        } catch (InterruptedException e) {
+            
+        }                
+    }
+
+    
+    
+}

Copied: branches/enterprise/WFK-2_1/examples/quartz/quartz-ejb/src/test/java/org/jboss/seam/example/quartz/test/OnceTest.java (from rev 15540, branches/enterprise/WFK-2_1/examples/quartz/quartz-tests/src/test/java/org/jboss/seam/example/quartz/test/OnceTest.java)
===================================================================
--- branches/enterprise/WFK-2_1/examples/quartz/quartz-ejb/src/test/java/org/jboss/seam/example/quartz/test/OnceTest.java	                        (rev 0)
+++ branches/enterprise/WFK-2_1/examples/quartz/quartz-ejb/src/test/java/org/jboss/seam/example/quartz/test/OnceTest.java	2013-06-04 09:25:36 UTC (rev 15541)
@@ -0,0 +1,146 @@
+package org.jboss.seam.example.quartz.test;
+
+import static org.jboss.seam.example.quartz.Payment.Frequency.ONCE;
+
+import java.math.BigDecimal;
+
+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.async.QuartzTriggerHandle;
+import org.jboss.seam.example.quartz.Account;
+import org.jboss.seam.example.quartz.Payment;
+import org.jboss.seam.mock.DBJUnitSeamTest;
+import org.jboss.shrinkwrap.api.Archive;
+import org.junit.Ignore;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+
+/**
+ * 
+ * @author Pete Muir
+ *
+ */
+ at RunWith(Arquillian.class)
+public class OnceTest extends DBJUnitSeamTest 
+{
+    @Deployment(name="OnceTest")
+    @OverProtocol("Servlet 3.0")
+    public static Archive<?> createDeployment()
+    {
+        return Deployments.quartzDeployment();
+    }
+   
+    private QuartzTriggerHandle quartzTriggerHandle;
+    
+    @Override
+    protected void prepareDBUnitOperations() {
+        setDatabase("HSQL");
+        setDatasourceJndiName("java:jboss/datasources/ExampleDS");
+        
+        beforeTestOperations.add(
+                new DataSetOperation("BaseData.xml")
+        );
+    }
+    
+   
+    
+    @Test
+    @Ignore
+    public void scheduleOnce() throws Exception
+    {
+        try
+        {
+            String id = new FacesRequest("/search.xhtml") 
+            {
+                @Override
+                protected void beforeRequest() 
+                {
+                    setParameter("accountId", "1");
+                }
+                
+                @Override
+                protected void updateModelValues() throws Exception 
+                {
+                    setValue("#{newPayment.payee}", "IRS"); 
+                    setValue("#{newPayment.amount}", new BigDecimal("100.00"));
+                    setValue("#{newPayment.paymentFrequency}", ONCE);
+                }
+    
+                @Override
+                protected void invokeApplication() throws Exception 
+                {
+                    assert "persisted".equals(invokeMethod("#{paymentHome.saveAndSchedule}"));
+                }
+    
+                @Override
+                protected void renderResponse() throws Exception 
+                {
+                    assert ((Boolean)getValue("#{accountHome.idDefined}"));                
+                    Account account = (Account) getValue("#{selectedAccount}");                
+                    assert account !=null;
+                    assert account.getId() == 1;
+                    assert account.getPayments().size() == 1;               
+                    
+                    Payment payment = (Payment) getValue("#{newPayment}");
+                    assert payment.getPayee().equals("IRS");
+                    assert payment.getAmount().equals(new BigDecimal("100.00"));
+                    assert payment.getAccount() != null;
+                    assert payment.getAccount().getId() == 1;
+                    quartzTriggerHandle = payment.getQuartzTriggerHandle();
+                }
+                
+            }.run();
+            
+            // Wait, let quartz execute the job (async but straight away)
+            pause(500);
+            
+            new FacesRequest("/search.xhtml", id)
+            {
+    
+                @Override
+                protected void beforeRequest() 
+                {
+                    setParameter("accountId", "1");
+                }
+                
+                @Override
+                protected void renderResponse() throws Exception
+                {
+                    assert ((Boolean)getValue("#{accountHome.idDefined}"));                
+                    Account account = (Account) getValue("#{selectedAccount}");                
+                    assert account !=null;
+                    assert account.getId() == 1;
+                    assert account.getPayments().size() == 1;
+                    Payment payment = account.getPayments().get(0);
+                    assert new BigDecimal("100.00").equals(payment.getAmount());
+                    assert !payment.getActive();
+                    assert ONCE.equals(payment.getPaymentFrequency());
+                    assert payment.getLastPaid() != null;
+                    assert new BigDecimal("901.46").equals(account.getBalance());
+                }
+                
+            }.run();
+        }
+        finally
+        {
+            // Always cancel the job
+            if (quartzTriggerHandle != null)
+            {
+                quartzTriggerHandle.cancel();
+                quartzTriggerHandle = null;
+            }
+        }
+    }
+    
+    private void pause(long ms) {
+        try {
+            Thread.sleep(ms);
+        } catch (InterruptedException e) {
+            
+        }                
+    }
+
+    
+    
+}

Copied: branches/enterprise/WFK-2_1/examples/quartz/quartz-ejb/src/test/java/org/jboss/seam/example/quartz/test/RepeatingTest.java (from rev 15540, branches/enterprise/WFK-2_1/examples/quartz/quartz-tests/src/test/java/org/jboss/seam/example/quartz/test/RepeatingTest.java)
===================================================================
--- branches/enterprise/WFK-2_1/examples/quartz/quartz-ejb/src/test/java/org/jboss/seam/example/quartz/test/RepeatingTest.java	                        (rev 0)
+++ branches/enterprise/WFK-2_1/examples/quartz/quartz-ejb/src/test/java/org/jboss/seam/example/quartz/test/RepeatingTest.java	2013-06-04 09:25:36 UTC (rev 15541)
@@ -0,0 +1,463 @@
+package org.jboss.seam.example.quartz.test;
+
+import static org.jboss.seam.example.quartz.Payment.Frequency.EVERY_SECOND;
+
+import java.math.BigDecimal;
+
+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.async.QuartzTriggerHandle;
+import org.jboss.seam.example.quartz.Account;
+import org.jboss.seam.example.quartz.Payment;
+import org.jboss.seam.example.quartz.Payment.Frequency;
+import org.jboss.seam.mock.DBJUnitSeamTest;
+import org.jboss.shrinkwrap.api.Archive;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+
+/**
+ * 
+ * @author Pete Muir
+ *
+ */
+ at RunWith(Arquillian.class)
+public class RepeatingTest 
+    extends DBJUnitSeamTest 
+{
+    @Deployment(name="RepeatingTest")
+    @OverProtocol("Servlet 3.0")
+    public static Archive<?> createDeployment()
+    {
+        return Deployments.quartzDeployment();
+    }
+    
+    private QuartzTriggerHandle quartzTriggerHandle;
+    private Long paymentId;
+    
+    private static final Frequency REPEATING = EVERY_SECOND;
+
+    
+    @Override
+    protected void prepareDBUnitOperations() {
+        setDatabase("HSQL");
+        setDatasourceJndiName("java:jboss/datasources/ExampleDS");
+       
+        beforeTestOperations.add(
+                new DataSetOperation("BaseData.xml")
+        );
+    }
+    
+    
+    @Test
+    public void scheduleRepeating() throws Exception
+    {
+                        
+        try
+        {
+            String id = new FacesRequest("/search.xhtml") 
+            {
+                @Override
+                protected void beforeRequest() 
+                {
+                    setParameter("accountId", "1");
+                }
+                
+                @Override
+                protected void updateModelValues() throws Exception 
+                {
+                    setValue("#{newPayment.payee}", "IRS"); 
+                    setValue("#{newPayment.amount}", new BigDecimal("110.00"));
+                    setValue("#{newPayment.paymentFrequency}", REPEATING );
+                }
+                
+                @Override
+                protected void invokeApplication() throws Exception 
+                {
+                    // schedule a the repeating job and immediately pause it
+                    // this allows you to carefully control how long the timer
+                    // runs for
+                    assert "persisted".equals(invokeMethod("#{paymentHome.saveAndSchedule}"));
+                    Payment payment = (Payment) getValue("#{newPayment}");
+                    quartzTriggerHandle = payment.getQuartzTriggerHandle();
+                    quartzTriggerHandle.pause();
+                }
+    
+                @Override
+                protected void renderResponse() throws Exception 
+                {
+                    // Check the job exists
+                    assert ((Boolean)getValue("#{accountHome.idDefined}"));                
+                    Account account = (Account) getValue("#{selectedAccount}");                
+                    assert account !=null;
+                    assert account.getId() == 1;
+                    assert account.getPayments().size() == 1;            
+                    
+                    Payment payment = (Payment) getValue("#{newPayment}");
+                    assert payment.getPayee().equals("IRS");
+                    assert payment.getAmount().equals(new BigDecimal("110.00"));
+                    assert payment.getAccount() != null;
+                    assert payment.getAccount().getId() == 1;
+                    assert payment.getActive();
+                }
+                
+            }.run();
+            
+            // Start the triggerHandle, wait a lot shorter than the job takes
+            // At this point the job should have executed once exactly
+            quartzTriggerHandle.resume();
+            pause((long) (REPEATING.getInterval() * 0.1));
+            quartzTriggerHandle.pause();
+            
+            new FacesRequest("/search.xhtml", id)
+            {
+    
+                @Override
+                protected void beforeRequest() 
+                {
+                    setParameter("accountId", "1");
+                }
+                
+                @Override
+                protected void renderResponse() throws Exception
+                {
+                    assert ((Boolean)getValue("#{accountHome.idDefined}"));                
+                    Account account = (Account) getValue("#{selectedAccount}");                
+                    assert account !=null;
+                    assert account.getId() == 1;
+                    assert account.getPayments().size() == 1;
+                    Payment payment = account.getPayments().get(0);
+                    assert new BigDecimal("110.00").equals(payment.getAmount());
+                    assert payment.getActive();
+                    assert REPEATING.equals(payment.getPaymentFrequency());
+                    
+                    assert new BigDecimal("891.46").equals(account.getBalance());
+                }
+                
+            }.run();
+            
+            // Start the triggerHandle, wait until some short time after the 
+            // job triggers once
+            quartzTriggerHandle.resume();
+            pause(REPEATING.getInterval());
+            quartzTriggerHandle.pause();
+            
+            
+            new FacesRequest("/search.xhtml", id)
+            {
+    
+                @Override
+                protected void beforeRequest() 
+                {
+                    setParameter("accountId", "1");
+                }
+                
+                @Override
+                protected void renderResponse() throws Exception
+                {
+
+                    // Job should have run twice
+                    assert ((Boolean)getValue("#{accountHome.idDefined}"));                
+                    Account account = (Account) getValue("#{selectedAccount}");
+
+                    assert account !=null;
+                    assert account.getId() == 1;
+                    assert account.getPayments().size() == 1;
+                    Payment payment = account.getPayments().get(0);
+                    assert new BigDecimal("110.00").equals(payment.getAmount());
+                    assert payment.getActive();
+                    assert REPEATING.equals(payment.getPaymentFrequency());
+                    assert payment.getLastPaid() != null;
+                    assert new BigDecimal("781.46").equals(account.getBalance());
+                    paymentId = payment.getId();
+                }
+                
+            }.run();
+            
+            new FacesRequest("/search.xhtml", id)
+            {
+    
+                @Override
+                protected void beforeRequest() 
+                {
+                    setParameter("accountId", "1");
+                    setParameter("paymentId", paymentId.toString());
+                }
+                
+                @Override
+                protected void invokeApplication() throws Exception
+                {
+                    // Resume the job, then cancel it
+                    quartzTriggerHandle.resume();
+                    invokeMethod("#{paymentHome.cancel}");
+                }
+                
+                @Override
+                protected void renderResponse() throws Exception
+                {
+
+                    assert ((Boolean)getValue("#{accountHome.idDefined}"));                
+                    Account account = (Account) getValue("#{selectedAccount}");
+
+                    assert account !=null;
+                    assert account.getId() == 1;
+                    assert account.getPayments().size() == 1;
+                    Payment payment = account.getPayments().get(0);
+                    assert new BigDecimal("110.00").equals(payment.getAmount());
+                    assert !payment.getActive();
+                    assert payment.getLastPaid() != null;
+                    assert new BigDecimal("781.46").equals(account.getBalance());
+                }
+                
+            }.run();
+            
+            // Wait until some short time after another execution would
+            // have occurred to check it really stops
+            pause((long) (REPEATING.getInterval() * 1.05));
+            
+            new FacesRequest("/search.xhtml", id)
+            {
+    
+                @Override
+                protected void beforeRequest() 
+                {
+                    setParameter("accountId", "1");
+                }
+                
+                @Override
+                protected void renderResponse() throws Exception
+                {
+
+                    assert ((Boolean)getValue("#{accountHome.idDefined}"));                
+                    Account account = (Account) getValue("#{selectedAccount}");
+
+                    assert account !=null;
+                    assert account.getId() == 1;
+                    assert new BigDecimal("781.46").equals(account.getBalance());
+                }
+                
+            }.run();
+            
+        }
+        finally
+        {
+            if (quartzTriggerHandle != null)
+            {
+                quartzTriggerHandle.cancel();
+            }
+        }
+    }
+    
+    
+    
+    @Test
+    public void scheduleRepeatingWithStartAndEndTime() throws Exception
+    {
+                        
+        try
+        {
+            String id = new FacesRequest("/search.xhtml") 
+            {
+                @Override
+                protected void beforeRequest() 
+                {
+                    setParameter("accountId", "1");
+                }
+                
+                @Override
+                protected void updateModelValues() throws Exception 
+                {
+                    setValue("#{newPayment.payee}", "IRS"); 
+                    setValue("#{newPayment.amount}", new BigDecimal("110.00"));
+                    setValue("#{newPayment.paymentFrequency}", REPEATING );
+                }
+                
+                @Override
+                protected void invokeApplication() throws Exception 
+                {
+                    // schedule a the repeating job and immediately pause it
+                    // this allows you to carefully control how long the timer
+                    // runs for
+                    Payment payment = (Payment) getValue("#{newPayment}");
+                    payment.setPaymentDate(new java.sql.Timestamp( System.currentTimeMillis() + REPEATING.getInterval()));
+                    payment.setPaymentEndDate(new java.sql.Timestamp( (long) (System.currentTimeMillis() + (REPEATING.getInterval() * 2.5))));
+                    assert "persisted".equals(invokeMethod("#{paymentHome.saveAndSchedule}")); 
+                    quartzTriggerHandle = payment.getQuartzTriggerHandle();
+                    quartzTriggerHandle.pause();
+                }
+    
+                @Override
+                protected void renderResponse() throws Exception 
+                {
+                    // Check the job exists
+                    assert ((Boolean)getValue("#{accountHome.idDefined}"));                
+                    Account account = (Account) getValue("#{selectedAccount}");                
+                    assert account !=null;
+                    assert account.getId() == 1;
+                    assert account.getPayments().size() == 1;            
+                    
+                    Payment payment = (Payment) getValue("#{newPayment}");
+                    assert payment.getPayee().equals("IRS");
+                    assert payment.getAmount().equals(new BigDecimal("110.00"));
+                    assert payment.getAccount() != null;
+                    assert payment.getAccount().getId() == 1;
+                    assert payment.getActive();
+                }
+                
+            }.run();
+            
+            // Start the triggerHandle, wait a lot shorter than the job takes
+            // At this point the job should have executed zero times
+            quartzTriggerHandle.resume();
+            pause((long) (REPEATING.getInterval() * 0.1));
+            quartzTriggerHandle.pause();
+            
+            new FacesRequest("/search.xhtml", id)
+            {
+    
+                @Override
+                protected void beforeRequest() 
+                {
+                    setParameter("accountId", "1");
+                }
+                
+                @Override
+                protected void renderResponse() throws Exception
+                {
+                    assert ((Boolean)getValue("#{accountHome.idDefined}"));                
+                    Account account = (Account) getValue("#{selectedAccount}");                
+                    assert account !=null;
+                    assert account.getId() == 1;
+                    assert account.getPayments().size() == 1;
+                    Payment payment = account.getPayments().get(0);
+                    assert new BigDecimal("110.00").equals(payment.getAmount());
+                    assert payment.getActive();
+                    assert new BigDecimal("1001.46").equals(account.getBalance());
+                }
+                
+            }.run();
+            
+            // Start the triggerHandle, wait until some short time after the 
+            // job triggers once
+            quartzTriggerHandle.resume();
+            pause(REPEATING.getInterval());
+            quartzTriggerHandle.pause();
+            
+            
+            new FacesRequest("/search.xhtml", id)
+            {
+    
+                @Override
+                protected void beforeRequest() 
+                {
+                    setParameter("accountId", "1");
+                }
+                
+                @Override
+                protected void renderResponse() throws Exception
+                {
+
+                    // Job should have run twice
+                    assert ((Boolean)getValue("#{accountHome.idDefined}"));                
+                    Account account = (Account) getValue("#{selectedAccount}");
+
+                    assert account !=null;
+                    assert account.getId() == 1;
+                    assert account.getPayments().size() == 1;
+                    Payment payment = account.getPayments().get(0);
+                    assert new BigDecimal("110.00").equals(payment.getAmount());
+                    assert payment.getActive();
+                    assert new BigDecimal("891.46").equals(account.getBalance());
+                    paymentId = payment.getId();
+                }
+                
+            }.run();
+            
+            // Start the triggerHandle, wait until some short time after the 
+            // job triggers once
+            quartzTriggerHandle.resume();
+            pause(REPEATING.getInterval());
+            // Thats the last job so need to pause
+            
+            new FacesRequest("/search.xhtml", id)
+            {
+    
+                @Override
+                protected void beforeRequest() 
+                {
+                    setParameter("accountId", "1");
+                }
+                
+                @Override
+                protected void renderResponse() throws Exception
+                {
+
+                    // Job should have run twice
+                    assert ((Boolean)getValue("#{accountHome.idDefined}"));                
+                    Account account = (Account) getValue("#{selectedAccount}");
+
+                    assert account !=null;
+                    assert account.getId() == 1;
+                    assert account.getPayments().size() == 1;
+                    Payment payment = account.getPayments().get(0);
+                    assert new BigDecimal("110.00").equals(payment.getAmount());
+                    assert payment.getActive();
+                    assert new BigDecimal("781.46").equals(account.getBalance());
+                    paymentId = payment.getId();
+                }
+                
+            }.run();
+            
+            // Start the triggerHandle, wait until some short time after the 
+            // job would trigger again - we should be way beyond the expiry now 
+            pause(REPEATING.getInterval());
+            
+            new FacesRequest("/search.xhtml", id)
+            {
+    
+                @Override
+                protected void beforeRequest() 
+                {
+                    setParameter("accountId", "1");
+                }
+                
+                @Override
+                protected void renderResponse() throws Exception
+                {
+
+                    assert ((Boolean)getValue("#{accountHome.idDefined}"));                
+                    Account account = (Account) getValue("#{selectedAccount}");
+
+                    assert account !=null;
+                    assert account.getId() == 1;
+                    assert account.getPayments().size() == 1;
+                    Payment payment = account.getPayments().get(0);
+                    assert new BigDecimal("110.00").equals(payment.getAmount());
+                    assert payment.getActive();
+                    assert payment.getLastPaid() != null;
+                    assert new BigDecimal("781.46").equals(account.getBalance());
+                }
+                
+            }.run();
+            
+        }
+        finally
+        {
+            if (quartzTriggerHandle != null)
+            {
+                quartzTriggerHandle.cancel();
+            }
+        }
+    }
+    
+    private void pause(long ms) {
+        try {
+            Thread.sleep(ms);
+        } catch (InterruptedException e) {
+            
+        }                
+    }
+
+    
+    
+}

Copied: branches/enterprise/WFK-2_1/examples/quartz/quartz-ejb/src/test/java/org/jboss/seam/example/quartz/test/TestPaymentController.java (from rev 15540, branches/enterprise/WFK-2_1/examples/quartz/quartz-tests/src/test/java/org/jboss/seam/example/quartz/test/TestPaymentController.java)
===================================================================
--- branches/enterprise/WFK-2_1/examples/quartz/quartz-ejb/src/test/java/org/jboss/seam/example/quartz/test/TestPaymentController.java	                        (rev 0)
+++ branches/enterprise/WFK-2_1/examples/quartz/quartz-ejb/src/test/java/org/jboss/seam/example/quartz/test/TestPaymentController.java	2013-06-04 09:25:36 UTC (rev 15541)
@@ -0,0 +1,84 @@
+package org.jboss.seam.example.quartz.test;
+
+import static org.jboss.seam.annotations.Install.MOCK;
+
+import java.sql.Timestamp;
+
+import org.jboss.seam.annotations.In;
+import org.jboss.seam.annotations.Install;
+import org.jboss.seam.annotations.Logger;
+import org.jboss.seam.annotations.Name;
+import org.jboss.seam.async.QuartzTriggerHandle;
+import org.jboss.seam.async.Schedule;
+import org.jboss.seam.async.TimerSchedule;
+import org.jboss.seam.core.Events;
+import org.jboss.seam.example.quartz.Payment;
+import org.jboss.seam.example.quartz.PaymentHome;
+import org.jboss.seam.log.Log;
+
+/**
+ * @author Pete Muir
+ *
+ */
+ at Name("paymentHome")
+ at Install(precedence=MOCK)
+public class TestPaymentController extends PaymentHome
+{
+    
+    @In TestPaymentProcessor processor;
+    
+    @Logger Log log;
+    
+    public String scheduleAndSaveAsynchronously()
+    {
+        String result = persist();
+        
+        Payment payment = getInstance();
+        
+        log.info("scheduling instance #0", payment);
+        QuartzTriggerHandle handle = processor.schedulePayment(payment.getPaymentDate(), 
+                                                payment.getPaymentFrequency().getInterval(), 
+                                                payment.getPaymentEndDate(), 
+                                                payment);
+        
+        payment.setQuartzTriggerHandle( handle );
+
+        return result;
+    }
+    
+    public void scheduleAndSaveUsingAsynchronousEvent()
+    {
+        persist();
+        Events.instance().raiseAsynchronousEvent("org.jboss.seam.example.quartz.test.scheduleAndSave", getInstance());
+    }
+    
+    public void scheduleAndSaveUsingTimedEvent()
+    {
+        persist();
+        // A simple once-only which exprires in 1000ms
+        Schedule schedule = new TimerSchedule( new Timestamp( System.currentTimeMillis() + 1000l ) );
+        Events.instance().raiseTimedEvent("org.jboss.seam.example.quartz.test.scheduleAndSave", schedule, getInstance());
+    }
+    
+    public void scheduleAndSaveWithTransactionEvents()
+    {
+        TransactionStatus.clear();
+        Events.instance().raiseTransactionSuccessEvent("org.jboss.seam.example.quartz.test.transactionSuccess", getInstance());
+        Events.instance().raiseTransactionCompletionEvent("org.jboss.seam.example.quartz.test.transactionCompletion", getInstance());
+        try
+        {
+            super.saveAndSchedule();
+        }
+        catch (Exception e) 
+        {
+            e.printStackTrace();
+        }
+    }
+    
+    @Override
+    public Class<Payment> getEntityClass()
+    {
+        return Payment.class;
+    }
+    
+}

Copied: branches/enterprise/WFK-2_1/examples/quartz/quartz-ejb/src/test/java/org/jboss/seam/example/quartz/test/TestPaymentProcessor.java (from rev 15540, branches/enterprise/WFK-2_1/examples/quartz/quartz-tests/src/test/java/org/jboss/seam/example/quartz/test/TestPaymentProcessor.java)
===================================================================
--- branches/enterprise/WFK-2_1/examples/quartz/quartz-ejb/src/test/java/org/jboss/seam/example/quartz/test/TestPaymentProcessor.java	                        (rev 0)
+++ branches/enterprise/WFK-2_1/examples/quartz/quartz-ejb/src/test/java/org/jboss/seam/example/quartz/test/TestPaymentProcessor.java	2013-06-04 09:25:36 UTC (rev 15541)
@@ -0,0 +1,89 @@
+package org.jboss.seam.example.quartz.test;
+
+import static org.jboss.seam.annotations.Install.MOCK;
+
+import java.math.BigDecimal;
+import java.util.Date;
+
+import javax.persistence.EntityManager;
+
+import org.jboss.seam.annotations.AutoCreate;
+import org.jboss.seam.annotations.In;
+import org.jboss.seam.annotations.Install;
+import org.jboss.seam.annotations.Logger;
+import org.jboss.seam.annotations.Name;
+import org.jboss.seam.annotations.Observer;
+import org.jboss.seam.annotations.Transactional;
+import org.jboss.seam.annotations.async.Asynchronous;
+import org.jboss.seam.async.QuartzTriggerHandle;
+import org.jboss.seam.example.quartz.Payment;
+import org.jboss.seam.example.quartz.PaymentProcessor;
+import org.jboss.seam.log.Log;
+
+/**
+ * @author Pete Muir
+ *
+ */
+ at Name("processor")
+ at Install(precedence=MOCK)
+ at AutoCreate
+public class TestPaymentProcessor extends PaymentProcessor
+{
+    
+    @In 
+    EntityManager entityManager;
+
+    @Logger Log log;
+    
+    @Asynchronous
+    @Transactional
+    public QuartzTriggerHandle schedulePaymentAsynchronously(Payment payment) 
+    { 
+        payment = entityManager.merge(payment);
+        
+        log.info("[#0] Processing cron payment #1", System.currentTimeMillis(), payment.getId());
+
+        if (payment.getActive()) {
+            BigDecimal balance = payment.getAccount().adjustBalance(payment.getAmount().negate());
+            log.info(":: balance is now #0", balance);
+            payment.setLastPaid(new Date());
+
+        }
+
+        return null;
+    }
+    
+    @Observer("org.jboss.seam.example.quartz.test.scheduleAndSave")
+    @Transactional
+    public QuartzTriggerHandle schedulePayment(Payment payment) 
+    { 
+        payment = entityManager.merge(payment);
+        
+        log.error("[#0] Processing cron payment #1", System.currentTimeMillis(), payment.getId());
+        if (payment.getActive()) {
+            BigDecimal balance = payment.getAccount().adjustBalance(payment.getAmount().negate());
+            log.error(":: balance is now #0", balance);
+            payment.setLastPaid(new Date());
+
+        }
+
+        return null;
+    }
+    
+    @Observer("org.jboss.seam.example.quartz.test.transactionSuccess")
+    @Transactional
+    public void observeTransactionSuccess(Payment payment)
+    {
+        TransactionStatus.instance().setTransactionSucceded(true);
+        TransactionStatus.instance().setId(payment.getId());
+    }
+    
+    @Observer("org.jboss.seam.example.quartz.test.transactionCompletion")
+    @Transactional
+    public void observeTransactionCompletion(Payment payment)
+    {
+        TransactionStatus.instance().setTransactionCompleted(true);
+        TransactionStatus.instance().setId(payment.getId());
+    }
+
+}

Copied: branches/enterprise/WFK-2_1/examples/quartz/quartz-ejb/src/test/java/org/jboss/seam/example/quartz/test/TransactionStatus.java (from rev 15540, branches/enterprise/WFK-2_1/examples/quartz/quartz-tests/src/test/java/org/jboss/seam/example/quartz/test/TransactionStatus.java)
===================================================================
--- branches/enterprise/WFK-2_1/examples/quartz/quartz-ejb/src/test/java/org/jboss/seam/example/quartz/test/TransactionStatus.java	                        (rev 0)
+++ branches/enterprise/WFK-2_1/examples/quartz/quartz-ejb/src/test/java/org/jboss/seam/example/quartz/test/TransactionStatus.java	2013-06-04 09:25:36 UTC (rev 15541)
@@ -0,0 +1,75 @@
+package org.jboss.seam.example.quartz.test;
+
+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.Scope;
+import org.jboss.seam.contexts.Contexts;
+
+/**
+ * @author Pete Muir
+ *
+ */
+ at Name("transactionStatus")
+ at Scope(ScopeType.APPLICATION)
+ at AutoCreate
+public class TransactionStatus
+{
+    private Object id;
+    private boolean transactionSucceded;
+    private boolean transactionCompleted;
+    /**
+     * @return the transactionSuccess
+     */
+    public boolean getTransactionSucceded()
+    {
+        return this.transactionSucceded;
+    }
+    /**
+     * @param transactionSuccess the transactionSuccess to set
+     */
+    public void setTransactionSucceded(boolean transactionSuccess)
+    {
+        this.transactionSucceded = transactionSuccess;
+    }
+    /**
+     * @return the transactionCompleted
+     */
+    public boolean getTransactionCompleted()
+    {
+        return this.transactionCompleted;
+    }
+    /**
+     * @param transactionCompleted the transactionCompleted to set
+     */
+    public void setTransactionCompleted(boolean transactionCompleted)
+    {
+        this.transactionCompleted = transactionCompleted;
+    }
+    
+    public static void clear()
+    {
+        Contexts.getApplicationContext().remove("transactionStatus");
+    }
+    
+    public static TransactionStatus instance()
+    {
+        return (TransactionStatus) Component.getInstance("transactionStatus");
+    }
+    /**
+     * @return the id
+     */
+    public Object getId()
+    {
+        return this.id;
+    }
+    /**
+     * @param id the id to set
+     */
+    public void setId(Object id)
+    {
+        this.id = id;
+    }
+
+}

Copied: branches/enterprise/WFK-2_1/examples/quartz/quartz-ejb/src/test/resources/BaseData.xml (from rev 15540, branches/enterprise/WFK-2_1/examples/quartz/quartz-tests/src/test/resources/BaseData.xml)
===================================================================
--- branches/enterprise/WFK-2_1/examples/quartz/quartz-ejb/src/test/resources/BaseData.xml	                        (rev 0)
+++ branches/enterprise/WFK-2_1/examples/quartz/quartz-ejb/src/test/resources/BaseData.xml	2013-06-04 09:25:36 UTC (rev 15541)
@@ -0,0 +1,38 @@
+<?xml version="1.0"?>
+
+<dataset>
+
+  <ACCOUNT 
+    id="1"
+    accountNumber="23001"
+    balance="1001.46"
+    />
+    
+  <ACCOUNT 
+    id="2"
+    accountNumber="23002"
+    balance="1002.46"
+    />
+  
+  <ACCOUNT 
+    id="3"
+    accountNumber="23003"
+    balance="1003.46"
+    />
+    
+  <ACCOUNT 
+    id="4"
+    accountNumber="23004"
+    balance="1004.46"
+    />
+   
+  <ACCOUNT 
+    id="5"
+    accountNumber="23005"
+    balance="1005.46"
+    />
+    
+  <!-- This causes the payment table to be cleaned every time -->
+  <PAYMENT />
+    
+</dataset>
\ No newline at end of file

Added: branches/enterprise/WFK-2_1/examples/quartz/quartz-ejb/src/test/resources/arquillian.xml
===================================================================
--- branches/enterprise/WFK-2_1/examples/quartz/quartz-ejb/src/test/resources/arquillian.xml	                        (rev 0)
+++ branches/enterprise/WFK-2_1/examples/quartz/quartz-ejb/src/test/resources/arquillian.xml	2013-06-04 09:25:36 UTC (rev 15541)
@@ -0,0 +1,24 @@
+<?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>
+			<!-- These properties are only valid for arquillian managed container, 
+				but don't cause a problem for the remote container, so they can be left in. -->
+			<!-- To use jacoco, set jacoco.agent system property to something like 
+				-javaagent:/path/to/jacocoagent.jar=append=true,destfile=/path/to/output/jacoco.exec -->
+			<property name="javaVmArguments">-Xmx1024m -XX:MaxPermSize=1024m ${jacoco.agent}</property>
+			<property name="serverConfig">standalone.xml</property>
+			<!-- If jbossHome property is not set, the JBOSS_HOME environment variable 
+				is used -->
+			<!--<property name="jbossHome">/path/to/jboss/as</property> -->
+		</configuration>
+	</container>
+
+</arquillian>

Copied: branches/enterprise/WFK-2_1/examples/quartz/quartz-ejb/src/test/resources/components.xml (from rev 15540, branches/enterprise/WFK-2_1/examples/quartz/quartz-tests/src/test/resources/WEB-INF/components.xml)
===================================================================
--- branches/enterprise/WFK-2_1/examples/quartz/quartz-ejb/src/test/resources/components.xml	                        (rev 0)
+++ branches/enterprise/WFK-2_1/examples/quartz/quartz-ejb/src/test/resources/components.xml	2013-06-04 09:25:36 UTC (rev 15541)
@@ -0,0 +1,50 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<components xmlns="http://jboss.org/schema/seam/components"
+            xmlns:pay="http://jboss.org/schema/seam/examples/quartz"
+            xmlns:core="http://jboss.org/schema/seam/core"
+            xmlns:async="http://jboss.org/schema/seam/async"
+            xmlns:framework="http://jboss.org/schema/seam/framework"
+            xmlns:persistence="http://jboss.org/schema/seam/persistence"
+            xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+            xsi:schemaLocation=
+                "http://jboss.org/schema/seam/core http://jboss.org/schema/seam/core-2.3.xsd
+                 http://jboss.org/schema/seam/async http://jboss.org/schema/seam/async-2.3.xsd
+                 http://jboss.org/schema/seam/framework http://jboss.org/schema/seam/framework-2.3.xsd
+                 http://jboss.org/schema/seam/persistence http://jboss.org/schema/seam/persistence-2.3.xsd
+                 http://jboss.org/schema/seam/components http://jboss.org/schema/seam/components-2.3.xsd">
+
+    <pay:payment-home name="paymentHome" 
+                      new-instance="#{newPayment}" 
+                      created-message="Created a new payment to #{newPayment.payee}" />
+
+    <pay:payment name="newPayment" 
+                 payee="Somebody"
+                 account="#{selectedAccount}"
+                 payment-date="#{currentDatetime}"
+                 created-date="#{currentDatetime}" />
+
+    <factory name="selectedAccount" 
+             value="#{accountHome.instance}"/>
+
+    <framework:entity-home name="accountHome" 
+                           entity-class="org.jboss.seam.example.quartz.Account"
+                           entity-manager="#{entityManager}" />
+
+    <framework:entity-query name="accounts" 
+                            ejbql="from Account"
+                            order="accountNumber" 
+                            max-results="20" 
+                            entity-manager="#{entityManager}" />
+        
+    <persistence:managed-persistence-context name="entityManager"
+                                      auto-create="true"
+                                      persistence-unit-jndi-name="java:/seampayEntityManagerFactory" />
+
+    <!-- Install the QuartzDispatcher -->
+    <async:quartz-dispatcher/>
+
+    <core:init debug="true" jndi-pattern="java:app/quartz-ejb/#{ejbName}" />
+
+    <component class="org.jboss.seam.transaction.EjbSynchronizations" jndi-name="java:app/jboss-seam/EjbSynchronizations"/>
+
+</components>

Added: branches/enterprise/WFK-2_1/examples/quartz/quartz-ejb/src/test/resources/ejb-jar.xml
===================================================================
--- branches/enterprise/WFK-2_1/examples/quartz/quartz-ejb/src/test/resources/ejb-jar.xml	                        (rev 0)
+++ branches/enterprise/WFK-2_1/examples/quartz/quartz-ejb/src/test/resources/ejb-jar.xml	2013-06-04 09:25:36 UTC (rev 15541)
@@ -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>

Added: branches/enterprise/WFK-2_1/examples/quartz/quartz-ejb/src/test/resources/import.sql
===================================================================
--- branches/enterprise/WFK-2_1/examples/quartz/quartz-ejb/src/test/resources/import.sql	                        (rev 0)
+++ branches/enterprise/WFK-2_1/examples/quartz/quartz-ejb/src/test/resources/import.sql	2013-06-04 09:25:36 UTC (rev 15541)
@@ -0,0 +1,6 @@
+insert into Account(id, accountNumber, balance) values (1, '23001', 1001.46) 
+insert into Account(id, accountNumber, balance) values (2, '23002', 1002.46) 
+insert into Account(id, accountNumber, balance) values (3, '23003', 1003.46) 
+insert into Account(id, accountNumber, balance) values (4, '23004', 1004.46) 
+insert into Account(id, accountNumber, balance) values (5, '23005', 1005.46) 
+

Added: branches/enterprise/WFK-2_1/examples/quartz/quartz-ejb/src/test/resources/index.html
===================================================================
--- branches/enterprise/WFK-2_1/examples/quartz/quartz-ejb/src/test/resources/index.html	                        (rev 0)
+++ branches/enterprise/WFK-2_1/examples/quartz/quartz-ejb/src/test/resources/index.html	2013-06-04 09:25:36 UTC (rev 15541)
@@ -0,0 +1,5 @@
+<html>
+<head>
+  <meta http-equiv="Refresh" content="0; URL=search.seam">
+</head>
+</html>
\ No newline at end of file

Added: branches/enterprise/WFK-2_1/examples/quartz/quartz-ejb/src/test/resources/jboss-deployment-structure.xml
===================================================================
--- branches/enterprise/WFK-2_1/examples/quartz/quartz-ejb/src/test/resources/jboss-deployment-structure.xml	                        (rev 0)
+++ branches/enterprise/WFK-2_1/examples/quartz/quartz-ejb/src/test/resources/jboss-deployment-structure.xml	2013-06-04 09:25:36 UTC (rev 15541)
@@ -0,0 +1,9 @@
+<jboss-deployment-structure xmlns="urn:jboss:deployment-structure:1.0">
+  <deployment>
+  	  <dependencies>
+          <module name="org.dom4j" export="true"/>
+          <module name="org.apache.commons.collections" export="true"/>
+	      <module name="javax.faces.api" export="true"/>
+	    </dependencies>
+  </deployment>  
+</jboss-deployment-structure> 

Added: branches/enterprise/WFK-2_1/examples/quartz/quartz-ejb/src/test/resources/pages.xml
===================================================================
--- branches/enterprise/WFK-2_1/examples/quartz/quartz-ejb/src/test/resources/pages.xml	                        (rev 0)
+++ branches/enterprise/WFK-2_1/examples/quartz/quartz-ejb/src/test/resources/pages.xml	2013-06-04 09:25:36 UTC (rev 15541)
@@ -0,0 +1,16 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<pages xmlns="http://jboss.org/schema/seam/pages"
+       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+       xsi:schemaLocation="http://jboss.org/schema/seam/pages http://jboss.org/schema/seam/pages-2.3.xsd">
+
+   <page view-id="/search.xhtml">
+          <param name="accountId" value="#{accountHome.id}" converterId="javax.faces.Long" />
+          
+   		<navigation>
+      		<rule if-outcome="persisted">
+         		<render/>
+      		</rule>
+   		</navigation>
+
+	</page>
+</pages>

Added: branches/enterprise/WFK-2_1/examples/quartz/quartz-ejb/src/test/resources/persistence.xml
===================================================================
--- branches/enterprise/WFK-2_1/examples/quartz/quartz-ejb/src/test/resources/persistence.xml	                        (rev 0)
+++ branches/enterprise/WFK-2_1/examples/quartz/quartz-ejb/src/test/resources/persistence.xml	2013-06-04 09:25:36 UTC (rev 15541)
@@ -0,0 +1,16 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<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_2_0.xsd" 
+             version="2.0">
+    <persistence-unit name="userDatabase">
+        <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.show_sql" value="true"/>
+            <property name="jboss.entity.manager.factory.jndi.name" 
+                      value="java:/seampayEntityManagerFactory"/>
+        </properties>
+    </persistence-unit>
+</persistence>

Added: branches/enterprise/WFK-2_1/examples/quartz/quartz-ejb/src/test/resources/seam.properties
===================================================================
Copied: branches/enterprise/WFK-2_1/examples/quartz/quartz-ejb/src/test/resources/seam.quartz.properties (from rev 15540, branches/enterprise/WFK-2_1/examples/quartz/quartz-tests/src/test/resources/seam.quartz.properties)
===================================================================
--- branches/enterprise/WFK-2_1/examples/quartz/quartz-ejb/src/test/resources/seam.quartz.properties	                        (rev 0)
+++ branches/enterprise/WFK-2_1/examples/quartz/quartz-ejb/src/test/resources/seam.quartz.properties	2013-06-04 09:25:36 UTC (rev 15541)
@@ -0,0 +1,9 @@
+org.quartz.scheduler.instanceName = Sched1
+org.quartz.scheduler.instanceId = 1
+org.quartz.scheduler.rmi.export = false
+org.quartz.scheduler.rmi.proxy = false
+
+org.quartz.threadPool.class = org.quartz.simpl.SimpleThreadPool
+org.quartz.threadPool.threadCount = 3
+
+org.quartz.jobStore.class = org.quartz.simpl.RAMJobStore

Added: branches/enterprise/WFK-2_1/examples/quartz/quartz-ejb/src/test/resources/search.xhtml
===================================================================
--- branches/enterprise/WFK-2_1/examples/quartz/quartz-ejb/src/test/resources/search.xhtml	                        (rev 0)
+++ branches/enterprise/WFK-2_1/examples/quartz/quartz-ejb/src/test/resources/search.xhtml	2013-06-04 09:25:36 UTC (rev 15541)
@@ -0,0 +1,177 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml"
+      xmlns:ui="http://java.sun.com/jsf/facelets"
+      xmlns:h="http://java.sun.com/jsf/html"
+      xmlns:f="http://java.sun.com/jsf/core"
+      xmlns:s="http://jboss.org/schema/seam/taglib">
+<head>
+    <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
+    <title>Seam Pay</title>
+    <link href="screen.css" rel="stylesheet" type="text/css" />
+    <link href="date.css" rel="stylesheet" type="text/css" />
+</head>
+<body>
+      
+    <div class="menuButtons">
+        <s:link view="/search.xhtml" value="Show Accounts"/>
+    </div>
+    
+    <div class="body">        
+        <h1>Account</h1>
+        
+        <h:messages styleClass="message"/>
+
+
+        <!-- search results -->
+        <table class="results">
+            <tr>
+                <th>Id</th>
+                <th>Account Number</th>
+                <th>Balance</th>
+            </tr>
+            <ui:repeat id="accountTable" value="#{accounts.resultList}" var="account">
+                <tr>
+                    <td>
+                        <s:link id="link" view="/search.xhtml" value="#{account.id}">
+                            <f:param name="accountId" value="#{account.id}"/>
+                        </s:link>
+                    </td>
+                    <td>#{account.accountNumber}</td>
+                    <td>
+                        <h:outputText id="balance" value="#{account.balance}">
+                            <f:convertNumber type="currency" currencySymbol="$"/> 
+                        </h:outputText>
+                    </td>
+                </tr>
+          </ui:repeat>
+        </table>
+        <h:outputText value="No accounts found" rendered="#{empty accounts.resultList}" styleClass="message"/>
+        
+
+        <f:subview id="accountView" rendered="#{accountHome.idDefined}">
+            <h2>Payments from Account #{accountHome.instance.accountNumber}</h2>
+            <table id="payments" class="results">
+            	<thead>
+	            	<tr>
+	                    <th>Status</th>
+	                    <th>Payee</th>
+	                    <th>Payment Amount</th>
+	                    <th>Created Date</th>
+	                    <th>Scheduled Date</th>
+	                    <th>Cron</th>
+	                    <th>Frequency</th>
+	                    <th>Last Paid On</th>
+	                </tr>
+	           	</thead>
+	           	<tbody>
+	                <ui:repeat value="#{accountHome.instance.payments}" var="payment">
+	                    <tr>
+	                        <td>
+	                            <s:button action="#{paymentHome.cancel}" value="Cancel" rendered="#{payment.active}">
+	                                <f:param name="paymentId" value="#{payment.id}"/>
+	                            </s:button>
+	                            <h:outputText value="not active" rendered="#{!payment.active}" />
+	                        </td>                            
+	                        <td>#{payment.payee}</td>
+	                        <td>
+	                            <h:outputText value="#{payment.amount}">
+	                                <f:convertNumber type="currency" currencySymbol="$"/> 
+	                            </h:outputText>
+	                        </td>
+	                        <td>
+	                            <h:outputText value="#{payment.createdDate}">
+	                                <f:convertDateTime type="date" dateStyle="medium" />
+	                            </h:outputText>
+	                        </td>
+	                        <td>
+	                            <h:outputText value="#{payment.paymentDate}">
+	                                <f:convertDateTime type="date" dateStyle="medium" />
+	                            </h:outputText>
+	                        </td>
+	                        <td>#{payment.paymentCron}</td>
+	                        <td>#{payment.paymentFrequency}</td>
+	                        <td>
+	                            <h:outputText value="#{payment.lastPaid}">
+	                                <f:convertDateTime type="date" dateStyle="medium" />
+	                            </h:outputText>
+	                        </td>
+	                    </tr>
+	                </ui:repeat>
+	        	</tbody>
+            </table>
+
+            <h2>Make a payment from account #{accountHome.instance.accountNumber}:</h2>
+            <h:form id="paymentForm">
+                <s:validateAll>
+                    <table>
+                        <tr>
+                            <td>To:</td>
+                            <td>
+                                <h:inputText id="payee" value="#{newPayment.payee}" required="true"/>
+                            </td>
+                        </tr>
+                        <tr>
+                            <td>Amount:</td>
+                            <td><h:inputText id="amount" value="#{newPayment.amount}" required="true">
+                                <ui:remove>
+                                    <f:convertNumber type="currency" currencySymbol="$"/> 
+                                </ui:remove>
+                            </h:inputText></td>
+                        </tr>
+                        <tr>
+                            <td>Start Date:</td>
+                            <td><h:inputText id="paymentStartDate" value="#{newPayment.paymentDate}" required="true"> 
+                                    <f:convertDateTime pattern="MM/dd/yyyy HH:mm"/>
+                                
+                                </h:inputText>
+
+                                <h:message for="paymentStartDate" />
+                            </td>
+                        </tr>
+                        <tr>
+                            <td>End Date:</td>
+                            <td><h:inputText id="paymentEndDate" value="#{newPayment.paymentEndDate}"> 
+                                    <f:convertDateTime pattern="MM/dd/yyyy HH:mm"/>
+                                
+                                </h:inputText>
+
+                                <h:message for="paymentEndDate" />
+                            </td>
+                        </tr>
+
+                    </table>
+                </s:validateAll>
+
+                <p><b>Now, choose one of the following repeat payment schemes</b></p>
+                <p>Cron: 
+                <h:inputText id="paymentCron" value="#{newPayment.paymentCron}"/><br/> 
+                <h:commandButton id="cronSubmit" value="Schedule Cron Job" 
+                                 action="#{paymentHome.saveAndScheduleCron}" />
+                </p>
+
+                <p>Fixed frequency: 
+                <h:selectOneRadio id="radioList" 
+                                  layout="lineDirection"
+                                  value="#{newPayment.paymentFrequency}">
+<!--                  <f:converter converterId="org.jboss.seam.ui.EnumConverter" />-->
+                  <s:convertEnum />
+                  <s:enumItem enumValue="ONCE"         label="Only Once" />
+                  <s:enumItem enumValue="EVERY_MINUTE" label="Every Minute (testing)" />
+                  <s:enumItem enumValue="HOURLY"       label="Every Hour (testing)" />
+                  <s:enumItem enumValue="DAILY"        label="Every Day" />
+                  <s:enumItem enumValue="WEEKLY"       label="Every Week" />
+                  <ui:remove>
+                    <f:selectItems value="#{newPayment.frequencies}" />
+                  </ui:remove>
+                </h:selectOneRadio><br/>
+                <h:commandButton id="submit" value="Schedule at Fixed Interval" 
+                                 action="#{paymentHome.saveAndSchedule}" />
+                </p>
+                
+            </h:form>
+        </f:subview>
+
+    </div>
+    
+</body>
+</html>

Copied: branches/enterprise/WFK-2_1/examples/quartz/quartz-ejb/src/test/resources/web.xml (from rev 15540, branches/enterprise/WFK-2_1/examples/quartz/quartz-tests/src/test/resources-integration/web.xml)
===================================================================
--- branches/enterprise/WFK-2_1/examples/quartz/quartz-ejb/src/test/resources/web.xml	                        (rev 0)
+++ branches/enterprise/WFK-2_1/examples/quartz/quartz-ejb/src/test/resources/web.xml	2013-06-04 09:25:36 UTC (rev 15541)
@@ -0,0 +1,12 @@
+<?xml version="1.0" ?>
+
+<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.mock.MockSeamListener</listener-class>
+    </listener>
+
+</web-app>

Deleted: branches/enterprise/WFK-2_1/examples/quartz/quartz-tests/pom.xml
===================================================================
--- branches/enterprise/WFK-2_1/examples/quartz/quartz-tests/pom.xml	2013-06-04 07:13:54 UTC (rev 15540)
+++ branches/enterprise/WFK-2_1/examples/quartz/quartz-tests/pom.xml	2013-06-04 09:25:36 UTC (rev 15541)
@@ -1,196 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<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/maven-v4_0_0.xsd">
-    <modelVersion>4.0.0</modelVersion>
-    <parent>
-        <artifactId>quartz</artifactId>
-        <groupId>org.jboss.seam.examples</groupId>
-        <version>2.3.1.Final-redhat-2</version>
-        <relativePath>../pom.xml</relativePath>
-    </parent>
-    
-    <groupId>org.jboss.seam.examples.quartz</groupId>
-    <artifactId>quartz-tests</artifactId>
-    <name>Quartz Integration Tests Module (EE6)</name>
-    
-    <dependencies>
-        <dependency>
-            <groupId>org.testng</groupId>
-            <artifactId>testng</artifactId>
-            
-        </dependency>
-        <dependency>
-            <groupId>org.jboss.seam.examples.quartz</groupId>
-            <artifactId>quartz-ejb</artifactId>
-            <type>ejb</type>
-            <scope>test</scope>
-        </dependency>        
-        <dependency>
-            <groupId>org.jboss.seam</groupId>
-            <artifactId>jboss-seam</artifactId>
-            <type>ejb</type>
-            <scope>test</scope>
-        </dependency>        
-        <dependency>
-            <groupId>org.slf4j</groupId>
-            <artifactId>slf4j-log4j12</artifactId>
-            <scope>test</scope>
-        </dependency>
-        <dependency>
-            <groupId>org.jboss.spec.javax.faces</groupId>
-            <artifactId>jboss-jsf-api_2.1_spec</artifactId>
-        </dependency>
-        <dependency>
-            <groupId>org.hibernate.javax.persistence</groupId>
-            <artifactId>hibernate-jpa-2.0-api</artifactId>
-        </dependency>
-        <dependency>
-            <groupId>org.seleniumhq.selenium</groupId>
-            <artifactId>selenium-server</artifactId>
-        </dependency>
-        <dependency>
-            <groupId>org.seleniumhq.selenium</groupId>
-            <artifactId>selenium-java</artifactId>
-        </dependency>
-        <dependency>
-            <groupId>org.jboss.seam</groupId>
-            <artifactId>functional-tests</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.dbunit</groupId>
-            <artifactId>dbunit</artifactId>
-        </dependency>
-
-        <dependency>
-            <groupId>org.jboss.spec.javax.el</groupId>
-            <artifactId>jboss-el-api_2.2_spec</artifactId>
-        </dependency>
-
-    </dependencies>
-    
-    <build>
-        <testResources>
-            <testResource>
-                <directory>src/test/resources</directory>
-                <filtering>true</filtering>
-            </testResource>
-            <testResource>
-                <directory>src/test/resources-integration</directory>
-            </testResource>
-        </testResources>
-        <plugins>
-            <plugin>
-                <groupId>org.apache.maven.plugins</groupId>
-                <artifactId>maven-surefire-plugin</artifactId>
-                <configuration>
-                    <skip>true</skip>
-                </configuration>
-            </plugin>
-        </plugins>     
-    </build>    
-
-    <profiles>
-
-        <profile>
-            <id>integration-tests</id>
-            <activation>
-                <property>
-                    <name>arquillian</name>
-                </property>
-            </activation>
-        </profile>
-
-        <profile>
-            <id>arq-jbossas-7-managed</id>
-            <activation>
-                <property>
-                    <name>arquillian</name>
-                    <value>jbossas-managed-7</value>
-                </property>
-            </activation>
-            <build>
-                <plugins>
-                    <plugin>
-                        <groupId>org.apache.maven.plugins</groupId>
-                        <artifactId>maven-dependency-plugin</artifactId>
-                    </plugin>
-                </plugins>
-            </build>
-        </profile>
-
-        <profile>
-            <id>arq-jbossas-7-remote</id>
-            <activation>
-                <property>
-                    <name>arquillian</name>
-                    <value>jbossas-remote-7</value>
-                </property>
-            </activation>
-        </profile>
-
-        <profile>
-            <id>ftest-jbossas</id>
-            <properties>
-                <example.context.path>seam-quartz</example.context.path>
-            </properties>
-            <build>
-                <plugins>
-                    <plugin>
-                        <groupId>org.codehaus.mojo</groupId>
-                        <artifactId>selenium-maven-plugin</artifactId>
-                    </plugin>
-                    <plugin>
-                        <groupId>org.codehaus.mojo</groupId>
-                        <artifactId>failsafe-maven-plugin</artifactId>
-                    </plugin>
-                    <plugin>
-                        <groupId>org.apache.maven.plugins</groupId>
-                        <artifactId>maven-antrun-plugin</artifactId>
-                    </plugin>
-                </plugins>
-            </build>
-        </profile>
-        <profile>
-            <id>validate</id>
-            <build>
-                <plugins>
-                    <plugin>
-                        <groupId>org.codehaus.mojo</groupId>
-                        <artifactId>xml-maven-plugin</artifactId>
-                        <executions>
-                            <execution>
-                                <phase>none</phase>
-                            </execution>
-                        </executions>
-                    </plugin>
-                </plugins>
-            </build>
-        </profile>        
-    </profiles>
-    
-</project>

Deleted: branches/enterprise/WFK-2_1/examples/quartz/quartz-tests/src/test/java/org/jboss/seam/example/quartz/test/AccountTest.java
===================================================================
--- branches/enterprise/WFK-2_1/examples/quartz/quartz-tests/src/test/java/org/jboss/seam/example/quartz/test/AccountTest.java	2013-06-04 07:13:54 UTC (rev 15540)
+++ branches/enterprise/WFK-2_1/examples/quartz/quartz-tests/src/test/java/org/jboss/seam/example/quartz/test/AccountTest.java	2013-06-04 09:25:36 UTC (rev 15541)
@@ -1,110 +0,0 @@
-package org.jboss.seam.example.quartz.test;
-
-import java.util.List;
-
-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.example.quartz.Account;
-import org.jboss.seam.example.quartz.Payment;
-import org.jboss.seam.mock.DBJUnitSeamTest;
-import org.jboss.shrinkwrap.api.Archive;
-import org.jboss.shrinkwrap.api.spec.EnterpriseArchive;
-import org.jboss.shrinkwrap.api.spec.WebArchive;
-import org.junit.Test;
-import org.junit.runner.RunWith;
-
-/**
- * 
- * @author Pete Muir
- *
- */
- at RunWith(Arquillian.class)
-public class AccountTest 
-    extends DBJUnitSeamTest 
-{
-    @Deployment(name="AccountTest")
-    @OverProtocol("Servlet 3.0")
-    public static Archive<?> createDeployment()
-    {
-        EnterpriseArchive er = Deployments.quartzDeployment();
-        WebArchive web = er.getAsType(WebArchive.class, "quartz-web.war");
-        web.addClasses(AccountTest.class);
-        return er;
-    }
-    
-    @Override
-    protected void prepareDBUnitOperations() {
-       
-        setDatabase("HSQL");
-        setDatasourceJndiName("java:jboss/datasources/ExampleDS");
-       
-        beforeTestOperations.add(
-                new DataSetOperation("BaseData.xml")
-        );
-    }
-    
-    @Test
-    public void listAccounts() throws Exception 
-    {
-        new FacesRequest("/search.xhtml") 
-        {
-            
-            @Override
-            @SuppressWarnings("unchecked")
-            protected void renderResponse() throws Exception 
-            {
-                List<Account> accounts = (List<Account>) getValue("#{accounts.resultList}");
-                
-                assert accounts.size() == 5;
-            }
-            
-        }.run(); 
-    }
-    
-    @Test
-    public void selectAccount() throws Exception 
-    {        
-        String id = new FacesRequest("/search.xhtml") 
-        {        
-        
-            @Override
-            @SuppressWarnings("unchecked")
-            protected void renderResponse() throws Exception 
-            {
-                assert !((Boolean)getValue("#{accountHome.idDefined}"));
-            }          
-        }.run();
-        
-        new FacesRequest("/search.xhtml", id) 
-        {
-            
-            @Override
-            protected void beforeRequest() 
-            {
-                setParameter("accountId", "1");
-            }
-
-            @Override
-            protected void renderResponse() throws Exception 
-            {
-                assert ((Boolean) getValue("#{accountHome.idDefined}"));
-                
-                Account account = (Account) getValue("#{selectedAccount}");
-                assert account !=null;
-                assert account.getId() == 1;
-                assert account.getPayments().size() == 0;
-               
-                Payment payment = (Payment) getValue("#{newPayment}");
-                assert payment.getPayee().equals("Somebody");
-                assert payment.getAccount() != null;
-                assert payment.getAccount().getId() == 1;
-                
-            }            
-        }.run();
-        
-        
-        
-    }
-    
-}

Deleted: branches/enterprise/WFK-2_1/examples/quartz/quartz-tests/src/test/java/org/jboss/seam/example/quartz/test/AsynchronousTest.java
===================================================================
--- branches/enterprise/WFK-2_1/examples/quartz/quartz-tests/src/test/java/org/jboss/seam/example/quartz/test/AsynchronousTest.java	2013-06-04 07:13:54 UTC (rev 15540)
+++ branches/enterprise/WFK-2_1/examples/quartz/quartz-tests/src/test/java/org/jboss/seam/example/quartz/test/AsynchronousTest.java	2013-06-04 09:25:36 UTC (rev 15541)
@@ -1,130 +0,0 @@
-package org.jboss.seam.example.quartz.test;
-
-import static org.jboss.seam.example.quartz.Payment.Frequency.ONCE;
-
-import java.math.BigDecimal;
-
-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.example.quartz.Account;
-import org.jboss.seam.example.quartz.Payment;
-import org.jboss.seam.mock.DBJUnitSeamTest;
-import org.jboss.shrinkwrap.api.Archive;
-import org.jboss.shrinkwrap.api.spec.EnterpriseArchive;
-import org.jboss.shrinkwrap.api.spec.WebArchive;
-import org.junit.Test;
-import org.junit.runner.RunWith;
-
-/**
- * 
- * @author Pete Muir
- *
- */
-
-// Actually this doesn't happen in the example, but lets test it here to keep
-// all quartz tests in one place
- at RunWith(Arquillian.class)
-public class AsynchronousTest extends DBJUnitSeamTest 
-{
-    @Deployment(name="AsynchronousTest")
-    @OverProtocol("Servlet 3.0")
-    public static Archive<?> createDeployment()
-    {
-        EnterpriseArchive er = Deployments.quartzDeployment();
-        WebArchive web = er.getAsType(WebArchive.class, "quartz-web.war");
-        web.addClasses(AsynchronousTest.class);
-        return er;
-    }
-    
-    @Override
-    protected void prepareDBUnitOperations() {
-       
-        setDatabase("HSQL");
-        setDatasourceJndiName("java:jboss/datasources/ExampleDS");
-       
-        beforeTestOperations.add(
-                new DataSetOperation("BaseData.xml")
-        );
-    }
-      
-    @Test
-    public void testAsynchronous() throws Exception
-    {
-            String id = new FacesRequest("/search.xhtml") 
-            {
-                @Override
-                protected void beforeRequest() 
-                {
-                    setParameter("accountId", "1");
-                }
-                
-                @Override
-                protected void updateModelValues() throws Exception 
-                {
-                    setValue("#{newPayment.payee}", "IRS"); 
-                    setValue("#{newPayment.amount}", new BigDecimal("100.00"));
-                    setValue("#{newPayment.paymentFrequency}", ONCE);
-                }
-    
-                @Override
-                protected void invokeApplication() throws Exception 
-                {
-                    invokeMethod("#{paymentHome.scheduleAndSaveAsynchronously}");
-                }
-    
-                @Override
-                protected void renderResponse() throws Exception 
-                {
-                    assert ((Boolean)getValue("#{accountHome.idDefined}"));                
-                    Account account = (Account) getValue("#{selectedAccount}");                
-                    assert account !=null;
-                    assert account.getId() == 1;
-                    assert account.getPayments().size() == 1;               
-                }
-                
-            }.run();
-            
-            // Wait, let quartz execute the async method which schedules the job
-            // for immediate execution
-            pause(50);
-            
-            new FacesRequest("/search.xhtml", id)
-            {
-    
-                @Override
-                protected void beforeRequest() 
-                {
-                    setParameter("accountId", "1");
-                }
-                
-                @Override
-                protected void renderResponse() throws Exception
-                {
-                    assert ((Boolean)getValue("#{accountHome.idDefined}"));                
-                    Account account = (Account) getValue("#{selectedAccount}");                
-                    assert account !=null;
-                    assert account.getId() == 1;
-                    assert account.getPayments().size() == 1;
-                    Payment payment = account.getPayments().get(0);
-                    assert new BigDecimal("100.00").equals(payment.getAmount());
-                    //assert !payment.getActive();
-                    //assert payment.getLastPaid() != null;
-                    assert new BigDecimal("901.46").equals(account.getBalance());
-                }
-                
-            }.run();
-    }
-
-    
-    private void pause(long ms) {
-        try {
-            Thread.sleep(ms);
-        } catch (InterruptedException e) {
-            
-        }                
-    }
-
-    
-    
-}

Deleted: branches/enterprise/WFK-2_1/examples/quartz/quartz-tests/src/test/java/org/jboss/seam/example/quartz/test/CronTest.java
===================================================================
--- branches/enterprise/WFK-2_1/examples/quartz/quartz-tests/src/test/java/org/jboss/seam/example/quartz/test/CronTest.java	2013-06-04 07:13:54 UTC (rev 15540)
+++ branches/enterprise/WFK-2_1/examples/quartz/quartz-tests/src/test/java/org/jboss/seam/example/quartz/test/CronTest.java	2013-06-04 09:25:36 UTC (rev 15541)
@@ -1,467 +0,0 @@
-package org.jboss.seam.example.quartz.test;
-
-import static org.jboss.seam.example.quartz.Payment.Frequency.EVERY_SECOND;
-
-import java.math.BigDecimal;
-
-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.async.QuartzTriggerHandle;
-import org.jboss.seam.example.quartz.Account;
-import org.jboss.seam.example.quartz.Payment;
-import org.jboss.seam.example.quartz.Payment.Frequency;
-import org.jboss.seam.mock.DBJUnitSeamTest;
-import org.jboss.shrinkwrap.api.Archive;
-import org.jboss.shrinkwrap.api.spec.EnterpriseArchive;
-import org.jboss.shrinkwrap.api.spec.WebArchive;
-import org.junit.Ignore;
-import org.junit.Test;
-import org.junit.runner.RunWith;
-
-/**
- * @author Pete Muir
- * 
- */
- at RunWith(Arquillian.class)
-public class CronTest  extends DBJUnitSeamTest 
-{
-    private QuartzTriggerHandle quartzTriggerHandle;
-    private Long paymentId;
-    
-    private static final Frequency REPEATING = EVERY_SECOND;
-
-    @Deployment(name="CronTest")
-    @OverProtocol("Servlet 3.0")
-    public static Archive<?> createDeployment()
-    {
-        EnterpriseArchive er = Deployments.quartzDeployment();
-        WebArchive web = er.getAsType(WebArchive.class, "quartz-web.war");
-        web.addClasses(CronTest.class);
-        return er;
-    }
-    
-    @Override
-    protected void prepareDBUnitOperations() {
-        setDatabase("HSQL");
-        setDatasourceJndiName("java:jboss/datasources/ExampleDS");
-        
-        beforeTestOperations.add(
-                new DataSetOperation("BaseData.xml")
-        );
-    }
-
-    
-    
-    
-    @Ignore
-    @Test
-    public void scheduleCron() throws Exception
-    {
-                        
-        try
-        {
-            String id = new FacesRequest("/search.xhtml") 
-            {
-                @Override
-                protected void beforeRequest() 
-                {
-                    setParameter("accountId", "1");
-                }
-                
-                @Override
-                protected void updateModelValues() throws Exception 
-                {
-                    setValue("#{newPayment.payee}", "IRS"); 
-                    setValue("#{newPayment.amount}", new BigDecimal("110.00"));
-                    setValue("#{newPayment.paymentCron}", "*/2 * * * * ?" );
-                }
-                
-                @Override
-                protected void invokeApplication() throws Exception 
-                {
-                    // schedule a the repeating job and immediately pause it
-                    // this allows you to carefully control how long the timer
-                    // runs for
-                    assert "persisted".equals(invokeMethod("#{paymentHome.saveAndScheduleCron}"));
-                    Payment payment = (Payment) getValue("#{newPayment}");
-                    quartzTriggerHandle = payment.getQuartzTriggerHandle();
-                    quartzTriggerHandle.pause();
-                }
-    
-                @Override
-                protected void renderResponse() throws Exception 
-                {
-                    // Check the job exists
-                    assert ((Boolean)getValue("#{accountHome.idDefined}"));                
-                    Account account = (Account) getValue("#{selectedAccount}");                
-                    assert account !=null;
-                    assert account.getId() == 1;
-                    assert account.getPayments().size() == 1;            
-                    
-                    Payment payment = (Payment) getValue("#{newPayment}");
-                    assert payment.getPayee().equals("IRS");
-                    assert payment.getAmount().equals(new BigDecimal("110.00"));
-                    assert payment.getAccount() != null;
-                    assert payment.getAccount().getId() == 1;
-                    assert payment.getActive();
-                }
-                
-            }.run();
-            
-            // Start the triggerHandle, wait a lot shorter than the job takes
-            // At this point the job should have executed once exactly
-            quartzTriggerHandle.resume();
-            pause((long) (REPEATING.getInterval() * 0.5));
-            quartzTriggerHandle.pause();
-            
-            new FacesRequest("/search.xhtml", id)
-            {
-    
-                @Override
-                protected void beforeRequest() 
-                {
-                    setParameter("accountId", "1");
-                }
-                
-                @Override
-                protected void renderResponse() throws Exception
-                {
-                    assert ((Boolean)getValue("#{accountHome.idDefined}"));                
-                    Account account = (Account) getValue("#{selectedAccount}");                
-                    assert account !=null;
-                    assert account.getId() == 1;
-                    assert account.getPayments().size() == 1;
-                    Payment payment = account.getPayments().get(0);
-                    assert new BigDecimal("110.00").equals(payment.getAmount());
-                    assert payment.getActive();
-                    assert "*/2 * * * * ?".equals(payment.getPaymentCron());
-                    
-                    assert new BigDecimal("891.46").equals(account.getBalance());
-                }
-                
-            }.run();
-            
-            // Start the triggerHandle, wait until some short time after the 
-            // job triggers once
-            quartzTriggerHandle.resume();
-            pause(2000l);
-            quartzTriggerHandle.pause();
-            
-            
-            new FacesRequest("/search.xhtml", id)
-            {
-    
-                @Override
-                protected void beforeRequest() 
-                {
-                    setParameter("accountId", "1");
-                }
-                
-                @Override
-                protected void renderResponse() throws Exception
-                {
-
-                    // Job should have run twice
-                    assert ((Boolean)getValue("#{accountHome.idDefined}"));                
-                    Account account = (Account) getValue("#{selectedAccount}");
-
-                    assert account !=null;
-                    assert account.getId() == 1;
-                    assert account.getPayments().size() == 1;
-                    Payment payment = account.getPayments().get(0);
-                    assert new BigDecimal("110.00").equals(payment.getAmount());
-                    assert payment.getActive();
-                    assert "*/2 * * * * ?".equals(payment.getPaymentCron());
-                    assert payment.getLastPaid() != null;
-                    assert new BigDecimal("781.46").equals(account.getBalance());
-                    paymentId = payment.getId();
-                }
-                
-            }.run();
-            
-            new FacesRequest("/search.xhtml", id)
-            {
-    
-                @Override
-                protected void beforeRequest() 
-                {
-                    setParameter("accountId", "1");
-                    setParameter("paymentId", paymentId.toString());
-                }
-                
-                @Override
-                protected void invokeApplication() throws Exception
-                {
-                    // Resume the job, then cancel it
-                    quartzTriggerHandle.resume();
-                    invokeMethod("#{paymentHome.cancel}");
-                }
-                
-                @Override
-                protected void renderResponse() throws Exception
-                {
-
-                    assert ((Boolean)getValue("#{accountHome.idDefined}"));                
-                    Account account = (Account) getValue("#{selectedAccount}");
-
-                    assert account !=null;
-                    assert account.getId() == 1;
-                    assert account.getPayments().size() == 1;
-                    Payment payment = account.getPayments().get(0);
-                    assert new BigDecimal("110.00").equals(payment.getAmount());
-                    assert !payment.getActive();
-                    assert payment.getLastPaid() != null;
-                    assert new BigDecimal("781.46").equals(account.getBalance());
-                }
-                
-            }.run();
-            
-            // Wait until some short time after another execution would
-            // have occurred to check it really stops
-            pause(2000l);
-            
-            new FacesRequest("/search.xhtml", id)
-            {
-    
-                @Override
-                protected void beforeRequest() 
-                {
-                    setParameter("accountId", "1");
-                }
-                
-                @Override
-                protected void renderResponse() throws Exception
-                {
-
-                    assert ((Boolean)getValue("#{accountHome.idDefined}"));                
-                    Account account = (Account) getValue("#{selectedAccount}");
-
-                    assert account !=null;
-                    assert account.getId() == 1;
-                    assert new BigDecimal("781.46").equals(account.getBalance());
-                }
-                
-            }.run();
-            
-        }
-        finally
-        {
-            if (quartzTriggerHandle != null)
-            {
-                quartzTriggerHandle.cancel();
-            }
-        }
-    }
-
-    @Ignore
-    @Test
-    public void scheduleCronWithStartAndEndTime() throws Exception
-    {
-                        
-        try
-        {
-            String id = new FacesRequest("/search.xhtml") 
-            {
-                @Override
-                protected void beforeRequest() 
-                {
-                    setParameter("accountId", "1");
-                }
-                
-                @Override
-                protected void updateModelValues() throws Exception 
-                {
-                    setValue("#{newPayment.payee}", "IRS"); 
-                    setValue("#{newPayment.amount}", new BigDecimal("110.00"));
-                    setValue("#{newPayment.paymentCron}", "*/2 * * * * ?" );
-                }
-                
-                @Override
-                protected void invokeApplication() throws Exception 
-                {
-                    // schedule a the repeating job and immediately pause it
-                    // this allows you to carefully control how long the timer
-                    // runs for
-                    Payment payment = (Payment) getValue("#{newPayment}");
-                    payment.setPaymentDate(new java.sql.Timestamp( System.currentTimeMillis() + REPEATING.getInterval()));
-                    payment.setPaymentEndDate(new java.sql.Timestamp( (long) (System.currentTimeMillis() + (REPEATING.getInterval() * 4.5))));
-                    assert "persisted".equals(invokeMethod("#{paymentHome.saveAndScheduleCron}"));
-                    quartzTriggerHandle = payment.getQuartzTriggerHandle();
-                    quartzTriggerHandle.pause();
-                }
-    
-                @Override
-                protected void renderResponse() throws Exception 
-                {
-                    // Check the job exists
-                    assert ((Boolean)getValue("#{accountHome.idDefined}"));                
-                    Account account = (Account) getValue("#{selectedAccount}");                
-                    assert account !=null;
-                    assert account.getId() == 1;
-                    assert account.getPayments().size() == 1;            
-                    
-                    Payment payment = (Payment) getValue("#{newPayment}");
-                    assert payment.getPayee().equals("IRS");
-                    assert payment.getAmount().equals(new BigDecimal("110.00"));
-                    assert payment.getAccount() != null;
-                    assert payment.getAccount().getId() == 1;
-                    assert payment.getActive();
-                }
-                
-            }.run();
-            
-            // Start the triggerHandle, wait a lot shorter than the job takes
-            // At this point the job should have executed once exactly
-            quartzTriggerHandle.resume();
-            pause((long) (REPEATING.getInterval() * 0.5));
-            quartzTriggerHandle.pause();
-            
-            new FacesRequest("/search.xhtml", id)
-            {
-    
-                @Override
-                protected void beforeRequest() 
-                {
-                    setParameter("accountId", "1");
-                }
-                
-                @Override
-                protected void renderResponse() throws Exception
-                {
-                    assert ((Boolean)getValue("#{accountHome.idDefined}"));                
-                    Account account = (Account) getValue("#{selectedAccount}");                
-                    assert account !=null;
-                    assert account.getId() == 1;
-                    assert account.getPayments().size() == 1;
-                    Payment payment = account.getPayments().get(0);
-                    assert new BigDecimal("110.00").equals(payment.getAmount());
-                    assert payment.getActive();
-                    assert "*/2 * * * * ?".equals(payment.getPaymentCron());
-                    
-                    assert new BigDecimal("1001.46").equals(account.getBalance());
-                }
-                
-            }.run();
-            
-            // Start the triggerHandle, wait until some short time after the initial
-            // expiration
-            quartzTriggerHandle.resume();
-            pause(REPEATING.getInterval());
-            quartzTriggerHandle.pause();
-            
-            
-            new FacesRequest("/search.xhtml", id)
-            {
-    
-                @Override
-                protected void beforeRequest() 
-                {
-                    setParameter("accountId", "1");
-                }
-                
-                @Override
-                protected void renderResponse() throws Exception
-                {
-
-                    // Job should have run twice
-                    assert ((Boolean)getValue("#{accountHome.idDefined}"));                
-                    Account account = (Account) getValue("#{selectedAccount}");
-
-                    assert account !=null;
-                    assert account.getId() == 1;
-                    assert account.getPayments().size() == 1;
-                    Payment payment = account.getPayments().get(0);
-                    assert new BigDecimal("110.00").equals(payment.getAmount());
-                    assert payment.getActive();
-                    assert "*/2 * * * * ?".equals(payment.getPaymentCron());
-                    assert new BigDecimal("891.46").equals(account.getBalance());
-                    paymentId = payment.getId();
-                }
-                
-            }.run();
-            
-            // Start the triggerHandle, wait until some short time after the 
-            // job triggers once
-            quartzTriggerHandle.resume();
-            pause(2000l);
-            
-            new FacesRequest("/search.xhtml", id)
-            {
-    
-                @Override
-                protected void beforeRequest() 
-                {
-                    setParameter("accountId", "1");
-                }
-                
-                @Override
-                protected void renderResponse() throws Exception
-                {
-
-                    // Job should have run twice
-                    assert ((Boolean)getValue("#{accountHome.idDefined}"));                
-                    Account account = (Account) getValue("#{selectedAccount}");
-
-                    assert account !=null;
-                    assert account.getId() == 1;
-                    assert account.getPayments().size() == 1;
-                    Payment payment = account.getPayments().get(0);
-                    assert new BigDecimal("110.00").equals(payment.getAmount());
-                    assert payment.getActive();
-                    assert "*/2 * * * * ?".equals(payment.getPaymentCron());
-                    assert payment.getLastPaid() != null;
-                    assert new BigDecimal("781.46").equals(account.getBalance());
-                    paymentId = payment.getId();
-                }
-                
-            }.run();
-                          
-            // Wait until some short time after another execution would
-            // have occurred to check it really stops
-            pause(2000l);
-            
-            new FacesRequest("/search.xhtml", id)
-            {
-    
-                @Override
-                protected void beforeRequest() 
-                {
-                    setParameter("accountId", "1");
-                }
-                
-                @Override
-                protected void renderResponse() throws Exception
-                {
-
-                    assert ((Boolean)getValue("#{accountHome.idDefined}"));                
-                    Account account = (Account) getValue("#{selectedAccount}");
-
-                    assert account !=null;
-                    assert account.getId() == 1;
-                    assert new BigDecimal("781.46").equals(account.getBalance());
-                }
-                
-            }.run();
-            
-        }
-        finally
-        {
-            if (quartzTriggerHandle != null)
-            {
-                quartzTriggerHandle.cancel();
-            }
-        }
-    }
-    
-    private void pause(long ms) {
-        try {
-            Thread.sleep(ms);
-        } catch (InterruptedException e) {
-            
-        }                
-    }
-
-    
-    
-}

Deleted: branches/enterprise/WFK-2_1/examples/quartz/quartz-tests/src/test/java/org/jboss/seam/example/quartz/test/Deployments.java
===================================================================
--- branches/enterprise/WFK-2_1/examples/quartz/quartz-tests/src/test/java/org/jboss/seam/example/quartz/test/Deployments.java	2013-06-04 07:13:54 UTC (rev 15540)
+++ branches/enterprise/WFK-2_1/examples/quartz/quartz-tests/src/test/java/org/jboss/seam/example/quartz/test/Deployments.java	2013-06-04 09:25:36 UTC (rev 15541)
@@ -1,38 +0,0 @@
-package org.jboss.seam.example.quartz.test;
-
-import org.jboss.shrinkwrap.api.ShrinkWrap;
-import org.jboss.shrinkwrap.api.importer.ZipImporter;
-import org.jboss.shrinkwrap.api.spec.EnterpriseArchive;
-import org.jboss.shrinkwrap.api.spec.JavaArchive;
-import org.jboss.shrinkwrap.api.spec.WebArchive;
-import org.jboss.shrinkwrap.resolver.api.DependencyResolvers;
-import org.jboss.shrinkwrap.resolver.api.maven.MavenDependencyResolver;
-
-import java.io.File;
-
-public class Deployments {
-    public static EnterpriseArchive quartzDeployment() {
-        EnterpriseArchive ear = ShrinkWrap.create(ZipImporter.class, "seam-quartz.ear").importFrom(new File("../quartz-ear/target/seam-quartz.ear"))
-              .as(EnterpriseArchive.class);
-
-        // Install org.jboss.seam.mock.MockSeamListener
-        WebArchive web = ear.getAsType(WebArchive.class, "quartz-web.war");
-        web.delete("/WEB-INF/web.xml");
-        web.addAsWebInfResource("web.xml");
-        
-        web.addAsResource("BaseData.xml", "BaseData.xml");
-        
-        web.delete("/WEB-INF/components.xml");
-        web.addAsWebInfResource("WEB-INF/components.xml", "components.xml");
-        
-        JavaArchive ejb =  ear.getAsType(JavaArchive.class, "quartz-ejb.jar");
-        ejb.addClasses(TestPaymentController.class, TestPaymentProcessor.class, TransactionStatus.class);
-        
-        ear.addAsLibraries(DependencyResolvers.use(MavenDependencyResolver.class)
-              .configureFrom("pom.xml")
-              .artifact("org.dbunit:dbunit:jar:2.2")
-              .resolveAsFiles());
-
-        return ear;
-    }
-}

Deleted: branches/enterprise/WFK-2_1/examples/quartz/quartz-tests/src/test/java/org/jboss/seam/example/quartz/test/EventsTest.java
===================================================================
--- branches/enterprise/WFK-2_1/examples/quartz/quartz-tests/src/test/java/org/jboss/seam/example/quartz/test/EventsTest.java	2013-06-04 07:13:54 UTC (rev 15540)
+++ branches/enterprise/WFK-2_1/examples/quartz/quartz-tests/src/test/java/org/jboss/seam/example/quartz/test/EventsTest.java	2013-06-04 09:25:36 UTC (rev 15541)
@@ -1,274 +0,0 @@
-package org.jboss.seam.example.quartz.test;
-
-import static org.jboss.seam.example.quartz.Payment.Frequency.ONCE;
-
-import java.math.BigDecimal;
-
-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.example.quartz.Account;
-import org.jboss.seam.example.quartz.Payment;
-import org.jboss.seam.mock.DBJUnitSeamTest;
-import org.jboss.shrinkwrap.api.Archive;
-import org.jboss.shrinkwrap.api.spec.EnterpriseArchive;
-import org.jboss.shrinkwrap.api.spec.WebArchive;
-import org.junit.Test;
-import org.junit.runner.RunWith;
-
-/**
- * 
- * @author Pete Muir
- *
- */
-
-// Actually this doesn't happen in the example, but lets test it here to keep
-// all quartz tests in one place
- at RunWith(Arquillian.class)
-public class EventsTest extends DBJUnitSeamTest 
-{
-    @Deployment(name="EventsTest")
-    @OverProtocol("Servlet 3.0")
-    public static Archive<?> createDeployment()
-    {
-        EnterpriseArchive er = Deployments.quartzDeployment();
-        WebArchive web = er.getAsType(WebArchive.class, "quartz-web.war");
-        web.addClasses(EventsTest.class);
-        return er;
-    }
-   
-    @Override
-    protected void prepareDBUnitOperations() {
-        setDatabase("HSQL");
-        setDatasourceJndiName("java:jboss/datasources/ExampleDS");
-        
-        beforeTestOperations.add(
-                new DataSetOperation("BaseData.xml")
-        );
-    }
-
-    @Test
-    public void testAsynchronousEvent() throws Exception
-    {
-            String id = new FacesRequest("/search.xhtml") 
-            {
-                @Override
-                protected void beforeRequest() 
-                {
-                    setParameter("accountId", "1");
-                }
-                
-                @Override
-                protected void updateModelValues() throws Exception 
-                {
-                    setValue("#{newPayment.payee}", "IRS"); 
-                    setValue("#{newPayment.amount}", new BigDecimal("110.00"));
-                    setValue("#{newPayment.paymentFrequency}", ONCE);
-                }
-    
-                @Override
-                protected void invokeApplication() throws Exception 
-                {
-                    invokeMethod("#{paymentHome.scheduleAndSaveUsingAsynchronousEvent}");
-                }
-    
-                @Override
-                protected void renderResponse() throws Exception 
-                {
-                    assert ((Boolean)getValue("#{accountHome.idDefined}"));                
-                    Account account = (Account) getValue("#{selectedAccount}");                
-                    assert account !=null;
-                    assert account.getId() == 1;
-                    assert account.getPayments().size() == 1;               
-                }
-                
-            }.run();
-            
-            // Wait, let quartz execute the async method which schedules the job
-            // for immediate execution
-            pause(50);
-            
-            new FacesRequest("/search.xhtml", id)
-            {
-    
-                @Override
-                protected void beforeRequest() 
-                {
-                    setParameter("accountId", "1");
-                }
-                
-                @Override
-                protected void renderResponse() throws Exception
-                {
-                    System.out.println("running renderResponse");
-                    assert ((Boolean)getValue("#{accountHome.idDefined}"));                
-                    Account account = (Account) getValue("#{selectedAccount}");                
-                    assert account !=null;
-                    assert account.getId() == 1;
-                    assert account.getPayments().size() == 1;
-                    Payment payment = account.getPayments().get(0);
-                    assert new BigDecimal("110.00").equals(payment.getAmount());
-                    //assert !payment.getActive();
-                    //assert payment.getLastPaid() != null;
-                    assert new BigDecimal("891.46").equals(account.getBalance());
-                }
-                
-            }.run();
-    }
-
-    
-    @Test
-    public void testTransactionSuccessEvents() throws Exception
-    {
-            String id = new FacesRequest("/search.xhtml") 
-            {
-                @Override
-                protected void beforeRequest() 
-                {
-                    setParameter("accountId", "1");
-                }
-                
-                @Override
-                protected void updateModelValues() throws Exception 
-                {
-                    setValue("#{newPayment.payee}", "IRS"); 
-                    setValue("#{newPayment.amount}", new BigDecimal("110.00"));
-                    setValue("#{newPayment.paymentFrequency}", ONCE);
-                }
-    
-                @Override
-                protected void invokeApplication() throws Exception 
-                {
-                    invokeMethod("#{paymentHome.scheduleAndSaveWithTransactionEvents}");
-                }
-    
-                @Override
-                protected void renderResponse() throws Exception 
-                {
-                    assert ((Boolean)getValue("#{accountHome.idDefined}"));                
-                    Account account = (Account) getValue("#{selectedAccount}");                
-                    assert account !=null;
-                    assert account.getId() == 1;
-                    assert account.getPayments().size() == 1;               
-                }
-                
-            }.run();
-            
-            // Wait, let quartz execute the async method which schedules the job
-            // for immediate execution
-            pause(50);
-            
-            new FacesRequest("/search.xhtml", id)
-            {
-    
-                @Override
-                protected void beforeRequest() 
-                {
-                    setParameter("accountId", "1");
-                }
-                
-                @Override
-                protected void renderResponse() throws Exception
-                {
-                    System.out.println("running renderResponse");
-                    assert ((Boolean)getValue("#{accountHome.idDefined}"));                
-                    Account account = (Account) getValue("#{selectedAccount}");                
-                    assert account !=null;
-                    assert account.getId() == 1;
-                    assert account.getPayments().size() == 1;
-                    Payment payment = account.getPayments().get(0);
-                    assert new BigDecimal("110.00").equals(payment.getAmount());
-                    //assert !payment.getActive();
-                    //assert payment.getLastPaid() != null;
-                    assert new BigDecimal("891.46").equals(account.getBalance());
-                    assert (Boolean) getValue("#{transactionStatus.transactionCompleted}");
-                    assert (Boolean) getValue("#{transactionStatus.transactionSucceded}"); 
-                    assert payment.getId().equals(getValue("#{transactionStatus.id}"));
-                }
-                
-            }.run();
-    }
-    
-    @Test
-    public void testTimedEvent() throws Exception
-    {
-            String id = new FacesRequest("/search.xhtml") 
-            {
-                @Override
-                protected void beforeRequest() 
-                {
-                    setParameter("accountId", "1");
-                }
-                
-                @Override
-                protected void updateModelValues() throws Exception 
-                {
-                    setValue("#{newPayment.payee}", "IRS"); 
-                    setValue("#{newPayment.amount}", new BigDecimal("120.00"));
-                    setValue("#{newPayment.paymentFrequency}", ONCE);
-                }
-    
-                @Override
-                protected void invokeApplication() throws Exception 
-                {
-                    invokeMethod("#{paymentHome.scheduleAndSaveUsingTimedEvent}");
-                }
-    
-                @Override
-                protected void renderResponse() throws Exception 
-                {
-		    Thread.sleep(1000);
-                    assert ((Boolean)getValue("#{accountHome.idDefined}"));                
-                    Account account = (Account) getValue("#{selectedAccount}");                
-                    assert account !=null;
-                    assert account.getId() == 1;
-                    assert account.getPayments().size() == 1;               
-                }
-                
-            }.run();
-            
-            // Wait, let quartz execute the async method which schedules the job
-            // for immediate execution
-            pause(1000l);
-            
-            new FacesRequest("/search.xhtml", id)
-            {
-    
-                @Override
-                protected void beforeRequest() 
-                {
-                    setParameter("accountId", "1");
-                }
-                
-                @Override
-                protected void renderResponse() throws Exception
-                {
-                    System.out.println("running renderResponse");
-                    assert ((Boolean)getValue("#{accountHome.idDefined}"));                
-                    Account account = (Account) getValue("#{selectedAccount}");                
-                    assert account != null;
-                    assert account.getId() == 1;
-                    assert account.getPayments().size() == 1;
-                    Payment payment = account.getPayments().get(0);
-                    assert new BigDecimal("120.00").equals(payment.getAmount()) : "Invalid payment amount: " + payment.getAmount();
-                    //assert !payment.getActive();
-                    //assert payment.getLastPaid() != null;
-                    assert new BigDecimal("881.46").equals(account.getBalance()) : "Invalid account balance: " + account.getBalance();
-                }
-                
-            }.run();
-    }
-
-    
-    
-    private void pause(long ms) {
-        try {
-            Thread.sleep(ms);
-        } catch (InterruptedException e) {
-            
-        }                
-    }
-
-    
-    
-}

Deleted: branches/enterprise/WFK-2_1/examples/quartz/quartz-tests/src/test/java/org/jboss/seam/example/quartz/test/OnceTest.java
===================================================================
--- branches/enterprise/WFK-2_1/examples/quartz/quartz-tests/src/test/java/org/jboss/seam/example/quartz/test/OnceTest.java	2013-06-04 07:13:54 UTC (rev 15540)
+++ branches/enterprise/WFK-2_1/examples/quartz/quartz-tests/src/test/java/org/jboss/seam/example/quartz/test/OnceTest.java	2013-06-04 09:25:36 UTC (rev 15541)
@@ -1,151 +0,0 @@
-package org.jboss.seam.example.quartz.test;
-
-import static org.jboss.seam.example.quartz.Payment.Frequency.ONCE;
-
-import java.math.BigDecimal;
-
-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.async.QuartzTriggerHandle;
-import org.jboss.seam.example.quartz.Account;
-import org.jboss.seam.example.quartz.Payment;
-import org.jboss.seam.mock.DBJUnitSeamTest;
-import org.jboss.shrinkwrap.api.Archive;
-import org.jboss.shrinkwrap.api.spec.EnterpriseArchive;
-import org.jboss.shrinkwrap.api.spec.WebArchive;
-import org.junit.Ignore;
-import org.junit.Test;
-import org.junit.runner.RunWith;
-
-/**
- * 
- * @author Pete Muir
- *
- */
- at RunWith(Arquillian.class)
-public class OnceTest extends DBJUnitSeamTest 
-{
-    @Deployment(name="OnceTest")
-    @OverProtocol("Servlet 3.0")
-    public static Archive<?> createDeployment()
-    {
-        EnterpriseArchive er = Deployments.quartzDeployment();
-        WebArchive web = er.getAsType(WebArchive.class, "quartz-web.war");
-        web.addClasses(OnceTest.class);
-        return er;
-    }
-   
-    private QuartzTriggerHandle quartzTriggerHandle;
-    
-    @Override
-    protected void prepareDBUnitOperations() {
-        setDatabase("HSQL");
-        setDatasourceJndiName("java:jboss/datasources/ExampleDS");
-        
-        beforeTestOperations.add(
-                new DataSetOperation("BaseData.xml")
-        );
-    }
-    
-   
-    
-    @Test
-    @Ignore
-    public void scheduleOnce() throws Exception
-    {
-        try
-        {
-            String id = new FacesRequest("/search.xhtml") 
-            {
-                @Override
-                protected void beforeRequest() 
-                {
-                    setParameter("accountId", "1");
-                }
-                
-                @Override
-                protected void updateModelValues() throws Exception 
-                {
-                    setValue("#{newPayment.payee}", "IRS"); 
-                    setValue("#{newPayment.amount}", new BigDecimal("100.00"));
-                    setValue("#{newPayment.paymentFrequency}", ONCE);
-                }
-    
-                @Override
-                protected void invokeApplication() throws Exception 
-                {
-                    assert "persisted".equals(invokeMethod("#{paymentHome.saveAndSchedule}"));
-                }
-    
-                @Override
-                protected void renderResponse() throws Exception 
-                {
-                    assert ((Boolean)getValue("#{accountHome.idDefined}"));                
-                    Account account = (Account) getValue("#{selectedAccount}");                
-                    assert account !=null;
-                    assert account.getId() == 1;
-                    assert account.getPayments().size() == 1;               
-                    
-                    Payment payment = (Payment) getValue("#{newPayment}");
-                    assert payment.getPayee().equals("IRS");
-                    assert payment.getAmount().equals(new BigDecimal("100.00"));
-                    assert payment.getAccount() != null;
-                    assert payment.getAccount().getId() == 1;
-                    quartzTriggerHandle = payment.getQuartzTriggerHandle();
-                }
-                
-            }.run();
-            
-            // Wait, let quartz execute the job (async but straight away)
-            pause(500);
-            
-            new FacesRequest("/search.xhtml", id)
-            {
-    
-                @Override
-                protected void beforeRequest() 
-                {
-                    setParameter("accountId", "1");
-                }
-                
-                @Override
-                protected void renderResponse() throws Exception
-                {
-                    assert ((Boolean)getValue("#{accountHome.idDefined}"));                
-                    Account account = (Account) getValue("#{selectedAccount}");                
-                    assert account !=null;
-                    assert account.getId() == 1;
-                    assert account.getPayments().size() == 1;
-                    Payment payment = account.getPayments().get(0);
-                    assert new BigDecimal("100.00").equals(payment.getAmount());
-                    assert !payment.getActive();
-                    assert ONCE.equals(payment.getPaymentFrequency());
-                    assert payment.getLastPaid() != null;
-                    assert new BigDecimal("901.46").equals(account.getBalance());
-                }
-                
-            }.run();
-        }
-        finally
-        {
-            // Always cancel the job
-            if (quartzTriggerHandle != null)
-            {
-                quartzTriggerHandle.cancel();
-                quartzTriggerHandle = null;
-            }
-        }
-    }
-    
-    private void pause(long ms) {
-        try {
-            Thread.sleep(ms);
-        } catch (InterruptedException e) {
-            
-        }                
-    }
-
-    
-    
-}

Deleted: branches/enterprise/WFK-2_1/examples/quartz/quartz-tests/src/test/java/org/jboss/seam/example/quartz/test/RepeatingTest.java
===================================================================
--- branches/enterprise/WFK-2_1/examples/quartz/quartz-tests/src/test/java/org/jboss/seam/example/quartz/test/RepeatingTest.java	2013-06-04 07:13:54 UTC (rev 15540)
+++ branches/enterprise/WFK-2_1/examples/quartz/quartz-tests/src/test/java/org/jboss/seam/example/quartz/test/RepeatingTest.java	2013-06-04 09:25:36 UTC (rev 15541)
@@ -1,468 +0,0 @@
-package org.jboss.seam.example.quartz.test;
-
-import static org.jboss.seam.example.quartz.Payment.Frequency.EVERY_SECOND;
-
-import java.math.BigDecimal;
-
-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.async.QuartzTriggerHandle;
-import org.jboss.seam.example.quartz.Account;
-import org.jboss.seam.example.quartz.Payment;
-import org.jboss.seam.example.quartz.Payment.Frequency;
-import org.jboss.seam.mock.DBJUnitSeamTest;
-import org.jboss.shrinkwrap.api.Archive;
-import org.jboss.shrinkwrap.api.spec.EnterpriseArchive;
-import org.jboss.shrinkwrap.api.spec.WebArchive;
-import org.junit.Test;
-import org.junit.runner.RunWith;
-
-/**
- * 
- * @author Pete Muir
- *
- */
- at RunWith(Arquillian.class)
-public class RepeatingTest 
-    extends DBJUnitSeamTest 
-{
-    @Deployment(name="RepeatingTest")
-    @OverProtocol("Servlet 3.0")
-    public static Archive<?> createDeployment()
-    {
-        EnterpriseArchive er = Deployments.quartzDeployment();
-        WebArchive web = er.getAsType(WebArchive.class, "quartz-web.war");
-        web.addClasses(RepeatingTest.class);
-        return er;
-    }
-    
-    private QuartzTriggerHandle quartzTriggerHandle;
-    private Long paymentId;
-    
-    private static final Frequency REPEATING = EVERY_SECOND;
-
-    
-    @Override
-    protected void prepareDBUnitOperations() {
-        setDatabase("HSQL");
-        setDatasourceJndiName("java:jboss/datasources/ExampleDS");
-       
-        beforeTestOperations.add(
-                new DataSetOperation("BaseData.xml")
-        );
-    }
-    
-    
-    @Test
-    public void scheduleRepeating() throws Exception
-    {
-                        
-        try
-        {
-            String id = new FacesRequest("/search.xhtml") 
-            {
-                @Override
-                protected void beforeRequest() 
-                {
-                    setParameter("accountId", "1");
-                }
-                
-                @Override
-                protected void updateModelValues() throws Exception 
-                {
-                    setValue("#{newPayment.payee}", "IRS"); 
-                    setValue("#{newPayment.amount}", new BigDecimal("110.00"));
-                    setValue("#{newPayment.paymentFrequency}", REPEATING );
-                }
-                
-                @Override
-                protected void invokeApplication() throws Exception 
-                {
-                    // schedule a the repeating job and immediately pause it
-                    // this allows you to carefully control how long the timer
-                    // runs for
-                    assert "persisted".equals(invokeMethod("#{paymentHome.saveAndSchedule}"));
-                    Payment payment = (Payment) getValue("#{newPayment}");
-                    quartzTriggerHandle = payment.getQuartzTriggerHandle();
-                    quartzTriggerHandle.pause();
-                }
-    
-                @Override
-                protected void renderResponse() throws Exception 
-                {
-                    // Check the job exists
-                    assert ((Boolean)getValue("#{accountHome.idDefined}"));                
-                    Account account = (Account) getValue("#{selectedAccount}");                
-                    assert account !=null;
-                    assert account.getId() == 1;
-                    assert account.getPayments().size() == 1;            
-                    
-                    Payment payment = (Payment) getValue("#{newPayment}");
-                    assert payment.getPayee().equals("IRS");
-                    assert payment.getAmount().equals(new BigDecimal("110.00"));
-                    assert payment.getAccount() != null;
-                    assert payment.getAccount().getId() == 1;
-                    assert payment.getActive();
-                }
-                
-            }.run();
-            
-            // Start the triggerHandle, wait a lot shorter than the job takes
-            // At this point the job should have executed once exactly
-            quartzTriggerHandle.resume();
-            pause((long) (REPEATING.getInterval() * 0.1));
-            quartzTriggerHandle.pause();
-            
-            new FacesRequest("/search.xhtml", id)
-            {
-    
-                @Override
-                protected void beforeRequest() 
-                {
-                    setParameter("accountId", "1");
-                }
-                
-                @Override
-                protected void renderResponse() throws Exception
-                {
-                    assert ((Boolean)getValue("#{accountHome.idDefined}"));                
-                    Account account = (Account) getValue("#{selectedAccount}");                
-                    assert account !=null;
-                    assert account.getId() == 1;
-                    assert account.getPayments().size() == 1;
-                    Payment payment = account.getPayments().get(0);
-                    assert new BigDecimal("110.00").equals(payment.getAmount());
-                    assert payment.getActive();
-                    assert REPEATING.equals(payment.getPaymentFrequency());
-                    
-                    assert new BigDecimal("891.46").equals(account.getBalance());
-                }
-                
-            }.run();
-            
-            // Start the triggerHandle, wait until some short time after the 
-            // job triggers once
-            quartzTriggerHandle.resume();
-            pause(REPEATING.getInterval());
-            quartzTriggerHandle.pause();
-            
-            
-            new FacesRequest("/search.xhtml", id)
-            {
-    
-                @Override
-                protected void beforeRequest() 
-                {
-                    setParameter("accountId", "1");
-                }
-                
-                @Override
-                protected void renderResponse() throws Exception
-                {
-
-                    // Job should have run twice
-                    assert ((Boolean)getValue("#{accountHome.idDefined}"));                
-                    Account account = (Account) getValue("#{selectedAccount}");
-
-                    assert account !=null;
-                    assert account.getId() == 1;
-                    assert account.getPayments().size() == 1;
-                    Payment payment = account.getPayments().get(0);
-                    assert new BigDecimal("110.00").equals(payment.getAmount());
-                    assert payment.getActive();
-                    assert REPEATING.equals(payment.getPaymentFrequency());
-                    assert payment.getLastPaid() != null;
-                    assert new BigDecimal("781.46").equals(account.getBalance());
-                    paymentId = payment.getId();
-                }
-                
-            }.run();
-            
-            new FacesRequest("/search.xhtml", id)
-            {
-    
-                @Override
-                protected void beforeRequest() 
-                {
-                    setParameter("accountId", "1");
-                    setParameter("paymentId", paymentId.toString());
-                }
-                
-                @Override
-                protected void invokeApplication() throws Exception
-                {
-                    // Resume the job, then cancel it
-                    quartzTriggerHandle.resume();
-                    invokeMethod("#{paymentHome.cancel}");
-                }
-                
-                @Override
-                protected void renderResponse() throws Exception
-                {
-
-                    assert ((Boolean)getValue("#{accountHome.idDefined}"));                
-                    Account account = (Account) getValue("#{selectedAccount}");
-
-                    assert account !=null;
-                    assert account.getId() == 1;
-                    assert account.getPayments().size() == 1;
-                    Payment payment = account.getPayments().get(0);
-                    assert new BigDecimal("110.00").equals(payment.getAmount());
-                    assert !payment.getActive();
-                    assert payment.getLastPaid() != null;
-                    assert new BigDecimal("781.46").equals(account.getBalance());
-                }
-                
-            }.run();
-            
-            // Wait until some short time after another execution would
-            // have occurred to check it really stops
-            pause((long) (REPEATING.getInterval() * 1.05));
-            
-            new FacesRequest("/search.xhtml", id)
-            {
-    
-                @Override
-                protected void beforeRequest() 
-                {
-                    setParameter("accountId", "1");
-                }
-                
-                @Override
-                protected void renderResponse() throws Exception
-                {
-
-                    assert ((Boolean)getValue("#{accountHome.idDefined}"));                
-                    Account account = (Account) getValue("#{selectedAccount}");
-
-                    assert account !=null;
-                    assert account.getId() == 1;
-                    assert new BigDecimal("781.46").equals(account.getBalance());
-                }
-                
-            }.run();
-            
-        }
-        finally
-        {
-            if (quartzTriggerHandle != null)
-            {
-                quartzTriggerHandle.cancel();
-            }
-        }
-    }
-    
-    
-    
-    @Test
-    public void scheduleRepeatingWithStartAndEndTime() throws Exception
-    {
-                        
-        try
-        {
-            String id = new FacesRequest("/search.xhtml") 
-            {
-                @Override
-                protected void beforeRequest() 
-                {
-                    setParameter("accountId", "1");
-                }
-                
-                @Override
-                protected void updateModelValues() throws Exception 
-                {
-                    setValue("#{newPayment.payee}", "IRS"); 
-                    setValue("#{newPayment.amount}", new BigDecimal("110.00"));
-                    setValue("#{newPayment.paymentFrequency}", REPEATING );
-                }
-                
-                @Override
-                protected void invokeApplication() throws Exception 
-                {
-                    // schedule a the repeating job and immediately pause it
-                    // this allows you to carefully control how long the timer
-                    // runs for
-                    Payment payment = (Payment) getValue("#{newPayment}");
-                    payment.setPaymentDate(new java.sql.Timestamp( System.currentTimeMillis() + REPEATING.getInterval()));
-                    payment.setPaymentEndDate(new java.sql.Timestamp( (long) (System.currentTimeMillis() + (REPEATING.getInterval() * 2.5))));
-                    assert "persisted".equals(invokeMethod("#{paymentHome.saveAndSchedule}")); 
-                    quartzTriggerHandle = payment.getQuartzTriggerHandle();
-                    quartzTriggerHandle.pause();
-                }
-    
-                @Override
-                protected void renderResponse() throws Exception 
-                {
-                    // Check the job exists
-                    assert ((Boolean)getValue("#{accountHome.idDefined}"));                
-                    Account account = (Account) getValue("#{selectedAccount}");                
-                    assert account !=null;
-                    assert account.getId() == 1;
-                    assert account.getPayments().size() == 1;            
-                    
-                    Payment payment = (Payment) getValue("#{newPayment}");
-                    assert payment.getPayee().equals("IRS");
-                    assert payment.getAmount().equals(new BigDecimal("110.00"));
-                    assert payment.getAccount() != null;
-                    assert payment.getAccount().getId() == 1;
-                    assert payment.getActive();
-                }
-                
-            }.run();
-            
-            // Start the triggerHandle, wait a lot shorter than the job takes
-            // At this point the job should have executed zero times
-            quartzTriggerHandle.resume();
-            pause((long) (REPEATING.getInterval() * 0.1));
-            quartzTriggerHandle.pause();
-            
-            new FacesRequest("/search.xhtml", id)
-            {
-    
-                @Override
-                protected void beforeRequest() 
-                {
-                    setParameter("accountId", "1");
-                }
-                
-                @Override
-                protected void renderResponse() throws Exception
-                {
-                    assert ((Boolean)getValue("#{accountHome.idDefined}"));                
-                    Account account = (Account) getValue("#{selectedAccount}");                
-                    assert account !=null;
-                    assert account.getId() == 1;
-                    assert account.getPayments().size() == 1;
-                    Payment payment = account.getPayments().get(0);
-                    assert new BigDecimal("110.00").equals(payment.getAmount());
-                    assert payment.getActive();
-                    assert new BigDecimal("1001.46").equals(account.getBalance());
-                }
-                
-            }.run();
-            
-            // Start the triggerHandle, wait until some short time after the 
-            // job triggers once
-            quartzTriggerHandle.resume();
-            pause(REPEATING.getInterval());
-            quartzTriggerHandle.pause();
-            
-            
-            new FacesRequest("/search.xhtml", id)
-            {
-    
-                @Override
-                protected void beforeRequest() 
-                {
-                    setParameter("accountId", "1");
-                }
-                
-                @Override
-                protected void renderResponse() throws Exception
-                {
-
-                    // Job should have run twice
-                    assert ((Boolean)getValue("#{accountHome.idDefined}"));                
-                    Account account = (Account) getValue("#{selectedAccount}");
-
-                    assert account !=null;
-                    assert account.getId() == 1;
-                    assert account.getPayments().size() == 1;
-                    Payment payment = account.getPayments().get(0);
-                    assert new BigDecimal("110.00").equals(payment.getAmount());
-                    assert payment.getActive();
-                    assert new BigDecimal("891.46").equals(account.getBalance());
-                    paymentId = payment.getId();
-                }
-                
-            }.run();
-            
-            // Start the triggerHandle, wait until some short time after the 
-            // job triggers once
-            quartzTriggerHandle.resume();
-            pause(REPEATING.getInterval());
-            // Thats the last job so need to pause
-            
-            new FacesRequest("/search.xhtml", id)
-            {
-    
-                @Override
-                protected void beforeRequest() 
-                {
-                    setParameter("accountId", "1");
-                }
-                
-                @Override
-                protected void renderResponse() throws Exception
-                {
-
-                    // Job should have run twice
-                    assert ((Boolean)getValue("#{accountHome.idDefined}"));                
-                    Account account = (Account) getValue("#{selectedAccount}");
-
-                    assert account !=null;
-                    assert account.getId() == 1;
-                    assert account.getPayments().size() == 1;
-                    Payment payment = account.getPayments().get(0);
-                    assert new BigDecimal("110.00").equals(payment.getAmount());
-                    assert payment.getActive();
-                    assert new BigDecimal("781.46").equals(account.getBalance());
-                    paymentId = payment.getId();
-                }
-                
-            }.run();
-            
-            // Start the triggerHandle, wait until some short time after the 
-            // job would trigger again - we should be way beyond the expiry now 
-            pause(REPEATING.getInterval());
-            
-            new FacesRequest("/search.xhtml", id)
-            {
-    
-                @Override
-                protected void beforeRequest() 
-                {
-                    setParameter("accountId", "1");
-                }
-                
-                @Override
-                protected void renderResponse() throws Exception
-                {
-
-                    assert ((Boolean)getValue("#{accountHome.idDefined}"));                
-                    Account account = (Account) getValue("#{selectedAccount}");
-
-                    assert account !=null;
-                    assert account.getId() == 1;
-                    assert account.getPayments().size() == 1;
-                    Payment payment = account.getPayments().get(0);
-                    assert new BigDecimal("110.00").equals(payment.getAmount());
-                    assert payment.getActive();
-                    assert payment.getLastPaid() != null;
-                    assert new BigDecimal("781.46").equals(account.getBalance());
-                }
-                
-            }.run();
-            
-        }
-        finally
-        {
-            if (quartzTriggerHandle != null)
-            {
-                quartzTriggerHandle.cancel();
-            }
-        }
-    }
-    
-    private void pause(long ms) {
-        try {
-            Thread.sleep(ms);
-        } catch (InterruptedException e) {
-            
-        }                
-    }
-
-    
-    
-}

Deleted: branches/enterprise/WFK-2_1/examples/quartz/quartz-tests/src/test/java/org/jboss/seam/example/quartz/test/TestPaymentController.java
===================================================================
--- branches/enterprise/WFK-2_1/examples/quartz/quartz-tests/src/test/java/org/jboss/seam/example/quartz/test/TestPaymentController.java	2013-06-04 07:13:54 UTC (rev 15540)
+++ branches/enterprise/WFK-2_1/examples/quartz/quartz-tests/src/test/java/org/jboss/seam/example/quartz/test/TestPaymentController.java	2013-06-04 09:25:36 UTC (rev 15541)
@@ -1,84 +0,0 @@
-package org.jboss.seam.example.quartz.test;
-
-import static org.jboss.seam.annotations.Install.MOCK;
-
-import java.sql.Timestamp;
-
-import org.jboss.seam.annotations.In;
-import org.jboss.seam.annotations.Install;
-import org.jboss.seam.annotations.Logger;
-import org.jboss.seam.annotations.Name;
-import org.jboss.seam.async.QuartzTriggerHandle;
-import org.jboss.seam.async.Schedule;
-import org.jboss.seam.async.TimerSchedule;
-import org.jboss.seam.core.Events;
-import org.jboss.seam.example.quartz.Payment;
-import org.jboss.seam.example.quartz.PaymentHome;
-import org.jboss.seam.log.Log;
-
-/**
- * @author Pete Muir
- *
- */
- at Name("paymentHome")
- at Install(precedence=MOCK)
-public class TestPaymentController extends PaymentHome
-{
-    
-    @In TestPaymentProcessor processor;
-    
-    @Logger Log log;
-    
-    public String scheduleAndSaveAsynchronously()
-    {
-        String result = persist();
-        
-        Payment payment = getInstance();
-        
-        log.info("scheduling instance #0", payment);
-        QuartzTriggerHandle handle = processor.schedulePayment(payment.getPaymentDate(), 
-                                                payment.getPaymentFrequency().getInterval(), 
-                                                payment.getPaymentEndDate(), 
-                                                payment);
-        
-        payment.setQuartzTriggerHandle( handle );
-
-        return result;
-    }
-    
-    public void scheduleAndSaveUsingAsynchronousEvent()
-    {
-        persist();
-        Events.instance().raiseAsynchronousEvent("org.jboss.seam.example.quartz.test.scheduleAndSave", getInstance());
-    }
-    
-    public void scheduleAndSaveUsingTimedEvent()
-    {
-        persist();
-        // A simple once-only which exprires in 1000ms
-        Schedule schedule = new TimerSchedule( new Timestamp( System.currentTimeMillis() + 1000l ) );
-        Events.instance().raiseTimedEvent("org.jboss.seam.example.quartz.test.scheduleAndSave", schedule, getInstance());
-    }
-    
-    public void scheduleAndSaveWithTransactionEvents()
-    {
-        TransactionStatus.clear();
-        Events.instance().raiseTransactionSuccessEvent("org.jboss.seam.example.quartz.test.transactionSuccess", getInstance());
-        Events.instance().raiseTransactionCompletionEvent("org.jboss.seam.example.quartz.test.transactionCompletion", getInstance());
-        try
-        {
-            super.saveAndSchedule();
-        }
-        catch (Exception e) 
-        {
-            e.printStackTrace();
-        }
-    }
-    
-    @Override
-    public Class<Payment> getEntityClass()
-    {
-        return Payment.class;
-    }
-    
-}

Deleted: branches/enterprise/WFK-2_1/examples/quartz/quartz-tests/src/test/java/org/jboss/seam/example/quartz/test/TestPaymentProcessor.java
===================================================================
--- branches/enterprise/WFK-2_1/examples/quartz/quartz-tests/src/test/java/org/jboss/seam/example/quartz/test/TestPaymentProcessor.java	2013-06-04 07:13:54 UTC (rev 15540)
+++ branches/enterprise/WFK-2_1/examples/quartz/quartz-tests/src/test/java/org/jboss/seam/example/quartz/test/TestPaymentProcessor.java	2013-06-04 09:25:36 UTC (rev 15541)
@@ -1,89 +0,0 @@
-package org.jboss.seam.example.quartz.test;
-
-import static org.jboss.seam.annotations.Install.MOCK;
-
-import java.math.BigDecimal;
-import java.util.Date;
-
-import javax.persistence.EntityManager;
-
-import org.jboss.seam.annotations.AutoCreate;
-import org.jboss.seam.annotations.In;
-import org.jboss.seam.annotations.Install;
-import org.jboss.seam.annotations.Logger;
-import org.jboss.seam.annotations.Name;
-import org.jboss.seam.annotations.Observer;
-import org.jboss.seam.annotations.Transactional;
-import org.jboss.seam.annotations.async.Asynchronous;
-import org.jboss.seam.async.QuartzTriggerHandle;
-import org.jboss.seam.example.quartz.Payment;
-import org.jboss.seam.example.quartz.PaymentProcessor;
-import org.jboss.seam.log.Log;
-
-/**
- * @author Pete Muir
- *
- */
- at Name("processor")
- at Install(precedence=MOCK)
- at AutoCreate
-public class TestPaymentProcessor extends PaymentProcessor
-{
-    
-    @In 
-    EntityManager entityManager;
-
-    @Logger Log log;
-    
-    @Asynchronous
-    @Transactional
-    public QuartzTriggerHandle schedulePaymentAsynchronously(Payment payment) 
-    { 
-        payment = entityManager.merge(payment);
-        
-        log.info("[#0] Processing cron payment #1", System.currentTimeMillis(), payment.getId());
-
-        if (payment.getActive()) {
-            BigDecimal balance = payment.getAccount().adjustBalance(payment.getAmount().negate());
-            log.info(":: balance is now #0", balance);
-            payment.setLastPaid(new Date());
-
-        }
-
-        return null;
-    }
-    
-    @Observer("org.jboss.seam.example.quartz.test.scheduleAndSave")
-    @Transactional
-    public QuartzTriggerHandle schedulePayment(Payment payment) 
-    { 
-        payment = entityManager.merge(payment);
-        
-        log.error("[#0] Processing cron payment #1", System.currentTimeMillis(), payment.getId());
-        if (payment.getActive()) {
-            BigDecimal balance = payment.getAccount().adjustBalance(payment.getAmount().negate());
-            log.error(":: balance is now #0", balance);
-            payment.setLastPaid(new Date());
-
-        }
-
-        return null;
-    }
-    
-    @Observer("org.jboss.seam.example.quartz.test.transactionSuccess")
-    @Transactional
-    public void observeTransactionSuccess(Payment payment)
-    {
-        TransactionStatus.instance().setTransactionSucceded(true);
-        TransactionStatus.instance().setId(payment.getId());
-    }
-    
-    @Observer("org.jboss.seam.example.quartz.test.transactionCompletion")
-    @Transactional
-    public void observeTransactionCompletion(Payment payment)
-    {
-        TransactionStatus.instance().setTransactionCompleted(true);
-        TransactionStatus.instance().setId(payment.getId());
-    }
-
-}

Deleted: branches/enterprise/WFK-2_1/examples/quartz/quartz-tests/src/test/java/org/jboss/seam/example/quartz/test/TransactionStatus.java
===================================================================
--- branches/enterprise/WFK-2_1/examples/quartz/quartz-tests/src/test/java/org/jboss/seam/example/quartz/test/TransactionStatus.java	2013-06-04 07:13:54 UTC (rev 15540)
+++ branches/enterprise/WFK-2_1/examples/quartz/quartz-tests/src/test/java/org/jboss/seam/example/quartz/test/TransactionStatus.java	2013-06-04 09:25:36 UTC (rev 15541)
@@ -1,75 +0,0 @@
-package org.jboss.seam.example.quartz.test;
-
-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.Scope;
-import org.jboss.seam.contexts.Contexts;
-
-/**
- * @author Pete Muir
- *
- */
- at Name("transactionStatus")
- at Scope(ScopeType.APPLICATION)
- at AutoCreate
-public class TransactionStatus
-{
-    private Object id;
-    private boolean transactionSucceded;
-    private boolean transactionCompleted;
-    /**
-     * @return the transactionSuccess
-     */
-    public boolean getTransactionSucceded()
-    {
-        return this.transactionSucceded;
-    }
-    /**
-     * @param transactionSuccess the transactionSuccess to set
-     */
-    public void setTransactionSucceded(boolean transactionSuccess)
-    {
-        this.transactionSucceded = transactionSuccess;
-    }
-    /**
-     * @return the transactionCompleted
-     */
-    public boolean getTransactionCompleted()
-    {
-        return this.transactionCompleted;
-    }
-    /**
-     * @param transactionCompleted the transactionCompleted to set
-     */
-    public void setTransactionCompleted(boolean transactionCompleted)
-    {
-        this.transactionCompleted = transactionCompleted;
-    }
-    
-    public static void clear()
-    {
-        Contexts.getApplicationContext().remove("transactionStatus");
-    }
-    
-    public static TransactionStatus instance()
-    {
-        return (TransactionStatus) Component.getInstance("transactionStatus");
-    }
-    /**
-     * @return the id
-     */
-    public Object getId()
-    {
-        return this.id;
-    }
-    /**
-     * @param id the id to set
-     */
-    public void setId(Object id)
-    {
-        this.id = id;
-    }
-
-}

Deleted: branches/enterprise/WFK-2_1/examples/quartz/quartz-tests/src/test/java/org/jboss/seam/example/quartz/test/selenium/QuartzPaymentTest.java
===================================================================
--- branches/enterprise/WFK-2_1/examples/quartz/quartz-tests/src/test/java/org/jboss/seam/example/quartz/test/selenium/QuartzPaymentTest.java	2013-06-04 07:13:54 UTC (rev 15540)
+++ branches/enterprise/WFK-2_1/examples/quartz/quartz-tests/src/test/java/org/jboss/seam/example/quartz/test/selenium/QuartzPaymentTest.java	2013-06-04 09:25:36 UTC (rev 15541)
@@ -1,93 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2008, Red Hat Middleware LLC, and individual contributors
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.jboss.seam.example.quartz.test.selenium;
-
-import java.math.BigDecimal;
-import java.text.MessageFormat;
-import java.text.ParseException;
-
-import static org.testng.AssertJUnit.*;
-
-import org.jboss.seam.example.common.test.seampay.selenium.PaymentTest;
-import org.testng.annotations.Test;
-
-/**
- * 
- * @author jharting
- * 
- */
-public class QuartzPaymentTest extends PaymentTest
-{
-
-   /**
-    * Submits new payment using CRON and verifies that the balance is subtracted
-    * correctly
-    * 
-    * @throws ParseException
-    * @throws InterruptedException
-    */
-   @Test
-   public void testCRON() throws ParseException, InterruptedException
-   {
-      int account = 3;
-      BigDecimal amount = new BigDecimal(10);
-      String to = "foo";
-      String accountLinkLocator = MessageFormat.format(getProperty("ACCOUNT_TABLE_LINK"), account);
-      String accountBalanceLocator = MessageFormat.format(getProperty("ACCOUNT_TABLE_BALANCE"), account);
-      // send every 20 seconds
-      String cronExpression = "0/20 * * * * ?";
-
-      browser.click(accountLinkLocator);
-      browser.waitForPageToLoad(TIMEOUT);
-      // submit new cron job
-      browser.type(getProperty("PAYMENT_TO_FIELD"), to);
-      browser.type(getProperty("PAYMENT_AMOUNT_FIELD"), amount.toString());
-      browser.type(getProperty("PAYMENT_CRON_FIELD"), cronExpression);
-      browser.click(getProperty("PAYMENT_CRON_SUBMIT"));
-      browser.waitForPageToLoad(TIMEOUT);
-      assertTrue("Scheduled payment not confirmed.", browser.isTextPresent(MessageFormat.format(getProperty("PAYMENT_CONFIRMATION_MESSAGE"), to)));
-      assertEquals("Invalid count of payments.", 1, browser.getXpathCount(getProperty("PAYMENTS_COUNT")));
-      // wait
-      Thread.sleep(5000);
-      // get balance
-      browser.click(accountLinkLocator);
-      browser.waitForPageToLoad(TIMEOUT);
-      BigDecimal firstBalance = BigDecimal.valueOf(parseBalance(browser.getText(accountBalanceLocator)));
-      // wait 20 seconds
-      Thread.sleep(20000);
-      // get balance after 20 seconds
-      browser.click(accountLinkLocator);
-      browser.waitForPageToLoad(TIMEOUT);
-      BigDecimal secondBalance = BigDecimal.valueOf(parseBalance(browser.getText(accountBalanceLocator)));
-      // wait 20 seconds
-      Thread.sleep(20000);
-      // get balance after 40 seconds
-      browser.click(accountLinkLocator);
-      browser.waitForPageToLoad(TIMEOUT);
-      BigDecimal thirdBalance = BigDecimal.valueOf(parseBalance(browser.getText(accountBalanceLocator)));
-
-      BigDecimal expectedSecondBalance = firstBalance.subtract(amount);
-      BigDecimal expectedThirdBalance = firstBalance.subtract(amount).subtract(amount);
-      assertEquals("Incorrect balance after 20 seconds.", expectedSecondBalance, secondBalance);
-      assertEquals("Incorrect balance after 40 seconds.", expectedThirdBalance, thirdBalance);
-   }
-}

Deleted: branches/enterprise/WFK-2_1/examples/quartz/quartz-tests/src/test/resources/BaseData.xml
===================================================================
--- branches/enterprise/WFK-2_1/examples/quartz/quartz-tests/src/test/resources/BaseData.xml	2013-06-04 07:13:54 UTC (rev 15540)
+++ branches/enterprise/WFK-2_1/examples/quartz/quartz-tests/src/test/resources/BaseData.xml	2013-06-04 09:25:36 UTC (rev 15541)
@@ -1,38 +0,0 @@
-<?xml version="1.0"?>
-
-<dataset>
-
-  <ACCOUNT 
-    id="1"
-    accountNumber="23001"
-    balance="1001.46"
-    />
-    
-  <ACCOUNT 
-    id="2"
-    accountNumber="23002"
-    balance="1002.46"
-    />
-  
-  <ACCOUNT 
-    id="3"
-    accountNumber="23003"
-    balance="1003.46"
-    />
-    
-  <ACCOUNT 
-    id="4"
-    accountNumber="23004"
-    balance="1004.46"
-    />
-   
-  <ACCOUNT 
-    id="5"
-    accountNumber="23005"
-    balance="1005.46"
-    />
-    
-  <!-- This causes the payment table to be cleaned every time -->
-  <PAYMENT />
-    
-</dataset>
\ No newline at end of file

Deleted: branches/enterprise/WFK-2_1/examples/quartz/quartz-tests/src/test/resources/WEB-INF/components.xml
===================================================================
--- branches/enterprise/WFK-2_1/examples/quartz/quartz-tests/src/test/resources/WEB-INF/components.xml	2013-06-04 07:13:54 UTC (rev 15540)
+++ branches/enterprise/WFK-2_1/examples/quartz/quartz-tests/src/test/resources/WEB-INF/components.xml	2013-06-04 09:25:36 UTC (rev 15541)
@@ -1,50 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<components xmlns="http://jboss.org/schema/seam/components"
-            xmlns:pay="http://jboss.org/schema/seam/examples/quartz"
-            xmlns:core="http://jboss.org/schema/seam/core"
-            xmlns:async="http://jboss.org/schema/seam/async"
-            xmlns:framework="http://jboss.org/schema/seam/framework"
-            xmlns:persistence="http://jboss.org/schema/seam/persistence"
-            xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
-            xsi:schemaLocation=
-                "http://jboss.org/schema/seam/core http://jboss.org/schema/seam/core-2.3.xsd
-                 http://jboss.org/schema/seam/async http://jboss.org/schema/seam/async-2.3.xsd
-                 http://jboss.org/schema/seam/framework http://jboss.org/schema/seam/framework-2.3.xsd
-                 http://jboss.org/schema/seam/persistence http://jboss.org/schema/seam/persistence-2.3.xsd
-                 http://jboss.org/schema/seam/components http://jboss.org/schema/seam/components-2.3.xsd">
-
-    <pay:payment-home name="paymentHome" 
-                      new-instance="#{newPayment}" 
-                      created-message="Created a new payment to #{newPayment.payee}" />
-
-    <pay:payment name="newPayment" 
-                 payee="Somebody"
-                 account="#{selectedAccount}"
-                 payment-date="#{currentDatetime}"
-                 created-date="#{currentDatetime}" />
-
-    <factory name="selectedAccount" 
-             value="#{accountHome.instance}"/>
-
-    <framework:entity-home name="accountHome" 
-                           entity-class="org.jboss.seam.example.quartz.Account"
-                           entity-manager="#{entityManager}" />
-
-    <framework:entity-query name="accounts" 
-                            ejbql="from Account"
-                            order="accountNumber" 
-                            max-results="20" 
-                            entity-manager="#{entityManager}" />
-        
-    <persistence:managed-persistence-context name="entityManager"
-                                      auto-create="true"
-                                      persistence-unit-jndi-name="java:/seampayEntityManagerFactory" />
-
-    <!-- Install the QuartzDispatcher -->
-    <async:quartz-dispatcher/>
-
-    <core:init debug="true" jndi-pattern="java:app/quartz-ejb/#{ejbName}" />
-
-    <component class="org.jboss.seam.transaction.EjbSynchronizations" jndi-name="java:app/jboss-seam/EjbSynchronizations"/>
-
-</components>

Deleted: branches/enterprise/WFK-2_1/examples/quartz/quartz-tests/src/test/resources/quartz.properties
===================================================================
--- branches/enterprise/WFK-2_1/examples/quartz/quartz-tests/src/test/resources/quartz.properties	2013-06-04 07:13:54 UTC (rev 15540)
+++ branches/enterprise/WFK-2_1/examples/quartz/quartz-tests/src/test/resources/quartz.properties	2013-06-04 09:25:36 UTC (rev 15541)
@@ -1,34 +0,0 @@
- #
- # JBoss, Home of Professional Open Source
- # Copyright 2008, Red Hat Middleware LLC, and individual contributors
- # by the @authors tag. See the copyright.txt in the distribution for a
- # full listing of individual contributors.
- #
- # This is free software; you can redistribute it and/or modify it
- # under the terms of the GNU Lesser General Public License as
- # published by the Free Software Foundation; either version 2.1 of
- # the License, or (at your option) any later version.
- #
- # This software is distributed in the hope that it will be useful,
- # but WITHOUT ANY WARRANTY; without even the implied warranty of
- # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- # Lesser General Public License for more details.
- #
- # You should have received a copy of the GNU Lesser General Public
- # License along with this software; if not, write to the Free
- # Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- # 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- # 
-MAIN_PAGE = /search.seam
-MAIN_PAGE_TITLE = Seam Pay
-ACCOUNT_TABLE_LINK = id=accountTable:{0}:link
-ACCOUNT_TABLE_BALANCE = id=accountTable:{0}:balance
-PAYMENT_TO_FIELD = id=accountView:paymentForm:payee
-PAYMENT_AMOUNT_FIELD = id=accountView:paymentForm:amount
-PAYMENT_CRON_FIELD = id=accountView:paymentForm:paymentCron
-PAYMENT_CRON_SUBMIT = id=accountView:paymentForm:cronSubmit
-PAYMENT_ONLY_ONCE_RADIO = id=accountView:paymentForm:radioList:0
-PAYMENT_EVERY_MINUTE_RADIO = id=accountView:paymentForm:radioList:1
-PAYMENT_SUBMIT = id=accountView:paymentForm:submit
-PAYMENT_CONFIRMATION_MESSAGE =Created a new payment to {0}
-PAYMENTS_COUNT =//table[@id\='payments']/tbody/tr
\ No newline at end of file

Deleted: branches/enterprise/WFK-2_1/examples/quartz/quartz-tests/src/test/resources/seam.quartz.properties
===================================================================
--- branches/enterprise/WFK-2_1/examples/quartz/quartz-tests/src/test/resources/seam.quartz.properties	2013-06-04 07:13:54 UTC (rev 15540)
+++ branches/enterprise/WFK-2_1/examples/quartz/quartz-tests/src/test/resources/seam.quartz.properties	2013-06-04 09:25:36 UTC (rev 15541)
@@ -1,9 +0,0 @@
-org.quartz.scheduler.instanceName = Sched1
-org.quartz.scheduler.instanceId = 1
-org.quartz.scheduler.rmi.export = false
-org.quartz.scheduler.rmi.proxy = false
-
-org.quartz.threadPool.class = org.quartz.simpl.SimpleThreadPool
-org.quartz.threadPool.threadCount = 3
-
-org.quartz.jobStore.class = org.quartz.simpl.RAMJobStore

Deleted: branches/enterprise/WFK-2_1/examples/quartz/quartz-tests/src/test/resources-ftest/testng.xml
===================================================================
--- branches/enterprise/WFK-2_1/examples/quartz/quartz-tests/src/test/resources-ftest/testng.xml	2013-06-04 07:13:54 UTC (rev 15540)
+++ branches/enterprise/WFK-2_1/examples/quartz/quartz-tests/src/test/resources-ftest/testng.xml	2013-06-04 09:25:36 UTC (rev 15541)
@@ -1,25 +0,0 @@
-    <!--
-        JBoss, Home of Professional Open Source Copyright 2008, Red Hat
-        Middleware LLC, and individual contributors by the @authors tag. See
-        the copyright.txt in the distribution for a full listing of individual
-        contributors. This is free software; you can redistribute it and/or
-        modify it under the terms of the GNU Lesser General Public License as
-        published by the Free Software Foundation; either version 2.1 of the
-        License, or (at your option) any later version. This software is
-        distributed in the hope that it will be useful, but WITHOUT ANY
-        WARRANTY; without even the implied warranty of MERCHANTABILITY or
-        FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
-        License for more details. You should have received a copy of the GNU
-        Lesser General Public License along with this software; if not, write
-        to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
-        Boston, MA 02110-1301 USA, or see the FSF site: http://www.fsf.org.
-    --> 
-<!DOCTYPE suite SYSTEM "http://beust.com/testng/testng-1.0.dtd" >
-<suite name="Quartz example" verbose="2" parallel="false">
-    <test name="quartz_tests">
-        <parameter name="PROPERTY_FILE" value="/quartz.properties" />
-        <classes>
-            <class name="org.jboss.seam.example.quartz.test.selenium.QuartzPaymentTest" />
-        </classes>
-    </test>
-</suite>

Deleted: branches/enterprise/WFK-2_1/examples/quartz/quartz-tests/src/test/resources-integration/arquillian.xml
===================================================================
--- branches/enterprise/WFK-2_1/examples/quartz/quartz-tests/src/test/resources-integration/arquillian.xml	2013-06-04 07:13:54 UTC (rev 15540)
+++ branches/enterprise/WFK-2_1/examples/quartz/quartz-tests/src/test/resources-integration/arquillian.xml	2013-06-04 09:25:36 UTC (rev 15541)
@@ -1,16 +0,0 @@
-<?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 ${jacoco.agent}</property>
-        </configuration>
-    </container>
-
-</arquillian>

Deleted: branches/enterprise/WFK-2_1/examples/quartz/quartz-tests/src/test/resources-integration/web.xml
===================================================================
--- branches/enterprise/WFK-2_1/examples/quartz/quartz-tests/src/test/resources-integration/web.xml	2013-06-04 07:13:54 UTC (rev 15540)
+++ branches/enterprise/WFK-2_1/examples/quartz/quartz-tests/src/test/resources-integration/web.xml	2013-06-04 09:25:36 UTC (rev 15541)
@@ -1,12 +0,0 @@
-<?xml version="1.0" ?>
-
-<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.mock.MockSeamListener</listener-class>
-    </listener>
-
-</web-app>

Modified: branches/enterprise/WFK-2_1/examples/quartz/quartz-web/pom.xml
===================================================================
--- branches/enterprise/WFK-2_1/examples/quartz/quartz-web/pom.xml	2013-06-04 07:13:54 UTC (rev 15540)
+++ branches/enterprise/WFK-2_1/examples/quartz/quartz-web/pom.xml	2013-06-04 09:25:36 UTC (rev 15541)
@@ -72,6 +72,7 @@
             <plugin>
                 <groupId>org.apache.maven.plugins</groupId>
                 <artifactId>maven-war-plugin</artifactId>
+                <version>${version.war.plugin}</version>
                 <configuration>
                     <webResources>
                         <resource>

Modified: branches/enterprise/WFK-2_1/jboss-seam/src/main/java/org/jboss/seam/mock/ResourceRequestEnvironment.java
===================================================================
--- branches/enterprise/WFK-2_1/jboss-seam/src/main/java/org/jboss/seam/mock/ResourceRequestEnvironment.java	2013-06-04 07:13:54 UTC (rev 15540)
+++ branches/enterprise/WFK-2_1/jboss-seam/src/main/java/org/jboss/seam/mock/ResourceRequestEnvironment.java	2013-06-04 09:25:36 UTC (rev 15541)
@@ -206,7 +206,7 @@
 
       protected EnhancedMockHttpServletRequest createRequest()
       {
-         return new EnhancedMockHttpServletRequest(environment.seamTest.servletContex);
+         return new EnhancedMockHttpServletRequest(environment.seamTest.servletContext);
       }
 
       protected EnhancedMockHttpServletResponse createResponse()



More information about the seam-commits mailing list