[seam-commits] Seam SVN: r14483 - in branches/community/Seam_2_3/examples-ee6: quartz and 38 other directories.

seam-commits at lists.jboss.org seam-commits at lists.jboss.org
Tue Apr 3 07:31:38 EDT 2012


Author: maschmid
Date: 2012-04-03 07:31:37 -0400 (Tue, 03 Apr 2012)
New Revision: 14483

Added:
   branches/community/Seam_2_3/examples-ee6/quartz/
   branches/community/Seam_2_3/examples-ee6/quartz/pom.xml
   branches/community/Seam_2_3/examples-ee6/quartz/quartz-ear/
   branches/community/Seam_2_3/examples-ee6/quartz/quartz-ear/pom.xml
   branches/community/Seam_2_3/examples-ee6/quartz/quartz-ear/src/
   branches/community/Seam_2_3/examples-ee6/quartz/quartz-ear/src/main/
   branches/community/Seam_2_3/examples-ee6/quartz/quartz-ear/src/main/application/
   branches/community/Seam_2_3/examples-ee6/quartz/quartz-ear/src/main/application/META-INF/
   branches/community/Seam_2_3/examples-ee6/quartz/quartz-ear/src/main/application/META-INF/jboss-deployment-structure.xml
   branches/community/Seam_2_3/examples-ee6/quartz/quartz-ejb/
   branches/community/Seam_2_3/examples-ee6/quartz/quartz-ejb/pom.xml
   branches/community/Seam_2_3/examples-ee6/quartz/quartz-ejb/src/
   branches/community/Seam_2_3/examples-ee6/quartz/quartz-ejb/src/main/
   branches/community/Seam_2_3/examples-ee6/quartz/quartz-ejb/src/main/java/
   branches/community/Seam_2_3/examples-ee6/quartz/quartz-ejb/src/main/java/org/
   branches/community/Seam_2_3/examples-ee6/quartz/quartz-ejb/src/main/java/org/jboss/
   branches/community/Seam_2_3/examples-ee6/quartz/quartz-ejb/src/main/java/org/jboss/seam/
   branches/community/Seam_2_3/examples-ee6/quartz/quartz-ejb/src/main/java/org/jboss/seam/example/
   branches/community/Seam_2_3/examples-ee6/quartz/quartz-ejb/src/main/java/org/jboss/seam/example/quartz/
   branches/community/Seam_2_3/examples-ee6/quartz/quartz-ejb/src/main/java/org/jboss/seam/example/quartz/Account.java
   branches/community/Seam_2_3/examples-ee6/quartz/quartz-ejb/src/main/java/org/jboss/seam/example/quartz/Payment.java
   branches/community/Seam_2_3/examples-ee6/quartz/quartz-ejb/src/main/java/org/jboss/seam/example/quartz/PaymentHome.java
   branches/community/Seam_2_3/examples-ee6/quartz/quartz-ejb/src/main/java/org/jboss/seam/example/quartz/PaymentProcessor.java
   branches/community/Seam_2_3/examples-ee6/quartz/quartz-ejb/src/main/java/org/jboss/seam/example/quartz/package-info.java
   branches/community/Seam_2_3/examples-ee6/quartz/quartz-ejb/src/main/resources/
   branches/community/Seam_2_3/examples-ee6/quartz/quartz-ejb/src/main/resources/META-INF/
   branches/community/Seam_2_3/examples-ee6/quartz/quartz-ejb/src/main/resources/META-INF/ejb-jar.xml
   branches/community/Seam_2_3/examples-ee6/quartz/quartz-ejb/src/main/resources/META-INF/persistence.xml
   branches/community/Seam_2_3/examples-ee6/quartz/quartz-ejb/src/main/resources/import.sql
   branches/community/Seam_2_3/examples-ee6/quartz/quartz-ejb/src/main/resources/seam.properties
   branches/community/Seam_2_3/examples-ee6/quartz/quartz-ejb/src/main/resources/seam.quartz.properties
   branches/community/Seam_2_3/examples-ee6/quartz/quartz-tests/
   branches/community/Seam_2_3/examples-ee6/quartz/quartz-tests/pom.xml
   branches/community/Seam_2_3/examples-ee6/quartz/quartz-tests/src/
   branches/community/Seam_2_3/examples-ee6/quartz/quartz-tests/src/test/
   branches/community/Seam_2_3/examples-ee6/quartz/quartz-tests/src/test/java/
   branches/community/Seam_2_3/examples-ee6/quartz/quartz-tests/src/test/java/org/
   branches/community/Seam_2_3/examples-ee6/quartz/quartz-tests/src/test/java/org/jboss/
   branches/community/Seam_2_3/examples-ee6/quartz/quartz-tests/src/test/java/org/jboss/seam/
   branches/community/Seam_2_3/examples-ee6/quartz/quartz-tests/src/test/java/org/jboss/seam/example/
   branches/community/Seam_2_3/examples-ee6/quartz/quartz-tests/src/test/java/org/jboss/seam/example/quartz/
   branches/community/Seam_2_3/examples-ee6/quartz/quartz-tests/src/test/java/org/jboss/seam/example/quartz/test/
   branches/community/Seam_2_3/examples-ee6/quartz/quartz-tests/src/test/java/org/jboss/seam/example/quartz/test/AccountTest.java
   branches/community/Seam_2_3/examples-ee6/quartz/quartz-tests/src/test/java/org/jboss/seam/example/quartz/test/AsynchronousTest.java
   branches/community/Seam_2_3/examples-ee6/quartz/quartz-tests/src/test/java/org/jboss/seam/example/quartz/test/CronTest.java
   branches/community/Seam_2_3/examples-ee6/quartz/quartz-tests/src/test/java/org/jboss/seam/example/quartz/test/EventsTest.java
   branches/community/Seam_2_3/examples-ee6/quartz/quartz-tests/src/test/java/org/jboss/seam/example/quartz/test/OnceTest.java
   branches/community/Seam_2_3/examples-ee6/quartz/quartz-tests/src/test/java/org/jboss/seam/example/quartz/test/RepeatingTest.java
   branches/community/Seam_2_3/examples-ee6/quartz/quartz-tests/src/test/java/org/jboss/seam/example/quartz/test/TestPaymentController.java
   branches/community/Seam_2_3/examples-ee6/quartz/quartz-tests/src/test/java/org/jboss/seam/example/quartz/test/TestPaymentProcessor.java
   branches/community/Seam_2_3/examples-ee6/quartz/quartz-tests/src/test/java/org/jboss/seam/example/quartz/test/TransactionStatus.java
   branches/community/Seam_2_3/examples-ee6/quartz/quartz-tests/src/test/java/org/jboss/seam/example/quartz/test/selenium/
   branches/community/Seam_2_3/examples-ee6/quartz/quartz-tests/src/test/java/org/jboss/seam/example/quartz/test/selenium/QuartzPaymentTest.java
   branches/community/Seam_2_3/examples-ee6/quartz/quartz-tests/src/test/resources-ftest/
   branches/community/Seam_2_3/examples-ee6/quartz/quartz-tests/src/test/resources-ftest/testng.xml
   branches/community/Seam_2_3/examples-ee6/quartz/quartz-tests/src/test/resources-integration/
   branches/community/Seam_2_3/examples-ee6/quartz/quartz-tests/src/test/resources-integration/testng.xml
   branches/community/Seam_2_3/examples-ee6/quartz/quartz-tests/src/test/resources/
   branches/community/Seam_2_3/examples-ee6/quartz/quartz-tests/src/test/resources/BaseData.xml
   branches/community/Seam_2_3/examples-ee6/quartz/quartz-tests/src/test/resources/WEB-INF/
   branches/community/Seam_2_3/examples-ee6/quartz/quartz-tests/src/test/resources/WEB-INF/components.xml
   branches/community/Seam_2_3/examples-ee6/quartz/quartz-tests/src/test/resources/quartz.properties
   branches/community/Seam_2_3/examples-ee6/quartz/quartz-tests/src/test/resources/seam.properties
   branches/community/Seam_2_3/examples-ee6/quartz/quartz-tests/src/test/resources/seam.quartz.properties
   branches/community/Seam_2_3/examples-ee6/quartz/quartz-web/
   branches/community/Seam_2_3/examples-ee6/quartz/quartz-web/pom.xml
   branches/community/Seam_2_3/examples-ee6/quartz/quartz-web/src/
   branches/community/Seam_2_3/examples-ee6/quartz/quartz-web/src/main/
   branches/community/Seam_2_3/examples-ee6/quartz/quartz-web/src/main/resources/
   branches/community/Seam_2_3/examples-ee6/quartz/quartz-web/src/main/resources/seam.quartz.properties
   branches/community/Seam_2_3/examples-ee6/quartz/quartz-web/src/main/webapp/
   branches/community/Seam_2_3/examples-ee6/quartz/quartz-web/src/main/webapp/WEB-INF/
   branches/community/Seam_2_3/examples-ee6/quartz/quartz-web/src/main/webapp/WEB-INF/components.xml
   branches/community/Seam_2_3/examples-ee6/quartz/quartz-web/src/main/webapp/WEB-INF/faces-config.xml
   branches/community/Seam_2_3/examples-ee6/quartz/quartz-web/src/main/webapp/WEB-INF/pages.xml
   branches/community/Seam_2_3/examples-ee6/quartz/quartz-web/src/main/webapp/WEB-INF/web.xml
   branches/community/Seam_2_3/examples-ee6/quartz/quartz-web/src/main/webapp/date.css
   branches/community/Seam_2_3/examples-ee6/quartz/quartz-web/src/main/webapp/img/
   branches/community/Seam_2_3/examples-ee6/quartz/quartz-web/src/main/webapp/img/cal-next.png
   branches/community/Seam_2_3/examples-ee6/quartz/quartz-web/src/main/webapp/img/cal-prev.png
   branches/community/Seam_2_3/examples-ee6/quartz/quartz-web/src/main/webapp/img/dtpick.gif
   branches/community/Seam_2_3/examples-ee6/quartz/quartz-web/src/main/webapp/index.html
   branches/community/Seam_2_3/examples-ee6/quartz/quartz-web/src/main/webapp/screen.css
   branches/community/Seam_2_3/examples-ee6/quartz/quartz-web/src/main/webapp/search.xhtml
   branches/community/Seam_2_3/examples-ee6/quartz/readme.txt
