Seam SVN: r15542 - branches/enterprise/WFK-2_1/build.
by seam-commits@lists.jboss.org
Author: manaRH
Date: 2013-06-04 06:28:59 -0400 (Tue, 04 Jun 2013)
New Revision: 15542
Modified:
branches/enterprise/WFK-2_1/build/build.properties
Log:
fixed version
Modified: branches/enterprise/WFK-2_1/build/build.properties
===================================================================
--- branches/enterprise/WFK-2_1/build/build.properties 2013-06-04 09:25:36 UTC (rev 15541)
+++ branches/enterprise/WFK-2_1/build/build.properties 2013-06-04 10:28:59 UTC (rev 15542)
@@ -1,2 +1,2 @@
-complete.version=2.3.1.Final-redhat-1
+complete.version=2.3.1.Final-redhat-2
version=2.3
\ No newline at end of file
11 years, 5 months
Seam SVN: r15541 - in branches/enterprise/WFK-2_1: examples/quartz/quartz-ear and 20 other directories.
by seam-commits@lists.jboss.org
Author: tremes
Date: 2013-06-04 05:25:36 -0400 (Tue, 04 Jun 2013)
New Revision: 15541
Added:
branches/enterprise/WFK-2_1/examples/quartz/quartz-ejb/src/test/
branches/enterprise/WFK-2_1/examples/quartz/quartz-ejb/src/test/java/
branches/enterprise/WFK-2_1/examples/quartz/quartz-ejb/src/test/java/org/
branches/enterprise/WFK-2_1/examples/quartz/quartz-ejb/src/test/java/org/jboss/
branches/enterprise/WFK-2_1/examples/quartz/quartz-ejb/src/test/java/org/jboss/seam/
branches/enterprise/WFK-2_1/examples/quartz/quartz-ejb/src/test/java/org/jboss/seam/example/
branches/enterprise/WFK-2_1/examples/quartz/quartz-ejb/src/test/java/org/jboss/seam/example/quartz/
branches/enterprise/WFK-2_1/examples/quartz/quartz-ejb/src/test/java/org/jboss/seam/example/quartz/test/
branches/enterprise/WFK-2_1/examples/quartz/quartz-ejb/src/test/java/org/jboss/seam/example/quartz/test/AccountTest.java
branches/enterprise/WFK-2_1/examples/quartz/quartz-ejb/src/test/java/org/jboss/seam/example/quartz/test/AsynchronousTest.java
branches/enterprise/WFK-2_1/examples/quartz/quartz-ejb/src/test/java/org/jboss/seam/example/quartz/test/CronTest.java
branches/enterprise/WFK-2_1/examples/quartz/quartz-ejb/src/test/java/org/jboss/seam/example/quartz/test/Deployments.java
branches/enterprise/WFK-2_1/examples/quartz/quartz-ejb/src/test/java/org/jboss/seam/example/quartz/test/EventsTest.java
branches/enterprise/WFK-2_1/examples/quartz/quartz-ejb/src/test/java/org/jboss/seam/example/quartz/test/OnceTest.java
branches/enterprise/WFK-2_1/examples/quartz/quartz-ejb/src/test/java/org/jboss/seam/example/quartz/test/RepeatingTest.java
branches/enterprise/WFK-2_1/examples/quartz/quartz-ejb/src/test/java/org/jboss/seam/example/quartz/test/TestPaymentController.java
branches/enterprise/WFK-2_1/examples/quartz/quartz-ejb/src/test/java/org/jboss/seam/example/quartz/test/TestPaymentProcessor.java
branches/enterprise/WFK-2_1/examples/quartz/quartz-ejb/src/test/java/org/jboss/seam/example/quartz/test/TransactionStatus.java
branches/enterprise/WFK-2_1/examples/quartz/quartz-ejb/src/test/resources/
branches/enterprise/WFK-2_1/examples/quartz/quartz-ejb/src/test/resources/BaseData.xml
branches/enterprise/WFK-2_1/examples/quartz/quartz-ejb/src/test/resources/arquillian.xml
branches/enterprise/WFK-2_1/examples/quartz/quartz-ejb/src/test/resources/components.xml
branches/enterprise/WFK-2_1/examples/quartz/quartz-ejb/src/test/resources/ejb-jar.xml
branches/enterprise/WFK-2_1/examples/quartz/quartz-ejb/src/test/resources/import.sql
branches/enterprise/WFK-2_1/examples/quartz/quartz-ejb/src/test/resources/index.html
branches/enterprise/WFK-2_1/examples/quartz/quartz-ejb/src/test/resources/jboss-deployment-structure.xml
branches/enterprise/WFK-2_1/examples/quartz/quartz-ejb/src/test/resources/pages.xml
branches/enterprise/WFK-2_1/examples/quartz/quartz-ejb/src/test/resources/persistence.xml
branches/enterprise/WFK-2_1/examples/quartz/quartz-ejb/src/test/resources/seam.properties
branches/enterprise/WFK-2_1/examples/quartz/quartz-ejb/src/test/resources/seam.quartz.properties
branches/enterprise/WFK-2_1/examples/quartz/quartz-ejb/src/test/resources/search.xhtml
branches/enterprise/WFK-2_1/examples/quartz/quartz-ejb/src/test/resources/web.xml
Removed:
branches/enterprise/WFK-2_1/examples/quartz/quartz-tests/pom.xml
branches/enterprise/WFK-2_1/examples/quartz/quartz-tests/src/test/java/org/jboss/seam/example/quartz/test/AccountTest.java
branches/enterprise/WFK-2_1/examples/quartz/quartz-tests/src/test/java/org/jboss/seam/example/quartz/test/AsynchronousTest.java
branches/enterprise/WFK-2_1/examples/quartz/quartz-tests/src/test/java/org/jboss/seam/example/quartz/test/CronTest.java
branches/enterprise/WFK-2_1/examples/quartz/quartz-tests/src/test/java/org/jboss/seam/example/quartz/test/Deployments.java
branches/enterprise/WFK-2_1/examples/quartz/quartz-tests/src/test/java/org/jboss/seam/example/quartz/test/EventsTest.java
branches/enterprise/WFK-2_1/examples/quartz/quartz-tests/src/test/java/org/jboss/seam/example/quartz/test/OnceTest.java
branches/enterprise/WFK-2_1/examples/quartz/quartz-tests/src/test/java/org/jboss/seam/example/quartz/test/RepeatingTest.java
branches/enterprise/WFK-2_1/examples/quartz/quartz-tests/src/test/java/org/jboss/seam/example/quartz/test/TestPaymentController.java
branches/enterprise/WFK-2_1/examples/quartz/quartz-tests/src/test/java/org/jboss/seam/example/quartz/test/TestPaymentProcessor.java
branches/enterprise/WFK-2_1/examples/quartz/quartz-tests/src/test/java/org/jboss/seam/example/quartz/test/TransactionStatus.java
branches/enterprise/WFK-2_1/examples/quartz/quartz-tests/src/test/java/org/jboss/seam/example/quartz/test/selenium/QuartzPaymentTest.java
branches/enterprise/WFK-2_1/examples/quartz/quartz-tests/src/test/resources-ftest/testng.xml
branches/enterprise/WFK-2_1/examples/quartz/quartz-tests/src/test/resources-integration/arquillian.xml
branches/enterprise/WFK-2_1/examples/quartz/quartz-tests/src/test/resources-integration/web.xml
branches/enterprise/WFK-2_1/examples/quartz/quartz-tests/src/test/resources/BaseData.xml
branches/enterprise/WFK-2_1/examples/quartz/quartz-tests/src/test/resources/WEB-INF/components.xml
branches/enterprise/WFK-2_1/examples/quartz/quartz-tests/src/test/resources/quartz.properties
branches/enterprise/WFK-2_1/examples/quartz/quartz-tests/src/test/resources/seam.quartz.properties
Modified:
branches/enterprise/WFK-2_1/examples/quartz/pom.xml
branches/enterprise/WFK-2_1/examples/quartz/quartz-ear/pom.xml
branches/enterprise/WFK-2_1/examples/quartz/quartz-ejb/pom.xml
branches/enterprise/WFK-2_1/examples/quartz/quartz-web/pom.xml
branches/enterprise/WFK-2_1/jboss-seam/src/main/java/org/jboss/seam/mock/ResourceRequestEnvironment.java
Log:
Quartz example migrated
Modified: branches/enterprise/WFK-2_1/examples/quartz/pom.xml
===================================================================
--- branches/enterprise/WFK-2_1/examples/quartz/pom.xml 2013-06-04 07:13:54 UTC (rev 15540)
+++ branches/enterprise/WFK-2_1/examples/quartz/pom.xml 2013-06-04 09:25:36 UTC (rev 15541)
@@ -3,25 +3,44 @@
<modelVersion>4.0.0</modelVersion>
<groupId>org.jboss.seam.examples</groupId>
<artifactId>quartz</artifactId>
- <parent>
- <groupId>org.jboss.seam</groupId>
- <artifactId>examples</artifactId>
- <version>2.3.1.Final-redhat-2</version>
- </parent>
+ <version>2.3.1.Final-redhat-2</version>
<packaging>pom</packaging>
<name>Quartz Example (EE6)</name>
- <properties>
- <example.name>quartz</example.name>
- </properties>
-
<modules>
<module>quartz-ear</module>
<module>quartz-ejb</module>
<module>quartz-web</module>
- <module>quartz-tests</module>
</modules>
+ <properties>
+ <example.name>quartz</example.name>
+ <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
+ <maven.compiler.target>1.6</maven.compiler.target>
+ <maven.compiler.source>1.6</maven.compiler.source>
+
+ <!-- To use jacoco, set jacoco.agent system property to something like
+ -javaagent:/path/to/jacocoagent.jar=append=true,destfile=/path/to/output/jacoco.exec -->
+ <jacoco.agent />
+
+ <!-- To use custom Maven settings and profiles, uncomment and customize
+ the following properties. This is necessary for the ShrinkWrap resolver to
+ function properly. -->
+ <!--<maven.user.settings>/path/to/custom/settings.xml</maven.user.settings> -->
+ <!--<maven.profiles>custom,profile</maven.profiles> -->
+
+ <version.commons.logging>1.1.1</version.commons.logging>
+ <version.shrinkwrap.resolver>2.0.0-beta-4</version.shrinkwrap.resolver>
+
+ <!-- Plugin versions -->
+ <version.dependency.plugin>2.5.1</version.dependency.plugin>
+ <version.surefire.plugin>2.10</version.surefire.plugin>
+ <version.compiler.plugin>2.3.1</version.compiler.plugin>
+ <version.ear.plugin>2.6</version.ear.plugin>
+ <version.war.plugin>2.1.1</version.war.plugin>
+ <version.jboss.maven.plugin>7.4.Final</version.jboss.maven.plugin>
+ </properties>
+
<dependencyManagement>
<dependencies>
<dependency>
@@ -30,17 +49,78 @@
<version>${project.version}</version>
<type>ejb</type>
</dependency>
+
<dependency>
<groupId>org.jboss.seam.examples.quartz</groupId>
<artifactId>quartz-web</artifactId>
<version>${project.version}</version>
<type>war</type>
</dependency>
+
<dependency>
<groupId>org.jboss.seam.examples.quartz</groupId>
<artifactId>quartz-ear</artifactId>
<version>${project.version}</version>
</dependency>
+
+ <!-- BOMs -->
+ <dependency>
+ <groupId>org.jboss.shrinkwrap.resolver</groupId>
+ <artifactId>shrinkwrap-resolver-bom</artifactId>
+ <version>${version.shrinkwrap.resolver}</version>
+ <scope>import</scope>
+ <type>pom</type>
+ </dependency>
+
+ <dependency>
+ <groupId>org.jboss.seam</groupId>
+ <artifactId>bom</artifactId>
+ <version>${project.version}</version>
+ <type>pom</type>
+ <scope>import</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.jboss.seam</groupId>
+ <artifactId>jboss-seam</artifactId>
+ <version>${project.version}</version>
+ <exclusions>
+ <exclusion>
+ <groupId>org.testng</groupId>
+ <artifactId>testng</artifactId>
+ </exclusion>
+ </exclusions>
+ </dependency>
</dependencies>
</dependencyManagement>
+
+ <build>
+ <pluginManagement>
+ <plugins>
+ <!-- Manage plugin versions for build stability -->
+ <plugin>
+ <artifactId>maven-surefire-plugin</artifactId>
+ <version>${version.surefire.plugin}</version>
+ <configuration>
+ <systemPropertyVariables>
+ <org.apache.maven.user-settings>${maven.user.settings}</org.apache.maven.user-settings>
+ <maven.profiles>${maven.profiles}</maven.profiles>
+ </systemPropertyVariables>
+ </configuration>
+ </plugin>
+ <plugin>
+ <artifactId>maven-dependency-plugin</artifactId>
+ <version>${version.dependency.plugin}</version>
+ </plugin>
+ <plugin>
+ <artifactId>maven-compiler-plugin</artifactId>
+ <version>${version.compiler.plugin}</version>
+ <configuration>
+ <source>${maven.compiler.source}</source>
+ <target>${maven.compiler.target}</target>
+ </configuration>
+ </plugin>
+ </plugins>
+ </pluginManagement>
+ </build>
</project>
Modified: branches/enterprise/WFK-2_1/examples/quartz/quartz-ear/pom.xml
===================================================================
--- branches/enterprise/WFK-2_1/examples/quartz/quartz-ear/pom.xml 2013-06-04 07:13:54 UTC (rev 15540)
+++ branches/enterprise/WFK-2_1/examples/quartz/quartz-ear/pom.xml 2013-06-04 09:25:36 UTC (rev 15541)
@@ -1,4 +1,4 @@
-<?xml version="1.0" encoding="UTF-8"?>
+:<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
@@ -52,6 +52,7 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-ear-plugin</artifactId>
+ <version>${version.ear.plugin}</version>
<configuration>
<version>6</version>
<defaultLibBundleDir>lib</defaultLibBundleDir>
Modified: branches/enterprise/WFK-2_1/examples/quartz/quartz-ejb/pom.xml
===================================================================
--- branches/enterprise/WFK-2_1/examples/quartz/quartz-ejb/pom.xml 2013-06-04 07:13:54 UTC (rev 15540)
+++ branches/enterprise/WFK-2_1/examples/quartz/quartz-ejb/pom.xml 2013-06-04 09:25:36 UTC (rev 15541)
@@ -71,6 +71,130 @@
<groupId>org.opensymphony.quartz</groupId>
<artifactId>quartz</artifactId>
</dependency>
+
+ <!-- Test dependencies -->
+ <dependency>
+ <groupId>org.jboss.shrinkwrap.resolver</groupId>
+ <artifactId>shrinkwrap-resolver-depchain</artifactId>
+ <type>pom</type>
+ <scope>test</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <scope>test</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.jboss.arquillian.junit</groupId>
+ <artifactId>arquillian-junit-container</artifactId>
+ <scope>test</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.jboss.arquillian.protocol</groupId>
+ <artifactId>arquillian-protocol-servlet</artifactId>
+ <scope>test</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.dbunit</groupId>
+ <artifactId>dbunit</artifactId>
+ <scope>test</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.jboss.spec.javax.el</groupId>
+ <artifactId>jboss-el-api_2.2_spec</artifactId>
+ <scope>test</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>commons-logging</groupId>
+ <artifactId>commons-logging</artifactId>
+ <version>${version.commons.logging}</version>
+ <scope>test</scope>
+ </dependency>
</dependencies>
+
+ <profiles>
+ <profile>
+ <id>integration-tests</id>
+ <activation>
+ <property>
+ <name>arquillian</name>
+ </property>
+ </activation>
+ <properties>
+ <jndiPattern>java:app/seam-quartz/#{ejbName}</jndiPattern>
+ <distributable>false</distributable>
+ </properties>
+ <build>
+ <testResources>
+ <testResource>
+ <directory>src/test/resources</directory>
+ <filtering>true</filtering>
+ </testResource>
+ </testResources>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-surefire-plugin</artifactId>
+ <configuration>
+ <skip>false</skip>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+ </profile>
+
+ <profile>
+ <id>arq-jbossas-7-managed</id>
+ <activation>
+ <property>
+ <name>arquillian</name>
+ <value>jbossas-managed-7</value>
+ </property>
+ </activation>
+ <dependencies>
+ <dependency>
+ <groupId>org.jboss.as</groupId>
+ <artifactId>jboss-as-arquillian-container-managed</artifactId>
+ <scope>test</scope>
+ </dependency>
+ </dependencies>
+ </profile>
+
+ <profile>
+ <id>arq-jbossas-7-remote</id>
+ <activation>
+ <property>
+ <name>arquillian</name>
+ <value>jbossas-remote-7</value>
+ </property>
+ </activation>
+ <dependencies>
+ <dependency>
+ <groupId>org.jboss.as</groupId>
+ <artifactId>jboss-as-arquillian-container-remote</artifactId>
+ <scope>test</scope>
+ </dependency>
+ </dependencies>
+ </profile>
+ </profiles>
+
+ <build>
+ <plugins>
+ <!-- Skip tests by default -->
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-surefire-plugin</artifactId>
+ <configuration>
+ <skip>true</skip>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
</project>
Copied: branches/enterprise/WFK-2_1/examples/quartz/quartz-ejb/src/test/java/org/jboss/seam/example/quartz/test/AccountTest.java (from rev 15540, branches/enterprise/WFK-2_1/examples/quartz/quartz-tests/src/test/java/org/jboss/seam/example/quartz/test/AccountTest.java)
===================================================================
--- branches/enterprise/WFK-2_1/examples/quartz/quartz-ejb/src/test/java/org/jboss/seam/example/quartz/test/AccountTest.java (rev 0)
+++ branches/enterprise/WFK-2_1/examples/quartz/quartz-ejb/src/test/java/org/jboss/seam/example/quartz/test/AccountTest.java 2013-06-04 09:25:36 UTC (rev 15541)
@@ -0,0 +1,105 @@
+package org.jboss.seam.example.quartz.test;
+
+import java.util.List;
+
+import org.jboss.arquillian.container.test.api.Deployment;
+import org.jboss.arquillian.container.test.api.OverProtocol;
+import org.jboss.arquillian.junit.Arquillian;
+import org.jboss.seam.example.quartz.Account;
+import org.jboss.seam.example.quartz.Payment;
+import org.jboss.seam.mock.DBJUnitSeamTest;
+import org.jboss.shrinkwrap.api.Archive;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+
+/**
+ *
+ * @author Pete Muir
+ *
+ */
+(a)RunWith(Arquillian.class)
+public class AccountTest
+ extends DBJUnitSeamTest
+{
+ @Deployment(name="AccountTest")
+ @OverProtocol("Servlet 3.0")
+ public static Archive<?> createDeployment()
+ {
+ return Deployments.quartzDeployment();
+ }
+
+ @Override
+ protected void prepareDBUnitOperations() {
+
+ setDatabase("HSQL");
+ setDatasourceJndiName("java:jboss/datasources/ExampleDS");
+
+ beforeTestOperations.add(
+ new DataSetOperation("BaseData.xml")
+ );
+ }
+
+ @Test
+ public void listAccounts() throws Exception
+ {
+ new FacesRequest("/search.xhtml")
+ {
+
+ @Override
+ @SuppressWarnings("unchecked")
+ protected void renderResponse() throws Exception
+ {
+ List<Account> accounts = (List<Account>) getValue("#{accounts.resultList}");
+
+ assert accounts.size() == 5;
+ }
+
+ }.run();
+ }
+
+ @Test
+ public void selectAccount() throws Exception
+ {
+ String id = new FacesRequest("/search.xhtml")
+ {
+
+ @Override
+ @SuppressWarnings("unchecked")
+ protected void renderResponse() throws Exception
+ {
+ assert !((Boolean)getValue("#{accountHome.idDefined}"));
+ }
+ }.run();
+
+ new FacesRequest("/search.xhtml", id)
+ {
+
+ @Override
+ protected void beforeRequest()
+ {
+ setParameter("accountId", "1");
+ }
+
+ @Override
+ protected void renderResponse() throws Exception
+ {
+ assert ((Boolean) getValue("#{accountHome.idDefined}"));
+
+ Account account = (Account) getValue("#{selectedAccount}");
+ assert account !=null;
+ assert account.getId() == 1;
+ assert account.getPayments().size() == 0;
+
+ Payment payment = (Payment) getValue("#{newPayment}");
+ assert payment.getPayee().equals("Somebody");
+ assert payment.getAccount() != null;
+ assert payment.getAccount().getId() == 1;
+
+ }
+ }.run();
+
+
+
+ }
+
+}
Copied: branches/enterprise/WFK-2_1/examples/quartz/quartz-ejb/src/test/java/org/jboss/seam/example/quartz/test/AsynchronousTest.java (from rev 15540, branches/enterprise/WFK-2_1/examples/quartz/quartz-tests/src/test/java/org/jboss/seam/example/quartz/test/AsynchronousTest.java)
===================================================================
--- branches/enterprise/WFK-2_1/examples/quartz/quartz-ejb/src/test/java/org/jboss/seam/example/quartz/test/AsynchronousTest.java (rev 0)
+++ branches/enterprise/WFK-2_1/examples/quartz/quartz-ejb/src/test/java/org/jboss/seam/example/quartz/test/AsynchronousTest.java 2013-06-04 09:25:36 UTC (rev 15541)
@@ -0,0 +1,125 @@
+package org.jboss.seam.example.quartz.test;
+
+import static org.jboss.seam.example.quartz.Payment.Frequency.ONCE;
+
+import java.math.BigDecimal;
+
+import org.jboss.arquillian.container.test.api.Deployment;
+import org.jboss.arquillian.container.test.api.OverProtocol;
+import org.jboss.arquillian.junit.Arquillian;
+import org.jboss.seam.example.quartz.Account;
+import org.jboss.seam.example.quartz.Payment;
+import org.jboss.seam.mock.DBJUnitSeamTest;
+import org.jboss.shrinkwrap.api.Archive;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+
+/**
+ *
+ * @author Pete Muir
+ *
+ */
+
+// Actually this doesn't happen in the example, but lets test it here to keep
+// all quartz tests in one place
+(a)RunWith(Arquillian.class)
+public class AsynchronousTest extends DBJUnitSeamTest
+{
+ @Deployment(name="AsynchronousTest")
+ @OverProtocol("Servlet 3.0")
+ public static Archive<?> createDeployment()
+ {
+ return Deployments.quartzDeployment();
+ }
+
+ @Override
+ protected void prepareDBUnitOperations() {
+
+ setDatabase("HSQL");
+ setDatasourceJndiName("java:jboss/datasources/ExampleDS");
+
+ beforeTestOperations.add(
+ new DataSetOperation("BaseData.xml")
+ );
+ }
+
+ @Test
+ public void testAsynchronous() throws Exception
+ {
+ String id = new FacesRequest("/search.xhtml")
+ {
+ @Override
+ protected void beforeRequest()
+ {
+ setParameter("accountId", "1");
+ }
+
+ @Override
+ protected void updateModelValues() throws Exception
+ {
+ setValue("#{newPayment.payee}", "IRS");
+ setValue("#{newPayment.amount}", new BigDecimal("100.00"));
+ setValue("#{newPayment.paymentFrequency}", ONCE);
+ }
+
+ @Override
+ protected void invokeApplication() throws Exception
+ {
+ invokeMethod("#{paymentHome.scheduleAndSaveAsynchronously}");
+ }
+
+ @Override
+ protected void renderResponse() throws Exception
+ {
+ assert ((Boolean)getValue("#{accountHome.idDefined}"));
+ Account account = (Account) getValue("#{selectedAccount}");
+ assert account !=null;
+ assert account.getId() == 1;
+ assert account.getPayments().size() == 1;
+ }
+
+ }.run();
+
+ // Wait, let quartz execute the async method which schedules the job
+ // for immediate execution
+ pause(50);
+
+ new FacesRequest("/search.xhtml", id)
+ {
+
+ @Override
+ protected void beforeRequest()
+ {
+ setParameter("accountId", "1");
+ }
+
+ @Override
+ protected void renderResponse() throws Exception
+ {
+ assert ((Boolean)getValue("#{accountHome.idDefined}"));
+ Account account = (Account) getValue("#{selectedAccount}");
+ assert account !=null;
+ assert account.getId() == 1;
+ assert account.getPayments().size() == 1;
+ Payment payment = account.getPayments().get(0);
+ assert new BigDecimal("100.00").equals(payment.getAmount());
+ //assert !payment.getActive();
+ //assert payment.getLastPaid() != null;
+ assert new BigDecimal("901.46").equals(account.getBalance());
+ }
+
+ }.run();
+ }
+
+
+ private void pause(long ms) {
+ try {
+ Thread.sleep(ms);
+ } catch (InterruptedException e) {
+
+ }
+ }
+
+
+
+}
Copied: branches/enterprise/WFK-2_1/examples/quartz/quartz-ejb/src/test/java/org/jboss/seam/example/quartz/test/CronTest.java (from rev 15540, branches/enterprise/WFK-2_1/examples/quartz/quartz-tests/src/test/java/org/jboss/seam/example/quartz/test/CronTest.java)
===================================================================
--- branches/enterprise/WFK-2_1/examples/quartz/quartz-ejb/src/test/java/org/jboss/seam/example/quartz/test/CronTest.java (rev 0)
+++ branches/enterprise/WFK-2_1/examples/quartz/quartz-ejb/src/test/java/org/jboss/seam/example/quartz/test/CronTest.java 2013-06-04 09:25:36 UTC (rev 15541)
@@ -0,0 +1,462 @@
+package org.jboss.seam.example.quartz.test;
+
+import static org.jboss.seam.example.quartz.Payment.Frequency.EVERY_SECOND;
+
+import java.math.BigDecimal;
+
+import org.jboss.arquillian.container.test.api.Deployment;
+import org.jboss.arquillian.container.test.api.OverProtocol;
+import org.jboss.arquillian.junit.Arquillian;
+import org.jboss.seam.async.QuartzTriggerHandle;
+import org.jboss.seam.example.quartz.Account;
+import org.jboss.seam.example.quartz.Payment;
+import org.jboss.seam.example.quartz.Payment.Frequency;
+import org.jboss.seam.mock.DBJUnitSeamTest;
+import org.jboss.shrinkwrap.api.Archive;
+import org.junit.Ignore;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+
+/**
+ * @author Pete Muir
+ *
+ */
+(a)RunWith(Arquillian.class)
+public class CronTest extends DBJUnitSeamTest
+{
+ private QuartzTriggerHandle quartzTriggerHandle;
+ private Long paymentId;
+
+ private static final Frequency REPEATING = EVERY_SECOND;
+
+ @Deployment(name="CronTest")
+ @OverProtocol("Servlet 3.0")
+ public static Archive<?> createDeployment()
+ {
+ return Deployments.quartzDeployment();
+ }
+
+ @Override
+ protected void prepareDBUnitOperations() {
+ setDatabase("HSQL");
+ setDatasourceJndiName("java:jboss/datasources/ExampleDS");
+
+ beforeTestOperations.add(
+ new DataSetOperation("BaseData.xml")
+ );
+ }
+
+
+
+
+ @Ignore
+ @Test
+ public void scheduleCron() throws Exception
+ {
+
+ try
+ {
+ String id = new FacesRequest("/search.xhtml")
+ {
+ @Override
+ protected void beforeRequest()
+ {
+ setParameter("accountId", "1");
+ }
+
+ @Override
+ protected void updateModelValues() throws Exception
+ {
+ setValue("#{newPayment.payee}", "IRS");
+ setValue("#{newPayment.amount}", new BigDecimal("110.00"));
+ setValue("#{newPayment.paymentCron}", "*/2 * * * * ?" );
+ }
+
+ @Override
+ protected void invokeApplication() throws Exception
+ {
+ // schedule a the repeating job and immediately pause it
+ // this allows you to carefully control how long the timer
+ // runs for
+ assert "persisted".equals(invokeMethod("#{paymentHome.saveAndScheduleCron}"));
+ Payment payment = (Payment) getValue("#{newPayment}");
+ quartzTriggerHandle = payment.getQuartzTriggerHandle();
+ quartzTriggerHandle.pause();
+ }
+
+ @Override
+ protected void renderResponse() throws Exception
+ {
+ // Check the job exists
+ assert ((Boolean)getValue("#{accountHome.idDefined}"));
+ Account account = (Account) getValue("#{selectedAccount}");
+ assert account !=null;
+ assert account.getId() == 1;
+ assert account.getPayments().size() == 1;
+
+ Payment payment = (Payment) getValue("#{newPayment}");
+ assert payment.getPayee().equals("IRS");
+ assert payment.getAmount().equals(new BigDecimal("110.00"));
+ assert payment.getAccount() != null;
+ assert payment.getAccount().getId() == 1;
+ assert payment.getActive();
+ }
+
+ }.run();
+
+ // Start the triggerHandle, wait a lot shorter than the job takes
+ // At this point the job should have executed once exactly
+ quartzTriggerHandle.resume();
+ pause((long) (REPEATING.getInterval() * 0.5));
+ quartzTriggerHandle.pause();
+
+ new FacesRequest("/search.xhtml", id)
+ {
+
+ @Override
+ protected void beforeRequest()
+ {
+ setParameter("accountId", "1");
+ }
+
+ @Override
+ protected void renderResponse() throws Exception
+ {
+ assert ((Boolean)getValue("#{accountHome.idDefined}"));
+ Account account = (Account) getValue("#{selectedAccount}");
+ assert account !=null;
+ assert account.getId() == 1;
+ assert account.getPayments().size() == 1;
+ Payment payment = account.getPayments().get(0);
+ assert new BigDecimal("110.00").equals(payment.getAmount());
+ assert payment.getActive();
+ assert "*/2 * * * * ?".equals(payment.getPaymentCron());
+
+ assert new BigDecimal("891.46").equals(account.getBalance());
+ }
+
+ }.run();
+
+ // Start the triggerHandle, wait until some short time after the
+ // job triggers once
+ quartzTriggerHandle.resume();
+ pause(2000l);
+ quartzTriggerHandle.pause();
+
+
+ new FacesRequest("/search.xhtml", id)
+ {
+
+ @Override
+ protected void beforeRequest()
+ {
+ setParameter("accountId", "1");
+ }
+
+ @Override
+ protected void renderResponse() throws Exception
+ {
+
+ // Job should have run twice
+ assert ((Boolean)getValue("#{accountHome.idDefined}"));
+ Account account = (Account) getValue("#{selectedAccount}");
+
+ assert account !=null;
+ assert account.getId() == 1;
+ assert account.getPayments().size() == 1;
+ Payment payment = account.getPayments().get(0);
+ assert new BigDecimal("110.00").equals(payment.getAmount());
+ assert payment.getActive();
+ assert "*/2 * * * * ?".equals(payment.getPaymentCron());
+ assert payment.getLastPaid() != null;
+ assert new BigDecimal("781.46").equals(account.getBalance());
+ paymentId = payment.getId();
+ }
+
+ }.run();
+
+ new FacesRequest("/search.xhtml", id)
+ {
+
+ @Override
+ protected void beforeRequest()
+ {
+ setParameter("accountId", "1");
+ setParameter("paymentId", paymentId.toString());
+ }
+
+ @Override
+ protected void invokeApplication() throws Exception
+ {
+ // Resume the job, then cancel it
+ quartzTriggerHandle.resume();
+ invokeMethod("#{paymentHome.cancel}");
+ }
+
+ @Override
+ protected void renderResponse() throws Exception
+ {
+
+ assert ((Boolean)getValue("#{accountHome.idDefined}"));
+ Account account = (Account) getValue("#{selectedAccount}");
+
+ assert account !=null;
+ assert account.getId() == 1;
+ assert account.getPayments().size() == 1;
+ Payment payment = account.getPayments().get(0);
+ assert new BigDecimal("110.00").equals(payment.getAmount());
+ assert !payment.getActive();
+ assert payment.getLastPaid() != null;
+ assert new BigDecimal("781.46").equals(account.getBalance());
+ }
+
+ }.run();
+
+ // Wait until some short time after another execution would
+ // have occurred to check it really stops
+ pause(2000l);
+
+ new FacesRequest("/search.xhtml", id)
+ {
+
+ @Override
+ protected void beforeRequest()
+ {
+ setParameter("accountId", "1");
+ }
+
+ @Override
+ protected void renderResponse() throws Exception
+ {
+
+ assert ((Boolean)getValue("#{accountHome.idDefined}"));
+ Account account = (Account) getValue("#{selectedAccount}");
+
+ assert account !=null;
+ assert account.getId() == 1;
+ assert new BigDecimal("781.46").equals(account.getBalance());
+ }
+
+ }.run();
+
+ }
+ finally
+ {
+ if (quartzTriggerHandle != null)
+ {
+ quartzTriggerHandle.cancel();
+ }
+ }
+ }
+
+ @Ignore
+ @Test
+ public void scheduleCronWithStartAndEndTime() throws Exception
+ {
+
+ try
+ {
+ String id = new FacesRequest("/search.xhtml")
+ {
+ @Override
+ protected void beforeRequest()
+ {
+ setParameter("accountId", "1");
+ }
+
+ @Override
+ protected void updateModelValues() throws Exception
+ {
+ setValue("#{newPayment.payee}", "IRS");
+ setValue("#{newPayment.amount}", new BigDecimal("110.00"));
+ setValue("#{newPayment.paymentCron}", "*/2 * * * * ?" );
+ }
+
+ @Override
+ protected void invokeApplication() throws Exception
+ {
+ // schedule a the repeating job and immediately pause it
+ // this allows you to carefully control how long the timer
+ // runs for
+ Payment payment = (Payment) getValue("#{newPayment}");
+ payment.setPaymentDate(new java.sql.Timestamp( System.currentTimeMillis() + REPEATING.getInterval()));
+ payment.setPaymentEndDate(new java.sql.Timestamp( (long) (System.currentTimeMillis() + (REPEATING.getInterval() * 4.5))));
+ assert "persisted".equals(invokeMethod("#{paymentHome.saveAndScheduleCron}"));
+ quartzTriggerHandle = payment.getQuartzTriggerHandle();
+ quartzTriggerHandle.pause();
+ }
+
+ @Override
+ protected void renderResponse() throws Exception
+ {
+ // Check the job exists
+ assert ((Boolean)getValue("#{accountHome.idDefined}"));
+ Account account = (Account) getValue("#{selectedAccount}");
+ assert account !=null;
+ assert account.getId() == 1;
+ assert account.getPayments().size() == 1;
+
+ Payment payment = (Payment) getValue("#{newPayment}");
+ assert payment.getPayee().equals("IRS");
+ assert payment.getAmount().equals(new BigDecimal("110.00"));
+ assert payment.getAccount() != null;
+ assert payment.getAccount().getId() == 1;
+ assert payment.getActive();
+ }
+
+ }.run();
+
+ // Start the triggerHandle, wait a lot shorter than the job takes
+ // At this point the job should have executed once exactly
+ quartzTriggerHandle.resume();
+ pause((long) (REPEATING.getInterval() * 0.5));
+ quartzTriggerHandle.pause();
+
+ new FacesRequest("/search.xhtml", id)
+ {
+
+ @Override
+ protected void beforeRequest()
+ {
+ setParameter("accountId", "1");
+ }
+
+ @Override
+ protected void renderResponse() throws Exception
+ {
+ assert ((Boolean)getValue("#{accountHome.idDefined}"));
+ Account account = (Account) getValue("#{selectedAccount}");
+ assert account !=null;
+ assert account.getId() == 1;
+ assert account.getPayments().size() == 1;
+ Payment payment = account.getPayments().get(0);
+ assert new BigDecimal("110.00").equals(payment.getAmount());
+ assert payment.getActive();
+ assert "*/2 * * * * ?".equals(payment.getPaymentCron());
+
+ assert new BigDecimal("1001.46").equals(account.getBalance());
+ }
+
+ }.run();
+
+ // Start the triggerHandle, wait until some short time after the initial
+ // expiration
+ quartzTriggerHandle.resume();
+ pause(REPEATING.getInterval());
+ quartzTriggerHandle.pause();
+
+
+ new FacesRequest("/search.xhtml", id)
+ {
+
+ @Override
+ protected void beforeRequest()
+ {
+ setParameter("accountId", "1");
+ }
+
+ @Override
+ protected void renderResponse() throws Exception
+ {
+
+ // Job should have run twice
+ assert ((Boolean)getValue("#{accountHome.idDefined}"));
+ Account account = (Account) getValue("#{selectedAccount}");
+
+ assert account !=null;
+ assert account.getId() == 1;
+ assert account.getPayments().size() == 1;
+ Payment payment = account.getPayments().get(0);
+ assert new BigDecimal("110.00").equals(payment.getAmount());
+ assert payment.getActive();
+ assert "*/2 * * * * ?".equals(payment.getPaymentCron());
+ assert new BigDecimal("891.46").equals(account.getBalance());
+ paymentId = payment.getId();
+ }
+
+ }.run();
+
+ // Start the triggerHandle, wait until some short time after the
+ // job triggers once
+ quartzTriggerHandle.resume();
+ pause(2000l);
+
+ new FacesRequest("/search.xhtml", id)
+ {
+
+ @Override
+ protected void beforeRequest()
+ {
+ setParameter("accountId", "1");
+ }
+
+ @Override
+ protected void renderResponse() throws Exception
+ {
+
+ // Job should have run twice
+ assert ((Boolean)getValue("#{accountHome.idDefined}"));
+ Account account = (Account) getValue("#{selectedAccount}");
+
+ assert account !=null;
+ assert account.getId() == 1;
+ assert account.getPayments().size() == 1;
+ Payment payment = account.getPayments().get(0);
+ assert new BigDecimal("110.00").equals(payment.getAmount());
+ assert payment.getActive();
+ assert "*/2 * * * * ?".equals(payment.getPaymentCron());
+ assert payment.getLastPaid() != null;
+ assert new BigDecimal("781.46").equals(account.getBalance());
+ paymentId = payment.getId();
+ }
+
+ }.run();
+
+ // Wait until some short time after another execution would
+ // have occurred to check it really stops
+ pause(2000l);
+
+ new FacesRequest("/search.xhtml", id)
+ {
+
+ @Override
+ protected void beforeRequest()
+ {
+ setParameter("accountId", "1");
+ }
+
+ @Override
+ protected void renderResponse() throws Exception
+ {
+
+ assert ((Boolean)getValue("#{accountHome.idDefined}"));
+ Account account = (Account) getValue("#{selectedAccount}");
+
+ assert account !=null;
+ assert account.getId() == 1;
+ assert new BigDecimal("781.46").equals(account.getBalance());
+ }
+
+ }.run();
+
+ }
+ finally
+ {
+ if (quartzTriggerHandle != null)
+ {
+ quartzTriggerHandle.cancel();
+ }
+ }
+ }
+
+ private void pause(long ms) {
+ try {
+ Thread.sleep(ms);
+ } catch (InterruptedException e) {
+
+ }
+ }
+
+
+
+}
Added: branches/enterprise/WFK-2_1/examples/quartz/quartz-ejb/src/test/java/org/jboss/seam/example/quartz/test/Deployments.java
===================================================================
--- branches/enterprise/WFK-2_1/examples/quartz/quartz-ejb/src/test/java/org/jboss/seam/example/quartz/test/Deployments.java (rev 0)
+++ branches/enterprise/WFK-2_1/examples/quartz/quartz-ejb/src/test/java/org/jboss/seam/example/quartz/test/Deployments.java 2013-06-04 09:25:36 UTC (rev 15541)
@@ -0,0 +1,74 @@
+package org.jboss.seam.example.quartz.test;
+
+import java.io.File;
+
+import org.jboss.seam.example.quartz.PaymentProcessor;
+import org.jboss.shrinkwrap.api.ShrinkWrap;
+import org.jboss.shrinkwrap.api.spec.JavaArchive;
+import org.jboss.shrinkwrap.api.spec.WebArchive;
+import org.jboss.shrinkwrap.resolver.api.maven.Maven;
+
+public class Deployments {
+ /* public static EnterpriseArchive quartzDeployment() {
+ EnterpriseArchive ear = ShrinkWrap.create(ZipImporter.class, "seam-quartz.ear").importFrom(new File("../quartz-ear/target/seam-quartz.ear"))
+ .as(EnterpriseArchive.class);
+
+ // Install org.jboss.seam.mock.MockSeamListener
+ WebArchive web = ear.getAsType(WebArchive.class, "quartz-web.war");
+ web.delete("/WEB-INF/web.xml");
+ web.addAsWebInfResource("web.xml");
+
+ web.addAsResource("BaseData.xml", "BaseData.xml");
+
+ web.delete("/WEB-INF/components.xml");
+ web.addAsWebInfResource("WEB-INF/components.xml", "components.xml");
+
+ JavaArchive ejb = ear.getAsType(JavaArchive.class, "quartz-ejb.jar");
+ ejb.addClasses(TestPaymentController.class, TestPaymentProcessor.class, TransactionStatus.class);
+
+ ear.addAsLibraries(DependencyResolvers.use(MavenDependencyResolver.class)
+ .configureFrom("pom.xml")
+ .artifact("org.dbunit:dbunit:jar:2.2")
+ .resolveAsFiles());
+
+ return ear;
+ }*/
+
+ public static WebArchive quartzDeployment() {
+
+ // use profiles defined in 'maven.profiles' property in pom.xml
+ String profilesString = System.getProperty("maven.profiles");
+ String[] profiles = profilesString != null ? profilesString.split(", ?") : new String[0];
+
+ File[] libs = Maven.resolver().loadPomFromFile("pom.xml", profiles)
+ .importCompileAndRuntimeDependencies()
+ // force resolve jboss-seam, because it is provided-scoped in the pom, but we need it bundled in the WAR
+ .resolve("org.jboss.seam:jboss-seam").withTransitivity().asFile();
+
+ File[] dbunitLibs = Maven.resolver().loadPomFromFile("pom.xml")
+ .resolve("org.dbunit:dbunit:jar:2.2")
+ .withoutTransitivity().asFile();
+
+ JavaArchive ejb = ShrinkWrap.create(JavaArchive.class,"quartz-ejb.jar");
+ ejb.addPackage(PaymentProcessor.class.getPackage());
+
+ return ShrinkWrap.create(WebArchive.class, "seam-quartz.war")
+ .addPackage(AsynchronousTest.class.getPackage())
+ .addPackage(PaymentProcessor.class.getPackage())
+ .addAsWebInfResource("META-INF/ejb-jar.xml", "ejb-jar.xml")
+ .addAsWebInfResource("components.xml", "components.xml")
+ .addAsWebInfResource("persistence.xml", "classes/META-INF/persistence.xml")
+ .addAsWebInfResource("import.sql", "classes/import.sql")
+ .addAsWebInfResource("jboss-deployment-structure.xml", "jboss-deployment-structure.xml")
+ .addAsWebInfResource("seam.properties", "classes/seam.properties")
+ .addAsWebInfResource("seam.quartz.properties", "classes/seam.quartz.properties")
+ .addAsWebInfResource("web.xml", "web.xml")
+ .addAsWebInfResource("pages.xml", "pages.xml")
+ .addAsResource("BaseData.xml", "BaseData.xml")
+ .addAsWebResource("index.html")
+ .addAsWebResource("search.xhtml")
+ .addAsLibraries(libs)
+ .addAsLibraries(dbunitLibs);
+
+ }
+}
Copied: branches/enterprise/WFK-2_1/examples/quartz/quartz-ejb/src/test/java/org/jboss/seam/example/quartz/test/EventsTest.java (from rev 15540, branches/enterprise/WFK-2_1/examples/quartz/quartz-tests/src/test/java/org/jboss/seam/example/quartz/test/EventsTest.java)
===================================================================
--- branches/enterprise/WFK-2_1/examples/quartz/quartz-ejb/src/test/java/org/jboss/seam/example/quartz/test/EventsTest.java (rev 0)
+++ branches/enterprise/WFK-2_1/examples/quartz/quartz-ejb/src/test/java/org/jboss/seam/example/quartz/test/EventsTest.java 2013-06-04 09:25:36 UTC (rev 15541)
@@ -0,0 +1,269 @@
+package org.jboss.seam.example.quartz.test;
+
+import static org.jboss.seam.example.quartz.Payment.Frequency.ONCE;
+
+import java.math.BigDecimal;
+
+import org.jboss.arquillian.container.test.api.Deployment;
+import org.jboss.arquillian.container.test.api.OverProtocol;
+import org.jboss.arquillian.junit.Arquillian;
+import org.jboss.seam.example.quartz.Account;
+import org.jboss.seam.example.quartz.Payment;
+import org.jboss.seam.mock.DBJUnitSeamTest;
+import org.jboss.shrinkwrap.api.Archive;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+
+/**
+ *
+ * @author Pete Muir
+ *
+ */
+
+// Actually this doesn't happen in the example, but lets test it here to keep
+// all quartz tests in one place
+(a)RunWith(Arquillian.class)
+public class EventsTest extends DBJUnitSeamTest
+{
+ @Deployment(name="EventsTest")
+ @OverProtocol("Servlet 3.0")
+ public static Archive<?> createDeployment()
+ {
+ return Deployments.quartzDeployment();
+ }
+
+ @Override
+ protected void prepareDBUnitOperations() {
+ setDatabase("HSQL");
+ setDatasourceJndiName("java:jboss/datasources/ExampleDS");
+
+ beforeTestOperations.add(
+ new DataSetOperation("BaseData.xml")
+ );
+ }
+
+ @Test
+ public void testAsynchronousEvent() throws Exception
+ {
+ String id = new FacesRequest("/search.xhtml")
+ {
+ @Override
+ protected void beforeRequest()
+ {
+ setParameter("accountId", "1");
+ }
+
+ @Override
+ protected void updateModelValues() throws Exception
+ {
+ setValue("#{newPayment.payee}", "IRS");
+ setValue("#{newPayment.amount}", new BigDecimal("110.00"));
+ setValue("#{newPayment.paymentFrequency}", ONCE);
+ }
+
+ @Override
+ protected void invokeApplication() throws Exception
+ {
+ invokeMethod("#{paymentHome.scheduleAndSaveUsingAsynchronousEvent}");
+ }
+
+ @Override
+ protected void renderResponse() throws Exception
+ {
+ assert ((Boolean)getValue("#{accountHome.idDefined}"));
+ Account account = (Account) getValue("#{selectedAccount}");
+ assert account !=null;
+ assert account.getId() == 1;
+ assert account.getPayments().size() == 1;
+ }
+
+ }.run();
+
+ // Wait, let quartz execute the async method which schedules the job
+ // for immediate execution
+ pause(50);
+
+ new FacesRequest("/search.xhtml", id)
+ {
+
+ @Override
+ protected void beforeRequest()
+ {
+ setParameter("accountId", "1");
+ }
+
+ @Override
+ protected void renderResponse() throws Exception
+ {
+ System.out.println("running renderResponse");
+ assert ((Boolean)getValue("#{accountHome.idDefined}"));
+ Account account = (Account) getValue("#{selectedAccount}");
+ assert account !=null;
+ assert account.getId() == 1;
+ assert account.getPayments().size() == 1;
+ Payment payment = account.getPayments().get(0);
+ assert new BigDecimal("110.00").equals(payment.getAmount());
+ //assert !payment.getActive();
+ //assert payment.getLastPaid() != null;
+ assert new BigDecimal("891.46").equals(account.getBalance());
+ }
+
+ }.run();
+ }
+
+
+ @Test
+ public void testTransactionSuccessEvents() throws Exception
+ {
+ String id = new FacesRequest("/search.xhtml")
+ {
+ @Override
+ protected void beforeRequest()
+ {
+ setParameter("accountId", "1");
+ }
+
+ @Override
+ protected void updateModelValues() throws Exception
+ {
+ setValue("#{newPayment.payee}", "IRS");
+ setValue("#{newPayment.amount}", new BigDecimal("110.00"));
+ setValue("#{newPayment.paymentFrequency}", ONCE);
+ }
+
+ @Override
+ protected void invokeApplication() throws Exception
+ {
+ invokeMethod("#{paymentHome.scheduleAndSaveWithTransactionEvents}");
+ }
+
+ @Override
+ protected void renderResponse() throws Exception
+ {
+ assert ((Boolean)getValue("#{accountHome.idDefined}"));
+ Account account = (Account) getValue("#{selectedAccount}");
+ assert account !=null;
+ assert account.getId() == 1;
+ assert account.getPayments().size() == 1;
+ }
+
+ }.run();
+
+ // Wait, let quartz execute the async method which schedules the job
+ // for immediate execution
+ pause(50);
+
+ new FacesRequest("/search.xhtml", id)
+ {
+
+ @Override
+ protected void beforeRequest()
+ {
+ setParameter("accountId", "1");
+ }
+
+ @Override
+ protected void renderResponse() throws Exception
+ {
+ System.out.println("running renderResponse");
+ assert ((Boolean)getValue("#{accountHome.idDefined}"));
+ Account account = (Account) getValue("#{selectedAccount}");
+ assert account !=null;
+ assert account.getId() == 1;
+ assert account.getPayments().size() == 1;
+ Payment payment = account.getPayments().get(0);
+ assert new BigDecimal("110.00").equals(payment.getAmount());
+ //assert !payment.getActive();
+ //assert payment.getLastPaid() != null;
+ assert new BigDecimal("891.46").equals(account.getBalance());
+ assert (Boolean) getValue("#{transactionStatus.transactionCompleted}");
+ assert (Boolean) getValue("#{transactionStatus.transactionSucceded}");
+ assert payment.getId().equals(getValue("#{transactionStatus.id}"));
+ }
+
+ }.run();
+ }
+
+ @Test
+ public void testTimedEvent() throws Exception
+ {
+ String id = new FacesRequest("/search.xhtml")
+ {
+ @Override
+ protected void beforeRequest()
+ {
+ setParameter("accountId", "1");
+ }
+
+ @Override
+ protected void updateModelValues() throws Exception
+ {
+ setValue("#{newPayment.payee}", "IRS");
+ setValue("#{newPayment.amount}", new BigDecimal("120.00"));
+ setValue("#{newPayment.paymentFrequency}", ONCE);
+ }
+
+ @Override
+ protected void invokeApplication() throws Exception
+ {
+ invokeMethod("#{paymentHome.scheduleAndSaveUsingTimedEvent}");
+ }
+
+ @Override
+ protected void renderResponse() throws Exception
+ {
+ Thread.sleep(1000);
+ assert ((Boolean)getValue("#{accountHome.idDefined}"));
+ Account account = (Account) getValue("#{selectedAccount}");
+ assert account !=null;
+ assert account.getId() == 1;
+ assert account.getPayments().size() == 1;
+ }
+
+ }.run();
+
+ // Wait, let quartz execute the async method which schedules the job
+ // for immediate execution
+ pause(1000l);
+
+ new FacesRequest("/search.xhtml", id)
+ {
+
+ @Override
+ protected void beforeRequest()
+ {
+ setParameter("accountId", "1");
+ }
+
+ @Override
+ protected void renderResponse() throws Exception
+ {
+ System.out.println("running renderResponse");
+ assert ((Boolean)getValue("#{accountHome.idDefined}"));
+ Account account = (Account) getValue("#{selectedAccount}");
+ assert account != null;
+ assert account.getId() == 1;
+ assert account.getPayments().size() == 1;
+ Payment payment = account.getPayments().get(0);
+ assert new BigDecimal("120.00").equals(payment.getAmount()) : "Invalid payment amount: " + payment.getAmount();
+ //assert !payment.getActive();
+ //assert payment.getLastPaid() != null;
+ assert new BigDecimal("881.46").equals(account.getBalance()) : "Invalid account balance: " + account.getBalance();
+ }
+
+ }.run();
+ }
+
+
+
+ private void pause(long ms) {
+ try {
+ Thread.sleep(ms);
+ } catch (InterruptedException e) {
+
+ }
+ }
+
+
+
+}
Copied: branches/enterprise/WFK-2_1/examples/quartz/quartz-ejb/src/test/java/org/jboss/seam/example/quartz/test/OnceTest.java (from rev 15540, branches/enterprise/WFK-2_1/examples/quartz/quartz-tests/src/test/java/org/jboss/seam/example/quartz/test/OnceTest.java)
===================================================================
--- branches/enterprise/WFK-2_1/examples/quartz/quartz-ejb/src/test/java/org/jboss/seam/example/quartz/test/OnceTest.java (rev 0)
+++ branches/enterprise/WFK-2_1/examples/quartz/quartz-ejb/src/test/java/org/jboss/seam/example/quartz/test/OnceTest.java 2013-06-04 09:25:36 UTC (rev 15541)
@@ -0,0 +1,146 @@
+package org.jboss.seam.example.quartz.test;
+
+import static org.jboss.seam.example.quartz.Payment.Frequency.ONCE;
+
+import java.math.BigDecimal;
+
+import org.jboss.arquillian.container.test.api.Deployment;
+import org.jboss.arquillian.container.test.api.OverProtocol;
+import org.jboss.arquillian.junit.Arquillian;
+import org.jboss.seam.async.QuartzTriggerHandle;
+import org.jboss.seam.example.quartz.Account;
+import org.jboss.seam.example.quartz.Payment;
+import org.jboss.seam.mock.DBJUnitSeamTest;
+import org.jboss.shrinkwrap.api.Archive;
+import org.junit.Ignore;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+
+/**
+ *
+ * @author Pete Muir
+ *
+ */
+(a)RunWith(Arquillian.class)
+public class OnceTest extends DBJUnitSeamTest
+{
+ @Deployment(name="OnceTest")
+ @OverProtocol("Servlet 3.0")
+ public static Archive<?> createDeployment()
+ {
+ return Deployments.quartzDeployment();
+ }
+
+ private QuartzTriggerHandle quartzTriggerHandle;
+
+ @Override
+ protected void prepareDBUnitOperations() {
+ setDatabase("HSQL");
+ setDatasourceJndiName("java:jboss/datasources/ExampleDS");
+
+ beforeTestOperations.add(
+ new DataSetOperation("BaseData.xml")
+ );
+ }
+
+
+
+ @Test
+ @Ignore
+ public void scheduleOnce() throws Exception
+ {
+ try
+ {
+ String id = new FacesRequest("/search.xhtml")
+ {
+ @Override
+ protected void beforeRequest()
+ {
+ setParameter("accountId", "1");
+ }
+
+ @Override
+ protected void updateModelValues() throws Exception
+ {
+ setValue("#{newPayment.payee}", "IRS");
+ setValue("#{newPayment.amount}", new BigDecimal("100.00"));
+ setValue("#{newPayment.paymentFrequency}", ONCE);
+ }
+
+ @Override
+ protected void invokeApplication() throws Exception
+ {
+ assert "persisted".equals(invokeMethod("#{paymentHome.saveAndSchedule}"));
+ }
+
+ @Override
+ protected void renderResponse() throws Exception
+ {
+ assert ((Boolean)getValue("#{accountHome.idDefined}"));
+ Account account = (Account) getValue("#{selectedAccount}");
+ assert account !=null;
+ assert account.getId() == 1;
+ assert account.getPayments().size() == 1;
+
+ Payment payment = (Payment) getValue("#{newPayment}");
+ assert payment.getPayee().equals("IRS");
+ assert payment.getAmount().equals(new BigDecimal("100.00"));
+ assert payment.getAccount() != null;
+ assert payment.getAccount().getId() == 1;
+ quartzTriggerHandle = payment.getQuartzTriggerHandle();
+ }
+
+ }.run();
+
+ // Wait, let quartz execute the job (async but straight away)
+ pause(500);
+
+ new FacesRequest("/search.xhtml", id)
+ {
+
+ @Override
+ protected void beforeRequest()
+ {
+ setParameter("accountId", "1");
+ }
+
+ @Override
+ protected void renderResponse() throws Exception
+ {
+ assert ((Boolean)getValue("#{accountHome.idDefined}"));
+ Account account = (Account) getValue("#{selectedAccount}");
+ assert account !=null;
+ assert account.getId() == 1;
+ assert account.getPayments().size() == 1;
+ Payment payment = account.getPayments().get(0);
+ assert new BigDecimal("100.00").equals(payment.getAmount());
+ assert !payment.getActive();
+ assert ONCE.equals(payment.getPaymentFrequency());
+ assert payment.getLastPaid() != null;
+ assert new BigDecimal("901.46").equals(account.getBalance());
+ }
+
+ }.run();
+ }
+ finally
+ {
+ // Always cancel the job
+ if (quartzTriggerHandle != null)
+ {
+ quartzTriggerHandle.cancel();
+ quartzTriggerHandle = null;
+ }
+ }
+ }
+
+ private void pause(long ms) {
+ try {
+ Thread.sleep(ms);
+ } catch (InterruptedException e) {
+
+ }
+ }
+
+
+
+}
Copied: branches/enterprise/WFK-2_1/examples/quartz/quartz-ejb/src/test/java/org/jboss/seam/example/quartz/test/RepeatingTest.java (from rev 15540, branches/enterprise/WFK-2_1/examples/quartz/quartz-tests/src/test/java/org/jboss/seam/example/quartz/test/RepeatingTest.java)
===================================================================
--- branches/enterprise/WFK-2_1/examples/quartz/quartz-ejb/src/test/java/org/jboss/seam/example/quartz/test/RepeatingTest.java (rev 0)
+++ branches/enterprise/WFK-2_1/examples/quartz/quartz-ejb/src/test/java/org/jboss/seam/example/quartz/test/RepeatingTest.java 2013-06-04 09:25:36 UTC (rev 15541)
@@ -0,0 +1,463 @@
+package org.jboss.seam.example.quartz.test;
+
+import static org.jboss.seam.example.quartz.Payment.Frequency.EVERY_SECOND;
+
+import java.math.BigDecimal;
+
+import org.jboss.arquillian.container.test.api.Deployment;
+import org.jboss.arquillian.container.test.api.OverProtocol;
+import org.jboss.arquillian.junit.Arquillian;
+import org.jboss.seam.async.QuartzTriggerHandle;
+import org.jboss.seam.example.quartz.Account;
+import org.jboss.seam.example.quartz.Payment;
+import org.jboss.seam.example.quartz.Payment.Frequency;
+import org.jboss.seam.mock.DBJUnitSeamTest;
+import org.jboss.shrinkwrap.api.Archive;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+
+/**
+ *
+ * @author Pete Muir
+ *
+ */
+(a)RunWith(Arquillian.class)
+public class RepeatingTest
+ extends DBJUnitSeamTest
+{
+ @Deployment(name="RepeatingTest")
+ @OverProtocol("Servlet 3.0")
+ public static Archive<?> createDeployment()
+ {
+ return Deployments.quartzDeployment();
+ }
+
+ private QuartzTriggerHandle quartzTriggerHandle;
+ private Long paymentId;
+
+ private static final Frequency REPEATING = EVERY_SECOND;
+
+
+ @Override
+ protected void prepareDBUnitOperations() {
+ setDatabase("HSQL");
+ setDatasourceJndiName("java:jboss/datasources/ExampleDS");
+
+ beforeTestOperations.add(
+ new DataSetOperation("BaseData.xml")
+ );
+ }
+
+
+ @Test
+ public void scheduleRepeating() throws Exception
+ {
+
+ try
+ {
+ String id = new FacesRequest("/search.xhtml")
+ {
+ @Override
+ protected void beforeRequest()
+ {
+ setParameter("accountId", "1");
+ }
+
+ @Override
+ protected void updateModelValues() throws Exception
+ {
+ setValue("#{newPayment.payee}", "IRS");
+ setValue("#{newPayment.amount}", new BigDecimal("110.00"));
+ setValue("#{newPayment.paymentFrequency}", REPEATING );
+ }
+
+ @Override
+ protected void invokeApplication() throws Exception
+ {
+ // schedule a the repeating job and immediately pause it
+ // this allows you to carefully control how long the timer
+ // runs for
+ assert "persisted".equals(invokeMethod("#{paymentHome.saveAndSchedule}"));
+ Payment payment = (Payment) getValue("#{newPayment}");
+ quartzTriggerHandle = payment.getQuartzTriggerHandle();
+ quartzTriggerHandle.pause();
+ }
+
+ @Override
+ protected void renderResponse() throws Exception
+ {
+ // Check the job exists
+ assert ((Boolean)getValue("#{accountHome.idDefined}"));
+ Account account = (Account) getValue("#{selectedAccount}");
+ assert account !=null;
+ assert account.getId() == 1;
+ assert account.getPayments().size() == 1;
+
+ Payment payment = (Payment) getValue("#{newPayment}");
+ assert payment.getPayee().equals("IRS");
+ assert payment.getAmount().equals(new BigDecimal("110.00"));
+ assert payment.getAccount() != null;
+ assert payment.getAccount().getId() == 1;
+ assert payment.getActive();
+ }
+
+ }.run();
+
+ // Start the triggerHandle, wait a lot shorter than the job takes
+ // At this point the job should have executed once exactly
+ quartzTriggerHandle.resume();
+ pause((long) (REPEATING.getInterval() * 0.1));
+ quartzTriggerHandle.pause();
+
+ new FacesRequest("/search.xhtml", id)
+ {
+
+ @Override
+ protected void beforeRequest()
+ {
+ setParameter("accountId", "1");
+ }
+
+ @Override
+ protected void renderResponse() throws Exception
+ {
+ assert ((Boolean)getValue("#{accountHome.idDefined}"));
+ Account account = (Account) getValue("#{selectedAccount}");
+ assert account !=null;
+ assert account.getId() == 1;
+ assert account.getPayments().size() == 1;
+ Payment payment = account.getPayments().get(0);
+ assert new BigDecimal("110.00").equals(payment.getAmount());
+ assert payment.getActive();
+ assert REPEATING.equals(payment.getPaymentFrequency());
+
+ assert new BigDecimal("891.46").equals(account.getBalance());
+ }
+
+ }.run();
+
+ // Start the triggerHandle, wait until some short time after the
+ // job triggers once
+ quartzTriggerHandle.resume();
+ pause(REPEATING.getInterval());
+ quartzTriggerHandle.pause();
+
+
+ new FacesRequest("/search.xhtml", id)
+ {
+
+ @Override
+ protected void beforeRequest()
+ {
+ setParameter("accountId", "1");
+ }
+
+ @Override
+ protected void renderResponse() throws Exception
+ {
+
+ // Job should have run twice
+ assert ((Boolean)getValue("#{accountHome.idDefined}"));
+ Account account = (Account) getValue("#{selectedAccount}");
+
+ assert account !=null;
+ assert account.getId() == 1;
+ assert account.getPayments().size() == 1;
+ Payment payment = account.getPayments().get(0);
+ assert new BigDecimal("110.00").equals(payment.getAmount());
+ assert payment.getActive();
+ assert REPEATING.equals(payment.getPaymentFrequency());
+ assert payment.getLastPaid() != null;
+ assert new BigDecimal("781.46").equals(account.getBalance());
+ paymentId = payment.getId();
+ }
+
+ }.run();
+
+ new FacesRequest("/search.xhtml", id)
+ {
+
+ @Override
+ protected void beforeRequest()
+ {
+ setParameter("accountId", "1");
+ setParameter("paymentId", paymentId.toString());
+ }
+
+ @Override
+ protected void invokeApplication() throws Exception
+ {
+ // Resume the job, then cancel it
+ quartzTriggerHandle.resume();
+ invokeMethod("#{paymentHome.cancel}");
+ }
+
+ @Override
+ protected void renderResponse() throws Exception
+ {
+
+ assert ((Boolean)getValue("#{accountHome.idDefined}"));
+ Account account = (Account) getValue("#{selectedAccount}");
+
+ assert account !=null;
+ assert account.getId() == 1;
+ assert account.getPayments().size() == 1;
+ Payment payment = account.getPayments().get(0);
+ assert new BigDecimal("110.00").equals(payment.getAmount());
+ assert !payment.getActive();
+ assert payment.getLastPaid() != null;
+ assert new BigDecimal("781.46").equals(account.getBalance());
+ }
+
+ }.run();
+
+ // Wait until some short time after another execution would
+ // have occurred to check it really stops
+ pause((long) (REPEATING.getInterval() * 1.05));
+
+ new FacesRequest("/search.xhtml", id)
+ {
+
+ @Override
+ protected void beforeRequest()
+ {
+ setParameter("accountId", "1");
+ }
+
+ @Override
+ protected void renderResponse() throws Exception
+ {
+
+ assert ((Boolean)getValue("#{accountHome.idDefined}"));
+ Account account = (Account) getValue("#{selectedAccount}");
+
+ assert account !=null;
+ assert account.getId() == 1;
+ assert new BigDecimal("781.46").equals(account.getBalance());
+ }
+
+ }.run();
+
+ }
+ finally
+ {
+ if (quartzTriggerHandle != null)
+ {
+ quartzTriggerHandle.cancel();
+ }
+ }
+ }
+
+
+
+ @Test
+ public void scheduleRepeatingWithStartAndEndTime() throws Exception
+ {
+
+ try
+ {
+ String id = new FacesRequest("/search.xhtml")
+ {
+ @Override
+ protected void beforeRequest()
+ {
+ setParameter("accountId", "1");
+ }
+
+ @Override
+ protected void updateModelValues() throws Exception
+ {
+ setValue("#{newPayment.payee}", "IRS");
+ setValue("#{newPayment.amount}", new BigDecimal("110.00"));
+ setValue("#{newPayment.paymentFrequency}", REPEATING );
+ }
+
+ @Override
+ protected void invokeApplication() throws Exception
+ {
+ // schedule a the repeating job and immediately pause it
+ // this allows you to carefully control how long the timer
+ // runs for
+ Payment payment = (Payment) getValue("#{newPayment}");
+ payment.setPaymentDate(new java.sql.Timestamp( System.currentTimeMillis() + REPEATING.getInterval()));
+ payment.setPaymentEndDate(new java.sql.Timestamp( (long) (System.currentTimeMillis() + (REPEATING.getInterval() * 2.5))));
+ assert "persisted".equals(invokeMethod("#{paymentHome.saveAndSchedule}"));
+ quartzTriggerHandle = payment.getQuartzTriggerHandle();
+ quartzTriggerHandle.pause();
+ }
+
+ @Override
+ protected void renderResponse() throws Exception
+ {
+ // Check the job exists
+ assert ((Boolean)getValue("#{accountHome.idDefined}"));
+ Account account = (Account) getValue("#{selectedAccount}");
+ assert account !=null;
+ assert account.getId() == 1;
+ assert account.getPayments().size() == 1;
+
+ Payment payment = (Payment) getValue("#{newPayment}");
+ assert payment.getPayee().equals("IRS");
+ assert payment.getAmount().equals(new BigDecimal("110.00"));
+ assert payment.getAccount() != null;
+ assert payment.getAccount().getId() == 1;
+ assert payment.getActive();
+ }
+
+ }.run();
+
+ // Start the triggerHandle, wait a lot shorter than the job takes
+ // At this point the job should have executed zero times
+ quartzTriggerHandle.resume();
+ pause((long) (REPEATING.getInterval() * 0.1));
+ quartzTriggerHandle.pause();
+
+ new FacesRequest("/search.xhtml", id)
+ {
+
+ @Override
+ protected void beforeRequest()
+ {
+ setParameter("accountId", "1");
+ }
+
+ @Override
+ protected void renderResponse() throws Exception
+ {
+ assert ((Boolean)getValue("#{accountHome.idDefined}"));
+ Account account = (Account) getValue("#{selectedAccount}");
+ assert account !=null;
+ assert account.getId() == 1;
+ assert account.getPayments().size() == 1;
+ Payment payment = account.getPayments().get(0);
+ assert new BigDecimal("110.00").equals(payment.getAmount());
+ assert payment.getActive();
+ assert new BigDecimal("1001.46").equals(account.getBalance());
+ }
+
+ }.run();
+
+ // Start the triggerHandle, wait until some short time after the
+ // job triggers once
+ quartzTriggerHandle.resume();
+ pause(REPEATING.getInterval());
+ quartzTriggerHandle.pause();
+
+
+ new FacesRequest("/search.xhtml", id)
+ {
+
+ @Override
+ protected void beforeRequest()
+ {
+ setParameter("accountId", "1");
+ }
+
+ @Override
+ protected void renderResponse() throws Exception
+ {
+
+ // Job should have run twice
+ assert ((Boolean)getValue("#{accountHome.idDefined}"));
+ Account account = (Account) getValue("#{selectedAccount}");
+
+ assert account !=null;
+ assert account.getId() == 1;
+ assert account.getPayments().size() == 1;
+ Payment payment = account.getPayments().get(0);
+ assert new BigDecimal("110.00").equals(payment.getAmount());
+ assert payment.getActive();
+ assert new BigDecimal("891.46").equals(account.getBalance());
+ paymentId = payment.getId();
+ }
+
+ }.run();
+
+ // Start the triggerHandle, wait until some short time after the
+ // job triggers once
+ quartzTriggerHandle.resume();
+ pause(REPEATING.getInterval());
+ // Thats the last job so need to pause
+
+ new FacesRequest("/search.xhtml", id)
+ {
+
+ @Override
+ protected void beforeRequest()
+ {
+ setParameter("accountId", "1");
+ }
+
+ @Override
+ protected void renderResponse() throws Exception
+ {
+
+ // Job should have run twice
+ assert ((Boolean)getValue("#{accountHome.idDefined}"));
+ Account account = (Account) getValue("#{selectedAccount}");
+
+ assert account !=null;
+ assert account.getId() == 1;
+ assert account.getPayments().size() == 1;
+ Payment payment = account.getPayments().get(0);
+ assert new BigDecimal("110.00").equals(payment.getAmount());
+ assert payment.getActive();
+ assert new BigDecimal("781.46").equals(account.getBalance());
+ paymentId = payment.getId();
+ }
+
+ }.run();
+
+ // Start the triggerHandle, wait until some short time after the
+ // job would trigger again - we should be way beyond the expiry now
+ pause(REPEATING.getInterval());
+
+ new FacesRequest("/search.xhtml", id)
+ {
+
+ @Override
+ protected void beforeRequest()
+ {
+ setParameter("accountId", "1");
+ }
+
+ @Override
+ protected void renderResponse() throws Exception
+ {
+
+ assert ((Boolean)getValue("#{accountHome.idDefined}"));
+ Account account = (Account) getValue("#{selectedAccount}");
+
+ assert account !=null;
+ assert account.getId() == 1;
+ assert account.getPayments().size() == 1;
+ Payment payment = account.getPayments().get(0);
+ assert new BigDecimal("110.00").equals(payment.getAmount());
+ assert payment.getActive();
+ assert payment.getLastPaid() != null;
+ assert new BigDecimal("781.46").equals(account.getBalance());
+ }
+
+ }.run();
+
+ }
+ finally
+ {
+ if (quartzTriggerHandle != null)
+ {
+ quartzTriggerHandle.cancel();
+ }
+ }
+ }
+
+ private void pause(long ms) {
+ try {
+ Thread.sleep(ms);
+ } catch (InterruptedException e) {
+
+ }
+ }
+
+
+
+}
Copied: branches/enterprise/WFK-2_1/examples/quartz/quartz-ejb/src/test/java/org/jboss/seam/example/quartz/test/TestPaymentController.java (from rev 15540, branches/enterprise/WFK-2_1/examples/quartz/quartz-tests/src/test/java/org/jboss/seam/example/quartz/test/TestPaymentController.java)
===================================================================
--- branches/enterprise/WFK-2_1/examples/quartz/quartz-ejb/src/test/java/org/jboss/seam/example/quartz/test/TestPaymentController.java (rev 0)
+++ branches/enterprise/WFK-2_1/examples/quartz/quartz-ejb/src/test/java/org/jboss/seam/example/quartz/test/TestPaymentController.java 2013-06-04 09:25:36 UTC (rev 15541)
@@ -0,0 +1,84 @@
+package org.jboss.seam.example.quartz.test;
+
+import static org.jboss.seam.annotations.Install.MOCK;
+
+import java.sql.Timestamp;
+
+import org.jboss.seam.annotations.In;
+import org.jboss.seam.annotations.Install;
+import org.jboss.seam.annotations.Logger;
+import org.jboss.seam.annotations.Name;
+import org.jboss.seam.async.QuartzTriggerHandle;
+import org.jboss.seam.async.Schedule;
+import org.jboss.seam.async.TimerSchedule;
+import org.jboss.seam.core.Events;
+import org.jboss.seam.example.quartz.Payment;
+import org.jboss.seam.example.quartz.PaymentHome;
+import org.jboss.seam.log.Log;
+
+/**
+ * @author Pete Muir
+ *
+ */
+@Name("paymentHome")
+@Install(precedence=MOCK)
+public class TestPaymentController extends PaymentHome
+{
+
+ @In TestPaymentProcessor processor;
+
+ @Logger Log log;
+
+ public String scheduleAndSaveAsynchronously()
+ {
+ String result = persist();
+
+ Payment payment = getInstance();
+
+ log.info("scheduling instance #0", payment);
+ QuartzTriggerHandle handle = processor.schedulePayment(payment.getPaymentDate(),
+ payment.getPaymentFrequency().getInterval(),
+ payment.getPaymentEndDate(),
+ payment);
+
+ payment.setQuartzTriggerHandle( handle );
+
+ return result;
+ }
+
+ public void scheduleAndSaveUsingAsynchronousEvent()
+ {
+ persist();
+ Events.instance().raiseAsynchronousEvent("org.jboss.seam.example.quartz.test.scheduleAndSave", getInstance());
+ }
+
+ public void scheduleAndSaveUsingTimedEvent()
+ {
+ persist();
+ // A simple once-only which exprires in 1000ms
+ Schedule schedule = new TimerSchedule( new Timestamp( System.currentTimeMillis() + 1000l ) );
+ Events.instance().raiseTimedEvent("org.jboss.seam.example.quartz.test.scheduleAndSave", schedule, getInstance());
+ }
+
+ public void scheduleAndSaveWithTransactionEvents()
+ {
+ TransactionStatus.clear();
+ Events.instance().raiseTransactionSuccessEvent("org.jboss.seam.example.quartz.test.transactionSuccess", getInstance());
+ Events.instance().raiseTransactionCompletionEvent("org.jboss.seam.example.quartz.test.transactionCompletion", getInstance());
+ try
+ {
+ super.saveAndSchedule();
+ }
+ catch (Exception e)
+ {
+ e.printStackTrace();
+ }
+ }
+
+ @Override
+ public Class<Payment> getEntityClass()
+ {
+ return Payment.class;
+ }
+
+}
Copied: branches/enterprise/WFK-2_1/examples/quartz/quartz-ejb/src/test/java/org/jboss/seam/example/quartz/test/TestPaymentProcessor.java (from rev 15540, branches/enterprise/WFK-2_1/examples/quartz/quartz-tests/src/test/java/org/jboss/seam/example/quartz/test/TestPaymentProcessor.java)
===================================================================
--- branches/enterprise/WFK-2_1/examples/quartz/quartz-ejb/src/test/java/org/jboss/seam/example/quartz/test/TestPaymentProcessor.java (rev 0)
+++ branches/enterprise/WFK-2_1/examples/quartz/quartz-ejb/src/test/java/org/jboss/seam/example/quartz/test/TestPaymentProcessor.java 2013-06-04 09:25:36 UTC (rev 15541)
@@ -0,0 +1,89 @@
+package org.jboss.seam.example.quartz.test;
+
+import static org.jboss.seam.annotations.Install.MOCK;
+
+import java.math.BigDecimal;
+import java.util.Date;
+
+import javax.persistence.EntityManager;
+
+import org.jboss.seam.annotations.AutoCreate;
+import org.jboss.seam.annotations.In;
+import org.jboss.seam.annotations.Install;
+import org.jboss.seam.annotations.Logger;
+import org.jboss.seam.annotations.Name;
+import org.jboss.seam.annotations.Observer;
+import org.jboss.seam.annotations.Transactional;
+import org.jboss.seam.annotations.async.Asynchronous;
+import org.jboss.seam.async.QuartzTriggerHandle;
+import org.jboss.seam.example.quartz.Payment;
+import org.jboss.seam.example.quartz.PaymentProcessor;
+import org.jboss.seam.log.Log;
+
+/**
+ * @author Pete Muir
+ *
+ */
+@Name("processor")
+@Install(precedence=MOCK)
+@AutoCreate
+public class TestPaymentProcessor extends PaymentProcessor
+{
+
+ @In
+ EntityManager entityManager;
+
+ @Logger Log log;
+
+ @Asynchronous
+ @Transactional
+ public QuartzTriggerHandle schedulePaymentAsynchronously(Payment payment)
+ {
+ payment = entityManager.merge(payment);
+
+ log.info("[#0] Processing cron payment #1", System.currentTimeMillis(), payment.getId());
+
+ if (payment.getActive()) {
+ BigDecimal balance = payment.getAccount().adjustBalance(payment.getAmount().negate());
+ log.info(":: balance is now #0", balance);
+ payment.setLastPaid(new Date());
+
+ }
+
+ return null;
+ }
+
+ @Observer("org.jboss.seam.example.quartz.test.scheduleAndSave")
+ @Transactional
+ public QuartzTriggerHandle schedulePayment(Payment payment)
+ {
+ payment = entityManager.merge(payment);
+
+ log.error("[#0] Processing cron payment #1", System.currentTimeMillis(), payment.getId());
+ if (payment.getActive()) {
+ BigDecimal balance = payment.getAccount().adjustBalance(payment.getAmount().negate());
+ log.error(":: balance is now #0", balance);
+ payment.setLastPaid(new Date());
+
+ }
+
+ return null;
+ }
+
+ @Observer("org.jboss.seam.example.quartz.test.transactionSuccess")
+ @Transactional
+ public void observeTransactionSuccess(Payment payment)
+ {
+ TransactionStatus.instance().setTransactionSucceded(true);
+ TransactionStatus.instance().setId(payment.getId());
+ }
+
+ @Observer("org.jboss.seam.example.quartz.test.transactionCompletion")
+ @Transactional
+ public void observeTransactionCompletion(Payment payment)
+ {
+ TransactionStatus.instance().setTransactionCompleted(true);
+ TransactionStatus.instance().setId(payment.getId());
+ }
+
+}
Copied: branches/enterprise/WFK-2_1/examples/quartz/quartz-ejb/src/test/java/org/jboss/seam/example/quartz/test/TransactionStatus.java (from rev 15540, branches/enterprise/WFK-2_1/examples/quartz/quartz-tests/src/test/java/org/jboss/seam/example/quartz/test/TransactionStatus.java)
===================================================================
--- branches/enterprise/WFK-2_1/examples/quartz/quartz-ejb/src/test/java/org/jboss/seam/example/quartz/test/TransactionStatus.java (rev 0)
+++ branches/enterprise/WFK-2_1/examples/quartz/quartz-ejb/src/test/java/org/jboss/seam/example/quartz/test/TransactionStatus.java 2013-06-04 09:25:36 UTC (rev 15541)
@@ -0,0 +1,75 @@
+package org.jboss.seam.example.quartz.test;
+
+import org.jboss.seam.Component;
+import org.jboss.seam.ScopeType;
+import org.jboss.seam.annotations.AutoCreate;
+import org.jboss.seam.annotations.Name;
+import org.jboss.seam.annotations.Scope;
+import org.jboss.seam.contexts.Contexts;
+
+/**
+ * @author Pete Muir
+ *
+ */
+@Name("transactionStatus")
+(a)Scope(ScopeType.APPLICATION)
+@AutoCreate
+public class TransactionStatus
+{
+ private Object id;
+ private boolean transactionSucceded;
+ private boolean transactionCompleted;
+ /**
+ * @return the transactionSuccess
+ */
+ public boolean getTransactionSucceded()
+ {
+ return this.transactionSucceded;
+ }
+ /**
+ * @param transactionSuccess the transactionSuccess to set
+ */
+ public void setTransactionSucceded(boolean transactionSuccess)
+ {
+ this.transactionSucceded = transactionSuccess;
+ }
+ /**
+ * @return the transactionCompleted
+ */
+ public boolean getTransactionCompleted()
+ {
+ return this.transactionCompleted;
+ }
+ /**
+ * @param transactionCompleted the transactionCompleted to set
+ */
+ public void setTransactionCompleted(boolean transactionCompleted)
+ {
+ this.transactionCompleted = transactionCompleted;
+ }
+
+ public static void clear()
+ {
+ Contexts.getApplicationContext().remove("transactionStatus");
+ }
+
+ public static TransactionStatus instance()
+ {
+ return (TransactionStatus) Component.getInstance("transactionStatus");
+ }
+ /**
+ * @return the id
+ */
+ public Object getId()
+ {
+ return this.id;
+ }
+ /**
+ * @param id the id to set
+ */
+ public void setId(Object id)
+ {
+ this.id = id;
+ }
+
+}
Copied: branches/enterprise/WFK-2_1/examples/quartz/quartz-ejb/src/test/resources/BaseData.xml (from rev 15540, branches/enterprise/WFK-2_1/examples/quartz/quartz-tests/src/test/resources/BaseData.xml)
===================================================================
--- branches/enterprise/WFK-2_1/examples/quartz/quartz-ejb/src/test/resources/BaseData.xml (rev 0)
+++ branches/enterprise/WFK-2_1/examples/quartz/quartz-ejb/src/test/resources/BaseData.xml 2013-06-04 09:25:36 UTC (rev 15541)
@@ -0,0 +1,38 @@
+<?xml version="1.0"?>
+
+<dataset>
+
+ <ACCOUNT
+ id="1"
+ accountNumber="23001"
+ balance="1001.46"
+ />
+
+ <ACCOUNT
+ id="2"
+ accountNumber="23002"
+ balance="1002.46"
+ />
+
+ <ACCOUNT
+ id="3"
+ accountNumber="23003"
+ balance="1003.46"
+ />
+
+ <ACCOUNT
+ id="4"
+ accountNumber="23004"
+ balance="1004.46"
+ />
+
+ <ACCOUNT
+ id="5"
+ accountNumber="23005"
+ balance="1005.46"
+ />
+
+ <!-- This causes the payment table to be cleaned every time -->
+ <PAYMENT />
+
+</dataset>
\ No newline at end of file
Added: branches/enterprise/WFK-2_1/examples/quartz/quartz-ejb/src/test/resources/arquillian.xml
===================================================================
--- branches/enterprise/WFK-2_1/examples/quartz/quartz-ejb/src/test/resources/arquillian.xml (rev 0)
+++ branches/enterprise/WFK-2_1/examples/quartz/quartz-ejb/src/test/resources/arquillian.xml 2013-06-04 09:25:36 UTC (rev 15541)
@@ -0,0 +1,24 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<arquillian xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xmlns="http://jboss.org/schema/arquillian"
+ xsi:schemaLocation="http://jboss.org/schema/arquillian http://jboss.org/schema/arquillian/arquillian_1_0.xsd">
+
+ <engine>
+ <property name="deploymentExportPath">target/</property>
+ </engine>
+
+ <container qualifier="jboss" default="true">
+ <configuration>
+ <!-- These properties are only valid for arquillian managed container,
+ but don't cause a problem for the remote container, so they can be left in. -->
+ <!-- To use jacoco, set jacoco.agent system property to something like
+ -javaagent:/path/to/jacocoagent.jar=append=true,destfile=/path/to/output/jacoco.exec -->
+ <property name="javaVmArguments">-Xmx1024m -XX:MaxPermSize=1024m ${jacoco.agent}</property>
+ <property name="serverConfig">standalone.xml</property>
+ <!-- If jbossHome property is not set, the JBOSS_HOME environment variable
+ is used -->
+ <!--<property name="jbossHome">/path/to/jboss/as</property> -->
+ </configuration>
+ </container>
+
+</arquillian>
Copied: branches/enterprise/WFK-2_1/examples/quartz/quartz-ejb/src/test/resources/components.xml (from rev 15540, branches/enterprise/WFK-2_1/examples/quartz/quartz-tests/src/test/resources/WEB-INF/components.xml)
===================================================================
--- branches/enterprise/WFK-2_1/examples/quartz/quartz-ejb/src/test/resources/components.xml (rev 0)
+++ branches/enterprise/WFK-2_1/examples/quartz/quartz-ejb/src/test/resources/components.xml 2013-06-04 09:25:36 UTC (rev 15541)
@@ -0,0 +1,50 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<components xmlns="http://jboss.org/schema/seam/components"
+ xmlns:pay="http://jboss.org/schema/seam/examples/quartz"
+ xmlns:core="http://jboss.org/schema/seam/core"
+ xmlns:async="http://jboss.org/schema/seam/async"
+ xmlns:framework="http://jboss.org/schema/seam/framework"
+ xmlns:persistence="http://jboss.org/schema/seam/persistence"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation=
+ "http://jboss.org/schema/seam/core http://jboss.org/schema/seam/core-2.3.xsd
+ http://jboss.org/schema/seam/async http://jboss.org/schema/seam/async-2.3.xsd
+ http://jboss.org/schema/seam/framework http://jboss.org/schema/seam/framework-2.3.xsd
+ http://jboss.org/schema/seam/persistence http://jboss.org/schema/seam/persistence-2.3.xsd
+ http://jboss.org/schema/seam/components http://jboss.org/schema/seam/components-2.3.xsd">
+
+ <pay:payment-home name="paymentHome"
+ new-instance="#{newPayment}"
+ created-message="Created a new payment to #{newPayment.payee}" />
+
+ <pay:payment name="newPayment"
+ payee="Somebody"
+ account="#{selectedAccount}"
+ payment-date="#{currentDatetime}"
+ created-date="#{currentDatetime}" />
+
+ <factory name="selectedAccount"
+ value="#{accountHome.instance}"/>
+
+ <framework:entity-home name="accountHome"
+ entity-class="org.jboss.seam.example.quartz.Account"
+ entity-manager="#{entityManager}" />
+
+ <framework:entity-query name="accounts"
+ ejbql="from Account"
+ order="accountNumber"
+ max-results="20"
+ entity-manager="#{entityManager}" />
+
+ <persistence:managed-persistence-context name="entityManager"
+ auto-create="true"
+ persistence-unit-jndi-name="java:/seampayEntityManagerFactory" />
+
+ <!-- Install the QuartzDispatcher -->
+ <async:quartz-dispatcher/>
+
+ <core:init debug="true" jndi-pattern="java:app/quartz-ejb/#{ejbName}" />
+
+ <component class="org.jboss.seam.transaction.EjbSynchronizations" jndi-name="java:app/jboss-seam/EjbSynchronizations"/>
+
+</components>
Added: branches/enterprise/WFK-2_1/examples/quartz/quartz-ejb/src/test/resources/ejb-jar.xml
===================================================================
--- branches/enterprise/WFK-2_1/examples/quartz/quartz-ejb/src/test/resources/ejb-jar.xml (rev 0)
+++ branches/enterprise/WFK-2_1/examples/quartz/quartz-ejb/src/test/resources/ejb-jar.xml 2013-06-04 09:25:36 UTC (rev 15541)
@@ -0,0 +1,20 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<ejb-jar xmlns="http://java.sun.com/xml/ns/javaee"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/ejb-jar_3_0.xsd"
+ version="3.0">
+
+ <interceptors>
+ <interceptor>
+ <interceptor-class>org.jboss.seam.ejb.SeamInterceptor</interceptor-class>
+ </interceptor>
+ </interceptors>
+
+ <assembly-descriptor>
+ <interceptor-binding>
+ <ejb-name>*</ejb-name>
+ <interceptor-class>org.jboss.seam.ejb.SeamInterceptor</interceptor-class>
+ </interceptor-binding>
+ </assembly-descriptor>
+
+</ejb-jar>
Added: branches/enterprise/WFK-2_1/examples/quartz/quartz-ejb/src/test/resources/import.sql
===================================================================
--- branches/enterprise/WFK-2_1/examples/quartz/quartz-ejb/src/test/resources/import.sql (rev 0)
+++ branches/enterprise/WFK-2_1/examples/quartz/quartz-ejb/src/test/resources/import.sql 2013-06-04 09:25:36 UTC (rev 15541)
@@ -0,0 +1,6 @@
+insert into Account(id, accountNumber, balance) values (1, '23001', 1001.46)
+insert into Account(id, accountNumber, balance) values (2, '23002', 1002.46)
+insert into Account(id, accountNumber, balance) values (3, '23003', 1003.46)
+insert into Account(id, accountNumber, balance) values (4, '23004', 1004.46)
+insert into Account(id, accountNumber, balance) values (5, '23005', 1005.46)
+
Added: branches/enterprise/WFK-2_1/examples/quartz/quartz-ejb/src/test/resources/index.html
===================================================================
--- branches/enterprise/WFK-2_1/examples/quartz/quartz-ejb/src/test/resources/index.html (rev 0)
+++ branches/enterprise/WFK-2_1/examples/quartz/quartz-ejb/src/test/resources/index.html 2013-06-04 09:25:36 UTC (rev 15541)
@@ -0,0 +1,5 @@
+<html>
+<head>
+ <meta http-equiv="Refresh" content="0; URL=search.seam">
+</head>
+</html>
\ No newline at end of file
Added: branches/enterprise/WFK-2_1/examples/quartz/quartz-ejb/src/test/resources/jboss-deployment-structure.xml
===================================================================
--- branches/enterprise/WFK-2_1/examples/quartz/quartz-ejb/src/test/resources/jboss-deployment-structure.xml (rev 0)
+++ branches/enterprise/WFK-2_1/examples/quartz/quartz-ejb/src/test/resources/jboss-deployment-structure.xml 2013-06-04 09:25:36 UTC (rev 15541)
@@ -0,0 +1,9 @@
+<jboss-deployment-structure xmlns="urn:jboss:deployment-structure:1.0">
+ <deployment>
+ <dependencies>
+ <module name="org.dom4j" export="true"/>
+ <module name="org.apache.commons.collections" export="true"/>
+ <module name="javax.faces.api" export="true"/>
+ </dependencies>
+ </deployment>
+</jboss-deployment-structure>
Added: branches/enterprise/WFK-2_1/examples/quartz/quartz-ejb/src/test/resources/pages.xml
===================================================================
--- branches/enterprise/WFK-2_1/examples/quartz/quartz-ejb/src/test/resources/pages.xml (rev 0)
+++ branches/enterprise/WFK-2_1/examples/quartz/quartz-ejb/src/test/resources/pages.xml 2013-06-04 09:25:36 UTC (rev 15541)
@@ -0,0 +1,16 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<pages xmlns="http://jboss.org/schema/seam/pages"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://jboss.org/schema/seam/pages http://jboss.org/schema/seam/pages-2.3.xsd">
+
+ <page view-id="/search.xhtml">
+ <param name="accountId" value="#{accountHome.id}" converterId="javax.faces.Long" />
+
+ <navigation>
+ <rule if-outcome="persisted">
+ <render/>
+ </rule>
+ </navigation>
+
+ </page>
+</pages>
Added: branches/enterprise/WFK-2_1/examples/quartz/quartz-ejb/src/test/resources/persistence.xml
===================================================================
--- branches/enterprise/WFK-2_1/examples/quartz/quartz-ejb/src/test/resources/persistence.xml (rev 0)
+++ branches/enterprise/WFK-2_1/examples/quartz/quartz-ejb/src/test/resources/persistence.xml 2013-06-04 09:25:36 UTC (rev 15541)
@@ -0,0 +1,16 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<persistence xmlns="http://java.sun.com/xml/ns/persistence"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://java.sun.com/xml/ns/persistence http://java.sun.com/xml/ns/persistence/persistence_2_0.xsd"
+ version="2.0">
+ <persistence-unit name="userDatabase">
+ <provider>org.hibernate.ejb.HibernatePersistence</provider>
+ <jta-data-source>java:jboss/datasources/ExampleDS</jta-data-source>
+ <properties>
+ <property name="hibernate.hbm2ddl.auto" value="create-drop"/>
+ <property name="hibernate.show_sql" value="true"/>
+ <property name="jboss.entity.manager.factory.jndi.name"
+ value="java:/seampayEntityManagerFactory"/>
+ </properties>
+ </persistence-unit>
+</persistence>
Added: branches/enterprise/WFK-2_1/examples/quartz/quartz-ejb/src/test/resources/seam.properties
===================================================================
Copied: branches/enterprise/WFK-2_1/examples/quartz/quartz-ejb/src/test/resources/seam.quartz.properties (from rev 15540, branches/enterprise/WFK-2_1/examples/quartz/quartz-tests/src/test/resources/seam.quartz.properties)
===================================================================
--- branches/enterprise/WFK-2_1/examples/quartz/quartz-ejb/src/test/resources/seam.quartz.properties (rev 0)
+++ branches/enterprise/WFK-2_1/examples/quartz/quartz-ejb/src/test/resources/seam.quartz.properties 2013-06-04 09:25:36 UTC (rev 15541)
@@ -0,0 +1,9 @@
+org.quartz.scheduler.instanceName = Sched1
+org.quartz.scheduler.instanceId = 1
+org.quartz.scheduler.rmi.export = false
+org.quartz.scheduler.rmi.proxy = false
+
+org.quartz.threadPool.class = org.quartz.simpl.SimpleThreadPool
+org.quartz.threadPool.threadCount = 3
+
+org.quartz.jobStore.class = org.quartz.simpl.RAMJobStore
Added: branches/enterprise/WFK-2_1/examples/quartz/quartz-ejb/src/test/resources/search.xhtml
===================================================================
--- branches/enterprise/WFK-2_1/examples/quartz/quartz-ejb/src/test/resources/search.xhtml (rev 0)
+++ branches/enterprise/WFK-2_1/examples/quartz/quartz-ejb/src/test/resources/search.xhtml 2013-06-04 09:25:36 UTC (rev 15541)
@@ -0,0 +1,177 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml"
+ xmlns:ui="http://java.sun.com/jsf/facelets"
+ xmlns:h="http://java.sun.com/jsf/html"
+ xmlns:f="http://java.sun.com/jsf/core"
+ xmlns:s="http://jboss.org/schema/seam/taglib">
+<head>
+ <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
+ <title>Seam Pay</title>
+ <link href="screen.css" rel="stylesheet" type="text/css" />
+ <link href="date.css" rel="stylesheet" type="text/css" />
+</head>
+<body>
+
+ <div class="menuButtons">
+ <s:link view="/search.xhtml" value="Show Accounts"/>
+ </div>
+
+ <div class="body">
+ <h1>Account</h1>
+
+ <h:messages styleClass="message"/>
+
+
+ <!-- search results -->
+ <table class="results">
+ <tr>
+ <th>Id</th>
+ <th>Account Number</th>
+ <th>Balance</th>
+ </tr>
+ <ui:repeat id="accountTable" value="#{accounts.resultList}" var="account">
+ <tr>
+ <td>
+ <s:link id="link" view="/search.xhtml" value="#{account.id}">
+ <f:param name="accountId" value="#{account.id}"/>
+ </s:link>
+ </td>
+ <td>#{account.accountNumber}</td>
+ <td>
+ <h:outputText id="balance" value="#{account.balance}">
+ <f:convertNumber type="currency" currencySymbol="$"/>
+ </h:outputText>
+ </td>
+ </tr>
+ </ui:repeat>
+ </table>
+ <h:outputText value="No accounts found" rendered="#{empty accounts.resultList}" styleClass="message"/>
+
+
+ <f:subview id="accountView" rendered="#{accountHome.idDefined}">
+ <h2>Payments from Account #{accountHome.instance.accountNumber}</h2>
+ <table id="payments" class="results">
+ <thead>
+ <tr>
+ <th>Status</th>
+ <th>Payee</th>
+ <th>Payment Amount</th>
+ <th>Created Date</th>
+ <th>Scheduled Date</th>
+ <th>Cron</th>
+ <th>Frequency</th>
+ <th>Last Paid On</th>
+ </tr>
+ </thead>
+ <tbody>
+ <ui:repeat value="#{accountHome.instance.payments}" var="payment">
+ <tr>
+ <td>
+ <s:button action="#{paymentHome.cancel}" value="Cancel" rendered="#{payment.active}">
+ <f:param name="paymentId" value="#{payment.id}"/>
+ </s:button>
+ <h:outputText value="not active" rendered="#{!payment.active}" />
+ </td>
+ <td>#{payment.payee}</td>
+ <td>
+ <h:outputText value="#{payment.amount}">
+ <f:convertNumber type="currency" currencySymbol="$"/>
+ </h:outputText>
+ </td>
+ <td>
+ <h:outputText value="#{payment.createdDate}">
+ <f:convertDateTime type="date" dateStyle="medium" />
+ </h:outputText>
+ </td>
+ <td>
+ <h:outputText value="#{payment.paymentDate}">
+ <f:convertDateTime type="date" dateStyle="medium" />
+ </h:outputText>
+ </td>
+ <td>#{payment.paymentCron}</td>
+ <td>#{payment.paymentFrequency}</td>
+ <td>
+ <h:outputText value="#{payment.lastPaid}">
+ <f:convertDateTime type="date" dateStyle="medium" />
+ </h:outputText>
+ </td>
+ </tr>
+ </ui:repeat>
+ </tbody>
+ </table>
+
+ <h2>Make a payment from account #{accountHome.instance.accountNumber}:</h2>
+ <h:form id="paymentForm">
+ <s:validateAll>
+ <table>
+ <tr>
+ <td>To:</td>
+ <td>
+ <h:inputText id="payee" value="#{newPayment.payee}" required="true"/>
+ </td>
+ </tr>
+ <tr>
+ <td>Amount:</td>
+ <td><h:inputText id="amount" value="#{newPayment.amount}" required="true">
+ <ui:remove>
+ <f:convertNumber type="currency" currencySymbol="$"/>
+ </ui:remove>
+ </h:inputText></td>
+ </tr>
+ <tr>
+ <td>Start Date:</td>
+ <td><h:inputText id="paymentStartDate" value="#{newPayment.paymentDate}" required="true">
+ <f:convertDateTime pattern="MM/dd/yyyy HH:mm"/>
+
+ </h:inputText>
+
+ <h:message for="paymentStartDate" />
+ </td>
+ </tr>
+ <tr>
+ <td>End Date:</td>
+ <td><h:inputText id="paymentEndDate" value="#{newPayment.paymentEndDate}">
+ <f:convertDateTime pattern="MM/dd/yyyy HH:mm"/>
+
+ </h:inputText>
+
+ <h:message for="paymentEndDate" />
+ </td>
+ </tr>
+
+ </table>
+ </s:validateAll>
+
+ <p><b>Now, choose one of the following repeat payment schemes</b></p>
+ <p>Cron:
+ <h:inputText id="paymentCron" value="#{newPayment.paymentCron}"/><br/>
+ <h:commandButton id="cronSubmit" value="Schedule Cron Job"
+ action="#{paymentHome.saveAndScheduleCron}" />
+ </p>
+
+ <p>Fixed frequency:
+ <h:selectOneRadio id="radioList"
+ layout="lineDirection"
+ value="#{newPayment.paymentFrequency}">
+<!-- <f:converter converterId="org.jboss.seam.ui.EnumConverter" />-->
+ <s:convertEnum />
+ <s:enumItem enumValue="ONCE" label="Only Once" />
+ <s:enumItem enumValue="EVERY_MINUTE" label="Every Minute (testing)" />
+ <s:enumItem enumValue="HOURLY" label="Every Hour (testing)" />
+ <s:enumItem enumValue="DAILY" label="Every Day" />
+ <s:enumItem enumValue="WEEKLY" label="Every Week" />
+ <ui:remove>
+ <f:selectItems value="#{newPayment.frequencies}" />
+ </ui:remove>
+ </h:selectOneRadio><br/>
+ <h:commandButton id="submit" value="Schedule at Fixed Interval"
+ action="#{paymentHome.saveAndSchedule}" />
+ </p>
+
+ </h:form>
+ </f:subview>
+
+ </div>
+
+</body>
+</html>
Copied: branches/enterprise/WFK-2_1/examples/quartz/quartz-ejb/src/test/resources/web.xml (from rev 15540, branches/enterprise/WFK-2_1/examples/quartz/quartz-tests/src/test/resources-integration/web.xml)
===================================================================
--- branches/enterprise/WFK-2_1/examples/quartz/quartz-ejb/src/test/resources/web.xml (rev 0)
+++ branches/enterprise/WFK-2_1/examples/quartz/quartz-ejb/src/test/resources/web.xml 2013-06-04 09:25:36 UTC (rev 15541)
@@ -0,0 +1,12 @@
+<?xml version="1.0" ?>
+
+<web-app version="3.0"
+ xmlns="http://java.sun.com/xml/ns/javaee"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd">
+
+ <listener>
+ <listener-class>org.jboss.seam.mock.MockSeamListener</listener-class>
+ </listener>
+
+</web-app>
Deleted: branches/enterprise/WFK-2_1/examples/quartz/quartz-tests/pom.xml
===================================================================
--- branches/enterprise/WFK-2_1/examples/quartz/quartz-tests/pom.xml 2013-06-04 07:13:54 UTC (rev 15540)
+++ branches/enterprise/WFK-2_1/examples/quartz/quartz-tests/pom.xml 2013-06-04 09:25:36 UTC (rev 15541)
@@ -1,196 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
- <modelVersion>4.0.0</modelVersion>
- <parent>
- <artifactId>quartz</artifactId>
- <groupId>org.jboss.seam.examples</groupId>
- <version>2.3.1.Final-redhat-2</version>
- <relativePath>../pom.xml</relativePath>
- </parent>
-
- <groupId>org.jboss.seam.examples.quartz</groupId>
- <artifactId>quartz-tests</artifactId>
- <name>Quartz Integration Tests Module (EE6)</name>
-
- <dependencies>
- <dependency>
- <groupId>org.testng</groupId>
- <artifactId>testng</artifactId>
-
- </dependency>
- <dependency>
- <groupId>org.jboss.seam.examples.quartz</groupId>
- <artifactId>quartz-ejb</artifactId>
- <type>ejb</type>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.jboss.seam</groupId>
- <artifactId>jboss-seam</artifactId>
- <type>ejb</type>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.slf4j</groupId>
- <artifactId>slf4j-log4j12</artifactId>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.jboss.spec.javax.faces</groupId>
- <artifactId>jboss-jsf-api_2.1_spec</artifactId>
- </dependency>
- <dependency>
- <groupId>org.hibernate.javax.persistence</groupId>
- <artifactId>hibernate-jpa-2.0-api</artifactId>
- </dependency>
- <dependency>
- <groupId>org.seleniumhq.selenium</groupId>
- <artifactId>selenium-server</artifactId>
- </dependency>
- <dependency>
- <groupId>org.seleniumhq.selenium</groupId>
- <artifactId>selenium-java</artifactId>
- </dependency>
- <dependency>
- <groupId>org.jboss.seam</groupId>
- <artifactId>functional-tests</artifactId>
- <scope>test</scope>
- </dependency>
-
- <dependency>
- <groupId>org.jboss.arquillian.junit</groupId>
- <artifactId>arquillian-junit-container</artifactId>
- <scope>test</scope>
- </dependency>
-
- <dependency>
- <groupId>org.jboss.arquillian.protocol</groupId>
- <artifactId>arquillian-protocol-servlet</artifactId>
- <scope>test</scope>
- </dependency>
-
- <dependency>
- <groupId>org.jboss.shrinkwrap.resolver</groupId>
- <artifactId>shrinkwrap-resolver-api-maven</artifactId>
- <scope>test</scope>
- </dependency>
-
- <dependency>
- <groupId>org.jboss.shrinkwrap.resolver</groupId>
- <artifactId>shrinkwrap-resolver-impl-maven</artifactId>
- <scope>test</scope>
- </dependency>
-
- <dependency>
- <groupId>org.dbunit</groupId>
- <artifactId>dbunit</artifactId>
- </dependency>
-
- <dependency>
- <groupId>org.jboss.spec.javax.el</groupId>
- <artifactId>jboss-el-api_2.2_spec</artifactId>
- </dependency>
-
- </dependencies>
-
- <build>
- <testResources>
- <testResource>
- <directory>src/test/resources</directory>
- <filtering>true</filtering>
- </testResource>
- <testResource>
- <directory>src/test/resources-integration</directory>
- </testResource>
- </testResources>
- <plugins>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-surefire-plugin</artifactId>
- <configuration>
- <skip>true</skip>
- </configuration>
- </plugin>
- </plugins>
- </build>
-
- <profiles>
-
- <profile>
- <id>integration-tests</id>
- <activation>
- <property>
- <name>arquillian</name>
- </property>
- </activation>
- </profile>
-
- <profile>
- <id>arq-jbossas-7-managed</id>
- <activation>
- <property>
- <name>arquillian</name>
- <value>jbossas-managed-7</value>
- </property>
- </activation>
- <build>
- <plugins>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-dependency-plugin</artifactId>
- </plugin>
- </plugins>
- </build>
- </profile>
-
- <profile>
- <id>arq-jbossas-7-remote</id>
- <activation>
- <property>
- <name>arquillian</name>
- <value>jbossas-remote-7</value>
- </property>
- </activation>
- </profile>
-
- <profile>
- <id>ftest-jbossas</id>
- <properties>
- <example.context.path>seam-quartz</example.context.path>
- </properties>
- <build>
- <plugins>
- <plugin>
- <groupId>org.codehaus.mojo</groupId>
- <artifactId>selenium-maven-plugin</artifactId>
- </plugin>
- <plugin>
- <groupId>org.codehaus.mojo</groupId>
- <artifactId>failsafe-maven-plugin</artifactId>
- </plugin>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-antrun-plugin</artifactId>
- </plugin>
- </plugins>
- </build>
- </profile>
- <profile>
- <id>validate</id>
- <build>
- <plugins>
- <plugin>
- <groupId>org.codehaus.mojo</groupId>
- <artifactId>xml-maven-plugin</artifactId>
- <executions>
- <execution>
- <phase>none</phase>
- </execution>
- </executions>
- </plugin>
- </plugins>
- </build>
- </profile>
- </profiles>
-
-</project>
Deleted: branches/enterprise/WFK-2_1/examples/quartz/quartz-tests/src/test/java/org/jboss/seam/example/quartz/test/AccountTest.java
===================================================================
--- branches/enterprise/WFK-2_1/examples/quartz/quartz-tests/src/test/java/org/jboss/seam/example/quartz/test/AccountTest.java 2013-06-04 07:13:54 UTC (rev 15540)
+++ branches/enterprise/WFK-2_1/examples/quartz/quartz-tests/src/test/java/org/jboss/seam/example/quartz/test/AccountTest.java 2013-06-04 09:25:36 UTC (rev 15541)
@@ -1,110 +0,0 @@
-package org.jboss.seam.example.quartz.test;
-
-import java.util.List;
-
-import org.jboss.arquillian.container.test.api.Deployment;
-import org.jboss.arquillian.container.test.api.OverProtocol;
-import org.jboss.arquillian.junit.Arquillian;
-import org.jboss.seam.example.quartz.Account;
-import org.jboss.seam.example.quartz.Payment;
-import org.jboss.seam.mock.DBJUnitSeamTest;
-import org.jboss.shrinkwrap.api.Archive;
-import org.jboss.shrinkwrap.api.spec.EnterpriseArchive;
-import org.jboss.shrinkwrap.api.spec.WebArchive;
-import org.junit.Test;
-import org.junit.runner.RunWith;
-
-/**
- *
- * @author Pete Muir
- *
- */
-(a)RunWith(Arquillian.class)
-public class AccountTest
- extends DBJUnitSeamTest
-{
- @Deployment(name="AccountTest")
- @OverProtocol("Servlet 3.0")
- public static Archive<?> createDeployment()
- {
- EnterpriseArchive er = Deployments.quartzDeployment();
- WebArchive web = er.getAsType(WebArchive.class, "quartz-web.war");
- web.addClasses(AccountTest.class);
- return er;
- }
-
- @Override
- protected void prepareDBUnitOperations() {
-
- setDatabase("HSQL");
- setDatasourceJndiName("java:jboss/datasources/ExampleDS");
-
- beforeTestOperations.add(
- new DataSetOperation("BaseData.xml")
- );
- }
-
- @Test
- public void listAccounts() throws Exception
- {
- new FacesRequest("/search.xhtml")
- {
-
- @Override
- @SuppressWarnings("unchecked")
- protected void renderResponse() throws Exception
- {
- List<Account> accounts = (List<Account>) getValue("#{accounts.resultList}");
-
- assert accounts.size() == 5;
- }
-
- }.run();
- }
-
- @Test
- public void selectAccount() throws Exception
- {
- String id = new FacesRequest("/search.xhtml")
- {
-
- @Override
- @SuppressWarnings("unchecked")
- protected void renderResponse() throws Exception
- {
- assert !((Boolean)getValue("#{accountHome.idDefined}"));
- }
- }.run();
-
- new FacesRequest("/search.xhtml", id)
- {
-
- @Override
- protected void beforeRequest()
- {
- setParameter("accountId", "1");
- }
-
- @Override
- protected void renderResponse() throws Exception
- {
- assert ((Boolean) getValue("#{accountHome.idDefined}"));
-
- Account account = (Account) getValue("#{selectedAccount}");
- assert account !=null;
- assert account.getId() == 1;
- assert account.getPayments().size() == 0;
-
- Payment payment = (Payment) getValue("#{newPayment}");
- assert payment.getPayee().equals("Somebody");
- assert payment.getAccount() != null;
- assert payment.getAccount().getId() == 1;
-
- }
- }.run();
-
-
-
- }
-
-}
Deleted: branches/enterprise/WFK-2_1/examples/quartz/quartz-tests/src/test/java/org/jboss/seam/example/quartz/test/AsynchronousTest.java
===================================================================
--- branches/enterprise/WFK-2_1/examples/quartz/quartz-tests/src/test/java/org/jboss/seam/example/quartz/test/AsynchronousTest.java 2013-06-04 07:13:54 UTC (rev 15540)
+++ branches/enterprise/WFK-2_1/examples/quartz/quartz-tests/src/test/java/org/jboss/seam/example/quartz/test/AsynchronousTest.java 2013-06-04 09:25:36 UTC (rev 15541)
@@ -1,130 +0,0 @@
-package org.jboss.seam.example.quartz.test;
-
-import static org.jboss.seam.example.quartz.Payment.Frequency.ONCE;
-
-import java.math.BigDecimal;
-
-import org.jboss.arquillian.container.test.api.Deployment;
-import org.jboss.arquillian.container.test.api.OverProtocol;
-import org.jboss.arquillian.junit.Arquillian;
-import org.jboss.seam.example.quartz.Account;
-import org.jboss.seam.example.quartz.Payment;
-import org.jboss.seam.mock.DBJUnitSeamTest;
-import org.jboss.shrinkwrap.api.Archive;
-import org.jboss.shrinkwrap.api.spec.EnterpriseArchive;
-import org.jboss.shrinkwrap.api.spec.WebArchive;
-import org.junit.Test;
-import org.junit.runner.RunWith;
-
-/**
- *
- * @author Pete Muir
- *
- */
-
-// Actually this doesn't happen in the example, but lets test it here to keep
-// all quartz tests in one place
-(a)RunWith(Arquillian.class)
-public class AsynchronousTest extends DBJUnitSeamTest
-{
- @Deployment(name="AsynchronousTest")
- @OverProtocol("Servlet 3.0")
- public static Archive<?> createDeployment()
- {
- EnterpriseArchive er = Deployments.quartzDeployment();
- WebArchive web = er.getAsType(WebArchive.class, "quartz-web.war");
- web.addClasses(AsynchronousTest.class);
- return er;
- }
-
- @Override
- protected void prepareDBUnitOperations() {
-
- setDatabase("HSQL");
- setDatasourceJndiName("java:jboss/datasources/ExampleDS");
-
- beforeTestOperations.add(
- new DataSetOperation("BaseData.xml")
- );
- }
-
- @Test
- public void testAsynchronous() throws Exception
- {
- String id = new FacesRequest("/search.xhtml")
- {
- @Override
- protected void beforeRequest()
- {
- setParameter("accountId", "1");
- }
-
- @Override
- protected void updateModelValues() throws Exception
- {
- setValue("#{newPayment.payee}", "IRS");
- setValue("#{newPayment.amount}", new BigDecimal("100.00"));
- setValue("#{newPayment.paymentFrequency}", ONCE);
- }
-
- @Override
- protected void invokeApplication() throws Exception
- {
- invokeMethod("#{paymentHome.scheduleAndSaveAsynchronously}");
- }
-
- @Override
- protected void renderResponse() throws Exception
- {
- assert ((Boolean)getValue("#{accountHome.idDefined}"));
- Account account = (Account) getValue("#{selectedAccount}");
- assert account !=null;
- assert account.getId() == 1;
- assert account.getPayments().size() == 1;
- }
-
- }.run();
-
- // Wait, let quartz execute the async method which schedules the job
- // for immediate execution
- pause(50);
-
- new FacesRequest("/search.xhtml", id)
- {
-
- @Override
- protected void beforeRequest()
- {
- setParameter("accountId", "1");
- }
-
- @Override
- protected void renderResponse() throws Exception
- {
- assert ((Boolean)getValue("#{accountHome.idDefined}"));
- Account account = (Account) getValue("#{selectedAccount}");
- assert account !=null;
- assert account.getId() == 1;
- assert account.getPayments().size() == 1;
- Payment payment = account.getPayments().get(0);
- assert new BigDecimal("100.00").equals(payment.getAmount());
- //assert !payment.getActive();
- //assert payment.getLastPaid() != null;
- assert new BigDecimal("901.46").equals(account.getBalance());
- }
-
- }.run();
- }
-
-
- private void pause(long ms) {
- try {
- Thread.sleep(ms);
- } catch (InterruptedException e) {
-
- }
- }
-
-
-
-}
Deleted: branches/enterprise/WFK-2_1/examples/quartz/quartz-tests/src/test/java/org/jboss/seam/example/quartz/test/CronTest.java
===================================================================
--- branches/enterprise/WFK-2_1/examples/quartz/quartz-tests/src/test/java/org/jboss/seam/example/quartz/test/CronTest.java 2013-06-04 07:13:54 UTC (rev 15540)
+++ branches/enterprise/WFK-2_1/examples/quartz/quartz-tests/src/test/java/org/jboss/seam/example/quartz/test/CronTest.java 2013-06-04 09:25:36 UTC (rev 15541)
@@ -1,467 +0,0 @@
-package org.jboss.seam.example.quartz.test;
-
-import static org.jboss.seam.example.quartz.Payment.Frequency.EVERY_SECOND;
-
-import java.math.BigDecimal;
-
-import org.jboss.arquillian.container.test.api.Deployment;
-import org.jboss.arquillian.container.test.api.OverProtocol;
-import org.jboss.arquillian.junit.Arquillian;
-import org.jboss.seam.async.QuartzTriggerHandle;
-import org.jboss.seam.example.quartz.Account;
-import org.jboss.seam.example.quartz.Payment;
-import org.jboss.seam.example.quartz.Payment.Frequency;
-import org.jboss.seam.mock.DBJUnitSeamTest;
-import org.jboss.shrinkwrap.api.Archive;
-import org.jboss.shrinkwrap.api.spec.EnterpriseArchive;
-import org.jboss.shrinkwrap.api.spec.WebArchive;
-import org.junit.Ignore;
-import org.junit.Test;
-import org.junit.runner.RunWith;
-
-/**
- * @author Pete Muir
- *
- */
-(a)RunWith(Arquillian.class)
-public class CronTest extends DBJUnitSeamTest
-{
- private QuartzTriggerHandle quartzTriggerHandle;
- private Long paymentId;
-
- private static final Frequency REPEATING = EVERY_SECOND;
-
- @Deployment(name="CronTest")
- @OverProtocol("Servlet 3.0")
- public static Archive<?> createDeployment()
- {
- EnterpriseArchive er = Deployments.quartzDeployment();
- WebArchive web = er.getAsType(WebArchive.class, "quartz-web.war");
- web.addClasses(CronTest.class);
- return er;
- }
-
- @Override
- protected void prepareDBUnitOperations() {
- setDatabase("HSQL");
- setDatasourceJndiName("java:jboss/datasources/ExampleDS");
-
- beforeTestOperations.add(
- new DataSetOperation("BaseData.xml")
- );
- }
-
-
-
-
- @Ignore
- @Test
- public void scheduleCron() throws Exception
- {
-
- try
- {
- String id = new FacesRequest("/search.xhtml")
- {
- @Override
- protected void beforeRequest()
- {
- setParameter("accountId", "1");
- }
-
- @Override
- protected void updateModelValues() throws Exception
- {
- setValue("#{newPayment.payee}", "IRS");
- setValue("#{newPayment.amount}", new BigDecimal("110.00"));
- setValue("#{newPayment.paymentCron}", "*/2 * * * * ?" );
- }
-
- @Override
- protected void invokeApplication() throws Exception
- {
- // schedule a the repeating job and immediately pause it
- // this allows you to carefully control how long the timer
- // runs for
- assert "persisted".equals(invokeMethod("#{paymentHome.saveAndScheduleCron}"));
- Payment payment = (Payment) getValue("#{newPayment}");
- quartzTriggerHandle = payment.getQuartzTriggerHandle();
- quartzTriggerHandle.pause();
- }
-
- @Override
- protected void renderResponse() throws Exception
- {
- // Check the job exists
- assert ((Boolean)getValue("#{accountHome.idDefined}"));
- Account account = (Account) getValue("#{selectedAccount}");
- assert account !=null;
- assert account.getId() == 1;
- assert account.getPayments().size() == 1;
-
- Payment payment = (Payment) getValue("#{newPayment}");
- assert payment.getPayee().equals("IRS");
- assert payment.getAmount().equals(new BigDecimal("110.00"));
- assert payment.getAccount() != null;
- assert payment.getAccount().getId() == 1;
- assert payment.getActive();
- }
-
- }.run();
-
- // Start the triggerHandle, wait a lot shorter than the job takes
- // At this point the job should have executed once exactly
- quartzTriggerHandle.resume();
- pause((long) (REPEATING.getInterval() * 0.5));
- quartzTriggerHandle.pause();
-
- new FacesRequest("/search.xhtml", id)
- {
-
- @Override
- protected void beforeRequest()
- {
- setParameter("accountId", "1");
- }
-
- @Override
- protected void renderResponse() throws Exception
- {
- assert ((Boolean)getValue("#{accountHome.idDefined}"));
- Account account = (Account) getValue("#{selectedAccount}");
- assert account !=null;
- assert account.getId() == 1;
- assert account.getPayments().size() == 1;
- Payment payment = account.getPayments().get(0);
- assert new BigDecimal("110.00").equals(payment.getAmount());
- assert payment.getActive();
- assert "*/2 * * * * ?".equals(payment.getPaymentCron());
-
- assert new BigDecimal("891.46").equals(account.getBalance());
- }
-
- }.run();
-
- // Start the triggerHandle, wait until some short time after the
- // job triggers once
- quartzTriggerHandle.resume();
- pause(2000l);
- quartzTriggerHandle.pause();
-
-
- new FacesRequest("/search.xhtml", id)
- {
-
- @Override
- protected void beforeRequest()
- {
- setParameter("accountId", "1");
- }
-
- @Override
- protected void renderResponse() throws Exception
- {
-
- // Job should have run twice
- assert ((Boolean)getValue("#{accountHome.idDefined}"));
- Account account = (Account) getValue("#{selectedAccount}");
-
- assert account !=null;
- assert account.getId() == 1;
- assert account.getPayments().size() == 1;
- Payment payment = account.getPayments().get(0);
- assert new BigDecimal("110.00").equals(payment.getAmount());
- assert payment.getActive();
- assert "*/2 * * * * ?".equals(payment.getPaymentCron());
- assert payment.getLastPaid() != null;
- assert new BigDecimal("781.46").equals(account.getBalance());
- paymentId = payment.getId();
- }
-
- }.run();
-
- new FacesRequest("/search.xhtml", id)
- {
-
- @Override
- protected void beforeRequest()
- {
- setParameter("accountId", "1");
- setParameter("paymentId", paymentId.toString());
- }
-
- @Override
- protected void invokeApplication() throws Exception
- {
- // Resume the job, then cancel it
- quartzTriggerHandle.resume();
- invokeMethod("#{paymentHome.cancel}");
- }
-
- @Override
- protected void renderResponse() throws Exception
- {
-
- assert ((Boolean)getValue("#{accountHome.idDefined}"));
- Account account = (Account) getValue("#{selectedAccount}");
-
- assert account !=null;
- assert account.getId() == 1;
- assert account.getPayments().size() == 1;
- Payment payment = account.getPayments().get(0);
- assert new BigDecimal("110.00").equals(payment.getAmount());
- assert !payment.getActive();
- assert payment.getLastPaid() != null;
- assert new BigDecimal("781.46").equals(account.getBalance());
- }
-
- }.run();
-
- // Wait until some short time after another execution would
- // have occurred to check it really stops
- pause(2000l);
-
- new FacesRequest("/search.xhtml", id)
- {
-
- @Override
- protected void beforeRequest()
- {
- setParameter("accountId", "1");
- }
-
- @Override
- protected void renderResponse() throws Exception
- {
-
- assert ((Boolean)getValue("#{accountHome.idDefined}"));
- Account account = (Account) getValue("#{selectedAccount}");
-
- assert account !=null;
- assert account.getId() == 1;
- assert new BigDecimal("781.46").equals(account.getBalance());
- }
-
- }.run();
-
- }
- finally
- {
- if (quartzTriggerHandle != null)
- {
- quartzTriggerHandle.cancel();
- }
- }
- }
-
- @Ignore
- @Test
- public void scheduleCronWithStartAndEndTime() throws Exception
- {
-
- try
- {
- String id = new FacesRequest("/search.xhtml")
- {
- @Override
- protected void beforeRequest()
- {
- setParameter("accountId", "1");
- }
-
- @Override
- protected void updateModelValues() throws Exception
- {
- setValue("#{newPayment.payee}", "IRS");
- setValue("#{newPayment.amount}", new BigDecimal("110.00"));
- setValue("#{newPayment.paymentCron}", "*/2 * * * * ?" );
- }
-
- @Override
- protected void invokeApplication() throws Exception
- {
- // schedule a the repeating job and immediately pause it
- // this allows you to carefully control how long the timer
- // runs for
- Payment payment = (Payment) getValue("#{newPayment}");
- payment.setPaymentDate(new java.sql.Timestamp( System.currentTimeMillis() + REPEATING.getInterval()));
- payment.setPaymentEndDate(new java.sql.Timestamp( (long) (System.currentTimeMillis() + (REPEATING.getInterval() * 4.5))));
- assert "persisted".equals(invokeMethod("#{paymentHome.saveAndScheduleCron}"));
- quartzTriggerHandle = payment.getQuartzTriggerHandle();
- quartzTriggerHandle.pause();
- }
-
- @Override
- protected void renderResponse() throws Exception
- {
- // Check the job exists
- assert ((Boolean)getValue("#{accountHome.idDefined}"));
- Account account = (Account) getValue("#{selectedAccount}");
- assert account !=null;
- assert account.getId() == 1;
- assert account.getPayments().size() == 1;
-
- Payment payment = (Payment) getValue("#{newPayment}");
- assert payment.getPayee().equals("IRS");
- assert payment.getAmount().equals(new BigDecimal("110.00"));
- assert payment.getAccount() != null;
- assert payment.getAccount().getId() == 1;
- assert payment.getActive();
- }
-
- }.run();
-
- // Start the triggerHandle, wait a lot shorter than the job takes
- // At this point the job should have executed once exactly
- quartzTriggerHandle.resume();
- pause((long) (REPEATING.getInterval() * 0.5));
- quartzTriggerHandle.pause();
-
- new FacesRequest("/search.xhtml", id)
- {
-
- @Override
- protected void beforeRequest()
- {
- setParameter("accountId", "1");
- }
-
- @Override
- protected void renderResponse() throws Exception
- {
- assert ((Boolean)getValue("#{accountHome.idDefined}"));
- Account account = (Account) getValue("#{selectedAccount}");
- assert account !=null;
- assert account.getId() == 1;
- assert account.getPayments().size() == 1;
- Payment payment = account.getPayments().get(0);
- assert new BigDecimal("110.00").equals(payment.getAmount());
- assert payment.getActive();
- assert "*/2 * * * * ?".equals(payment.getPaymentCron());
-
- assert new BigDecimal("1001.46").equals(account.getBalance());
- }
-
- }.run();
-
- // Start the triggerHandle, wait until some short time after the initial
- // expiration
- quartzTriggerHandle.resume();
- pause(REPEATING.getInterval());
- quartzTriggerHandle.pause();
-
-
- new FacesRequest("/search.xhtml", id)
- {
-
- @Override
- protected void beforeRequest()
- {
- setParameter("accountId", "1");
- }
-
- @Override
- protected void renderResponse() throws Exception
- {
-
- // Job should have run twice
- assert ((Boolean)getValue("#{accountHome.idDefined}"));
- Account account = (Account) getValue("#{selectedAccount}");
-
- assert account !=null;
- assert account.getId() == 1;
- assert account.getPayments().size() == 1;
- Payment payment = account.getPayments().get(0);
- assert new BigDecimal("110.00").equals(payment.getAmount());
- assert payment.getActive();
- assert "*/2 * * * * ?".equals(payment.getPaymentCron());
- assert new BigDecimal("891.46").equals(account.getBalance());
- paymentId = payment.getId();
- }
-
- }.run();
-
- // Start the triggerHandle, wait until some short time after the
- // job triggers once
- quartzTriggerHandle.resume();
- pause(2000l);
-
- new FacesRequest("/search.xhtml", id)
- {
-
- @Override
- protected void beforeRequest()
- {
- setParameter("accountId", "1");
- }
-
- @Override
- protected void renderResponse() throws Exception
- {
-
- // Job should have run twice
- assert ((Boolean)getValue("#{accountHome.idDefined}"));
- Account account = (Account) getValue("#{selectedAccount}");
-
- assert account !=null;
- assert account.getId() == 1;
- assert account.getPayments().size() == 1;
- Payment payment = account.getPayments().get(0);
- assert new BigDecimal("110.00").equals(payment.getAmount());
- assert payment.getActive();
- assert "*/2 * * * * ?".equals(payment.getPaymentCron());
- assert payment.getLastPaid() != null;
- assert new BigDecimal("781.46").equals(account.getBalance());
- paymentId = payment.getId();
- }
-
- }.run();
-
- // Wait until some short time after another execution would
- // have occurred to check it really stops
- pause(2000l);
-
- new FacesRequest("/search.xhtml", id)
- {
-
- @Override
- protected void beforeRequest()
- {
- setParameter("accountId", "1");
- }
-
- @Override
- protected void renderResponse() throws Exception
- {
-
- assert ((Boolean)getValue("#{accountHome.idDefined}"));
- Account account = (Account) getValue("#{selectedAccount}");
-
- assert account !=null;
- assert account.getId() == 1;
- assert new BigDecimal("781.46").equals(account.getBalance());
- }
-
- }.run();
-
- }
- finally
- {
- if (quartzTriggerHandle != null)
- {
- quartzTriggerHandle.cancel();
- }
- }
- }
-
- private void pause(long ms) {
- try {
- Thread.sleep(ms);
- } catch (InterruptedException e) {
-
- }
- }
-
-
-
-}
Deleted: branches/enterprise/WFK-2_1/examples/quartz/quartz-tests/src/test/java/org/jboss/seam/example/quartz/test/Deployments.java
===================================================================
--- branches/enterprise/WFK-2_1/examples/quartz/quartz-tests/src/test/java/org/jboss/seam/example/quartz/test/Deployments.java 2013-06-04 07:13:54 UTC (rev 15540)
+++ branches/enterprise/WFK-2_1/examples/quartz/quartz-tests/src/test/java/org/jboss/seam/example/quartz/test/Deployments.java 2013-06-04 09:25:36 UTC (rev 15541)
@@ -1,38 +0,0 @@
-package org.jboss.seam.example.quartz.test;
-
-import org.jboss.shrinkwrap.api.ShrinkWrap;
-import org.jboss.shrinkwrap.api.importer.ZipImporter;
-import org.jboss.shrinkwrap.api.spec.EnterpriseArchive;
-import org.jboss.shrinkwrap.api.spec.JavaArchive;
-import org.jboss.shrinkwrap.api.spec.WebArchive;
-import org.jboss.shrinkwrap.resolver.api.DependencyResolvers;
-import org.jboss.shrinkwrap.resolver.api.maven.MavenDependencyResolver;
-
-import java.io.File;
-
-public class Deployments {
- public static EnterpriseArchive quartzDeployment() {
- EnterpriseArchive ear = ShrinkWrap.create(ZipImporter.class, "seam-quartz.ear").importFrom(new File("../quartz-ear/target/seam-quartz.ear"))
- .as(EnterpriseArchive.class);
-
- // Install org.jboss.seam.mock.MockSeamListener
- WebArchive web = ear.getAsType(WebArchive.class, "quartz-web.war");
- web.delete("/WEB-INF/web.xml");
- web.addAsWebInfResource("web.xml");
-
- web.addAsResource("BaseData.xml", "BaseData.xml");
-
- web.delete("/WEB-INF/components.xml");
- web.addAsWebInfResource("WEB-INF/components.xml", "components.xml");
-
- JavaArchive ejb = ear.getAsType(JavaArchive.class, "quartz-ejb.jar");
- ejb.addClasses(TestPaymentController.class, TestPaymentProcessor.class, TransactionStatus.class);
-
- ear.addAsLibraries(DependencyResolvers.use(MavenDependencyResolver.class)
- .configureFrom("pom.xml")
- .artifact("org.dbunit:dbunit:jar:2.2")
- .resolveAsFiles());
-
- return ear;
- }
-}
Deleted: branches/enterprise/WFK-2_1/examples/quartz/quartz-tests/src/test/java/org/jboss/seam/example/quartz/test/EventsTest.java
===================================================================
--- branches/enterprise/WFK-2_1/examples/quartz/quartz-tests/src/test/java/org/jboss/seam/example/quartz/test/EventsTest.java 2013-06-04 07:13:54 UTC (rev 15540)
+++ branches/enterprise/WFK-2_1/examples/quartz/quartz-tests/src/test/java/org/jboss/seam/example/quartz/test/EventsTest.java 2013-06-04 09:25:36 UTC (rev 15541)
@@ -1,274 +0,0 @@
-package org.jboss.seam.example.quartz.test;
-
-import static org.jboss.seam.example.quartz.Payment.Frequency.ONCE;
-
-import java.math.BigDecimal;
-
-import org.jboss.arquillian.container.test.api.Deployment;
-import org.jboss.arquillian.container.test.api.OverProtocol;
-import org.jboss.arquillian.junit.Arquillian;
-import org.jboss.seam.example.quartz.Account;
-import org.jboss.seam.example.quartz.Payment;
-import org.jboss.seam.mock.DBJUnitSeamTest;
-import org.jboss.shrinkwrap.api.Archive;
-import org.jboss.shrinkwrap.api.spec.EnterpriseArchive;
-import org.jboss.shrinkwrap.api.spec.WebArchive;
-import org.junit.Test;
-import org.junit.runner.RunWith;
-
-/**
- *
- * @author Pete Muir
- *
- */
-
-// Actually this doesn't happen in the example, but lets test it here to keep
-// all quartz tests in one place
-(a)RunWith(Arquillian.class)
-public class EventsTest extends DBJUnitSeamTest
-{
- @Deployment(name="EventsTest")
- @OverProtocol("Servlet 3.0")
- public static Archive<?> createDeployment()
- {
- EnterpriseArchive er = Deployments.quartzDeployment();
- WebArchive web = er.getAsType(WebArchive.class, "quartz-web.war");
- web.addClasses(EventsTest.class);
- return er;
- }
-
- @Override
- protected void prepareDBUnitOperations() {
- setDatabase("HSQL");
- setDatasourceJndiName("java:jboss/datasources/ExampleDS");
-
- beforeTestOperations.add(
- new DataSetOperation("BaseData.xml")
- );
- }
-
- @Test
- public void testAsynchronousEvent() throws Exception
- {
- String id = new FacesRequest("/search.xhtml")
- {
- @Override
- protected void beforeRequest()
- {
- setParameter("accountId", "1");
- }
-
- @Override
- protected void updateModelValues() throws Exception
- {
- setValue("#{newPayment.payee}", "IRS");
- setValue("#{newPayment.amount}", new BigDecimal("110.00"));
- setValue("#{newPayment.paymentFrequency}", ONCE);
- }
-
- @Override
- protected void invokeApplication() throws Exception
- {
- invokeMethod("#{paymentHome.scheduleAndSaveUsingAsynchronousEvent}");
- }
-
- @Override
- protected void renderResponse() throws Exception
- {
- assert ((Boolean)getValue("#{accountHome.idDefined}"));
- Account account = (Account) getValue("#{selectedAccount}");
- assert account !=null;
- assert account.getId() == 1;
- assert account.getPayments().size() == 1;
- }
-
- }.run();
-
- // Wait, let quartz execute the async method which schedules the job
- // for immediate execution
- pause(50);
-
- new FacesRequest("/search.xhtml", id)
- {
-
- @Override
- protected void beforeRequest()
- {
- setParameter("accountId", "1");
- }
-
- @Override
- protected void renderResponse() throws Exception
- {
- System.out.println("running renderResponse");
- assert ((Boolean)getValue("#{accountHome.idDefined}"));
- Account account = (Account) getValue("#{selectedAccount}");
- assert account !=null;
- assert account.getId() == 1;
- assert account.getPayments().size() == 1;
- Payment payment = account.getPayments().get(0);
- assert new BigDecimal("110.00").equals(payment.getAmount());
- //assert !payment.getActive();
- //assert payment.getLastPaid() != null;
- assert new BigDecimal("891.46").equals(account.getBalance());
- }
-
- }.run();
- }
-
-
- @Test
- public void testTransactionSuccessEvents() throws Exception
- {
- String id = new FacesRequest("/search.xhtml")
- {
- @Override
- protected void beforeRequest()
- {
- setParameter("accountId", "1");
- }
-
- @Override
- protected void updateModelValues() throws Exception
- {
- setValue("#{newPayment.payee}", "IRS");
- setValue("#{newPayment.amount}", new BigDecimal("110.00"));
- setValue("#{newPayment.paymentFrequency}", ONCE);
- }
-
- @Override
- protected void invokeApplication() throws Exception
- {
- invokeMethod("#{paymentHome.scheduleAndSaveWithTransactionEvents}");
- }
-
- @Override
- protected void renderResponse() throws Exception
- {
- assert ((Boolean)getValue("#{accountHome.idDefined}"));
- Account account = (Account) getValue("#{selectedAccount}");
- assert account !=null;
- assert account.getId() == 1;
- assert account.getPayments().size() == 1;
- }
-
- }.run();
-
- // Wait, let quartz execute the async method which schedules the job
- // for immediate execution
- pause(50);
-
- new FacesRequest("/search.xhtml", id)
- {
-
- @Override
- protected void beforeRequest()
- {
- setParameter("accountId", "1");
- }
-
- @Override
- protected void renderResponse() throws Exception
- {
- System.out.println("running renderResponse");
- assert ((Boolean)getValue("#{accountHome.idDefined}"));
- Account account = (Account) getValue("#{selectedAccount}");
- assert account !=null;
- assert account.getId() == 1;
- assert account.getPayments().size() == 1;
- Payment payment = account.getPayments().get(0);
- assert new BigDecimal("110.00").equals(payment.getAmount());
- //assert !payment.getActive();
- //assert payment.getLastPaid() != null;
- assert new BigDecimal("891.46").equals(account.getBalance());
- assert (Boolean) getValue("#{transactionStatus.transactionCompleted}");
- assert (Boolean) getValue("#{transactionStatus.transactionSucceded}");
- assert payment.getId().equals(getValue("#{transactionStatus.id}"));
- }
-
- }.run();
- }
-
- @Test
- public void testTimedEvent() throws Exception
- {
- String id = new FacesRequest("/search.xhtml")
- {
- @Override
- protected void beforeRequest()
- {
- setParameter("accountId", "1");
- }
-
- @Override
- protected void updateModelValues() throws Exception
- {
- setValue("#{newPayment.payee}", "IRS");
- setValue("#{newPayment.amount}", new BigDecimal("120.00"));
- setValue("#{newPayment.paymentFrequency}", ONCE);
- }
-
- @Override
- protected void invokeApplication() throws Exception
- {
- invokeMethod("#{paymentHome.scheduleAndSaveUsingTimedEvent}");
- }
-
- @Override
- protected void renderResponse() throws Exception
- {
- Thread.sleep(1000);
- assert ((Boolean)getValue("#{accountHome.idDefined}"));
- Account account = (Account) getValue("#{selectedAccount}");
- assert account !=null;
- assert account.getId() == 1;
- assert account.getPayments().size() == 1;
- }
-
- }.run();
-
- // Wait, let quartz execute the async method which schedules the job
- // for immediate execution
- pause(1000l);
-
- new FacesRequest("/search.xhtml", id)
- {
-
- @Override
- protected void beforeRequest()
- {
- setParameter("accountId", "1");
- }
-
- @Override
- protected void renderResponse() throws Exception
- {
- System.out.println("running renderResponse");
- assert ((Boolean)getValue("#{accountHome.idDefined}"));
- Account account = (Account) getValue("#{selectedAccount}");
- assert account != null;
- assert account.getId() == 1;
- assert account.getPayments().size() == 1;
- Payment payment = account.getPayments().get(0);
- assert new BigDecimal("120.00").equals(payment.getAmount()) : "Invalid payment amount: " + payment.getAmount();
- //assert !payment.getActive();
- //assert payment.getLastPaid() != null;
- assert new BigDecimal("881.46").equals(account.getBalance()) : "Invalid account balance: " + account.getBalance();
- }
-
- }.run();
- }
-
-
-
- private void pause(long ms) {
- try {
- Thread.sleep(ms);
- } catch (InterruptedException e) {
-
- }
- }
-
-
-
-}
Deleted: branches/enterprise/WFK-2_1/examples/quartz/quartz-tests/src/test/java/org/jboss/seam/example/quartz/test/OnceTest.java
===================================================================
--- branches/enterprise/WFK-2_1/examples/quartz/quartz-tests/src/test/java/org/jboss/seam/example/quartz/test/OnceTest.java 2013-06-04 07:13:54 UTC (rev 15540)
+++ branches/enterprise/WFK-2_1/examples/quartz/quartz-tests/src/test/java/org/jboss/seam/example/quartz/test/OnceTest.java 2013-06-04 09:25:36 UTC (rev 15541)
@@ -1,151 +0,0 @@
-package org.jboss.seam.example.quartz.test;
-
-import static org.jboss.seam.example.quartz.Payment.Frequency.ONCE;
-
-import java.math.BigDecimal;
-
-import org.jboss.arquillian.container.test.api.Deployment;
-import org.jboss.arquillian.container.test.api.OverProtocol;
-import org.jboss.arquillian.junit.Arquillian;
-import org.jboss.seam.async.QuartzTriggerHandle;
-import org.jboss.seam.example.quartz.Account;
-import org.jboss.seam.example.quartz.Payment;
-import org.jboss.seam.mock.DBJUnitSeamTest;
-import org.jboss.shrinkwrap.api.Archive;
-import org.jboss.shrinkwrap.api.spec.EnterpriseArchive;
-import org.jboss.shrinkwrap.api.spec.WebArchive;
-import org.junit.Ignore;
-import org.junit.Test;
-import org.junit.runner.RunWith;
-
-/**
- *
- * @author Pete Muir
- *
- */
-(a)RunWith(Arquillian.class)
-public class OnceTest extends DBJUnitSeamTest
-{
- @Deployment(name="OnceTest")
- @OverProtocol("Servlet 3.0")
- public static Archive<?> createDeployment()
- {
- EnterpriseArchive er = Deployments.quartzDeployment();
- WebArchive web = er.getAsType(WebArchive.class, "quartz-web.war");
- web.addClasses(OnceTest.class);
- return er;
- }
-
- private QuartzTriggerHandle quartzTriggerHandle;
-
- @Override
- protected void prepareDBUnitOperations() {
- setDatabase("HSQL");
- setDatasourceJndiName("java:jboss/datasources/ExampleDS");
-
- beforeTestOperations.add(
- new DataSetOperation("BaseData.xml")
- );
- }
-
-
-
- @Test
- @Ignore
- public void scheduleOnce() throws Exception
- {
- try
- {
- String id = new FacesRequest("/search.xhtml")
- {
- @Override
- protected void beforeRequest()
- {
- setParameter("accountId", "1");
- }
-
- @Override
- protected void updateModelValues() throws Exception
- {
- setValue("#{newPayment.payee}", "IRS");
- setValue("#{newPayment.amount}", new BigDecimal("100.00"));
- setValue("#{newPayment.paymentFrequency}", ONCE);
- }
-
- @Override
- protected void invokeApplication() throws Exception
- {
- assert "persisted".equals(invokeMethod("#{paymentHome.saveAndSchedule}"));
- }
-
- @Override
- protected void renderResponse() throws Exception
- {
- assert ((Boolean)getValue("#{accountHome.idDefined}"));
- Account account = (Account) getValue("#{selectedAccount}");
- assert account !=null;
- assert account.getId() == 1;
- assert account.getPayments().size() == 1;
-
- Payment payment = (Payment) getValue("#{newPayment}");
- assert payment.getPayee().equals("IRS");
- assert payment.getAmount().equals(new BigDecimal("100.00"));
- assert payment.getAccount() != null;
- assert payment.getAccount().getId() == 1;
- quartzTriggerHandle = payment.getQuartzTriggerHandle();
- }
-
- }.run();
-
- // Wait, let quartz execute the job (async but straight away)
- pause(500);
-
- new FacesRequest("/search.xhtml", id)
- {
-
- @Override
- protected void beforeRequest()
- {
- setParameter("accountId", "1");
- }
-
- @Override
- protected void renderResponse() throws Exception
- {
- assert ((Boolean)getValue("#{accountHome.idDefined}"));
- Account account = (Account) getValue("#{selectedAccount}");
- assert account !=null;
- assert account.getId() == 1;
- assert account.getPayments().size() == 1;
- Payment payment = account.getPayments().get(0);
- assert new BigDecimal("100.00").equals(payment.getAmount());
- assert !payment.getActive();
- assert ONCE.equals(payment.getPaymentFrequency());
- assert payment.getLastPaid() != null;
- assert new BigDecimal("901.46").equals(account.getBalance());
- }
-
- }.run();
- }
- finally
- {
- // Always cancel the job
- if (quartzTriggerHandle != null)
- {
- quartzTriggerHandle.cancel();
- quartzTriggerHandle = null;
- }
- }
- }
-
- private void pause(long ms) {
- try {
- Thread.sleep(ms);
- } catch (InterruptedException e) {
-
- }
- }
-
-
-
-}
Deleted: branches/enterprise/WFK-2_1/examples/quartz/quartz-tests/src/test/java/org/jboss/seam/example/quartz/test/RepeatingTest.java
===================================================================
--- branches/enterprise/WFK-2_1/examples/quartz/quartz-tests/src/test/java/org/jboss/seam/example/quartz/test/RepeatingTest.java 2013-06-04 07:13:54 UTC (rev 15540)
+++ branches/enterprise/WFK-2_1/examples/quartz/quartz-tests/src/test/java/org/jboss/seam/example/quartz/test/RepeatingTest.java 2013-06-04 09:25:36 UTC (rev 15541)
@@ -1,468 +0,0 @@
-package org.jboss.seam.example.quartz.test;
-
-import static org.jboss.seam.example.quartz.Payment.Frequency.EVERY_SECOND;
-
-import java.math.BigDecimal;
-
-import org.jboss.arquillian.container.test.api.Deployment;
-import org.jboss.arquillian.container.test.api.OverProtocol;
-import org.jboss.arquillian.junit.Arquillian;
-import org.jboss.seam.async.QuartzTriggerHandle;
-import org.jboss.seam.example.quartz.Account;
-import org.jboss.seam.example.quartz.Payment;
-import org.jboss.seam.example.quartz.Payment.Frequency;
-import org.jboss.seam.mock.DBJUnitSeamTest;
-import org.jboss.shrinkwrap.api.Archive;
-import org.jboss.shrinkwrap.api.spec.EnterpriseArchive;
-import org.jboss.shrinkwrap.api.spec.WebArchive;
-import org.junit.Test;
-import org.junit.runner.RunWith;
-
-/**
- *
- * @author Pete Muir
- *
- */
-(a)RunWith(Arquillian.class)
-public class RepeatingTest
- extends DBJUnitSeamTest
-{
- @Deployment(name="RepeatingTest")
- @OverProtocol("Servlet 3.0")
- public static Archive<?> createDeployment()
- {
- EnterpriseArchive er = Deployments.quartzDeployment();
- WebArchive web = er.getAsType(WebArchive.class, "quartz-web.war");
- web.addClasses(RepeatingTest.class);
- return er;
- }
-
- private QuartzTriggerHandle quartzTriggerHandle;
- private Long paymentId;
-
- private static final Frequency REPEATING = EVERY_SECOND;
-
-
- @Override
- protected void prepareDBUnitOperations() {
- setDatabase("HSQL");
- setDatasourceJndiName("java:jboss/datasources/ExampleDS");
-
- beforeTestOperations.add(
- new DataSetOperation("BaseData.xml")
- );
- }
-
-
- @Test
- public void scheduleRepeating() throws Exception
- {
-
- try
- {
- String id = new FacesRequest("/search.xhtml")
- {
- @Override
- protected void beforeRequest()
- {
- setParameter("accountId", "1");
- }
-
- @Override
- protected void updateModelValues() throws Exception
- {
- setValue("#{newPayment.payee}", "IRS");
- setValue("#{newPayment.amount}", new BigDecimal("110.00"));
- setValue("#{newPayment.paymentFrequency}", REPEATING );
- }
-
- @Override
- protected void invokeApplication() throws Exception
- {
- // schedule a the repeating job and immediately pause it
- // this allows you to carefully control how long the timer
- // runs for
- assert "persisted".equals(invokeMethod("#{paymentHome.saveAndSchedule}"));
- Payment payment = (Payment) getValue("#{newPayment}");
- quartzTriggerHandle = payment.getQuartzTriggerHandle();
- quartzTriggerHandle.pause();
- }
-
- @Override
- protected void renderResponse() throws Exception
- {
- // Check the job exists
- assert ((Boolean)getValue("#{accountHome.idDefined}"));
- Account account = (Account) getValue("#{selectedAccount}");
- assert account !=null;
- assert account.getId() == 1;
- assert account.getPayments().size() == 1;
-
- Payment payment = (Payment) getValue("#{newPayment}");
- assert payment.getPayee().equals("IRS");
- assert payment.getAmount().equals(new BigDecimal("110.00"));
- assert payment.getAccount() != null;
- assert payment.getAccount().getId() == 1;
- assert payment.getActive();
- }
-
- }.run();
-
- // Start the triggerHandle, wait a lot shorter than the job takes
- // At this point the job should have executed once exactly
- quartzTriggerHandle.resume();
- pause((long) (REPEATING.getInterval() * 0.1));
- quartzTriggerHandle.pause();
-
- new FacesRequest("/search.xhtml", id)
- {
-
- @Override
- protected void beforeRequest()
- {
- setParameter("accountId", "1");
- }
-
- @Override
- protected void renderResponse() throws Exception
- {
- assert ((Boolean)getValue("#{accountHome.idDefined}"));
- Account account = (Account) getValue("#{selectedAccount}");
- assert account !=null;
- assert account.getId() == 1;
- assert account.getPayments().size() == 1;
- Payment payment = account.getPayments().get(0);
- assert new BigDecimal("110.00").equals(payment.getAmount());
- assert payment.getActive();
- assert REPEATING.equals(payment.getPaymentFrequency());
-
- assert new BigDecimal("891.46").equals(account.getBalance());
- }
-
- }.run();
-
- // Start the triggerHandle, wait until some short time after the
- // job triggers once
- quartzTriggerHandle.resume();
- pause(REPEATING.getInterval());
- quartzTriggerHandle.pause();
-
-
- new FacesRequest("/search.xhtml", id)
- {
-
- @Override
- protected void beforeRequest()
- {
- setParameter("accountId", "1");
- }
-
- @Override
- protected void renderResponse() throws Exception
- {
-
- // Job should have run twice
- assert ((Boolean)getValue("#{accountHome.idDefined}"));
- Account account = (Account) getValue("#{selectedAccount}");
-
- assert account !=null;
- assert account.getId() == 1;
- assert account.getPayments().size() == 1;
- Payment payment = account.getPayments().get(0);
- assert new BigDecimal("110.00").equals(payment.getAmount());
- assert payment.getActive();
- assert REPEATING.equals(payment.getPaymentFrequency());
- assert payment.getLastPaid() != null;
- assert new BigDecimal("781.46").equals(account.getBalance());
- paymentId = payment.getId();
- }
-
- }.run();
-
- new FacesRequest("/search.xhtml", id)
- {
-
- @Override
- protected void beforeRequest()
- {
- setParameter("accountId", "1");
- setParameter("paymentId", paymentId.toString());
- }
-
- @Override
- protected void invokeApplication() throws Exception
- {
- // Resume the job, then cancel it
- quartzTriggerHandle.resume();
- invokeMethod("#{paymentHome.cancel}");
- }
-
- @Override
- protected void renderResponse() throws Exception
- {
-
- assert ((Boolean)getValue("#{accountHome.idDefined}"));
- Account account = (Account) getValue("#{selectedAccount}");
-
- assert account !=null;
- assert account.getId() == 1;
- assert account.getPayments().size() == 1;
- Payment payment = account.getPayments().get(0);
- assert new BigDecimal("110.00").equals(payment.getAmount());
- assert !payment.getActive();
- assert payment.getLastPaid() != null;
- assert new BigDecimal("781.46").equals(account.getBalance());
- }
-
- }.run();
-
- // Wait until some short time after another execution would
- // have occurred to check it really stops
- pause((long) (REPEATING.getInterval() * 1.05));
-
- new FacesRequest("/search.xhtml", id)
- {
-
- @Override
- protected void beforeRequest()
- {
- setParameter("accountId", "1");
- }
-
- @Override
- protected void renderResponse() throws Exception
- {
-
- assert ((Boolean)getValue("#{accountHome.idDefined}"));
- Account account = (Account) getValue("#{selectedAccount}");
-
- assert account !=null;
- assert account.getId() == 1;
- assert new BigDecimal("781.46").equals(account.getBalance());
- }
-
- }.run();
-
- }
- finally
- {
- if (quartzTriggerHandle != null)
- {
- quartzTriggerHandle.cancel();
- }
- }
- }
-
-
-
- @Test
- public void scheduleRepeatingWithStartAndEndTime() throws Exception
- {
-
- try
- {
- String id = new FacesRequest("/search.xhtml")
- {
- @Override
- protected void beforeRequest()
- {
- setParameter("accountId", "1");
- }
-
- @Override
- protected void updateModelValues() throws Exception
- {
- setValue("#{newPayment.payee}", "IRS");
- setValue("#{newPayment.amount}", new BigDecimal("110.00"));
- setValue("#{newPayment.paymentFrequency}", REPEATING );
- }
-
- @Override
- protected void invokeApplication() throws Exception
- {
- // schedule a the repeating job and immediately pause it
- // this allows you to carefully control how long the timer
- // runs for
- Payment payment = (Payment) getValue("#{newPayment}");
- payment.setPaymentDate(new java.sql.Timestamp( System.currentTimeMillis() + REPEATING.getInterval()));
- payment.setPaymentEndDate(new java.sql.Timestamp( (long) (System.currentTimeMillis() + (REPEATING.getInterval() * 2.5))));
- assert "persisted".equals(invokeMethod("#{paymentHome.saveAndSchedule}"));
- quartzTriggerHandle = payment.getQuartzTriggerHandle();
- quartzTriggerHandle.pause();
- }
-
- @Override
- protected void renderResponse() throws Exception
- {
- // Check the job exists
- assert ((Boolean)getValue("#{accountHome.idDefined}"));
- Account account = (Account) getValue("#{selectedAccount}");
- assert account !=null;
- assert account.getId() == 1;
- assert account.getPayments().size() == 1;
-
- Payment payment = (Payment) getValue("#{newPayment}");
- assert payment.getPayee().equals("IRS");
- assert payment.getAmount().equals(new BigDecimal("110.00"));
- assert payment.getAccount() != null;
- assert payment.getAccount().getId() == 1;
- assert payment.getActive();
- }
-
- }.run();
-
- // Start the triggerHandle, wait a lot shorter than the job takes
- // At this point the job should have executed zero times
- quartzTriggerHandle.resume();
- pause((long) (REPEATING.getInterval() * 0.1));
- quartzTriggerHandle.pause();
-
- new FacesRequest("/search.xhtml", id)
- {
-
- @Override
- protected void beforeRequest()
- {
- setParameter("accountId", "1");
- }
-
- @Override
- protected void renderResponse() throws Exception
- {
- assert ((Boolean)getValue("#{accountHome.idDefined}"));
- Account account = (Account) getValue("#{selectedAccount}");
- assert account !=null;
- assert account.getId() == 1;
- assert account.getPayments().size() == 1;
- Payment payment = account.getPayments().get(0);
- assert new BigDecimal("110.00").equals(payment.getAmount());
- assert payment.getActive();
- assert new BigDecimal("1001.46").equals(account.getBalance());
- }
-
- }.run();
-
- // Start the triggerHandle, wait until some short time after the
- // job triggers once
- quartzTriggerHandle.resume();
- pause(REPEATING.getInterval());
- quartzTriggerHandle.pause();
-
-
- new FacesRequest("/search.xhtml", id)
- {
-
- @Override
- protected void beforeRequest()
- {
- setParameter("accountId", "1");
- }
-
- @Override
- protected void renderResponse() throws Exception
- {
-
- // Job should have run twice
- assert ((Boolean)getValue("#{accountHome.idDefined}"));
- Account account = (Account) getValue("#{selectedAccount}");
-
- assert account !=null;
- assert account.getId() == 1;
- assert account.getPayments().size() == 1;
- Payment payment = account.getPayments().get(0);
- assert new BigDecimal("110.00").equals(payment.getAmount());
- assert payment.getActive();
- assert new BigDecimal("891.46").equals(account.getBalance());
- paymentId = payment.getId();
- }
-
- }.run();
-
- // Start the triggerHandle, wait until some short time after the
- // job triggers once
- quartzTriggerHandle.resume();
- pause(REPEATING.getInterval());
- // Thats the last job so need to pause
-
- new FacesRequest("/search.xhtml", id)
- {
-
- @Override
- protected void beforeRequest()
- {
- setParameter("accountId", "1");
- }
-
- @Override
- protected void renderResponse() throws Exception
- {
-
- // Job should have run twice
- assert ((Boolean)getValue("#{accountHome.idDefined}"));
- Account account = (Account) getValue("#{selectedAccount}");
-
- assert account !=null;
- assert account.getId() == 1;
- assert account.getPayments().size() == 1;
- Payment payment = account.getPayments().get(0);
- assert new BigDecimal("110.00").equals(payment.getAmount());
- assert payment.getActive();
- assert new BigDecimal("781.46").equals(account.getBalance());
- paymentId = payment.getId();
- }
-
- }.run();
-
- // Start the triggerHandle, wait until some short time after the
- // job would trigger again - we should be way beyond the expiry now
- pause(REPEATING.getInterval());
-
- new FacesRequest("/search.xhtml", id)
- {
-
- @Override
- protected void beforeRequest()
- {
- setParameter("accountId", "1");
- }
-
- @Override
- protected void renderResponse() throws Exception
- {
-
- assert ((Boolean)getValue("#{accountHome.idDefined}"));
- Account account = (Account) getValue("#{selectedAccount}");
-
- assert account !=null;
- assert account.getId() == 1;
- assert account.getPayments().size() == 1;
- Payment payment = account.getPayments().get(0);
- assert new BigDecimal("110.00").equals(payment.getAmount());
- assert payment.getActive();
- assert payment.getLastPaid() != null;
- assert new BigDecimal("781.46").equals(account.getBalance());
- }
-
- }.run();
-
- }
- finally
- {
- if (quartzTriggerHandle != null)
- {
- quartzTriggerHandle.cancel();
- }
- }
- }
-
- private void pause(long ms) {
- try {
- Thread.sleep(ms);
- } catch (InterruptedException e) {
-
- }
- }
-
-
-
-}
Deleted: branches/enterprise/WFK-2_1/examples/quartz/quartz-tests/src/test/java/org/jboss/seam/example/quartz/test/TestPaymentController.java
===================================================================
--- branches/enterprise/WFK-2_1/examples/quartz/quartz-tests/src/test/java/org/jboss/seam/example/quartz/test/TestPaymentController.java 2013-06-04 07:13:54 UTC (rev 15540)
+++ branches/enterprise/WFK-2_1/examples/quartz/quartz-tests/src/test/java/org/jboss/seam/example/quartz/test/TestPaymentController.java 2013-06-04 09:25:36 UTC (rev 15541)
@@ -1,84 +0,0 @@
-package org.jboss.seam.example.quartz.test;
-
-import static org.jboss.seam.annotations.Install.MOCK;
-
-import java.sql.Timestamp;
-
-import org.jboss.seam.annotations.In;
-import org.jboss.seam.annotations.Install;
-import org.jboss.seam.annotations.Logger;
-import org.jboss.seam.annotations.Name;
-import org.jboss.seam.async.QuartzTriggerHandle;
-import org.jboss.seam.async.Schedule;
-import org.jboss.seam.async.TimerSchedule;
-import org.jboss.seam.core.Events;
-import org.jboss.seam.example.quartz.Payment;
-import org.jboss.seam.example.quartz.PaymentHome;
-import org.jboss.seam.log.Log;
-
-/**
- * @author Pete Muir
- *
- */
-@Name("paymentHome")
-@Install(precedence=MOCK)
-public class TestPaymentController extends PaymentHome
-{
-
- @In TestPaymentProcessor processor;
-
- @Logger Log log;
-
- public String scheduleAndSaveAsynchronously()
- {
- String result = persist();
-
- Payment payment = getInstance();
-
- log.info("scheduling instance #0", payment);
- QuartzTriggerHandle handle = processor.schedulePayment(payment.getPaymentDate(),
- payment.getPaymentFrequency().getInterval(),
- payment.getPaymentEndDate(),
- payment);
-
- payment.setQuartzTriggerHandle( handle );
-
- return result;
- }
-
- public void scheduleAndSaveUsingAsynchronousEvent()
- {
- persist();
- Events.instance().raiseAsynchronousEvent("org.jboss.seam.example.quartz.test.scheduleAndSave", getInstance());
- }
-
- public void scheduleAndSaveUsingTimedEvent()
- {
- persist();
- // A simple once-only which exprires in 1000ms
- Schedule schedule = new TimerSchedule( new Timestamp( System.currentTimeMillis() + 1000l ) );
- Events.instance().raiseTimedEvent("org.jboss.seam.example.quartz.test.scheduleAndSave", schedule, getInstance());
- }
-
- public void scheduleAndSaveWithTransactionEvents()
- {
- TransactionStatus.clear();
- Events.instance().raiseTransactionSuccessEvent("org.jboss.seam.example.quartz.test.transactionSuccess", getInstance());
- Events.instance().raiseTransactionCompletionEvent("org.jboss.seam.example.quartz.test.transactionCompletion", getInstance());
- try
- {
- super.saveAndSchedule();
- }
- catch (Exception e)
- {
- e.printStackTrace();
- }
- }
-
- @Override
- public Class<Payment> getEntityClass()
- {
- return Payment.class;
- }
-
-}
Deleted: branches/enterprise/WFK-2_1/examples/quartz/quartz-tests/src/test/java/org/jboss/seam/example/quartz/test/TestPaymentProcessor.java
===================================================================
--- branches/enterprise/WFK-2_1/examples/quartz/quartz-tests/src/test/java/org/jboss/seam/example/quartz/test/TestPaymentProcessor.java 2013-06-04 07:13:54 UTC (rev 15540)
+++ branches/enterprise/WFK-2_1/examples/quartz/quartz-tests/src/test/java/org/jboss/seam/example/quartz/test/TestPaymentProcessor.java 2013-06-04 09:25:36 UTC (rev 15541)
@@ -1,89 +0,0 @@
-package org.jboss.seam.example.quartz.test;
-
-import static org.jboss.seam.annotations.Install.MOCK;
-
-import java.math.BigDecimal;
-import java.util.Date;
-
-import javax.persistence.EntityManager;
-
-import org.jboss.seam.annotations.AutoCreate;
-import org.jboss.seam.annotations.In;
-import org.jboss.seam.annotations.Install;
-import org.jboss.seam.annotations.Logger;
-import org.jboss.seam.annotations.Name;
-import org.jboss.seam.annotations.Observer;
-import org.jboss.seam.annotations.Transactional;
-import org.jboss.seam.annotations.async.Asynchronous;
-import org.jboss.seam.async.QuartzTriggerHandle;
-import org.jboss.seam.example.quartz.Payment;
-import org.jboss.seam.example.quartz.PaymentProcessor;
-import org.jboss.seam.log.Log;
-
-/**
- * @author Pete Muir
- *
- */
-@Name("processor")
-@Install(precedence=MOCK)
-@AutoCreate
-public class TestPaymentProcessor extends PaymentProcessor
-{
-
- @In
- EntityManager entityManager;
-
- @Logger Log log;
-
- @Asynchronous
- @Transactional
- public QuartzTriggerHandle schedulePaymentAsynchronously(Payment payment)
- {
- payment = entityManager.merge(payment);
-
- log.info("[#0] Processing cron payment #1", System.currentTimeMillis(), payment.getId());
-
- if (payment.getActive()) {
- BigDecimal balance = payment.getAccount().adjustBalance(payment.getAmount().negate());
- log.info(":: balance is now #0", balance);
- payment.setLastPaid(new Date());
-
- }
-
- return null;
- }
-
- @Observer("org.jboss.seam.example.quartz.test.scheduleAndSave")
- @Transactional
- public QuartzTriggerHandle schedulePayment(Payment payment)
- {
- payment = entityManager.merge(payment);
-
- log.error("[#0] Processing cron payment #1", System.currentTimeMillis(), payment.getId());
- if (payment.getActive()) {
- BigDecimal balance = payment.getAccount().adjustBalance(payment.getAmount().negate());
- log.error(":: balance is now #0", balance);
- payment.setLastPaid(new Date());
-
- }
-
- return null;
- }
-
- @Observer("org.jboss.seam.example.quartz.test.transactionSuccess")
- @Transactional
- public void observeTransactionSuccess(Payment payment)
- {
- TransactionStatus.instance().setTransactionSucceded(true);
- TransactionStatus.instance().setId(payment.getId());
- }
-
- @Observer("org.jboss.seam.example.quartz.test.transactionCompletion")
- @Transactional
- public void observeTransactionCompletion(Payment payment)
- {
- TransactionStatus.instance().setTransactionCompleted(true);
- TransactionStatus.instance().setId(payment.getId());
- }
-
-}
Deleted: branches/enterprise/WFK-2_1/examples/quartz/quartz-tests/src/test/java/org/jboss/seam/example/quartz/test/TransactionStatus.java
===================================================================
--- branches/enterprise/WFK-2_1/examples/quartz/quartz-tests/src/test/java/org/jboss/seam/example/quartz/test/TransactionStatus.java 2013-06-04 07:13:54 UTC (rev 15540)
+++ branches/enterprise/WFK-2_1/examples/quartz/quartz-tests/src/test/java/org/jboss/seam/example/quartz/test/TransactionStatus.java 2013-06-04 09:25:36 UTC (rev 15541)
@@ -1,75 +0,0 @@
-package org.jboss.seam.example.quartz.test;
-
-import org.jboss.seam.Component;
-import org.jboss.seam.ScopeType;
-import org.jboss.seam.annotations.AutoCreate;
-import org.jboss.seam.annotations.Name;
-import org.jboss.seam.annotations.Scope;
-import org.jboss.seam.contexts.Contexts;
-
-/**
- * @author Pete Muir
- *
- */
-@Name("transactionStatus")
-(a)Scope(ScopeType.APPLICATION)
-@AutoCreate
-public class TransactionStatus
-{
- private Object id;
- private boolean transactionSucceded;
- private boolean transactionCompleted;
- /**
- * @return the transactionSuccess
- */
- public boolean getTransactionSucceded()
- {
- return this.transactionSucceded;
- }
- /**
- * @param transactionSuccess the transactionSuccess to set
- */
- public void setTransactionSucceded(boolean transactionSuccess)
- {
- this.transactionSucceded = transactionSuccess;
- }
- /**
- * @return the transactionCompleted
- */
- public boolean getTransactionCompleted()
- {
- return this.transactionCompleted;
- }
- /**
- * @param transactionCompleted the transactionCompleted to set
- */
- public void setTransactionCompleted(boolean transactionCompleted)
- {
- this.transactionCompleted = transactionCompleted;
- }
-
- public static void clear()
- {
- Contexts.getApplicationContext().remove("transactionStatus");
- }
-
- public static TransactionStatus instance()
- {
- return (TransactionStatus) Component.getInstance("transactionStatus");
- }
- /**
- * @return the id
- */
- public Object getId()
- {
- return this.id;
- }
- /**
- * @param id the id to set
- */
- public void setId(Object id)
- {
- this.id = id;
- }
-
-}
Deleted: branches/enterprise/WFK-2_1/examples/quartz/quartz-tests/src/test/java/org/jboss/seam/example/quartz/test/selenium/QuartzPaymentTest.java
===================================================================
--- branches/enterprise/WFK-2_1/examples/quartz/quartz-tests/src/test/java/org/jboss/seam/example/quartz/test/selenium/QuartzPaymentTest.java 2013-06-04 07:13:54 UTC (rev 15540)
+++ branches/enterprise/WFK-2_1/examples/quartz/quartz-tests/src/test/java/org/jboss/seam/example/quartz/test/selenium/QuartzPaymentTest.java 2013-06-04 09:25:36 UTC (rev 15541)
@@ -1,93 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2008, Red Hat Middleware LLC, and individual contributors
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.jboss.seam.example.quartz.test.selenium;
-
-import java.math.BigDecimal;
-import java.text.MessageFormat;
-import java.text.ParseException;
-
-import static org.testng.AssertJUnit.*;
-
-import org.jboss.seam.example.common.test.seampay.selenium.PaymentTest;
-import org.testng.annotations.Test;
-
-/**
- *
- * @author jharting
- *
- */
-public class QuartzPaymentTest extends PaymentTest
-{
-
- /**
- * Submits new payment using CRON and verifies that the balance is subtracted
- * correctly
- *
- * @throws ParseException
- * @throws InterruptedException
- */
- @Test
- public void testCRON() throws ParseException, InterruptedException
- {
- int account = 3;
- BigDecimal amount = new BigDecimal(10);
- String to = "foo";
- String accountLinkLocator = MessageFormat.format(getProperty("ACCOUNT_TABLE_LINK"), account);
- String accountBalanceLocator = MessageFormat.format(getProperty("ACCOUNT_TABLE_BALANCE"), account);
- // send every 20 seconds
- String cronExpression = "0/20 * * * * ?";
-
- browser.click(accountLinkLocator);
- browser.waitForPageToLoad(TIMEOUT);
- // submit new cron job
- browser.type(getProperty("PAYMENT_TO_FIELD"), to);
- browser.type(getProperty("PAYMENT_AMOUNT_FIELD"), amount.toString());
- browser.type(getProperty("PAYMENT_CRON_FIELD"), cronExpression);
- browser.click(getProperty("PAYMENT_CRON_SUBMIT"));
- browser.waitForPageToLoad(TIMEOUT);
- assertTrue("Scheduled payment not confirmed.", browser.isTextPresent(MessageFormat.format(getProperty("PAYMENT_CONFIRMATION_MESSAGE"), to)));
- assertEquals("Invalid count of payments.", 1, browser.getXpathCount(getProperty("PAYMENTS_COUNT")));
- // wait
- Thread.sleep(5000);
- // get balance
- browser.click(accountLinkLocator);
- browser.waitForPageToLoad(TIMEOUT);
- BigDecimal firstBalance = BigDecimal.valueOf(parseBalance(browser.getText(accountBalanceLocator)));
- // wait 20 seconds
- Thread.sleep(20000);
- // get balance after 20 seconds
- browser.click(accountLinkLocator);
- browser.waitForPageToLoad(TIMEOUT);
- BigDecimal secondBalance = BigDecimal.valueOf(parseBalance(browser.getText(accountBalanceLocator)));
- // wait 20 seconds
- Thread.sleep(20000);
- // get balance after 40 seconds
- browser.click(accountLinkLocator);
- browser.waitForPageToLoad(TIMEOUT);
- BigDecimal thirdBalance = BigDecimal.valueOf(parseBalance(browser.getText(accountBalanceLocator)));
-
- BigDecimal expectedSecondBalance = firstBalance.subtract(amount);
- BigDecimal expectedThirdBalance = firstBalance.subtract(amount).subtract(amount);
- assertEquals("Incorrect balance after 20 seconds.", expectedSecondBalance, secondBalance);
- assertEquals("Incorrect balance after 40 seconds.", expectedThirdBalance, thirdBalance);
- }
-}
Deleted: branches/enterprise/WFK-2_1/examples/quartz/quartz-tests/src/test/resources/BaseData.xml
===================================================================
--- branches/enterprise/WFK-2_1/examples/quartz/quartz-tests/src/test/resources/BaseData.xml 2013-06-04 07:13:54 UTC (rev 15540)
+++ branches/enterprise/WFK-2_1/examples/quartz/quartz-tests/src/test/resources/BaseData.xml 2013-06-04 09:25:36 UTC (rev 15541)
@@ -1,38 +0,0 @@
-<?xml version="1.0"?>
-
-<dataset>
-
- <ACCOUNT
- id="1"
- accountNumber="23001"
- balance="1001.46"
- />
-
- <ACCOUNT
- id="2"
- accountNumber="23002"
- balance="1002.46"
- />
-
- <ACCOUNT
- id="3"
- accountNumber="23003"
- balance="1003.46"
- />
-
- <ACCOUNT
- id="4"
- accountNumber="23004"
- balance="1004.46"
- />
-
- <ACCOUNT
- id="5"
- accountNumber="23005"
- balance="1005.46"
- />
-
- <!-- This causes the payment table to be cleaned every time -->
- <PAYMENT />
-
-</dataset>
\ No newline at end of file
Deleted: branches/enterprise/WFK-2_1/examples/quartz/quartz-tests/src/test/resources/WEB-INF/components.xml
===================================================================
--- branches/enterprise/WFK-2_1/examples/quartz/quartz-tests/src/test/resources/WEB-INF/components.xml 2013-06-04 07:13:54 UTC (rev 15540)
+++ branches/enterprise/WFK-2_1/examples/quartz/quartz-tests/src/test/resources/WEB-INF/components.xml 2013-06-04 09:25:36 UTC (rev 15541)
@@ -1,50 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<components xmlns="http://jboss.org/schema/seam/components"
- xmlns:pay="http://jboss.org/schema/seam/examples/quartz"
- xmlns:core="http://jboss.org/schema/seam/core"
- xmlns:async="http://jboss.org/schema/seam/async"
- xmlns:framework="http://jboss.org/schema/seam/framework"
- xmlns:persistence="http://jboss.org/schema/seam/persistence"
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xsi:schemaLocation=
- "http://jboss.org/schema/seam/core http://jboss.org/schema/seam/core-2.3.xsd
- http://jboss.org/schema/seam/async http://jboss.org/schema/seam/async-2.3.xsd
- http://jboss.org/schema/seam/framework http://jboss.org/schema/seam/framework-2.3.xsd
- http://jboss.org/schema/seam/persistence http://jboss.org/schema/seam/persistence-2.3.xsd
- http://jboss.org/schema/seam/components http://jboss.org/schema/seam/components-2.3.xsd">
-
- <pay:payment-home name="paymentHome"
- new-instance="#{newPayment}"
- created-message="Created a new payment to #{newPayment.payee}" />
-
- <pay:payment name="newPayment"
- payee="Somebody"
- account="#{selectedAccount}"
- payment-date="#{currentDatetime}"
- created-date="#{currentDatetime}" />
-
- <factory name="selectedAccount"
- value="#{accountHome.instance}"/>
-
- <framework:entity-home name="accountHome"
- entity-class="org.jboss.seam.example.quartz.Account"
- entity-manager="#{entityManager}" />
-
- <framework:entity-query name="accounts"
- ejbql="from Account"
- order="accountNumber"
- max-results="20"
- entity-manager="#{entityManager}" />
-
- <persistence:managed-persistence-context name="entityManager"
- auto-create="true"
- persistence-unit-jndi-name="java:/seampayEntityManagerFactory" />
-
- <!-- Install the QuartzDispatcher -->
- <async:quartz-dispatcher/>
-
- <core:init debug="true" jndi-pattern="java:app/quartz-ejb/#{ejbName}" />
-
- <component class="org.jboss.seam.transaction.EjbSynchronizations" jndi-name="java:app/jboss-seam/EjbSynchronizations"/>
-
-</components>
Deleted: branches/enterprise/WFK-2_1/examples/quartz/quartz-tests/src/test/resources/quartz.properties
===================================================================
--- branches/enterprise/WFK-2_1/examples/quartz/quartz-tests/src/test/resources/quartz.properties 2013-06-04 07:13:54 UTC (rev 15540)
+++ branches/enterprise/WFK-2_1/examples/quartz/quartz-tests/src/test/resources/quartz.properties 2013-06-04 09:25:36 UTC (rev 15541)
@@ -1,34 +0,0 @@
- #
- # JBoss, Home of Professional Open Source
- # Copyright 2008, Red Hat Middleware LLC, and individual contributors
- # by the @authors tag. See the copyright.txt in the distribution for a
- # full listing of individual contributors.
- #
- # This is free software; you can redistribute it and/or modify it
- # under the terms of the GNU Lesser General Public License as
- # published by the Free Software Foundation; either version 2.1 of
- # the License, or (at your option) any later version.
- #
- # This software is distributed in the hope that it will be useful,
- # but WITHOUT ANY WARRANTY; without even the implied warranty of
- # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- # Lesser General Public License for more details.
- #
- # You should have received a copy of the GNU Lesser General Public
- # License along with this software; if not, write to the Free
- # Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- # 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- #
-MAIN_PAGE = /search.seam
-MAIN_PAGE_TITLE = Seam Pay
-ACCOUNT_TABLE_LINK = id=accountTable:{0}:link
-ACCOUNT_TABLE_BALANCE = id=accountTable:{0}:balance
-PAYMENT_TO_FIELD = id=accountView:paymentForm:payee
-PAYMENT_AMOUNT_FIELD = id=accountView:paymentForm:amount
-PAYMENT_CRON_FIELD = id=accountView:paymentForm:paymentCron
-PAYMENT_CRON_SUBMIT = id=accountView:paymentForm:cronSubmit
-PAYMENT_ONLY_ONCE_RADIO = id=accountView:paymentForm:radioList:0
-PAYMENT_EVERY_MINUTE_RADIO = id=accountView:paymentForm:radioList:1
-PAYMENT_SUBMIT = id=accountView:paymentForm:submit
-PAYMENT_CONFIRMATION_MESSAGE =Created a new payment to {0}
-PAYMENTS_COUNT =//table[@id\='payments']/tbody/tr
\ No newline at end of file
Deleted: branches/enterprise/WFK-2_1/examples/quartz/quartz-tests/src/test/resources/seam.quartz.properties
===================================================================
--- branches/enterprise/WFK-2_1/examples/quartz/quartz-tests/src/test/resources/seam.quartz.properties 2013-06-04 07:13:54 UTC (rev 15540)
+++ branches/enterprise/WFK-2_1/examples/quartz/quartz-tests/src/test/resources/seam.quartz.properties 2013-06-04 09:25:36 UTC (rev 15541)
@@ -1,9 +0,0 @@
-org.quartz.scheduler.instanceName = Sched1
-org.quartz.scheduler.instanceId = 1
-org.quartz.scheduler.rmi.export = false
-org.quartz.scheduler.rmi.proxy = false
-
-org.quartz.threadPool.class = org.quartz.simpl.SimpleThreadPool
-org.quartz.threadPool.threadCount = 3
-
-org.quartz.jobStore.class = org.quartz.simpl.RAMJobStore
Deleted: branches/enterprise/WFK-2_1/examples/quartz/quartz-tests/src/test/resources-ftest/testng.xml
===================================================================
--- branches/enterprise/WFK-2_1/examples/quartz/quartz-tests/src/test/resources-ftest/testng.xml 2013-06-04 07:13:54 UTC (rev 15540)
+++ branches/enterprise/WFK-2_1/examples/quartz/quartz-tests/src/test/resources-ftest/testng.xml 2013-06-04 09:25:36 UTC (rev 15541)
@@ -1,25 +0,0 @@
- <!--
- JBoss, Home of Professional Open Source Copyright 2008, Red Hat
- Middleware LLC, and individual contributors by the @authors tag. See
- the copyright.txt in the distribution for a full listing of individual
- contributors. This is free software; you can redistribute it and/or
- modify it under the terms of the GNU Lesser General Public License as
- published by the Free Software Foundation; either version 2.1 of the
- License, or (at your option) any later version. This software is
- distributed in the hope that it will be useful, but WITHOUT ANY
- WARRANTY; without even the implied warranty of MERCHANTABILITY or
- FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
- License for more details. You should have received a copy of the GNU
- Lesser General Public License along with this software; if not, write
- to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
- Boston, MA 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- -->
-<!DOCTYPE suite SYSTEM "http://beust.com/testng/testng-1.0.dtd" >
-<suite name="Quartz example" verbose="2" parallel="false">
- <test name="quartz_tests">
- <parameter name="PROPERTY_FILE" value="/quartz.properties" />
- <classes>
- <class name="org.jboss.seam.example.quartz.test.selenium.QuartzPaymentTest" />
- </classes>
- </test>
-</suite>
Deleted: branches/enterprise/WFK-2_1/examples/quartz/quartz-tests/src/test/resources-integration/arquillian.xml
===================================================================
--- branches/enterprise/WFK-2_1/examples/quartz/quartz-tests/src/test/resources-integration/arquillian.xml 2013-06-04 07:13:54 UTC (rev 15540)
+++ branches/enterprise/WFK-2_1/examples/quartz/quartz-tests/src/test/resources-integration/arquillian.xml 2013-06-04 09:25:36 UTC (rev 15541)
@@ -1,16 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<arquillian xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xmlns="http://jboss.org/schema/arquillian"
- xsi:schemaLocation="http://jboss.org/schema/arquillian http://jboss.org/schema/arquillian/arquillian_1_0.xsd">
-
- <engine>
- <property name="deploymentExportPath">target/</property>
- </engine>
-
- <container qualifier="jboss" default="true">
- <configuration>
- <property name="javaVmArguments">-Xmx1024m -XX:MaxPermSize=512m ${jacoco.agent}</property>
- </configuration>
- </container>
-
-</arquillian>
Deleted: branches/enterprise/WFK-2_1/examples/quartz/quartz-tests/src/test/resources-integration/web.xml
===================================================================
--- branches/enterprise/WFK-2_1/examples/quartz/quartz-tests/src/test/resources-integration/web.xml 2013-06-04 07:13:54 UTC (rev 15540)
+++ branches/enterprise/WFK-2_1/examples/quartz/quartz-tests/src/test/resources-integration/web.xml 2013-06-04 09:25:36 UTC (rev 15541)
@@ -1,12 +0,0 @@
-<?xml version="1.0" ?>
-
-<web-app version="3.0"
- xmlns="http://java.sun.com/xml/ns/javaee"
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd">
-
- <listener>
- <listener-class>org.jboss.seam.mock.MockSeamListener</listener-class>
- </listener>
-
-</web-app>
Modified: branches/enterprise/WFK-2_1/examples/quartz/quartz-web/pom.xml
===================================================================
--- branches/enterprise/WFK-2_1/examples/quartz/quartz-web/pom.xml 2013-06-04 07:13:54 UTC (rev 15540)
+++ branches/enterprise/WFK-2_1/examples/quartz/quartz-web/pom.xml 2013-06-04 09:25:36 UTC (rev 15541)
@@ -72,6 +72,7 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-war-plugin</artifactId>
+ <version>${version.war.plugin}</version>
<configuration>
<webResources>
<resource>
Modified: branches/enterprise/WFK-2_1/jboss-seam/src/main/java/org/jboss/seam/mock/ResourceRequestEnvironment.java
===================================================================
--- branches/enterprise/WFK-2_1/jboss-seam/src/main/java/org/jboss/seam/mock/ResourceRequestEnvironment.java 2013-06-04 07:13:54 UTC (rev 15540)
+++ branches/enterprise/WFK-2_1/jboss-seam/src/main/java/org/jboss/seam/mock/ResourceRequestEnvironment.java 2013-06-04 09:25:36 UTC (rev 15541)
@@ -206,7 +206,7 @@
protected EnhancedMockHttpServletRequest createRequest()
{
- return new EnhancedMockHttpServletRequest(environment.seamTest.servletContex);
+ return new EnhancedMockHttpServletRequest(environment.seamTest.servletContext);
}
protected EnhancedMockHttpServletResponse createResponse()
11 years, 5 months
Seam SVN: r15540 - in branches/enterprise/WFK-2_1/examples/openid: openid-ear and 4 other directories.
by seam-commits@lists.jboss.org
Author: tremes
Date: 2013-06-04 03:13:54 -0400 (Tue, 04 Jun 2013)
New Revision: 15540
Removed:
branches/enterprise/WFK-2_1/examples/openid/openid-tests/pom.xml
branches/enterprise/WFK-2_1/examples/openid/openid-tests/src/test/java/org/jboss/seam/example/openid/test/selenium/SeleniumOpenIdTest.java
branches/enterprise/WFK-2_1/examples/openid/openid-tests/src/test/resources-ftest/testng.xml
Modified:
branches/enterprise/WFK-2_1/examples/openid/openid-ear/pom.xml
branches/enterprise/WFK-2_1/examples/openid/openid-web/pom.xml
branches/enterprise/WFK-2_1/examples/openid/pom.xml
Log:
openid example migrated
Modified: branches/enterprise/WFK-2_1/examples/openid/openid-ear/pom.xml
===================================================================
--- branches/enterprise/WFK-2_1/examples/openid/openid-ear/pom.xml 2013-06-04 07:01:40 UTC (rev 15539)
+++ branches/enterprise/WFK-2_1/examples/openid/openid-ear/pom.xml 2013-06-04 07:13:54 UTC (rev 15540)
@@ -66,6 +66,7 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-ear-plugin</artifactId>
+ <version>${version.ear.plugin}</version>
<configuration>
<version>6</version>
<defaultLibBundleDir>lib</defaultLibBundleDir>
Deleted: branches/enterprise/WFK-2_1/examples/openid/openid-tests/pom.xml
===================================================================
--- branches/enterprise/WFK-2_1/examples/openid/openid-tests/pom.xml 2013-06-04 07:01:40 UTC (rev 15539)
+++ branches/enterprise/WFK-2_1/examples/openid/openid-tests/pom.xml 2013-06-04 07:13:54 UTC (rev 15540)
@@ -1,94 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
- <modelVersion>4.0.0</modelVersion>
- <parent>
- <artifactId>openid</artifactId>
- <groupId>org.jboss.seam.examples</groupId>
- <version>2.3.1.Final-redhat-2</version>
- <relativePath>../pom.xml</relativePath>
- </parent>
-
- <groupId>org.jboss.seam.examples.openid</groupId>
- <artifactId>openid-tests</artifactId>
- <name>Openid Integration Tests Module (EE6)</name>
-
- <dependencies>
- <dependency>
- <groupId>org.testng</groupId>
- <artifactId>testng</artifactId>
-
- </dependency>
- <dependency>
- <groupId>org.jboss.seam.examples.openid</groupId>
- <artifactId>openid-ejb</artifactId>
- <type>ejb</type>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.jboss.seam</groupId>
- <artifactId>jboss-seam</artifactId>
- <type>ejb</type>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.slf4j</groupId>
- <artifactId>slf4j-log4j12</artifactId>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.jboss.spec.javax.faces</groupId>
- <artifactId>jboss-jsf-api_2.1_spec</artifactId>
- </dependency>
- <dependency>
- <groupId>org.seleniumhq.selenium</groupId>
- <artifactId>selenium-server</artifactId>
- </dependency>
- <dependency>
- <groupId>org.seleniumhq.selenium</groupId>
- <artifactId>selenium-java</artifactId>
- </dependency>
- <dependency>
- <groupId>org.jboss.seam</groupId>
- <artifactId>functional-tests</artifactId>
- <scope>test</scope>
- </dependency>
- </dependencies>
-
- <build>
- <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</id>
- <properties>
- <example.context.path>seam-openid</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>
Deleted: branches/enterprise/WFK-2_1/examples/openid/openid-tests/src/test/java/org/jboss/seam/example/openid/test/selenium/SeleniumOpenIdTest.java
===================================================================
--- branches/enterprise/WFK-2_1/examples/openid/openid-tests/src/test/java/org/jboss/seam/example/openid/test/selenium/SeleniumOpenIdTest.java 2013-06-04 07:01:40 UTC (rev 15539)
+++ branches/enterprise/WFK-2_1/examples/openid/openid-tests/src/test/java/org/jboss/seam/example/openid/test/selenium/SeleniumOpenIdTest.java 2013-06-04 07:13:54 UTC (rev 15540)
@@ -1,132 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2008, Red Hat Middleware LLC, and individual contributors
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.jboss.seam.example.openid.test.selenium;
-
-import static org.testng.AssertJUnit.assertTrue;
-import static org.testng.AssertJUnit.assertEquals;
-import org.jboss.seam.example.common.test.selenium.SeamSeleniumTest;
-import org.testng.annotations.BeforeClass;
-import org.testng.annotations.AfterClass;
-import org.testng.annotations.BeforeMethod;
-import org.testng.annotations.Parameters;
-import org.testng.annotations.Test;
-
-/**
- * This class tests basic functionality of Seam OpenId example.
- *
- * For executing this test a selenium.browser property is automaticly changed:
- *
- * selenium.browser=*chrome (to test Mozilla Firefox)
- * selenium.browser=*iehta (to test Internet Explorer)
- *
- * This parameter tells browser to increase its privileges to be able to
- * work across multiple domains.
- *
- *
- * @author Martin Gencur
- *
- */
-public class SeleniumOpenIdTest extends SeamSeleniumTest
-{
- public static final String HOME_PAGE_TITLE = "OpenID Wall";
- public static final String LOGIN_LINK = "xpath=//input[@value='OpenID Login']";
- public static final String LOGIN_INPUT = "xpath=//input[@class='openid_input']";
- public static final String PASSWORD_INPUT = "id=password";
- public static final String SIGNIN_BUTTON = "id=signin_button";
- public static final String CONTINUE_BUTTON = "xpath=//button[contains(text(),'Continue')]";
- public static final String LOGOUT_BUTTON = "xpath=//input[@value='Logout']";
-
- public static String OPENID_ACCOUNT;
- public static String OPENID_PASSWORD;
-
- public static String ORIGINAL_BROWSER;
-
- @BeforeClass
- @Parameters( { "openid.account", "openid.password" })
- public void setCredentials(String account, String password) {
- OPENID_ACCOUNT = account;
- OPENID_PASSWORD = password;
- }
-
- @AfterClass
- public void returnBrowser(){
- super.setBrowser(ORIGINAL_BROWSER);
- }
-
- @BeforeMethod
- @Override
- public void setUp()
- {
- /*setting browser with enhanced security privileges for selenium*/
- setProperBrowser(SeamSeleniumTest.getBrowser());
- super.setUp();
- browser.open(CONTEXT_PATH);
- }
-
- /**
- * Place holder - just verifies that example deploys
- */
- @Test
- public void homePageLoadTest()
- {
- assertEquals("Unexpected page title.", HOME_PAGE_TITLE, browser.getTitle());
- }
-
- /**
- * Method verifies login and logout operations.
- */
- @Test(dependsOnMethods={"homePageLoadTest"})
- public void openIdLoginLogoutTest(){
- deleteCookies();
- browser.type(LOGIN_INPUT, OPENID_ACCOUNT);
- browser.clickAndWait(LOGIN_LINK);
- browser.type(PASSWORD_INPUT, OPENID_PASSWORD);
- browser.clickAndWait(SIGNIN_BUTTON);
- if (browser.isElementPresent(CONTINUE_BUTTON)) {
- browser.clickAndWait(CONTINUE_BUTTON);
- }
- assertTrue("Page should contain information about successfull login", browser.isTextPresent("OpenID login successful..."));
- browser.clickAndWait(LOGOUT_BUTTON);
- assertTrue("Page should contain input field which means that user is not logged in anymore", browser.isElementPresent(LOGIN_INPUT));
- }
-
- private void deleteCookies(){
- browser.deleteCookie("session_id","");
- browser.deleteCookie("secure_session_id","");
- }
-
- /**
- * Method for setting proper browser for selenium so that it can work
- * across multiple domains.
- *
- * @param origBrowser Originally intended browser
- */
- private void setProperBrowser(String origBrowser){
- ORIGINAL_BROWSER = origBrowser;
- if (origBrowser.equals("*firefox") || origBrowser.equals("*firefoxproxy")) {
- super.setBrowser("*chrome");
- }
- if (origBrowser.equals("*iexplore") || origBrowser.equals("*iexploreproxy")) {
- super.setBrowser("*iehta");
- }
- }
-}
Deleted: branches/enterprise/WFK-2_1/examples/openid/openid-tests/src/test/resources-ftest/testng.xml
===================================================================
--- branches/enterprise/WFK-2_1/examples/openid/openid-tests/src/test/resources-ftest/testng.xml 2013-06-04 07:01:40 UTC (rev 15539)
+++ branches/enterprise/WFK-2_1/examples/openid/openid-tests/src/test/resources-ftest/testng.xml 2013-06-04 07:13:54 UTC (rev 15540)
@@ -1,26 +0,0 @@
-
- <!--
- JBoss, Home of Professional Open Source Copyright 2008, Red Hat
- Middleware LLC, and individual contributors by the @authors tag. See
- the copyright.txt in the distribution for a full listing of individual
- contributors. This is free software; you can redistribute it and/or
- modify it under the terms of the GNU Lesser General Public License as
- published by the Free Software Foundation; either version 2.1 of the
- License, or (at your option) any later version. This software is
- distributed in the hope that it will be useful, but WITHOUT ANY
- WARRANTY; without even the implied warranty of MERCHANTABILITY or
- FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
- License for more details. You should have received a copy of the GNU
- Lesser General Public License along with this software; if not, write
- to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
- Boston, MA 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- -->
-<!DOCTYPE suite SYSTEM "http://beust.com/testng/testng-1.0.dtd" >
-<suite name="OpenId example" verbose="2" parallel="false">
- <test name="openid_tests">
- <parameter name="PROPERTY_FILE" value="" />
- <classes>
- <class name="org.jboss.seam.example.openid.test.selenium.SeleniumOpenIdTest" />
- </classes>
- </test>
-</suite>
Modified: branches/enterprise/WFK-2_1/examples/openid/openid-web/pom.xml
===================================================================
--- branches/enterprise/WFK-2_1/examples/openid/openid-web/pom.xml 2013-06-04 07:01:40 UTC (rev 15539)
+++ branches/enterprise/WFK-2_1/examples/openid/openid-web/pom.xml 2013-06-04 07:13:54 UTC (rev 15540)
@@ -78,6 +78,7 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-war-plugin</artifactId>
+ <version>${version.war.plugin}</version>
<configuration>
<webResources>
<resource>
Modified: branches/enterprise/WFK-2_1/examples/openid/pom.xml
===================================================================
--- branches/enterprise/WFK-2_1/examples/openid/pom.xml 2013-06-04 07:01:40 UTC (rev 15539)
+++ branches/enterprise/WFK-2_1/examples/openid/pom.xml 2013-06-04 07:13:54 UTC (rev 15540)
@@ -1,14 +1,9 @@
<?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">
- <parent>
- <artifactId>examples</artifactId>
- <groupId>org.jboss.seam</groupId>
- <version>2.3.1.Final-redhat-2</version>
- </parent>
-
<modelVersion>4.0.0</modelVersion>
<groupId>org.jboss.seam.examples</groupId>
<artifactId>openid</artifactId>
+ <version>2.3.1.Final-redhat-2</version>
<packaging>pom</packaging>
<name>OpenID Example (EE6)</name>
@@ -16,9 +11,36 @@
<module>openid-ejb</module>
<module>openid-web</module>
<module>openid-ear</module>
- <module>openid-tests</module>
</modules>
+ <properties>
+ <example.name>openid</example.name>
+ <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
+ <maven.compiler.target>1.6</maven.compiler.target>
+ <maven.compiler.source>1.6</maven.compiler.source>
+
+ <!-- To use jacoco, set jacoco.agent system property to something like
+ -javaagent:/path/to/jacocoagent.jar=append=true,destfile=/path/to/output/jacoco.exec -->
+ <jacoco.agent />
+
+ <!-- To use custom Maven settings and profiles, uncomment and customize
+ the following properties. This is necessary for the ShrinkWrap resolver to
+ function properly. -->
+ <!--<maven.user.settings>/path/to/custom/settings.xml</maven.user.settings> -->
+ <!--<maven.profiles>custom,profile</maven.profiles> -->
+
+ <version.commons.logging>1.1.1</version.commons.logging>
+ <version.shrinkwrap.resolver>2.0.0-beta-4</version.shrinkwrap.resolver>
+
+ <!-- Plugin versions -->
+ <version.dependency.plugin>2.5.1</version.dependency.plugin>
+ <version.surefire.plugin>2.10</version.surefire.plugin>
+ <version.compiler.plugin>2.3.1</version.compiler.plugin>
+ <version.ear.plugin>2.6</version.ear.plugin>
+ <version.war.plugin>2.1.1</version.war.plugin>
+ <version.jboss.maven.plugin>7.4.Final</version.jboss.maven.plugin>
+ </properties>
+
<dependencyManagement>
<dependencies>
<dependency>
@@ -27,18 +49,86 @@
<version>${project.version}</version>
<type>ejb</type>
</dependency>
+
<dependency>
<groupId>org.jboss.seam.examples.openid</groupId>
<artifactId>openid-web</artifactId>
<version>${project.version}</version>
<type>war</type>
</dependency>
+
<dependency>
<groupId>org.jboss.seam.examples.openid</groupId>
<artifactId>openid-ear</artifactId>
<version>${project.version}</version>
</dependency>
+
+ <!-- BOMs -->
+ <dependency>
+ <groupId>org.jboss.shrinkwrap.resolver</groupId>
+ <artifactId>shrinkwrap-resolver-bom</artifactId>
+ <version>${version.shrinkwrap.resolver}</version>
+ <scope>import</scope>
+ <type>pom</type>
+ </dependency>
+
+ <dependency>
+ <groupId>org.jboss.seam</groupId>
+ <artifactId>bom</artifactId>
+ <version>${project.version}</version>
+ <type>pom</type>
+ <scope>import</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>commons-logging</groupId>
+ <artifactId>commons-logging</artifactId>
+ <version>${version.commons.logging}</version>
+ <scope>provided</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.jboss.seam</groupId>
+ <artifactId>jboss-seam</artifactId>
+ <version>${project.version}</version>
+ <exclusions>
+ <exclusion>
+ <groupId>org.testng</groupId>
+ <artifactId>testng</artifactId>
+ </exclusion>
+ </exclusions>
+ </dependency>
</dependencies>
</dependencyManagement>
+
+ <build>
+ <pluginManagement>
+ <plugins>
+ <!-- Manage plugin versions for build stability -->
+ <plugin>
+ <artifactId>maven-surefire-plugin</artifactId>
+ <version>${version.surefire.plugin}</version>
+ <configuration>
+ <systemPropertyVariables>
+ <org.apache.maven.user-settings>${maven.user.settings}</org.apache.maven.user-settings>
+ <maven.profiles>${maven.profiles}</maven.profiles>
+ </systemPropertyVariables>
+ </configuration>
+ </plugin>
+ <plugin>
+ <artifactId>maven-dependency-plugin</artifactId>
+ <version>${version.dependency.plugin}</version>
+ </plugin>
+ <plugin>
+ <artifactId>maven-compiler-plugin</artifactId>
+ <version>${version.compiler.plugin}</version>
+ <configuration>
+ <source>${maven.compiler.source}</source>
+ <target>${maven.compiler.target}</target>
+ </configuration>
+ </plugin>
+ </plugins>
+ </pluginManagement>
+ </build>
</project>
11 years, 5 months
Seam SVN: r15539 - in branches/enterprise/WFK-2_1/examples/messages: messages-ear and 17 other directories.
by seam-commits@lists.jboss.org
Author: tremes
Date: 2013-06-04 03:01:40 -0400 (Tue, 04 Jun 2013)
New Revision: 15539
Added:
branches/enterprise/WFK-2_1/examples/messages/messages-ejb/src/test/
branches/enterprise/WFK-2_1/examples/messages/messages-ejb/src/test/java/
branches/enterprise/WFK-2_1/examples/messages/messages-ejb/src/test/java/org/
branches/enterprise/WFK-2_1/examples/messages/messages-ejb/src/test/java/org/jboss/
branches/enterprise/WFK-2_1/examples/messages/messages-ejb/src/test/java/org/jboss/seam/
branches/enterprise/WFK-2_1/examples/messages/messages-ejb/src/test/java/org/jboss/seam/example/
branches/enterprise/WFK-2_1/examples/messages/messages-ejb/src/test/java/org/jboss/seam/example/messages/
branches/enterprise/WFK-2_1/examples/messages/messages-ejb/src/test/java/org/jboss/seam/example/messages/test/
branches/enterprise/WFK-2_1/examples/messages/messages-ejb/src/test/java/org/jboss/seam/example/messages/test/Deployments.java
branches/enterprise/WFK-2_1/examples/messages/messages-ejb/src/test/java/org/jboss/seam/example/messages/test/MessageListTest.java
branches/enterprise/WFK-2_1/examples/messages/messages-ejb/src/test/resources/
branches/enterprise/WFK-2_1/examples/messages/messages-ejb/src/test/resources/arquillian.xml
branches/enterprise/WFK-2_1/examples/messages/messages-ejb/src/test/resources/components.xml
branches/enterprise/WFK-2_1/examples/messages/messages-ejb/src/test/resources/ejb-jar.xml
branches/enterprise/WFK-2_1/examples/messages/messages-ejb/src/test/resources/import.sql
branches/enterprise/WFK-2_1/examples/messages/messages-ejb/src/test/resources/jboss-deployment-structure.xml
branches/enterprise/WFK-2_1/examples/messages/messages-ejb/src/test/resources/persistence.xml
branches/enterprise/WFK-2_1/examples/messages/messages-ejb/src/test/resources/seam.properties
branches/enterprise/WFK-2_1/examples/messages/messages-ejb/src/test/resources/web.xml
Removed:
branches/enterprise/WFK-2_1/examples/messages/messages-tests/pom.xml
branches/enterprise/WFK-2_1/examples/messages/messages-tests/src/test/java/org/jboss/seam/example/messages/test/MessageListTest.java
branches/enterprise/WFK-2_1/examples/messages/messages-tests/src/test/java/org/jboss/seam/example/messages/test/selenium/MessageTest.java
branches/enterprise/WFK-2_1/examples/messages/messages-tests/src/test/resources-ftest/testng.xml
branches/enterprise/WFK-2_1/examples/messages/messages-tests/src/test/resources-integration/arquillian.xml
branches/enterprise/WFK-2_1/examples/messages/messages-tests/src/test/resources-integration/web.xml
Modified:
branches/enterprise/WFK-2_1/examples/messages/messages-ear/pom.xml
branches/enterprise/WFK-2_1/examples/messages/messages-ejb/pom.xml
branches/enterprise/WFK-2_1/examples/messages/messages-web/pom.xml
branches/enterprise/WFK-2_1/examples/messages/pom.xml
Log:
Messages example migrated
Modified: branches/enterprise/WFK-2_1/examples/messages/messages-ear/pom.xml
===================================================================
--- branches/enterprise/WFK-2_1/examples/messages/messages-ear/pom.xml 2013-06-04 06:41:09 UTC (rev 15538)
+++ branches/enterprise/WFK-2_1/examples/messages/messages-ear/pom.xml 2013-06-04 07:01:40 UTC (rev 15539)
@@ -52,6 +52,7 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-ear-plugin</artifactId>
+ <version>${version.ear.plugin}</version>
<configuration>
<version>6</version>
<defaultLibBundleDir>lib</defaultLibBundleDir>
Modified: branches/enterprise/WFK-2_1/examples/messages/messages-ejb/pom.xml
===================================================================
--- branches/enterprise/WFK-2_1/examples/messages/messages-ejb/pom.xml 2013-06-04 06:41:09 UTC (rev 15538)
+++ branches/enterprise/WFK-2_1/examples/messages/messages-ejb/pom.xml 2013-06-04 07:01:40 UTC (rev 15539)
@@ -46,5 +46,116 @@
</exclusions>
<scope>provided</scope>
</dependency>
+
+ <!-- Test dependencies -->
+ <dependency>
+ <groupId>org.jboss.shrinkwrap.resolver</groupId>
+ <artifactId>shrinkwrap-resolver-depchain</artifactId>
+ <type>pom</type>
+ <scope>test</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <scope>test</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.jboss.arquillian.junit</groupId>
+ <artifactId>arquillian-junit-container</artifactId>
+ <scope>test</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.jboss.arquillian.protocol</groupId>
+ <artifactId>arquillian-protocol-servlet</artifactId>
+ <scope>test</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.jboss.spec.javax.faces</groupId>
+ <artifactId>jboss-jsf-api_2.1_spec</artifactId>
+ <scope>test</scope>
+ </dependency>
</dependencies>
+
+ <profiles>
+ <profile>
+ <id>integration-tests</id>
+ <activation>
+ <property>
+ <name>arquillian</name>
+ </property>
+ </activation>
+ <properties>
+ <jndiPattern>java:app/seam-messages/#{ejbName}</jndiPattern>
+ <distributable>false</distributable>
+ </properties>
+ <build>
+ <testResources>
+ <testResource>
+ <directory>src/test/resources</directory>
+ <filtering>true</filtering>
+ </testResource>
+ </testResources>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-surefire-plugin</artifactId>
+ <configuration>
+ <skip>false</skip>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+ </profile>
+
+ <profile>
+ <id>arq-jbossas-7-managed</id>
+ <activation>
+ <property>
+ <name>arquillian</name>
+ <value>jbossas-managed-7</value>
+ </property>
+ </activation>
+ <dependencies>
+ <dependency>
+ <groupId>org.jboss.as</groupId>
+ <artifactId>jboss-as-arquillian-container-managed</artifactId>
+ <scope>test</scope>
+ </dependency>
+ </dependencies>
+ </profile>
+
+ <profile>
+ <id>arq-jbossas-7-remote</id>
+ <activation>
+ <property>
+ <name>arquillian</name>
+ <value>jbossas-remote-7</value>
+ </property>
+ </activation>
+ <dependencies>
+ <dependency>
+ <groupId>org.jboss.as</groupId>
+ <artifactId>jboss-as-arquillian-container-remote</artifactId>
+ <scope>test</scope>
+ </dependency>
+ </dependencies>
+ </profile>
+ </profiles>
+
+ <build>
+ <plugins>
+ <!-- Skip tests by default -->
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-surefire-plugin</artifactId>
+ <configuration>
+ <skip>true</skip>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
</project>
Added: branches/enterprise/WFK-2_1/examples/messages/messages-ejb/src/test/java/org/jboss/seam/example/messages/test/Deployments.java
===================================================================
--- branches/enterprise/WFK-2_1/examples/messages/messages-ejb/src/test/java/org/jboss/seam/example/messages/test/Deployments.java (rev 0)
+++ branches/enterprise/WFK-2_1/examples/messages/messages-ejb/src/test/java/org/jboss/seam/example/messages/test/Deployments.java 2013-06-04 07:01:40 UTC (rev 15539)
@@ -0,0 +1,39 @@
+package org.jboss.seam.example.messages.test;
+
+import java.io.File;
+
+import org.jboss.seam.example.messages.Message;
+import org.jboss.shrinkwrap.api.ShrinkWrap;
+import org.jboss.shrinkwrap.api.spec.WebArchive;
+import org.jboss.shrinkwrap.resolver.api.maven.Maven;
+
+public class Deployments
+{
+
+ public static WebArchive messagesDeployment() {
+
+ // use profiles defined in 'maven.profiles' property in pom.xml
+ String profilesString = System.getProperty("maven.profiles");
+ String[] profiles = profilesString != null ? profilesString.split(", ?") : new String[0];
+
+ File[] libs = Maven.resolver().loadPomFromFile("pom.xml", profiles)
+ .importCompileAndRuntimeDependencies()
+ // force resolve jboss-seam, because it is provided-scoped in the pom, but we need it bundled in the WAR
+ .resolve("org.jboss.seam:jboss-seam").withTransitivity().asFile();
+
+
+
+ return ShrinkWrap.create(WebArchive.class, "seam-messages.war")
+ .addPackage(Message.class.getPackage())
+ .addAsWebInfResource("META-INF/ejb-jar.xml", "ejb-jar.xml")
+ .addAsWebInfResource("components.xml", "components.xml")
+ .addAsWebInfResource("persistence.xml", "classes/META-INF/persistence.xml")
+ .addAsWebInfResource("import.sql", "classes/import.sql")
+ .addAsWebInfResource("jboss-deployment-structure.xml", "jboss-deployment-structure.xml")
+ .addAsWebInfResource("seam.properties", "classes/seam.properties")
+ .addAsWebInfResource("web.xml", "web.xml")
+ .addAsLibraries(libs);
+
+ }
+
+}
Copied: branches/enterprise/WFK-2_1/examples/messages/messages-ejb/src/test/java/org/jboss/seam/example/messages/test/MessageListTest.java (from rev 15538, branches/enterprise/WFK-2_1/examples/messages/messages-tests/src/test/java/org/jboss/seam/example/messages/test/MessageListTest.java)
===================================================================
--- branches/enterprise/WFK-2_1/examples/messages/messages-ejb/src/test/java/org/jboss/seam/example/messages/test/MessageListTest.java (rev 0)
+++ branches/enterprise/WFK-2_1/examples/messages/messages-ejb/src/test/java/org/jboss/seam/example/messages/test/MessageListTest.java 2013-06-04 07:01:40 UTC (rev 15539)
@@ -0,0 +1,103 @@
+//$Id: MessageListTest.java 2383 2006-10-26 18:53:00Z gavin $
+package org.jboss.seam.example.messages.test;
+import javax.faces.model.DataModel;
+
+import org.jboss.arquillian.container.test.api.Deployment;
+import org.jboss.arquillian.container.test.api.OverProtocol;
+import org.jboss.arquillian.junit.Arquillian;
+import org.jboss.seam.mock.JUnitSeamTest;
+import org.jboss.shrinkwrap.api.Archive;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+
+(a)RunWith(Arquillian.class)
+public class MessageListTest extends JUnitSeamTest
+{
+ @Deployment(name="MessageListTest")
+ @OverProtocol("Servlet 3.0")
+ public static Archive<?> createDeployment()
+ {
+
+ return Deployments.messagesDeployment();
+ }
+
+ @Test
+ public void testMessageList() throws Exception
+ {
+ new NonFacesRequest()
+ {
+
+ @Override
+ protected void renderResponse() throws Exception {
+ DataModel list = (DataModel) getInstance("messageList");
+ assert list.getRowCount()==2;
+ }
+
+ }.run();
+
+ new FacesRequest()
+ {
+
+ @Override
+ protected void updateModelValues() throws Exception {
+ DataModel list = (DataModel) getInstance("messageList");
+ assert list.getRowCount()==2;
+ list.setRowIndex(1);
+ }
+
+
+ @Override
+ protected void invokeApplication() throws Exception {
+ invokeMethod("#{messageManager.select}");
+ }
+
+
+ @Override
+ protected void renderResponse() throws Exception {
+ DataModel list = (DataModel) getInstance("messageList");
+ assert list.getRowCount()==2;
+ assert getValue("#{message.title}").equals("Hello World");
+ assert getValue("#{message.read}").equals(true);
+ }
+
+ }.run();
+
+ new FacesRequest()
+ {
+
+ @Override
+ protected void updateModelValues() throws Exception {
+ DataModel list = (DataModel) getInstance("messageList");
+ assert list.getRowCount()==2;
+ list.setRowIndex(0);
+ }
+
+
+ @Override
+ protected void invokeApplication() throws Exception {
+ invokeMethod("#{messageManager.delete}");
+ }
+
+
+ @Override
+ protected void renderResponse() throws Exception {
+ DataModel list = (DataModel) getInstance("messageList");
+ assert list.getRowCount()==1;
+ }
+
+ }.run();
+
+ new NonFacesRequest()
+ {
+
+ @Override
+ protected void renderResponse() throws Exception {
+ DataModel list = (DataModel) getInstance("messageList");
+ assert list.getRowCount()==1;
+ }
+
+ }.run();
+
+ }
+
+}
Added: branches/enterprise/WFK-2_1/examples/messages/messages-ejb/src/test/resources/arquillian.xml
===================================================================
--- branches/enterprise/WFK-2_1/examples/messages/messages-ejb/src/test/resources/arquillian.xml (rev 0)
+++ branches/enterprise/WFK-2_1/examples/messages/messages-ejb/src/test/resources/arquillian.xml 2013-06-04 07:01:40 UTC (rev 15539)
@@ -0,0 +1,24 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<arquillian xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xmlns="http://jboss.org/schema/arquillian"
+ xsi:schemaLocation="http://jboss.org/schema/arquillian http://jboss.org/schema/arquillian/arquillian_1_0.xsd">
+
+ <engine>
+ <property name="deploymentExportPath">target/</property>
+ </engine>
+
+ <container qualifier="jboss" default="true">
+ <configuration>
+ <!-- These properties are only valid for arquillian managed container,
+ but don't cause a problem for the remote container, so they can be left in. -->
+ <!-- To use jacoco, set jacoco.agent system property to something like
+ -javaagent:/path/to/jacocoagent.jar=append=true,destfile=/path/to/output/jacoco.exec -->
+ <property name="javaVmArguments">-Xmx1024m -XX:MaxPermSize=1024m ${jacoco.agent}</property>
+ <property name="serverConfig">standalone.xml</property>
+ <!-- If jbossHome property is not set, the JBOSS_HOME environment variable
+ is used -->
+ <!--<property name="jbossHome">/path/to/jboss/as</property> -->
+ </configuration>
+ </container>
+
+</arquillian>
Added: branches/enterprise/WFK-2_1/examples/messages/messages-ejb/src/test/resources/components.xml
===================================================================
--- branches/enterprise/WFK-2_1/examples/messages/messages-ejb/src/test/resources/components.xml (rev 0)
+++ branches/enterprise/WFK-2_1/examples/messages/messages-ejb/src/test/resources/components.xml 2013-06-04 07:01:40 UTC (rev 15539)
@@ -0,0 +1,14 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<components xmlns="http://jboss.org/schema/seam/components"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://jboss.org/schema/seam/components http://jboss.org/schema/seam/components-2.3.xsd">
+
+ <component name="org.jboss.seam.core.init">
+ <property name="jndiPattern">${jndiPattern}</property>
+ </component>
+
+ <!-- This is required for JBoss AS7 due these EJB components are bound to jboss-seam module -->
+ <component class="org.jboss.seam.transaction.EjbSynchronizations" jndi-name="java:app/jboss-seam/EjbSynchronizations"/>
+ <component class="org.jboss.seam.async.TimerServiceDispatcher" jndi-name="java:app/jboss-seam/TimerServiceDispatcher"/>
+
+</components>
Added: branches/enterprise/WFK-2_1/examples/messages/messages-ejb/src/test/resources/ejb-jar.xml
===================================================================
--- branches/enterprise/WFK-2_1/examples/messages/messages-ejb/src/test/resources/ejb-jar.xml (rev 0)
+++ branches/enterprise/WFK-2_1/examples/messages/messages-ejb/src/test/resources/ejb-jar.xml 2013-06-04 07:01:40 UTC (rev 15539)
@@ -0,0 +1,20 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<ejb-jar xmlns="http://java.sun.com/xml/ns/javaee"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/ejb-jar_3_0.xsd"
+ version="3.0">
+
+ <interceptors>
+ <interceptor>
+ <interceptor-class>org.jboss.seam.ejb.SeamInterceptor</interceptor-class>
+ </interceptor>
+ </interceptors>
+
+ <assembly-descriptor>
+ <interceptor-binding>
+ <ejb-name>*</ejb-name>
+ <interceptor-class>org.jboss.seam.ejb.SeamInterceptor</interceptor-class>
+ </interceptor-binding>
+ </assembly-descriptor>
+
+</ejb-jar>
Added: branches/enterprise/WFK-2_1/examples/messages/messages-ejb/src/test/resources/import.sql
===================================================================
--- branches/enterprise/WFK-2_1/examples/messages/messages-ejb/src/test/resources/import.sql (rev 0)
+++ branches/enterprise/WFK-2_1/examples/messages/messages-ejb/src/test/resources/import.sql 2013-06-04 07:01:40 UTC (rev 15539)
@@ -0,0 +1,2 @@
+insert into Message (title, text, read, datetime) values ('Hello World', 'This is an example of a message.', 0, '2006-01-01 11:12:00')
+insert into Message (title, text, read, datetime) values ('Greetings Earthling', 'This is another example of a message.', 0, '2006-02-04 03:04:00')
Added: branches/enterprise/WFK-2_1/examples/messages/messages-ejb/src/test/resources/jboss-deployment-structure.xml
===================================================================
--- branches/enterprise/WFK-2_1/examples/messages/messages-ejb/src/test/resources/jboss-deployment-structure.xml (rev 0)
+++ branches/enterprise/WFK-2_1/examples/messages/messages-ejb/src/test/resources/jboss-deployment-structure.xml 2013-06-04 07:01:40 UTC (rev 15539)
@@ -0,0 +1,12 @@
+<jboss-deployment-structure xmlns="urn:jboss:deployment-structure:1.0">
+ <deployment>
+ <dependencies>
+<!-- <module name="org.apache.log4j" export="true"/> -->
+ <module name="org.dom4j" export="true"/>
+<!-- <module name="org.apache.commons.logging" export="true"/> -->
+<!-- <module name="org.apache.commons.collections" export="true"/> -->
+ <module name="javax.faces.api" export="true"/>
+ <module name="com.sun.jsf-impl" export="true"/>
+ </dependencies>
+ </deployment>
+</jboss-deployment-structure>
\ No newline at end of file
Added: branches/enterprise/WFK-2_1/examples/messages/messages-ejb/src/test/resources/persistence.xml
===================================================================
--- branches/enterprise/WFK-2_1/examples/messages/messages-ejb/src/test/resources/persistence.xml (rev 0)
+++ branches/enterprise/WFK-2_1/examples/messages/messages-ejb/src/test/resources/persistence.xml 2013-06-04 07:01:40 UTC (rev 15539)
@@ -0,0 +1,13 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<persistence xmlns="http://java.sun.com/xml/ns/persistence"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://java.sun.com/xml/ns/persistence http://java.sun.com/xml/ns/persistence/persistence_2_0.xsd"
+ version="2.0">
+ <persistence-unit name="messageDatabase">
+ <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"/>
+ </properties>
+ </persistence-unit>
+</persistence>
Added: branches/enterprise/WFK-2_1/examples/messages/messages-ejb/src/test/resources/seam.properties
===================================================================
--- branches/enterprise/WFK-2_1/examples/messages/messages-ejb/src/test/resources/seam.properties (rev 0)
+++ branches/enterprise/WFK-2_1/examples/messages/messages-ejb/src/test/resources/seam.properties 2013-06-04 07:01:40 UTC (rev 15539)
@@ -0,0 +1 @@
+
Copied: branches/enterprise/WFK-2_1/examples/messages/messages-ejb/src/test/resources/web.xml (from rev 15538, branches/enterprise/WFK-2_1/examples/messages/messages-tests/src/test/resources-integration/web.xml)
===================================================================
--- branches/enterprise/WFK-2_1/examples/messages/messages-ejb/src/test/resources/web.xml (rev 0)
+++ branches/enterprise/WFK-2_1/examples/messages/messages-ejb/src/test/resources/web.xml 2013-06-04 07:01:40 UTC (rev 15539)
@@ -0,0 +1,12 @@
+<?xml version="1.0" ?>
+
+<web-app version="3.0"
+ xmlns="http://java.sun.com/xml/ns/javaee"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd">
+
+ <listener>
+ <listener-class>org.jboss.seam.mock.MockSeamListener</listener-class>
+ </listener>
+
+</web-app>
Deleted: branches/enterprise/WFK-2_1/examples/messages/messages-tests/pom.xml
===================================================================
--- branches/enterprise/WFK-2_1/examples/messages/messages-tests/pom.xml 2013-06-04 06:41:09 UTC (rev 15538)
+++ branches/enterprise/WFK-2_1/examples/messages/messages-tests/pom.xml 2013-06-04 07:01:40 UTC (rev 15539)
@@ -1,158 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
- <modelVersion>4.0.0</modelVersion>
- <parent>
- <artifactId>messages</artifactId>
- <groupId>org.jboss.seam.examples</groupId>
- <version>2.3.1.Final-redhat-2</version>
- <relativePath>../pom.xml</relativePath>
- </parent>
-
- <groupId>org.jboss.seam.examples.messages</groupId>
- <artifactId>messages-tests</artifactId>
- <name>Messages Integration Tests Module (EE6)</name>
-
- <dependencies>
- <dependency>
- <groupId>org.testng</groupId>
- <artifactId>testng</artifactId>
- </dependency>
- <dependency>
- <groupId>org.jboss.seam.examples.messages</groupId>
- <artifactId>messages-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.jboss.spec.javax.faces</groupId>
- <artifactId>jboss-jsf-api_2.1_spec</artifactId>
- <scope>provided</scope>
- </dependency>
- <dependency>
- <groupId>org.seleniumhq.selenium</groupId>
- <artifactId>selenium-server</artifactId>
- </dependency>
- <dependency>
- <groupId>org.seleniumhq.selenium</groupId>
- <artifactId>selenium-java</artifactId>
- </dependency>
- <dependency>
- <groupId>org.jboss.seam</groupId>
- <artifactId>functional-tests</artifactId>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>junit</groupId>
- <artifactId>junit</artifactId>
- <scope>test</scope>
- </dependency>
-
- <dependency>
- <groupId>org.jboss.arquillian.junit</groupId>
- <artifactId>arquillian-junit-container</artifactId>
- <scope>test</scope>
- </dependency>
-
- <dependency>
- <groupId>org.jboss.arquillian.protocol</groupId>
- <artifactId>arquillian-protocol-servlet</artifactId>
- <scope>test</scope>
- </dependency>
-
- <dependency>
- <groupId>org.jboss.spec.javax.el</groupId>
- <artifactId>jboss-el-api_2.2_spec</artifactId>
- <scope>provided</scope>
- </dependency>
- </dependencies>
-
- <build>
- <testResources>
- <testResource>
- <directory>src/test/resources</directory>
- <filtering>true</filtering>
- </testResource>
- <testResource>
- <directory>src/test/resources-integration</directory>
- </testResource>
- </testResources>
- <plugins>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-surefire-plugin</artifactId>
- <configuration>
- <skip>true</skip>
- </configuration>
- </plugin>
- </plugins>
- </build>
-
- <profiles>
- <profile>
- <id>integration-tests</id>
- <activation>
- <property>
- <name>arquillian</name>
- </property>
- </activation>
- </profile>
-
- <profile>
- <id>arq-jbossas-7-managed</id>
- <activation>
- <property>
- <name>arquillian</name>
- <value>jbossas-managed-7</value>
- </property>
- </activation>
- <build>
- <plugins>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-dependency-plugin</artifactId>
- </plugin>
- </plugins>
- </build>
- </profile>
-
- <profile>
- <id>arq-jbossas-7-remote</id>
- <activation>
- <property>
- <name>arquillian</name>
- <value>jbossas-remote-7</value>
- </property>
- </activation>
- </profile>
-
- <profile>
- <id>ftest-jbossas</id>
- <properties>
- <example.context.path>seam-messages</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>
Deleted: branches/enterprise/WFK-2_1/examples/messages/messages-tests/src/test/java/org/jboss/seam/example/messages/test/MessageListTest.java
===================================================================
--- branches/enterprise/WFK-2_1/examples/messages/messages-tests/src/test/java/org/jboss/seam/example/messages/test/MessageListTest.java 2013-06-04 06:41:09 UTC (rev 15538)
+++ branches/enterprise/WFK-2_1/examples/messages/messages-tests/src/test/java/org/jboss/seam/example/messages/test/MessageListTest.java 2013-06-04 07:01:40 UTC (rev 15539)
@@ -1,119 +0,0 @@
-//$Id: MessageListTest.java 2383 2006-10-26 18:53:00Z gavin $
-package org.jboss.seam.example.messages.test;
-import javax.faces.model.DataModel;
-
-import java.io.File;
-
-import org.jboss.shrinkwrap.api.Archive;
-import org.jboss.shrinkwrap.api.ShrinkWrap;
-import org.jboss.shrinkwrap.api.importer.ZipImporter;
-import org.jboss.shrinkwrap.api.spec.EnterpriseArchive;
-import org.jboss.shrinkwrap.api.spec.WebArchive;
-import org.jboss.arquillian.container.test.api.Deployment;
-import org.jboss.arquillian.container.test.api.OverProtocol;
-import org.jboss.arquillian.junit.Arquillian;
-
-import org.jboss.seam.mock.JUnitSeamTest;
-
-import org.junit.runner.RunWith;
-import org.junit.Test;
-
-(a)RunWith(Arquillian.class)
-public class MessageListTest extends JUnitSeamTest
-{
- @Deployment(name="MessageListTest")
- @OverProtocol("Servlet 3.0")
- public static Archive<?> createDeployment()
- {
- EnterpriseArchive er = ShrinkWrap.create(ZipImporter.class, "seam-messages.ear").importFrom(new File("../messages-ear/target/seam-messages.ear"))
- .as(EnterpriseArchive.class);
- WebArchive web = er.getAsType(WebArchive.class, "messages-web.war");
- web.addClasses(MessageListTest.class);
-
- // Install org.jboss.seam.mock.MockSeamListener
- web.delete("/WEB-INF/web.xml");
- web.addAsWebInfResource("web.xml");
-
- return er;
- }
-
- @Test
- public void testMessageList() throws Exception
- {
- new NonFacesRequest()
- {
-
- @Override
- protected void renderResponse() throws Exception {
- DataModel list = (DataModel) getInstance("messageList");
- assert list.getRowCount()==2;
- }
-
- }.run();
-
- new FacesRequest()
- {
-
- @Override
- protected void updateModelValues() throws Exception {
- DataModel list = (DataModel) getInstance("messageList");
- assert list.getRowCount()==2;
- list.setRowIndex(1);
- }
-
-
- @Override
- protected void invokeApplication() throws Exception {
- invokeMethod("#{messageManager.select}");
- }
-
-
- @Override
- protected void renderResponse() throws Exception {
- DataModel list = (DataModel) getInstance("messageList");
- assert list.getRowCount()==2;
- assert getValue("#{message.title}").equals("Hello World");
- assert getValue("#{message.read}").equals(true);
- }
-
- }.run();
-
- new FacesRequest()
- {
-
- @Override
- protected void updateModelValues() throws Exception {
- DataModel list = (DataModel) getInstance("messageList");
- assert list.getRowCount()==2;
- list.setRowIndex(0);
- }
-
-
- @Override
- protected void invokeApplication() throws Exception {
- invokeMethod("#{messageManager.delete}");
- }
-
-
- @Override
- protected void renderResponse() throws Exception {
- DataModel list = (DataModel) getInstance("messageList");
- assert list.getRowCount()==1;
- }
-
- }.run();
-
- new NonFacesRequest()
- {
-
- @Override
- protected void renderResponse() throws Exception {
- DataModel list = (DataModel) getInstance("messageList");
- assert list.getRowCount()==1;
- }
-
- }.run();
-
- }
-
-}
Deleted: branches/enterprise/WFK-2_1/examples/messages/messages-tests/src/test/java/org/jboss/seam/example/messages/test/selenium/MessageTest.java
===================================================================
--- branches/enterprise/WFK-2_1/examples/messages/messages-tests/src/test/java/org/jboss/seam/example/messages/test/selenium/MessageTest.java 2013-06-04 06:41:09 UTC (rev 15538)
+++ branches/enterprise/WFK-2_1/examples/messages/messages-tests/src/test/java/org/jboss/seam/example/messages/test/selenium/MessageTest.java 2013-06-04 07:01:40 UTC (rev 15539)
@@ -1,83 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2008, Red Hat Middleware LLC, and individual contributors
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.jboss.seam.example.messages.test.selenium;
-
-import java.text.MessageFormat;
-
-import org.jboss.seam.example.common.test.selenium.SeamSeleniumTest;
-import org.testng.annotations.BeforeMethod;
-import org.testng.annotations.DataProvider;
-import org.testng.annotations.Test;
-import static org.testng.AssertJUnit.assertTrue;
-import static org.testng.AssertJUnit.assertFalse;
-import static org.testng.AssertJUnit.assertEquals;
-
-/**
- * Test for messages example
- * @author Jozef Hartinger
- *
- */
-public class MessageTest extends SeamSeleniumTest
-{
-
- public static final String MESSAGES_URL = "/messages.seam";
- public static final String MESSAGES_LINK = "messages:{0}:link";
- public static final String MESSAGES_DELETE = "messages:{0}:delete";
- public static final String MESSAGES_CHECKBOX = "messages:{0}:read";
- public static final String MESSAGES_COUNT = "//table[@id='messages']/tbody/tr";
- public static final String MESSAGE_TITLE = "title";
- public static final String MESSAGE_TEXT = "text";
-
- @Override
- @BeforeMethod
- public void setUp()
- {
- super.setUp();
- browser.open(CONTEXT_PATH + MESSAGES_URL);
- }
-
- @Test(dataProvider = "messages")
- public void readMessageTest(int i, String title, String text)
- {
- browser.clickAndWait(MessageFormat.format(MESSAGES_LINK, i));
- assertEquals("Unexpected message title displayed.", title, browser.getText(MESSAGE_TITLE));
- assertEquals("Unexpected message text displayed.", text, browser.getText(MESSAGE_TEXT));
- assertTrue("Checkbox should be checked after message is read.", browser.isChecked(MessageFormat.format(MESSAGES_CHECKBOX, i)));
- }
-
- @Test(dependsOnMethods = {"readMessageTest"}, dataProvider = "messages")
- public void deleteMessageTest(int i, String title, String name)
- {
- int messageCount = browser.getXpathCount(MESSAGES_COUNT).intValue();
- // delete first message in a table
- browser.clickAndWait(MessageFormat.format(MESSAGES_DELETE, 0));
- assertEquals("Unexpected count of messages.", --messageCount, browser.getXpathCount(MESSAGES_COUNT));
- assertFalse("Message title still present.", browser.isTextPresent(title));
- }
-
- @DataProvider(name = "messages")
- public Object[][] getMessages()
- {
- Object[][] messages = { { 0, "Greetings Earthling", "This is another example of a message." }, { 1, "Hello World", "This is an example of a message." } };
- return messages;
- }
-}
Deleted: branches/enterprise/WFK-2_1/examples/messages/messages-tests/src/test/resources-ftest/testng.xml
===================================================================
--- branches/enterprise/WFK-2_1/examples/messages/messages-tests/src/test/resources-ftest/testng.xml 2013-06-04 06:41:09 UTC (rev 15538)
+++ branches/enterprise/WFK-2_1/examples/messages/messages-tests/src/test/resources-ftest/testng.xml 2013-06-04 07:01:40 UTC (rev 15539)
@@ -1,26 +0,0 @@
-
- <!--
- JBoss, Home of Professional Open Source Copyright 2008, Red Hat
- Middleware LLC, and individual contributors by the @authors tag. See
- the copyright.txt in the distribution for a full listing of individual
- contributors. This is free software; you can redistribute it and/or
- modify it under the terms of the GNU Lesser General Public License as
- published by the Free Software Foundation; either version 2.1 of the
- License, or (at your option) any later version. This software is
- distributed in the hope that it will be useful, but WITHOUT ANY
- WARRANTY; without even the implied warranty of MERCHANTABILITY or
- FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
- License for more details. You should have received a copy of the GNU
- Lesser General Public License along with this software; if not, write
- to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
- Boston, MA 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- -->
-<!DOCTYPE suite SYSTEM "http://beust.com/testng/testng-1.0.dtd" >
-<suite name="Messages example" verbose="2" parallel="false">
- <test name="messages_tests">
- <parameter name="PROPERTY_FILE" value="" />
- <classes>
- <class name="org.jboss.seam.example.messages.test.selenium.MessageTest" />
- </classes>
- </test>
-</suite>
Deleted: branches/enterprise/WFK-2_1/examples/messages/messages-tests/src/test/resources-integration/arquillian.xml
===================================================================
--- branches/enterprise/WFK-2_1/examples/messages/messages-tests/src/test/resources-integration/arquillian.xml 2013-06-04 06:41:09 UTC (rev 15538)
+++ branches/enterprise/WFK-2_1/examples/messages/messages-tests/src/test/resources-integration/arquillian.xml 2013-06-04 07:01:40 UTC (rev 15539)
@@ -1,16 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<arquillian xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xmlns="http://jboss.org/schema/arquillian"
- xsi:schemaLocation="http://jboss.org/schema/arquillian http://jboss.org/schema/arquillian/arquillian_1_0.xsd">
-
- <engine>
- <property name="deploymentExportPath">target/</property>
- </engine>
-
- <container qualifier="jboss" default="true">
- <configuration>
- <property name="javaVmArguments">-Xmx1024m -XX:MaxPermSize=512m ${jacoco.agent}</property>
- </configuration>
- </container>
-
-</arquillian>
Deleted: branches/enterprise/WFK-2_1/examples/messages/messages-tests/src/test/resources-integration/web.xml
===================================================================
--- branches/enterprise/WFK-2_1/examples/messages/messages-tests/src/test/resources-integration/web.xml 2013-06-04 06:41:09 UTC (rev 15538)
+++ branches/enterprise/WFK-2_1/examples/messages/messages-tests/src/test/resources-integration/web.xml 2013-06-04 07:01:40 UTC (rev 15539)
@@ -1,12 +0,0 @@
-<?xml version="1.0" ?>
-
-<web-app version="3.0"
- xmlns="http://java.sun.com/xml/ns/javaee"
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd">
-
- <listener>
- <listener-class>org.jboss.seam.mock.MockSeamListener</listener-class>
- </listener>
-
-</web-app>
Modified: branches/enterprise/WFK-2_1/examples/messages/messages-web/pom.xml
===================================================================
--- branches/enterprise/WFK-2_1/examples/messages/messages-web/pom.xml 2013-06-04 06:41:09 UTC (rev 15538)
+++ branches/enterprise/WFK-2_1/examples/messages/messages-web/pom.xml 2013-06-04 07:01:40 UTC (rev 15539)
@@ -62,6 +62,7 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-war-plugin</artifactId>
+ <version>${version.war.plugin}</version>
<configuration>
<webResources>
<resource>
Modified: branches/enterprise/WFK-2_1/examples/messages/pom.xml
===================================================================
--- branches/enterprise/WFK-2_1/examples/messages/pom.xml 2013-06-04 06:41:09 UTC (rev 15538)
+++ branches/enterprise/WFK-2_1/examples/messages/pom.xml 2013-06-04 07:01:40 UTC (rev 15539)
@@ -1,14 +1,9 @@
<?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">
- <parent>
- <artifactId>examples</artifactId>
- <groupId>org.jboss.seam</groupId>
- <version>2.3.1.Final-redhat-2</version>
- </parent>
-
<modelVersion>4.0.0</modelVersion>
<groupId>org.jboss.seam.examples</groupId>
<artifactId>messages</artifactId>
+ <version>2.3.1.Final-redhat-2</version>
<packaging>pom</packaging>
<name>Messages Example (EE6)</name>
@@ -16,12 +11,35 @@
<module>messages-ejb</module>
<module>messages-web</module>
<module>messages-ear</module>
- <module>messages-tests</module>
</modules>
<properties>
- <example.name>messages</example.name>
- </properties>
+ <example.name>messages</example.name>
+ <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
+ <maven.compiler.target>1.6</maven.compiler.target>
+ <maven.compiler.source>1.6</maven.compiler.source>
+
+ <!-- To use jacoco, set jacoco.agent system property to something like
+ -javaagent:/path/to/jacocoagent.jar=append=true,destfile=/path/to/output/jacoco.exec -->
+ <jacoco.agent />
+
+ <!-- To use custom Maven settings and profiles, uncomment and customize
+ the following properties. This is necessary for the ShrinkWrap resolver to
+ function properly. -->
+ <!--<maven.user.settings>/path/to/custom/settings.xml</maven.user.settings> -->
+ <!--<maven.profiles>custom,profile</maven.profiles> -->
+
+ <version.commons.logging>1.1.1</version.commons.logging>
+ <version.shrinkwrap.resolver>2.0.0-beta-4</version.shrinkwrap.resolver>
+
+ <!-- Plugin versions -->
+ <version.dependency.plugin>2.5.1</version.dependency.plugin>
+ <version.surefire.plugin>2.10</version.surefire.plugin>
+ <version.compiler.plugin>2.3.1</version.compiler.plugin>
+ <version.ear.plugin>2.6</version.ear.plugin>
+ <version.war.plugin>2.1.1</version.war.plugin>
+ <version.jboss.maven.plugin>7.4.Final</version.jboss.maven.plugin>
+ </properties>
<dependencyManagement>
<dependencies>
@@ -31,17 +49,79 @@
<version>${project.version}</version>
<type>ejb</type>
</dependency>
+
<dependency>
<groupId>org.jboss.seam.examples.messages</groupId>
<artifactId>messages-web</artifactId>
<version>${project.version}</version>
<type>war</type>
</dependency>
+
<dependency>
<groupId>org.jboss.seam.examples.messages</groupId>
<artifactId>messages-ear</artifactId>
<version>${project.version}</version>
</dependency>
+
+ <!-- BOMs -->
+ <dependency>
+ <groupId>org.jboss.shrinkwrap.resolver</groupId>
+ <artifactId>shrinkwrap-resolver-bom</artifactId>
+ <version>${version.shrinkwrap.resolver}</version>
+ <scope>import</scope>
+ <type>pom</type>
+ </dependency>
+
+ <dependency>
+ <groupId>org.jboss.seam</groupId>
+ <artifactId>bom</artifactId>
+ <version>${project.version}</version>
+ <type>pom</type>
+ <scope>import</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.jboss.seam</groupId>
+ <artifactId>jboss-seam</artifactId>
+ <version>${project.version}</version>
+ <exclusions>
+ <exclusion>
+ <groupId>org.testng</groupId>
+ <artifactId>testng</artifactId>
+ </exclusion>
+ </exclusions>
+ </dependency>
</dependencies>
</dependencyManagement>
+
+ <build>
+ <pluginManagement>
+ <plugins>
+ <!-- Manage plugin versions for build stability -->
+ <plugin>
+ <artifactId>maven-surefire-plugin</artifactId>
+ <version>${version.surefire.plugin}</version>
+ <configuration>
+ <systemPropertyVariables>
+ <org.apache.maven.user-settings>${maven.user.settings}</org.apache.maven.user-settings>
+ <maven.profiles>${maven.profiles}</maven.profiles>
+ </systemPropertyVariables>
+ </configuration>
+ </plugin>
+ <plugin>
+ <artifactId>maven-dependency-plugin</artifactId>
+ <version>${version.dependency.plugin}</version>
+ </plugin>
+ <plugin>
+ <artifactId>maven-compiler-plugin</artifactId>
+ <version>${version.compiler.plugin}</version>
+ <configuration>
+ <source>${maven.compiler.source}</source>
+ <target>${maven.compiler.target}</target>
+ </configuration>
+ </plugin>
+ </plugins>
+ </pluginManagement>
+ </build>
+
</project>
11 years, 5 months
Seam SVN: r15538 - in branches/enterprise/WFK-2_1/examples/mail: mail-ear and 25 other directories.
by seam-commits@lists.jboss.org
Author: tremes
Date: 2013-06-04 02:41:09 -0400 (Tue, 04 Jun 2013)
New Revision: 15538
Added:
branches/enterprise/WFK-2_1/examples/mail/mail-ejb/src/main/resources/META-INF/ejb-jar.xml
branches/enterprise/WFK-2_1/examples/mail/mail-ejb/src/test/
branches/enterprise/WFK-2_1/examples/mail/mail-ejb/src/test/java/
branches/enterprise/WFK-2_1/examples/mail/mail-ejb/src/test/java/org/
branches/enterprise/WFK-2_1/examples/mail/mail-ejb/src/test/java/org/jboss/
branches/enterprise/WFK-2_1/examples/mail/mail-ejb/src/test/java/org/jboss/seam/
branches/enterprise/WFK-2_1/examples/mail/mail-ejb/src/test/java/org/jboss/seam/example/
branches/enterprise/WFK-2_1/examples/mail/mail-ejb/src/test/java/org/jboss/seam/example/mail/
branches/enterprise/WFK-2_1/examples/mail/mail-ejb/src/test/java/org/jboss/seam/example/mail/test/
branches/enterprise/WFK-2_1/examples/mail/mail-ejb/src/test/java/org/jboss/seam/example/mail/test/Deployments.java
branches/enterprise/WFK-2_1/examples/mail/mail-ejb/src/test/java/org/jboss/seam/example/mail/test/MailTest.java
branches/enterprise/WFK-2_1/examples/mail/mail-ejb/src/test/resources/
branches/enterprise/WFK-2_1/examples/mail/mail-ejb/src/test/resources/arquillian.xml
branches/enterprise/WFK-2_1/examples/mail/mail-ejb/src/test/resources/components.xml
branches/enterprise/WFK-2_1/examples/mail/mail-ejb/src/test/resources/ejb-jar.xml
branches/enterprise/WFK-2_1/examples/mail/mail-ejb/src/test/resources/html.xhtml
branches/enterprise/WFK-2_1/examples/mail/mail-ejb/src/test/resources/jboss-deployment-structure.xml
branches/enterprise/WFK-2_1/examples/mail/mail-ejb/src/test/resources/org/
branches/enterprise/WFK-2_1/examples/mail/mail-ejb/src/test/resources/org/jboss/
branches/enterprise/WFK-2_1/examples/mail/mail-ejb/src/test/resources/org/jboss/seam/
branches/enterprise/WFK-2_1/examples/mail/mail-ejb/src/test/resources/org/jboss/seam/example/
branches/enterprise/WFK-2_1/examples/mail/mail-ejb/src/test/resources/org/jboss/seam/example/mail/
branches/enterprise/WFK-2_1/examples/mail/mail-ejb/src/test/resources/org/jboss/seam/example/mail/test/
branches/enterprise/WFK-2_1/examples/mail/mail-ejb/src/test/resources/org/jboss/seam/example/mail/test/errors1.xhtml
branches/enterprise/WFK-2_1/examples/mail/mail-ejb/src/test/resources/org/jboss/seam/example/mail/test/errors2.xhtml
branches/enterprise/WFK-2_1/examples/mail/mail-ejb/src/test/resources/org/jboss/seam/example/mail/test/errors3.xhtml
branches/enterprise/WFK-2_1/examples/mail/mail-ejb/src/test/resources/org/jboss/seam/example/mail/test/errors4.xhtml
branches/enterprise/WFK-2_1/examples/mail/mail-ejb/src/test/resources/org/jboss/seam/example/mail/test/sanitization.xhtml
branches/enterprise/WFK-2_1/examples/mail/mail-ejb/src/test/resources/plain.xhtml
branches/enterprise/WFK-2_1/examples/mail/mail-ejb/src/test/resources/seam.properties
branches/enterprise/WFK-2_1/examples/mail/mail-ejb/src/test/resources/simple.xhtml
branches/enterprise/WFK-2_1/examples/mail/mail-ejb/src/test/resources/template.xhtml
branches/enterprise/WFK-2_1/examples/mail/mail-ejb/src/test/resources/templating.xhtml
branches/enterprise/WFK-2_1/examples/mail/mail-ejb/src/test/resources/web.xml
Removed:
branches/enterprise/WFK-2_1/examples/mail/mail-tests/pom.xml
branches/enterprise/WFK-2_1/examples/mail/mail-tests/src/test/java/org/jboss/seam/example/mail/test/MailTest.java
branches/enterprise/WFK-2_1/examples/mail/mail-tests/src/test/java/org/jboss/seam/example/mail/test/selenium/SeleniumMailTest.java
branches/enterprise/WFK-2_1/examples/mail/mail-tests/src/test/resources-ftest/testng.xml
branches/enterprise/WFK-2_1/examples/mail/mail-tests/src/test/resources-integration/arquillian.xml
branches/enterprise/WFK-2_1/examples/mail/mail-tests/src/test/resources-integration/web.xml
branches/enterprise/WFK-2_1/examples/mail/mail-tests/src/test/resources/org/jboss/seam/example/mail/test/errors1.xhtml
branches/enterprise/WFK-2_1/examples/mail/mail-tests/src/test/resources/org/jboss/seam/example/mail/test/errors2.xhtml
branches/enterprise/WFK-2_1/examples/mail/mail-tests/src/test/resources/org/jboss/seam/example/mail/test/errors3.xhtml
branches/enterprise/WFK-2_1/examples/mail/mail-tests/src/test/resources/org/jboss/seam/example/mail/test/errors4.xhtml
branches/enterprise/WFK-2_1/examples/mail/mail-tests/src/test/resources/org/jboss/seam/example/mail/test/sanitization.xhtml
Modified:
branches/enterprise/WFK-2_1/examples/mail/mail-ear/pom.xml
branches/enterprise/WFK-2_1/examples/mail/mail-ejb/pom.xml
branches/enterprise/WFK-2_1/examples/mail/mail-web/pom.xml
branches/enterprise/WFK-2_1/examples/mail/pom.xml
Log:
Mail example migrated
Modified: branches/enterprise/WFK-2_1/examples/mail/mail-ear/pom.xml
===================================================================
--- branches/enterprise/WFK-2_1/examples/mail/mail-ear/pom.xml 2013-06-04 06:09:08 UTC (rev 15537)
+++ branches/enterprise/WFK-2_1/examples/mail/mail-ear/pom.xml 2013-06-04 06:41:09 UTC (rev 15538)
@@ -61,6 +61,7 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-ear-plugin</artifactId>
+ <version>${version.ear.plugin}</version>
<configuration>
<version>6</version>
<defaultLibBundleDir>lib</defaultLibBundleDir>
Modified: branches/enterprise/WFK-2_1/examples/mail/mail-ejb/pom.xml
===================================================================
--- branches/enterprise/WFK-2_1/examples/mail/mail-ejb/pom.xml 2013-06-04 06:09:08 UTC (rev 15537)
+++ branches/enterprise/WFK-2_1/examples/mail/mail-ejb/pom.xml 2013-06-04 06:41:09 UTC (rev 15538)
@@ -20,26 +20,146 @@
<type>ejb</type>
<scope>provided</scope>
</dependency>
+
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-validator</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.1_spec</artifactId>
<scope>provided</scope>
</dependency>
+
+ <dependency>
+ <groupId>org.jboss.seam</groupId>
+ <artifactId>jboss-seam-mail</artifactId>
+ </dependency>
+
+ <!-- Test dependencies -->
+ <dependency>
+ <groupId>org.jboss.shrinkwrap.resolver</groupId>
+ <artifactId>shrinkwrap-resolver-depchain</artifactId>
+ <type>pom</type>
+ <scope>test</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <scope>test</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.jboss.arquillian.junit</groupId>
+ <artifactId>arquillian-junit-container</artifactId>
+ <scope>test</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.jboss.arquillian.protocol</groupId>
+ <artifactId>arquillian-protocol-servlet</artifactId>
+ <scope>test</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>javax.mail</groupId>
+ <artifactId>mail</artifactId>
+ <scope>test</scope>
+ </dependency>
+
</dependencies>
+
+ <profiles>
+ <profile>
+ <id>integration-tests</id>
+ <activation>
+ <property>
+ <name>arquillian</name>
+ </property>
+ </activation>
+ <properties>
+ <jndiPattern>java:app/seam-mail/#{ejbName}</jndiPattern>
+ <distributable>false</distributable>
+ </properties>
+ <build>
+ <testResources>
+ <testResource>
+ <directory>src/test/resources</directory>
+ <filtering>true</filtering>
+ </testResource>
+ </testResources>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-surefire-plugin</artifactId>
+ <configuration>
+ <skip>false</skip>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+ </profile>
+ <profile>
+ <id>arq-jbossas-7-managed</id>
+ <activation>
+ <property>
+ <name>arquillian</name>
+ <value>jbossas-managed-7</value>
+ </property>
+ </activation>
+ <dependencies>
+ <dependency>
+ <groupId>org.jboss.as</groupId>
+ <artifactId>jboss-as-arquillian-container-managed</artifactId>
+ <scope>test</scope>
+ </dependency>
+ </dependencies>
+ </profile>
+
+ <profile>
+ <id>arq-jbossas-7-remote</id>
+ <activation>
+ <property>
+ <name>arquillian</name>
+ <value>jbossas-remote-7</value>
+ </property>
+ </activation>
+ <dependencies>
+ <dependency>
+ <groupId>org.jboss.as</groupId>
+ <artifactId>jboss-as-arquillian-container-remote</artifactId>
+ <scope>test</scope>
+ </dependency>
+ </dependencies>
+ </profile>
+ </profiles>
+
+ <build>
+ <plugins>
+ <!-- Skip tests by default -->
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-surefire-plugin</artifactId>
+ <configuration>
+ <skip>true</skip>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
</project>
Added: branches/enterprise/WFK-2_1/examples/mail/mail-ejb/src/main/resources/META-INF/ejb-jar.xml
===================================================================
--- branches/enterprise/WFK-2_1/examples/mail/mail-ejb/src/main/resources/META-INF/ejb-jar.xml (rev 0)
+++ branches/enterprise/WFK-2_1/examples/mail/mail-ejb/src/main/resources/META-INF/ejb-jar.xml 2013-06-04 06:41:09 UTC (rev 15538)
@@ -0,0 +1,19 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<ejb-jar xmlns="http://java.sun.com/xml/ns/javaee"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/ejb-jar_3_0.xsd"
+ version="3.0">
+
+ <interceptors>
+ <interceptor>
+ <interceptor-class>org.jboss.seam.ejb.SeamInterceptor</interceptor-class>
+ </interceptor>
+ </interceptors>
+
+ <assembly-descriptor>
+ <interceptor-binding>
+ <ejb-name>*</ejb-name>
+ <interceptor-class>org.jboss.seam.ejb.SeamInterceptor</interceptor-class>
+ </interceptor-binding>
+ </assembly-descriptor>
+</ejb-jar>
Added: branches/enterprise/WFK-2_1/examples/mail/mail-ejb/src/test/java/org/jboss/seam/example/mail/test/Deployments.java
===================================================================
--- branches/enterprise/WFK-2_1/examples/mail/mail-ejb/src/test/java/org/jboss/seam/example/mail/test/Deployments.java (rev 0)
+++ branches/enterprise/WFK-2_1/examples/mail/mail-ejb/src/test/java/org/jboss/seam/example/mail/test/Deployments.java 2013-06-04 06:41:09 UTC (rev 15538)
@@ -0,0 +1,47 @@
+package org.jboss.seam.example.mail.test;
+
+import java.io.File;
+
+import org.jboss.seam.example.mail.MailExample;
+import org.jboss.shrinkwrap.api.ShrinkWrap;
+import org.jboss.shrinkwrap.api.spec.WebArchive;
+import org.jboss.shrinkwrap.resolver.api.maven.Maven;
+
+public class Deployments
+{
+
+ public static WebArchive mailDeployment() {
+
+ // use profiles defined in 'maven.profiles' property in pom.xml
+ String profilesString = System.getProperty("maven.profiles");
+ String[] profiles = profilesString != null ? profilesString.split(", ?") : new String[0];
+
+ File[] libs = Maven.resolver().loadPomFromFile("pom.xml", profiles)
+ .importCompileAndRuntimeDependencies()
+ // force resolve jboss-seam, because it is provided-scoped in the pom, but we need it bundled in the WAR
+ .resolve("org.jboss.seam:jboss-seam").withTransitivity().asFile();
+
+
+
+ return ShrinkWrap.create(WebArchive.class, "seam-mail.war")
+ .addPackage(MailExample.class.getPackage())
+ .addAsWebInfResource("META-INF/ejb-jar.xml", "ejb-jar.xml")
+ .addAsWebInfResource("components.xml", "components.xml")
+ .addAsWebInfResource("jboss-deployment-structure.xml", "jboss-deployment-structure.xml")
+ .addAsWebInfResource("seam.properties", "classes/seam.properties")
+ .addAsWebInfResource("web.xml", "web.xml")
+ .addAsWebResource("org/jboss/seam/example/mail/test/errors1.xhtml", "org/jboss/seam/example/mail/test/errors1.xhtml")
+ .addAsWebResource("org/jboss/seam/example/mail/test/errors2.xhtml", "org/jboss/seam/example/mail/test/errors2.xhtml")
+ .addAsWebResource("org/jboss/seam/example/mail/test/errors3.xhtml", "org/jboss/seam/example/mail/test/errors3.xhtml")
+ .addAsWebResource("org/jboss/seam/example/mail/test/errors4.xhtml", "org/jboss/seam/example/mail/test/errors4.xhtml")
+ .addAsWebResource("org/jboss/seam/example/mail/test/sanitization.xhtml", "org/jboss/seam/example/mail/test/sanitization.xhtml")
+ .addAsWebResource("simple.xhtml")
+ .addAsWebResource("plain.xhtml")
+ .addAsWebResource("html.xhtml")
+ .addAsWebResource("templating.xhtml")
+ .addAsWebResource("template.xhtml")
+ .addAsLibraries(libs);
+
+ }
+
+}
Added: branches/enterprise/WFK-2_1/examples/mail/mail-ejb/src/test/java/org/jboss/seam/example/mail/test/MailTest.java
===================================================================
--- branches/enterprise/WFK-2_1/examples/mail/mail-ejb/src/test/java/org/jboss/seam/example/mail/test/MailTest.java (rev 0)
+++ branches/enterprise/WFK-2_1/examples/mail/mail-ejb/src/test/java/org/jboss/seam/example/mail/test/MailTest.java 2013-06-04 06:41:09 UTC (rev 15538)
@@ -0,0 +1,512 @@
+package org.jboss.seam.example.mail.test;
+
+import static javax.mail.Message.RecipientType.BCC;
+import static javax.mail.Message.RecipientType.CC;
+
+import java.io.InputStream;
+
+import javax.faces.FacesException;
+import javax.faces.context.FacesContext;
+import javax.mail.internet.AddressException;
+import javax.mail.internet.InternetAddress;
+import javax.mail.internet.MimeBodyPart;
+import javax.mail.internet.MimeMessage;
+import javax.mail.internet.MimeMultipart;
+
+import org.jboss.arquillian.container.test.api.Deployment;
+import org.jboss.arquillian.container.test.api.OverProtocol;
+import org.jboss.arquillian.junit.Arquillian;
+import org.jboss.seam.Component;
+import org.jboss.seam.Seam;
+import org.jboss.seam.contexts.Contexts;
+import org.jboss.seam.contexts.Lifecycle;
+import org.jboss.seam.document.ByteArrayDocumentData;
+import org.jboss.seam.document.DocumentData;
+import org.jboss.seam.example.mail.Person;
+import org.jboss.seam.faces.Renderer;
+import org.jboss.seam.mail.MailSession;
+import org.jboss.seam.mail.ui.UIAttachment;
+import org.jboss.seam.mail.ui.UIMessage;
+import org.jboss.seam.mock.MockTransport;
+import org.jboss.shrinkwrap.api.Archive;
+import org.junit.After;
+import org.junit.Assert;
+import org.junit.Before;
+import org.junit.Ignore;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+
+/**
+ * @author Pete Muir
+ *
+ */
+(a)RunWith(Arquillian.class)
+public class MailTest
+{
+ @Deployment(name = "MailTest")
+ @OverProtocol("Servlet 3.0")
+ public static Archive<?> createDeployment()
+ {
+
+ return Deployments.mailDeployment();
+ }
+
+ @Before
+ public void before()
+ {
+ Lifecycle.beginCall();
+ }
+
+ @After
+ public void after()
+ {
+ Lifecycle.endCall();
+ }
+
+ protected MimeMessage getRenderedMailMessage(String viewId)
+ {
+ Contexts.getApplicationContext().set(Seam.getComponentName(MailSession.class), new MailSession("mock").create());
+ MockTransport.clearMailMessage();
+ Renderer.instance().render(viewId);
+ return MockTransport.getMailMessage();
+ }
+
+ @Test
+ public void testSimple() throws Exception
+ {
+ Person person = (Person) Component.getInstance("person");
+ person.setFirstname("Pete");
+ person.setLastname("Muir");
+ person.setAddress("test(a)example.com");
+
+ MimeMessage renderedMessage = getRenderedMailMessage("/simple.xhtml");
+ Assert.assertTrue(MailSession.instance().getTransport() instanceof MockTransport);
+
+ // Test the headers
+
+ Assert.assertNotNull(renderedMessage);
+ Assert.assertEquals(renderedMessage.getAllRecipients().length, 1);
+ Assert.assertTrue(renderedMessage.getAllRecipients()[0] instanceof InternetAddress);
+ InternetAddress to = (InternetAddress) renderedMessage.getAllRecipients()[0];
+ Assert.assertEquals(to.getAddress(), "test(a)example.com");
+ Assert.assertEquals(to.getPersonal(), "Pete Muir");
+ Assert.assertEquals(renderedMessage.getFrom().length, 1);
+ Assert.assertTrue(renderedMessage.getFrom()[0] instanceof InternetAddress);
+ InternetAddress from = (InternetAddress) renderedMessage.getFrom()[0];
+ Assert.assertEquals(from.getAddress(), "peter(a)example.com");
+ Assert.assertEquals(from.getPersonal(), "Peter");
+ Assert.assertEquals(renderedMessage.getSubject(), "Try out Seam!");
+ Assert.assertNull(renderedMessage.getHeader("Precedence"));
+ Assert.assertNull(renderedMessage.getHeader("X-Priority"));
+ Assert.assertNull(renderedMessage.getHeader("Priority"));
+ Assert.assertNull(renderedMessage.getHeader("Importance"));
+ Assert.assertNull(renderedMessage.getHeader("Disposition-Notification-To"));
+
+ // Check the body
+
+ Assert.assertNotNull(renderedMessage.getContent());
+ Assert.assertTrue(renderedMessage.getContent() instanceof MimeMultipart);
+ MimeMultipart body = (MimeMultipart) renderedMessage.getContent();
+ Assert.assertEquals(body.getCount(), 1);
+ Assert.assertNotNull(body.getBodyPart(0));
+ Assert.assertTrue(body.getBodyPart(0) instanceof MimeBodyPart);
+ MimeBodyPart bodyPart = (MimeBodyPart) body.getBodyPart(0);
+ Assert.assertNotNull(bodyPart.getContent());
+ Assert.assertEquals(bodyPart.getDisposition(), "inline");
+ Assert.assertTrue(bodyPart.isMimeType("text/html"));
+ }
+
+ @Ignore
+ @Test
+ public void testAttachment() throws Exception
+ {
+ Person person = (Person) Component.getInstance("person");
+ person.setFirstname("Gavin");
+ person.setLastname("King");
+ person.setAddress("gavin(a)king.com");
+
+ MimeMessage renderedMessage = getRenderedMailMessage("/attachment.xhtml");
+
+ // Test the headers
+
+ InternetAddress to = (InternetAddress) renderedMessage.getAllRecipients()[0];
+ Assert.assertEquals(to.getAddress(), "gavin(a)king.com");
+ Assert.assertEquals(to.getPersonal(), "Gavin King");
+ InternetAddress from = (InternetAddress) renderedMessage.getFrom()[0];
+ Assert.assertEquals(from.getAddress(), "do-not-reply(a)jboss.com");
+ Assert.assertEquals(from.getPersonal(), "Seam");
+ Assert.assertEquals(renderedMessage.getSubject(), "Try out Seam!");
+ MimeMultipart body = (MimeMultipart) renderedMessage.getContent();
+
+ Assert.assertEquals(body.getCount(), 6); // 3 Attachments and 1
+ // MimeMultipart
+
+ // The root multipart/related
+ Assert.assertNotNull(body.getBodyPart(0));
+ Assert.assertTrue(body.getBodyPart(0) instanceof MimeBodyPart);
+ MimeBodyPart bodyPart = (MimeBodyPart) body.getBodyPart(0);
+ Assert.assertNotNull(bodyPart.getContent());
+ Assert.assertTrue(bodyPart.getContent() instanceof MimeMultipart);
+ Assert.assertTrue(bodyPart.isMimeType("multipart/related"));
+
+ MimeMultipart attachments = (MimeMultipart) bodyPart.getContent();
+
+ Assert.assertEquals(attachments.getCount(), 3); // 2 Attachments and 1
+ // MimeMultipart
+
+ // Attachment 0 (the actual message)
+ Assert.assertNotNull(attachments.getBodyPart(0));
+ Assert.assertTrue(attachments.getBodyPart(0) instanceof MimeBodyPart);
+ bodyPart = (MimeBodyPart) attachments.getBodyPart(0);
+ Assert.assertNotNull(bodyPart.getContent());
+ Assert.assertNotNull(bodyPart.getContent());
+ Assert.assertTrue(bodyPart.isMimeType("text/html"));
+ Assert.assertEquals(bodyPart.getDisposition(), "inline");
+
+ // Inline Attachment 1 // Attachment Jboss Logo
+ Assert.assertNotNull(attachments.getBodyPart(1));
+ Assert.assertTrue(attachments.getBodyPart(1) instanceof MimeBodyPart);
+ bodyPart = (MimeBodyPart) attachments.getBodyPart(1);
+ Assert.assertNotNull(bodyPart.getContent());
+ Assert.assertTrue(bodyPart.getContent() instanceof InputStream);
+ Assert.assertEquals(bodyPart.getFileName(), "jboss.jpg");
+
+ Assert.assertTrue(bodyPart.isMimeType("image/jpeg"));
+ Assert.assertEquals(bodyPart.getDisposition(), "inline");
+ Assert.assertNotNull(bodyPart.getContentID());
+
+ // Inline Attachment 1 // Attachment Gavin Pic
+ Assert.assertNotNull(attachments.getBodyPart(2));
+ Assert.assertTrue(attachments.getBodyPart(2) instanceof MimeBodyPart);
+ bodyPart = (MimeBodyPart) attachments.getBodyPart(2);
+ Assert.assertNotNull(bodyPart.getContent());
+ Assert.assertTrue(bodyPart.getContent() instanceof InputStream);
+ Assert.assertEquals(bodyPart.getFileName(), "Gavin_King.jpg");
+ Assert.assertTrue(bodyPart.isMimeType("image/png"));
+ Assert.assertEquals(bodyPart.getDisposition(), "inline");
+ Assert.assertNotNull(bodyPart.getContentID());
+
+ // Root Attachment 0
+ Assert.assertNotNull(body.getBodyPart(1));
+ Assert.assertTrue(body.getBodyPart(1) instanceof MimeBodyPart);
+ bodyPart = (MimeBodyPart) body.getBodyPart(1);
+ Assert.assertNotNull(bodyPart.getContent());
+ Assert.assertTrue(bodyPart.getContent() instanceof InputStream);
+ Assert.assertEquals(bodyPart.getFileName(), "numbers.csv");
+ Assert.assertTrue(bodyPart.isMimeType("content/unknown"));
+ Assert.assertEquals(bodyPart.getDisposition(), "attachment");
+ Assert.assertNull(bodyPart.getContentID());
+
+ // Root Attachment 1
+ Assert.assertNotNull(body.getBodyPart(2));
+ Assert.assertTrue(body.getBodyPart(2) instanceof MimeBodyPart);
+ bodyPart = (MimeBodyPart) body.getBodyPart(2);
+ Assert.assertNotNull(bodyPart.getContent());
+ Assert.assertTrue(bodyPart.getContent() instanceof String);
+ Assert.assertEquals(bodyPart.getFileName(), "whyseam.pdf");
+ Assert.assertEquals(bodyPart.getDisposition(), "attachment");
+ Assert.assertNull(bodyPart.getContentID());
+
+ // Root Attachment 3
+ Assert.assertNotNull(body.getBodyPart(3));
+ Assert.assertTrue(body.getBodyPart(3) instanceof MimeBodyPart);
+ bodyPart = (MimeBodyPart) body.getBodyPart(3);
+ Assert.assertNotNull(bodyPart.getContent());
+ Assert.assertEquals(bodyPart.getFileName(), "excel.xls");
+ Assert.assertTrue(bodyPart.isMimeType("application/vnd.ms-excel"));
+ Assert.assertEquals(bodyPart.getDisposition(), "attachment");
+ Assert.assertNull(bodyPart.getContentID());
+
+ }
+
+ @Test
+ public void testPdfAttachment() throws Exception
+ {
+ UIAttachment attachment = new UIAttachment();
+ attachment.setFileName("filename.pdf");
+ UIMessage message = new UIMessage();
+ attachment.setParent(message);
+ message.setMailSession(MailSession.instance());
+ DocumentData doc = new ByteArrayDocumentData("filename", new DocumentData.DocumentType("pdf", "application/pdf"), new byte[] {});
+ attachment.setValue(doc);
+ attachment.encodeEnd(FacesContext.getCurrentInstance());
+
+ // verify we built the message
+ Assert.assertEquals(message.getAttachments().size(), 1);
+ MimeBodyPart bodyPart = message.getAttachments().get(0);
+ Assert.assertEquals(bodyPart.getFileName(), "filename.pdf");
+ Assert.assertEquals(bodyPart.getDisposition(), "attachment");
+ }
+
+ @Test
+ public void testHtml() throws Exception
+ {
+ Person person = (Person) Component.getInstance("person");
+ person.setFirstname("Pete");
+ person.setLastname("Muir");
+ person.setAddress("test(a)example.com");
+
+ MimeMessage renderedMessage = getRenderedMailMessage("/html.xhtml");
+
+ // Test the standard headers
+
+ InternetAddress to = (InternetAddress) renderedMessage.getAllRecipients()[0];
+ Assert.assertEquals(to.getAddress(), "test(a)example.com");
+ Assert.assertEquals(to.getPersonal(), "Pete Muir");
+ InternetAddress from = (InternetAddress) renderedMessage.getFrom()[0];
+ Assert.assertEquals(from.getAddress(), "do-not-reply(a)jboss.com");
+ Assert.assertEquals(from.getPersonal(), "Seam");
+ Assert.assertEquals(renderedMessage.getSubject(), "Seam Mail");
+
+ // Test the extra headers
+
+ // Importance
+ Assert.assertNotNull(renderedMessage.getHeader("X-Priority"));
+ Assert.assertNotNull(renderedMessage.getHeader("Priority"));
+ Assert.assertNotNull(renderedMessage.getHeader("Importance"));
+ Assert.assertEquals(renderedMessage.getHeader("X-Priority").length, 1);
+ Assert.assertEquals(renderedMessage.getHeader("Priority").length, 1);
+ Assert.assertEquals(renderedMessage.getHeader("Importance").length, 1);
+ Assert.assertEquals(renderedMessage.getHeader("X-Priority")[0], "5");
+ Assert.assertEquals(renderedMessage.getHeader("Priority")[0], "Non-urgent");
+ Assert.assertEquals(renderedMessage.getHeader("Importance")[0], "low");
+
+ // read receipt
+ Assert.assertNotNull(renderedMessage.getHeader("Disposition-Notification-To"));
+ Assert.assertEquals(renderedMessage.getHeader("Disposition-Notification-To").length, 1);
+ Assert.assertEquals(renderedMessage.getHeader("Disposition-Notification-To")[0], "Seam <do-not-reply(a)jboss.com>");
+
+ // m:header
+ Assert.assertNotNull(renderedMessage.getHeader("X-Sent-From"));
+ Assert.assertEquals(renderedMessage.getHeader("X-Sent-From").length, 1);
+ Assert.assertEquals(renderedMessage.getHeader("X-Sent-From")[0], "Seam");
+
+ MimeMultipart body = (MimeMultipart) renderedMessage.getContent();
+
+ // Check the alternative facet
+ Assert.assertTrue(renderedMessage.getContentType().startsWith("multipart/mixed"));
+ Assert.assertEquals(body.getCount(), 1);
+ MimeBodyPart bodyPart = (MimeBodyPart) body.getBodyPart(0);
+ Assert.assertTrue(bodyPart.getContentType().startsWith("multipart/alternative"));
+ Assert.assertTrue(bodyPart.getContent() instanceof MimeMultipart);
+ MimeMultipart bodyParts = (MimeMultipart) bodyPart.getContent();
+ Assert.assertEquals(bodyParts.getCount(), 2);
+ Assert.assertTrue(bodyParts.getBodyPart(0) instanceof MimeBodyPart);
+ Assert.assertTrue(bodyParts.getBodyPart(1) instanceof MimeBodyPart);
+ MimeBodyPart alternative = (MimeBodyPart) bodyParts.getBodyPart(0);
+ MimeBodyPart html = (MimeBodyPart) bodyParts.getBodyPart(1);
+ Assert.assertTrue(alternative.isMimeType("text/plain"));
+ Assert.assertEquals(alternative.getDisposition(), "inline");
+ Assert.assertTrue(html.isMimeType("text/html"));
+ }
+
+ @Test
+ public void testPlain() throws Exception
+ {
+ Person person = (Person) Component.getInstance("person");
+ person.setFirstname("Pete");
+ person.setLastname("Muir");
+ person.setAddress("test(a)example.com");
+
+ MimeMessage renderedMessage = getRenderedMailMessage("/plain.xhtml");
+
+ // Test the standard headers
+
+ InternetAddress to = (InternetAddress) renderedMessage.getAllRecipients()[0];
+ Assert.assertEquals(to.getAddress(), "test(a)example.com");
+ Assert.assertEquals(to.getPersonal(), "Pete Muir");
+ InternetAddress from = (InternetAddress) renderedMessage.getFrom()[0];
+ Assert.assertEquals(from.getAddress(), "do-not-reply(a)jboss.com");
+ Assert.assertEquals(from.getPersonal(), "Seam");
+ Assert.assertEquals(renderedMessage.getReplyTo().length, 1);
+ Assert.assertTrue(renderedMessage.getReplyTo()[0] instanceof InternetAddress);
+ InternetAddress replyTo = (InternetAddress) renderedMessage.getReplyTo()[0];
+ Assert.assertEquals(replyTo.getAddress(), "another.address(a)jboss.org");
+ Assert.assertEquals(replyTo.getPersonal(), "JBoss");
+ Assert.assertEquals(renderedMessage.getRecipients(CC).length, 1);
+ Assert.assertTrue(renderedMessage.getRecipients(CC)[0] instanceof InternetAddress);
+ InternetAddress cc = (InternetAddress) renderedMessage.getRecipients(CC)[0];
+ Assert.assertEquals(cc.getAddress(), "test(a)example.com");
+ Assert.assertEquals(cc.getPersonal(), "Pete Muir");
+ Assert.assertEquals(renderedMessage.getRecipients(BCC).length, 1);
+ Assert.assertTrue(renderedMessage.getRecipients(BCC)[0] instanceof InternetAddress);
+ InternetAddress bcc = (InternetAddress) renderedMessage.getRecipients(CC)[0];
+ Assert.assertEquals(bcc.getAddress(), "test(a)example.com");
+ Assert.assertEquals(bcc.getPersonal(), "Pete Muir");
+ Assert.assertEquals(renderedMessage.getHeader("Precedence")[0], "bulk");
+ // Importance
+ Assert.assertNotNull(renderedMessage.getHeader("X-Priority"));
+ Assert.assertNotNull(renderedMessage.getHeader("Priority"));
+ Assert.assertNotNull(renderedMessage.getHeader("Importance"));
+ Assert.assertEquals(renderedMessage.getHeader("X-Priority").length, 1);
+ Assert.assertEquals(renderedMessage.getHeader("Priority").length, 1);
+ Assert.assertEquals(renderedMessage.getHeader("Importance").length, 1);
+ Assert.assertEquals(renderedMessage.getHeader("X-Priority")[0], "1");
+ Assert.assertEquals(renderedMessage.getHeader("Priority")[0], "Urgent");
+ Assert.assertEquals(renderedMessage.getHeader("Importance")[0], "high");
+ Assert.assertEquals(renderedMessage.getSubject(), "Plain text email sent by Seam");
+
+ // Check the body
+
+ Assert.assertNotNull(renderedMessage.getContent());
+ MimeMultipart body = (MimeMultipart) renderedMessage.getContent();
+ Assert.assertEquals(body.getCount(), 1);
+ MimeBodyPart bodyPart = (MimeBodyPart) body.getBodyPart(0);
+ Assert.assertNotNull(bodyPart.getContent());
+ Assert.assertEquals(bodyPart.getDisposition(), "inline");
+ Assert.assertTrue(bodyPart.isMimeType("text/plain"));
+
+ }
+
+ @Test
+ public void testAttachmentErrors() throws Exception
+ {
+ Person person = (Person) Component.getInstance("person");
+ person.setFirstname("Pete");
+ person.setLastname("Muir");
+ person.setAddress("test(a)example.com");
+
+ // Test for an unavailable attachment
+
+ Contexts.getEventContext().set("attachment", "/foo.pdf");
+
+ }
+
+ @Test
+ public void testAddressValidation() throws Exception
+ {
+ Person person = (Person) Component.getInstance("person");
+ person.setFirstname("Pete");
+ person.setLastname("Muir");
+ boolean exceptionThrown = false;
+ person.setAddress("testexample.com");
+
+ try
+ {
+ getRenderedMailMessage("/org/jboss/seam/example/mail/test/errors2.xhtml");
+ }
+ catch (FacesException e)
+ {
+ Assert.assertTrue(e.getCause() instanceof AddressException);
+ AddressException ae = (AddressException) e.getCause();
+ Assert.assertTrue(ae.getMessage().startsWith("Missing final '@domain'"));
+ exceptionThrown = true;
+ }
+ Assert.assertTrue(exceptionThrown);
+
+ }
+
+ // JBSEAM-2109
+ // @Test
+ public void testReplyToErrors() throws Exception
+ {
+ Person person = (Person) Component.getInstance("person");
+ person.setFirstname("Pete");
+ person.setLastname("Muir");
+ person.setAddress("test(a)example.com");
+
+ boolean exceptionThrown = false;
+
+ try
+ {
+ getRenderedMailMessage("/org/jboss/seam/example/mail/test/errors3.xhtml");
+ }
+ catch (Exception e)
+ {
+ Assert.assertTrue(e.getCause() instanceof AddressException);
+ AddressException ae = (AddressException) e.getCause();
+ System.out.println(ae.getMessage());
+ Assert.assertTrue(ae.getMessage().startsWith("Email cannot have more than one Reply-to address"));
+ exceptionThrown = true;
+ }
+ Assert.assertTrue(exceptionThrown);
+ }
+
+ @Test
+ public void testFromErrors() throws Exception
+ {
+ Person person = (Person) Component.getInstance("person");
+ person.setFirstname("Pete");
+ person.setLastname("Muir");
+ person.setAddress("test(a)example.com");
+
+ boolean exceptionThrown = false;
+
+ try
+ {
+ getRenderedMailMessage("/org/jboss/seam/example/mail/test/errors4.xhtml");
+ }
+ catch (FacesException e)
+ {
+ Assert.assertTrue(e.getCause() instanceof AddressException);
+ AddressException ae = (AddressException) e.getCause();
+ Assert.assertTrue(ae.getMessage().startsWith("Email cannot have more than one from address"));
+ exceptionThrown = true;
+ }
+ Assert.assertTrue(exceptionThrown);
+ }
+
+ @Test
+ public void testSanitization() throws Exception
+ {
+ Contexts.getEventContext().set("name", "Pete\nMuir");
+ MimeMessage renderedMessage = getRenderedMailMessage("/org/jboss/seam/example/mail/test/sanitization.xhtml");
+ Assert.assertEquals(renderedMessage.getSubject(), "Try out Seam!");
+ InternetAddress to = (InternetAddress) renderedMessage.getAllRecipients()[0];
+ Assert.assertEquals(to.getAddress(), "peter(a)email.tld");
+ Assert.assertEquals(to.getPersonal(), "Pete");
+ Assert.assertEquals(renderedMessage.getFrom().length, 1);
+ Assert.assertTrue(renderedMessage.getFrom()[0] instanceof InternetAddress);
+ InternetAddress from = (InternetAddress) renderedMessage.getFrom()[0];
+ Assert.assertEquals(from.getAddress(), "peter(a)example.com");
+ Assert.assertEquals(from.getPersonal(), "Pete");
+ Assert.assertNotNull(renderedMessage.getHeader("Pete"));
+ Assert.assertEquals(renderedMessage.getHeader("Pete").length, 1);
+ Assert.assertEquals(renderedMessage.getHeader("Pete")[0], "roll over");
+ }
+
+ @Test
+ public void testTemplating() throws Exception
+ {
+ Person person = (Person) Component.getInstance("person");
+ person.setFirstname("Pete");
+ person.setLastname("Muir");
+ person.setAddress("test(a)example.com");
+
+ MimeMessage renderedMessage = getRenderedMailMessage("/templating.xhtml");
+
+ // Test the standard headers
+
+ InternetAddress to = (InternetAddress) renderedMessage.getAllRecipients()[0];
+ Assert.assertEquals(to.getAddress(), "test(a)example.com");
+ Assert.assertEquals(to.getPersonal(), "Pete Muir");
+ InternetAddress from = (InternetAddress) renderedMessage.getFrom()[0];
+ Assert.assertEquals(from.getAddress(), "do-not-reply(a)jboss.com");
+ Assert.assertEquals(from.getPersonal(), "Seam");
+ Assert.assertEquals(renderedMessage.getSubject(), "Templating with Seam Mail");
+ Assert.assertNull(renderedMessage.getHeader("X-Priority"));
+ Assert.assertNull(renderedMessage.getHeader("Priority"));
+ Assert.assertNull(renderedMessage.getHeader("Importance"));
+
+ // Check the body
+
+ MimeMultipart body = (MimeMultipart) renderedMessage.getContent();
+
+ // Check the alternative facet
+ Assert.assertTrue(renderedMessage.getContentType().startsWith("multipart/mixed"));
+ Assert.assertEquals(body.getCount(), 1);
+ MimeBodyPart bodyPart = (MimeBodyPart) body.getBodyPart(0);
+ Assert.assertTrue(bodyPart.getContentType().startsWith("multipart/alternative"));
+ Assert.assertTrue(bodyPart.getContent() instanceof MimeMultipart);
+ MimeMultipart bodyParts = (MimeMultipart) bodyPart.getContent();
+ Assert.assertEquals(bodyParts.getCount(), 2);
+ Assert.assertTrue(bodyParts.getBodyPart(0) instanceof MimeBodyPart);
+ Assert.assertTrue(bodyParts.getBodyPart(1) instanceof MimeBodyPart);
+ MimeBodyPart alternative = (MimeBodyPart) bodyParts.getBodyPart(0);
+ MimeBodyPart html = (MimeBodyPart) bodyParts.getBodyPart(1);
+ Assert.assertTrue(alternative.isMimeType("text/plain"));
+ Assert.assertEquals(alternative.getDisposition(), "inline");
+ Assert.assertTrue(html.isMimeType("text/html"));
+ Assert.assertEquals(html.getDisposition(), "inline");
+ }
+}
Added: branches/enterprise/WFK-2_1/examples/mail/mail-ejb/src/test/resources/arquillian.xml
===================================================================
--- branches/enterprise/WFK-2_1/examples/mail/mail-ejb/src/test/resources/arquillian.xml (rev 0)
+++ branches/enterprise/WFK-2_1/examples/mail/mail-ejb/src/test/resources/arquillian.xml 2013-06-04 06:41:09 UTC (rev 15538)
@@ -0,0 +1,24 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<arquillian xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xmlns="http://jboss.org/schema/arquillian"
+ xsi:schemaLocation="http://jboss.org/schema/arquillian http://jboss.org/schema/arquillian/arquillian_1_0.xsd">
+
+ <engine>
+ <property name="deploymentExportPath">target/</property>
+ </engine>
+
+ <container qualifier="jboss" default="true">
+ <configuration>
+ <!-- These properties are only valid for arquillian managed container,
+ but don't cause a problem for the remote container, so they can be left in. -->
+ <!-- To use jacoco, set jacoco.agent system property to something like
+ -javaagent:/path/to/jacocoagent.jar=append=true,destfile=/path/to/output/jacoco.exec -->
+ <property name="javaVmArguments">-Xmx1024m -XX:MaxPermSize=1024m ${jacoco.agent}</property>
+ <property name="serverConfig">standalone.xml</property>
+ <!-- If jbossHome property is not set, the JBOSS_HOME environment variable
+ is used -->
+ <!--<property name="jbossHome">/path/to/jboss/as</property> -->
+ </configuration>
+ </container>
+
+</arquillian>
Added: branches/enterprise/WFK-2_1/examples/mail/mail-ejb/src/test/resources/components.xml
===================================================================
--- branches/enterprise/WFK-2_1/examples/mail/mail-ejb/src/test/resources/components.xml (rev 0)
+++ branches/enterprise/WFK-2_1/examples/mail/mail-ejb/src/test/resources/components.xml 2013-06-04 06:41:09 UTC (rev 15538)
@@ -0,0 +1,20 @@
+<components xmlns="http://jboss.org/schema/seam/components"
+ xmlns:core="http://jboss.org/schema/seam/core"
+ xmlns:async="http://jboss.org/schema/seam/async"
+ xmlns:mail="http://jboss.org/schema/seam/mail"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation=
+ "http://jboss.org/schema/seam/core http://jboss.org/schema/seam/core-2.3.xsd
+ http://jboss.org/schema/seam/async http://jboss.org/schema/seam/async-2.3.xsd
+ http://jboss.org/schema/seam/mail http://jboss.org/schema/seam/mail-2.3.xsd
+ http://jboss.org/schema/seam/components http://jboss.org/schema/seam/components-2.3.xsd">
+
+
+ <core:init debug="true" jndi-pattern="${jndiPattern}" />
+
+ <!-- If you need to alter the SMTP gateway, comment out this mail-session, -->
+ <!--<mail:mail-session host="localhost" port="2525" /> -->
+
+ <!-- uncomment this one and set the host attribute to the name or IP address of your SMTP gateway-->
+ <mail:mail-session host="localhost" tls="false" port="3025" ssl="false" />
+</components>
Added: branches/enterprise/WFK-2_1/examples/mail/mail-ejb/src/test/resources/ejb-jar.xml
===================================================================
--- branches/enterprise/WFK-2_1/examples/mail/mail-ejb/src/test/resources/ejb-jar.xml (rev 0)
+++ branches/enterprise/WFK-2_1/examples/mail/mail-ejb/src/test/resources/ejb-jar.xml 2013-06-04 06:41:09 UTC (rev 15538)
@@ -0,0 +1,19 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<ejb-jar xmlns="http://java.sun.com/xml/ns/javaee"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/ejb-jar_3_0.xsd"
+ version="3.0">
+
+ <interceptors>
+ <interceptor>
+ <interceptor-class>org.jboss.seam.ejb.SeamInterceptor</interceptor-class>
+ </interceptor>
+ </interceptors>
+
+ <assembly-descriptor>
+ <interceptor-binding>
+ <ejb-name>*</ejb-name>
+ <interceptor-class>org.jboss.seam.ejb.SeamInterceptor</interceptor-class>
+ </interceptor-binding>
+ </assembly-descriptor>
+</ejb-jar>
Added: branches/enterprise/WFK-2_1/examples/mail/mail-ejb/src/test/resources/html.xhtml
===================================================================
--- branches/enterprise/WFK-2_1/examples/mail/mail-ejb/src/test/resources/html.xhtml (rev 0)
+++ branches/enterprise/WFK-2_1/examples/mail/mail-ejb/src/test/resources/html.xhtml 2013-06-04 06:41:09 UTC (rev 15538)
@@ -0,0 +1,22 @@
+<m:message xmlns="http://www.w3.org/1999/xhtml"
+ xmlns:m="http://jboss.org/schema/seam/mail"
+ xmlns:h="http://java.sun.com/jsf/html"
+ xmlns:f="http://java.sun.com/jsf/core"
+ importance="low" requestReadReceipt="true">
+ <m:header name="X-Sent-From" value="Seam" />
+ <m:from name="Seam" address="do-not-reply(a)jboss.com" />
+ <m:to name="#{person.firstname} #{person.lastname}">#{person.address}</m:to>
+ <m:subject>Seam Mail</m:subject>
+ <m:body>
+ <html>
+ <body>
+ <p><b>#{person.firstname},</b></p>
+ <p>This is an example <i>HTML</i> email sent by Seam.</p>
+ <p>It has an alternative text body for mail readers that don't support html.</p>
+ </body>
+ </html>
+ <f:facet name="alternative">
+ <h:outputText>This is the alternative text body for mail readers that don't support html</h:outputText>
+ </f:facet>
+ </m:body>
+</m:message>
\ No newline at end of file
Added: branches/enterprise/WFK-2_1/examples/mail/mail-ejb/src/test/resources/jboss-deployment-structure.xml
===================================================================
--- branches/enterprise/WFK-2_1/examples/mail/mail-ejb/src/test/resources/jboss-deployment-structure.xml (rev 0)
+++ branches/enterprise/WFK-2_1/examples/mail/mail-ejb/src/test/resources/jboss-deployment-structure.xml 2013-06-04 06:41:09 UTC (rev 15538)
@@ -0,0 +1,18 @@
+<jboss-deployment-structure xmlns="urn:jboss:deployment-structure:1.0">
+ <deployment>
+ <exclusions>
+ <module name="org.hibernate" slot="main" />
+ </exclusions>
+ <dependencies>
+ <module name="org.apache.log4j" export="true" />
+ <module name="org.dom4j" export="true" />
+ <module name="org.apache.commons.logging" export="true" />
+ <module name="org.apache.commons.collections" export="true" />
+ <module name="javax.faces.api" export="true" />
+ <module name="com.sun.jsf-impl" export="true" />
+ <module name="org.slf4j" export="true" />
+ <module name="org.javassist" export="true"/>
+ <module name="javax.mail.api" export="true"/>
+ </dependencies>
+ </deployment>
+</jboss-deployment-structure>
Copied: branches/enterprise/WFK-2_1/examples/mail/mail-ejb/src/test/resources/org/jboss/seam/example/mail/test/errors1.xhtml (from rev 15537, branches/enterprise/WFK-2_1/examples/mail/mail-tests/src/test/resources/org/jboss/seam/example/mail/test/errors1.xhtml)
===================================================================
--- branches/enterprise/WFK-2_1/examples/mail/mail-ejb/src/test/resources/org/jboss/seam/example/mail/test/errors1.xhtml (rev 0)
+++ branches/enterprise/WFK-2_1/examples/mail/mail-ejb/src/test/resources/org/jboss/seam/example/mail/test/errors1.xhtml 2013-06-04 06:41:09 UTC (rev 15538)
@@ -0,0 +1,10 @@
+<m:message xmlns="http://www.w3.org/1999/xhtml"
+ xmlns:m="http://jboss.org/schema/seam/mail"
+ xmlns:h="http://java.sun.com/jsf/html">
+
+ <m:from name="Peter">peter(a)example.com</m:from>
+ <m:to name="Peter">peter(a)email.tld</m:to>
+ <m:subject>Try out Seam!</m:subject>
+ <m:attachment value="#{attachment}" />
+ <m:body>A mail message to test exception handling</m:body>
+</m:message>
\ No newline at end of file
Copied: branches/enterprise/WFK-2_1/examples/mail/mail-ejb/src/test/resources/org/jboss/seam/example/mail/test/errors2.xhtml (from rev 15537, branches/enterprise/WFK-2_1/examples/mail/mail-tests/src/test/resources/org/jboss/seam/example/mail/test/errors2.xhtml)
===================================================================
--- branches/enterprise/WFK-2_1/examples/mail/mail-ejb/src/test/resources/org/jboss/seam/example/mail/test/errors2.xhtml (rev 0)
+++ branches/enterprise/WFK-2_1/examples/mail/mail-ejb/src/test/resources/org/jboss/seam/example/mail/test/errors2.xhtml 2013-06-04 06:41:09 UTC (rev 15538)
@@ -0,0 +1,9 @@
+<m:message xmlns="http://www.w3.org/1999/xhtml"
+ xmlns:m="http://jboss.org/schema/seam/mail"
+ xmlns:h="http://java.sun.com/jsf/html">
+
+ <m:from name="Peter" address="peter(a)example.com" />
+ <m:to name="#{person.firstname} #{person.lastname}">#{person.address}</m:to>
+ <m:subject>Try out Seam!</m:subject>
+ <m:body>A mail message to test exception handling</m:body>
+</m:message>
\ No newline at end of file
Copied: branches/enterprise/WFK-2_1/examples/mail/mail-ejb/src/test/resources/org/jboss/seam/example/mail/test/errors3.xhtml (from rev 15537, branches/enterprise/WFK-2_1/examples/mail/mail-tests/src/test/resources/org/jboss/seam/example/mail/test/errors3.xhtml)
===================================================================
--- branches/enterprise/WFK-2_1/examples/mail/mail-ejb/src/test/resources/org/jboss/seam/example/mail/test/errors3.xhtml (rev 0)
+++ branches/enterprise/WFK-2_1/examples/mail/mail-ejb/src/test/resources/org/jboss/seam/example/mail/test/errors3.xhtml 2013-06-04 06:41:09 UTC (rev 15538)
@@ -0,0 +1,11 @@
+<m:message xmlns="http://www.w3.org/1999/xhtml"
+ xmlns:m="http://jboss.org/schema/seam/mail"
+ xmlns:h="http://java.sun.com/jsf/html">
+
+ <m:replyTo address="foo(a)bar.com" />
+ <m:replyTo address="bar(a)bar.com" />
+ <m:from name="Peter" address="peter(a)example.com" />
+ <m:to name="#{person.firstname} #{person.lastname}">#{person.address}</m:to>
+ <m:subject>Try out Seam!</m:subject>
+ <m:body>A mail message to test exception handling</m:body>
+</m:message>
\ No newline at end of file
Copied: branches/enterprise/WFK-2_1/examples/mail/mail-ejb/src/test/resources/org/jboss/seam/example/mail/test/errors4.xhtml (from rev 15537, branches/enterprise/WFK-2_1/examples/mail/mail-tests/src/test/resources/org/jboss/seam/example/mail/test/errors4.xhtml)
===================================================================
--- branches/enterprise/WFK-2_1/examples/mail/mail-ejb/src/test/resources/org/jboss/seam/example/mail/test/errors4.xhtml (rev 0)
+++ branches/enterprise/WFK-2_1/examples/mail/mail-ejb/src/test/resources/org/jboss/seam/example/mail/test/errors4.xhtml 2013-06-04 06:41:09 UTC (rev 15538)
@@ -0,0 +1,10 @@
+<m:message xmlns="http://www.w3.org/1999/xhtml"
+ xmlns:m="http://jboss.org/schema/seam/mail"
+ xmlns:h="http://java.sun.com/jsf/html">
+
+ <m:from address="bar(a)bar.com" />
+ <m:from name="Peter" address="peter(a)example.com" />
+ <m:to name="#{person.firstname} #{person.lastname}">#{person.address}</m:to>
+ <m:subject>Try out Seam!</m:subject>
+ <m:body>A mail message to test exception handling</m:body>
+</m:message>
\ No newline at end of file
Copied: branches/enterprise/WFK-2_1/examples/mail/mail-ejb/src/test/resources/org/jboss/seam/example/mail/test/sanitization.xhtml (from rev 15537, branches/enterprise/WFK-2_1/examples/mail/mail-tests/src/test/resources/org/jboss/seam/example/mail/test/sanitization.xhtml)
===================================================================
--- branches/enterprise/WFK-2_1/examples/mail/mail-ejb/src/test/resources/org/jboss/seam/example/mail/test/sanitization.xhtml (rev 0)
+++ branches/enterprise/WFK-2_1/examples/mail/mail-ejb/src/test/resources/org/jboss/seam/example/mail/test/sanitization.xhtml 2013-06-04 06:41:09 UTC (rev 15538)
@@ -0,0 +1,14 @@
+<m:message xmlns="http://www.w3.org/1999/xhtml"
+ xmlns:m="http://jboss.org/schema/seam/mail"
+ xmlns:h="http://java.sun.com/jsf/html">
+
+ <m:from name="#{name}">peter(a)example.com
+foo</m:from>
+ <m:to name="#{name}">peter(a)email.tld
+bar</m:to>
+ <m:subject>Try out
+ Seam!</m:subject>
+ <m:header name="#{name}">roll
+ over</m:header>
+ <m:body>A mail message to test sanitization</m:body>
+</m:message>
\ No newline at end of file
Added: branches/enterprise/WFK-2_1/examples/mail/mail-ejb/src/test/resources/plain.xhtml
===================================================================
--- branches/enterprise/WFK-2_1/examples/mail/mail-ejb/src/test/resources/plain.xhtml (rev 0)
+++ branches/enterprise/WFK-2_1/examples/mail/mail-ejb/src/test/resources/plain.xhtml 2013-06-04 06:41:09 UTC (rev 15538)
@@ -0,0 +1,16 @@
+<m:message xmlns:m="http://jboss.org/schema/seam/mail" importance="high" precedence="bulk">
+
+ <m:from name="Seam" address="do-not-reply(a)jboss.com" />
+ <m:replyTo name="JBoss" address="another.address(a)jboss.org" />
+ <m:cc name="#{person.firstname} #{person.lastname}">#{person.address}</m:cc>
+ <m:bcc name="#{person.firstname} #{person.lastname}">#{person.address}</m:bcc>
+ <m:to name="#{person.firstname} #{person.lastname}">#{person.address}</m:to>
+ <m:subject>Plain text email sent by Seam</m:subject>
+ <m:body type="plain">Dear #{person.firstname},
+
+This is a plain text, email.
+
+Regards
+
+JBoss Seam Mail</m:body>
+</m:message>
\ No newline at end of file
Added: branches/enterprise/WFK-2_1/examples/mail/mail-ejb/src/test/resources/seam.properties
===================================================================
Copied: branches/enterprise/WFK-2_1/examples/mail/mail-ejb/src/test/resources/simple.xhtml (from rev 15537, branches/enterprise/WFK-2_1/examples/mail/mail-tests/src/test/resources/org/jboss/seam/example/mail/test/errors2.xhtml)
===================================================================
--- branches/enterprise/WFK-2_1/examples/mail/mail-ejb/src/test/resources/simple.xhtml (rev 0)
+++ branches/enterprise/WFK-2_1/examples/mail/mail-ejb/src/test/resources/simple.xhtml 2013-06-04 06:41:09 UTC (rev 15538)
@@ -0,0 +1,14 @@
+<m:message xmlns="http://www.w3.org/1999/xhtml"
+ xmlns:m="http://jboss.org/schema/seam/mail"
+ xmlns:h="http://java.sun.com/jsf/html">
+
+ <m:from name="Peter" address="peter(a)example.com" />
+ <m:to name="#{person.firstname} #{person.lastname}">#{person.address}</m:to>
+ <m:subject>Try out Seam!</m:subject>
+ <m:body>
+ <p><h:outputText value="Dear #{person.firstname}" />,</p>
+ <p>You can try out Seam by visiting <a href="http://www.seamframework.org">http://www.seamframework.org</a>.</p>
+ <p>Regards</p>
+ <p>Peter</p>
+ </m:body>
+</m:message>
\ No newline at end of file
Added: branches/enterprise/WFK-2_1/examples/mail/mail-ejb/src/test/resources/template.xhtml
===================================================================
--- branches/enterprise/WFK-2_1/examples/mail/mail-ejb/src/test/resources/template.xhtml (rev 0)
+++ branches/enterprise/WFK-2_1/examples/mail/mail-ejb/src/test/resources/template.xhtml 2013-06-04 06:41:09 UTC (rev 15538)
@@ -0,0 +1,37 @@
+<ui:composition xmlns="http://www.w3.org/1999/xhtml"
+ xmlns:ui="http://java.sun.com/jsf/facelets"
+ xmlns:s="http://jboss.org/schema/seam/taglib"
+ xmlns:m="http://jboss.org/schema/seam/mail"
+ xmlns:h="http://java.sun.com/jsf/html"
+ xmlns:f="http://java.sun.com/jsf/core">
+
+ <m:message>
+ <m:from name="Seam" address="do-not-reply(a)jboss.com" />
+ <m:to name="#{person.firstname} #{person.lastname}">#{person.address}</m:to>
+ <m:subject>#{subject}</m:subject>
+ <m:body>
+ <html>
+ <body>
+ <ui:insert name="body">
+ This is the default body, specified by the template.
+ </ui:insert>
+ </body>
+ </html>
+ <f:facet name="alternative">
+ <ui:insert name="alternative">
+ <h:outputText>Sorry, your mail reader doesn't support html.</h:outputText>
+ </ui:insert>
+ </f:facet>
+ </m:body>
+ </m:message>
+
+ <ui:insert name="successMessage">
+ <html>
+ <body>
+ <p>This email was sent directly from the view without invoking a bean - just link to a page which contains an <m:message> tag!</p>
+ <p>The email has been successfully sent. <s:link view="/index.xhtml">Click here</s:link> to return to the index.</p>
+ </body>
+ </html>
+ </ui:insert>
+
+</ui:composition>
\ No newline at end of file
Added: branches/enterprise/WFK-2_1/examples/mail/mail-ejb/src/test/resources/templating.xhtml
===================================================================
--- branches/enterprise/WFK-2_1/examples/mail/mail-ejb/src/test/resources/templating.xhtml (rev 0)
+++ branches/enterprise/WFK-2_1/examples/mail/mail-ejb/src/test/resources/templating.xhtml 2013-06-04 06:41:09 UTC (rev 15538)
@@ -0,0 +1,28 @@
+<ui:composition 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"
+ template="template.xhtml" importance="normal">
+
+ <ui:param name="subject" value="Templating with Seam Mail" />
+
+ <ui:define name="body">
+
+ <p>This email demonstrates that you can easily use <i>facelets templating features</i> in your code!</p>
+
+ <p>In fact you can use <b>any</b> JSF tags that you like!</p>
+
+ <p>Here's a dataTable</p>
+
+ <h:dataTable value="#{lists.daysOfWeek}" var="day">
+ <h:column>
+ <f:facet name="header">
+ Day
+ </f:facet>
+ <h:outputText value="#{day}" />
+ </h:column>
+ </h:dataTable>
+
+ </ui:define>
+
+</ui:composition>
\ No newline at end of file
Added: branches/enterprise/WFK-2_1/examples/mail/mail-ejb/src/test/resources/web.xml
===================================================================
--- branches/enterprise/WFK-2_1/examples/mail/mail-ejb/src/test/resources/web.xml (rev 0)
+++ branches/enterprise/WFK-2_1/examples/mail/mail-ejb/src/test/resources/web.xml 2013-06-04 06:41:09 UTC (rev 15538)
@@ -0,0 +1,64 @@
+<?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>
+
+ <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>
+
+ <context-param>
+ <param-name>com.sun.faces.allowTextChildren</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>
+
+ <servlet>
+ <servlet-name>Mail Servlet</servlet-name>
+ <servlet-class>org.jboss.seam.example.mail.MailSenderServlet</servlet-class>
+ <load-on-startup>1</load-on-startup>
+ </servlet>
+
+ <servlet-mapping>
+ <servlet-name>Mail Servlet</servlet-name>
+ <url-pattern>/mail/sender</url-pattern>
+ </servlet-mapping>
+
+ <session-config>
+ <session-timeout>10</session-timeout>
+ </session-config>
+
+</web-app>
Deleted: branches/enterprise/WFK-2_1/examples/mail/mail-tests/pom.xml
===================================================================
--- branches/enterprise/WFK-2_1/examples/mail/mail-tests/pom.xml 2013-06-04 06:09:08 UTC (rev 15537)
+++ branches/enterprise/WFK-2_1/examples/mail/mail-tests/pom.xml 2013-06-04 06:41:09 UTC (rev 15538)
@@ -1,193 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
- <modelVersion>4.0.0</modelVersion>
- <parent>
- <artifactId>mail</artifactId>
- <groupId>org.jboss.seam.examples</groupId>
- <version>2.3.1.Final-redhat-2</version>
- <relativePath>../pom.xml</relativePath>
- </parent>
-
- <groupId>org.jboss.seam.examples.mail</groupId>
- <artifactId>mail-tests</artifactId>
- <name>Mail Integration Tests Module (EE6)</name>
-
- <dependencies>
- <dependency>
- <groupId>org.jboss.seam.examples.mail</groupId>
- <artifactId>mail-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.jboss.seam</groupId>
- <artifactId>jboss-seam-mail</artifactId>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.jboss.seam</groupId>
- <artifactId>jboss-seam-pdf</artifactId>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.jboss.seam</groupId>
- <artifactId>jboss-seam-excel</artifactId>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.jboss.seam</groupId>
- <artifactId>jboss-seam-ui</artifactId>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>javax.mail</groupId>
- <artifactId>mail</artifactId>
- </dependency>
- <dependency>
- <groupId>org.seleniumhq.selenium</groupId>
- <artifactId>selenium-server</artifactId>
- </dependency>
- <dependency>
- <groupId>org.seleniumhq.selenium</groupId>
- <artifactId>selenium-java</artifactId>
- </dependency>
- <dependency>
- <groupId>org.subethamail</groupId>
- <artifactId>subethasmtp-wiser</artifactId>
- <version>1.2</version>
- </dependency>
-
- <dependency>
- <groupId>org.jboss.seam</groupId>
- <artifactId>functional-tests</artifactId>
- <scope>test</scope>
- </dependency>
-
- <dependency>
- <groupId>org.testng</groupId>
- <artifactId>testng</artifactId>
- </dependency>
-
- <dependency>
- <groupId>junit</groupId>
- <artifactId>junit</artifactId>
- <scope>test</scope>
- </dependency>
-
- <dependency>
- <groupId>org.jboss.arquillian.junit</groupId>
- <artifactId>arquillian-junit-container</artifactId>
- <scope>test</scope>
- </dependency>
-
- <dependency>
- <groupId>org.jboss.arquillian.protocol</groupId>
- <artifactId>arquillian-protocol-servlet</artifactId>
- <scope>test</scope>
- </dependency>
-
- <dependency>
- <groupId>org.jboss.spec.javax.el</groupId>
- <artifactId>jboss-el-api_2.2_spec</artifactId>
- <scope>runtime</scope>
- </dependency>
- </dependencies>
-
- <build>
- <testResources>
- <testResource>
- <directory>src/test/resources</directory>
- <filtering>true</filtering>
- </testResource>
- <testResource> <!-- this takes datasource mail-ds.xml -->
- <directory>${basedir}/../mail-ear/src/main/resources</directory>
- <filtering>true</filtering>
- </testResource>
- <testResource> <!-- this takes themes aka *.properties -->
- <directory>${basedir}/../mail-web/src/main/resources</directory>
- <filtering>true</filtering>
- </testResource>
- <testResource>
- <directory>src/test/resources-integration</directory>
- </testResource>
- </testResources>
- <plugins>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-surefire-plugin</artifactId>
- <configuration>
- <skip>true</skip>
- </configuration>
- </plugin>
- </plugins>
- </build>
-
- <profiles>
- <profile>
- <id>integration-tests</id>
- <activation>
- <property>
- <name>arquillian</name>
- </property>
- </activation>
- </profile>
-
- <profile>
- <id>arq-jbossas-7-managed</id>
- <activation>
- <property>
- <name>arquillian</name>
- <value>jbossas-managed-7</value>
- </property>
- </activation>
- <build>
- <plugins>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-dependency-plugin</artifactId>
- </plugin>
- </plugins>
- </build>
- </profile>
-
- <profile>
- <id>arq-jbossas-7-remote</id>
- <activation>
- <property>
- <name>arquillian</name>
- <value>jbossas-remote-7</value>
- </property>
- </activation>
- </profile>
-
- <profile>
- <id>ftest-jbossas</id>
- <properties>
- <example.context.path>seam-mail</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>
Deleted: branches/enterprise/WFK-2_1/examples/mail/mail-tests/src/test/java/org/jboss/seam/example/mail/test/MailTest.java
===================================================================
--- branches/enterprise/WFK-2_1/examples/mail/mail-tests/src/test/java/org/jboss/seam/example/mail/test/MailTest.java 2013-06-04 06:09:08 UTC (rev 15537)
+++ branches/enterprise/WFK-2_1/examples/mail/mail-tests/src/test/java/org/jboss/seam/example/mail/test/MailTest.java 2013-06-04 06:41:09 UTC (rev 15538)
@@ -1,529 +0,0 @@
-package org.jboss.seam.example.mail.test;
-
-import static javax.mail.Message.RecipientType.BCC;
-import static javax.mail.Message.RecipientType.CC;
-
-import java.io.File;
-import java.io.InputStream;
-
-import javax.faces.FacesException;
-import javax.faces.context.FacesContext;
-import javax.mail.internet.AddressException;
-import javax.mail.internet.InternetAddress;
-import javax.mail.internet.MimeBodyPart;
-import javax.mail.internet.MimeMessage;
-import javax.mail.internet.MimeMultipart;
-
-import org.jboss.shrinkwrap.api.Archive;
-import org.jboss.shrinkwrap.api.ShrinkWrap;
-import org.jboss.shrinkwrap.api.importer.ZipImporter;
-import org.jboss.shrinkwrap.api.spec.EnterpriseArchive;
-import org.jboss.shrinkwrap.api.spec.WebArchive;
-import org.jboss.arquillian.container.test.api.Deployment;
-import org.jboss.arquillian.container.test.api.OverProtocol;
-import org.jboss.arquillian.junit.Arquillian;
-
-import org.jboss.seam.Component;
-import org.jboss.seam.Seam;
-import org.jboss.seam.contexts.Contexts;
-import org.jboss.seam.contexts.Lifecycle;
-import org.jboss.seam.document.ByteArrayDocumentData;
-import org.jboss.seam.document.DocumentData;
-import org.jboss.seam.example.mail.Person;
-import org.jboss.seam.faces.Renderer;
-import org.jboss.seam.mail.MailSession;
-import org.jboss.seam.mail.ui.UIAttachment;
-import org.jboss.seam.mail.ui.UIMessage;
-import org.jboss.seam.mock.MockTransport;
-
-
-import org.junit.After;
-import org.junit.Before;
-import org.junit.Ignore;
-import org.junit.Test;
-import org.junit.Assert;
-import org.junit.runner.RunWith;
-
-/**
- * @author Pete Muir
- *
- */
-(a)RunWith(Arquillian.class)
-public class MailTest
-{
- @Deployment(name="MailTest")
- @OverProtocol("Servlet 3.0")
- public static Archive<?> createDeployment()
- {
- EnterpriseArchive er = ShrinkWrap.create(ZipImporter.class, "seam-mail.ear").importFrom(new File("../mail-ear/target/seam-mail.ear"))
- .as(EnterpriseArchive.class);
- WebArchive web = er.getAsType(WebArchive.class, "mail-web.war");
- web.addClasses(MailTest.class);
- web.addAsWebResource("org/jboss/seam/example/mail/test/errors1.xhtml", "org/jboss/seam/example/mail/test/errors1.xhtml");
- web.addAsWebResource("org/jboss/seam/example/mail/test/errors2.xhtml", "org/jboss/seam/example/mail/test/errors2.xhtml");
- web.addAsWebResource("org/jboss/seam/example/mail/test/errors3.xhtml", "org/jboss/seam/example/mail/test/errors3.xhtml");
- web.addAsWebResource("org/jboss/seam/example/mail/test/errors4.xhtml", "org/jboss/seam/example/mail/test/errors4.xhtml");
- web.addAsWebResource("org/jboss/seam/example/mail/test/sanitization.xhtml", "org/jboss/seam/example/mail/test/sanitization.xhtml");
-
- return er;
- }
-
- @Before
- public void before() {
- Lifecycle.beginCall();
- }
-
- @After
- public void after() {
- Lifecycle.endCall();
- }
-
- protected MimeMessage getRenderedMailMessage(String viewId)
- {
- Contexts.getApplicationContext().set(Seam.getComponentName(MailSession.class), new MailSession("mock").create());
- MockTransport.clearMailMessage();
- Renderer.instance().render(viewId);
- return MockTransport.getMailMessage();
- }
-
-
-
- @Test
- public void testSimple() throws Exception
- {
- Person person = (Person)Component.getInstance("person");
- person.setFirstname("Pete");
- person.setLastname("Muir");
- person.setAddress("test(a)example.com");
-
- MimeMessage renderedMessage = getRenderedMailMessage("/simple.xhtml");
- Assert.assertTrue(MailSession.instance().getTransport() instanceof MockTransport);
-
- // Test the headers
-
- Assert.assertNotNull(renderedMessage);
- Assert.assertEquals(renderedMessage.getAllRecipients().length, 1);
- Assert.assertTrue(renderedMessage.getAllRecipients()[0] instanceof InternetAddress);
- InternetAddress to = (InternetAddress) renderedMessage.getAllRecipients()[0];
- Assert.assertEquals(to.getAddress(), "test(a)example.com");
- Assert.assertEquals(to.getPersonal(), "Pete Muir");
- Assert.assertEquals(renderedMessage.getFrom().length, 1);
- Assert.assertTrue(renderedMessage.getFrom()[0] instanceof InternetAddress);
- InternetAddress from = (InternetAddress) renderedMessage.getFrom()[0];
- Assert.assertEquals(from.getAddress(), "peter(a)example.com");
- Assert.assertEquals(from.getPersonal(), "Peter");
- Assert.assertEquals(renderedMessage.getSubject(), "Try out Seam!");
- Assert.assertNull(renderedMessage.getHeader("Precedence"));
- Assert.assertNull(renderedMessage.getHeader("X-Priority"));
- Assert.assertNull(renderedMessage.getHeader("Priority"));
- Assert.assertNull(renderedMessage.getHeader("Importance"));
- Assert.assertNull(renderedMessage.getHeader("Disposition-Notification-To"));
-
- // Check the body
-
- Assert.assertNotNull(renderedMessage.getContent());
- Assert.assertTrue(renderedMessage.getContent() instanceof MimeMultipart);
- MimeMultipart body = (MimeMultipart) renderedMessage.getContent();
- Assert.assertEquals(body.getCount(), 1);
- Assert.assertNotNull(body.getBodyPart(0));
- Assert.assertTrue(body.getBodyPart(0) instanceof MimeBodyPart);
- MimeBodyPart bodyPart = (MimeBodyPart) body.getBodyPart(0);
- Assert.assertNotNull(bodyPart.getContent());
- Assert.assertEquals(bodyPart.getDisposition(), "inline");
- Assert.assertTrue(bodyPart.isMimeType("text/html"));
- }
-
- @Ignore
- @Test
- public void testAttachment() throws Exception
- {
- Person person = (Person)Component.getInstance("person");
- person.setFirstname("Gavin");
- person.setLastname("King");
- person.setAddress("gavin(a)king.com");
-
- MimeMessage renderedMessage = getRenderedMailMessage("/attachment.xhtml");
-
- // Test the headers
-
- InternetAddress to = (InternetAddress) renderedMessage.getAllRecipients()[0];
- Assert.assertEquals(to.getAddress(), "gavin(a)king.com");
- Assert.assertEquals(to.getPersonal(), "Gavin King");
- InternetAddress from = (InternetAddress) renderedMessage.getFrom()[0];
- Assert.assertEquals(from.getAddress(), "do-not-reply(a)jboss.com");
- Assert.assertEquals(from.getPersonal(), "Seam");
- Assert.assertEquals(renderedMessage.getSubject(), "Try out Seam!");
- MimeMultipart body = (MimeMultipart) renderedMessage.getContent();
-
- Assert.assertEquals(body.getCount(), 6); //3 Attachments and 1 MimeMultipart
-
- // The root multipart/related
- Assert.assertNotNull(body.getBodyPart(0));
- Assert.assertTrue(body.getBodyPart(0) instanceof MimeBodyPart);
- MimeBodyPart bodyPart = (MimeBodyPart) body.getBodyPart(0);
- Assert.assertNotNull(bodyPart.getContent());
- Assert.assertTrue(bodyPart.getContent() instanceof MimeMultipart);
- Assert.assertTrue(bodyPart.isMimeType("multipart/related"));
-
- MimeMultipart attachments = (MimeMultipart) bodyPart.getContent();
-
- Assert.assertEquals(attachments.getCount(), 3); //2 Attachments and 1 MimeMultipart
-
- // Attachment 0 (the actual message)
- Assert.assertNotNull(attachments.getBodyPart(0));
- Assert.assertTrue(attachments.getBodyPart(0) instanceof MimeBodyPart);
- bodyPart = (MimeBodyPart) attachments.getBodyPart(0);
- Assert.assertNotNull(bodyPart.getContent());
- Assert.assertNotNull(bodyPart.getContent());
- Assert.assertTrue(bodyPart.isMimeType("text/html"));
- Assert.assertEquals(bodyPart.getDisposition(), "inline");
-
- // Inline Attachment 1 // Attachment Jboss Logo
- Assert.assertNotNull(attachments.getBodyPart(1));
- Assert.assertTrue(attachments.getBodyPart(1) instanceof MimeBodyPart);
- bodyPart = (MimeBodyPart) attachments.getBodyPart(1);
- Assert.assertNotNull(bodyPart.getContent());
- Assert.assertTrue(bodyPart.getContent() instanceof InputStream);
- Assert.assertEquals(bodyPart.getFileName(), "jboss.jpg");
-
- Assert.assertTrue(bodyPart.isMimeType("image/jpeg"));
- Assert.assertEquals(bodyPart.getDisposition(), "inline");
- Assert.assertNotNull(bodyPart.getContentID());
-
- // Inline Attachment 1 // Attachment Gavin Pic
- Assert.assertNotNull(attachments.getBodyPart(2));
- Assert.assertTrue(attachments.getBodyPart(2) instanceof MimeBodyPart);
- bodyPart = (MimeBodyPart) attachments.getBodyPart(2);
- Assert.assertNotNull(bodyPart.getContent());
- Assert.assertTrue(bodyPart.getContent() instanceof InputStream);
- Assert.assertEquals(bodyPart.getFileName(), "Gavin_King.jpg");
- Assert.assertTrue(bodyPart.isMimeType("image/png"));
- Assert.assertEquals(bodyPart.getDisposition(), "inline");
- Assert.assertNotNull(bodyPart.getContentID());
-
- // Root Attachment 0
- Assert.assertNotNull(body.getBodyPart(1));
- Assert.assertTrue(body.getBodyPart(1) instanceof MimeBodyPart);
- bodyPart = (MimeBodyPart) body.getBodyPart(1);
- Assert.assertNotNull(bodyPart.getContent());
- Assert.assertTrue( bodyPart.getContent() instanceof InputStream);
- Assert.assertEquals(bodyPart.getFileName(), "numbers.csv");
- Assert.assertTrue(bodyPart.isMimeType("content/unknown"));
- Assert.assertEquals(bodyPart.getDisposition(), "attachment");
- Assert.assertNull(bodyPart.getContentID());
-
- // Root Attachment 1
- Assert.assertNotNull(body.getBodyPart(2));
- Assert.assertTrue(body.getBodyPart(2) instanceof MimeBodyPart);
- bodyPart = (MimeBodyPart) body.getBodyPart(2);
- Assert.assertNotNull(bodyPart.getContent());
- Assert.assertTrue(bodyPart.getContent() instanceof String);
- Assert.assertEquals(bodyPart.getFileName(), "whyseam.pdf");
- Assert.assertEquals(bodyPart.getDisposition(), "attachment");
- Assert.assertNull(bodyPart.getContentID());
-
- // Root Attachment 3
- Assert.assertNotNull(body.getBodyPart(3));
- Assert.assertTrue(body.getBodyPart(3) instanceof MimeBodyPart);
- bodyPart = (MimeBodyPart) body.getBodyPart(3);
- Assert.assertNotNull(bodyPart.getContent());
- Assert.assertEquals(bodyPart.getFileName(), "excel.xls");
- Assert.assertTrue(bodyPart.isMimeType("application/vnd.ms-excel"));
- Assert.assertEquals(bodyPart.getDisposition(), "attachment");
- Assert.assertNull(bodyPart.getContentID());
-
- }
-
- @Test
- public void testPdfAttachment() throws Exception
- {
- UIAttachment attachment = new UIAttachment();
- attachment.setFileName("filename.pdf");
- UIMessage message = new UIMessage();
- attachment.setParent(message);
- message.setMailSession(MailSession.instance());
- DocumentData doc = new ByteArrayDocumentData("filename", new DocumentData.DocumentType("pdf", "application/pdf"), new byte[] {});
- attachment.setValue(doc);
- attachment.encodeEnd(FacesContext.getCurrentInstance());
-
- // verify we built the message
- Assert.assertEquals(message.getAttachments().size(), 1);
- MimeBodyPart bodyPart = message.getAttachments().get(0);
- Assert.assertEquals(bodyPart.getFileName(), "filename.pdf");
- Assert.assertEquals(bodyPart.getDisposition(),"attachment");
- }
-
- @Test
- public void testHtml() throws Exception
- {
- Person person = (Person)Component.getInstance("person");
- person.setFirstname("Pete");
- person.setLastname("Muir");
- person.setAddress("test(a)example.com");
-
- MimeMessage renderedMessage = getRenderedMailMessage("/html.xhtml");
-
- // Test the standard headers
-
- InternetAddress to = (InternetAddress) renderedMessage.getAllRecipients()[0];
- Assert.assertEquals(to.getAddress(), "test(a)example.com");
- Assert.assertEquals(to.getPersonal(), "Pete Muir");
- InternetAddress from = (InternetAddress) renderedMessage.getFrom()[0];
- Assert.assertEquals(from.getAddress(), "do-not-reply(a)jboss.com");
- Assert.assertEquals(from.getPersonal(), "Seam");
- Assert.assertEquals(renderedMessage.getSubject(), "Seam Mail");
-
- // Test the extra headers
-
- // Importance
- Assert.assertNotNull(renderedMessage.getHeader("X-Priority"));
- Assert.assertNotNull(renderedMessage.getHeader("Priority"));
- Assert.assertNotNull(renderedMessage.getHeader("Importance"));
- Assert.assertEquals(renderedMessage.getHeader("X-Priority").length, 1);
- Assert.assertEquals(renderedMessage.getHeader("Priority").length, 1);
- Assert.assertEquals(renderedMessage.getHeader("Importance").length, 1);
- Assert.assertEquals(renderedMessage.getHeader("X-Priority")[0], "5");
- Assert.assertEquals(renderedMessage.getHeader("Priority")[0], "Non-urgent");
- Assert.assertEquals(renderedMessage.getHeader("Importance")[0], "low");
-
- // read receipt
- Assert.assertNotNull(renderedMessage.getHeader("Disposition-Notification-To"));
- Assert.assertEquals(renderedMessage.getHeader("Disposition-Notification-To").length, 1);
- Assert.assertEquals(renderedMessage.getHeader("Disposition-Notification-To")[0], "Seam <do-not-reply(a)jboss.com>");
-
- // m:header
- Assert.assertNotNull(renderedMessage.getHeader("X-Sent-From"));
- Assert.assertEquals(renderedMessage.getHeader("X-Sent-From").length, 1);
- Assert.assertEquals(renderedMessage.getHeader("X-Sent-From")[0], "Seam");
-
- MimeMultipart body = (MimeMultipart) renderedMessage.getContent();
-
- // Check the alternative facet
- Assert.assertTrue(renderedMessage.getContentType().startsWith("multipart/mixed"));
- Assert.assertEquals(body.getCount(), 1);
- MimeBodyPart bodyPart = (MimeBodyPart) body.getBodyPart(0);
- Assert.assertTrue(bodyPart.getContentType().startsWith("multipart/alternative"));
- Assert.assertTrue(bodyPart.getContent() instanceof MimeMultipart);
- MimeMultipart bodyParts = (MimeMultipart) bodyPart.getContent();
- Assert.assertEquals(bodyParts.getCount(), 2);
- Assert.assertTrue(bodyParts.getBodyPart(0) instanceof MimeBodyPart);
- Assert.assertTrue(bodyParts.getBodyPart(1) instanceof MimeBodyPart);
- MimeBodyPart alternative = (MimeBodyPart) bodyParts.getBodyPart(0);
- MimeBodyPart html = (MimeBodyPart) bodyParts.getBodyPart(1);
- Assert.assertTrue(alternative.isMimeType("text/plain"));
- Assert.assertEquals(alternative.getDisposition(), "inline");
- Assert.assertTrue(html.isMimeType("text/html"));
- }
-
-
- @Test
- public void testPlain() throws Exception
- {
- Person person = (Person)Component.getInstance("person");
- person.setFirstname("Pete");
- person.setLastname("Muir");
- person.setAddress("test(a)example.com");
-
- MimeMessage renderedMessage = getRenderedMailMessage("/plain.xhtml");
-
- // Test the standard headers
-
- InternetAddress to = (InternetAddress) renderedMessage.getAllRecipients()[0];
- Assert.assertEquals(to.getAddress(), "test(a)example.com");
- Assert.assertEquals(to.getPersonal(), "Pete Muir");
- InternetAddress from = (InternetAddress) renderedMessage.getFrom()[0];
- Assert.assertEquals(from.getAddress(), "do-not-reply(a)jboss.com");
- Assert.assertEquals(from.getPersonal(), "Seam");
- Assert.assertEquals(renderedMessage.getReplyTo().length, 1);
- Assert.assertTrue(renderedMessage.getReplyTo()[0] instanceof InternetAddress);
- InternetAddress replyTo = (InternetAddress) renderedMessage.getReplyTo()[0];
- Assert.assertEquals(replyTo.getAddress(), "another.address(a)jboss.org");
- Assert.assertEquals(replyTo.getPersonal(), "JBoss");
- Assert.assertEquals(renderedMessage.getRecipients(CC).length, 1);
- Assert.assertTrue(renderedMessage.getRecipients(CC)[0] instanceof InternetAddress);
- InternetAddress cc = (InternetAddress) renderedMessage.getRecipients(CC)[0];
- Assert.assertEquals(cc.getAddress(), "test(a)example.com");
- Assert.assertEquals(cc.getPersonal(), "Pete Muir");
- Assert.assertEquals(renderedMessage.getRecipients(BCC).length, 1);
- Assert.assertTrue(renderedMessage.getRecipients(BCC)[0] instanceof InternetAddress);
- InternetAddress bcc = (InternetAddress) renderedMessage.getRecipients(CC)[0];
- Assert.assertEquals(bcc.getAddress(), "test(a)example.com");
- Assert.assertEquals(bcc.getPersonal(), "Pete Muir");
- Assert.assertEquals(renderedMessage.getHeader("Precedence")[0], "bulk");
- // Importance
- Assert.assertNotNull(renderedMessage.getHeader("X-Priority"));
- Assert.assertNotNull(renderedMessage.getHeader("Priority"));
- Assert.assertNotNull(renderedMessage.getHeader("Importance"));
- Assert.assertEquals(renderedMessage.getHeader("X-Priority").length, 1);
- Assert.assertEquals(renderedMessage.getHeader("Priority").length, 1);
- Assert.assertEquals(renderedMessage.getHeader("Importance").length, 1);
- Assert.assertEquals(renderedMessage.getHeader("X-Priority")[0], "1");
- Assert.assertEquals(renderedMessage.getHeader("Priority")[0], "Urgent");
- Assert.assertEquals(renderedMessage.getHeader("Importance")[0], "high");
- Assert.assertEquals(renderedMessage.getSubject(), "Plain text email sent by Seam");
-
- // Check the body
-
- Assert.assertNotNull(renderedMessage.getContent());
- MimeMultipart body = (MimeMultipart) renderedMessage.getContent();
- Assert.assertEquals(body.getCount(), 1);
- MimeBodyPart bodyPart = (MimeBodyPart) body.getBodyPart(0);
- Assert.assertNotNull(bodyPart.getContent());
- Assert.assertEquals(bodyPart.getDisposition(), "inline");
- Assert.assertTrue(bodyPart.isMimeType("text/plain"));
-
- }
-
- @Test
- public void testAttachmentErrors() throws Exception
- {
- Person person = (Person)Component.getInstance("person");
- person.setFirstname("Pete");
- person.setLastname("Muir");
- person.setAddress("test(a)example.com");
-
- // Test for an unavailable attachment
-
- Contexts.getEventContext().set("attachment", "/foo.pdf");
-
- }
-
- @Test
- public void testAddressValidation() throws Exception
- {
- Person person = (Person)Component.getInstance("person");
- person.setFirstname("Pete");
- person.setLastname("Muir");
- boolean exceptionThrown = false;
- person.setAddress("testexample.com");
-
- try
- {
- getRenderedMailMessage("/org/jboss/seam/example/mail/test/errors2.xhtml");
- }
- catch (FacesException e)
- {
- Assert.assertTrue(e.getCause() instanceof AddressException);
- AddressException ae = (AddressException) e.getCause();
- Assert.assertTrue(ae.getMessage().startsWith("Missing final '@domain'"));
- exceptionThrown = true;
- }
- Assert.assertTrue(exceptionThrown);
-
- }
-
-
- //JBSEAM-2109
- //@Test
- public void testReplyToErrors() throws Exception
- {
- Person person = (Person)Component.getInstance("person");
- person.setFirstname("Pete");
- person.setLastname("Muir");
- person.setAddress("test(a)example.com");
-
- boolean exceptionThrown = false;
-
- try
- {
- getRenderedMailMessage("/org/jboss/seam/example/mail/test/errors3.xhtml");
- }
- catch (Exception e)
- {
- Assert.assertTrue(e.getCause() instanceof AddressException);
- AddressException ae = (AddressException) e.getCause();
- System.out.println(ae.getMessage());
- Assert.assertTrue(ae.getMessage().startsWith("Email cannot have more than one Reply-to address"));
- exceptionThrown = true;
- }
- Assert.assertTrue(exceptionThrown);
- }
-
- @Test
- public void testFromErrors() throws Exception
- {
- Person person = (Person)Component.getInstance("person");
- person.setFirstname("Pete");
- person.setLastname("Muir");
- person.setAddress("test(a)example.com");
-
- boolean exceptionThrown = false;
-
- try
- {
- getRenderedMailMessage("/org/jboss/seam/example/mail/test/errors4.xhtml");
- }
- catch (FacesException e)
- {
- Assert.assertTrue(e.getCause() instanceof AddressException);
- AddressException ae = (AddressException) e.getCause();
- Assert.assertTrue(ae.getMessage().startsWith("Email cannot have more than one from address"));
- exceptionThrown = true;
- }
- Assert.assertTrue(exceptionThrown);
- }
-
- @Test
- public void testSanitization() throws Exception
- {
- Contexts.getEventContext().set("name", "Pete\nMuir");
- MimeMessage renderedMessage = getRenderedMailMessage("/org/jboss/seam/example/mail/test/sanitization.xhtml");
- Assert.assertEquals(renderedMessage.getSubject(), "Try out Seam!");
- InternetAddress to = (InternetAddress) renderedMessage.getAllRecipients()[0];
- Assert.assertEquals(to.getAddress(), "peter(a)email.tld");
- Assert.assertEquals(to.getPersonal(), "Pete");
- Assert.assertEquals(renderedMessage.getFrom().length, 1);
- Assert.assertTrue(renderedMessage.getFrom()[0] instanceof InternetAddress);
- InternetAddress from = (InternetAddress) renderedMessage.getFrom()[0];
- Assert.assertEquals(from.getAddress(), "peter(a)example.com");
- Assert.assertEquals(from.getPersonal(), "Pete");
- Assert.assertNotNull(renderedMessage.getHeader("Pete"));
- Assert.assertEquals(renderedMessage.getHeader("Pete").length, 1);
- Assert.assertEquals(renderedMessage.getHeader("Pete")[0], "roll over");
- }
-
- @Test
- public void testTemplating() throws Exception
- {
- Person person = (Person)Component.getInstance("person");
- person.setFirstname("Pete");
- person.setLastname("Muir");
- person.setAddress("test(a)example.com");
-
- MimeMessage renderedMessage = getRenderedMailMessage("/templating.xhtml");
-
- // Test the standard headers
-
- InternetAddress to = (InternetAddress) renderedMessage.getAllRecipients()[0];
- Assert.assertEquals(to.getAddress(), "test(a)example.com");
- Assert.assertEquals(to.getPersonal(), "Pete Muir");
- InternetAddress from = (InternetAddress) renderedMessage.getFrom()[0];
- Assert.assertEquals(from.getAddress(), "do-not-reply(a)jboss.com");
- Assert.assertEquals(from.getPersonal(), "Seam");
- Assert.assertEquals(renderedMessage.getSubject(), "Templating with Seam Mail");
- Assert.assertNull(renderedMessage.getHeader("X-Priority"));
- Assert.assertNull(renderedMessage.getHeader("Priority"));
- Assert.assertNull(renderedMessage.getHeader("Importance"));
-
- // Check the body
-
- MimeMultipart body = (MimeMultipart) renderedMessage.getContent();
-
- // Check the alternative facet
- Assert.assertTrue(renderedMessage.getContentType().startsWith("multipart/mixed"));
- Assert.assertEquals(body.getCount(), 1);
- MimeBodyPart bodyPart = (MimeBodyPart) body.getBodyPart(0);
- Assert.assertTrue(bodyPart.getContentType().startsWith("multipart/alternative"));
- Assert.assertTrue(bodyPart.getContent() instanceof MimeMultipart);
- MimeMultipart bodyParts = (MimeMultipart) bodyPart.getContent();
- Assert.assertEquals(bodyParts.getCount(), 2);
- Assert.assertTrue(bodyParts.getBodyPart(0) instanceof MimeBodyPart);
- Assert.assertTrue(bodyParts.getBodyPart(1) instanceof MimeBodyPart);
- MimeBodyPart alternative = (MimeBodyPart) bodyParts.getBodyPart(0);
- MimeBodyPart html = (MimeBodyPart) bodyParts.getBodyPart(1);
- Assert.assertTrue(alternative.isMimeType("text/plain"));
- Assert.assertEquals(alternative.getDisposition(), "inline");
- Assert.assertTrue(html.isMimeType("text/html"));
- Assert.assertEquals(html.getDisposition(), "inline");
- }
-}
Deleted: branches/enterprise/WFK-2_1/examples/mail/mail-tests/src/test/java/org/jboss/seam/example/mail/test/selenium/SeleniumMailTest.java
===================================================================
--- branches/enterprise/WFK-2_1/examples/mail/mail-tests/src/test/java/org/jboss/seam/example/mail/test/selenium/SeleniumMailTest.java 2013-06-04 06:09:08 UTC (rev 15537)
+++ branches/enterprise/WFK-2_1/examples/mail/mail-tests/src/test/java/org/jboss/seam/example/mail/test/selenium/SeleniumMailTest.java 2013-06-04 06:41:09 UTC (rev 15538)
@@ -1,148 +0,0 @@
-package org.jboss.seam.example.mail.test.selenium;
-
-import org.jboss.seam.example.common.test.selenium.SeamSeleniumTest;
-import org.subethamail.wiser.Wiser;
-import org.subethamail.wiser.WiserMessage;
-import org.testng.annotations.AfterMethod;
-import org.testng.annotations.BeforeMethod;
-import org.testng.annotations.DataProvider;
-import org.testng.annotations.Test;
-import static org.testng.AssertJUnit.assertEquals;
-import static org.testng.AssertJUnit.assertTrue;
-import static org.testng.AssertJUnit.assertFalse;
-
-public class SeleniumMailTest extends SeamSeleniumTest
-{
- public static final String HOME_PAGE = "/index.seam";
- public static final String HOME_PAGE_TITLE = "Seam Mail";
- public static final String ENVELOPE_SENDER = "peter@example.com|do-not-reply(a)jboss.com";
-
- public static final String FIRSTNAME_INPUT = "id=emailform:firstname";
- public static final String FIRSTNAME = "John";
- public static final String LASTNAME_INPUT = "id=emailform:lastname";
- public static final String LASTNAME = "Smith";
- public static final String ADDRESS_INPUT = "id=emailform:address";
- public static final String ADDRESS = "john.smith@localhost";
- public static final String SERVLET_NAME_INPUT = "id=name";
- public static final String SERVLET_ADDRESS_INPUT = "id=email";
-
- public static final String SEND_SIMPLE_BUTTON = "id=emailform:sendSimple";
- public static final String SEND_PLAIN_BUTTON = "id=emailform:sendPlain";
- public static final String SEND_HTML_BUTTON = "id=emailform:sendHtml";
- public static final String SEND_ATTACHMENT_BUTTON = "id=emailform:sendAttachment";
- public static final String SEND_ASYNCHRONOUS_BUTTON = "id=emailform:sendAsynchronous";
- public static final String SEND_TEMPLATE_BUTTON = "id=emailform:sendTemplate";
- public static final String SEND_SERVLET_BUTTON = "id=sendServlet";
-
- protected Wiser wiser;
-
- @BeforeMethod
- @Override
- public void setUp()
- {
- super.setUp();
- browser.open(CONTEXT_PATH + HOME_PAGE);
- }
-
- /**
- * We restart SMTP after each Method, because Wiser doesn't have mechanism to flush recieved emails.
- */
- @BeforeMethod
- public void startSMTP()
- {
- wiser = new Wiser();
- wiser.setPort(2525);
- wiser.start();
- }
-
- @AfterMethod
- public void stopSMTP()
- {
- wiser.stop();
- }
-
- /**
- * Place holder - just verifies that example deploys
- */
- @Test
- public void homePageLoadTest()
- {
- assertEquals("Unexpected page title.", HOME_PAGE_TITLE, browser.getTitle());
- }
-
- @DataProvider(name = "sendMethods")
- public Object[][] mailTest() {
- return new Object[][] {
- {SEND_SIMPLE_BUTTON, new String[] {"Content-Type: text/html; charset=ISO-8859-1", "Content-Disposition: inline", "<p>Dear " + FIRSTNAME + ",</p>"}},
- {SEND_PLAIN_BUTTON, new String[] {"This is a plain text, email."}},
- {SEND_HTML_BUTTON, new String[] {"Subject: Seam Mail", "Content-Type: multipart/mixed;", "Content-Type: multipart/alternative;", "Content-Type: text/plain; charset=ISO-8859-1", "This is the alternative text body for mail readers that don't support html", "Content-Type: text/html; charset=ISO-8859-1", "<p>This is an example <i>HTML</i> email sent by Seam.</p>"}},
- {SEND_ATTACHMENT_BUTTON, new String[] {"Content-Type: multipart/mixed;","Content-Type: application/octet-stream; name=jboss.jpg", "/9j/4AAQSkZJRgABA"/*jpeg start*/, "Content-Type: application/octet-stream; name=numbers.csv", "3,Three,treis,trois", "Content-Type: image/png; name=" + FIRSTNAME + "_" + LASTNAME + ".jpg", "iVBORw0KGgo" /*png start*/ }},
- {SEND_ASYNCHRONOUS_BUTTON, new String[] {"Content-Type: multipart/mixed;", "Content-Type: text/html; charset=ISO-8859-1", "Content-Disposition: inline", "<p>Dear " + FIRSTNAME + ",</p>"}},
- {SEND_TEMPLATE_BUTTON, new String[] {"Subject: Templating with Seam Mail", "Content-Type: multipart/mixed;", "Content-Type: multipart/alternative;", "Content-Type: text/plain; charset=ISO-8859-1", "Sorry, your mail reader doesn't support html.", "Content-Type: text/html; charset=ISO-8859-1", "<p>Here's a dataTable</p><table>", "<td>Saturday</td>"}},
- {SEND_SERVLET_BUTTON, new String[] {"Content-Type: multipart/mixed;", "Content-Disposition: inline", "Dear John Smith,", "This is a plain text, email."}}
- };
- }
-
- /**
- * Sends a mail and verifies it was delivered
- */
- @Test(dataProvider = "sendMethods")
- public void mailTest(String buttonToClick, String[] expectedMessageContents) {
- fillInInputs();
- sendEmail(buttonToClick);
- checkDelivered(expectedMessageContents);
- }
-
- /**
- * Fills in html text inputs.
- */
- private void fillInInputs()
- {
- browser.type(FIRSTNAME_INPUT, FIRSTNAME);
- browser.type(LASTNAME_INPUT, LASTNAME);
- browser.type(ADDRESS_INPUT, ADDRESS);
- browser.type(SERVLET_NAME_INPUT, FIRSTNAME + " " + LASTNAME);
- browser.type(SERVLET_ADDRESS_INPUT, ADDRESS);
- }
-
- /**
- * Sends an email by clicking on specified button. If the send method is asynchronous,
- * waits for the associated action to take place. It assures that the email was sent
- * by verifying appropriate message.
- * @param buttonToClick
- */
- private void sendEmail(String buttonToClick)
- {
- browser.clickAndWait(buttonToClick);
- if (buttonToClick.equals(SEND_ASYNCHRONOUS_BUTTON)) {
- assertTrue(browser.isTextPresent("Seam Email")); // asynchronous email send produces no message, so we just check that we didn't end up on a debug page
- try
- {
- Thread.sleep(4000);
- }
- catch (InterruptedException e)
- {
- e.printStackTrace();
- }
- } else {
- assertTrue("Expected message about successfuly sent mail. See also JBSEAM-3769.", browser.isTextPresent("Email sent successfully"));
- }
- }
-
- /**
- * Checks that the expected email was delivered.
- * @param expectedMessageContents
- */
- private void checkDelivered(String[] expectedMessageContents)
- {
- assertFalse("Expected a message", wiser.getMessages().isEmpty());
- WiserMessage message = wiser.getMessages().get(0); // although "send plain text" example sends 3 mails (To:, CC:, Bcc:) Wiser cannot distinquish between them so we just check the first mail.
- assertEquals(ADDRESS, message.getEnvelopeReceiver());
- assertTrue("Envelope sender (" + message.getEnvelopeSender() + ") doesn't match expected one (" + ENVELOPE_SENDER + ")", message.getEnvelopeSender().matches(ENVELOPE_SENDER));
-
- for (String expectedMessageContent: expectedMessageContents) {
- assertTrue("Didn't find expected text (" + expectedMessageContent + ") in the received email.", new String(message.getData()).contains(expectedMessageContent));
- }
- }
-
-}
Deleted: branches/enterprise/WFK-2_1/examples/mail/mail-tests/src/test/resources/org/jboss/seam/example/mail/test/errors1.xhtml
===================================================================
--- branches/enterprise/WFK-2_1/examples/mail/mail-tests/src/test/resources/org/jboss/seam/example/mail/test/errors1.xhtml 2013-06-04 06:09:08 UTC (rev 15537)
+++ branches/enterprise/WFK-2_1/examples/mail/mail-tests/src/test/resources/org/jboss/seam/example/mail/test/errors1.xhtml 2013-06-04 06:41:09 UTC (rev 15538)
@@ -1,10 +0,0 @@
-<m:message xmlns="http://www.w3.org/1999/xhtml"
- xmlns:m="http://jboss.org/schema/seam/mail"
- xmlns:h="http://java.sun.com/jsf/html">
-
- <m:from name="Peter">peter(a)example.com</m:from>
- <m:to name="Peter">peter(a)email.tld</m:to>
- <m:subject>Try out Seam!</m:subject>
- <m:attachment value="#{attachment}" />
- <m:body>A mail message to test exception handling</m:body>
-</m:message>
\ No newline at end of file
Deleted: branches/enterprise/WFK-2_1/examples/mail/mail-tests/src/test/resources/org/jboss/seam/example/mail/test/errors2.xhtml
===================================================================
--- branches/enterprise/WFK-2_1/examples/mail/mail-tests/src/test/resources/org/jboss/seam/example/mail/test/errors2.xhtml 2013-06-04 06:09:08 UTC (rev 15537)
+++ branches/enterprise/WFK-2_1/examples/mail/mail-tests/src/test/resources/org/jboss/seam/example/mail/test/errors2.xhtml 2013-06-04 06:41:09 UTC (rev 15538)
@@ -1,9 +0,0 @@
-<m:message xmlns="http://www.w3.org/1999/xhtml"
- xmlns:m="http://jboss.org/schema/seam/mail"
- xmlns:h="http://java.sun.com/jsf/html">
-
- <m:from name="Peter" address="peter(a)example.com" />
- <m:to name="#{person.firstname} #{person.lastname}">#{person.address}</m:to>
- <m:subject>Try out Seam!</m:subject>
- <m:body>A mail message to test exception handling</m:body>
-</m:message>
\ No newline at end of file
Deleted: branches/enterprise/WFK-2_1/examples/mail/mail-tests/src/test/resources/org/jboss/seam/example/mail/test/errors3.xhtml
===================================================================
--- branches/enterprise/WFK-2_1/examples/mail/mail-tests/src/test/resources/org/jboss/seam/example/mail/test/errors3.xhtml 2013-06-04 06:09:08 UTC (rev 15537)
+++ branches/enterprise/WFK-2_1/examples/mail/mail-tests/src/test/resources/org/jboss/seam/example/mail/test/errors3.xhtml 2013-06-04 06:41:09 UTC (rev 15538)
@@ -1,11 +0,0 @@
-<m:message xmlns="http://www.w3.org/1999/xhtml"
- xmlns:m="http://jboss.org/schema/seam/mail"
- xmlns:h="http://java.sun.com/jsf/html">
-
- <m:replyTo address="foo(a)bar.com" />
- <m:replyTo address="bar(a)bar.com" />
- <m:from name="Peter" address="peter(a)example.com" />
- <m:to name="#{person.firstname} #{person.lastname}">#{person.address}</m:to>
- <m:subject>Try out Seam!</m:subject>
- <m:body>A mail message to test exception handling</m:body>
-</m:message>
\ No newline at end of file
Deleted: branches/enterprise/WFK-2_1/examples/mail/mail-tests/src/test/resources/org/jboss/seam/example/mail/test/errors4.xhtml
===================================================================
--- branches/enterprise/WFK-2_1/examples/mail/mail-tests/src/test/resources/org/jboss/seam/example/mail/test/errors4.xhtml 2013-06-04 06:09:08 UTC (rev 15537)
+++ branches/enterprise/WFK-2_1/examples/mail/mail-tests/src/test/resources/org/jboss/seam/example/mail/test/errors4.xhtml 2013-06-04 06:41:09 UTC (rev 15538)
@@ -1,10 +0,0 @@
-<m:message xmlns="http://www.w3.org/1999/xhtml"
- xmlns:m="http://jboss.org/schema/seam/mail"
- xmlns:h="http://java.sun.com/jsf/html">
-
- <m:from address="bar(a)bar.com" />
- <m:from name="Peter" address="peter(a)example.com" />
- <m:to name="#{person.firstname} #{person.lastname}">#{person.address}</m:to>
- <m:subject>Try out Seam!</m:subject>
- <m:body>A mail message to test exception handling</m:body>
-</m:message>
\ No newline at end of file
Deleted: branches/enterprise/WFK-2_1/examples/mail/mail-tests/src/test/resources/org/jboss/seam/example/mail/test/sanitization.xhtml
===================================================================
--- branches/enterprise/WFK-2_1/examples/mail/mail-tests/src/test/resources/org/jboss/seam/example/mail/test/sanitization.xhtml 2013-06-04 06:09:08 UTC (rev 15537)
+++ branches/enterprise/WFK-2_1/examples/mail/mail-tests/src/test/resources/org/jboss/seam/example/mail/test/sanitization.xhtml 2013-06-04 06:41:09 UTC (rev 15538)
@@ -1,14 +0,0 @@
-<m:message xmlns="http://www.w3.org/1999/xhtml"
- xmlns:m="http://jboss.org/schema/seam/mail"
- xmlns:h="http://java.sun.com/jsf/html">
-
- <m:from name="#{name}">peter(a)example.com
-foo</m:from>
- <m:to name="#{name}">peter(a)email.tld
-bar</m:to>
- <m:subject>Try out
- Seam!</m:subject>
- <m:header name="#{name}">roll
- over</m:header>
- <m:body>A mail message to test sanitization</m:body>
-</m:message>
\ No newline at end of file
Deleted: branches/enterprise/WFK-2_1/examples/mail/mail-tests/src/test/resources-ftest/testng.xml
===================================================================
--- branches/enterprise/WFK-2_1/examples/mail/mail-tests/src/test/resources-ftest/testng.xml 2013-06-04 06:09:08 UTC (rev 15537)
+++ branches/enterprise/WFK-2_1/examples/mail/mail-tests/src/test/resources-ftest/testng.xml 2013-06-04 06:41:09 UTC (rev 15538)
@@ -1,26 +0,0 @@
-
- <!--
- JBoss, Home of Professional Open Source Copyright 2008, Red Hat
- Middleware LLC, and individual contributors by the @authors tag. See
- the copyright.txt in the distribution for a full listing of individual
- contributors. This is free software; you can redistribute it and/or
- modify it under the terms of the GNU Lesser General Public License as
- published by the Free Software Foundation; either version 2.1 of the
- License, or (at your option) any later version. This software is
- distributed in the hope that it will be useful, but WITHOUT ANY
- WARRANTY; without even the implied warranty of MERCHANTABILITY or
- FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
- License for more details. You should have received a copy of the GNU
- Lesser General Public License along with this software; if not, write
- to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
- Boston, MA 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- -->
-<!DOCTYPE suite SYSTEM "http://beust.com/testng/testng-1.0.dtd" >
-<suite name="Mail example" verbose="2" parallel="false">
- <test name="mail_jboss">
- <parameter name="PROPERTY_FILE" value="" />
- <classes>
- <class name="org.jboss.seam.example.mail.test.selenium.SeleniumMailTest" />
- </classes>
- </test>
-</suite>
Deleted: branches/enterprise/WFK-2_1/examples/mail/mail-tests/src/test/resources-integration/arquillian.xml
===================================================================
--- branches/enterprise/WFK-2_1/examples/mail/mail-tests/src/test/resources-integration/arquillian.xml 2013-06-04 06:09:08 UTC (rev 15537)
+++ branches/enterprise/WFK-2_1/examples/mail/mail-tests/src/test/resources-integration/arquillian.xml 2013-06-04 06:41:09 UTC (rev 15538)
@@ -1,16 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<arquillian xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xmlns="http://jboss.org/schema/arquillian"
- xsi:schemaLocation="http://jboss.org/schema/arquillian http://jboss.org/schema/arquillian/arquillian_1_0.xsd">
-
- <engine>
- <property name="deploymentExportPath">target/</property>
- </engine>
-
- <container qualifier="jboss" default="true">
- <configuration>
- <property name="javaVmArguments">-Xmx1024m -XX:MaxPermSize=512m ${jacoco.agent}</property>
- </configuration>
- </container>
-
-</arquillian>
Deleted: branches/enterprise/WFK-2_1/examples/mail/mail-tests/src/test/resources-integration/web.xml
===================================================================
--- branches/enterprise/WFK-2_1/examples/mail/mail-tests/src/test/resources-integration/web.xml 2013-06-04 06:09:08 UTC (rev 15537)
+++ branches/enterprise/WFK-2_1/examples/mail/mail-tests/src/test/resources-integration/web.xml 2013-06-04 06:41:09 UTC (rev 15538)
@@ -1,12 +0,0 @@
-<?xml version="1.0" ?>
-
-<web-app version="3.0"
- xmlns="http://java.sun.com/xml/ns/javaee"
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd">
-
- <listener>
- <listener-class>org.jboss.seam.mock.MockSeamListener</listener-class>
- </listener>
-
-</web-app>
Modified: branches/enterprise/WFK-2_1/examples/mail/mail-web/pom.xml
===================================================================
--- branches/enterprise/WFK-2_1/examples/mail/mail-web/pom.xml 2013-06-04 06:09:08 UTC (rev 15537)
+++ branches/enterprise/WFK-2_1/examples/mail/mail-web/pom.xml 2013-06-04 06:41:09 UTC (rev 15538)
@@ -75,6 +75,7 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-war-plugin</artifactId>
+ <version>${version.war.plugin}</version>
<configuration>
<webResources>
<resource>
Modified: branches/enterprise/WFK-2_1/examples/mail/pom.xml
===================================================================
--- branches/enterprise/WFK-2_1/examples/mail/pom.xml 2013-06-04 06:09:08 UTC (rev 15537)
+++ branches/enterprise/WFK-2_1/examples/mail/pom.xml 2013-06-04 06:41:09 UTC (rev 15538)
@@ -1,47 +1,134 @@
<?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">
+<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</groupId>
<artifactId>mail</artifactId>
- <parent>
- <groupId>org.jboss.seam</groupId>
- <artifactId>examples</artifactId>
- <version>2.3.1.Final-redhat-2</version>
- <relativePath>../pom.xml</relativePath>
- </parent>
- <packaging>pom</packaging>
- <name>Seam Mail Example (EE6)</name>
-
- <properties>
- <example.name>mail</example.name>
- </properties>
-
- <modules>
- <module>mail-ear</module>
- <module>mail-ejb</module>
- <module>mail-web</module>
- <module>mail-tests</module>
- </modules>
-
- <dependencyManagement>
- <dependencies>
- <dependency>
- <groupId>org.jboss.seam.examples.mail</groupId>
- <artifactId>mail-ejb</artifactId>
- <version>${project.version}</version>
- <type>ejb</type>
- </dependency>
- <dependency>
- <groupId>org.jboss.seam.examples.mail</groupId>
- <artifactId>mail-web</artifactId>
- <version>${project.version}</version>
- <type>war</type>
- </dependency>
- <dependency>
- <groupId>org.jboss.seam.examples.mail</groupId>
- <artifactId>mail-ear</artifactId>
- <version>${project.version}</version>
- </dependency>
- </dependencies>
- </dependencyManagement>
+ <version>2.3.1.Final-redhat-2</version>
+ <packaging>pom</packaging>
+ <name>Seam Mail Example (EE6)</name>
+
+ <properties>
+ <example.name>mail</example.name>
+ <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
+ <maven.compiler.target>1.6</maven.compiler.target>
+ <maven.compiler.source>1.6</maven.compiler.source>
+
+ <!-- To use jacoco, set jacoco.agent system property to something like
+ -javaagent:/path/to/jacocoagent.jar=append=true,destfile=/path/to/output/jacoco.exec -->
+ <jacoco.agent />
+
+ <!-- To use custom Maven settings and profiles, uncomment and customize
+ the following properties. This is necessary for the ShrinkWrap resolver to
+ function properly. -->
+ <!--<maven.user.settings>/path/to/custom/settings.xml</maven.user.settings> -->
+ <!--<maven.profiles>custom,profile</maven.profiles> -->
+
+ <version.commons.logging>1.1.1</version.commons.logging>
+ <version.shrinkwrap.resolver>2.0.0-beta-4</version.shrinkwrap.resolver>
+
+ <!-- Plugin versions -->
+ <version.dependency.plugin>2.5.1</version.dependency.plugin>
+ <version.surefire.plugin>2.10</version.surefire.plugin>
+ <version.compiler.plugin>2.3.1</version.compiler.plugin>
+ <version.ear.plugin>2.6</version.ear.plugin>
+ <version.war.plugin>2.1.1</version.war.plugin>
+ <version.jboss.maven.plugin>7.4.Final</version.jboss.maven.plugin>
+ </properties>
+
+ <modules>
+ <module>mail-ear</module>
+ <module>mail-ejb</module>
+ <module>mail-web</module>
+ </modules>
+
+ <dependencyManagement>
+ <dependencies>
+ <dependency>
+ <groupId>org.jboss.seam.examples.mail</groupId>
+ <artifactId>mail-ejb</artifactId>
+ <version>${project.version}</version>
+ <type>ejb</type>
+ </dependency>
+
+ <dependency>
+ <groupId>org.jboss.seam.examples.mail</groupId>
+ <artifactId>mail-web</artifactId>
+ <version>${project.version}</version>
+ <type>war</type>
+ </dependency>
+
+ <dependency>
+ <groupId>org.jboss.seam.examples.mail</groupId>
+ <artifactId>mail-ear</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+
+ <!-- BOMs -->
+ <dependency>
+ <groupId>org.jboss.shrinkwrap.resolver</groupId>
+ <artifactId>shrinkwrap-resolver-bom</artifactId>
+ <version>${version.shrinkwrap.resolver}</version>
+ <scope>import</scope>
+ <type>pom</type>
+ </dependency>
+
+ <dependency>
+ <groupId>org.jboss.seam</groupId>
+ <artifactId>bom</artifactId>
+ <version>${project.version}</version>
+ <type>pom</type>
+ <scope>import</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>commons-logging</groupId>
+ <artifactId>commons-logging</artifactId>
+ <version>${version.commons.logging}</version>
+ <scope>provided</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.jboss.seam</groupId>
+ <artifactId>jboss-seam</artifactId>
+ <version>${project.version}</version>
+ <exclusions>
+ <exclusion>
+ <groupId>org.testng</groupId>
+ <artifactId>testng</artifactId>
+ </exclusion>
+ </exclusions>
+ </dependency>
+ </dependencies>
+ </dependencyManagement>
+
+ <build>
+ <pluginManagement>
+ <plugins>
+ <!-- Manage plugin versions for build stability -->
+ <plugin>
+ <artifactId>maven-surefire-plugin</artifactId>
+ <version>${version.surefire.plugin}</version>
+ <configuration>
+ <systemPropertyVariables>
+ <org.apache.maven.user-settings>${maven.user.settings}</org.apache.maven.user-settings>
+ <maven.profiles>${maven.profiles}</maven.profiles>
+ </systemPropertyVariables>
+ </configuration>
+ </plugin>
+ <plugin>
+ <artifactId>maven-dependency-plugin</artifactId>
+ <version>${version.dependency.plugin}</version>
+ </plugin>
+ <plugin>
+ <artifactId>maven-compiler-plugin</artifactId>
+ <version>${version.compiler.plugin}</version>
+ <configuration>
+ <source>${maven.compiler.source}</source>
+ <target>${maven.compiler.target}</target>
+ </configuration>
+ </plugin>
+ </plugins>
+ </pluginManagement>
+ </build>
</project>
11 years, 5 months
Seam SVN: r15537 - in branches/enterprise/WFK-2_1/examples/itext: itext-ear and 18 other directories.
by seam-commits@lists.jboss.org
Author: tremes
Date: 2013-06-04 02:09:08 -0400 (Tue, 04 Jun 2013)
New Revision: 15537
Added:
branches/enterprise/WFK-2_1/examples/itext/itext-ejb/src/test/
branches/enterprise/WFK-2_1/examples/itext/itext-ejb/src/test/java/
branches/enterprise/WFK-2_1/examples/itext/itext-ejb/src/test/java/org/
branches/enterprise/WFK-2_1/examples/itext/itext-ejb/src/test/java/org/jboss/
branches/enterprise/WFK-2_1/examples/itext/itext-ejb/src/test/java/org/jboss/seam/
branches/enterprise/WFK-2_1/examples/itext/itext-ejb/src/test/java/org/jboss/seam/example/
branches/enterprise/WFK-2_1/examples/itext/itext-ejb/src/test/java/org/jboss/seam/example/itext/
branches/enterprise/WFK-2_1/examples/itext/itext-ejb/src/test/java/org/jboss/seam/example/itext/test/
branches/enterprise/WFK-2_1/examples/itext/itext-ejb/src/test/java/org/jboss/seam/example/itext/test/Deployments.java
branches/enterprise/WFK-2_1/examples/itext/itext-ejb/src/test/java/org/jboss/seam/example/itext/test/DocumentTest.java
branches/enterprise/WFK-2_1/examples/itext/itext-ejb/src/test/resources/
branches/enterprise/WFK-2_1/examples/itext/itext-ejb/src/test/resources/arquillian.xml
branches/enterprise/WFK-2_1/examples/itext/itext-ejb/src/test/resources/components.xml
branches/enterprise/WFK-2_1/examples/itext/itext-ejb/src/test/resources/ejb-jar.xml
branches/enterprise/WFK-2_1/examples/itext/itext-ejb/src/test/resources/jboss-deployment-structure.xml
branches/enterprise/WFK-2_1/examples/itext/itext-ejb/src/test/resources/persistence.xml
branches/enterprise/WFK-2_1/examples/itext/itext-ejb/src/test/resources/seam.properties
branches/enterprise/WFK-2_1/examples/itext/itext-ejb/src/test/resources/web.xml
branches/enterprise/WFK-2_1/examples/itext/itext-ejb/src/test/resources/whyseam.xhtml
Removed:
branches/enterprise/WFK-2_1/examples/itext/itext-tests/pom.xml
branches/enterprise/WFK-2_1/examples/itext/itext-tests/src/test/java/org/jboss/seam/example/itext/test/DocumentTest.java
branches/enterprise/WFK-2_1/examples/itext/itext-tests/src/test/java/org/jboss/seam/example/itext/test/selenium/SeleniumItextTest.java
branches/enterprise/WFK-2_1/examples/itext/itext-tests/src/test/resources-ftest/testng.xml
branches/enterprise/WFK-2_1/examples/itext/itext-tests/src/test/resources-integration/arquillian.xml
branches/enterprise/WFK-2_1/examples/itext/itext-tests/src/test/resources-integration/web.xml
Modified:
branches/enterprise/WFK-2_1/examples/itext/itext-ear/pom.xml
branches/enterprise/WFK-2_1/examples/itext/itext-ejb/pom.xml
branches/enterprise/WFK-2_1/examples/itext/itext-ejb/src/main/java/org/jboss/seam/example/pdf/JFreeData.java
branches/enterprise/WFK-2_1/examples/itext/itext-web/pom.xml
branches/enterprise/WFK-2_1/examples/itext/pom.xml
Log:
itext example migrated
Modified: branches/enterprise/WFK-2_1/examples/itext/itext-ear/pom.xml
===================================================================
--- branches/enterprise/WFK-2_1/examples/itext/itext-ear/pom.xml 2013-06-03 20:39:42 UTC (rev 15536)
+++ branches/enterprise/WFK-2_1/examples/itext/itext-ear/pom.xml 2013-06-04 06:09:08 UTC (rev 15537)
@@ -52,6 +52,7 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-ear-plugin</artifactId>
+ <version>${version.ear.plugin}</version>
<configuration>
<version>6</version>
<defaultLibBundleDir>lib</defaultLibBundleDir>
Modified: branches/enterprise/WFK-2_1/examples/itext/itext-ejb/pom.xml
===================================================================
--- branches/enterprise/WFK-2_1/examples/itext/itext-ejb/pom.xml 2013-06-03 20:39:42 UTC (rev 15536)
+++ branches/enterprise/WFK-2_1/examples/itext/itext-ejb/pom.xml 2013-06-04 06:09:08 UTC (rev 15537)
@@ -79,6 +79,132 @@
<groupId>jfree</groupId>
<artifactId>jfreechart</artifactId>
</dependency>
+
+ <!-- Test dependencies -->
+ <dependency>
+ <groupId>org.jboss.shrinkwrap.resolver</groupId>
+ <artifactId>shrinkwrap-resolver-depchain</artifactId>
+ <type>pom</type>
+ <scope>test</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <scope>test</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.jboss.arquillian.junit</groupId>
+ <artifactId>arquillian-junit-container</artifactId>
+ <scope>test</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.jboss.arquillian.protocol</groupId>
+ <artifactId>arquillian-protocol-servlet</artifactId>
+ <scope>test</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.jboss.seam</groupId>
+ <artifactId>jboss-seam-pdf</artifactId>
+ <exclusions>
+ <exclusion>
+ <groupId>com.lowagie</groupId>
+ <artifactId>itext</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>com.lowagie</groupId>
+ <artifactId>itext-rtf</artifactId>
+ </exclusion>
+ </exclusions>
+ </dependency>
+
+ <dependency>
+ <groupId>org.jboss.spec.javax.el</groupId>
+ <artifactId>jboss-el-api_2.2_spec</artifactId>
+ <scope>test</scope>
+ </dependency>
</dependencies>
+
+ <profiles>
+ <profile>
+ <id>integration-tests</id>
+ <activation>
+ <property>
+ <name>arquillian</name>
+ </property>
+ </activation>
+ <properties>
+ <jndiPattern>java:app/seam-itext/#{ejbName}</jndiPattern>
+ <distributable>false</distributable>
+ </properties>
+ <build>
+ <testResources>
+ <testResource>
+ <directory>src/test/resources</directory>
+ <filtering>true</filtering>
+ </testResource>
+ </testResources>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-surefire-plugin</artifactId>
+ <configuration>
+ <skip>false</skip>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+ </profile>
+ <profile>
+ <id>arq-jbossas-7-managed</id>
+ <activation>
+ <property>
+ <name>arquillian</name>
+ <value>jbossas-managed-7</value>
+ </property>
+ </activation>
+ <dependencies>
+ <dependency>
+ <groupId>org.jboss.as</groupId>
+ <artifactId>jboss-as-arquillian-container-managed</artifactId>
+ <scope>test</scope>
+ </dependency>
+ </dependencies>
+ </profile>
+
+ <profile>
+ <id>arq-jbossas-7-remote</id>
+ <activation>
+ <property>
+ <name>arquillian</name>
+ <value>jbossas-remote-7</value>
+ </property>
+ </activation>
+ <dependencies>
+ <dependency>
+ <groupId>org.jboss.as</groupId>
+ <artifactId>jboss-as-arquillian-container-remote</artifactId>
+ <scope>test</scope>
+ </dependency>
+ </dependencies>
+ </profile>
+ </profiles>
+
+ <build>
+ <plugins>
+ <!-- Skip tests by default -->
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-surefire-plugin</artifactId>
+ <configuration>
+ <skip>true</skip>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+
</project>
Modified: branches/enterprise/WFK-2_1/examples/itext/itext-ejb/src/main/java/org/jboss/seam/example/pdf/JFreeData.java
===================================================================
--- branches/enterprise/WFK-2_1/examples/itext/itext-ejb/src/main/java/org/jboss/seam/example/pdf/JFreeData.java 2013-06-03 20:39:42 UTC (rev 15536)
+++ branches/enterprise/WFK-2_1/examples/itext/itext-ejb/src/main/java/org/jboss/seam/example/pdf/JFreeData.java 2013-06-04 06:09:08 UTC (rev 15537)
@@ -141,11 +141,11 @@
Paint gp1 = new Color(0, 0, 0, 0);
GradientPaint gp2 = new GradientPaint(0.0f, 0.0f, Color.red, 0.0f, 0.0f, new Color(64, 0, 0));
//renderer.setSeriesPaint(0, gp0);
- renderer.setSeriesPaint(0, Color.green);
+ renderer.setSeriesPaint(0, Color.green);
renderer.setSeriesPaint(1, gp1);
//renderer.setSeriesPaint(2, gp2);
- renderer.setSeriesPaint(2, Color.red);
-
+ renderer.setSeriesPaint(2, Color.red);
+
return chart;
}
}
\ No newline at end of file
Added: branches/enterprise/WFK-2_1/examples/itext/itext-ejb/src/test/java/org/jboss/seam/example/itext/test/Deployments.java
===================================================================
--- branches/enterprise/WFK-2_1/examples/itext/itext-ejb/src/test/java/org/jboss/seam/example/itext/test/Deployments.java (rev 0)
+++ branches/enterprise/WFK-2_1/examples/itext/itext-ejb/src/test/java/org/jboss/seam/example/itext/test/Deployments.java 2013-06-04 06:09:08 UTC (rev 15537)
@@ -0,0 +1,40 @@
+package org.jboss.seam.example.itext.test;
+
+import java.io.File;
+
+import org.jboss.seam.example.pdf.JFreeData;
+import org.jboss.shrinkwrap.api.ShrinkWrap;
+import org.jboss.shrinkwrap.api.asset.StringAsset;
+import org.jboss.shrinkwrap.api.spec.WebArchive;
+import org.jboss.shrinkwrap.resolver.api.maven.Maven;
+
+public class Deployments
+{
+public static WebArchive itextDeployment() {
+
+ // use profiles defined in 'maven.profiles' property in pom.xml
+ String profilesString = System.getProperty("maven.profiles");
+ String[] profiles = profilesString != null ? profilesString.split(", ?") : new String[0];
+ File[] libs = Maven.resolver().loadPomFromFile("pom.xml", profiles)
+ .importCompileAndRuntimeDependencies()
+ // force resolve jboss-seam, because it is provided-scoped in the pom, but we need it bundled in the WAR
+ .resolve("org.jboss.seam:jboss-seam").withTransitivity().asFile();
+
+
+
+ return ShrinkWrap.create(WebArchive.class, "seam-itext.war")
+ .addPackage(JFreeData.class.getPackage())
+ .addAsWebInfResource("META-INF/ejb-jar.xml", "ejb-jar.xml")
+ .addAsWebInfResource("persistence.xml", "classes/META-INF/persistence.xml")
+ .addAsWebInfResource(new StringAsset("org.jboss.seam.mock.MockFacesContextFactory"), "classes/META-INF/services/javax.faces.context.FacesContextFactory")
+ .addAsWebInfResource("components.xml", "components.xml")
+ .addAsWebInfResource("jboss-deployment-structure.xml", "jboss-deployment-structure.xml")
+ .addAsWebInfResource("seam.properties", "classes/seam.properties")
+ .addAsWebInfResource("web.xml", "web.xml")
+ .addAsWebResource("whyseam.xhtml")
+ .addAsLibraries(libs);
+
+ }
+
+
+}
Copied: branches/enterprise/WFK-2_1/examples/itext/itext-ejb/src/test/java/org/jboss/seam/example/itext/test/DocumentTest.java (from rev 15536, branches/enterprise/WFK-2_1/examples/itext/itext-tests/src/test/java/org/jboss/seam/example/itext/test/DocumentTest.java)
===================================================================
--- branches/enterprise/WFK-2_1/examples/itext/itext-ejb/src/test/java/org/jboss/seam/example/itext/test/DocumentTest.java (rev 0)
+++ branches/enterprise/WFK-2_1/examples/itext/itext-ejb/src/test/java/org/jboss/seam/example/itext/test/DocumentTest.java 2013-06-04 06:09:08 UTC (rev 15537)
@@ -0,0 +1,98 @@
+package org.jboss.seam.example.itext.test;
+
+import org.jboss.arquillian.container.test.api.Deployment;
+import org.jboss.arquillian.container.test.api.OverProtocol;
+import org.jboss.arquillian.junit.Arquillian;
+import org.jboss.seam.contexts.Contexts;
+import org.jboss.seam.core.Conversation;
+import org.jboss.seam.document.ByteArrayDocumentData;
+import org.jboss.seam.document.DocumentData;
+import org.jboss.seam.document.DocumentStore;
+import org.jboss.seam.mock.JUnitSeamTest;
+import org.jboss.seam.pdf.ui.UIDocument;
+import org.jboss.shrinkwrap.api.Archive;
+import org.jboss.shrinkwrap.api.spec.WebArchive;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+
+/**
+ * This is just a placeholder until I can find a way to actually test the UI
+ * components.
+ */
+(a)RunWith(Arquillian.class)
+public class DocumentTest extends JUnitSeamTest
+{
+ @Deployment
+ @OverProtocol("Servlet 3.0")
+ public static Archive<?> createDeployment()
+ {
+
+ WebArchive web = Deployments.itextDeployment();
+ return web;
+ }
+
+ @Test
+ public void documentStore() throws Exception
+ {
+ String conversationId = new FacesRequest("/whyseam.xhtml")
+ {
+
+ @Override
+ protected void invokeApplication() throws Exception
+ {
+ Conversation.instance().begin();
+
+ DocumentStore store = (DocumentStore) getValue("#{org.jboss.seam.document.documentStore}");
+ String docId = store.newId();
+
+ Contexts.getSessionContext().set("docId", docId);
+
+ DocumentData documentData = new ByteArrayDocumentData("base", UIDocument.PDF, new byte[100]);
+ store.saveData(docId, documentData);
+ }
+
+ @Override
+ protected void renderResponse() throws Exception
+ {
+ String docId = (String) getValue("#{docId}");
+ assert docId != null;
+
+ DocumentStore store = (DocumentStore) getValue("#{org.jboss.seam.document.documentStore}");
+ assert store.idIsValid(docId);
+
+ }
+ }.run();
+
+ // different conversation
+ new FacesRequest("/whyseam.xhtml")
+ {
+ @Override
+ protected void renderResponse() throws Exception
+ {
+ String docId = (String) getValue("#{docId}");
+ assert docId != null;
+
+ DocumentStore store = (DocumentStore) getValue("#{org.jboss.seam.document.documentStore}");
+ assert !store.idIsValid(docId);
+ }
+ }.run();
+
+ new FacesRequest("/whyseam.xhtml", conversationId)
+ {
+ @Override
+ protected void renderResponse() throws Exception
+ {
+ String docId = (String) getValue("#{docId}");
+ assert docId != null;
+
+ DocumentStore store = (DocumentStore) getValue("#{org.jboss.seam.document.documentStore}");
+ assert store.idIsValid(docId);
+
+ ByteArrayDocumentData data = (ByteArrayDocumentData) store.getDocumentData(docId);
+ assert data.getDocumentType().equals(UIDocument.PDF);
+ assert data.getData().length == 100;
+ }
+ }.run();
+ }
+
+}
Added: branches/enterprise/WFK-2_1/examples/itext/itext-ejb/src/test/resources/arquillian.xml
===================================================================
--- branches/enterprise/WFK-2_1/examples/itext/itext-ejb/src/test/resources/arquillian.xml (rev 0)
+++ branches/enterprise/WFK-2_1/examples/itext/itext-ejb/src/test/resources/arquillian.xml 2013-06-04 06:09:08 UTC (rev 15537)
@@ -0,0 +1,24 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<arquillian xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xmlns="http://jboss.org/schema/arquillian"
+ xsi:schemaLocation="http://jboss.org/schema/arquillian http://jboss.org/schema/arquillian/arquillian_1_0.xsd">
+
+ <engine>
+ <property name="deploymentExportPath">target/</property>
+ </engine>
+
+ <container qualifier="jboss" default="true">
+ <configuration>
+ <!-- These properties are only valid for arquillian managed container,
+ but don't cause a problem for the remote container, so they
+ can be left in. -->
+ <!-- To use jacoco, set jacoco.agent system property to something like
+ -javaagent:/path/to/jacocoagent.jar=append=true,destfile=/path/to/output/jacoco.exec -->
+ <property name="javaVmArguments">-Xmx1024m -XX:MaxPermSize=1024m ${jacoco.agent}</property>
+ <property name="serverConfig">standalone.xml</property>
+ <!-- If jbossHome property is not set, the JBOSS_HOME environment variable is used -->
+ <!--<property name="jbossHome">/path/to/jboss/as</property>-->
+ </configuration>
+ </container>
+
+</arquillian>
\ No newline at end of file
Added: branches/enterprise/WFK-2_1/examples/itext/itext-ejb/src/test/resources/components.xml
===================================================================
--- branches/enterprise/WFK-2_1/examples/itext/itext-ejb/src/test/resources/components.xml (rev 0)
+++ branches/enterprise/WFK-2_1/examples/itext/itext-ejb/src/test/resources/components.xml 2013-06-04 06:09:08 UTC (rev 15537)
@@ -0,0 +1,24 @@
+<components xmlns="http://jboss.org/schema/seam/components"
+ xmlns:pdf="http://jboss.org/schema/seam/pdf"
+ xmlns:core="http://jboss.org/schema/seam/core"
+ xmlns:framework="http://jboss.org/schema/seam/framework"
+ xmlns:web="http://jboss.org/schema/seam/web"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://jboss.org/schema/seam/core http://jboss.org/schema/seam/core-2.3.xsd
+ http://jboss.org/schema/seam/framework http://jboss.org/schema/seam/framework-2.3.xsd
+ http://jboss.org/schema/seam/pdf http://jboss.org/schema/seam/pdf-2.3.xsd
+ http://jboss.org/schema/seam/web /Users/orb/proj/jboss/seam/trunk/src/main/org/jboss/seam/web-2.3.xsd
+ http://jboss.org/schema/seam/components http://jboss.org/schema/seam/components-2.3.xsd">
+
+ <component name="org.jboss.seam.document.documentStore">
+ <property name="useExtensions">true</property>
+ <property name="errorPage">/pdfMissing.seam</property>
+ </component>
+
+ <pdf:key-store-config key-store="pdf.keystore"
+ key-store-password="storepass"
+ key-password="keypass"
+ key-alias="pdfKey" />
+
+ <core:init debug="true" jndi-pattern="${jndiPattern}" />
+</components>
Added: branches/enterprise/WFK-2_1/examples/itext/itext-ejb/src/test/resources/ejb-jar.xml
===================================================================
--- branches/enterprise/WFK-2_1/examples/itext/itext-ejb/src/test/resources/ejb-jar.xml (rev 0)
+++ branches/enterprise/WFK-2_1/examples/itext/itext-ejb/src/test/resources/ejb-jar.xml 2013-06-04 06:09:08 UTC (rev 15537)
@@ -0,0 +1,19 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<ejb-jar xmlns="http://java.sun.com/xml/ns/javaee"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/ejb-jar_3_0.xsd"
+ version="3.0">
+
+ <interceptors>
+ <interceptor>
+ <interceptor-class>org.jboss.seam.ejb.SeamInterceptor</interceptor-class>
+ </interceptor>
+ </interceptors>
+
+ <assembly-descriptor>
+ <interceptor-binding>
+ <ejb-name>*</ejb-name>
+ <interceptor-class>org.jboss.seam.ejb.SeamInterceptor</interceptor-class>
+ </interceptor-binding>
+ </assembly-descriptor>
+</ejb-jar>
Added: branches/enterprise/WFK-2_1/examples/itext/itext-ejb/src/test/resources/jboss-deployment-structure.xml
===================================================================
--- branches/enterprise/WFK-2_1/examples/itext/itext-ejb/src/test/resources/jboss-deployment-structure.xml (rev 0)
+++ branches/enterprise/WFK-2_1/examples/itext/itext-ejb/src/test/resources/jboss-deployment-structure.xml 2013-06-04 06:09:08 UTC (rev 15537)
@@ -0,0 +1,14 @@
+<jboss-deployment-structure xmlns="urn:jboss:deployment-structure:1.0">
+ <deployment>
+ <dependencies>
+ <module name="org.apache.log4j" export="true"/>
+ <module name="org.dom4j" export="true"/>
+ <module name="org.apache.commons.logging" export="true"/>
+ <module name="org.apache.commons.collections" export="true"/>
+ <module name="javax.faces.api" export="true"/>
+ <module name="com.sun.jsf-impl" export="true"/>
+ <module name="org.javassist" export="true"/>
+ <module name="org.antlr" export="true"/>
+ </dependencies>
+ </deployment>
+</jboss-deployment-structure>
Added: branches/enterprise/WFK-2_1/examples/itext/itext-ejb/src/test/resources/persistence.xml
===================================================================
--- branches/enterprise/WFK-2_1/examples/itext/itext-ejb/src/test/resources/persistence.xml (rev 0)
+++ branches/enterprise/WFK-2_1/examples/itext/itext-ejb/src/test/resources/persistence.xml 2013-06-04 06:09:08 UTC (rev 15537)
@@ -0,0 +1,16 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<persistence xmlns="http://java.sun.com/xml/ns/persistence"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://java.sun.com/xml/ns/persistence http://java.sun.com/xml/ns/persistence/persistence_2_0.xsd"
+ version="2.0">
+ <persistence-unit name="userDatabase">
+ <provider>org.hibernate.ejb.HibernatePersistence</provider>
+ <jta-data-source>java:jboss/datasources/ExampleDS</jta-data-source>
+ <properties>
+ <property name="hibernate.hbm2ddl.auto" value="create-drop"/>
+ <property name="hibernate.show_sql" value="true"/>
+ <property name="jboss.entity.manager.factory.jndi.name"
+ value="java:/seampdfEntityManagerFactory"/>
+ </properties>
+ </persistence-unit>
+</persistence>
Added: branches/enterprise/WFK-2_1/examples/itext/itext-ejb/src/test/resources/seam.properties
===================================================================
--- branches/enterprise/WFK-2_1/examples/itext/itext-ejb/src/test/resources/seam.properties (rev 0)
+++ branches/enterprise/WFK-2_1/examples/itext/itext-ejb/src/test/resources/seam.properties 2013-06-04 06:09:08 UTC (rev 15537)
@@ -0,0 +1 @@
+
Copied: branches/enterprise/WFK-2_1/examples/itext/itext-ejb/src/test/resources/web.xml (from rev 15536, branches/enterprise/WFK-2_1/examples/itext/itext-tests/src/test/resources-integration/web.xml)
===================================================================
--- branches/enterprise/WFK-2_1/examples/itext/itext-ejb/src/test/resources/web.xml (rev 0)
+++ branches/enterprise/WFK-2_1/examples/itext/itext-ejb/src/test/resources/web.xml 2013-06-04 06:09:08 UTC (rev 15537)
@@ -0,0 +1,12 @@
+<?xml version="1.0" ?>
+
+<web-app version="3.0"
+ xmlns="http://java.sun.com/xml/ns/javaee"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd">
+
+ <listener>
+ <listener-class>org.jboss.seam.mock.MockSeamListener</listener-class>
+ </listener>
+
+</web-app>
Added: branches/enterprise/WFK-2_1/examples/itext/itext-ejb/src/test/resources/whyseam.xhtml
===================================================================
--- branches/enterprise/WFK-2_1/examples/itext/itext-ejb/src/test/resources/whyseam.xhtml (rev 0)
+++ branches/enterprise/WFK-2_1/examples/itext/itext-ejb/src/test/resources/whyseam.xhtml 2013-06-04 06:09:08 UTC (rev 15537)
@@ -0,0 +1,62 @@
+<p:document xmlns:ui="http://java.sun.com/jsf/facelets"
+ xmlns:f="http://java.sun.com/jsf/core"
+ xmlns:p="http://jboss.org/schema/seam/pdf"
+ title="Why Seam"
+ keywords="mykeyword"
+ subject="seam"
+ author="Seam Team"
+ creator="Seam PDF example app">
+
+ <f:facet name="header">
+ <p:font size="12">
+ <p:footer borderWidthTop="1" borderColorTop="blue" borderWidthBottom="0" alignment="center">Why Seam? [<p:pageNumber />]</p:footer>
+ </p:font>
+ </f:facet>
+
+ <p:image alignment="right" wrap="true" value="/jboss.jpg" />
+ <p:font size="24"><p:paragraph backgroundColor="red" spacingAfter="50">Ten Good Reasons To Use Seam</p:paragraph></p:font>
+
+ <p:font color="blue" size="18"><p:paragraph>It's the quickest way to get "rich"</p:paragraph></p:font>
+
+ <p:paragraph alignment="justify">AJAX fundamentally changes the interaction model of the web. The synchronous, coarse-grained requests used by traditional web clients let many server-side applications get away with minimal caching and no session-level concurrency. The "stateless" architecture is in many cases a viable solution. But not anymore! AJAX clients hit the server with many asynchronous, concurrent, fine-grained requests, which could easily bring your database to its knees. When state is held in memory between requests, it is highly vulnerable to concurrency-related bugs, since the Java EE platform provides no constructs for dealing with session-level concurrency.</p:paragraph>
+
+ <p:paragraph alignment="justify">Seam's totally unique concurrency model and state-management model was conceived and designed with AJAX in mind. </p:paragraph>
+
+ <p:paragraph alignment="justify">Seam 1.1 integrates open source JSF-based AJAX solutions like ICEfaces and Ajax4JSF with Seam's state and concurrency management engine. You can add AJAX to your applications with ease, without the need to learn JavaScript, and you will be protected from potential bugs and performance problems associated with the switch to AJAX. </p:paragraph>
+
+ <p:font size="18"><p:paragraph>It's the easiest way to get started with EJB 3.0 </p:paragraph></p:font>
+ <p:paragraph alignment="justify">EJB 3.0 is a great component model for transactional business components, the highlight being the brand new Java Persistence API (JPA). But Java web and application frameworks designed before the release of EJB 3.0 lack support for the new component model, leaving you to write your own integration code, and in many cases forcing you into the use of a layered architecture that may not be right for your application. </p:paragraph>
+
+ <p:paragraph alignment="justify">Seam was designed for use with EJB 3.0 and lets you use the new component model everywhere. Since any class in a Seam application can be an EJB component, there is no need to introduce extra unwanted layers just to keep your frameworks happy. And, of course, there is no need to write code to integrate EJB 3.0 with your web framework, since Seam already has it. </p:paragraph>
+
+ <p:paragraph alignment="justify">Note that you don't have to use EJB 3.0 to use Seam, and if you're developing in an environment that doesn't support EJB 3.0, Seam provides alternatives. </p:paragraph>
+
+ <p:font size="18"><p:paragraph>It's the best way to leverage JSF </p:paragraph></p:font>
+ <p:paragraph alignment="justify">JSF has created a vibrant ecosystem of component libraries and other addons, that make this easily the most exciting web framework in Java. But plain JSF is heavy on XML, and misses out on a number of important features, especially for people building internet-facing applications. Seam replaces the tedious XML configuration with a handful of annotations, reducing code and making you more productive. Seam extends JSF with extra functionality for multi-window operation and workspace management, model-based validation, jBPM-based pageflow, internationalization, page fragment caching. Seam even adds facilities for handling bookmarkable (REST-style) web pages - the number one user complaint against JSF. </p:paragraph>
+
+ <p:paragraph alignment="justify">Since JSF does not address the problem of access to transactional resources, Seam's integration of JTA, JPA and EJB 3.0 is a must-have for most JSF users. </p:paragraph>
+
+ <p:font size="18"><p:paragraph>And the easiest way to do BPM </p:paragraph></p:font>
+ <p:paragraph alignment="justify">jBPM is an intuitive and powerful solution for enterprise applications with complex human collaboration, or web applications with complex user interactions. BPM technology not only makes it easier for developers and analysts to model, implement and optimize a business process, but also makes it possible for operations and management to analyse the efficiency of the business process, and be informed of problems. </p:paragraph>
+
+ <p:paragraph alignment="justify">Seam deeply integrates jBPM and makes it incredibly simple to use jBPM for task management or pageflow, and is a great way to get started with BPM technology. The combination of Seam and jBPM can shrink development time of some kinds of projects by literally months. </p:paragraph>
+
+ <p:font size="18"><p:paragraph>But CRUD is easy too </p:paragraph></p:font>
+ <p:paragraph alignment="justify">Seam takes on hard problems affecting complex enterprise applications. But that doesn't mean the easy stuff is any more difficult than it should be. Seam is every bit as productive as any of the current crop of CRUD frameworks when it comes to building simple data driven applications. Seam combines a simple data access framework (built around JPA and Hibernate) with a command line code generation and database reverse engineering tool to get you started in minutes. </p:paragraph>
+
+ <p:font size="18"><p:paragraph>It makes persistence a breeze </p:paragraph></p:font>
+ <p:paragraph alignment="justify">Seam grew out of the Hibernate community, and was designed and implemented by the people who created Hibernate, the same people who coined the term "persistence context". Seam's conversation model solves a raft of persistence-related programming problems caused by traditional stateless web application architectures. Whether you use Hibernate or JPA, Seam makes it easy and natural to use extended persistence contexts, and helps you avoid unnecessary state replication when you use an extended persistence context in a clustered environment. </p:paragraph>
+
+ <p:font size="18"><p:paragraph>Annotations </p:paragraph></p:font>
+ <p:paragraph alignment="justify">Seam is the first programming model that lets you use Java 5 annotations end to end, from the persistence layer to the UI. You'll never find yourself wrestling with unnecessary, noisy XML. Which is not to say that Seam doesn't use XML when appropriate (Seam has a sophisticated XML-based component configuration facility), just that you won't get lost in reams of XML for common programming tasks. </p:paragraph>
+
+ <p:font size="18"><p:paragraph>Get hip to automated integration testing </p:paragraph></p:font>
+ <p:paragraph alignment="justify">Automated unit tests certainly have their place in any project. But it's worse than dangerous to rely solely on unit testing. Most bugs concern the interaction between components, and the interaction between a component and the container environment. Unit tests are unable to properly capture container behavior, and usually don't capture complex inter-component interactions. Seam introduces an innovative approach to automated integration testing, where you can emulate the entire flow of a request or conversation, testing all layers of Java code in the application, from presentation to persistence. </p:paragraph>
+
+ <p:font size="18"><p:paragraph>Marry open source with open standards </p:paragraph></p:font>
+ <p:paragraph alignment="justify">Seam is founded upon open source implementations of open standards like JSF and EJB 3.0, along with open source innovators like Hibernate, jBPM, Facelets, Drools, ICEfaces and Ajax4JSF. The creators of Seam are active in the EJB, JPA, Bean Validation and JSF expert groups and lead the Web Beans (JSR-299) expert group which aims to bring the ideas of Seam into the Java EE standard. The Seam project is totally committed to the idea of open source innovation driving new ideas and ehancements into the Java platform. </p:paragraph>
+
+ <p:font size="18"><p:paragraph>It just works </p:paragraph></p:font>
+ <p:paragraph alignment="justify">You'll love it if you try it.</p:paragraph>
+</p:document>
+
Deleted: branches/enterprise/WFK-2_1/examples/itext/itext-tests/pom.xml
===================================================================
--- branches/enterprise/WFK-2_1/examples/itext/itext-tests/pom.xml 2013-06-03 20:39:42 UTC (rev 15536)
+++ branches/enterprise/WFK-2_1/examples/itext/itext-tests/pom.xml 2013-06-04 06:09:08 UTC (rev 15537)
@@ -1,180 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
- <modelVersion>4.0.0</modelVersion>
- <parent>
- <artifactId>itext</artifactId>
- <groupId>org.jboss.seam.examples</groupId>
- <version>2.3.1.Final-redhat-2</version>
- <relativePath>../pom.xml</relativePath>
- </parent>
-
- <groupId>org.jboss.seam.examples.itext</groupId>
- <artifactId>itext-tests</artifactId>
- <name>Itext Integration Tests Module (EE6)</name>
-
- <dependencies>
- <dependency>
- <groupId>org.testng</groupId>
- <artifactId>testng</artifactId>
- </dependency>
- <dependency>
- <groupId>org.jboss.seam.examples.itext</groupId>
- <artifactId>itext-ejb</artifactId>
- <type>ejb</type>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.jboss.seam</groupId>
- <artifactId>jboss-seam</artifactId>
- <type>ejb</type>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.slf4j</groupId>
- <artifactId>slf4j-log4j12</artifactId>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.jboss.spec.javax.faces</groupId>
- <artifactId>jboss-jsf-api_2.1_spec</artifactId>
- <scope>provided</scope>
- </dependency>
- <dependency>
- <groupId>org.seleniumhq.selenium</groupId>
- <artifactId>selenium-server</artifactId>
- </dependency>
- <dependency>
- <groupId>org.seleniumhq.selenium</groupId>
- <artifactId>selenium-java</artifactId>
- </dependency>
- <dependency>
- <groupId>org.jboss.arquillian.junit</groupId>
- <artifactId>arquillian-junit-container</artifactId>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.jboss.arquillian.protocol</groupId>
- <artifactId>arquillian-protocol-servlet</artifactId>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.jboss.seam</groupId>
- <artifactId>functional-tests</artifactId>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.jboss.seam</groupId>
- <artifactId>jboss-seam-pdf</artifactId>
- <exclusions>
- <exclusion>
- <groupId>com.lowagie</groupId>
- <artifactId>itext</artifactId>
- </exclusion>
- <exclusion>
- <groupId>com.lowagie</groupId>
- <artifactId>itext-rtf</artifactId>
- </exclusion>
- </exclusions>
- </dependency>
- <dependency>
- <groupId>com.lowagie</groupId>
- <artifactId>itext-rtf</artifactId>
- </dependency>
- <dependency>
- <groupId>com.lowagie</groupId>
- <artifactId>itext</artifactId>
- </dependency>
- <dependency>
- <groupId>jfree</groupId>
- <artifactId>jfreechart</artifactId>
- </dependency>
- <dependency>
- <groupId>org.jboss.spec.javax.el</groupId>
- <artifactId>jboss-el-api_2.2_spec</artifactId>
- </dependency>
- </dependencies>
-
- <build>
- <testResources>
- <testResource>
- <directory>src/test/resources</directory>
- <filtering>true</filtering>
- </testResource>
- <testResource>
- <directory>src/test/resources-integration</directory>
- </testResource>
- </testResources>
- <plugins>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-surefire-plugin</artifactId>
- <configuration>
- <skip>true</skip>
- </configuration>
- </plugin>
- </plugins>
- </build>
-
- <profiles>
- <profile>
- <id>integration-tests</id>
- <activation>
- <property>
- <name>arquillian</name>
- </property>
- </activation>
- </profile>
-
- <profile>
- <id>arq-jbossas-7-managed</id>
- <activation>
- <property>
- <name>arquillian</name>
- <value>jbossas-managed-7</value>
- </property>
- </activation>
- <build>
- <plugins>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-dependency-plugin</artifactId>
- </plugin>
- </plugins>
- </build>
- </profile>
-
- <profile>
- <id>arq-jbossas-7-remote</id>
- <activation>
- <property>
- <name>arquillian</name>
- <value>jbossas-remote-7</value>
- </property>
- </activation>
- </profile>
-
- <profile>
- <id>ftest-jbossas</id>
- <properties>
- <example.context.path>seam-itext</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>
Deleted: branches/enterprise/WFK-2_1/examples/itext/itext-tests/src/test/java/org/jboss/seam/example/itext/test/DocumentTest.java
===================================================================
--- branches/enterprise/WFK-2_1/examples/itext/itext-tests/src/test/java/org/jboss/seam/example/itext/test/DocumentTest.java 2013-06-03 20:39:42 UTC (rev 15536)
+++ branches/enterprise/WFK-2_1/examples/itext/itext-tests/src/test/java/org/jboss/seam/example/itext/test/DocumentTest.java 2013-06-04 06:09:08 UTC (rev 15537)
@@ -1,112 +0,0 @@
-package org.jboss.seam.example.itext.test;
-
-import java.io.File;
-
-import org.jboss.arquillian.container.test.api.Deployment;
-import org.jboss.arquillian.container.test.api.OverProtocol;
-import org.jboss.arquillian.junit.Arquillian;
-import org.jboss.seam.contexts.Contexts;
-import org.jboss.seam.core.Conversation;
-import org.jboss.seam.document.ByteArrayDocumentData;
-import org.jboss.seam.document.DocumentData;
-import org.jboss.seam.document.DocumentStore;
-import org.jboss.seam.mock.JUnitSeamTest;
-import org.jboss.seam.pdf.ui.UIDocument;
-import org.jboss.shrinkwrap.api.Archive;
-import org.jboss.shrinkwrap.api.ShrinkWrap;
-import org.jboss.shrinkwrap.api.asset.StringAsset;
-import org.jboss.shrinkwrap.api.importer.ZipImporter;
-import org.jboss.shrinkwrap.api.spec.EnterpriseArchive;
-import org.jboss.shrinkwrap.api.spec.WebArchive;
-import org.junit.Test;
-import org.junit.runner.RunWith;
-
-/**
- * This is just a placeholder until I can find a way to actually test the UI
- * components.
- */
-(a)RunWith(Arquillian.class)
-public class DocumentTest extends JUnitSeamTest
-{
- @Deployment
- @OverProtocol("Servlet 3.0")
- public static Archive<?> createDeployment()
- {
- EnterpriseArchive er = ShrinkWrap.create(ZipImporter.class, "seam-itext.ear").importFrom(new File("../itext-ear/target/seam-itext.ear"))
- .as(EnterpriseArchive.class);
- WebArchive web = er.getAsType(WebArchive.class, "itext-web.war");
- web.addAsWebInfResource(new StringAsset("org.jboss.seam.mock.MockFacesContextFactory"), "classes/META-INF/services/javax.faces.context.FacesContextFactory");
- web.addClasses(DocumentTest.class);
-
- // Install org.jboss.seam.mock.MockSeamListener
- web.delete("/WEB-INF/web.xml");
- web.addAsWebInfResource("web.xml");
-
- return er;
- }
-
- @Test
- public void documentStore() throws Exception
- {
- String conversationId = new FacesRequest("/whyseam.xhtml")
- {
-
- @Override
- protected void invokeApplication() throws Exception
- {
- Conversation.instance().begin();
-
- DocumentStore store = (DocumentStore) getValue("#{org.jboss.seam.document.documentStore}");
- String docId = store.newId();
-
- Contexts.getSessionContext().set("docId", docId);
-
- DocumentData documentData = new ByteArrayDocumentData("base", UIDocument.PDF, new byte[100]);
- store.saveData(docId, documentData);
- }
-
- @Override
- protected void renderResponse() throws Exception
- {
- String docId = (String) getValue("#{docId}");
- assert docId != null;
-
- DocumentStore store = (DocumentStore) getValue("#{org.jboss.seam.document.documentStore}");
- assert store.idIsValid(docId);
-
- }
- }.run();
-
- // different conversation
- new FacesRequest("/whyseam.xhtml")
- {
- @Override
- protected void renderResponse() throws Exception
- {
- String docId = (String) getValue("#{docId}");
- assert docId != null;
-
- DocumentStore store = (DocumentStore) getValue("#{org.jboss.seam.document.documentStore}");
- assert !store.idIsValid(docId);
- }
- }.run();
-
- new FacesRequest("/whyseam.xhtml", conversationId)
- {
- @Override
- protected void renderResponse() throws Exception
- {
- String docId = (String) getValue("#{docId}");
- assert docId != null;
-
- DocumentStore store = (DocumentStore) getValue("#{org.jboss.seam.document.documentStore}");
- assert store.idIsValid(docId);
-
- ByteArrayDocumentData data = (ByteArrayDocumentData)store.getDocumentData(docId);
- assert data.getDocumentType().equals(UIDocument.PDF);
- assert data.getData().length == 100;
- }
- }.run();
- }
-
-}
Deleted: branches/enterprise/WFK-2_1/examples/itext/itext-tests/src/test/java/org/jboss/seam/example/itext/test/selenium/SeleniumItextTest.java
===================================================================
--- branches/enterprise/WFK-2_1/examples/itext/itext-tests/src/test/java/org/jboss/seam/example/itext/test/selenium/SeleniumItextTest.java 2013-06-03 20:39:42 UTC (rev 15536)
+++ branches/enterprise/WFK-2_1/examples/itext/itext-tests/src/test/java/org/jboss/seam/example/itext/test/selenium/SeleniumItextTest.java 2013-06-04 06:09:08 UTC (rev 15537)
@@ -1,27 +0,0 @@
-package org.jboss.seam.example.itext.test.selenium;
-
-import org.jboss.seam.example.common.test.selenium.SeamSeleniumTest;
-import static org.testng.AssertJUnit.assertEquals;
-import org.testng.annotations.BeforeMethod;
-import org.testng.annotations.Test;
-
-public class SeleniumItextTest extends SeamSeleniumTest
-{
- public static final String HOME_PAGE = "/index.seam";
- public static final String HOME_PAGE_TITLE = "Seam PDF";
-
- @BeforeMethod
- @Override
- public void setUp() {
- super.setUp();
- browser.open(CONTEXT_PATH + HOME_PAGE);
- }
-
- /**
- * Place holder - just verifies that example deploys
- */
- @Test
- public void homePageLoadTest() {
- assertEquals("Unexpected page title.", HOME_PAGE_TITLE, browser.getTitle());
- }
-}
Deleted: branches/enterprise/WFK-2_1/examples/itext/itext-tests/src/test/resources-ftest/testng.xml
===================================================================
--- branches/enterprise/WFK-2_1/examples/itext/itext-tests/src/test/resources-ftest/testng.xml 2013-06-03 20:39:42 UTC (rev 15536)
+++ branches/enterprise/WFK-2_1/examples/itext/itext-tests/src/test/resources-ftest/testng.xml 2013-06-04 06:09:08 UTC (rev 15537)
@@ -1,26 +0,0 @@
-
- <!--
- JBoss, Home of Professional Open Source Copyright 2008, Red Hat
- Middleware LLC, and individual contributors by the @authors tag. See
- the copyright.txt in the distribution for a full listing of individual
- contributors. This is free software; you can redistribute it and/or
- modify it under the terms of the GNU Lesser General Public License as
- published by the Free Software Foundation; either version 2.1 of the
- License, or (at your option) any later version. This software is
- distributed in the hope that it will be useful, but WITHOUT ANY
- WARRANTY; without even the implied warranty of MERCHANTABILITY or
- FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
- License for more details. You should have received a copy of the GNU
- Lesser General Public License along with this software; if not, write
- to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
- Boston, MA 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- -->
-<!DOCTYPE suite SYSTEM "http://beust.com/testng/testng-1.0.dtd" >
-<suite name="Itext example" verbose="2" parallel="false">
- <test name="itext_tests">
- <parameter name="PROPERTY_FILE" value="" />
- <classes>
- <class name="org.jboss.seam.example.itext.test.selenium.SeleniumItextTest" />
- </classes>
- </test>
-</suite>
Deleted: branches/enterprise/WFK-2_1/examples/itext/itext-tests/src/test/resources-integration/arquillian.xml
===================================================================
--- branches/enterprise/WFK-2_1/examples/itext/itext-tests/src/test/resources-integration/arquillian.xml 2013-06-03 20:39:42 UTC (rev 15536)
+++ branches/enterprise/WFK-2_1/examples/itext/itext-tests/src/test/resources-integration/arquillian.xml 2013-06-04 06:09:08 UTC (rev 15537)
@@ -1,16 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<arquillian xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xmlns="http://jboss.org/schema/arquillian"
- xsi:schemaLocation="http://jboss.org/schema/arquillian http://jboss.org/schema/arquillian/arquillian_1_0.xsd">
-
- <engine>
- <property name="deploymentExportPath">target/</property>
- </engine>
-
- <container qualifier="jboss" default="true">
- <configuration>
- <property name="javaVmArguments">-Xmx1024m -XX:MaxPermSize=512m ${jacoco.agent}</property>
- </configuration>
- </container>
-
-</arquillian>
Deleted: branches/enterprise/WFK-2_1/examples/itext/itext-tests/src/test/resources-integration/web.xml
===================================================================
--- branches/enterprise/WFK-2_1/examples/itext/itext-tests/src/test/resources-integration/web.xml 2013-06-03 20:39:42 UTC (rev 15536)
+++ branches/enterprise/WFK-2_1/examples/itext/itext-tests/src/test/resources-integration/web.xml 2013-06-04 06:09:08 UTC (rev 15537)
@@ -1,12 +0,0 @@
-<?xml version="1.0" ?>
-
-<web-app version="3.0"
- xmlns="http://java.sun.com/xml/ns/javaee"
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd">
-
- <listener>
- <listener-class>org.jboss.seam.mock.MockSeamListener</listener-class>
- </listener>
-
-</web-app>
Modified: branches/enterprise/WFK-2_1/examples/itext/itext-web/pom.xml
===================================================================
--- branches/enterprise/WFK-2_1/examples/itext/itext-web/pom.xml 2013-06-03 20:39:42 UTC (rev 15536)
+++ branches/enterprise/WFK-2_1/examples/itext/itext-web/pom.xml 2013-06-04 06:09:08 UTC (rev 15537)
@@ -92,6 +92,7 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-war-plugin</artifactId>
+ <version>${version.war.plugin}</version>
<configuration>
<nonFilteredFileExtensions>
<!-- default value contains jpg,jpeg,gif,bmp,png -->
Modified: branches/enterprise/WFK-2_1/examples/itext/pom.xml
===================================================================
--- branches/enterprise/WFK-2_1/examples/itext/pom.xml 2013-06-03 20:39:42 UTC (rev 15536)
+++ branches/enterprise/WFK-2_1/examples/itext/pom.xml 2013-06-04 06:09:08 UTC (rev 15537)
@@ -1,14 +1,9 @@
<?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">
- <parent>
- <groupId>org.jboss.seam</groupId>
- <artifactId>examples</artifactId>
- <version>2.3.1.Final-redhat-2</version>
- </parent>
-
<modelVersion>4.0.0</modelVersion>
<groupId>org.jboss.seam.examples</groupId>
<artifactId>itext</artifactId>
+ <version>2.3.1.Final-redhat-2</version>
<packaging>pom</packaging>
<name>Itext Example (EE6)</name>
@@ -16,12 +11,35 @@
<module>itext-ejb</module>
<module>itext-web</module>
<module>itext-ear</module>
- <module>itext-tests</module>
</modules>
<properties>
- <example.name>itext</example.name>
- </properties>
+ <example.name>itext</example.name>
+ <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
+ <maven.compiler.target>1.6</maven.compiler.target>
+ <maven.compiler.source>1.6</maven.compiler.source>
+
+ <!-- To use jacoco, set jacoco.agent system property to something like
+ -javaagent:/path/to/jacocoagent.jar=append=true,destfile=/path/to/output/jacoco.exec -->
+ <jacoco.agent />
+
+ <!-- To use custom Maven settings and profiles, uncomment and customize
+ the following properties. This is necessary for the ShrinkWrap resolver to
+ function properly. -->
+ <!--<maven.user.settings>/path/to/custom/settings.xml</maven.user.settings> -->
+ <!--<maven.profiles>custom,profile</maven.profiles> -->
+
+ <version.commons.logging>1.1.1</version.commons.logging>
+ <version.shrinkwrap.resolver>2.0.0-beta-4</version.shrinkwrap.resolver>
+
+ <!-- Plugin versions -->
+ <version.dependency.plugin>2.5.1</version.dependency.plugin>
+ <version.surefire.plugin>2.10</version.surefire.plugin>
+ <version.compiler.plugin>2.3.1</version.compiler.plugin>
+ <version.ear.plugin>2.6</version.ear.plugin>
+ <version.war.plugin>2.1.1</version.war.plugin>
+ <version.jboss.maven.plugin>7.4.Final</version.jboss.maven.plugin>
+ </properties>
<dependencyManagement>
<dependencies>
@@ -31,19 +49,79 @@
<version>${project.version}</version>
<type>ejb</type>
</dependency>
+
<dependency>
<groupId>org.jboss.seam.examples.itext</groupId>
<artifactId>itext-web</artifactId>
<version>${project.version}</version>
<type>war</type>
</dependency>
+
<dependency>
<groupId>org.jboss.seam.examples.itext</groupId>
<artifactId>itext-ear</artifactId>
<version>${project.version}</version>
<type>ear</type>
</dependency>
+
+ <!-- BOMs -->
+ <dependency>
+ <groupId>org.jboss.shrinkwrap.resolver</groupId>
+ <artifactId>shrinkwrap-resolver-bom</artifactId>
+ <version>${version.shrinkwrap.resolver}</version>
+ <scope>import</scope>
+ <type>pom</type>
+ </dependency>
+
+ <dependency>
+ <groupId>org.jboss.seam</groupId>
+ <artifactId>bom</artifactId>
+ <version>${project.version}</version>
+ <type>pom</type>
+ <scope>import</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.jboss.seam</groupId>
+ <artifactId>jboss-seam</artifactId>
+ <version>${project.version}</version>
+ <exclusions>
+ <exclusion>
+ <groupId>org.testng</groupId>
+ <artifactId>testng</artifactId>
+ </exclusion>
+ </exclusions>
+ </dependency>
</dependencies>
</dependencyManagement>
+ <build>
+ <pluginManagement>
+ <plugins>
+ <!-- Manage plugin versions for build stability -->
+ <plugin>
+ <artifactId>maven-surefire-plugin</artifactId>
+ <version>${version.surefire.plugin}</version>
+ <configuration>
+ <systemPropertyVariables>
+ <org.apache.maven.user-settings>${maven.user.settings}</org.apache.maven.user-settings>
+ <maven.profiles>${maven.profiles}</maven.profiles>
+ </systemPropertyVariables>
+ </configuration>
+ </plugin>
+ <plugin>
+ <artifactId>maven-dependency-plugin</artifactId>
+ <version>${version.dependency.plugin}</version>
+ </plugin>
+ <plugin>
+ <artifactId>maven-compiler-plugin</artifactId>
+ <version>${version.compiler.plugin}</version>
+ <configuration>
+ <source>${maven.compiler.source}</source>
+ <target>${maven.compiler.target}</target>
+ </configuration>
+ </plugin>
+ </plugins>
+ </pluginManagement>
+ </build>
</project>
11 years, 5 months
Seam SVN: r15536 - in branches/enterprise/WFK-2_1/examples/ui: ui-ear and 1 other directories.
by seam-commits@lists.jboss.org
Author: maschmid
Date: 2013-06-03 16:39:42 -0400 (Mon, 03 Jun 2013)
New Revision: 15536
Removed:
branches/enterprise/WFK-2_1/examples/ui/ui-tests/
Modified:
branches/enterprise/WFK-2_1/examples/ui/pom.xml
branches/enterprise/WFK-2_1/examples/ui/ui-ear/pom.xml
branches/enterprise/WFK-2_1/examples/ui/ui-web/pom.xml
Log:
ui example migrated
Modified: branches/enterprise/WFK-2_1/examples/ui/pom.xml
===================================================================
--- branches/enterprise/WFK-2_1/examples/ui/pom.xml 2013-06-03 20:25:04 UTC (rev 15535)
+++ branches/enterprise/WFK-2_1/examples/ui/pom.xml 2013-06-03 20:39:42 UTC (rev 15536)
@@ -1,31 +1,42 @@
<?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">
- <parent>
- <artifactId>examples</artifactId>
- <groupId>org.jboss.seam</groupId>
- <version>2.3.1.Final-redhat-2</version>
- <relativePath>../pom.xml</relativePath>
- </parent>
-
<modelVersion>4.0.0</modelVersion>
<groupId>org.jboss.seam.examples</groupId>
<artifactId>ui</artifactId>
+ <version>2.3.1.Final-redhat-2</version>
+
<packaging>pom</packaging>
<name>UI Example (EE6)</name>
+ <properties>
+ <example.name>ui</example.name>
+ <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
+ <maven.compiler.target>1.6</maven.compiler.target>
+ <maven.compiler.source>1.6</maven.compiler.source>
+
+ <version.commons.logging>1.1.1</version.commons.logging>
+
+ <!-- Plugin versions -->
+ <version.dependency.plugin>2.5.1</version.dependency.plugin>
+ <version.surefire.plugin>2.10</version.surefire.plugin>
+ <version.resources.plugin>2.6</version.resources.plugin>
+ <version.compiler.plugin>2.3.1</version.compiler.plugin>
+ <version.ear.plugin>2.6</version.ear.plugin>
+ <version.war.plugin>2.1.1</version.war.plugin>
+ <version.ejb.plugin>2.3</version.ejb.plugin>
+ <version.jboss.maven.plugin>7.4.Final</version.jboss.maven.plugin>
+ </properties>
+
<modules>
<module>ui-ejb</module>
<module>ui-web</module>
<module>ui-ear</module>
- <module>ui-tests</module>
+
</modules>
- <properties>
- <example.name>ui</example.name>
- </properties>
-
<dependencyManagement>
<dependencies>
+ <!-- Modules -->
<dependency>
<groupId>org.jboss.seam.examples.ui</groupId>
<artifactId>ui-ejb</artifactId>
@@ -43,7 +54,81 @@
<artifactId>ui-ear</artifactId>
<version>${project.version}</version>
</dependency>
+
+ <!-- BOMs -->
+ <dependency>
+ <groupId>org.jboss.seam</groupId>
+ <artifactId>bom</artifactId>
+ <version>${project.version}</version>
+ <type>pom</type>
+ <scope>import</scope>
+ </dependency>
+
+ <!-- Common provided dependencies -->
+ <dependency>
+ <groupId>commons-logging</groupId>
+ <artifactId>commons-logging</artifactId>
+ <version>${version.commons.logging}</version>
+ <scope>provided</scope>
+ </dependency>
+
+ <!-- TestNG is not necessary -->
+ <dependency>
+ <groupId>org.jboss.seam</groupId>
+ <artifactId>jboss-seam</artifactId>
+ <version>${project.version}</version>
+ <exclusions>
+ <exclusion>
+ <groupId>org.testng</groupId>
+ <artifactId>testng</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ </exclusion>
+ </exclusions>
+ </dependency>
</dependencies>
</dependencyManagement>
+ <build>
+ <pluginManagement>
+ <plugins>
+ <plugin>
+ <artifactId>maven-ejb-plugin</artifactId>
+ <version>${version.ejb.plugin}</version>
+ <configuration>
+ <ejbVersion>3.0</ejbVersion>
+ </configuration>
+ </plugin>
+ <!-- Manage plugin versions for build stability -->
+ <plugin>
+ <artifactId>maven-surefire-plugin</artifactId>
+ <version>${version.surefire.plugin}</version>
+ <configuration>
+ <systemPropertyVariables>
+ <org.apache.maven.user-settings>${maven.user.settings}</org.apache.maven.user-settings>
+ </systemPropertyVariables>
+ </configuration>
+ </plugin>
+ <plugin>
+ <artifactId>maven-dependency-plugin</artifactId>
+ <version>${version.dependency.plugin}</version>
+ </plugin>
+ <plugin>
+ <artifactId>maven-resources-plugin</artifactId>
+ <version>${version.resources.plugin}</version>
+ </plugin>
+ <plugin>
+ <artifactId>maven-compiler-plugin</artifactId>
+ <version>${version.compiler.plugin}</version>
+ <configuration>
+ <source>${maven.compiler.source}</source>
+ <target>${maven.compiler.target}</target>
+ </configuration>
+ </plugin>
+ </plugins>
+ </pluginManagement>
+ </build>
+
</project>
Modified: branches/enterprise/WFK-2_1/examples/ui/ui-ear/pom.xml
===================================================================
--- branches/enterprise/WFK-2_1/examples/ui/ui-ear/pom.xml 2013-06-03 20:25:04 UTC (rev 15535)
+++ branches/enterprise/WFK-2_1/examples/ui/ui-ear/pom.xml 2013-06-03 20:39:42 UTC (rev 15536)
@@ -54,10 +54,20 @@
<build>
<finalName>seam-ui</finalName>
+ <pluginManagement>
+ <plugins>
+ <plugin>
+ <groupId>org.jboss.as.plugins</groupId>
+ <artifactId>jboss-as-maven-plugin</artifactId>
+ <version>${version.jboss.maven.plugin}</version>
+ </plugin>
+ </plugins>
+ </pluginManagement>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-ear-plugin</artifactId>
+ <version>${version.ear.plugin}</version>
<configuration>
<version>6</version>
<defaultLibBundleDir>lib</defaultLibBundleDir>
Modified: branches/enterprise/WFK-2_1/examples/ui/ui-web/pom.xml
===================================================================
--- branches/enterprise/WFK-2_1/examples/ui/ui-web/pom.xml 2013-06-03 20:25:04 UTC (rev 15535)
+++ branches/enterprise/WFK-2_1/examples/ui/ui-web/pom.xml 2013-06-03 20:39:42 UTC (rev 15536)
@@ -60,6 +60,7 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-war-plugin</artifactId>
+ <version>${version.war.plugin}</version>
<configuration>
<webResources>
<resource>
11 years, 5 months
Seam SVN: r15535 - in branches/enterprise/WFK-2_1/examples/tasks: tasks-ear and 12 other directories.
by seam-commits@lists.jboss.org
Author: maschmid
Date: 2013-06-03 16:25:04 -0400 (Mon, 03 Jun 2013)
New Revision: 15535
Added:
branches/enterprise/WFK-2_1/examples/tasks/tasks-ejb/src/test/
branches/enterprise/WFK-2_1/examples/tasks/tasks-ejb/src/test/java/
branches/enterprise/WFK-2_1/examples/tasks/tasks-ejb/src/test/java/org/
branches/enterprise/WFK-2_1/examples/tasks/tasks-ejb/src/test/java/org/jboss/
branches/enterprise/WFK-2_1/examples/tasks/tasks-ejb/src/test/java/org/jboss/seam/
branches/enterprise/WFK-2_1/examples/tasks/tasks-ejb/src/test/java/org/jboss/seam/example/
branches/enterprise/WFK-2_1/examples/tasks/tasks-ejb/src/test/java/org/jboss/seam/example/tasks/
branches/enterprise/WFK-2_1/examples/tasks/tasks-ejb/src/test/java/org/jboss/seam/example/tasks/test/
branches/enterprise/WFK-2_1/examples/tasks/tasks-ejb/src/test/java/org/jboss/seam/example/tasks/test/CategoryResourceTest.java
branches/enterprise/WFK-2_1/examples/tasks/tasks-ejb/src/test/java/org/jboss/seam/example/tasks/test/Deployments.java
branches/enterprise/WFK-2_1/examples/tasks/tasks-ejb/src/test/java/org/jboss/seam/example/tasks/test/ResolvedTaskResourceQueryTest.java
branches/enterprise/WFK-2_1/examples/tasks/tasks-ejb/src/test/java/org/jboss/seam/example/tasks/test/TaskResourceTest.java
branches/enterprise/WFK-2_1/examples/tasks/tasks-ejb/src/test/resources/
branches/enterprise/WFK-2_1/examples/tasks/tasks-ejb/src/test/resources/arquillian.xml
branches/enterprise/WFK-2_1/examples/tasks/tasks-ejb/src/test/resources/components.xml
branches/enterprise/WFK-2_1/examples/tasks/tasks-ejb/src/test/resources/jboss-deployment-structure.xml
branches/enterprise/WFK-2_1/examples/tasks/tasks-ejb/src/test/resources/pages.xml
branches/enterprise/WFK-2_1/examples/tasks/tasks-ejb/src/test/resources/persistence.xml
branches/enterprise/WFK-2_1/examples/tasks/tasks-ejb/src/test/resources/web.xml
Removed:
branches/enterprise/WFK-2_1/examples/tasks/tasks-tests/
Modified:
branches/enterprise/WFK-2_1/examples/tasks/pom.xml
branches/enterprise/WFK-2_1/examples/tasks/tasks-ear/pom.xml
branches/enterprise/WFK-2_1/examples/tasks/tasks-ejb/pom.xml
branches/enterprise/WFK-2_1/examples/tasks/tasks-web/pom.xml
Log:
tasks example migrated
Modified: branches/enterprise/WFK-2_1/examples/tasks/pom.xml
===================================================================
--- branches/enterprise/WFK-2_1/examples/tasks/pom.xml 2013-06-03 19:31:51 UTC (rev 15534)
+++ branches/enterprise/WFK-2_1/examples/tasks/pom.xml 2013-06-03 20:25:04 UTC (rev 15535)
@@ -3,27 +3,49 @@
<modelVersion>4.0.0</modelVersion>
<groupId>org.jboss.seam.examples</groupId>
<artifactId>tasks</artifactId>
- <parent>
- <groupId>org.jboss.seam</groupId>
- <artifactId>examples</artifactId>
- <version>2.3.1.Final-redhat-2</version>
- </parent>
+ <version>2.3.1.Final-redhat-2</version>
+
<packaging>pom</packaging>
<name>Tasks Example (EE6)</name>
<properties>
<example.name>tasks</example.name>
+ <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
+ <maven.compiler.target>1.6</maven.compiler.target>
+ <maven.compiler.source>1.6</maven.compiler.source>
+
+ <!-- To use jacoco, set jacoco.agent system property to something like
+ -javaagent:/path/to/jacocoagent.jar=append=true,destfile=/path/to/output/jacoco.exec -->
+ <jacoco.agent />
+
+ <!-- To use custom Maven settings with ShrinkWrap Resolver, uncomment
+ and customize the following property. -->
+ <!--<maven.user.settings>/path/to/custom/settings.xml</maven.user.settings>-->
+
+ <version.commons.logging>1.1.1</version.commons.logging>
+ <version.shrinkwrap.resolver>2.0.0-beta-4</version.shrinkwrap.resolver>
+
+ <!-- Plugin versions -->
+ <version.dependency.plugin>2.5.1</version.dependency.plugin>
+ <version.surefire.plugin>2.10</version.surefire.plugin>
+ <version.resources.plugin>2.6</version.resources.plugin>
+ <version.compiler.plugin>2.3.1</version.compiler.plugin>
+ <version.ear.plugin>2.6</version.ear.plugin>
+ <version.war.plugin>2.1.1</version.war.plugin>
+ <version.ejb.plugin>2.3</version.ejb.plugin>
+ <version.jboss.maven.plugin>7.4.Final</version.jboss.maven.plugin>
</properties>
<modules>
<module>tasks-ear</module>
<module>tasks-ejb</module>
<module>tasks-web</module>
- <module>tasks-tests</module>
+
</modules>
<dependencyManagement>
<dependencies>
+ <!-- Modules -->
<dependency>
<groupId>org.jboss.seam.examples.tasks</groupId>
<artifactId>tasks-ejb</artifactId>
@@ -41,6 +63,82 @@
<artifactId>tasks-ear</artifactId>
<version>${project.version}</version>
</dependency>
+
+ <!-- BOMs -->
+ <dependency>
+ <groupId>org.jboss.shrinkwrap.resolver</groupId>
+ <artifactId>shrinkwrap-resolver-bom</artifactId>
+ <version>${version.shrinkwrap.resolver}</version>
+ <scope>import</scope>
+ <type>pom</type>
+ </dependency>
+
+ <dependency>
+ <groupId>org.jboss.seam</groupId>
+ <artifactId>bom</artifactId>
+ <version>${project.version}</version>
+ <type>pom</type>
+ <scope>import</scope>
+ </dependency>
+
+ <!-- Common provided dependencies -->
+ <dependency>
+ <groupId>commons-logging</groupId>
+ <artifactId>commons-logging</artifactId>
+ <version>${version.commons.logging}</version>
+ <scope>provided</scope>
+ </dependency>
+
+ <!-- TestNG is not necessary -->
+ <dependency>
+ <groupId>org.jboss.seam</groupId>
+ <artifactId>jboss-seam</artifactId>
+ <version>${project.version}</version>
+ <exclusions>
+ <exclusion>
+ <groupId>org.testng</groupId>
+ <artifactId>testng</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ </exclusion>
+ </exclusions>
+ </dependency>
+
</dependencies>
</dependencyManagement>
+
+ <build>
+ <pluginManagement>
+ <plugins>
+ <!-- Manage plugin versions for build stability -->
+ <plugin>
+ <artifactId>maven-surefire-plugin</artifactId>
+ <version>${version.surefire.plugin}</version>
+ <configuration>
+ <systemPropertyVariables>
+ <org.apache.maven.user-settings>${maven.user.settings}</org.apache.maven.user-settings>
+ </systemPropertyVariables>
+ </configuration>
+ </plugin>
+ <plugin>
+ <artifactId>maven-dependency-plugin</artifactId>
+ <version>${version.dependency.plugin}</version>
+ </plugin>
+ <plugin>
+ <artifactId>maven-resources-plugin</artifactId>
+ <version>${version.resources.plugin}</version>
+ </plugin>
+ <plugin>
+ <artifactId>maven-compiler-plugin</artifactId>
+ <version>${version.compiler.plugin}</version>
+ <configuration>
+ <source>${maven.compiler.source}</source>
+ <target>${maven.compiler.target}</target>
+ </configuration>
+ </plugin>
+ </plugins>
+ </pluginManagement>
+ </build>
</project>
Modified: branches/enterprise/WFK-2_1/examples/tasks/tasks-ear/pom.xml
===================================================================
--- branches/enterprise/WFK-2_1/examples/tasks/tasks-ear/pom.xml 2013-06-03 19:31:51 UTC (rev 15534)
+++ branches/enterprise/WFK-2_1/examples/tasks/tasks-ear/pom.xml 2013-06-03 20:25:04 UTC (rev 15535)
@@ -49,10 +49,20 @@
<build>
<finalName>seam-tasks</finalName>
+ <pluginManagement>
+ <plugins>
+ <plugin>
+ <groupId>org.jboss.as.plugins</groupId>
+ <artifactId>jboss-as-maven-plugin</artifactId>
+ <version>${version.jboss.maven.plugin}</version>
+ </plugin>
+ </plugins>
+ </pluginManagement>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-ear-plugin</artifactId>
+ <version>${version.ear.plugin}</version>
<configuration>
<version>6</version>
<defaultLibBundleDir>lib</defaultLibBundleDir>
Modified: branches/enterprise/WFK-2_1/examples/tasks/tasks-ejb/pom.xml
===================================================================
--- branches/enterprise/WFK-2_1/examples/tasks/tasks-ejb/pom.xml 2013-06-03 19:31:51 UTC (rev 15534)
+++ branches/enterprise/WFK-2_1/examples/tasks/tasks-ejb/pom.xml 2013-06-03 20:25:04 UTC (rev 15535)
@@ -84,6 +84,113 @@
</exclusion>
</exclusions>
</dependency>
+
+ <!-- Test dependencies -->
+ <dependency>
+ <groupId>org.jboss.shrinkwrap.resolver</groupId>
+ <artifactId>shrinkwrap-resolver-depchain</artifactId>
+ <type>pom</type>
+ <scope>test</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <scope>test</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.jboss.arquillian.junit</groupId>
+ <artifactId>arquillian-junit-container</artifactId>
+ <scope>test</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.jboss.arquillian.protocol</groupId>
+ <artifactId>arquillian-protocol-servlet</artifactId>
+ <scope>test</scope>
+ </dependency>
+
</dependencies>
-
+
+ <profiles>
+
+ <profile>
+ <id>integration-tests</id>
+ <activation>
+ <property>
+ <name>arquillian</name>
+ </property>
+ </activation>
+ <properties>
+ <jndiPattern>java:app/seam-tasks/#{ejbName}</jndiPattern>
+ <distributable>false</distributable>
+ </properties>
+ <build>
+ <testResources>
+ <testResource>
+ <directory>src/test/resources</directory>
+ <filtering>true</filtering>
+ </testResource>
+ </testResources>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-surefire-plugin</artifactId>
+ <configuration>
+ <skip>false</skip>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+ </profile>
+
+ <profile>
+ <id>arq-jbossas-7-managed</id>
+ <activation>
+ <property>
+ <name>arquillian</name>
+ <value>jbossas-managed-7</value>
+ </property>
+ </activation>
+ <dependencies>
+ <dependency>
+ <groupId>org.jboss.as</groupId>
+ <artifactId>jboss-as-arquillian-container-managed</artifactId>
+ <scope>test</scope>
+ </dependency>
+ </dependencies>
+ </profile>
+
+ <profile>
+ <id>arq-jbossas-7-remote</id>
+ <activation>
+ <property>
+ <name>arquillian</name>
+ <value>jbossas-remote-7</value>
+ </property>
+ </activation>
+ <dependencies>
+ <dependency>
+ <groupId>org.jboss.as</groupId>
+ <artifactId>jboss-as-arquillian-container-remote</artifactId>
+ <scope>test</scope>
+ </dependency>
+ </dependencies>
+ </profile>
+ </profiles>
+
+ <build>
+ <plugins>
+ <!-- Skip tests by default -->
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-surefire-plugin</artifactId>
+ <configuration>
+ <skip>true</skip>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+
</project>
Added: branches/enterprise/WFK-2_1/examples/tasks/tasks-ejb/src/test/java/org/jboss/seam/example/tasks/test/CategoryResourceTest.java
===================================================================
--- branches/enterprise/WFK-2_1/examples/tasks/tasks-ejb/src/test/java/org/jboss/seam/example/tasks/test/CategoryResourceTest.java (rev 0)
+++ branches/enterprise/WFK-2_1/examples/tasks/tasks-ejb/src/test/java/org/jboss/seam/example/tasks/test/CategoryResourceTest.java 2013-06-03 20:25:04 UTC (rev 15535)
@@ -0,0 +1,182 @@
+/*
+ * 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.tasks.test;
+
+import org.jboss.arquillian.container.test.api.Deployment;
+import org.jboss.arquillian.container.test.api.OverProtocol;
+import org.jboss.arquillian.junit.Arquillian;
+
+import static org.jboss.seam.mock.ResourceRequestEnvironment.Method;
+import static org.jboss.seam.mock.ResourceRequestEnvironment.ResourceRequest;
+import org.jboss.seam.mock.EnhancedMockHttpServletRequest;
+import org.jboss.seam.mock.EnhancedMockHttpServletResponse;
+import org.jboss.seam.mock.JUnitSeamTest;
+import org.jboss.seam.mock.ResourceRequestEnvironment;
+import org.jboss.shrinkwrap.api.Archive;
+import org.jboss.shrinkwrap.api.spec.EnterpriseArchive;
+import org.jboss.shrinkwrap.api.spec.WebArchive;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+
+/**
+ * Test class for /category part of API
+ * @author Jozef Hartinger
+ *
+ */
+(a)RunWith(Arquillian.class)
+public class CategoryResourceTest extends JUnitSeamTest
+{
+ @Deployment(name="CategoryResourceTest")
+ @OverProtocol("Servlet 3.0")
+ public static Archive<?> createDeployment()
+ {
+ return Deployments.tasksDeployment();
+ }
+
+ @Test
+ public void getCategoryListTest() throws Exception
+ {
+ String[][] data = new String[][] { new String[] { "application/xml", "<category><name>School</name></category>" }, new String[] { "application/json", "{\"category\":{\"name\":\"School\"}}" } };
+
+ for (final String[] caseData : data) {
+ new ResourceRequest(new ResourceRequestEnvironment(this), Method.GET, "/v1/auth/category")
+ {
+
+ @Override
+ protected void prepareRequest(EnhancedMockHttpServletRequest request)
+ {
+ super.prepareRequest(request);
+ request.addHeader("Accept", caseData[0]);
+ request.addHeader("Authorization", "Basic ZGVtbzpkZW1v"); // demo:demo
+ }
+
+ @Override
+ protected void onResponse(EnhancedMockHttpServletResponse response)
+ {
+ super.onResponse(response);
+ assertEquals("Unexpected response code.", 200, response.getStatus());
+ assertTrue("Unexpected response.", response.getContentAsString().contains(caseData[1]));
+ }
+
+ }.run();
+ }
+ }
+
+ @Test
+ public void deleteCategoryTest() throws Exception
+ {
+ new ResourceRequest(new ResourceRequestEnvironment(this), Method.DELETE, "/v1/auth/category/Work")
+ {
+
+ @Override
+ protected void prepareRequest(EnhancedMockHttpServletRequest request)
+ {
+ super.prepareRequest(request);
+ request.addHeader("Accept", "application/xml");
+ request.addHeader("Authorization", "Basic ZGVtbzpkZW1v"); // demo:demo
+ }
+
+ @Override
+ protected void onResponse(EnhancedMockHttpServletResponse response)
+ {
+ super.onResponse(response);
+ assertEquals("Unexpected response code.", 204, response.getStatus());
+ }
+
+ }.run();
+ }
+
+ @Test
+ public void createCategoryTest() throws Exception
+ {
+
+ final String uri = "/v1/auth/category/Test%20Category";
+ final String mimeType = "application/json";
+ final String expectedResponse = "{\"category\":{\"name\":\"Test Category\"}}";
+
+ new ResourceRequest(new ResourceRequestEnvironment(this), Method.PUT, uri)
+ {
+
+ @Override
+ protected void prepareRequest(EnhancedMockHttpServletRequest request)
+ {
+ super.prepareRequest(request);
+ request.addHeader("Authorization", "Basic ZGVtbzpkZW1v"); // demo:demo
+ }
+
+ @Override
+ protected void onResponse(EnhancedMockHttpServletResponse response)
+ {
+ super.onResponse(response);
+ assertEquals("Unexpected response code.", 201, response.getStatus());
+ }
+
+ }.run();
+
+ new ResourceRequest(new ResourceRequestEnvironment(this), Method.GET, uri)
+ {
+
+ @Override
+ protected void prepareRequest(EnhancedMockHttpServletRequest request)
+ {
+ super.prepareRequest(request);
+ request.addHeader("Accept", mimeType);
+ request.addHeader("Authorization", "Basic ZGVtbzpkZW1v"); // demo:demo
+ }
+
+ @Override
+ protected void onResponse(EnhancedMockHttpServletResponse response)
+ {
+ super.onResponse(response);
+ assertEquals("Unexpected response code.", 200, response.getStatus());
+ assertEquals("Unexpected response.", expectedResponse, response.getContentAsString());
+ }
+
+ }.run();
+ }
+
+ @Test
+ public void noAuthorizationHeaderTest() throws Exception
+ {
+ new ResourceRequest(new ResourceRequestEnvironment(this), Method.GET, "/v1/auth/category")
+ {
+
+ @Override
+ protected void prepareRequest(EnhancedMockHttpServletRequest request)
+ {
+ super.prepareRequest(request);
+ request.addHeader("Accept", "application/xml");
+ }
+
+ @Override
+ protected void onResponse(EnhancedMockHttpServletResponse response)
+ {
+ super.onResponse(response);
+ assertEquals("Unexpected response code.", 401, response.getStatus());
+ }
+
+ }.run();
+ }
+
+}
Added: branches/enterprise/WFK-2_1/examples/tasks/tasks-ejb/src/test/java/org/jboss/seam/example/tasks/test/Deployments.java
===================================================================
--- branches/enterprise/WFK-2_1/examples/tasks/tasks-ejb/src/test/java/org/jboss/seam/example/tasks/test/Deployments.java (rev 0)
+++ branches/enterprise/WFK-2_1/examples/tasks/tasks-ejb/src/test/java/org/jboss/seam/example/tasks/test/Deployments.java 2013-06-03 20:25:04 UTC (rev 15535)
@@ -0,0 +1,42 @@
+package org.jboss.seam.example.tasks.test;
+
+import org.jboss.shrinkwrap.api.ShrinkWrap;
+import org.jboss.shrinkwrap.api.importer.ZipImporter;
+import org.jboss.shrinkwrap.api.spec.WebArchive;
+import org.jboss.shrinkwrap.resolver.api.maven.Maven;
+
+import java.io.File;
+
+public class Deployments {
+ public static WebArchive tasksDeployment() {
+ File[] libs = Maven.resolver().loadPomFromFile("pom.xml")
+ .importCompileAndRuntimeDependencies()
+ // force resolve jboss-seam, because it is provided-scoped in the pom, but we need it bundled in the WAR
+ .resolve("org.jboss.seam:jboss-seam")
+ .withTransitivity().asFile();
+
+ WebArchive war = ShrinkWrap.create(WebArchive.class, "seam-tasks.war")
+ .addPackages(true, "org.jboss.seam.example.tasks")
+
+ // already in EJB module
+ .addAsResource("import.sql", "import.sql")
+ .addAsResource("seam.properties", "seam.properties")
+ .addAsWebInfResource("META-INF/ejb-jar.xml", "ejb-jar.xml")
+
+ // test-specific persistence.xml
+ .addAsResource("persistence.xml", "META-INF/persistence.xml")
+
+ // manually copied from Web module
+ .addAsWebInfResource("pages.xml", "pages.xml")
+
+ // manually copied from Web module, modified
+ .addAsWebInfResource("web.xml", "web.xml") // only contains MockSeamListener definition
+ .addAsWebInfResource("components.xml", "components.xml") // corrected ejb component jndi-name references from java:app/jboss-seam to java:app/seam-tasks
+
+ // manually copied from EAR module
+ .addAsWebInfResource("jboss-deployment-structure.xml", "jboss-deployment-structure.xml")
+ .addAsLibraries(libs);
+
+ return war;
+ }
+}
Added: branches/enterprise/WFK-2_1/examples/tasks/tasks-ejb/src/test/java/org/jboss/seam/example/tasks/test/ResolvedTaskResourceQueryTest.java
===================================================================
--- branches/enterprise/WFK-2_1/examples/tasks/tasks-ejb/src/test/java/org/jboss/seam/example/tasks/test/ResolvedTaskResourceQueryTest.java (rev 0)
+++ branches/enterprise/WFK-2_1/examples/tasks/tasks-ejb/src/test/java/org/jboss/seam/example/tasks/test/ResolvedTaskResourceQueryTest.java 2013-06-03 20:25:04 UTC (rev 15535)
@@ -0,0 +1,119 @@
+/*
+ * 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.tasks.test;
+
+import org.jboss.arquillian.container.test.api.Deployment;
+import org.jboss.arquillian.container.test.api.OverProtocol;
+import org.jboss.arquillian.junit.Arquillian;
+
+import static org.jboss.seam.mock.ResourceRequestEnvironment.Method;
+import static org.jboss.seam.mock.ResourceRequestEnvironment.ResourceRequest;
+import org.jboss.seam.mock.EnhancedMockHttpServletRequest;
+import org.jboss.seam.mock.EnhancedMockHttpServletResponse;
+import org.jboss.seam.mock.JUnitSeamTest;
+import org.jboss.seam.mock.ResourceRequestEnvironment;
+import org.jboss.shrinkwrap.api.Archive;
+import org.jboss.shrinkwrap.api.spec.WebArchive;
+import org.junit.Test;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
+import org.junit.Before;
+import org.junit.runner.RunWith;
+
+/**
+ * Test class for /user/{username}/tasks/resolved part of API.
+ * @author Jozef Hartinger
+ *
+ */
+(a)RunWith(Arquillian.class)
+public class ResolvedTaskResourceQueryTest extends JUnitSeamTest
+{
+
+ @Deployment(name="ResolvedTaskResourceQueryTest")
+ @OverProtocol("Servlet 3.0")
+ public static Archive<?> createDeployment()
+ {
+ return Deployments.tasksDeployment();
+ }
+
+ // We could do this BeforeClass only once but we can't do ResourceRequests there
+ @Before
+ public void resolveTask() throws Exception {
+
+ final String mimeType = "application/xml";
+ final String representation = "<task><id>14</id></task>";
+
+ new ResourceRequest(new ResourceRequestEnvironment(this), Method.PUT, "/v1/auth/category/School/resolved/14")
+ {
+
+ @Override
+ protected void prepareRequest(EnhancedMockHttpServletRequest request)
+ {
+ super.prepareRequest(request);
+ request.addHeader("Authorization", "Basic ZGVtbzpkZW1v"); // demo:demo
+ request.addHeader("Content-Type", mimeType);
+ request.setContentType(mimeType);
+ request.setContent(representation.getBytes());
+ }
+
+ @Override
+ protected void onResponse(EnhancedMockHttpServletResponse response)
+ {
+ super.onResponse(response);
+ assertEquals("Unexpected response code.", 204, response.getStatus());
+ }
+
+ }.run();
+ }
+
+ @Test
+ public void editTaskTest() throws Exception
+ {
+ String[][] data = new String[][] {
+ new String[] {"application/xml", "<name>Get a haircut</name>"},
+ new String[] {"application/json", "\"name\":\"Get a haircut\""},
+ new String[] {"application/atom+xml", "<atom:title>Get a haircut</atom:title>"}
+ };
+
+ for(final String[] caseData : data) {
+ new ResourceRequest(new ResourceRequestEnvironment(this), Method.GET, "/v1/user/demo/tasks/resolved")
+ {
+
+ @Override
+ protected void prepareRequest(EnhancedMockHttpServletRequest request)
+ {
+ super.prepareRequest(request);
+ request.addHeader("Accept", caseData[0]);
+ }
+
+ @Override
+ protected void onResponse(EnhancedMockHttpServletResponse response)
+ {
+ super.onResponse(response);
+ assertEquals("Unexpected response code.", 200, response.getStatus());
+ assertTrue("Unexpected response.", response.getContentAsString().contains(caseData[1]));
+ }
+
+ }.run();
+ }
+ }
+}
Added: branches/enterprise/WFK-2_1/examples/tasks/tasks-ejb/src/test/java/org/jboss/seam/example/tasks/test/TaskResourceTest.java
===================================================================
--- branches/enterprise/WFK-2_1/examples/tasks/tasks-ejb/src/test/java/org/jboss/seam/example/tasks/test/TaskResourceTest.java (rev 0)
+++ branches/enterprise/WFK-2_1/examples/tasks/tasks-ejb/src/test/java/org/jboss/seam/example/tasks/test/TaskResourceTest.java 2013-06-03 20:25:04 UTC (rev 15535)
@@ -0,0 +1,157 @@
+/*
+ * 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.tasks.test;
+
+import org.jboss.arquillian.container.test.api.Deployment;
+import org.jboss.arquillian.container.test.api.OverProtocol;
+import org.jboss.arquillian.junit.Arquillian;
+
+import static org.jboss.seam.mock.ResourceRequestEnvironment.Method;
+import static org.jboss.seam.mock.ResourceRequestEnvironment.ResourceRequest;
+import org.jboss.seam.mock.EnhancedMockHttpServletRequest;
+import org.jboss.seam.mock.EnhancedMockHttpServletResponse;
+import org.jboss.seam.mock.JUnitSeamTest;
+import org.jboss.seam.mock.ResourceRequestEnvironment;
+import org.jboss.shrinkwrap.api.Archive;
+import org.jboss.shrinkwrap.api.spec.WebArchive;
+import org.junit.Test;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
+import org.junit.runner.RunWith;
+
+/**
+ * Test class for TaskResourceHome and TaskResourceQuery components.
+ * @author Jozef Hartinger
+ *
+ */
+(a)RunWith(Arquillian.class)
+public class TaskResourceTest extends JUnitSeamTest
+{
+ @Deployment(name="TaskResourceTest")
+ @OverProtocol("Servlet 3.0")
+ public static Archive<?> createDeployment()
+ {
+ return Deployments.tasksDeployment();
+ }
+
+ @Test
+ public void createTaskTest() throws Exception
+ {
+ final String mimeType = "application/json";
+ final String representation = "{\"task\":{\"name\":\"Test task\"}}";
+
+ new ResourceRequest(new ResourceRequestEnvironment(this), Method.POST, "/v1/auth/category/School/unresolved")
+ {
+
+ @Override
+ protected void prepareRequest(EnhancedMockHttpServletRequest request)
+ {
+ super.prepareRequest(request);
+ request.addHeader("Authorization", "Basic ZGVtbzpkZW1v"); // demo:demo
+ request.addHeader("Content-Type", mimeType);
+ request.setContentType(mimeType);
+ request.setContent(representation.getBytes());
+ }
+
+ @Override
+ protected void onResponse(EnhancedMockHttpServletResponse response)
+ {
+ super.onResponse(response);
+ assertEquals("Unexpected response code.", 201, response.getStatus());
+ }
+
+ }.run();
+ }
+
+ @Test
+ public void editTaskTest() throws Exception
+ {
+ final String mimeType = "application/xml";
+ final String representation = "<task><id>4</id><name>Learn new English vocabulary</name></task>";
+
+ new ResourceRequest(new ResourceRequestEnvironment(this), Method.PUT, "/v1/auth/category/School/unresolved/4")
+ {
+
+ @Override
+ protected void prepareRequest(EnhancedMockHttpServletRequest request)
+ {
+ super.prepareRequest(request);
+ request.addHeader("Authorization", "Basic ZGVtbzpkZW1v"); // demo:demo
+ request.addHeader("Content-Type", mimeType);
+ request.setContentType(mimeType);
+ request.setContent(representation.getBytes());
+ }
+
+ @Override
+ protected void onResponse(EnhancedMockHttpServletResponse response)
+ {
+ super.onResponse(response);
+ assertEquals("Unexpected response code.", 204, response.getStatus());
+ }
+
+ }.run();
+
+ new ResourceRequest(new ResourceRequestEnvironment(this), Method.GET, "/v1/auth/category/School/unresolved/4")
+ {
+
+ @Override
+ protected void prepareRequest(EnhancedMockHttpServletRequest request)
+ {
+ super.prepareRequest(request);
+ request.addHeader("Accept", "application/xml");
+ request.addHeader("Authorization", "Basic ZGVtbzpkZW1v"); // demo:demo
+ }
+
+ @Override
+ protected void onResponse(EnhancedMockHttpServletResponse response)
+ {
+ super.onResponse(response);
+ assertEquals("Unexpected response code.", 200, response.getStatus());
+ assertTrue("Unexpected response.", response.getContentAsString().contains("Learn new English vocabulary"));
+ }
+
+ }.run();
+ }
+
+ @Test
+ public void deleteTaskTest() throws Exception
+ {
+ new ResourceRequest(new ResourceRequestEnvironment(this), Method.DELETE, "/v1/auth/category/School/unresolved/2")
+ {
+
+ @Override
+ protected void prepareRequest(EnhancedMockHttpServletRequest request)
+ {
+ super.prepareRequest(request);
+ request.addHeader("Authorization", "Basic ZGVtbzpkZW1v"); // demo:demo
+ }
+
+ @Override
+ protected void onResponse(EnhancedMockHttpServletResponse response)
+ {
+ super.onResponse(response);
+ assertEquals("Unexpected response code.", 204, response.getStatus());
+ }
+
+ }.run();
+ }
+}
Added: branches/enterprise/WFK-2_1/examples/tasks/tasks-ejb/src/test/resources/arquillian.xml
===================================================================
(Binary files differ)
Property changes on: branches/enterprise/WFK-2_1/examples/tasks/tasks-ejb/src/test/resources/arquillian.xml
___________________________________________________________________
Added: svn:mime-type
+ application/xml
Added: branches/enterprise/WFK-2_1/examples/tasks/tasks-ejb/src/test/resources/components.xml
===================================================================
(Binary files differ)
Property changes on: branches/enterprise/WFK-2_1/examples/tasks/tasks-ejb/src/test/resources/components.xml
___________________________________________________________________
Added: svn:mime-type
+ application/xml
Added: branches/enterprise/WFK-2_1/examples/tasks/tasks-ejb/src/test/resources/jboss-deployment-structure.xml
===================================================================
--- branches/enterprise/WFK-2_1/examples/tasks/tasks-ejb/src/test/resources/jboss-deployment-structure.xml (rev 0)
+++ branches/enterprise/WFK-2_1/examples/tasks/tasks-ejb/src/test/resources/jboss-deployment-structure.xml 2013-06-03 20:25:04 UTC (rev 15535)
@@ -0,0 +1,12 @@
+<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>
+ <exclusions>
+ <module name="org.jboss.resteasy.resteasy-jackson-provider" slot="main"/>
+ </exclusions>
+ </deployment>
+</jboss-deployment-structure>
Added: branches/enterprise/WFK-2_1/examples/tasks/tasks-ejb/src/test/resources/pages.xml
===================================================================
(Binary files differ)
Property changes on: branches/enterprise/WFK-2_1/examples/tasks/tasks-ejb/src/test/resources/pages.xml
___________________________________________________________________
Added: svn:mime-type
+ application/xml
Added: branches/enterprise/WFK-2_1/examples/tasks/tasks-ejb/src/test/resources/persistence.xml
===================================================================
(Binary files differ)
Property changes on: branches/enterprise/WFK-2_1/examples/tasks/tasks-ejb/src/test/resources/persistence.xml
___________________________________________________________________
Added: svn:mime-type
+ application/xml
Added: branches/enterprise/WFK-2_1/examples/tasks/tasks-ejb/src/test/resources/web.xml
===================================================================
(Binary files differ)
Property changes on: branches/enterprise/WFK-2_1/examples/tasks/tasks-ejb/src/test/resources/web.xml
___________________________________________________________________
Added: svn:mime-type
+ application/xml
Modified: branches/enterprise/WFK-2_1/examples/tasks/tasks-web/pom.xml
===================================================================
--- branches/enterprise/WFK-2_1/examples/tasks/tasks-web/pom.xml 2013-06-03 19:31:51 UTC (rev 15534)
+++ branches/enterprise/WFK-2_1/examples/tasks/tasks-web/pom.xml 2013-06-03 20:25:04 UTC (rev 15535)
@@ -72,6 +72,7 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-war-plugin</artifactId>
+ <version>${version.war.plugin}</version>
<configuration>
<webResources>
<resource>
11 years, 5 months
Seam SVN: r15534 - in branches/enterprise/WFK-2_1/examples: blog/blog-ejb and 36 other directories.
by seam-commits@lists.jboss.org
Author: rsmeral
Date: 2013-06-03 15:31:51 -0400 (Mon, 03 Jun 2013)
New Revision: 15534
Added:
branches/enterprise/WFK-2_1/examples/jpa/README.md
branches/enterprise/WFK-2_1/examples/jpa/jpa-web/src/test/
branches/enterprise/WFK-2_1/examples/jpa/jpa-web/src/test/java/
branches/enterprise/WFK-2_1/examples/jpa/jpa-web/src/test/java/org/
branches/enterprise/WFK-2_1/examples/jpa/jpa-web/src/test/java/org/jboss/
branches/enterprise/WFK-2_1/examples/jpa/jpa-web/src/test/java/org/jboss/seam/
branches/enterprise/WFK-2_1/examples/jpa/jpa-web/src/test/java/org/jboss/seam/example/
branches/enterprise/WFK-2_1/examples/jpa/jpa-web/src/test/java/org/jboss/seam/example/jpa/
branches/enterprise/WFK-2_1/examples/jpa/jpa-web/src/test/java/org/jboss/seam/example/jpa/test/
branches/enterprise/WFK-2_1/examples/jpa/jpa-web/src/test/java/org/jboss/seam/example/jpa/test/BookingTest.java
branches/enterprise/WFK-2_1/examples/jpa/jpa-web/src/test/java/org/jboss/seam/example/jpa/test/ChangePasswordTest.java
branches/enterprise/WFK-2_1/examples/jpa/jpa-web/src/test/java/org/jboss/seam/example/jpa/test/Deployments.java
branches/enterprise/WFK-2_1/examples/jpa/jpa-web/src/test/java/org/jboss/seam/example/jpa/test/LoginTest.java
branches/enterprise/WFK-2_1/examples/jpa/jpa-web/src/test/resources/
branches/enterprise/WFK-2_1/examples/jpa/jpa-web/src/test/resources/arquillian.xml
branches/enterprise/WFK-2_1/examples/jpa/jpa-web/src/test/resources/web.xml
branches/enterprise/WFK-2_1/examples/nestedbooking/nestedbooking-ejb/src/test/
branches/enterprise/WFK-2_1/examples/nestedbooking/nestedbooking-ejb/src/test/java/
branches/enterprise/WFK-2_1/examples/nestedbooking/nestedbooking-ejb/src/test/java/org/
branches/enterprise/WFK-2_1/examples/nestedbooking/nestedbooking-ejb/src/test/java/org/jboss/
branches/enterprise/WFK-2_1/examples/nestedbooking/nestedbooking-ejb/src/test/java/org/jboss/seam/
branches/enterprise/WFK-2_1/examples/nestedbooking/nestedbooking-ejb/src/test/java/org/jboss/seam/example/
branches/enterprise/WFK-2_1/examples/nestedbooking/nestedbooking-ejb/src/test/java/org/jboss/seam/example/nestedbooking/
branches/enterprise/WFK-2_1/examples/nestedbooking/nestedbooking-ejb/src/test/java/org/jboss/seam/example/nestedbooking/test/
branches/enterprise/WFK-2_1/examples/nestedbooking/nestedbooking-ejb/src/test/java/org/jboss/seam/example/nestedbooking/test/BookingTest.java
branches/enterprise/WFK-2_1/examples/nestedbooking/nestedbooking-ejb/src/test/java/org/jboss/seam/example/nestedbooking/test/ChangePasswordTest.java
branches/enterprise/WFK-2_1/examples/nestedbooking/nestedbooking-ejb/src/test/java/org/jboss/seam/example/nestedbooking/test/Deployments.java
branches/enterprise/WFK-2_1/examples/nestedbooking/nestedbooking-ejb/src/test/java/org/jboss/seam/example/nestedbooking/test/LoginTest.java
branches/enterprise/WFK-2_1/examples/nestedbooking/nestedbooking-ejb/src/test/resources/
branches/enterprise/WFK-2_1/examples/nestedbooking/nestedbooking-ejb/src/test/resources/arquillian.xml
branches/enterprise/WFK-2_1/examples/nestedbooking/nestedbooking-ejb/src/test/resources/components.xml
branches/enterprise/WFK-2_1/examples/nestedbooking/nestedbooking-ejb/src/test/resources/jboss-deployment-structure.xml
branches/enterprise/WFK-2_1/examples/nestedbooking/nestedbooking-ejb/src/test/resources/persistence.xml
branches/enterprise/WFK-2_1/examples/nestedbooking/nestedbooking-ejb/src/test/resources/web.xml
branches/enterprise/WFK-2_1/examples/spring/README.md
Removed:
branches/enterprise/WFK-2_1/examples/jpa/jpa-tests/
branches/enterprise/WFK-2_1/examples/jpa/readme.txt
branches/enterprise/WFK-2_1/examples/nestedbooking/nestedbooking-tests/
branches/enterprise/WFK-2_1/examples/nestedbooking/readme.txt
branches/enterprise/WFK-2_1/examples/spring/readme.txt
branches/enterprise/WFK-2_1/examples/spring/spring-tests/
Modified:
branches/enterprise/WFK-2_1/examples/blog/blog-ear/pom.xml
branches/enterprise/WFK-2_1/examples/blog/blog-ejb/pom.xml
branches/enterprise/WFK-2_1/examples/blog/blog-web/pom.xml
branches/enterprise/WFK-2_1/examples/booking/booking-ear/pom.xml
branches/enterprise/WFK-2_1/examples/booking/booking-ejb/pom.xml
branches/enterprise/WFK-2_1/examples/booking/booking-web/pom.xml
branches/enterprise/WFK-2_1/examples/groovybooking/groovybooking-web/pom.xml
branches/enterprise/WFK-2_1/examples/hibernate/hibernate-web/pom.xml
branches/enterprise/WFK-2_1/examples/jee6/jee6-web/pom.xml
branches/enterprise/WFK-2_1/examples/jpa/jpa-web/pom.xml
branches/enterprise/WFK-2_1/examples/jpa/jpa-web/src/main/resources/META-INF/persistence.xml
branches/enterprise/WFK-2_1/examples/jpa/pom.xml
branches/enterprise/WFK-2_1/examples/nestedbooking/nestedbooking-ear/pom.xml
branches/enterprise/WFK-2_1/examples/nestedbooking/nestedbooking-ejb/pom.xml
branches/enterprise/WFK-2_1/examples/nestedbooking/nestedbooking-web/pom.xml
branches/enterprise/WFK-2_1/examples/nestedbooking/pom.xml
branches/enterprise/WFK-2_1/examples/spring/pom.xml
branches/enterprise/WFK-2_1/examples/spring/spring-web/pom.xml
Log:
jpa, nestedbooking, spring converted
Modified: branches/enterprise/WFK-2_1/examples/blog/blog-ear/pom.xml
===================================================================
--- branches/enterprise/WFK-2_1/examples/blog/blog-ear/pom.xml 2013-06-03 18:05:17 UTC (rev 15533)
+++ branches/enterprise/WFK-2_1/examples/blog/blog-ear/pom.xml 2013-06-03 19:31:51 UTC (rev 15534)
@@ -5,7 +5,7 @@
<parent>
<artifactId>blog</artifactId>
<groupId>org.jboss.seam.examples</groupId>
- <version>2.3.1-SNAPSHOT</version>
+ <version>2.3.1.Final-redhat-2</version>
<relativePath>../pom.xml</relativePath>
</parent>
Modified: branches/enterprise/WFK-2_1/examples/blog/blog-ejb/pom.xml
===================================================================
--- branches/enterprise/WFK-2_1/examples/blog/blog-ejb/pom.xml 2013-06-03 18:05:17 UTC (rev 15533)
+++ branches/enterprise/WFK-2_1/examples/blog/blog-ejb/pom.xml 2013-06-03 19:31:51 UTC (rev 15534)
@@ -5,7 +5,7 @@
<parent>
<groupId>org.jboss.seam.examples</groupId>
<artifactId>blog</artifactId>
- <version>2.3.1-SNAPSHOT</version>
+ <version>2.3.1.Final-redhat-2</version>
<relativePath>../pom.xml</relativePath>
</parent>
Modified: branches/enterprise/WFK-2_1/examples/blog/blog-web/pom.xml
===================================================================
--- branches/enterprise/WFK-2_1/examples/blog/blog-web/pom.xml 2013-06-03 18:05:17 UTC (rev 15533)
+++ branches/enterprise/WFK-2_1/examples/blog/blog-web/pom.xml 2013-06-03 19:31:51 UTC (rev 15534)
@@ -6,7 +6,7 @@
<parent>
<artifactId>blog</artifactId>
<groupId>org.jboss.seam.examples</groupId>
- <version>2.3.1-SNAPSHOT</version>
+ <version>2.3.1.Final-redhat-2</version>
<relativePath>../pom.xml</relativePath>
</parent>
Modified: branches/enterprise/WFK-2_1/examples/booking/booking-ear/pom.xml
===================================================================
--- branches/enterprise/WFK-2_1/examples/booking/booking-ear/pom.xml 2013-06-03 18:05:17 UTC (rev 15533)
+++ branches/enterprise/WFK-2_1/examples/booking/booking-ear/pom.xml 2013-06-03 19:31:51 UTC (rev 15534)
@@ -4,7 +4,7 @@
<parent>
<groupId>org.jboss.seam.examples</groupId>
<artifactId>booking</artifactId>
- <version>2.3.1-SNAPSHOT</version>
+ <version>2.3.1.Final-redhat-2</version>
<relativePath>../pom.xml</relativePath>
</parent>
Modified: branches/enterprise/WFK-2_1/examples/booking/booking-ejb/pom.xml
===================================================================
--- branches/enterprise/WFK-2_1/examples/booking/booking-ejb/pom.xml 2013-06-03 18:05:17 UTC (rev 15533)
+++ branches/enterprise/WFK-2_1/examples/booking/booking-ejb/pom.xml 2013-06-03 19:31:51 UTC (rev 15534)
@@ -4,7 +4,7 @@
<parent>
<groupId>org.jboss.seam.examples</groupId>
<artifactId>booking</artifactId>
- <version>2.3.1-SNAPSHOT</version>
+ <version>2.3.1.Final-redhat-2</version>
<relativePath>../pom.xml</relativePath>
</parent>
Modified: branches/enterprise/WFK-2_1/examples/booking/booking-web/pom.xml
===================================================================
--- branches/enterprise/WFK-2_1/examples/booking/booking-web/pom.xml 2013-06-03 18:05:17 UTC (rev 15533)
+++ branches/enterprise/WFK-2_1/examples/booking/booking-web/pom.xml 2013-06-03 19:31:51 UTC (rev 15534)
@@ -4,7 +4,7 @@
<parent>
<groupId>org.jboss.seam.examples</groupId>
<artifactId>booking</artifactId>
- <version>2.3.1-SNAPSHOT</version>
+ <version>2.3.1.Final-redhat-2</version>
<relativePath>../pom.xml</relativePath>
</parent>
Modified: branches/enterprise/WFK-2_1/examples/groovybooking/groovybooking-web/pom.xml
===================================================================
--- branches/enterprise/WFK-2_1/examples/groovybooking/groovybooking-web/pom.xml 2013-06-03 18:05:17 UTC (rev 15533)
+++ branches/enterprise/WFK-2_1/examples/groovybooking/groovybooking-web/pom.xml 2013-06-03 19:31:51 UTC (rev 15534)
@@ -6,7 +6,7 @@
<parent>
<artifactId>groovybooking</artifactId>
<groupId>org.jboss.seam.examples</groupId>
- <version>2.3.1-SNAPSHOT</version>
+ <version>2.3.1.Final-redhat-2</version>
<relativePath>../pom.xml</relativePath>
</parent>
Modified: branches/enterprise/WFK-2_1/examples/hibernate/hibernate-web/pom.xml
===================================================================
--- branches/enterprise/WFK-2_1/examples/hibernate/hibernate-web/pom.xml 2013-06-03 18:05:17 UTC (rev 15533)
+++ branches/enterprise/WFK-2_1/examples/hibernate/hibernate-web/pom.xml 2013-06-03 19:31:51 UTC (rev 15534)
@@ -5,7 +5,7 @@
<parent>
<groupId>org.jboss.seam.examples</groupId>
<artifactId>hibernate</artifactId>
- <version>2.3.1-SNAPSHOT</version>
+ <version>2.3.1.Final-redhat-2</version>
<relativePath>../pom.xml</relativePath>
</parent>
Modified: branches/enterprise/WFK-2_1/examples/jee6/jee6-web/pom.xml
===================================================================
--- branches/enterprise/WFK-2_1/examples/jee6/jee6-web/pom.xml 2013-06-03 18:05:17 UTC (rev 15533)
+++ branches/enterprise/WFK-2_1/examples/jee6/jee6-web/pom.xml 2013-06-03 19:31:51 UTC (rev 15534)
@@ -5,7 +5,7 @@
<parent>
<groupId>org.jboss.seam.examples</groupId>
<artifactId>jee6</artifactId>
- <version>2.3.1-SNAPSHOT</version>
+ <version>2.3.1.Final-redhat-2</version>
<relativePath>../pom.xml</relativePath>
</parent>
Added: branches/enterprise/WFK-2_1/examples/jpa/README.md
===================================================================
--- branches/enterprise/WFK-2_1/examples/jpa/README.md (rev 0)
+++ branches/enterprise/WFK-2_1/examples/jpa/README.md 2013-06-03 19:31:51 UTC (rev 15534)
@@ -0,0 +1,58 @@
+Seam JPA Example
+================
+
+This is the Hotel Booking example implemented in Seam POJO and Hibernate JPA.
+
+Running the example
+-------------------
+
+To deploy the example to a running JBoss AS instance, follow these steps:
+
+1. In the example root directory run:
+
+ mvn clean install
+
+2. Set JBOSS_HOME environment property.
+
+3. In the jpa-web directory run:
+
+ mvn jboss-as:deploy
+
+4. Open this URL in a web browser: http://localhost:8080/jpa-web
+
+
+Testing the example
+-------------------
+
+This example is covered by integration and functional tests. All tests use the following technologies:
+
+* __Arquillian__ - as the framework for EE testing, for managing of container lifecycle and deployment of test archive,
+* __ShrinkWrap__ - to create the test archive (WAR).
+
+
+### Integration tests
+
+Integration tests cover core application logic and reside in the EJB module. In addition to Arquillian and ShrinkWrap, the integration tests also use:
+
+* __JUnitSeamTest__ - to hook into the JSF lifecycle and assert server-side state,
+* __ShrinkWrap Resolver__ - to resolve dependencies of the project for packaging in the test archive.
+
+The tests are executed in Maven's test phase. By default they are skipped and can be executed on JBoss AS with:
+
+ mvn clean test -Darquillian=jbossas-managed-7
+
+The `JBOSS_HOME` environment variable must be set and point to a JBoss AS instance directory.
+
+To test on a running server, use
+
+ mvn clean test -Darquillian=jbossas-remote-7
+
+Testing in JBDS
+---------------
+### Integration tests
+
+1. Open JBDS and start a configured instance of JBoss AS
+2. Import the example project and its submodules
+3. In the _Project Explorer_, select the Web module project, then
+ 1. Type `Ctrl+Alt+P` (_Select Maven Profiles_) and check `integration-tests` and `arq-jbossas-7-remote`
+ 2. Right-click the module and select _Run As_ - _JUnit Test_
Modified: branches/enterprise/WFK-2_1/examples/jpa/jpa-web/pom.xml
===================================================================
--- branches/enterprise/WFK-2_1/examples/jpa/jpa-web/pom.xml 2013-06-03 18:05:17 UTC (rev 15533)
+++ branches/enterprise/WFK-2_1/examples/jpa/jpa-web/pom.xml 2013-06-03 19:31:51 UTC (rev 15534)
@@ -1,14 +1,15 @@
<?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">
+<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>
+ <groupId>org.jboss.seam.examples</groupId>
<artifactId>jpa</artifactId>
- <groupId>org.jboss.seam.examples</groupId>
<version>2.3.1.Final-redhat-2</version>
<relativePath>../pom.xml</relativePath>
</parent>
-
- <groupId>org.jboss.seam.examples</groupId>
+
+ <groupId>org.jboss.seam.examples.jpa</groupId>
<artifactId>jpa-web</artifactId>
<packaging>war</packaging>
<name>JPA Web Module (EE6)</name>
@@ -84,14 +85,122 @@
<artifactId>jboss-servlet-api_3.0_spec</artifactId>
<scope>provided</scope>
</dependency>
+
+ <!-- Test dependencies -->
+ <dependency>
+ <groupId>org.jboss.shrinkwrap.resolver</groupId>
+ <artifactId>shrinkwrap-resolver-depchain</artifactId>
+ <type>pom</type>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss.arquillian.junit</groupId>
+ <artifactId>arquillian-junit-container</artifactId>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss.arquillian.protocol</groupId>
+ <artifactId>arquillian-protocol-servlet</artifactId>
+ <scope>test</scope>
+ </dependency>
+
</dependencies>
-
+
+ <profiles>
+ <profile>
+ <id>integration-tests</id>
+ <activation>
+ <property>
+ <name>arquillian</name>
+ </property>
+ </activation>
+ <properties>
+ <jndiPattern>java:app/jpa-web/#{ejbName}</jndiPattern>
+ <distributable>false</distributable>
+ </properties>
+ <build>
+ <testResources>
+ <testResource>
+ <directory>src/test/resources</directory>
+ <filtering>true</filtering>
+ </testResource>
+ </testResources>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-surefire-plugin</artifactId>
+ <configuration>
+ <skip>false</skip>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+ </profile>
+
+ <profile>
+ <id>arq-jbossas-7-managed</id>
+ <activation>
+ <property>
+ <name>arquillian</name>
+ <value>jbossas-managed-7</value>
+ </property>
+ </activation>
+ <dependencies>
+ <dependency>
+ <groupId>org.jboss.as</groupId>
+ <artifactId>jboss-as-arquillian-container-managed</artifactId>
+ <scope>test</scope>
+ </dependency>
+ </dependencies>
+ </profile>
+
+ <profile>
+ <id>arq-jbossas-7-remote</id>
+ <activation>
+ <property>
+ <name>arquillian</name>
+ <value>jbossas-remote-7</value>
+ </property>
+ </activation>
+ <dependencies>
+ <dependency>
+ <groupId>org.jboss.as</groupId>
+ <artifactId>jboss-as-arquillian-container-remote</artifactId>
+ <scope>test</scope>
+ </dependency>
+ </dependencies>
+ </profile>
+ </profiles>
+
<build>
<finalName>jpa-web</finalName>
+ <pluginManagement>
+ <plugins>
+ <plugin>
+ <groupId>org.jboss.as.plugins</groupId>
+ <artifactId>jboss-as-maven-plugin</artifactId>
+ <version>${version.jboss.maven.plugin}</version>
+ </plugin>
+ </plugins>
+ </pluginManagement>
<plugins>
+ <!-- Skip tests by default -->
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-surefire-plugin</artifactId>
+ <configuration>
+ <skip>true</skip>
+ </configuration>
+ </plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-war-plugin</artifactId>
+ <version>${version.war.plugin}</version>
<configuration>
<webResources>
<resource>
@@ -102,19 +211,7 @@
<attachClasses>true</attachClasses>
</configuration>
</plugin>
- <plugin>
- <groupId>org.codehaus.mojo</groupId>
- <artifactId>jboss-maven-plugin</artifactId>
- <version>1.5.0</version>
- <configuration>
- <jbossHome>${jboss.home}</jbossHome>
- <serverName>${jboss.domain}</serverName>
- <fileNames>
- <directory>${project.build.directory}/${project.build.finalName}.war</directory>
- </fileNames>
- </configuration>
- </plugin>
</plugins>
</build>
-
+
</project>
Modified: branches/enterprise/WFK-2_1/examples/jpa/jpa-web/src/main/resources/META-INF/persistence.xml
===================================================================
--- branches/enterprise/WFK-2_1/examples/jpa/jpa-web/src/main/resources/META-INF/persistence.xml 2013-06-03 18:05:17 UTC (rev 15533)
+++ branches/enterprise/WFK-2_1/examples/jpa/jpa-web/src/main/resources/META-INF/persistence.xml 2013-06-03 19:31:51 UTC (rev 15534)
@@ -9,6 +9,7 @@
<properties>
<property name="hibernate.hbm2ddl.auto" value="create-drop"/>
<property name="hibernate.show_sql" value="true"/>
+ <property name="hibernate.transaction.manager_lookup_class" value="org.hibernate.transaction.JBossTransactionManagerLookup"/>
<!-- Binds the EntityManagerFactory to JNDI where Seam can look it up.
This is only relevant when the container automatically loads the persistence unit, as is the case in JBoss AS 5. -->
<property name="jboss.entity.manager.factory.jndi.name" value="java:/bookingEntityManagerFactory"/>
Added: branches/enterprise/WFK-2_1/examples/jpa/jpa-web/src/test/java/org/jboss/seam/example/jpa/test/BookingTest.java
===================================================================
--- branches/enterprise/WFK-2_1/examples/jpa/jpa-web/src/test/java/org/jboss/seam/example/jpa/test/BookingTest.java (rev 0)
+++ branches/enterprise/WFK-2_1/examples/jpa/jpa-web/src/test/java/org/jboss/seam/example/jpa/test/BookingTest.java 2013-06-03 19:31:51 UTC (rev 15534)
@@ -0,0 +1,303 @@
+//$Id: BookingTest.java 6505 2007-10-12 11:24:54Z pmuir $
+package org.jboss.seam.example.jpa.test;
+
+import java.util.Calendar;
+import java.util.Date;
+import java.util.Iterator;
+
+import javax.faces.application.FacesMessage;
+import javax.faces.context.FacesContext;
+import javax.faces.model.DataModel;
+import javax.faces.model.ListDataModel;
+
+import org.jboss.arquillian.container.test.api.Deployment;
+import org.jboss.arquillian.container.test.api.OverProtocol;
+import org.jboss.arquillian.junit.Arquillian;
+import org.jboss.seam.contexts.Contexts;
+import org.jboss.seam.core.Manager;
+import org.jboss.seam.example.jpa.Booking;
+import org.jboss.seam.example.jpa.Hotel;
+import org.jboss.seam.example.jpa.HotelBookingAction;
+import org.jboss.seam.example.jpa.User;
+import org.jboss.seam.mock.JUnitSeamTest;
+import org.jboss.shrinkwrap.api.Archive;
+import org.junit.Assert;
+import org.junit.Test;
+
+import org.junit.runner.RunWith;
+
+(a)RunWith(Arquillian.class)
+public class BookingTest extends JUnitSeamTest
+{
+ @Deployment(name="BookingTest")
+ @OverProtocol("Servlet 3.0")
+ public static Archive<?> createDeployment()
+ {
+ return Deployments.jpaDeployment();
+ }
+
+ @Test
+ public void testBookHotel() throws Exception
+ {
+
+ new FacesRequest() {
+
+ @Override
+ protected void invokeApplication() throws Exception
+ {
+ Contexts.getSessionContext().set("user", new User("Gavin King", "foobar", "gavin"));
+ setValue("#{identity.username}", "gavin");
+ setValue("#{identity.password}", "foobar");
+ invokeAction("#{identity.login}");
+ }
+
+ }.run();
+
+ new FacesRequest("/main.xhtml") {
+
+ @Override
+ protected void updateModelValues() throws Exception
+ {
+ setValue("#{hotelSearch.searchString}", "Union Square");
+ }
+
+ @Override
+ protected void invokeApplication()
+ {
+ Assert.assertNull(invokeAction("#{hotelSearch.find}"));
+ }
+
+ @Override
+ protected void renderResponse()
+ {
+ DataModel hotels = (DataModel) Contexts.getSessionContext().get("hotels");
+ Assert.assertEquals(1, hotels.getRowCount());
+ Assert.assertEquals("NY",( (Hotel) hotels.getRowData() ).getCity() );
+ Assert.assertEquals("Union Square", getValue("#{hotelSearch.searchString}"));
+ Assert.assertTrue(!Manager.instance().isLongRunningConversation());
+ }
+
+ }.run();
+
+ String id = new FacesRequest("/main.xhtml") {
+
+ @Override
+ protected void invokeApplication() throws Exception {
+ HotelBookingAction hotelBooking = (HotelBookingAction) getInstance("hotelBooking");
+ DataModel hotels = (DataModel) Contexts.getSessionContext().get("hotels");
+ Assert.assertEquals(1, hotels.getRowCount());
+ hotelBooking.selectHotel( (Hotel) hotels.getRowData() );
+ }
+
+ @Override
+ protected void renderResponse()
+ {
+ Hotel hotel = (Hotel) Contexts.getConversationContext().get("hotel");
+ Assert.assertEquals("NY",hotel.getCity() );
+ Assert.assertEquals("10011",hotel.getZip() );
+ Assert.assertTrue(Manager.instance().isLongRunningConversation());
+ }
+
+ }.run();
+
+ id = new FacesRequest("/hotel.xhtml", id) {
+
+ @Override
+ protected void invokeApplication()
+ {
+ invokeAction("#{hotelBooking.bookHotel}");
+ }
+
+ @Override
+ protected void renderResponse()
+ {
+ Assert.assertNotNull(getValue("#{booking.user}"));
+ Assert.assertNotNull(getValue("#{booking.hotel}"));
+ Assert.assertNull(getValue("#{booking.creditCard}"));
+ Assert.assertNull(getValue("#{booking.creditCardName}"));
+ Booking booking = (Booking) Contexts.getConversationContext().get("booking");
+ Assert.assertTrue(booking.getHotel()==Contexts.getConversationContext().get("hotel"));
+ Assert.assertTrue(booking.getUser()==Contexts.getConversationContext().get("user"));
+ Assert.assertTrue(Manager.instance().isLongRunningConversation());
+ }
+
+ }.run();
+
+ new FacesRequest("/book.xhtml", id) {
+
+ @Override
+ protected void processValidations() throws Exception
+ {
+ validateValue("#{booking.creditCard}", "123");
+ Assert.assertTrue(isValidationFailure());
+ }
+
+ @Override
+ protected void renderResponse()
+ {
+ Iterator messages = FacesContext.getCurrentInstance().getMessages();
+ Assert.assertTrue(messages.hasNext());
+ Assert.assertEquals("Credit card number must 16 digits long", ( (FacesMessage) messages.next() ).getSummary());
+ Assert.assertFalse(messages.hasNext());
+ Assert.assertTrue(Manager.instance().isLongRunningConversation());
+ }
+
+ @Override
+ protected void afterRequest()
+ {
+ Assert.assertTrue(!isInvokeApplicationBegun());
+ }
+
+ }.run();
+
+ new FacesRequest("/book.xhtml", id) {
+
+ @Override
+ protected void processValidations() throws Exception
+ {
+ validateValue("#{booking.creditCardName}", "");
+ Assert.assertTrue(isValidationFailure());
+ }
+
+ @Override
+ protected void renderResponse()
+ {
+ Iterator messages = FacesContext.getCurrentInstance().getMessages();
+ Assert.assertTrue(messages.hasNext());
+ Assert.assertEquals("Credit card name is required", ( (FacesMessage) messages.next() ).getSummary());
+ Assert.assertFalse(messages.hasNext());
+ Assert.assertTrue(Manager.instance().isLongRunningConversation());
+ }
+
+ @Override
+ protected void afterRequest()
+ {
+ Assert.assertFalse(isInvokeApplicationBegun());
+ }
+
+ }.run();
+
+ new FacesRequest("/book.xhtml", id) {
+
+ @Override @SuppressWarnings("deprecation")
+ protected void updateModelValues() throws Exception
+ {
+ setValue("#{booking.creditCard}", "1234567891021234");
+ setValue("#{booking.creditCardName}", "GAVIN KING");
+ setValue("#{booking.beds}", 2);
+ Date now = new Date();
+ setValue("#{booking.checkinDate}", now);
+ setValue("#{booking.checkoutDate}", now);
+ }
+
+ @Override
+ protected void invokeApplication()
+ {
+ assert invokeAction("#{hotelBooking.setBookingDetails}")==null;
+ }
+
+ @Override
+ protected void renderResponse()
+ {
+ Iterator messages = FacesContext.getCurrentInstance().getMessages();
+ Assert.assertTrue(Manager.instance().isLongRunningConversation());
+ Assert.assertTrue(messages.hasNext());
+ FacesMessage message = (FacesMessage) messages.next();
+ Assert.assertEquals("Check out date must be later than check in date",message.getSummary());
+ Assert.assertFalse(messages.hasNext());
+ Assert.assertTrue(Manager.instance().isLongRunningConversation());
+ }
+
+ @Override
+ protected void afterRequest()
+ {
+ assert isInvokeApplicationComplete();
+ }
+
+ }.run();
+
+ new FacesRequest("/book.xhtml", id) {
+
+ @Override @SuppressWarnings("deprecation")
+ protected void updateModelValues() throws Exception
+ {
+ Calendar cal = Calendar.getInstance();
+ cal.add(Calendar.DAY_OF_MONTH, 2);
+ setValue("#{booking.checkoutDate}", cal.getTime() );
+ }
+
+ @Override
+ protected void invokeApplication()
+ {
+ invokeAction("#{hotelBooking.setBookingDetails}");
+ }
+
+ @Override
+ protected void renderResponse()
+ {
+ Assert.assertTrue(Manager.instance().isLongRunningConversation());
+ }
+
+ @Override
+ protected void afterRequest()
+ {
+ Assert.assertTrue( isInvokeApplicationComplete() );
+ }
+
+ }.run();
+
+ new FacesRequest("/confirm.xhtml", id) {
+
+ @Override
+ protected void invokeApplication()
+ {
+ invokeAction("#{hotelBooking.confirm}");
+ }
+
+ @Override
+ protected void afterRequest()
+ {
+ Assert.assertTrue( isInvokeApplicationComplete() );
+ }
+
+ }.run();
+
+ new NonFacesRequest("/main.xhtml") {
+
+ @Override
+ protected void renderResponse()
+ {
+ ListDataModel bookings = (ListDataModel) getInstance("bookings");
+ Assert.assertEquals(1, bookings.getRowCount());
+ bookings.setRowIndex(0);
+ Booking booking = (Booking) bookings.getRowData();
+ Assert.assertEquals("NY", booking.getHotel().getCity());
+ Assert.assertEquals("gavin", booking.getUser().getUsername());
+ Assert.assertFalse(Manager.instance().isLongRunningConversation());
+ }
+
+ }.run();
+
+ new FacesRequest("/main.xhtml") {
+
+ @Override
+ protected void invokeApplication()
+ {
+ ListDataModel bookings = (ListDataModel) Contexts.getSessionContext().get("bookings");
+ bookings.setRowIndex(0);
+ invokeAction("#{bookingList.cancel}");
+ }
+
+ @Override
+ protected void renderResponse()
+ {
+ ListDataModel bookings = (ListDataModel) Contexts.getSessionContext().get("bookings");
+ Assert.assertEquals(0, bookings.getRowCount());
+ Assert.assertFalse(Manager.instance().isLongRunningConversation());
+ }
+
+ }.run();
+
+ }
+
+}
Added: branches/enterprise/WFK-2_1/examples/jpa/jpa-web/src/test/java/org/jboss/seam/example/jpa/test/ChangePasswordTest.java
===================================================================
--- branches/enterprise/WFK-2_1/examples/jpa/jpa-web/src/test/java/org/jboss/seam/example/jpa/test/ChangePasswordTest.java (rev 0)
+++ branches/enterprise/WFK-2_1/examples/jpa/jpa-web/src/test/java/org/jboss/seam/example/jpa/test/ChangePasswordTest.java 2013-06-03 19:31:51 UTC (rev 15534)
@@ -0,0 +1,151 @@
+//$Id: ChangePasswordTest.java 6505 2007-10-12 11:24:54Z pmuir $
+package org.jboss.seam.example.jpa.test;
+
+import org.jboss.arquillian.junit.Arquillian;
+import org.jboss.arquillian.container.test.api.Deployment;
+import org.jboss.arquillian.container.test.api.OverProtocol;
+import org.jboss.seam.contexts.Contexts;
+import org.jboss.seam.core.Manager;
+import org.jboss.seam.example.jpa.User;
+import org.jboss.seam.mock.JUnitSeamTest;
+import org.jboss.shrinkwrap.api.Archive;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+
+(a)RunWith(Arquillian.class)
+public class ChangePasswordTest extends JUnitSeamTest
+{
+
+ @Deployment(name="ChangePasswordTest")
+ @OverProtocol("Servlet 3.0")
+ public static Archive<?> createDeployment()
+ {
+ return Deployments.jpaDeployment();
+ }
+
+ @Test
+ public void testChangePassword() throws Exception
+ {
+
+ new FacesRequest() {
+
+ @Override
+ protected void invokeApplication() throws Exception
+ {
+ Contexts.getSessionContext().set("user", new User("Gavin King", "foobar", "gavin"));
+ setValue("#{identity.username}", "gavin");
+ setValue("#{identity.password}", "foobar");
+ invokeMethod("#{identity.login}");
+ }
+
+ }.run();
+
+ new FacesRequest() {
+
+ @Override
+ protected void processValidations() throws Exception
+ {
+ validateValue("#{user.password}", "xxx");
+ assert isValidationFailure();
+ }
+
+ @Override
+ protected void renderResponse()
+ {
+ assert getValue("#{user.name}").equals("Gavin King");
+ assert getValue("#{user.username}").equals("gavin");
+ assert getValue("#{user.password}").equals("foobar");
+ assert !Manager.instance().isLongRunningConversation();
+ assert getValue("#{identity.loggedIn}").equals(true);
+
+ }
+
+ }.run();
+
+ new FacesRequest() {
+
+ @Override
+ protected void updateModelValues() throws Exception
+ {
+ setValue("#{user.password}", "xxxyyy");
+ setValue("#{changePassword.verify}", "xxyyyx");
+ }
+
+ @Override
+ protected void invokeApplication()
+ {
+ assert invokeAction("#{changePassword.changePassword}")==null;
+ }
+
+ @Override
+ protected void renderResponse()
+ {
+ assert getValue("#{user.name}").equals("Gavin King");
+ assert getValue("#{user.username}").equals("gavin");
+ assert getValue("#{user.password}").equals("foobar");
+ assert !Manager.instance().isLongRunningConversation();
+ assert getValue("#{identity.loggedIn}").equals(true);
+ }
+
+ }.run();
+
+ new FacesRequest() {
+
+ @Override
+ protected void updateModelValues() throws Exception
+ {
+ setValue("#{user.password}", "xxxyyy");
+ setValue("#{changePassword.verify}", "xxxyyy");
+ }
+
+ @Override
+ protected void invokeApplication()
+ {
+ invokeMethod("#{changePassword.changePassword}");
+ }
+
+ @Override
+ protected void renderResponse()
+ {
+ assert getValue("#{user.name}").equals("Gavin King");
+ assert getValue("#{user.username}").equals("gavin");
+ assert getValue("#{user.password}").equals("xxxyyy");
+ assert !Manager.instance().isLongRunningConversation();
+ assert getValue("#{identity.loggedIn}").equals(true);
+
+ }
+
+ }.run();
+
+ new FacesRequest() {
+
+ @Override
+ protected void updateModelValues() throws Exception
+ {
+ assert getValue("#{user.password}").equals("xxxyyy");
+ setValue("#{user.password}", "foobar");
+ setValue("#{changePassword.verify}", "foobar");
+ }
+
+ @Override
+ protected void invokeApplication()
+ {
+ invokeMethod("#{changePassword.changePassword}");
+ }
+
+ @Override
+ protected void renderResponse()
+ {
+ assert getValue("#{user.name}").equals("Gavin King");
+ assert getValue("#{user.username}").equals("gavin");
+ assert getValue("#{user.password}").equals("foobar");
+ assert !Manager.instance().isLongRunningConversation();
+ assert getValue("#{identity.loggedIn}").equals(true);
+
+ }
+
+ }.run();
+
+ }
+
+}
Added: branches/enterprise/WFK-2_1/examples/jpa/jpa-web/src/test/java/org/jboss/seam/example/jpa/test/Deployments.java
===================================================================
--- branches/enterprise/WFK-2_1/examples/jpa/jpa-web/src/test/java/org/jboss/seam/example/jpa/test/Deployments.java (rev 0)
+++ branches/enterprise/WFK-2_1/examples/jpa/jpa-web/src/test/java/org/jboss/seam/example/jpa/test/Deployments.java 2013-06-03 19:31:51 UTC (rev 15534)
@@ -0,0 +1,39 @@
+package org.jboss.seam.example.jpa.test;
+
+import org.jboss.shrinkwrap.api.ShrinkWrap;
+import org.jboss.shrinkwrap.api.spec.WebArchive;
+
+import java.io.File;
+import org.jboss.seam.example.jpa.Booking;
+import org.jboss.shrinkwrap.resolver.api.maven.Maven;
+
+public class Deployments {
+
+ public static WebArchive jpaDeployment() {
+
+ File[] libs = Maven.resolver().loadPomFromFile("pom.xml")
+ .importCompileAndRuntimeDependencies()
+ .resolve().withTransitivity().asFile();
+
+ // Get File reference to src/main/webapp/WEB-INF, to avoid duplication of resources for the test archive
+ // Depends on shrinkwrap-resolver-maven-plugin to set the property
+ File webInf = new File(new File("pom.xml").getParentFile(), "src/main/webapp/WEB-INF");
+
+ return ShrinkWrap.create(WebArchive.class, "jpa-web.war")
+ .addPackage(Booking.class.getPackage())
+
+ // copy classpath resources to WAR classpath
+ .addAsResource("import.sql")
+ .addAsResource("seam.properties")
+ .addAsResource("META-INF/persistence.xml")
+
+ // copy files from src/main/webapp to test-archive's WEB-INF
+ .addAsWebInfResource(new File(webInf, "components.xml"))
+ .addAsWebInfResource(new File(webInf, "jboss-deployment-structure.xml"))
+ .addAsWebInfResource(new File(webInf, "pages.xml"))
+
+ // modified web.xml, defines only MockSeamListener
+ .addAsWebInfResource("web.xml")
+ .addAsLibraries(libs);
+ }
+}
Added: branches/enterprise/WFK-2_1/examples/jpa/jpa-web/src/test/java/org/jboss/seam/example/jpa/test/LoginTest.java
===================================================================
--- branches/enterprise/WFK-2_1/examples/jpa/jpa-web/src/test/java/org/jboss/seam/example/jpa/test/LoginTest.java (rev 0)
+++ branches/enterprise/WFK-2_1/examples/jpa/jpa-web/src/test/java/org/jboss/seam/example/jpa/test/LoginTest.java 2013-06-03 19:31:51 UTC (rev 15534)
@@ -0,0 +1,129 @@
+//$Id: LoginTest.java 6505 2007-10-12 11:24:54Z pmuir $
+package org.jboss.seam.example.jpa.test;
+
+import org.jboss.arquillian.junit.Arquillian;
+import org.jboss.arquillian.container.test.api.Deployment;
+import org.jboss.arquillian.container.test.api.OverProtocol;
+import org.jboss.seam.core.Manager;
+import org.jboss.seam.mock.JUnitSeamTest;
+import org.jboss.seam.web.Session;
+import org.jboss.shrinkwrap.api.Archive;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+
+(a)RunWith(Arquillian.class)
+public class LoginTest extends JUnitSeamTest
+{
+
+ @Deployment(name="LoginTest")
+ @OverProtocol("Servlet 3.0")
+ public static Archive<?> createDeployment()
+ {
+ return Deployments.jpaDeployment();
+ }
+
+
+ @Test
+ public void testLoginComponent() throws Exception
+ {
+ new ComponentTest() {
+
+ @Override
+ protected void testComponents() throws Exception
+ {
+ assert getValue("#{identity.loggedIn}").equals(false);
+ setValue("#{identity.username}", "gavin");
+ setValue("#{identity.password}", "foobar");
+ invokeMethod("#{identity.login}");
+ assert getValue("#{user.name}").equals("Gavin King");
+ assert getValue("#{user.username}").equals("gavin");
+ assert getValue("#{user.password}").equals("foobar");
+ assert getValue("#{identity.loggedIn}").equals(true);
+ invokeMethod("#{identity.logout}");
+ assert getValue("#{identity.loggedIn}").equals(false);
+ setValue("#{identity.username}", "gavin");
+ setValue("#{identity.password}", "tiger");
+ invokeMethod("#{identity.login}");
+ assert getValue("#{identity.loggedIn}").equals(false);
+ }
+
+ }.run();
+ }
+
+ @Test
+ public void testLogin() throws Exception
+ {
+
+ new FacesRequest() {
+
+ @Override
+ protected void invokeApplication()
+ {
+ assert !isSessionInvalid();
+ assert getValue("#{identity.loggedIn}").equals(false);
+ }
+
+ }.run();
+
+ new FacesRequest() {
+
+ @Override
+ protected void updateModelValues() throws Exception
+ {
+ assert !isSessionInvalid();
+ setValue("#{identity.username}", "gavin");
+ setValue("#{identity.password}", "foobar");
+ }
+
+ @Override
+ protected void invokeApplication()
+ {
+ invokeAction("#{identity.login}");
+ }
+
+ @Override
+ protected void renderResponse()
+ {
+ assert getValue("#{user.name}").equals("Gavin King");
+ assert getValue("#{user.username}").equals("gavin");
+ assert getValue("#{user.password}").equals("foobar");
+ assert !Manager.instance().isLongRunningConversation();
+ assert getValue("#{identity.loggedIn}").equals(true);
+ }
+
+ }.run();
+
+ new FacesRequest() {
+
+ @Override
+ protected void invokeApplication()
+ {
+ assert !isSessionInvalid();
+ assert getValue("#{identity.loggedIn}").equals(true);
+ }
+
+ }.run();
+
+ new FacesRequest() {
+
+ @Override
+ protected void invokeApplication()
+ {
+ assert !Manager.instance().isLongRunningConversation();
+ assert !isSessionInvalid();
+ invokeMethod("#{identity.logout}");
+ assert Session.instance().isInvalid();
+ }
+
+ @Override
+ protected void renderResponse()
+ {
+ assert getValue("#{identity.loggedIn}").equals(false);
+ assert Session.instance().isInvalid();
+ }
+
+ }.run();
+
+ }
+
+}
Added: branches/enterprise/WFK-2_1/examples/jpa/jpa-web/src/test/resources/arquillian.xml
===================================================================
(Binary files differ)
Property changes on: branches/enterprise/WFK-2_1/examples/jpa/jpa-web/src/test/resources/arquillian.xml
___________________________________________________________________
Added: svn:mime-type
+ application/xml
Added: branches/enterprise/WFK-2_1/examples/jpa/jpa-web/src/test/resources/web.xml
===================================================================
(Binary files differ)
Property changes on: branches/enterprise/WFK-2_1/examples/jpa/jpa-web/src/test/resources/web.xml
___________________________________________________________________
Added: svn:mime-type
+ application/xml
Modified: branches/enterprise/WFK-2_1/examples/jpa/pom.xml
===================================================================
--- branches/enterprise/WFK-2_1/examples/jpa/pom.xml 2013-06-03 18:05:17 UTC (rev 15533)
+++ branches/enterprise/WFK-2_1/examples/jpa/pom.xml 2013-06-03 19:31:51 UTC (rev 15534)
@@ -3,25 +3,43 @@
<modelVersion>4.0.0</modelVersion>
<groupId>org.jboss.seam.examples</groupId>
<artifactId>jpa</artifactId>
- <parent>
- <groupId>org.jboss.seam</groupId>
- <artifactId>examples</artifactId>
- <version>2.3.1.Final-redhat-2</version>
- </parent>
+ <version>2.3.1.Final-redhat-2</version>
<packaging>pom</packaging>
<name>JPA Example (EE6)</name>
<properties>
<example.name>jpa</example.name>
+ <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
+ <maven.compiler.target>1.6</maven.compiler.target>
+ <maven.compiler.source>1.6</maven.compiler.source>
+
+ <!-- To use jacoco, set jacoco.agent system property to something like
+ -javaagent:/path/to/jacocoagent.jar=append=true,destfile=/path/to/output/jacoco.exec -->
+ <jacoco.agent />
+
+ <!-- To use custom Maven settings with ShrinkWrap Resolver, uncomment
+ and customize the following property. -->
+ <!--<maven.user.settings>/path/to/custom/settings.xml</maven.user.settings>-->
+
+ <version.commons.logging>1.1.1</version.commons.logging>
+ <version.shrinkwrap.resolver>2.0.0-beta-4</version.shrinkwrap.resolver>
+
+ <!-- Plugin versions -->
+ <version.dependency.plugin>2.5.1</version.dependency.plugin>
+ <version.resources.plugin>2.6</version.resources.plugin>
+ <version.surefire.plugin>2.10</version.surefire.plugin>
+ <version.compiler.plugin>2.3.1</version.compiler.plugin>
+ <version.war.plugin>2.1.1</version.war.plugin>
+ <version.jboss.maven.plugin>7.4.Final</version.jboss.maven.plugin>
</properties>
<modules>
<module>jpa-web</module>
- <module>jpa-tests</module>
</modules>
<dependencyManagement>
<dependencies>
+ <!-- Modules -->
<dependency>
<groupId>org.jboss.seam.examples</groupId>
<artifactId>jpa-web</artifactId>
@@ -34,6 +52,82 @@
<version>${project.version}</version>
<classifier>classes</classifier>
</dependency>
+
+ <!-- BOMs -->
+ <dependency>
+ <groupId>org.jboss.shrinkwrap.resolver</groupId>
+ <artifactId>shrinkwrap-resolver-bom</artifactId>
+ <version>${version.shrinkwrap.resolver}</version>
+ <scope>import</scope>
+ <type>pom</type>
+ </dependency>
+
+ <dependency>
+ <groupId>org.jboss.seam</groupId>
+ <artifactId>bom</artifactId>
+ <version>${project.version}</version>
+ <type>pom</type>
+ <scope>import</scope>
+ </dependency>
+
+ <!-- Common provided dependencies -->
+ <dependency>
+ <groupId>commons-logging</groupId>
+ <artifactId>commons-logging</artifactId>
+ <version>${version.commons.logging}</version>
+ <scope>provided</scope>
+ </dependency>
+
+ <!-- TestNG is not necessary -->
+ <dependency>
+ <groupId>org.jboss.seam</groupId>
+ <artifactId>jboss-seam</artifactId>
+ <version>${project.version}</version>
+ <exclusions>
+ <exclusion>
+ <groupId>org.testng</groupId>
+ <artifactId>testng</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ </exclusion>
+ </exclusions>
+ </dependency>
</dependencies>
</dependencyManagement>
+
+ <build>
+ <pluginManagement>
+ <plugins>
+ <!-- Manage plugin versions for build stability -->
+ <plugin>
+ <artifactId>maven-surefire-plugin</artifactId>
+ <version>${version.surefire.plugin}</version>
+ <configuration>
+ <systemPropertyVariables>
+ <org.apache.maven.user-settings>${maven.user.settings}</org.apache.maven.user-settings>
+ </systemPropertyVariables>
+ </configuration>
+ </plugin>
+ <plugin>
+ <artifactId>maven-dependency-plugin</artifactId>
+ <version>${version.dependency.plugin}</version>
+ </plugin>
+ <plugin>
+ <artifactId>maven-resources-plugin</artifactId>
+ <version>${version.resources.plugin}</version>
+ </plugin>
+ <plugin>
+ <artifactId>maven-compiler-plugin</artifactId>
+ <version>${version.compiler.plugin}</version>
+ <configuration>
+ <source>${maven.compiler.source}</source>
+ <target>${maven.compiler.target}</target>
+ </configuration>
+ </plugin>
+ </plugins>
+ </pluginManagement>
+
+ </build>
</project>
Deleted: branches/enterprise/WFK-2_1/examples/jpa/readme.txt
===================================================================
--- branches/enterprise/WFK-2_1/examples/jpa/readme.txt 2013-06-03 18:05:17 UTC (rev 15533)
+++ branches/enterprise/WFK-2_1/examples/jpa/readme.txt 2013-06-03 19:31:51 UTC (rev 15534)
@@ -1,18 +0,0 @@
-Seam JPA Example
-================
-
-This is the Hotel Booking example implemented in Seam POJO and Hibernate JPA.
-
-To deploy the example, follow these steps:
-
-* In the example root directory run:
-
- mvn clean install
-
-* Set JBOSS_HOME environment property.
-
-* In the jpa-web directory run:
-
- mvn jboss-as:deploy
-
-* Open this URL in a web browser: http://localhost:8080/jpa-web
Modified: branches/enterprise/WFK-2_1/examples/nestedbooking/nestedbooking-ear/pom.xml
===================================================================
--- branches/enterprise/WFK-2_1/examples/nestedbooking/nestedbooking-ear/pom.xml 2013-06-03 18:05:17 UTC (rev 15533)
+++ branches/enterprise/WFK-2_1/examples/nestedbooking/nestedbooking-ear/pom.xml 2013-06-03 19:31:51 UTC (rev 15534)
@@ -2,8 +2,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>
+ <groupId>org.jboss.seam.examples</groupId>
<artifactId>nestedbooking</artifactId>
- <groupId>org.jboss.seam.examples</groupId>
<version>2.3.1.Final-redhat-2</version>
<relativePath>../pom.xml</relativePath>
</parent>
@@ -28,7 +28,6 @@
<groupId>org.jboss.seam</groupId>
<artifactId>jboss-seam</artifactId>
<type>ejb</type>
- <scope>compile</scope>
<exclusions>
<exclusion>
<groupId>org.testng</groupId>
@@ -48,12 +47,21 @@
<build>
<finalName>seam-nestedbooking</finalName>
+ <pluginManagement>
+ <plugins>
+ <plugin>
+ <groupId>org.jboss.as.plugins</groupId>
+ <artifactId>jboss-as-maven-plugin</artifactId>
+ <version>${version.jboss.maven.plugin}</version>
+ </plugin>
+ </plugins>
+ </pluginManagement>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-ear-plugin</artifactId>
- <configuration>
- <version>6</version>
+ <version>${version.ear.plugin}</version>
+ <configuration>
<defaultLibBundleDir>lib</defaultLibBundleDir>
<filtering>true</filtering>
<modules>
Modified: branches/enterprise/WFK-2_1/examples/nestedbooking/nestedbooking-ejb/pom.xml
===================================================================
--- branches/enterprise/WFK-2_1/examples/nestedbooking/nestedbooking-ejb/pom.xml 2013-06-03 18:05:17 UTC (rev 15533)
+++ branches/enterprise/WFK-2_1/examples/nestedbooking/nestedbooking-ejb/pom.xml 2013-06-03 19:31:51 UTC (rev 15534)
@@ -2,8 +2,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>
+ <groupId>org.jboss.seam.examples</groupId>
<artifactId>nestedbooking</artifactId>
- <groupId>org.jboss.seam.examples</groupId>
<version>2.3.1.Final-redhat-2</version>
<relativePath>../pom.xml</relativePath>
</parent>
@@ -45,6 +45,110 @@
<artifactId>jboss-jsf-api_2.1_spec</artifactId>
<scope>provided</scope>
</dependency>
+
+ <!-- Test dependencies -->
+ <dependency>
+ <groupId>org.jboss.shrinkwrap.resolver</groupId>
+ <artifactId>shrinkwrap-resolver-depchain</artifactId>
+ <type>pom</type>
+ <scope>test</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <scope>test</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.jboss.arquillian.junit</groupId>
+ <artifactId>arquillian-junit-container</artifactId>
+ <scope>test</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.jboss.arquillian.protocol</groupId>
+ <artifactId>arquillian-protocol-servlet</artifactId>
+ <scope>test</scope>
+ </dependency>
</dependencies>
-
+
+ <profiles>
+ <profile>
+ <id>integration-tests</id>
+ <activation>
+ <property>
+ <name>arquillian</name>
+ </property>
+ </activation>
+ <properties>
+ <jndiPattern>java:app/seam-nestedbooking/#{ejbName}</jndiPattern>
+ </properties>
+ <build>
+ <testResources>
+ <testResource>
+ <directory>src/test/resources</directory>
+ <filtering>true</filtering>
+ </testResource>
+ </testResources>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-surefire-plugin</artifactId>
+ <configuration>
+ <skip>false</skip>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+ </profile>
+
+ <profile>
+ <id>arq-jbossas-7-managed</id>
+ <activation>
+ <property>
+ <name>arquillian</name>
+ <value>jbossas-managed-7</value>
+ </property>
+ </activation>
+ <dependencies>
+ <dependency>
+ <groupId>org.jboss.as</groupId>
+ <artifactId>jboss-as-arquillian-container-managed</artifactId>
+ <scope>test</scope>
+ </dependency>
+ </dependencies>
+ </profile>
+
+ <profile>
+ <id>arq-jbossas-7-remote</id>
+ <activation>
+ <property>
+ <name>arquillian</name>
+ <value>jbossas-remote-7</value>
+ </property>
+ </activation>
+ <dependencies>
+ <dependency>
+ <groupId>org.jboss.as</groupId>
+ <artifactId>jboss-as-arquillian-container-remote</artifactId>
+ <scope>test</scope>
+ </dependency>
+ </dependencies>
+ </profile>
+ </profiles>
+
+ <build>
+ <plugins>
+ <!-- Skip tests by default -->
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-surefire-plugin</artifactId>
+ <configuration>
+ <skip>true</skip>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+
</project>
Added: branches/enterprise/WFK-2_1/examples/nestedbooking/nestedbooking-ejb/src/test/java/org/jboss/seam/example/nestedbooking/test/BookingTest.java
===================================================================
--- branches/enterprise/WFK-2_1/examples/nestedbooking/nestedbooking-ejb/src/test/java/org/jboss/seam/example/nestedbooking/test/BookingTest.java (rev 0)
+++ branches/enterprise/WFK-2_1/examples/nestedbooking/nestedbooking-ejb/src/test/java/org/jboss/seam/example/nestedbooking/test/BookingTest.java 2013-06-03 19:31:51 UTC (rev 15534)
@@ -0,0 +1,307 @@
+//$Id: BookingTest.java 6896 2007-12-04 15:45:49Z pmuir $
+package org.jboss.seam.example.nestedbooking.test;
+
+import java.util.Calendar;
+import java.util.Date;
+import java.util.Iterator;
+
+import javax.faces.application.FacesMessage;
+import javax.faces.context.FacesContext;
+import javax.faces.model.DataModel;
+import javax.faces.model.ListDataModel;
+
+import org.jboss.arquillian.container.test.api.Deployment;
+import org.jboss.arquillian.container.test.api.OverProtocol;
+import org.jboss.arquillian.junit.Arquillian;
+import org.jboss.seam.contexts.Contexts;
+import org.jboss.seam.core.Manager;
+import org.jboss.seam.example.booking.Booking;
+import org.jboss.seam.example.booking.Hotel;
+import org.jboss.seam.example.booking.HotelBooking;
+import org.jboss.seam.example.booking.User;
+import org.jboss.seam.mock.JUnitSeamTest;
+import org.jboss.shrinkwrap.api.Archive;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+
+(a)RunWith(Arquillian.class)
+public class BookingTest extends JUnitSeamTest {
+
+ @Deployment(name = "BookingTest")
+ @OverProtocol("Servlet 3.0")
+ public static Archive<?> createDeployment() {
+ return Deployments.nestedBookingDeployment();
+ }
+
+ @Test
+ public void testBookHotel() throws Exception {
+
+ new FacesRequest() {
+ @Override
+ protected void invokeApplication() {
+ Contexts.getSessionContext().set("user", new User("Gavin King", "foobar", "gavin"));
+ setValue("#{identity.username}", "gavin");
+ setValue("#{identity.password}", "foobar");
+ invokeMethod("#{identity.login}");
+ }
+ }.run();
+
+ new FacesRequest("/main.xhtml") {
+ @Override
+ protected void updateModelValues() {
+ setValue("#{hotelSearch.searchString}", "Union Square");
+ }
+
+ @Override
+ protected void invokeApplication() {
+ assert invokeMethod("#{hotelSearch.find}") == null;
+ }
+
+ @Override
+ protected void renderResponse() {
+ DataModel hotels = (DataModel) Contexts.getSessionContext().get("hotels");
+ assert hotels.getRowCount() == 1;
+ assert ((Hotel) hotels.getRowData()).getCity().equals("NY");
+ assert getValue("#{hotelSearch.searchString}").equals("Union Square");
+ assert !Manager.instance().isLongRunningConversation();
+ }
+ }.run();
+
+ final String id = new FacesRequest("/main.xhtml") {
+ @Override
+ protected void invokeApplication() {
+ HotelBooking hotelBooking = (HotelBooking) getInstance("hotelBooking");
+ DataModel hotels = (DataModel) Contexts.getSessionContext().get("hotels");
+ assert hotels.getRowCount() == 1;
+ hotelBooking.selectHotel((Hotel) hotels.getRowData());
+ }
+
+ @Override
+ protected void renderResponse() {
+ Hotel hotel = (Hotel) Contexts.getConversationContext().get("hotel");
+ assert hotel.getCity().equals("NY");
+ assert hotel.getZip().equals("10011");
+ assert Manager.instance().isLongRunningConversation();
+ }
+ }.run();
+
+ new FacesRequest("/hotel.xhtml", id) {
+ @Override
+ protected void invokeApplication() {
+ invokeMethod("#{hotelBooking.bookHotel}");
+ }
+
+ @Override
+ protected void renderResponse() {
+ assert getValue("#{booking.user}") != null;
+ assert getValue("#{booking.hotel}") != null;
+ assert getValue("#{booking.creditCard}") == null;
+ assert getValue("#{booking.creditCardName}") == null;
+ Booking booking = (Booking) Contexts.getConversationContext().get("booking");
+ assert booking.getHotel() == Contexts.getConversationContext().get("hotel");
+ assert booking.getUser() == Contexts.getSessionContext().get("user");
+ assert Manager.instance().isLongRunningConversation();
+ }
+ }.run();
+
+
+ new FacesRequest("/book.xhtml", id) {
+ @Override
+ @SuppressWarnings("deprecation")
+ protected void updateModelValues() {
+ Date now = new Date();
+ setValue("#{booking.checkinDate}", now);
+ setValue("#{booking.checkoutDate}", now);
+ }
+
+ @Override
+ protected void invokeApplication() {
+ assert invokeMethod("#{hotelBooking.setBookingDates}") == null;
+ }
+
+ @Override
+ protected void renderResponse() {
+ Iterator messages = FacesContext.getCurrentInstance().getMessages();
+ assert messages.hasNext();
+ FacesMessage message = (FacesMessage) messages.next();
+ assert message.getSummary().equals("Check out date must be later than check in date");
+ assert !messages.hasNext();
+ assert Manager.instance().isLongRunningConversation();
+ }
+ }.run();
+
+ new FacesRequest("/book.xhtml", id) {
+ @Override
+ @SuppressWarnings("deprecation")
+ protected void updateModelValues() {
+ Calendar cal = Calendar.getInstance();
+ cal.add(Calendar.DAY_OF_MONTH, 2);
+ setValue("#{booking.checkoutDate}", cal.getTime());
+ }
+
+ @Override
+ protected void invokeApplication() {
+ assert "rooms".equals(invokeMethod("#{hotelBooking.setBookingDates}"));
+ }
+
+ @Override
+ protected void renderResponse() {
+ assert Manager.instance().isLongRunningConversation();
+ }
+ }.run();
+
+ new FacesRequest("/rooms.xhtml", id) {
+ @Override
+ protected void renderResponse() {
+ assert getValue("#{booking.user}") != null;
+ assert getValue("#{booking.hotel}") != null;
+ assert getValue("#{booking.checkinDate}") != null;
+ assert getValue("#{booking.checkoutDate}") != null;
+ assert getValue("#{booking.roomPreference}").equals(getValue("#{hotel.standardRoom}"));
+ assert getValue("#{booking.creditCard}") == null;
+ assert getValue("#{booking.creditCardName}") == null;
+
+ assert getValue("#{availableRooms.rowCount}").equals(new Integer(2));
+ DataModel availableRooms = (DataModel) getValue("#{availableRooms}");
+ availableRooms.setRowIndex(0);
+ assert "Cozy Room".equals(getValue("#{availableRooms.rowData.name}"));
+ availableRooms.setRowIndex(1);
+ assert "Spectacular Room".equals(getValue("#{availableRooms.rowData.name}"));
+ }
+ }.run();
+
+ final String nestedId = new FacesRequest("/rooms.xhtml", id) {
+ @Override
+ protected void applyRequestValues() {
+ DataModel availableRooms = (DataModel) getValue("#{availableRooms}");
+ availableRooms.setRowIndex(0);
+ }
+
+ @Override
+ protected void invokeApplication() {
+ assert getValue("#{booking.roomPreference}") != null;
+ assert "Cozy Room".equals(getValue("#{booking.roomPreference.name}"));
+ assert "payment".equals(invokeAction("#{roomPreference.selectPreference}"));
+ System.out.println("here");
+ }
+
+ @Override
+ protected void renderResponse() {
+ assert Manager.instance().isLongRunningConversation();
+ assert Manager.instance().isNestedConversation();
+ }
+ }.run();
+
+ System.out.println(id + "/" + nestedId);
+ // Hmm, need this to move to the new, nested, conversation
+ // TODO This is probably a bug in SeamTest, not sure where
+ new NonFacesRequest("/payment.xhtml", nestedId) {
+ @Override
+ protected void renderResponse() {
+ System.out.println("here");
+ assert Manager.instance().isLongRunningConversation();
+ assert Manager.instance().isNestedConversation();
+
+ assert getValue("#{booking.user}") != null;
+ assert getValue("#{booking.hotel}") != null;
+ assert getValue("#{booking.checkinDate}") != null;
+ assert getValue("#{booking.checkoutDate}") != null;
+ assert getValue("#{booking.roomPreference}") != null;
+ assert getValue("#{booking.creditCard}") == null;
+ assert getValue("#{booking.creditCardName}") == null;
+ }
+ }.run();
+
+ new FacesRequest("/payment.xhtml", nestedId) {
+ @Override
+ protected void processValidations() {
+ validateValue("#{booking.creditCard}", "123");
+ assert isValidationFailure();
+ }
+
+ @Override
+ protected void renderResponse() {
+ Iterator messages = FacesContext.getCurrentInstance().getMessages();
+ assert messages.hasNext();
+ assert ((FacesMessage) messages.next()).getSummary().equals("Credit card number must 16 digits long");
+ assert !messages.hasNext();
+ assert Manager.instance().isLongRunningConversation();
+ assert Manager.instance().isNestedConversation();
+ }
+ }.run();
+
+ new FacesRequest("/payment.xhtml", nestedId) {
+ @Override
+ protected void processValidations() {
+ validateValue("#{booking.creditCardName}", "");
+ assert isValidationFailure();
+ }
+
+ @Override
+ protected void renderResponse() {
+ Iterator messages = FacesContext.getCurrentInstance().getMessages();
+ assert messages.hasNext();
+ assert ((FacesMessage) messages.next()).getSummary().equals("Credit card name is required");
+ assert !messages.hasNext();
+ assert Manager.instance().isLongRunningConversation();
+ assert Manager.instance().isNestedConversation();
+ }
+ }.run();
+
+ new FacesRequest("/payment.xhtml", nestedId) {
+ @Override
+ protected void updateModelValues() {
+ setValue("#{booking.creditCard}", "1234567891021234");
+ setValue("#{booking.creditCardName}", "GAVIN KING");
+ }
+
+ @Override
+ protected void invokeApplication() {
+ assert "confirm".equals(invokeAction("#{roomPreference.requestConfirmation}"));
+ }
+
+ @Override
+ protected void renderResponse() {
+ assert Manager.instance().isLongRunningConversation();
+ assert Manager.instance().isNestedConversation();
+ }
+ }.run();
+
+ new FacesRequest("/confirm.xhtml", nestedId) {
+ @Override
+ protected void invokeApplication() {
+ invokeMethod("#{hotelBooking.confirm}");
+ }
+ }.run();
+
+ new NonFacesRequest("/main.xhtml") {
+ @Override
+ protected void renderResponse() {
+ ListDataModel bookings = (ListDataModel) getInstance("bookings");
+ assert bookings.getRowCount() == 1;
+ bookings.setRowIndex(0);
+ Booking booking = (Booking) bookings.getRowData();
+ assert booking.getHotel().getCity().equals("NY");
+ assert booking.getUser().getUsername().equals("gavin");
+ assert !Manager.instance().isLongRunningConversation();
+ }
+ }.run();
+
+ new FacesRequest("/main.xhtml") {
+ @Override
+ protected void invokeApplication() {
+ ListDataModel bookings = (ListDataModel) Contexts.getSessionContext().get("bookings");
+ bookings.setRowIndex(0);
+ invokeMethod("#{bookingList.cancel}");
+ }
+
+ @Override
+ protected void renderResponse() {
+ ListDataModel bookings = (ListDataModel) Contexts.getSessionContext().get("bookings");
+ assert bookings.getRowCount() == 0;
+ assert !Manager.instance().isLongRunningConversation();
+ }
+ }.run();
+
+ }
+}
Added: branches/enterprise/WFK-2_1/examples/nestedbooking/nestedbooking-ejb/src/test/java/org/jboss/seam/example/nestedbooking/test/ChangePasswordTest.java
===================================================================
--- branches/enterprise/WFK-2_1/examples/nestedbooking/nestedbooking-ejb/src/test/java/org/jboss/seam/example/nestedbooking/test/ChangePasswordTest.java (rev 0)
+++ branches/enterprise/WFK-2_1/examples/nestedbooking/nestedbooking-ejb/src/test/java/org/jboss/seam/example/nestedbooking/test/ChangePasswordTest.java 2013-06-03 19:31:51 UTC (rev 15534)
@@ -0,0 +1,150 @@
+//$Id: ChangePasswordTest.java 6826 2007-11-25 13:12:07Z pmuir $
+package org.jboss.seam.example.nestedbooking.test;
+
+import org.jboss.arquillian.container.test.api.Deployment;
+import org.jboss.arquillian.container.test.api.OverProtocol;
+import org.jboss.arquillian.junit.Arquillian;
+import org.jboss.seam.contexts.Contexts;
+import org.jboss.seam.core.Manager;
+import org.jboss.seam.example.booking.User;
+import org.jboss.seam.mock.JUnitSeamTest;
+import org.jboss.shrinkwrap.api.Archive;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+
+(a)RunWith(Arquillian.class)
+public class ChangePasswordTest extends JUnitSeamTest
+{
+ @Deployment(name="ChangePasswordTest")
+ @OverProtocol("Servlet 3.0")
+ public static Archive<?> createDeployment()
+ {
+ return Deployments.nestedBookingDeployment();
+ }
+
+ @Test
+ public void testChangePassword() throws Exception
+ {
+
+ new FacesRequest() {
+
+ @Override
+ protected void invokeApplication() throws Exception
+ {
+ Contexts.getSessionContext().set("user", new User("Gavin King", "foobar", "gavin"));
+ setValue("#{identity.username}", "gavin");
+ setValue("#{identity.password}", "foobar");
+ invokeMethod("#{identity.login}");
+ }
+
+ }.run();
+
+ new FacesRequest() {
+
+ @Override
+ protected void processValidations() throws Exception
+ {
+ validateValue("#{user.password}", "xxx");
+ assert isValidationFailure();
+ }
+
+ @Override
+ protected void renderResponse()
+ {
+ assert getValue("#{user.name}").equals("Gavin King");
+ assert getValue("#{user.username}").equals("gavin");
+ assert getValue("#{user.password}").equals("foobar");
+ assert !Manager.instance().isLongRunningConversation();
+ assert getValue("#{identity.loggedIn}").equals(true);
+
+ }
+
+ }.run();
+
+ new FacesRequest() {
+
+ @Override
+ protected void updateModelValues() throws Exception
+ {
+ setValue("#{user.password}", "xxxyyy");
+ setValue("#{changePassword.verify}", "xxyyyx");
+ }
+
+ @Override
+ protected void invokeApplication()
+ {
+ assert invokeMethod("#{changePassword.changePassword}")==null;
+ }
+
+ @Override
+ protected void renderResponse()
+ {
+ assert getValue("#{user.name}").equals("Gavin King");
+ assert getValue("#{user.username}").equals("gavin");
+ assert getValue("#{user.password}").equals("foobar");
+ assert !Manager.instance().isLongRunningConversation();
+ assert getValue("#{identity.loggedIn}").equals(true);
+ }
+
+ }.run();
+
+ new FacesRequest() {
+
+ @Override
+ protected void updateModelValues() throws Exception
+ {
+ setValue("#{user.password}", "xxxyyy");
+ setValue("#{changePassword.verify}", "xxxyyy");
+ }
+
+ @Override
+ protected void invokeApplication()
+ {
+ invokeMethod("#{changePassword.changePassword}");
+ }
+
+ @Override
+ protected void renderResponse()
+ {
+ assert getValue("#{user.name}").equals("Gavin King");
+ assert getValue("#{user.username}").equals("gavin");
+ assert getValue("#{user.password}").equals("xxxyyy");
+ assert !Manager.instance().isLongRunningConversation();
+ assert getValue("#{identity.loggedIn}").equals(true);
+
+ }
+
+ }.run();
+
+ new FacesRequest() {
+
+ @Override
+ protected void updateModelValues() throws Exception
+ {
+ assert getValue("#{user.password}").equals("xxxyyy");
+ setValue("#{user.password}", "foobar");
+ setValue("#{changePassword.verify}", "foobar");
+ }
+
+ @Override
+ protected void invokeApplication()
+ {
+ invokeMethod("#{changePassword.changePassword}");
+ }
+
+ @Override
+ protected void renderResponse()
+ {
+ assert getValue("#{user.name}").equals("Gavin King");
+ assert getValue("#{user.username}").equals("gavin");
+ assert getValue("#{user.password}").equals("foobar");
+ assert !Manager.instance().isLongRunningConversation();
+ assert getValue("#{identity.loggedIn}").equals(true);
+
+ }
+
+ }.run();
+
+ }
+
+}
Added: branches/enterprise/WFK-2_1/examples/nestedbooking/nestedbooking-ejb/src/test/java/org/jboss/seam/example/nestedbooking/test/Deployments.java
===================================================================
--- branches/enterprise/WFK-2_1/examples/nestedbooking/nestedbooking-ejb/src/test/java/org/jboss/seam/example/nestedbooking/test/Deployments.java (rev 0)
+++ branches/enterprise/WFK-2_1/examples/nestedbooking/nestedbooking-ejb/src/test/java/org/jboss/seam/example/nestedbooking/test/Deployments.java 2013-06-03 19:31:51 UTC (rev 15534)
@@ -0,0 +1,36 @@
+package org.jboss.seam.example.nestedbooking.test;
+
+import org.jboss.shrinkwrap.api.ShrinkWrap;
+import org.jboss.shrinkwrap.api.spec.WebArchive;
+
+import java.io.File;
+import org.jboss.seam.example.booking.Booking;
+import org.jboss.shrinkwrap.resolver.api.maven.Maven;
+
+public class Deployments {
+ public static WebArchive nestedBookingDeployment() {
+
+ File[] libs = Maven.resolver().loadPomFromFile("pom.xml")
+ .importCompileAndRuntimeDependencies()
+ // force resolve jboss-seam, because it is provided-scoped in the pom, but we need it bundled in the WAR
+ .resolve("org.jboss.seam:jboss-seam")
+ .withTransitivity().asFile();
+
+ return ShrinkWrap.create(WebArchive.class, "seam-nestedbooking.war")
+ .addPackage(Booking.class.getPackage())
+
+ // from main and test resources
+ .addAsWebInfResource("META-INF/ejb-jar.xml", "ejb-jar.xml")
+ .addAsResource("import.sql", "import.sql")
+ .addAsResource("seam.properties", "seam.properties")
+ .addAsWebInfResource("web.xml", "web.xml")
+
+ // manually copied from EAR, persistence modified
+ .addAsResource("persistence.xml", "META-INF/persistence.xml")
+ .addAsWebInfResource("jboss-deployment-structure.xml", "jboss-deployment-structure.xml")
+
+ // manually copied from WAR
+ .addAsWebInfResource("components.xml", "components.xml")
+ .addAsLibraries(libs);
+ }
+}
Added: branches/enterprise/WFK-2_1/examples/nestedbooking/nestedbooking-ejb/src/test/java/org/jboss/seam/example/nestedbooking/test/LoginTest.java
===================================================================
--- branches/enterprise/WFK-2_1/examples/nestedbooking/nestedbooking-ejb/src/test/java/org/jboss/seam/example/nestedbooking/test/LoginTest.java (rev 0)
+++ branches/enterprise/WFK-2_1/examples/nestedbooking/nestedbooking-ejb/src/test/java/org/jboss/seam/example/nestedbooking/test/LoginTest.java 2013-06-03 19:31:51 UTC (rev 15534)
@@ -0,0 +1,100 @@
+//$Id: LoginTest.java 6826 2007-11-25 13:12:07Z pmuir $
+package org.jboss.seam.example.nestedbooking.test;
+
+import org.jboss.arquillian.container.test.api.Deployment;
+import org.jboss.arquillian.container.test.api.OverProtocol;
+import org.jboss.arquillian.junit.Arquillian;
+import org.jboss.seam.Seam;
+import org.jboss.seam.core.Manager;
+import org.jboss.seam.mock.JUnitSeamTest;
+import org.jboss.shrinkwrap.api.Archive;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+
+(a)RunWith(Arquillian.class)
+public class LoginTest extends JUnitSeamTest
+{
+ @Deployment(name="LoginTest")
+ @OverProtocol("Servlet 3.0")
+ public static Archive<?> createDeployment()
+ {
+ return Deployments.nestedBookingDeployment();
+ }
+
+ @Test
+ public void testLogin() throws Exception
+ {
+
+ new FacesRequest() {
+
+ @Override
+ protected void invokeApplication()
+ {
+ assert !isSessionInvalid();
+ assert getValue("#{identity.loggedIn}").equals(false);
+ }
+
+ }.run();
+
+ new FacesRequest() {
+
+ @Override
+ protected void updateModelValues() throws Exception
+ {
+ assert !isSessionInvalid();
+ setValue("#{identity.username}", "gavin");
+ setValue("#{identity.password}", "foobar");
+ }
+
+ @Override
+ protected void invokeApplication()
+ {
+ invokeMethod("#{identity.login}");
+ }
+
+ @Override
+ protected void renderResponse()
+ {
+ assert getValue("#{user.name}").equals("Gavin King");
+ assert getValue("#{user.username}").equals("gavin");
+ assert getValue("#{user.password}").equals("foobar");
+ assert !Manager.instance().isLongRunningConversation();
+ assert getValue("#{identity.loggedIn}").equals(true);
+ }
+
+ }.run();
+
+ new FacesRequest() {
+
+ @Override
+ protected void invokeApplication()
+ {
+ assert !isSessionInvalid();
+ assert getValue("#{identity.loggedIn}").equals(true);
+ }
+
+ }.run();
+
+ new FacesRequest() {
+
+ @Override
+ protected void invokeApplication()
+ {
+ assert !Manager.instance().isLongRunningConversation();
+ assert !isSessionInvalid();
+ invokeMethod("#{identity.logout}");
+ assert Seam.isSessionInvalid();
+ }
+
+ @Override
+ protected void renderResponse()
+ {
+ assert getValue("#{identity.loggedIn}").equals(false);
+ assert Seam.isSessionInvalid();
+ }
+
+ }.run();
+
+ }
+
+}
Added: branches/enterprise/WFK-2_1/examples/nestedbooking/nestedbooking-ejb/src/test/resources/arquillian.xml
===================================================================
(Binary files differ)
Property changes on: branches/enterprise/WFK-2_1/examples/nestedbooking/nestedbooking-ejb/src/test/resources/arquillian.xml
___________________________________________________________________
Added: svn:mime-type
+ application/xml
Added: branches/enterprise/WFK-2_1/examples/nestedbooking/nestedbooking-ejb/src/test/resources/components.xml
===================================================================
(Binary files differ)
Property changes on: branches/enterprise/WFK-2_1/examples/nestedbooking/nestedbooking-ejb/src/test/resources/components.xml
___________________________________________________________________
Added: svn:mime-type
+ application/xml
Added: branches/enterprise/WFK-2_1/examples/nestedbooking/nestedbooking-ejb/src/test/resources/jboss-deployment-structure.xml
===================================================================
--- branches/enterprise/WFK-2_1/examples/nestedbooking/nestedbooking-ejb/src/test/resources/jboss-deployment-structure.xml (rev 0)
+++ branches/enterprise/WFK-2_1/examples/nestedbooking/nestedbooking-ejb/src/test/resources/jboss-deployment-structure.xml 2013-06-03 19:31:51 UTC (rev 15534)
@@ -0,0 +1,12 @@
+<jboss-deployment-structure xmlns="urn:jboss:deployment-structure:1.0">
+ <deployment>
+ <dependencies>
+ <module name="org.apache.log4j" export="true"/>
+ <module name="org.dom4j" export="true"/>
+ <module name="org.apache.commons.logging" export="true"/>
+ <module name="org.apache.commons.collections" export="true"/>
+ <module name="javax.faces.api" export="true"/>
+ <module name="com.sun.jsf-impl" export="true"/>
+ </dependencies>
+ </deployment>
+</jboss-deployment-structure>
Added: branches/enterprise/WFK-2_1/examples/nestedbooking/nestedbooking-ejb/src/test/resources/persistence.xml
===================================================================
(Binary files differ)
Property changes on: branches/enterprise/WFK-2_1/examples/nestedbooking/nestedbooking-ejb/src/test/resources/persistence.xml
___________________________________________________________________
Added: svn:mime-type
+ application/xml
Added: branches/enterprise/WFK-2_1/examples/nestedbooking/nestedbooking-ejb/src/test/resources/web.xml
===================================================================
(Binary files differ)
Property changes on: branches/enterprise/WFK-2_1/examples/nestedbooking/nestedbooking-ejb/src/test/resources/web.xml
___________________________________________________________________
Added: svn:mime-type
+ application/xml
Modified: branches/enterprise/WFK-2_1/examples/nestedbooking/nestedbooking-web/pom.xml
===================================================================
--- branches/enterprise/WFK-2_1/examples/nestedbooking/nestedbooking-web/pom.xml 2013-06-03 18:05:17 UTC (rev 15533)
+++ branches/enterprise/WFK-2_1/examples/nestedbooking/nestedbooking-web/pom.xml 2013-06-03 19:31:51 UTC (rev 15534)
@@ -2,8 +2,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>
+ <groupId>org.jboss.seam.examples</groupId>
<artifactId>nestedbooking</artifactId>
- <groupId>org.jboss.seam.examples</groupId>
<version>2.3.1.Final-redhat-2</version>
<relativePath>../pom.xml</relativePath>
</parent>
@@ -70,6 +70,7 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-war-plugin</artifactId>
+ <version>${version.war.plugin}</version>
<configuration>
<webResources>
<resource>
Modified: branches/enterprise/WFK-2_1/examples/nestedbooking/pom.xml
===================================================================
--- branches/enterprise/WFK-2_1/examples/nestedbooking/pom.xml 2013-06-03 18:05:17 UTC (rev 15533)
+++ branches/enterprise/WFK-2_1/examples/nestedbooking/pom.xml 2013-06-03 19:31:51 UTC (rev 15534)
@@ -3,27 +3,48 @@
<modelVersion>4.0.0</modelVersion>
<groupId>org.jboss.seam.examples</groupId>
<artifactId>nestedbooking</artifactId>
- <parent>
- <groupId>org.jboss.seam</groupId>
- <artifactId>examples</artifactId>
- <version>2.3.1.Final-redhat-2</version>
- </parent>
+ <version>2.3.1.Final-redhat-2</version>
<packaging>pom</packaging>
<name>Nested Booking Example (EE6)</name>
<properties>
<example.name>nestedbooking</example.name>
+ <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
+ <maven.compiler.target>1.6</maven.compiler.target>
+ <maven.compiler.source>1.6</maven.compiler.source>
+
+ <!-- To use jacoco, set jacoco.agent system property to something like
+ -javaagent:/path/to/jacocoagent.jar=append=true,destfile=/path/to/output/jacoco.exec -->
+ <jacoco.agent />
+
+ <!-- To use custom Maven settings with ShrinkWrap Resolver, uncomment
+ and customize the following property. -->
+ <!--<maven.user.settings>/path/to/custom/settings.xml</maven.user.settings>-->
+
+ <version.commons.logging>1.1.1</version.commons.logging>
+ <version.shrinkwrap.resolver>2.0.0-beta-4</version.shrinkwrap.resolver>
+
+ <!-- Plugin versions -->
+ <version.dependency.plugin>2.5.1</version.dependency.plugin>
+ <version.surefire.plugin>2.10</version.surefire.plugin>
+ <version.resources.plugin>2.6</version.resources.plugin>
+ <version.compiler.plugin>2.3.1</version.compiler.plugin>
+ <version.ear.plugin>2.6</version.ear.plugin>
+ <version.war.plugin>2.1.1</version.war.plugin>
+ <version.ejb.plugin>2.3</version.ejb.plugin>
+ <version.jboss.maven.plugin>7.4.Final</version.jboss.maven.plugin>
</properties>
<modules>
<module>nestedbooking-ear</module>
<module>nestedbooking-ejb</module>
<module>nestedbooking-web</module>
- <module>nestedbooking-tests</module>
+
</modules>
<dependencyManagement>
<dependencies>
+ <!-- Modules -->
<dependency>
<groupId>org.jboss.seam.examples.nestedbooking</groupId>
<artifactId>nestedbooking-ejb</artifactId>
@@ -40,7 +61,84 @@
<groupId>org.jboss.seam.examples.nestedbooking</groupId>
<artifactId>nestedbooking-ear</artifactId>
<version>${project.version}</version>
+ <type>ear</type>
</dependency>
+
+ <!-- BOMs -->
+ <dependency>
+ <groupId>org.jboss.shrinkwrap.resolver</groupId>
+ <artifactId>shrinkwrap-resolver-bom</artifactId>
+ <version>${version.shrinkwrap.resolver}</version>
+ <scope>import</scope>
+ <type>pom</type>
+ </dependency>
+
+ <dependency>
+ <groupId>org.jboss.seam</groupId>
+ <artifactId>bom</artifactId>
+ <version>${project.version}</version>
+ <type>pom</type>
+ <scope>import</scope>
+ </dependency>
+
+ <!-- Common provided dependencies -->
+ <dependency>
+ <groupId>commons-logging</groupId>
+ <artifactId>commons-logging</artifactId>
+ <version>${version.commons.logging}</version>
+ <scope>provided</scope>
+ </dependency>
+
+ <!-- TestNG is not necessary -->
+ <dependency>
+ <groupId>org.jboss.seam</groupId>
+ <artifactId>jboss-seam</artifactId>
+ <version>${project.version}</version>
+ <exclusions>
+ <exclusion>
+ <groupId>org.testng</groupId>
+ <artifactId>testng</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ </exclusion>
+ </exclusions>
+ </dependency>
+
</dependencies>
</dependencyManagement>
+
+ <build>
+ <pluginManagement>
+ <plugins>
+ <!-- Manage plugin versions for build stability -->
+ <plugin>
+ <artifactId>maven-surefire-plugin</artifactId>
+ <version>${version.surefire.plugin}</version>
+ <configuration>
+ <systemPropertyVariables>
+ <org.apache.maven.user-settings>${maven.user.settings}</org.apache.maven.user-settings>
+ </systemPropertyVariables>
+ </configuration>
+ </plugin>
+ <plugin>
+ <artifactId>maven-dependency-plugin</artifactId>
+ <version>${version.dependency.plugin}</version>
+ </plugin>
+ <plugin>
+ <artifactId>maven-resources-plugin</artifactId>
+ <version>${version.resources.plugin}</version>
+ </plugin>
+ <plugin>
+ <artifactId>maven-compiler-plugin</artifactId>
+ <version>${version.compiler.plugin}</version>
+ <configuration>
+ <source>${maven.compiler.source}</source>
+ <target>${maven.compiler.target}</target>
+ </configuration>
+ </plugin>
+ </plugins>
+ </pluginManagement>
+ </build>
</project>
Deleted: branches/enterprise/WFK-2_1/examples/nestedbooking/readme.txt
===================================================================
--- branches/enterprise/WFK-2_1/examples/nestedbooking/readme.txt 2013-06-03 18:05:17 UTC (rev 15533)
+++ branches/enterprise/WFK-2_1/examples/nestedbooking/readme.txt 2013-06-03 19:31:51 UTC (rev 15534)
@@ -1,20 +0,0 @@
-Seam NestedBooking Example
-==========================
-
-This example demonstrates the use of Seam nested conversations and runs
-on JBoss AS as an EAR.
-
-To deploy the example, follow these steps:
-
-* In the example root directory run:
-
- mvn clean install
-
-* Set JBOSS_HOME environment property.
-
-* In the nestedbooking-ear directory run:
-
- mvn jboss-as:deploy
-
-* Open this URL in a web browser: http://localhost:8080/seam-nestedbooking
-
Added: branches/enterprise/WFK-2_1/examples/spring/README.md
===================================================================
--- branches/enterprise/WFK-2_1/examples/spring/README.md (rev 0)
+++ branches/enterprise/WFK-2_1/examples/spring/README.md 2013-06-03 19:31:51 UTC (rev 15534)
@@ -0,0 +1,22 @@
+Seam Spring Example
+===================
+
+This example shows Seam/Spring integration. This application runs on AS as
+a WAR file.
+
+Running the example
+-------------------
+
+To deploy the example to a running JBoss AS instance, follow these steps:
+
+1. In the example root directory run:
+
+ mvn clean install
+
+2. Set JBOSS_HOME environment property.
+
+3. In the spring-web directory run:
+
+ mvn jboss-as:deploy
+
+4. Open this URL in a web browser: http://localhost:8080/spring-web
Modified: branches/enterprise/WFK-2_1/examples/spring/pom.xml
===================================================================
--- branches/enterprise/WFK-2_1/examples/spring/pom.xml 2013-06-03 18:05:17 UTC (rev 15533)
+++ branches/enterprise/WFK-2_1/examples/spring/pom.xml 2013-06-03 19:31:51 UTC (rev 15534)
@@ -3,32 +3,125 @@
<modelVersion>4.0.0</modelVersion>
<groupId>org.jboss.seam.examples</groupId>
<artifactId>spring</artifactId>
- <parent>
- <groupId>org.jboss.seam</groupId>
- <artifactId>examples</artifactId>
- <version>2.3.1.Final-redhat-2</version>
- </parent>
+ <version>2.3.1.Final-redhat-2</version>
<packaging>pom</packaging>
<name>Spring Example (EE6)</name>
<properties>
<example.name>spring</example.name>
+ <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
+ <maven.compiler.target>1.6</maven.compiler.target>
+ <maven.compiler.source>1.6</maven.compiler.source>
+
+ <!-- To use jacoco, set jacoco.agent system property to something like
+ -javaagent:/path/to/jacocoagent.jar=append=true,destfile=/path/to/output/jacoco.exec -->
+ <jacoco.agent />
+
+ <!-- To use custom Maven settings with ShrinkWrap Resolver, uncomment
+ and customize the following property. -->
+ <!--<maven.user.settings>/path/to/custom/settings.xml</maven.user.settings>-->
+
+ <version.commons.logging>1.1.1</version.commons.logging>
+ <version.shrinkwrap.resolver>2.0.0-beta-4</version.shrinkwrap.resolver>
+
+ <!-- Plugin versions -->
+ <version.dependency.plugin>2.5.1</version.dependency.plugin>
+ <version.resources.plugin>2.6</version.resources.plugin>
+ <version.surefire.plugin>2.10</version.surefire.plugin>
+ <version.compiler.plugin>2.3.1</version.compiler.plugin>
+ <version.war.plugin>2.1.1</version.war.plugin>
+ <version.jboss.maven.plugin>7.4.Final</version.jboss.maven.plugin>
</properties>
-
+
<modules>
<module>spring-web</module>
- <module>spring-tests</module>
</modules>
-
+
<dependencyManagement>
<dependencies>
+ <!-- Modules -->
<dependency>
<groupId>org.jboss.seam.examples.spring</groupId>
<artifactId>spring-web</artifactId>
<version>${project.version}</version>
<type>war</type>
</dependency>
+
+ <!-- BOMs -->
+ <dependency>
+ <groupId>org.jboss.shrinkwrap.resolver</groupId>
+ <artifactId>shrinkwrap-resolver-bom</artifactId>
+ <version>${version.shrinkwrap.resolver}</version>
+ <scope>import</scope>
+ <type>pom</type>
+ </dependency>
+
+ <dependency>
+ <groupId>org.jboss.seam</groupId>
+ <artifactId>bom</artifactId>
+ <version>${project.version}</version>
+ <type>pom</type>
+ <scope>import</scope>
+ </dependency>
+
+ <!-- Common provided dependencies -->
+ <dependency>
+ <groupId>commons-logging</groupId>
+ <artifactId>commons-logging</artifactId>
+ <version>${version.commons.logging}</version>
+ <scope>provided</scope>
+ </dependency>
+
+ <!-- TestNG is not necessary -->
+ <dependency>
+ <groupId>org.jboss.seam</groupId>
+ <artifactId>jboss-seam</artifactId>
+ <version>${project.version}</version>
+ <exclusions>
+ <exclusion>
+ <groupId>org.testng</groupId>
+ <artifactId>testng</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ </exclusion>
+ </exclusions>
+ </dependency>
</dependencies>
</dependencyManagement>
+ <build>
+ <pluginManagement>
+ <plugins>
+ <!-- Manage plugin versions for build stability -->
+ <plugin>
+ <artifactId>maven-surefire-plugin</artifactId>
+ <version>${version.surefire.plugin}</version>
+ <configuration>
+ <systemPropertyVariables>
+ <org.apache.maven.user-settings>${maven.user.settings}</org.apache.maven.user-settings>
+ </systemPropertyVariables>
+ </configuration>
+ </plugin>
+ <plugin>
+ <artifactId>maven-dependency-plugin</artifactId>
+ <version>${version.dependency.plugin}</version>
+ </plugin>
+ <plugin>
+ <artifactId>maven-resources-plugin</artifactId>
+ <version>${version.resources.plugin}</version>
+ </plugin>
+ <plugin>
+ <artifactId>maven-compiler-plugin</artifactId>
+ <version>${version.compiler.plugin}</version>
+ <configuration>
+ <source>${maven.compiler.source}</source>
+ <target>${maven.compiler.target}</target>
+ </configuration>
+ </plugin>
+ </plugins>
+ </pluginManagement>
+
+ </build>
</project>
Deleted: branches/enterprise/WFK-2_1/examples/spring/readme.txt
===================================================================
--- branches/enterprise/WFK-2_1/examples/spring/readme.txt 2013-06-03 18:05:17 UTC (rev 15533)
+++ branches/enterprise/WFK-2_1/examples/spring/readme.txt 2013-06-03 19:31:51 UTC (rev 15534)
@@ -1,18 +0,0 @@
-Seam Spring Example
-===================
-
-This example shows Seam/Spring integration. This application runs on AS as
-a WAR file.
-
-To deploy the example, follow these steps:
-
-* In the example root directory run:
-
- mvn clean install
-
-* Set JBOSS_HOME environment property.
-
-* In the spring-web directory run:
-
- mvn jboss-as:deploy
-
Modified: branches/enterprise/WFK-2_1/examples/spring/spring-web/pom.xml
===================================================================
--- branches/enterprise/WFK-2_1/examples/spring/spring-web/pom.xml 2013-06-03 18:05:17 UTC (rev 15533)
+++ branches/enterprise/WFK-2_1/examples/spring/spring-web/pom.xml 2013-06-03 19:31:51 UTC (rev 15534)
@@ -2,17 +2,17 @@
<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>
+ <groupId>org.jboss.seam.examples</groupId>
<artifactId>spring</artifactId>
- <groupId>org.jboss.seam.examples</groupId>
<version>2.3.1.Final-redhat-2</version>
<relativePath>../pom.xml</relativePath>
</parent>
-
+
<groupId>org.jboss.seam.examples.spring</groupId>
<artifactId>spring-web</artifactId>
<packaging>war</packaging>
<name>Spring Web Module (EE6)</name>
-
+
<dependencies>
<dependency>
<groupId>org.jboss.seam</groupId>
@@ -113,6 +113,7 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-war-plugin</artifactId>
+ <version>${version.war.plugin}</version>
<configuration>
<webResources>
<resource>
@@ -124,4 +125,5 @@
</plugin>
</plugins>
</build>
+
</project>
11 years, 5 months
Seam SVN: r15533 - in branches/enterprise/WFK-2_1/examples/seamspace: seamspace-ear and 12 other directories.
by seam-commits@lists.jboss.org
Author: maschmid
Date: 2013-06-03 14:05:17 -0400 (Mon, 03 Jun 2013)
New Revision: 15533
Added:
branches/enterprise/WFK-2_1/examples/seamspace/seamspace-ejb/src/test/
branches/enterprise/WFK-2_1/examples/seamspace/seamspace-ejb/src/test/java/
branches/enterprise/WFK-2_1/examples/seamspace/seamspace-ejb/src/test/java/org/
branches/enterprise/WFK-2_1/examples/seamspace/seamspace-ejb/src/test/java/org/jboss/
branches/enterprise/WFK-2_1/examples/seamspace/seamspace-ejb/src/test/java/org/jboss/seam/
branches/enterprise/WFK-2_1/examples/seamspace/seamspace-ejb/src/test/java/org/jboss/seam/example/
branches/enterprise/WFK-2_1/examples/seamspace/seamspace-ejb/src/test/java/org/jboss/seam/example/seamspace/
branches/enterprise/WFK-2_1/examples/seamspace/seamspace-ejb/src/test/java/org/jboss/seam/example/seamspace/test/
branches/enterprise/WFK-2_1/examples/seamspace/seamspace-ejb/src/test/java/org/jboss/seam/example/seamspace/test/BlogTest.java
branches/enterprise/WFK-2_1/examples/seamspace/seamspace-ejb/src/test/java/org/jboss/seam/example/seamspace/test/Deployments.java
branches/enterprise/WFK-2_1/examples/seamspace/seamspace-ejb/src/test/java/org/jboss/seam/example/seamspace/test/RegisterTest.java
branches/enterprise/WFK-2_1/examples/seamspace/seamspace-ejb/src/test/resources/
branches/enterprise/WFK-2_1/examples/seamspace/seamspace-ejb/src/test/resources/arquillian.xml
branches/enterprise/WFK-2_1/examples/seamspace/seamspace-ejb/src/test/resources/components.xml
branches/enterprise/WFK-2_1/examples/seamspace/seamspace-ejb/src/test/resources/jboss-deployment-structure.xml
branches/enterprise/WFK-2_1/examples/seamspace/seamspace-ejb/src/test/resources/pages.xml
branches/enterprise/WFK-2_1/examples/seamspace/seamspace-ejb/src/test/resources/persistence.xml
branches/enterprise/WFK-2_1/examples/seamspace/seamspace-ejb/src/test/resources/web.xml
Removed:
branches/enterprise/WFK-2_1/examples/seamspace/seamspace-tests/
Modified:
branches/enterprise/WFK-2_1/examples/seamspace/pom.xml
branches/enterprise/WFK-2_1/examples/seamspace/seamspace-ear/pom.xml
branches/enterprise/WFK-2_1/examples/seamspace/seamspace-ejb/pom.xml
branches/enterprise/WFK-2_1/examples/seamspace/seamspace-web/pom.xml
Log:
seamspace migrated
Modified: branches/enterprise/WFK-2_1/examples/seamspace/pom.xml
===================================================================
--- branches/enterprise/WFK-2_1/examples/seamspace/pom.xml 2013-06-03 17:24:43 UTC (rev 15532)
+++ branches/enterprise/WFK-2_1/examples/seamspace/pom.xml 2013-06-03 18:05:17 UTC (rev 15533)
@@ -3,27 +3,49 @@
<modelVersion>4.0.0</modelVersion>
<groupId>org.jboss.seam.examples</groupId>
<artifactId>seamspace</artifactId>
- <parent>
- <groupId>org.jboss.seam</groupId>
- <artifactId>examples</artifactId>
- <version>2.3.1.Final-redhat-2</version>
- </parent>
+ <version>2.3.1.Final-redhat-2</version>
+
<packaging>pom</packaging>
<name>SeamSpace Example (EE6)</name>
<properties>
<example.name>seamspace</example.name>
+ <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
+ <maven.compiler.target>1.6</maven.compiler.target>
+ <maven.compiler.source>1.6</maven.compiler.source>
+
+ <!-- To use jacoco, set jacoco.agent system property to something like
+ -javaagent:/path/to/jacocoagent.jar=append=true,destfile=/path/to/output/jacoco.exec -->
+ <jacoco.agent />
+
+ <!-- To use custom Maven settings with ShrinkWrap Resolver, uncomment
+ and customize the following property. -->
+ <!--<maven.user.settings>/path/to/custom/settings.xml</maven.user.settings>-->
+
+ <version.commons.logging>1.1.1</version.commons.logging>
+ <version.shrinkwrap.resolver>2.0.0-beta-4</version.shrinkwrap.resolver>
+
+ <!-- Plugin versions -->
+ <version.dependency.plugin>2.5.1</version.dependency.plugin>
+ <version.surefire.plugin>2.10</version.surefire.plugin>
+ <version.resources.plugin>2.6</version.resources.plugin>
+ <version.compiler.plugin>2.3.1</version.compiler.plugin>
+ <version.ear.plugin>2.6</version.ear.plugin>
+ <version.war.plugin>2.1.1</version.war.plugin>
+ <version.ejb.plugin>2.3</version.ejb.plugin>
+ <version.jboss.maven.plugin>7.4.Final</version.jboss.maven.plugin>
</properties>
<modules>
<module>seamspace-ear</module>
<module>seamspace-ejb</module>
<module>seamspace-web</module>
- <module>seamspace-tests</module>
+
</modules>
<dependencyManagement>
<dependencies>
+ <!-- Modules -->
<dependency>
<groupId>org.jboss.seam.examples.seamspace</groupId>
<artifactId>seamspace-ejb</artifactId>
@@ -41,6 +63,82 @@
<artifactId>seamspace-ear</artifactId>
<version>${project.version}</version>
</dependency>
+
+ <!-- BOMs -->
+ <dependency>
+ <groupId>org.jboss.shrinkwrap.resolver</groupId>
+ <artifactId>shrinkwrap-resolver-bom</artifactId>
+ <version>${version.shrinkwrap.resolver}</version>
+ <scope>import</scope>
+ <type>pom</type>
+ </dependency>
+
+ <dependency>
+ <groupId>org.jboss.seam</groupId>
+ <artifactId>bom</artifactId>
+ <version>${project.version}</version>
+ <type>pom</type>
+ <scope>import</scope>
+ </dependency>
+
+ <!-- Common provided dependencies -->
+ <dependency>
+ <groupId>commons-logging</groupId>
+ <artifactId>commons-logging</artifactId>
+ <version>${version.commons.logging}</version>
+ <scope>provided</scope>
+ </dependency>
+
+ <!-- TestNG is not necessary -->
+ <dependency>
+ <groupId>org.jboss.seam</groupId>
+ <artifactId>jboss-seam</artifactId>
+ <version>${project.version}</version>
+ <exclusions>
+ <exclusion>
+ <groupId>org.testng</groupId>
+ <artifactId>testng</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ </exclusion>
+ </exclusions>
+ </dependency>
+
</dependencies>
</dependencyManagement>
+
+ <build>
+ <pluginManagement>
+ <plugins>
+ <!-- Manage plugin versions for build stability -->
+ <plugin>
+ <artifactId>maven-surefire-plugin</artifactId>
+ <version>${version.surefire.plugin}</version>
+ <configuration>
+ <systemPropertyVariables>
+ <org.apache.maven.user-settings>${maven.user.settings}</org.apache.maven.user-settings>
+ </systemPropertyVariables>
+ </configuration>
+ </plugin>
+ <plugin>
+ <artifactId>maven-dependency-plugin</artifactId>
+ <version>${version.dependency.plugin}</version>
+ </plugin>
+ <plugin>
+ <artifactId>maven-resources-plugin</artifactId>
+ <version>${version.resources.plugin}</version>
+ </plugin>
+ <plugin>
+ <artifactId>maven-compiler-plugin</artifactId>
+ <version>${version.compiler.plugin}</version>
+ <configuration>
+ <source>${maven.compiler.source}</source>
+ <target>${maven.compiler.target}</target>
+ </configuration>
+ </plugin>
+ </plugins>
+ </pluginManagement>
+ </build>
</project>
Modified: branches/enterprise/WFK-2_1/examples/seamspace/seamspace-ear/pom.xml
===================================================================
--- branches/enterprise/WFK-2_1/examples/seamspace/seamspace-ear/pom.xml 2013-06-03 17:24:43 UTC (rev 15532)
+++ branches/enterprise/WFK-2_1/examples/seamspace/seamspace-ear/pom.xml 2013-06-03 18:05:17 UTC (rev 15533)
@@ -85,10 +85,20 @@
<build>
<finalName>seam-seamspace</finalName>
+ <pluginManagement>
+ <plugins>
+ <plugin>
+ <groupId>org.jboss.as.plugins</groupId>
+ <artifactId>jboss-as-maven-plugin</artifactId>
+ <version>${version.jboss.maven.plugin}</version>
+ </plugin>
+ </plugins>
+ </pluginManagement>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-ear-plugin</artifactId>
+ <version>${version.ear.plugin}</version>
<configuration>
<version>6</version>
<defaultLibBundleDir>lib</defaultLibBundleDir>
Modified: branches/enterprise/WFK-2_1/examples/seamspace/seamspace-ejb/pom.xml
===================================================================
--- branches/enterprise/WFK-2_1/examples/seamspace/seamspace-ejb/pom.xml 2013-06-03 17:24:43 UTC (rev 15532)
+++ branches/enterprise/WFK-2_1/examples/seamspace/seamspace-ejb/pom.xml 2013-06-03 18:05:17 UTC (rev 15533)
@@ -81,6 +81,112 @@
</exclusion>
</exclusions>
</dependency>
+
+ <!-- Test dependencies -->
+ <dependency>
+ <groupId>org.jboss.shrinkwrap.resolver</groupId>
+ <artifactId>shrinkwrap-resolver-depchain</artifactId>
+ <type>pom</type>
+ <scope>test</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <scope>test</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.jboss.arquillian.junit</groupId>
+ <artifactId>arquillian-junit-container</artifactId>
+ <scope>test</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.jboss.arquillian.protocol</groupId>
+ <artifactId>arquillian-protocol-servlet</artifactId>
+ <scope>test</scope>
+ </dependency>
+
</dependencies>
-
+
+ <profiles>
+ <profile>
+ <id>integration-tests</id>
+ <activation>
+ <property>
+ <name>arquillian</name>
+ </property>
+ </activation>
+ <properties>
+ <jndiPattern>java:app/seam-seamspace/#{ejbName}</jndiPattern>
+ <distributable>false</distributable>
+ </properties>
+ <build>
+ <testResources>
+ <testResource>
+ <directory>src/test/resources</directory>
+ <filtering>true</filtering>
+ </testResource>
+ </testResources>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-surefire-plugin</artifactId>
+ <configuration>
+ <skip>false</skip>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+ </profile>
+
+ <profile>
+ <id>arq-jbossas-7-managed</id>
+ <activation>
+ <property>
+ <name>arquillian</name>
+ <value>jbossas-managed-7</value>
+ </property>
+ </activation>
+ <dependencies>
+ <dependency>
+ <groupId>org.jboss.as</groupId>
+ <artifactId>jboss-as-arquillian-container-managed</artifactId>
+ <scope>test</scope>
+ </dependency>
+ </dependencies>
+ </profile>
+
+ <profile>
+ <id>arq-jbossas-7-remote</id>
+ <activation>
+ <property>
+ <name>arquillian</name>
+ <value>jbossas-remote-7</value>
+ </property>
+ </activation>
+ <dependencies>
+ <dependency>
+ <groupId>org.jboss.as</groupId>
+ <artifactId>jboss-as-arquillian-container-remote</artifactId>
+ <scope>test</scope>
+ </dependency>
+ </dependencies>
+ </profile>
+ </profiles>
+
+ <build>
+ <plugins>
+ <!-- Skip tests by default -->
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-surefire-plugin</artifactId>
+ <configuration>
+ <skip>true</skip>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+
</project>
Added: branches/enterprise/WFK-2_1/examples/seamspace/seamspace-ejb/src/test/java/org/jboss/seam/example/seamspace/test/BlogTest.java
===================================================================
--- branches/enterprise/WFK-2_1/examples/seamspace/seamspace-ejb/src/test/java/org/jboss/seam/example/seamspace/test/BlogTest.java (rev 0)
+++ branches/enterprise/WFK-2_1/examples/seamspace/seamspace-ejb/src/test/java/org/jboss/seam/example/seamspace/test/BlogTest.java 2013-06-03 18:05:17 UTC (rev 15533)
@@ -0,0 +1,161 @@
+package org.jboss.seam.example.seamspace.test;
+
+import static org.junit.Assert.*;
+
+import org.jboss.arquillian.container.test.api.Deployment;
+import org.jboss.arquillian.container.test.api.OverProtocol;
+import org.jboss.arquillian.junit.Arquillian;
+import org.jboss.seam.mock.JUnitSeamTest;
+import org.jboss.shrinkwrap.api.Archive;
+import org.jboss.shrinkwrap.api.spec.EnterpriseArchive;
+import org.jboss.shrinkwrap.api.spec.WebArchive;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+
+(a)RunWith(Arquillian.class)
+public class BlogTest extends JUnitSeamTest
+{
+ @Deployment(name="BlogTest")
+ @OverProtocol("Servlet 3.0")
+ public static Archive<?> createDeployment()
+ {
+ return Deployments.seamSpaceDeployment();
+ }
+
+ @Test
+ public void testCreateBlog() throws Exception
+ {
+ // Log in first
+ new FacesRequest()
+ {
+ @Override
+ protected void invokeApplication() throws Exception
+ {
+ setValue("#{identity.username}", "demo");
+ setValue("#{identity.password}", "demo");
+ invokeAction("#{identity.login}");
+ assertTrue((Boolean)getValue("#{identity.loggedIn}"));
+ }
+ }.run();
+
+ String cid = new FacesRequest()
+ {
+ @Override
+ protected void invokeApplication() throws Exception
+ {
+ assertNull(invokeAction("#{blog.createEntry}"));
+ }
+ }.run();
+
+ new FacesRequest("/createBlog.xhtml", cid)
+ {
+ @Override
+ protected void updateModelValues() throws Exception
+ {
+ setValue("#{selectedBlog.title}", "A new blog entry");
+ setValue("#{selectedBlog.text}", "A very very very long section of text. " +
+ "This text should be long enough to simulate a typical blog entry. " +
+ "Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Sed interdum " +
+ "felis non arcu. Phasellus sodales pharetra dui. Suspendisse felis turpis, " +
+ "ultricies a, ullamcorper sed, nonummy id, nulla. Ut quis orci. Mauris diam " +
+ "pede, condimentum et, tempor vitae, facilisis non, sem. Mauris quam ipsum, " +
+ "laoreet non, ultricies in, aliquet nec, metus. Morbi dui. Vestibulum " +
+ "ullamcorper, tellus non hendrerit consequat, libero erat laoreet metus, " +
+ "quis facilisis arcu diam vel orci. Fusce tempor erat eget odio. Aliquam urna " +
+ "dui, dignissim id, pretium in, congue quis, est. Phasellus nec erat ac arcu " +
+ "porttitor rhoncus. Pellentesque habitant morbi tristique senectus et netus et " +
+ "malesuada fames ac turpis egestas. Nulla sed massa ut est sodales ultrices. " +
+ "Sed vitae nulla eu tellus fringilla sagittis. Nunc convallis, mi at lobortis " +
+ "rhoncus, neque turpis ullamcorper odio, quis scelerisque est dolor non velit. Integer vulputate.");
+ }
+
+ @Override
+ protected void invokeApplication() throws Exception
+ {
+ assertNull(invokeAction("#{blog.saveEntry}"));
+ }
+
+ }.run();
+
+ new FacesRequest()
+ {
+ @Override
+ protected void invokeApplication() throws Exception
+ {
+ invokeAction("#{identity.logout}");
+ assertFalse((Boolean)getValue("#{identity.loggedIn}"));
+ }
+ }.run();
+ }
+
+ //@Test
+ public void testCreateComment() throws Exception
+ {
+ new FacesRequest()
+ {
+ @Override
+ protected void invokeApplication() throws Exception
+ {
+ setValue("#{identity.username}", "demo");
+ setValue("#{identity.password}", "demo");
+ invokeAction("#{identity.login}");
+ assertTrue((Boolean)getValue("#{identity.loggedIn}"));
+ }
+ }.run();
+
+ String cid = new FacesRequest("/comment.xhtml")
+ {
+ @Override
+ protected void beforeRequest()
+ {
+ setParameter("name", "Mr_Smiley");
+ setParameter("blogId", "1");
+ }
+
+ @Override
+ protected void renderResponse() throws Exception
+ {
+ assertNotNull(getValue("#{selectedBlog}"));
+ assertEquals(1, getValue("#{selectedBlog.blogId}"));
+ }
+ }.run();
+
+ new FacesRequest("/comment.xhtml", cid)
+ {
+ @Override
+ protected void invokeApplication() throws Exception
+ {
+ assertNull(invokeAction("#{blog.createComment}"));
+
+ assertNotNull(getValue("#{comment}"));
+ assertNotNull(getValue("#{comment.blog}"));
+ }
+ }.run();
+
+ new FacesRequest("/comment.xhtml", cid)
+ {
+ @Override
+ protected void updateModelValues() throws Exception
+ {
+ setValue("#{comment.comment}", "I totally disagree with your blog entry!");
+ }
+
+ @Override
+ protected void invokeApplication() throws Exception
+ {
+ assertNull(invokeAction("#{blog.saveComment}"));
+ }
+ }.run();
+
+ new FacesRequest()
+ {
+ @Override
+ protected void invokeApplication() throws Exception
+ {
+ invokeAction("#{identity.logout}");
+ assertFalse((Boolean)getValue("#{identity.loggedIn}"));
+ }
+ }.run();
+
+ }
+}
Added: branches/enterprise/WFK-2_1/examples/seamspace/seamspace-ejb/src/test/java/org/jboss/seam/example/seamspace/test/Deployments.java
===================================================================
--- branches/enterprise/WFK-2_1/examples/seamspace/seamspace-ejb/src/test/java/org/jboss/seam/example/seamspace/test/Deployments.java (rev 0)
+++ branches/enterprise/WFK-2_1/examples/seamspace/seamspace-ejb/src/test/java/org/jboss/seam/example/seamspace/test/Deployments.java 2013-06-03 18:05:17 UTC (rev 15533)
@@ -0,0 +1,44 @@
+package org.jboss.seam.example.seamspace.test;
+
+import org.jboss.shrinkwrap.api.ShrinkWrap;
+import org.jboss.shrinkwrap.api.spec.WebArchive;
+import org.jboss.shrinkwrap.resolver.api.maven.Maven;
+
+import java.io.File;
+import org.jboss.shrinkwrap.api.asset.StringAsset;
+
+public class Deployments {
+ public static WebArchive seamSpaceDeployment() {
+ File[] libs = Maven.resolver().loadPomFromFile("pom.xml")
+ .importCompileAndRuntimeDependencies()
+ // force resolve jboss-seam, because it is provided-scoped in the pom, but we need it bundled in the WAR
+ .resolve("org.jboss.seam:jboss-seam")
+ .withTransitivity().asFile();
+
+ WebArchive war = ShrinkWrap.create(WebArchive.class, "seam-seamspace.war")
+ .addPackages(true, "org.jboss.seam.example.seamspace")
+
+ // already in EJB module
+ .addAsResource("import.sql", "import.sql")
+ .addAsResource("seam.properties", "seam.properties")
+ .addAsWebInfResource("META-INF/ejb-jar.xml", "ejb-jar.xml")
+ .addAsResource("META-INF/orm.xml", "META-INF/orm.xml")
+ .addAsResource("META-INF/security-rules.drl", "META-INF/security-rules.drl")
+
+ // test-specific persistence.xml
+ .addAsResource("persistence.xml", "META-INF/persistence.xml")
+
+ // manually copied from Web module
+ .addAsWebInfResource("pages.xml", "pages.xml")
+
+ // manually copied from Web module, modified
+ .addAsWebInfResource("web.xml", "web.xml") // only contains MockSeamListener definition
+ .addAsWebInfResource("components.xml", "components.xml") // corrected ejb component jndi-name references from java:app/jboss-seam to java:app/seam-seampay
+
+ // manually copied from EAR module
+ .addAsWebInfResource("jboss-deployment-structure.xml", "jboss-deployment-structure.xml")
+ .addAsLibraries(libs);
+
+ return war;
+ }
+}
Added: branches/enterprise/WFK-2_1/examples/seamspace/seamspace-ejb/src/test/java/org/jboss/seam/example/seamspace/test/RegisterTest.java
===================================================================
--- branches/enterprise/WFK-2_1/examples/seamspace/seamspace-ejb/src/test/java/org/jboss/seam/example/seamspace/test/RegisterTest.java (rev 0)
+++ branches/enterprise/WFK-2_1/examples/seamspace/seamspace-ejb/src/test/java/org/jboss/seam/example/seamspace/test/RegisterTest.java 2013-06-03 18:05:17 UTC (rev 15533)
@@ -0,0 +1,87 @@
+package org.jboss.seam.example.seamspace.test;
+
+import static org.junit.Assert.*;
+
+import java.util.Date;
+import org.jboss.arquillian.container.test.api.Deployment;
+import org.jboss.arquillian.container.test.api.OverProtocol;
+import org.jboss.arquillian.junit.Arquillian;
+
+import org.jboss.seam.core.Manager;
+import org.jboss.seam.mock.JUnitSeamTest;
+import org.jboss.shrinkwrap.api.Archive;
+import org.jboss.shrinkwrap.api.spec.WebArchive;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+
+(a)RunWith(Arquillian.class)
+public class RegisterTest extends JUnitSeamTest
+{
+
+ @Deployment(name="RegisterTest")
+ @OverProtocol("Servlet 3.0")
+ public static Archive<?> createDeployment()
+ {
+ return Deployments.seamSpaceDeployment();
+ }
+
+ @Test
+ public void testRegister() throws Exception
+ {
+ String cid = new FacesRequest()
+ {
+ @Override
+ protected void invokeApplication() throws Exception
+ {
+ assertNull(invokeAction("#{register.start}"));
+ }
+ }.run();
+
+ new FacesRequest("/register.xhtml", cid)
+ {
+ @Override
+ protected void updateModelValues() throws Exception
+ {
+ setValue("#{register.member.email}", "shane(a)test.com");
+ setValue("#{register.member.firstName}", "Shane");
+ setValue("#{register.member.lastName}", "Bryzak");
+ setValue("#{register.member.memberName}", "shane123");
+ setValue("#{register.username}", "sbryzak");
+ setValue("#{register.password}", "secret");
+ setValue("#{register.confirm}", "secret");
+ setValue("#{register.gender}", "Male");
+ setValue("#{register.member.dob}", new Date(107100000000L));
+ }
+
+ @Override
+ protected void invokeApplication() throws Exception
+ {
+ assertNull(invokeAction("#{register.next}"));
+ }
+
+ }.run();
+
+ new FacesRequest("/register2.xhtml", cid)
+ {
+ @Override
+ protected void invokeApplication() throws Exception
+ {
+ assertNull(invokeAction("#{register.uploadPicture}"));
+ assertFalse(Manager.instance().isLongRunningConversation());
+ }
+
+ }.run();
+
+ new FacesRequest()
+ {
+ @Override
+ protected void invokeApplication() throws Exception
+ {
+ assertTrue((Boolean)getValue("#{identity.loggedIn}"));
+ assertNull(invokeAction("#{identity.logout}"));
+ assertFalse((Boolean)getValue("#{identity.loggedIn}"));
+ }
+
+ }.run();
+ }
+}
Added: branches/enterprise/WFK-2_1/examples/seamspace/seamspace-ejb/src/test/resources/arquillian.xml
===================================================================
(Binary files differ)
Property changes on: branches/enterprise/WFK-2_1/examples/seamspace/seamspace-ejb/src/test/resources/arquillian.xml
___________________________________________________________________
Added: svn:mime-type
+ application/xml
Added: branches/enterprise/WFK-2_1/examples/seamspace/seamspace-ejb/src/test/resources/components.xml
===================================================================
(Binary files differ)
Property changes on: branches/enterprise/WFK-2_1/examples/seamspace/seamspace-ejb/src/test/resources/components.xml
___________________________________________________________________
Added: svn:mime-type
+ application/xml
Added: branches/enterprise/WFK-2_1/examples/seamspace/seamspace-ejb/src/test/resources/jboss-deployment-structure.xml
===================================================================
--- branches/enterprise/WFK-2_1/examples/seamspace/seamspace-ejb/src/test/resources/jboss-deployment-structure.xml (rev 0)
+++ branches/enterprise/WFK-2_1/examples/seamspace/seamspace-ejb/src/test/resources/jboss-deployment-structure.xml 2013-06-03 18:05:17 UTC (rev 15533)
@@ -0,0 +1,10 @@
+<jboss-deployment-structure xmlns="urn:jboss:deployment-structure:1.0">
+ <deployment>
+ <dependencies>
+ <module name="org.antlr" export="true"/>
+ <module name="org.dom4j" export="true"/>
+ <module name="javax.faces.api" export="true"/>
+ <module name="com.sun.jsf-impl" export="true"/>
+ </dependencies>
+ </deployment>
+</jboss-deployment-structure>
Added: branches/enterprise/WFK-2_1/examples/seamspace/seamspace-ejb/src/test/resources/pages.xml
===================================================================
(Binary files differ)
Property changes on: branches/enterprise/WFK-2_1/examples/seamspace/seamspace-ejb/src/test/resources/pages.xml
___________________________________________________________________
Added: svn:mime-type
+ application/xml
Added: branches/enterprise/WFK-2_1/examples/seamspace/seamspace-ejb/src/test/resources/persistence.xml
===================================================================
(Binary files differ)
Property changes on: branches/enterprise/WFK-2_1/examples/seamspace/seamspace-ejb/src/test/resources/persistence.xml
___________________________________________________________________
Added: svn:mime-type
+ application/xml
Added: branches/enterprise/WFK-2_1/examples/seamspace/seamspace-ejb/src/test/resources/web.xml
===================================================================
(Binary files differ)
Property changes on: branches/enterprise/WFK-2_1/examples/seamspace/seamspace-ejb/src/test/resources/web.xml
___________________________________________________________________
Added: svn:mime-type
+ application/xml
Modified: branches/enterprise/WFK-2_1/examples/seamspace/seamspace-web/pom.xml
===================================================================
--- branches/enterprise/WFK-2_1/examples/seamspace/seamspace-web/pom.xml 2013-06-03 17:24:43 UTC (rev 15532)
+++ branches/enterprise/WFK-2_1/examples/seamspace/seamspace-web/pom.xml 2013-06-03 18:05:17 UTC (rev 15533)
@@ -66,6 +66,7 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-war-plugin</artifactId>
+ <version>${version.war.plugin}</version>
<configuration>
<webResources>
<resource>
11 years, 5 months