Log:
add quartz example to the ee6 examples


Added: branches/community/Seam_2_3/examples-ee6/quartz/pom.xml
===================================================================
--- branches/community/Seam_2_3/examples-ee6/quartz/pom.xml	                        (rev 0)
+++ branches/community/Seam_2_3/examples-ee6/quartz/pom.xml	2012-04-03 11:31:37 UTC (rev 14483)
@@ -0,0 +1,46 @@
+<?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>
+    <groupId>org.jboss.seam.examples-ee6</groupId>
+    <artifactId>quartz</artifactId>
+    <parent>
+        <groupId>org.jboss.seam</groupId>
+        <artifactId>examples-ee6</artifactId>
+        <version>2.3.0.Beta2-SNAPSHOT</version>
+    </parent>
+    <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>
+    
+    <dependencyManagement>
+        <dependencies>
+            <dependency>
+                <groupId>org.jboss.seam.examples-ee6.quartz</groupId>
+                <artifactId>quartz-ejb</artifactId>
+                <version>${project.version}</version>
+                <type>ejb</type>
+            </dependency>
+            <dependency>
+                <groupId>org.jboss.seam.examples-ee6.quartz</groupId>
+                <artifactId>quartz-web</artifactId>
+                <version>${project.version}</version>
+                <type>war</type>
+            </dependency>
+            <dependency>
+                <groupId>org.jboss.seam.examples-ee6.quartz</groupId>
+                <artifactId>quartz-ear</artifactId>
+                <version>${project.version}</version>
+            </dependency>
+        </dependencies>
+    </dependencyManagement>
+</project>

Added: branches/community/Seam_2_3/examples-ee6/quartz/quartz-ear/pom.xml
===================================================================
--- branches/community/Seam_2_3/examples-ee6/quartz/quartz-ear/pom.xml	                        (rev 0)
+++ branches/community/Seam_2_3/examples-ee6/quartz/quartz-ear/pom.xml	2012-04-03 11:31:37 UTC (rev 14483)
@@ -0,0 +1,122 @@
+<?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-ee6</groupId>
+        <version>2.3.0.Beta2-SNAPSHOT</version>
+        <relativePath>../pom.xml</relativePath>
+    </parent>
+    
+    <groupId>org.jboss.seam.examples-ee6.quartz</groupId>
+    <artifactId>quartz-ear</artifactId>
+    <packaging>ear</packaging>
+    <name>Quartz EAR Module (EE6)</name>
+    
+    <dependencies>
+        <dependency>
+            <groupId>org.jboss.seam.examples-ee6.quartz</groupId>
+            <artifactId>quartz-web</artifactId>
+            <type>war</type>
+        </dependency>
+        <dependency>
+            <groupId>org.jboss.seam.examples-ee6.quartz</groupId>
+            <artifactId>quartz-ejb</artifactId>
+            <type>ejb</type>
+        </dependency>
+        <dependency>
+            <groupId>org.jboss.seam</groupId>
+            <artifactId>jboss-seam</artifactId>
+            <type>ejb</type>
+            <scope>compile</scope>
+        </dependency>
+    </dependencies>
+
+    <build>
+        <finalName>seam-quartz</finalName>
+        <plugins>
+            <plugin>
+                <groupId>org.apache.maven.plugins</groupId>
+                <artifactId>maven-ear-plugin</artifactId>
+                <configuration>
+                    <version>6</version>
+                    <defaultLibBundleDir>lib</defaultLibBundleDir>
+                    <!-- Exclude eclipse generated application.xml and manually modified jboss-app.xml during mvn build  -->
+                    <earSourceExcludes>**/application.xml, **/jboss-app.xml</earSourceExcludes>
+                    <!-- use maven generated application.xml instead -->
+                    <generateApplicationXml>true</generateApplicationXml>
+                    <filtering>true</filtering>
+                    <modules>
+                        <webModule>
+                            <groupId>org.jboss.seam.examples-ee6.quartz</groupId>
+                            <artifactId>quartz-web</artifactId>
+                            <contextRoot>/seam-quartz</contextRoot>
+                            <bundleFileName>quartz-web.war</bundleFileName>
+                        </webModule>
+                        <ejbModule>
+                            <groupId>org.jboss.seam.examples-ee6.quartz</groupId>
+                            <artifactId>quartz-ejb</artifactId>
+                            <bundleFileName>quartz-ejb.jar</bundleFileName>
+                        </ejbModule>
+                        <ejbModule>
+                            <groupId>org.jboss.seam</groupId>
+                            <artifactId>jboss-seam</artifactId>
+                            <bundleFileName>jboss-seam.jar</bundleFileName>
+                        </ejbModule>
+                    </modules>
+                </configuration>
+            </plugin>
+        </plugins>
+    </build>
+
+    <profiles>
+        <profile>
+            <id>exploded</id>
+            <properties>
+                <example.name>quartz</example.name>
+            </properties>
+            <build>
+                <plugins>
+                    <plugin>
+                        <groupId>org.apache.maven.plugins</groupId>
+                        <artifactId>maven-dependency-plugin</artifactId>
+                        <executions>
+                            <execution>
+                                <id>unpack</id>
+                                <phase>package</phase>
+                                <goals>
+                                    <goal>unpack</goal>
+                                </goals>
+                                <configuration>
+                                    <artifactItems>
+                                        <artifactItem>
+                                            <groupId>org.jboss.seam.examples-ee6.quartz</groupId>
+                                            <artifactId>quartz-ear</artifactId>
+                                            <type>ear</type>
+                                            <overWrite>true</overWrite>
+                                            <outputDirectory>${project.build.directory}/${project.build.finalName}-exploded/${project.build.finalName}.ear</outputDirectory>
+                                        </artifactItem>
+                                        <artifactItem>
+                                            <groupId>org.jboss.seam.examples-ee6.quartz</groupId>
+                                            <artifactId>quartz-web</artifactId>
+                                            <type>war</type>
+                                            <overWrite>true</overWrite>
+                                            <outputDirectory>${project.build.directory}/${project.build.finalName}-exploded/${project.build.finalName}.ear/${example.name}-web.war</outputDirectory>
+                                        </artifactItem>
+                                        <artifactItem>
+                                            <groupId>org.jboss.seam.examples-ee6.quartz</groupId>
+                                            <artifactId>quartz-ejb</artifactId>
+                                            <type>jar</type>
+                                            <overWrite>true</overWrite>
+                                            <outputDirectory>${project.build.directory}/${project.build.finalName}-exploded/${project.build.finalName}.ear/${example.name}-ejb.jar</outputDirectory>
+                                        </artifactItem>
+                                    </artifactItems>
+                                </configuration>
+                            </execution>
+                        </executions>
+                    </plugin>
+                </plugins>
+            </build>
+        </profile>
+    </profiles>
+</project>

Added: branches/community/Seam_2_3/examples-ee6/quartz/quartz-ear/src/main/application/META-INF/jboss-deployment-structure.xml
===================================================================
--- branches/community/Seam_2_3/examples-ee6/quartz/quartz-ear/src/main/application/META-INF/jboss-deployment-structure.xml	                        (rev 0)
+++ branches/community/Seam_2_3/examples-ee6/quartz/quartz-ear/src/main/application/META-INF/jboss-deployment-structure.xml	2012-04-03 11:31:37 UTC (rev 14483)
@@ -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/community/Seam_2_3/examples-ee6/quartz/quartz-ejb/pom.xml
===================================================================
--- branches/community/Seam_2_3/examples-ee6/quartz/quartz-ejb/pom.xml	                        (rev 0)
+++ branches/community/Seam_2_3/examples-ee6/quartz/quartz-ejb/pom.xml	2012-04-03 11:31:37 UTC (rev 14483)
@@ -0,0 +1,76 @@
+<?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-ee6</groupId>
+        <version>2.3.0.Beta2-SNAPSHOT</version>
+        <relativePath>../pom.xml</relativePath>
+    </parent>
+    
+    <groupId>org.jboss.seam.examples-ee6.quartz</groupId>
+    <artifactId>quartz-ejb</artifactId>
+    <packaging>ejb</packaging>
+    <name>Quartz EJB Module (EE6)</name>
+    
+    <dependencies>
+        <dependency>
+            <groupId>org.jboss.seam</groupId>
+            <artifactId>jboss-seam</artifactId>
+            <type>ejb</type>
+            <exclusions>
+                <exclusion>
+                    <groupId>org.testng</groupId>
+                    <artifactId>testng</artifactId>
+                </exclusion>
+                <exclusion>
+                    <groupId>junit</groupId>
+                    <artifactId>junit</artifactId>
+                </exclusion>
+                <exclusion>
+                    <groupId>org.jboss.spec.javax.faces</groupId>
+                    <artifactId>jboss-jsf-api_2.0_spec</artifactId>
+                </exclusion>
+                <exclusion>
+                    <groupId>javax.el</groupId>
+                    <artifactId>el-api</artifactId>
+                </exclusion>
+            </exclusions>
+        </dependency>
+        <dependency>
+            <groupId>org.hibernate.javax.persistence</groupId>
+            <artifactId>hibernate-jpa-2.0-api</artifactId>
+            <scope>provided</scope>
+        </dependency>
+        <dependency>
+            <groupId>org.hibernate</groupId>
+            <artifactId>hibernate-validator</artifactId>
+            <scope>provided</scope>
+        </dependency>
+        <dependency>
+            <groupId>org.hibernate</groupId>
+            <artifactId>hibernate-entitymanager</artifactId>
+            <scope>provided</scope>
+        </dependency>
+        <dependency>
+            <groupId>org.jboss.spec.javax.servlet</groupId>
+            <artifactId>jboss-servlet-api_3.0_spec</artifactId>
+            <scope>provided</scope>
+        </dependency>
+        <dependency>
+            <groupId>org.jboss.spec.javax.ejb</groupId>
+            <artifactId>jboss-ejb-api_3.1_spec</artifactId>
+            <scope>provided</scope>
+        </dependency>
+        <dependency>
+            <groupId>org.jboss.spec.javax.faces</groupId>
+            <artifactId>jboss-jsf-api_2.0_spec</artifactId>
+            <scope>provided</scope>
+        </dependency>
+        <dependency>
+            <groupId>org.opensymphony.quartz</groupId>
+            <artifactId>quartz</artifactId>
+        </dependency>
+    </dependencies>
+   
+</project>

Added: branches/community/Seam_2_3/examples-ee6/quartz/quartz-ejb/src/main/java/org/jboss/seam/example/quartz/Account.java
===================================================================
--- branches/community/Seam_2_3/examples-ee6/quartz/quartz-ejb/src/main/java/org/jboss/seam/example/quartz/Account.java	                        (rev 0)
+++ branches/community/Seam_2_3/examples-ee6/quartz/quartz-ejb/src/main/java/org/jboss/seam/example/quartz/Account.java	2012-04-03 11:31:37 UTC (rev 14483)
@@ -0,0 +1,67 @@
+package org.jboss.seam.example.quartz;
+
+import java.io.Serializable;
+import java.math.BigDecimal;
+import java.util.List;
+
+import javax.persistence.CascadeType;
+import javax.persistence.Entity;
+import javax.persistence.GeneratedValue;
+import javax.persistence.Id;
+import javax.persistence.OneToMany;
+
+import javax.validation.constraints.NotNull;
+
+ at Entity
+public class Account
+    implements Serializable
+{
+    @Id @GeneratedValue 
+    private Long id;
+
+    @NotNull
+    BigDecimal balance;
+
+    @NotNull
+    String accountNumber;
+    //String login;
+    //String password;
+       
+    @OneToMany(mappedBy="account", cascade=CascadeType.REMOVE)
+    //@OrderBy("paymentDate")
+    private List<Payment> payments;
+   
+    public Long getId()
+    {
+        return id;
+    }
+    public void setId(Long id)
+    {
+        this.id = id;
+    }
+
+    public String getAccountNumber()
+    {
+        return accountNumber;
+    }
+    public void setAccountNumber(String accountNumber)
+    {
+        this.accountNumber = accountNumber;
+    }
+
+
+    public BigDecimal getBalance()
+    {
+        return balance;
+    }
+
+    public BigDecimal adjustBalance(BigDecimal amount) {
+        balance = balance.add(amount);
+        return balance;
+    }
+
+    public List<Payment> getPayments() 
+    {
+        return payments;
+    }
+}

Added: branches/community/Seam_2_3/examples-ee6/quartz/quartz-ejb/src/main/java/org/jboss/seam/example/quartz/Payment.java
===================================================================
--- branches/community/Seam_2_3/examples-ee6/quartz/quartz-ejb/src/main/java/org/jboss/seam/example/quartz/Payment.java	                        (rev 0)
+++ branches/community/Seam_2_3/examples-ee6/quartz/quartz-ejb/src/main/java/org/jboss/seam/example/quartz/Payment.java	2012-04-03 11:31:37 UTC (rev 14483)
@@ -0,0 +1,155 @@
+package org.jboss.seam.example.quartz;
+
+import java.io.Serializable;
+import java.math.BigDecimal;
+import java.util.Date;
+
+import javax.persistence.Entity;
+import javax.persistence.GeneratedValue;
+import javax.persistence.Id;
+import javax.persistence.Lob;
+import javax.persistence.ManyToOne;
+
+import javax.validation.constraints.Size;
+import javax.validation.constraints.NotNull;
+import javax.validation.constraints.Digits;
+import org.jboss.seam.async.QuartzTriggerHandle;
+
+ at Entity
+public class Payment
+    implements Serializable
+{
+    @Id @GeneratedValue 
+    private Long id;
+
+    @NotNull
+    @Digits(integer=8,fraction=2)
+    private BigDecimal amount;
+
+    @NotNull @Size(min=1)
+    private String payee;
+
+    @NotNull @ManyToOne
+    private Account account;
+   
+    @NotNull
+    private Date paymentDate;
+    @NotNull
+    private Date createdDate;
+    private Date lastPaid;
+
+    private boolean active = true;
+
+    private String paymentCron;
+    private Date paymentEndDate;
+
+    private Frequency paymentFrequency = Frequency.DAILY;
+
+    @Lob
+    private QuartzTriggerHandle quartzTriggerHandle;
+    
+    public Long getId() {
+        return id;
+    }
+    
+    public BigDecimal getAmount() {
+        return amount;
+    }
+    public void setAmount(BigDecimal amount) {
+        this.amount = amount;
+    }
+
+    public String getPayee()
+    {
+        return payee;
+    }
+
+    public void setPayee(String payee) {
+        this.payee = payee;
+    }
+
+    public Account getAccount() {
+        return account;
+    }
+    
+    public void setAccount(Account account) {
+        this.account = account;
+        account.getPayments().add(this);
+    }
+
+    public Date getPaymentDate() {
+        return paymentDate;
+    }
+    public void setPaymentDate(Date paymentDate) {
+        this.paymentDate = paymentDate;
+    }  
+
+    public Date getPaymentEndDate() {
+        return paymentEndDate;
+    }
+    public void setPaymentEndDate(Date paymentEndDate) {
+        this.paymentEndDate = paymentEndDate;
+    }  
+
+    public Date getCreatedDate() {
+        return createdDate;
+    }    
+    public void setCreatedDate(Date createdDate) {
+        this.createdDate = createdDate;
+    }  
+
+
+    public Date getLastPaid() {
+        return lastPaid;
+    }    
+    public void setLastPaid(Date lastPaid) {
+        this.lastPaid = lastPaid;
+    }  
+        
+    public boolean getActive() {
+        return active;
+    }
+    public void setActive(boolean active) {
+        this.active = active;
+    }
+   
+    public Frequency getPaymentFrequency() { 
+        return paymentFrequency; 
+    }
+    public void setPaymentFrequency(Frequency paymentFrequency) {
+        this.paymentFrequency = paymentFrequency;
+    }
+
+    public String getPaymentCron() { 
+        return paymentCron; 
+    }
+    public void setPaymentCron(String paymentCron) {
+        this.paymentCron = paymentCron;
+    }
+
+    public QuartzTriggerHandle getQuartzTriggerHandle() {
+        return quartzTriggerHandle;
+    }
+    public void setQuartzTriggerHandle(QuartzTriggerHandle quartzTriggerHandle) {
+        this.quartzTriggerHandle = quartzTriggerHandle;
+    }
+
+    public enum Frequency {
+        ONCE(null),
+        EVERY_SECOND(1000l), // Just for testing
+        EVERY_MINUTE(60*1000l),
+        HOURLY(60*60*1000l), 
+        DAILY(24*60*60*1000l), 
+        WEEKLY(7*24*60*60*1000l);
+
+        Long interval; 
+
+        Frequency(Long interval) {
+            this.interval = interval;
+        }
+        
+        public Long getInterval() {
+            return interval;
+        }
+    }
+}

Added: branches/community/Seam_2_3/examples-ee6/quartz/quartz-ejb/src/main/java/org/jboss/seam/example/quartz/PaymentHome.java
===================================================================
--- branches/community/Seam_2_3/examples-ee6/quartz/quartz-ejb/src/main/java/org/jboss/seam/example/quartz/PaymentHome.java	                        (rev 0)
+++ branches/community/Seam_2_3/examples-ee6/quartz/quartz-ejb/src/main/java/org/jboss/seam/example/quartz/PaymentHome.java	2012-04-03 11:31:37 UTC (rev 14483)
@@ -0,0 +1,81 @@
+package org.jboss.seam.example.quartz;
+
+import org.jboss.seam.annotations.In;
+import org.jboss.seam.annotations.Logger;
+import org.jboss.seam.annotations.Name;
+import org.jboss.seam.annotations.Transactional;
+import org.jboss.seam.annotations.web.RequestParameter;
+import org.jboss.seam.async.QuartzTriggerHandle;
+import org.jboss.seam.example.quartz.Payment;
+import org.jboss.seam.example.quartz.PaymentProcessor;
+import org.jboss.seam.faces.FacesMessages;
+import org.jboss.seam.framework.EntityHome;
+import org.jboss.seam.log.Log;
+
+ at Name("paymentHome")
+public class PaymentHome
+    extends EntityHome<Payment>
+{
+    @RequestParameter Long paymentId;
+    @In PaymentProcessor processor;
+    
+    @Logger Log log;
+
+    public String saveAndSchedule()
+    {
+        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 String saveAndScheduleCron()
+    {
+        String result = persist();
+        
+        Payment payment = getInstance();
+        log.info("scheduling instance #0", payment);
+
+        QuartzTriggerHandle handle = processor.schedulePayment(payment.getPaymentDate(), 
+                                                payment.getPaymentCron(), 
+                                                payment.getPaymentEndDate(), 
+                                                payment);
+        
+        payment.setQuartzTriggerHandle( handle );
+
+        return result;
+    }
+
+    @Override
+    public Object getId() {
+        return paymentId;
+    }
+
+    @Transactional
+    public void cancel() {
+        Payment payment = getInstance();
+        
+        QuartzTriggerHandle handle = payment.getQuartzTriggerHandle();
+        payment.setQuartzTriggerHandle(null);
+        payment.setActive(false);
+        
+        try
+        {
+            handle.cancel();
+        }
+        catch (Exception nsole)
+        {
+            FacesMessages.instance().add("Payment already processed");
+        }
+    }
+    
+}

Added: branches/community/Seam_2_3/examples-ee6/quartz/quartz-ejb/src/main/java/org/jboss/seam/example/quartz/PaymentProcessor.java
===================================================================
--- branches/community/Seam_2_3/examples-ee6/quartz/quartz-ejb/src/main/java/org/jboss/seam/example/quartz/PaymentProcessor.java	                        (rev 0)
+++ branches/community/Seam_2_3/examples-ee6/quartz/quartz-ejb/src/main/java/org/jboss/seam/example/quartz/PaymentProcessor.java	2012-04-03 11:31:37 UTC (rev 14483)
@@ -0,0 +1,75 @@
+package org.jboss.seam.example.quartz;
+
+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.Logger;
+import org.jboss.seam.annotations.Name;
+import org.jboss.seam.annotations.Transactional;
+import org.jboss.seam.annotations.async.Asynchronous;
+import org.jboss.seam.annotations.async.Expiration;
+import org.jboss.seam.annotations.async.FinalExpiration;
+import org.jboss.seam.annotations.async.IntervalCron;
+import org.jboss.seam.annotations.async.IntervalDuration;
+import org.jboss.seam.async.QuartzTriggerHandle;
+import org.jboss.seam.log.Log;
+
+ at Name("processor")
+ at AutoCreate
+public class PaymentProcessor {
+    
+    @In 
+    EntityManager entityManager;
+
+    @Logger Log log;
+
+    @Asynchronous
+    @Transactional
+    public QuartzTriggerHandle schedulePayment(@Expiration Date when, 
+                                 @IntervalDuration Long interval, 
+                                 @FinalExpiration Date stoptime, 
+                                 Payment payment) 
+    { 
+        payment = entityManager.merge(payment);
+        
+        log.info("[#0] Processing 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());
+
+            if (payment.getPaymentFrequency().equals(Payment.Frequency.ONCE)) {
+                payment.setActive(false);
+            }
+        }
+
+        return null;
+    }
+
+    @Asynchronous
+    @Transactional
+    public QuartzTriggerHandle schedulePayment(@Expiration Date when, 
+                                 @IntervalCron String cron, 
+                                 @FinalExpiration Date stoptime, 
+                                 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;
+    }
+    
+}

Added: branches/community/Seam_2_3/examples-ee6/quartz/quartz-ejb/src/main/java/org/jboss/seam/example/quartz/package-info.java
===================================================================
--- branches/community/Seam_2_3/examples-ee6/quartz/quartz-ejb/src/main/java/org/jboss/seam/example/quartz/package-info.java	                        (rev 0)
+++ branches/community/Seam_2_3/examples-ee6/quartz/quartz-ejb/src/main/java/org/jboss/seam/example/quartz/package-info.java	2012-04-03 11:31:37 UTC (rev 14483)
@@ -0,0 +1,4 @@
+ at Namespace(value="http://jboss.com/products/seam/examples/quartz")
+package org.jboss.seam.example.quartz;
+
+import org.jboss.seam.annotations.*;

Added: branches/community/Seam_2_3/examples-ee6/quartz/quartz-ejb/src/main/resources/META-INF/ejb-jar.xml
===================================================================
--- branches/community/Seam_2_3/examples-ee6/quartz/quartz-ejb/src/main/resources/META-INF/ejb-jar.xml	                        (rev 0)
+++ branches/community/Seam_2_3/examples-ee6/quartz/quartz-ejb/src/main/resources/META-INF/ejb-jar.xml	2012-04-03 11:31:37 UTC (rev 14483)
@@ -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/community/Seam_2_3/examples-ee6/quartz/quartz-ejb/src/main/resources/META-INF/persistence.xml
===================================================================
--- branches/community/Seam_2_3/examples-ee6/quartz/quartz-ejb/src/main/resources/META-INF/persistence.xml	                        (rev 0)
+++ branches/community/Seam_2_3/examples-ee6/quartz/quartz-ejb/src/main/resources/META-INF/persistence.xml	2012-04-03 11:31:37 UTC (rev 14483)
@@ -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_1_0.xsd" 
+             version="1.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/community/Seam_2_3/examples-ee6/quartz/quartz-ejb/src/main/resources/import.sql
===================================================================
--- branches/community/Seam_2_3/examples-ee6/quartz/quartz-ejb/src/main/resources/import.sql	                        (rev 0)
+++ branches/community/Seam_2_3/examples-ee6/quartz/quartz-ejb/src/main/resources/import.sql	2012-04-03 11:31:37 UTC (rev 14483)
@@ -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/community/Seam_2_3/examples-ee6/quartz/quartz-ejb/src/main/resources/seam.properties
===================================================================
Added: branches/community/Seam_2_3/examples-ee6/quartz/quartz-ejb/src/main/resources/seam.quartz.properties
===================================================================
--- branches/community/Seam_2_3/examples-ee6/quartz/quartz-ejb/src/main/resources/seam.quartz.properties	                        (rev 0)
+++ branches/community/Seam_2_3/examples-ee6/quartz/quartz-ejb/src/main/resources/seam.quartz.properties	2012-04-03 11:31:37 UTC (rev 14483)
@@ -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/community/Seam_2_3/examples-ee6/quartz/quartz-tests/pom.xml
===================================================================
--- branches/community/Seam_2_3/examples-ee6/quartz/quartz-tests/pom.xml	                        (rev 0)
+++ branches/community/Seam_2_3/examples-ee6/quartz/quartz-tests/pom.xml	2012-04-03 11:31:37 UTC (rev 14483)
@@ -0,0 +1,117 @@
+<?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-ee6</groupId>
+        <version>2.3.0.Beta2-SNAPSHOT</version>
+        <relativePath>../pom.xml</relativePath>
+    </parent>
+    
+    <groupId>org.jboss.seam.examples-ee6.quartz</groupId>
+    <artifactId>quartz-tests</artifactId>
+    <name>Quartz Integration Tests Module (EE6)</name>
+    
+    <dependencies>
+        <dependency>
+            <groupId>org.testng</groupId>
+            <artifactId>testng</artifactId>
+            <classifier>jdk15</classifier>
+        </dependency>
+        <dependency>
+            <groupId>org.jboss.seam.examples-ee6.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.0_spec</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>org.hibernate.javax.persistence</groupId>
+            <artifactId>hibernate-jpa-2.0-api</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>org.seleniumhq.selenium.server</groupId>
+            <artifactId>selenium-server</artifactId>
+            <classifier>standalone</classifier>
+        </dependency>
+        <dependency>
+            <groupId>org.seleniumhq.selenium.client-drivers</groupId>
+            <artifactId>selenium-java-client-driver</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>org.jboss.seam</groupId>
+            <artifactId>functional-tests</artifactId>
+            <scope>test</scope>
+        </dependency>
+        <dependency>
+            <groupId>org.dbunit</groupId>
+            <artifactId>dbunit</artifactId>
+        </dependency>
+    </dependencies>
+    
+    <build>
+        <testResources>
+            <testResource>
+                <directory>src/test/resources</directory>
+                <filtering>true</filtering>
+            </testResource>
+            <testResource>
+                <directory>${basedir}/../quartz-ear/src/main/resources</directory>
+                <filtering>true</filtering>
+            </testResource>
+            <testResource>
+                 <directory>${basedir}/../quartz-web/src/main/resources</directory>
+                 <filtering>true</filtering>
+            </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>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>
+    </profiles>
+    
+</project>

Added: branches/community/Seam_2_3/examples-ee6/quartz/quartz-tests/src/test/java/org/jboss/seam/example/quartz/test/AccountTest.java
===================================================================
--- branches/community/Seam_2_3/examples-ee6/quartz/quartz-tests/src/test/java/org/jboss/seam/example/quartz/test/AccountTest.java	                        (rev 0)
+++ branches/community/Seam_2_3/examples-ee6/quartz/quartz-tests/src/test/java/org/jboss/seam/example/quartz/test/AccountTest.java	2012-04-03 11:31:37 UTC (rev 14483)
@@ -0,0 +1,89 @@
+package org.jboss.seam.example.quartz.test;
+
+import java.util.List;
+
+import org.jboss.seam.example.quartz.Account;
+import org.jboss.seam.example.quartz.Payment;
+import org.jboss.seam.mock.DBUnitSeamTest;
+import org.testng.annotations.Test;
+
+/**
+ * 
+ * @author Pete Muir
+ *
+ */
+public class AccountTest 
+    extends DBUnitSeamTest 
+{
+    
+    @Override
+    protected void prepareDBUnitOperations() {
+        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();
+        
+        
+        
+    }
+    
+}

Added: branches/community/Seam_2_3/examples-ee6/quartz/quartz-tests/src/test/java/org/jboss/seam/example/quartz/test/AsynchronousTest.java
===================================================================
--- branches/community/Seam_2_3/examples-ee6/quartz/quartz-tests/src/test/java/org/jboss/seam/example/quartz/test/AsynchronousTest.java	                        (rev 0)
+++ branches/community/Seam_2_3/examples-ee6/quartz/quartz-tests/src/test/java/org/jboss/seam/example/quartz/test/AsynchronousTest.java	2012-04-03 11:31:37 UTC (rev 14483)
@@ -0,0 +1,109 @@
+package org.jboss.seam.example.quartz.test;
+
+import static org.jboss.seam.example.quartz.Payment.Frequency.ONCE;
+
+import java.math.BigDecimal;
+
+import org.jboss.seam.example.quartz.Account;
+import org.jboss.seam.example.quartz.Payment;
+import org.jboss.seam.mock.DBUnitSeamTest;
+import org.testng.annotations.Test;
+
+/**
+ * 
+ * @author Pete Muir
+ *
+ */
+
+// Actually this doesn't happen in the example, but lets test it here to keep
+// all quartz tests in one place
+public class AsynchronousTest extends DBUnitSeamTest 
+{
+    
+    @Override
+    protected void prepareDBUnitOperations() {
+        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) {
+            
+        }                
+    }
+
+    
+    
+}

Added: branches/community/Seam_2_3/examples-ee6/quartz/quartz-tests/src/test/java/org/jboss/seam/example/quartz/test/CronTest.java
===================================================================
--- branches/community/Seam_2_3/examples-ee6/quartz/quartz-tests/src/test/java/org/jboss/seam/example/quartz/test/CronTest.java	                        (rev 0)
+++ branches/community/Seam_2_3/examples-ee6/quartz/quartz-tests/src/test/java/org/jboss/seam/example/quartz/test/CronTest.java	2012-04-03 11:31:37 UTC (rev 14483)
@@ -0,0 +1,446 @@
+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.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.DBUnitSeamTest;
+import org.testng.annotations.Test;
+
+/**
+ * @author Pete Muir
+ * 
+ */
+
+public class CronTest  extends DBUnitSeamTest 
+{
+    private QuartzTriggerHandle quartzTriggerHandle;
+    private Long paymentId;
+    
+    private static final Frequency REPEATING = EVERY_SECOND;
+
+    
+    @Override
+    protected void prepareDBUnitOperations() {
+        beforeTestOperations.add(
+                new DataSetOperation("BaseData.xml")
+        );
+    }
+
+    
+    
+    
+  
+    //@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();
+            }
+        }
+    }
+
+    //@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/community/Seam_2_3/examples-ee6/quartz/quartz-tests/src/test/java/org/jboss/seam/example/quartz/test/EventsTest.java
===================================================================
--- branches/community/Seam_2_3/examples-ee6/quartz/quartz-tests/src/test/java/org/jboss/seam/example/quartz/test/EventsTest.java	                        (rev 0)
+++ branches/community/Seam_2_3/examples-ee6/quartz/quartz-tests/src/test/java/org/jboss/seam/example/quartz/test/EventsTest.java	2012-04-03 11:31:37 UTC (rev 14483)
@@ -0,0 +1,254 @@
+package org.jboss.seam.example.quartz.test;
+
+import static org.jboss.seam.example.quartz.Payment.Frequency.ONCE;
+
+import java.math.BigDecimal;
+
+import org.jboss.seam.example.quartz.Account;
+import org.jboss.seam.example.quartz.Payment;
+import org.jboss.seam.mock.DBUnitSeamTest;
+import org.testng.annotations.Test;
+
+/**
+ * 
+ * @author Pete Muir
+ *
+ */
+
+// Actually this doesn't happen in the example, but lets test it here to keep
+// all quartz tests in one place
+public class EventsTest extends DBUnitSeamTest 
+{
+    
+    @Override
+    protected void prepareDBUnitOperations() {
+        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) {
+            
+        }                
+    }
+
+    
+    
+}

Added: branches/community/Seam_2_3/examples-ee6/quartz/quartz-tests/src/test/java/org/jboss/seam/example/quartz/test/OnceTest.java
===================================================================
--- branches/community/Seam_2_3/examples-ee6/quartz/quartz-tests/src/test/java/org/jboss/seam/example/quartz/test/OnceTest.java	                        (rev 0)
+++ branches/community/Seam_2_3/examples-ee6/quartz/quartz-tests/src/test/java/org/jboss/seam/example/quartz/test/OnceTest.java	2012-04-03 11:31:37 UTC (rev 14483)
@@ -0,0 +1,128 @@
+package org.jboss.seam.example.quartz.test;
+
+import static org.jboss.seam.example.quartz.Payment.Frequency.ONCE;
+
+import java.math.BigDecimal;
+
+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.DBUnitSeamTest;
+import org.testng.annotations.Test;
+/**
+ * 
+ * @author Pete Muir
+ *
+ */
+
+public class OnceTest extends DBUnitSeamTest 
+{
+    private QuartzTriggerHandle quartzTriggerHandle;
+    
+    @Override
+    protected void prepareDBUnitOperations() {
+        beforeTestOperations.add(
+                new DataSetOperation("BaseData.xml")
+        );
+    }
+    
+   
+    
+    //@Test
+    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) {
+            
+        }                
+    }
+
+    
+    
+}

Added: branches/community/Seam_2_3/examples-ee6/quartz/quartz-tests/src/test/java/org/jboss/seam/example/quartz/test/RepeatingTest.java
===================================================================
--- branches/community/Seam_2_3/examples-ee6/quartz/quartz-tests/src/test/java/org/jboss/seam/example/quartz/test/RepeatingTest.java	                        (rev 0)
+++ branches/community/Seam_2_3/examples-ee6/quartz/quartz-tests/src/test/java/org/jboss/seam/example/quartz/test/RepeatingTest.java	2012-04-03 11:31:37 UTC (rev 14483)
@@ -0,0 +1,448 @@
+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.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.DBUnitSeamTest;
+import org.testng.annotations.Test;
+
+/**
+ * 
+ * @author Pete Muir
+ *
+ */
+
+public class RepeatingTest 
+    extends DBUnitSeamTest 
+{
+    private QuartzTriggerHandle quartzTriggerHandle;
+    private Long paymentId;
+    
+    private static final Frequency REPEATING = EVERY_SECOND;
+
+    
+    @Override
+    protected void prepareDBUnitOperations() {
+        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) {
+            
+        }                
+    }
+
+    
+    
+}

Added: branches/community/Seam_2_3/examples-ee6/quartz/quartz-tests/src/test/java/org/jboss/seam/example/quartz/test/TestPaymentController.java
===================================================================
--- branches/community/Seam_2_3/examples-ee6/quartz/quartz-tests/src/test/java/org/jboss/seam/example/quartz/test/TestPaymentController.java	                        (rev 0)
+++ branches/community/Seam_2_3/examples-ee6/quartz/quartz-tests/src/test/java/org/jboss/seam/example/quartz/test/TestPaymentController.java	2012-04-03 11:31:37 UTC (rev 14483)
@@ -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;
+    }
+    
+}

Added: branches/community/Seam_2_3/examples-ee6/quartz/quartz-tests/src/test/java/org/jboss/seam/example/quartz/test/TestPaymentProcessor.java
===================================================================
--- branches/community/Seam_2_3/examples-ee6/quartz/quartz-tests/src/test/java/org/jboss/seam/example/quartz/test/TestPaymentProcessor.java	                        (rev 0)
+++ branches/community/Seam_2_3/examples-ee6/quartz/quartz-tests/src/test/java/org/jboss/seam/example/quartz/test/TestPaymentProcessor.java	2012-04-03 11:31:37 UTC (rev 14483)
@@ -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());
+    }
+
+}

Added: branches/community/Seam_2_3/examples-ee6/quartz/quartz-tests/src/test/java/org/jboss/seam/example/quartz/test/TransactionStatus.java
===================================================================
--- branches/community/Seam_2_3/examples-ee6/quartz/quartz-tests/src/test/java/org/jboss/seam/example/quartz/test/TransactionStatus.java	                        (rev 0)
+++ branches/community/Seam_2_3/examples-ee6/quartz/quartz-tests/src/test/java/org/jboss/seam/example/quartz/test/TransactionStatus.java	2012-04-03 11:31:37 UTC (rev 14483)
@@ -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;
+    }
+
+}

Added: branches/community/Seam_2_3/examples-ee6/quartz/quartz-tests/src/test/java/org/jboss/seam/example/quartz/test/selenium/QuartzPaymentTest.java
===================================================================
--- branches/community/Seam_2_3/examples-ee6/quartz/quartz-tests/src/test/java/org/jboss/seam/example/quartz/test/selenium/QuartzPaymentTest.java	                        (rev 0)
+++ branches/community/Seam_2_3/examples-ee6/quartz/quartz-tests/src/test/java/org/jboss/seam/example/quartz/test/selenium/QuartzPaymentTest.java	2012-04-03 11:31:37 UTC (rev 14483)
@@ -0,0 +1,93 @@
+/*
+ * 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);
+   }
+}

Added: branches/community/Seam_2_3/examples-ee6/quartz/quartz-tests/src/test/resources/BaseData.xml
===================================================================
--- branches/community/Seam_2_3/examples-ee6/quartz/quartz-tests/src/test/resources/BaseData.xml	                        (rev 0)
+++ branches/community/Seam_2_3/examples-ee6/quartz/quartz-tests/src/test/resources/BaseData.xml	2012-04-03 11:31:37 UTC (rev 14483)
@@ -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/community/Seam_2_3/examples-ee6/quartz/quartz-tests/src/test/resources/WEB-INF/components.xml
===================================================================
--- branches/community/Seam_2_3/examples-ee6/quartz/quartz-tests/src/test/resources/WEB-INF/components.xml	                        (rev 0)
+++ branches/community/Seam_2_3/examples-ee6/quartz/quartz-tests/src/test/resources/WEB-INF/components.xml	2012-04-03 11:31:37 UTC (rev 14483)
@@ -0,0 +1,48 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<components xmlns="http://jboss.com/products/seam/components"
+            xmlns:pay="http://jboss.com/products/seam/examples/quartz"
+            xmlns:core="http://jboss.com/products/seam/core"
+            xmlns:async="http://jboss.com/products/seam/async"
+            xmlns:framework="http://jboss.com/products/seam/framework"
+            xmlns:persistence="http://jboss.com/products/seam/persistence"
+            xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+            xsi:schemaLocation=
+                "http://jboss.com/products/seam/core http://jboss.com/products/seam/core-2.3.xsd
+                 http://jboss.com/products/seam/async http://jboss.com/products/seam/async-2.3.xsd
+                 http://jboss.com/products/seam/framework http://jboss.com/products/seam/framework-2.3.xsd
+                 http://jboss.com/products/seam/persistence http://jboss.com/products/seam/persistence-2.3.xsd
+                 http://jboss.com/products/seam/components http://jboss.com/products/seam/components-2.3.xsd">
+
+    <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="seam-quartz/#{ejbName}/local" />
+
+</components>

Added: branches/community/Seam_2_3/examples-ee6/quartz/quartz-tests/src/test/resources/quartz.properties
===================================================================
--- branches/community/Seam_2_3/examples-ee6/quartz/quartz-tests/src/test/resources/quartz.properties	                        (rev 0)
+++ branches/community/Seam_2_3/examples-ee6/quartz/quartz-tests/src/test/resources/quartz.properties	2012-04-03 11:31:37 UTC (rev 14483)
@@ -0,0 +1,34 @@
+ #
+ # 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


Property changes on: branches/community/Seam_2_3/examples-ee6/quartz/quartz-tests/src/test/resources/quartz.properties
___________________________________________________________________
Added: svn:executable
   + *

Added: branches/community/Seam_2_3/examples-ee6/quartz/quartz-tests/src/test/resources/seam.properties
===================================================================
Added: branches/community/Seam_2_3/examples-ee6/quartz/quartz-tests/src/test/resources/seam.quartz.properties
===================================================================
--- branches/community/Seam_2_3/examples-ee6/quartz/quartz-tests/src/test/resources/seam.quartz.properties	                        (rev 0)
+++ branches/community/Seam_2_3/examples-ee6/quartz/quartz-tests/src/test/resources/seam.quartz.properties	2012-04-03 11:31:37 UTC (rev 14483)
@@ -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/community/Seam_2_3/examples-ee6/quartz/quartz-tests/src/test/resources-ftest/testng.xml
===================================================================
--- branches/community/Seam_2_3/examples-ee6/quartz/quartz-tests/src/test/resources-ftest/testng.xml	                        (rev 0)
+++ branches/community/Seam_2_3/examples-ee6/quartz/quartz-tests/src/test/resources-ftest/testng.xml	2012-04-03 11:31:37 UTC (rev 14483)
@@ -0,0 +1,25 @@
+    <!--
+        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>


Property changes on: branches/community/Seam_2_3/examples-ee6/quartz/quartz-tests/src/test/resources-ftest/testng.xml
___________________________________________________________________
Added: svn:executable
   + *

Added: branches/community/Seam_2_3/examples-ee6/quartz/quartz-tests/src/test/resources-integration/testng.xml
===================================================================
--- branches/community/Seam_2_3/examples-ee6/quartz/quartz-tests/src/test/resources-integration/testng.xml	                        (rev 0)
+++ branches/community/Seam_2_3/examples-ee6/quartz/quartz-tests/src/test/resources-integration/testng.xml	2012-04-03 11:31:37 UTC (rev 14483)
@@ -0,0 +1,18 @@
+<!DOCTYPE suite SYSTEM "http://beust.com/testng/testng-1.0.dtd" >
+
+<suite name="Quartz Example" verbose="2" parallel="false">
+	<test name="Quartz Example">
+      
+        <parameter name="datasourceJndiName" value="java:/DefaultDS"/>
+        <parameter name="database" value="HSQL" />
+        
+		<classes>
+			<class name="org.jboss.seam.example.quartz.test.AccountTest" />
+            <class name="org.jboss.seam.example.quartz.test.CronTest" />
+            <class name="org.jboss.seam.example.quartz.test.OnceTest" />
+            <class name="org.jboss.seam.example.quartz.test.RepeatingTest" />
+            <class name="org.jboss.seam.example.quartz.test.AsynchronousTest" />
+            <class name="org.jboss.seam.example.quartz.test.EventsTest" />
+		</classes>
+	</test>
+</suite>

Added: branches/community/Seam_2_3/examples-ee6/quartz/quartz-web/pom.xml
===================================================================
--- branches/community/Seam_2_3/examples-ee6/quartz/quartz-web/pom.xml	                        (rev 0)
+++ branches/community/Seam_2_3/examples-ee6/quartz/quartz-web/pom.xml	2012-04-03 11:31:37 UTC (rev 14483)
@@ -0,0 +1,81 @@
+<?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-ee6</groupId>
+        <version>2.3.0.Beta2-SNAPSHOT</version>
+        <relativePath>../pom.xml</relativePath>
+    </parent>
+    
+    <groupId>org.jboss.seam.examples-ee6.quartz</groupId>
+    <artifactId>quartz-web</artifactId>
+    <packaging>war</packaging>
+    <name>Quartz Web Module (EE6)</name>
+    
+    <properties>
+        <!-- filtering property for components.xml -->
+        <jndiPattern>java:app/quartz-ejb/#{ejbName}</jndiPattern>
+    </properties>
+    
+    <dependencies>
+        <dependency>
+            <groupId>org.jboss.seam.examples-ee6.quartz</groupId>
+            <artifactId>quartz-ejb</artifactId>
+            <type>ejb</type>
+            <scope>provided</scope>
+        </dependency>
+        <dependency>
+            <groupId>org.jboss.seam</groupId>
+            <artifactId>jboss-seam</artifactId>
+            <type>ejb</type>
+            <scope>provided</scope>
+        </dependency>
+        <dependency>
+            <groupId>org.jboss.seam</groupId>
+            <artifactId>jboss-seam-ui</artifactId>
+            <exclusions>
+                <exclusion>
+                    <groupId>org.jboss.seam</groupId>
+                    <artifactId>jboss-seam-jul</artifactId>
+                </exclusion>
+                <exclusion>
+                    <groupId>commons-beanutils</groupId>
+                    <artifactId>commons-beanutils</artifactId>
+                </exclusion>
+            </exclusions>
+        </dependency>
+        <dependency>
+            <groupId>org.jboss.seam</groupId>
+            <artifactId>jboss-seam-debug</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>commons-beanutils</groupId>
+            <artifactId>commons-beanutils</artifactId>
+            <exclusions>
+                <exclusion>
+                    <groupId>commons-collections</groupId>
+                    <artifactId>commons-collections</artifactId>
+                </exclusion>
+            </exclusions>
+        </dependency>
+    </dependencies>
+  
+    <build>
+        <plugins>
+            <plugin>
+                <groupId>org.apache.maven.plugins</groupId>
+                <artifactId>maven-war-plugin</artifactId>
+                <configuration>
+                    <webResources>
+                        <resource>
+                            <directory>src/main/webapp</directory>
+                            <filtering>true</filtering>
+                        </resource>
+                    </webResources>
+                </configuration>
+            </plugin>
+        </plugins>
+    </build>
+    
+</project>

Added: branches/community/Seam_2_3/examples-ee6/quartz/quartz-web/src/main/resources/seam.quartz.properties
===================================================================
--- branches/community/Seam_2_3/examples-ee6/quartz/quartz-web/src/main/resources/seam.quartz.properties	                        (rev 0)
+++ branches/community/Seam_2_3/examples-ee6/quartz/quartz-web/src/main/resources/seam.quartz.properties	2012-04-03 11:31:37 UTC (rev 14483)
@@ -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/community/Seam_2_3/examples-ee6/quartz/quartz-web/src/main/webapp/WEB-INF/components.xml
===================================================================
--- branches/community/Seam_2_3/examples-ee6/quartz/quartz-web/src/main/webapp/WEB-INF/components.xml	                        (rev 0)
+++ branches/community/Seam_2_3/examples-ee6/quartz/quartz-web/src/main/webapp/WEB-INF/components.xml	2012-04-03 11:31:37 UTC (rev 14483)
@@ -0,0 +1,50 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<components xmlns="http://jboss.com/products/seam/components"
+            xmlns:pay="http://jboss.com/products/seam/examples/quartz"
+            xmlns:core="http://jboss.com/products/seam/core"
+            xmlns:async="http://jboss.com/products/seam/async"
+            xmlns:framework="http://jboss.com/products/seam/framework"
+            xmlns:persistence="http://jboss.com/products/seam/persistence"
+            xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+            xsi:schemaLocation=
+                "http://jboss.com/products/seam/core http://jboss.com/products/seam/core-2.3.xsd
+                 http://jboss.com/products/seam/async http://jboss.com/products/seam/async-2.3.xsd
+                 http://jboss.com/products/seam/framework http://jboss.com/products/seam/framework-2.3.xsd
+                 http://jboss.com/products/seam/persistence http://jboss.com/products/seam/persistence-2.3.xsd
+                 http://jboss.com/products/seam/components http://jboss.com/products/seam/components-2.3.xsd">
+
+    <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="@jndiPattern@" />
+
+    <component class="org.jboss.seam.transaction.EjbSynchronizations" jndi-name="java:app/jboss-seam/EjbSynchronizations"/>
+
+</components>

Added: branches/community/Seam_2_3/examples-ee6/quartz/quartz-web/src/main/webapp/WEB-INF/faces-config.xml
===================================================================
--- branches/community/Seam_2_3/examples-ee6/quartz/quartz-web/src/main/webapp/WEB-INF/faces-config.xml	                        (rev 0)
+++ branches/community/Seam_2_3/examples-ee6/quartz/quartz-web/src/main/webapp/WEB-INF/faces-config.xml	2012-04-03 11:31:37 UTC (rev 14483)
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<faces-config version="2.1"
+              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-facesconfig_2_1.xsd">
+
+</faces-config>

Added: branches/community/Seam_2_3/examples-ee6/quartz/quartz-web/src/main/webapp/WEB-INF/pages.xml
===================================================================
--- branches/community/Seam_2_3/examples-ee6/quartz/quartz-web/src/main/webapp/WEB-INF/pages.xml	                        (rev 0)
+++ branches/community/Seam_2_3/examples-ee6/quartz/quartz-web/src/main/webapp/WEB-INF/pages.xml	2012-04-03 11:31:37 UTC (rev 14483)
@@ -0,0 +1,16 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<pages xmlns="http://jboss.com/products/seam/pages"
+       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+       xsi:schemaLocation="http://jboss.com/products/seam/pages http://jboss.com/products/seam/pages-2.3.xsd">
+
+   <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/community/Seam_2_3/examples-ee6/quartz/quartz-web/src/main/webapp/WEB-INF/web.xml
===================================================================
--- branches/community/Seam_2_3/examples-ee6/quartz/quartz-web/src/main/webapp/WEB-INF/web.xml	                        (rev 0)
+++ branches/community/Seam_2_3/examples-ee6/quartz/quartz-web/src/main/webapp/WEB-INF/web.xml	2012-04-03 11:31:37 UTC (rev 14483)
@@ -0,0 +1,58 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<web-app version="3.0" 
+         xmlns="http://java.sun.com/xml/ns/javaee"
+         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+         xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd">
+    
+    <!-- Seam -->
+    
+    <listener>
+        <listener-class>org.jboss.seam.servlet.SeamListener</listener-class>
+    </listener>
+    
+    <filter>
+        <filter-name>Seam Filter</filter-name>
+        <filter-class>org.jboss.seam.servlet.SeamFilter</filter-class>
+    </filter>
+
+    <filter-mapping>
+        <filter-name>Seam Filter</filter-name>
+        <url-pattern>/*</url-pattern>
+    </filter-mapping>
+        
+    <servlet>
+      <servlet-name>Seam Resource Servlet</servlet-name>
+      <servlet-class>org.jboss.seam.servlet.SeamResourceServlet</servlet-class>
+    </servlet>
+    
+    <servlet-mapping>
+      <servlet-name>Seam Resource Servlet</servlet-name>
+      <url-pattern>/seam/resource/*</url-pattern>
+    </servlet-mapping>     
+
+    <context-param>
+        <param-name>javax.faces.DEFAULT_SUFFIX</param-name>
+        <param-value>.xhtml</param-value>
+    </context-param>
+
+    <context-param>
+        <param-name>facelets.DEVELOPMENT</param-name>
+        <param-value>true</param-value>
+    </context-param>
+
+    <servlet>
+        <servlet-name>Faces Servlet</servlet-name>
+        <servlet-class>javax.faces.webapp.FacesServlet</servlet-class>
+        <load-on-startup>1</load-on-startup>
+    </servlet>
+    
+    <servlet-mapping>
+        <servlet-name>Faces Servlet</servlet-name>
+        <url-pattern>*.seam</url-pattern>
+    </servlet-mapping>
+    
+    <session-config>
+        <session-timeout>10</session-timeout> 
+    </session-config>
+    
+</web-app>

Added: branches/community/Seam_2_3/examples-ee6/quartz/quartz-web/src/main/webapp/date.css
===================================================================
--- branches/community/Seam_2_3/examples-ee6/quartz/quartz-web/src/main/webapp/date.css	                        (rev 0)
+++ branches/community/Seam_2_3/examples-ee6/quartz/quartz-web/src/main/webapp/date.css	2012-04-03 11:31:37 UTC (rev 14483)
@@ -0,0 +1,184 @@
+div.seam-date 
+{
+  margin-top: 5px;
+  border: 1px solid #AAAAAA;
+  background-color: #FFFFFF;  
+  color: #505050;
+  font-family: Tahoma, Arial, Helvetica, sans-serif;
+  font-size: 12px;
+}
+
+table.seam-date td {
+  font-family: Tahoma, Arial, Helvetica, sans-serif;
+  font-size: 11px; 
+}
+
+.seam-date-monthNames
+{
+  width: 70px;
+  border: 1px solid #dddddd;
+  border-right: 3px solid #444444;
+  border-bottom: 3px solid #444444;
+  background-color: #ffffff; 
+  font-size: 12px;
+  cursor: pointer;	
+  font-family: Tahoma, Arial, Helvetica, sans-serif;
+  font-weight: normal;
+}
+
+a.seam-date-monthNameLink, a.seam-date-monthNameLink:visited
+{
+  text-align: center;
+  display: block;
+  color: #555555;  
+}
+
+a.seam-date-monthNameLink:hover
+{ 
+  background-color: #CCCCCC;
+  color: red;  
+}
+
+.seam-date-years
+{
+  height: 10em;
+  overflow: auto;
+  width: 60px;
+  border: 1px solid #dddddd;
+  border-right: 3px solid #444444;
+  border-bottom: 3px solid #444444;
+  background-color: #ffffff; 
+  font-size: 12px;
+  cursor: pointer;	
+  font-family: Tahoma, Arial, Helvetica, sans-serif;
+  font-weight: normal;
+}
+
+a.seam-date-yearLink, a.seam-date-yearLink:visited
+{
+  text-align: center;
+  display: block;
+  color: #555555;    
+}
+
+a.seam-date-yearLink:hover
+{
+  background-color: #CCCCCC;
+  color: red;    
+}  
+
+tr.seam-date-header
+{
+  padding: 2px 0px 2px 0px;
+}
+  
+td.seam-date-header
+{
+  padding: 0px 8px 0px 8px;
+  text-align: center;
+  color: gray;
+  font-family: Tahoma, Arial, Helvetica, sans-serif;
+  font-weight: bold;
+  font-size: 12px;  
+}
+
+td.seam-date-header-prevMonth
+{
+  background-image: url("./img/cal-prev.png");
+  background-repeat: no-repeat;
+  background-position: center;
+  padding: 0px 2px 0px 2px;
+  width: 17px;
+  height: 16px;
+  margin-left: 2px;
+}
+
+td.seam-date-header-nextMonth
+{
+  background-image: url("./img/cal-next.png");
+  background-repeat: no-repeat;
+  background-position: center;
+  padding: 0px 2px 0px 2px;
+  width: 17px;
+  height: 16px;
+  margin-right: 2px;
+}
+
+tr.seam-date-headerDays
+{
+  color: white;
+  font-weight: normal;
+}
+
+tr.seam-date-headerDays > td
+{
+  background-color: #CCCCCC;
+  border: 1px solid #AAAAAA;
+  color: white;
+  text-align: center;
+  width: 26px;   
+}
+
+tr.seam-date-footer
+{
+  background-color: white; 
+  color: #505050;
+  font-weight: bold;
+}
+
+tr.seam-date-footer > td
+{
+  text-align: center;
+}
+
+td.seam-date-inMonth
+{
+  background-color: white; 
+  color: black;
+  font-weight: normal;
+  cursor: pointer;
+  border: 1px solid #ece9d8;
+}
+
+td.seam-date-outMonth
+{
+  background-color: white; 
+  color: #999999;
+  font-weight: normal;
+  cursor: pointer;
+  border: 1px solid #ece9d8;
+}
+
+td.seam-date-selected
+{
+  background-color: #CCCCCC;        
+  border: 1px solid #AAAAAA; 
+  color: black;
+  font-weight: normal;
+}
+
+td.seam-date-dayOff-inMonth
+{
+  background-color: #efefef;
+  color: black;
+  font-weight: normal;
+  cursor: pointer;
+  border: 1px solid #ece9d8;
+}
+
+td.seam-date-dayOff-outMonth
+{
+  background-color: #efefef;
+  color: #999999;
+  font-weight: normal;
+  cursor: pointer;
+  border: 1px solid #ece9d8;
+}
+
+td.seam-date-hover 
+{
+  background-color: #CCCCCC;
+  border: 1px solid #AAAAAA;
+  cursor: pointer;
+  color: red;
+}
\ No newline at end of file

Added: branches/community/Seam_2_3/examples-ee6/quartz/quartz-web/src/main/webapp/img/cal-next.png
===================================================================
(Binary files differ)


Property changes on: branches/community/Seam_2_3/examples-ee6/quartz/quartz-web/src/main/webapp/img/cal-next.png
___________________________________________________________________
Added: svn:mime-type
   + application/octet-stream

Added: branches/community/Seam_2_3/examples-ee6/quartz/quartz-web/src/main/webapp/img/cal-prev.png
===================================================================
(Binary files differ)


Property changes on: branches/community/Seam_2_3/examples-ee6/quartz/quartz-web/src/main/webapp/img/cal-prev.png
___________________________________________________________________
Added: svn:mime-type
   + application/octet-stream

Added: branches/community/Seam_2_3/examples-ee6/quartz/quartz-web/src/main/webapp/img/dtpick.gif
===================================================================
(Binary files differ)


Property changes on: branches/community/Seam_2_3/examples-ee6/quartz/quartz-web/src/main/webapp/img/dtpick.gif
___________________________________________________________________
Added: svn:mime-type
   + application/octet-stream

Added: branches/community/Seam_2_3/examples-ee6/quartz/quartz-web/src/main/webapp/index.html
===================================================================
--- branches/community/Seam_2_3/examples-ee6/quartz/quartz-web/src/main/webapp/index.html	                        (rev 0)
+++ branches/community/Seam_2_3/examples-ee6/quartz/quartz-web/src/main/webapp/index.html	2012-04-03 11:31:37 UTC (rev 14483)
@@ -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/community/Seam_2_3/examples-ee6/quartz/quartz-web/src/main/webapp/screen.css
===================================================================
--- branches/community/Seam_2_3/examples-ee6/quartz/quartz-web/src/main/webapp/screen.css	                        (rev 0)
+++ branches/community/Seam_2_3/examples-ee6/quartz/quartz-web/src/main/webapp/screen.css	2012-04-03 11:31:37 UTC (rev 14483)
@@ -0,0 +1,145 @@
+a:active, a:link, a:visited {
+	color: #0D5798;    
+}
+a:hover {
+	color: #8CAFCD;
+}
+
+.menuButtons {
+	background-color: #FF6600; /*#8CAFCD*/
+	padding-top: 10px;
+	padding-bottom: 10px;
+}
+.menuButtons a {
+    font-weight: bold;
+    text-decoration: none;
+	padding-left: 25px;
+	padding-right: 25px;
+}
+.menuButtons a:active, .menuButtons a:link, .menuButtons a:visited {
+	font-family: Arial,sans-serif;
+	background-color: #FF6600; /*#8CAFCD*/
+	color: white;
+	border-right: 1px solid white;
+}
+.menuButtons a:hover {
+	font-family: Arial,sans-serif;
+    background-color: white;
+    color: #FF6600; /*#8CAFCD*/
+}
+
+.actionButtons {
+	width: 100%;
+	text-align: center;
+	padding-top: 10px;
+}
+.tableControl {
+	width: 100%;
+	text-align: right;
+	padding-top: 15px;
+}
+.actionButtons a, .tableControl a {
+	font-family: Arial,sans-serif;
+	font-weight: bold;
+	color: #578BB8;
+	border: 1px solid #578BB8;
+	text-decoration: none;
+	padding: 5px;
+	margin: 5px;
+}
+.actionButtons a:hover, .tableControl a:hover {
+	color: white;
+	background-color: #578BB8;
+	margin: 5px;
+}
+
+h1 {
+	font-family: Arial,sans-serif;
+	color: #578BB8;
+	font-size: 1.6em;
+	margin-top: 0;
+}
+
+body {
+	margin: 0px;
+	font-family: Arial,sans-serif;
+	color: #616161;
+}
+
+.body {
+	padding: 30px;
+}
+
+
+table.results {
+	width: 100%;
+}
+
+table.results th {
+	background-color: #578BB8;
+	color: white;
+	font-family: Arial,sans-serif;
+	padding: 5px;
+	
+}
+
+table.results td {
+	background-color: #F0F0F0;
+	text-align: center;
+}
+
+.narrow {
+	width: 20%;
+}
+.wide {
+	width: 80%;
+}
+
+.first td {
+	background-color: #F0F0F0;
+}
+
+.second td {
+	background-color: white;
+}
+
+.dialog 
+{
+	padding: 15px;
+	background-color: #F0F0F0;
+	margin: 10px;	
+}
+.dialog table
+{
+	width: auto;
+}
+
+.message {
+	border: 1px solid #FFCC00;
+	padding: 5px;
+	margin-top: 5px;
+	margin-bottom: 5px;
+	background-color: #F0F0F0;
+}
+
+.prop {
+	padding: 5px;
+}
+.prop .name {
+	font-weight: bold;
+	text-align: left;
+	width: 115px;
+}
+.prop .value {
+	text-align: left;
+}
+.prop .errors {
+	color: red;
+	text-align: left;
+}
+.value input {
+	width:190px;
+}
+.errors input {
+	border: 1px solid red;
+}

Added: branches/community/Seam_2_3/examples-ee6/quartz/quartz-web/src/main/webapp/search.xhtml
===================================================================
--- branches/community/Seam_2_3/examples-ee6/quartz/quartz-web/src/main/webapp/search.xhtml	                        (rev 0)
+++ branches/community/Seam_2_3/examples-ee6/quartz/quartz-web/src/main/webapp/search.xhtml	2012-04-03 11:31:37 UTC (rev 14483)
@@ -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.com/products/seam/taglib"
+      template="template.xhtml">
+<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"> 
+                                    <s: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}"> 
+                                    <s: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}">
+                  <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>

Added: branches/community/Seam_2_3/examples-ee6/quartz/readme.txt
===================================================================
--- branches/community/Seam_2_3/examples-ee6/quartz/readme.txt	                        (rev 0)
+++ branches/community/Seam_2_3/examples-ee6/quartz/readme.txt	2012-04-03 11:31:37 UTC (rev 14483)
@@ -0,0 +1,19 @@
+Seam Quartz Example
+===================
+
+This example demonstrates the Seam Quartz Timer functionality. It runs on JBoss
+AS as an EAR.
+
+To deploy the example to JBoss AS, follow these steps:
+
+* In the example root directory run:
+
+    mvn clean package
+
+* Set JBOSS_HOME environment property.
+
+* In the quartz-ear directory run:
+
+    mvn jboss:hard-deploy
+
+* Open this URL in a web browser: http://localhost:8080/seam-quartz



More information about the seam-commits mailing list