JBoss JBPM SVN: r1786 - in jbossbpm/spec/trunk: modules/api and 23 other directories.
by do-not-reply@jboss.org
Author: thomas.diesler(a)jboss.com
Date: 2008-07-31 03:40:59 -0400 (Thu, 31 Jul 2008)
New Revision: 1786
Added:
jbossbpm/spec/trunk/modules/testsuite/src/test/java/org/jboss/bpm/cts/processmanager/
jbossbpm/spec/trunk/modules/testsuite/src/test/java/org/jboss/bpm/cts/processmanager/ProcessRegistryTest.java
jbossbpm/spec/trunk/modules/testsuite/src/test/resources/cts/engine/
Removed:
jbossbpm/spec/trunk/modules/testsuite/src/test/resources/samples/engine/
Modified:
jbossbpm/spec/trunk/modules/api/pom.xml
jbossbpm/spec/trunk/modules/api/src/main/java/org/jboss/bpm/client/ProcessManager.java
jbossbpm/spec/trunk/modules/api/src/main/java/org/jboss/bpm/model/ProcessBuilder.java
jbossbpm/spec/trunk/modules/dialects/
jbossbpm/spec/trunk/modules/dialects/api10/src/main/java/org/jboss/bpm/dialect/api10/model/package-info.java
jbossbpm/spec/trunk/modules/ri/src/main/java/org/jboss/bpm/client/internal/ProcessManagerImpl.java
jbossbpm/spec/trunk/modules/ri/src/main/java/org/jboss/bpm/model/internal/ProcessBuilderImpl.java
jbossbpm/spec/trunk/modules/ri/src/main/java/org/jboss/bpm/model/internal/ProcessImpl.java
jbossbpm/spec/trunk/modules/samples/airticket/
jbossbpm/spec/trunk/modules/samples/airticket/README.txt
jbossbpm/spec/trunk/modules/samples/airticket/client/pom.xml
jbossbpm/spec/trunk/modules/samples/airticket/server/src/main/java/org/jboss/bpm/samples/airticket/AirticketProcessBuilder.java
jbossbpm/spec/trunk/modules/samples/airticket/server/src/main/resources/jbpm-beans.xml
jbossbpm/spec/trunk/modules/testsuite/src/test/java/org/jboss/bpm/cts/engine/EngineShutdownTest.java
jbossbpm/spec/trunk/modules/testsuite/src/test/java/org/jboss/bpm/cts/process/ProcessIntegrityTest.java
jbossbpm/spec/trunk/modules/testsuite/src/test/java/org/jboss/bpm/cts/process/ProcessStartTest.java
jbossbpm/spec/trunk/modules/testsuite/src/test/java/org/jboss/bpm/samples/sequence/BasicSequenceTest.java
jbossbpm/spec/trunk/modules/testsuite/src/test/java/org/jboss/bpm/samples/task/BasicTaskTest.java
jbossbpm/spec/trunk/modules/testsuite/src/test/resources/cts/engine/basic-engine-api10.xml
jbossbpm/spec/trunk/modules/testsuite/src/test/resources/jbpm-beans.xml
jbossbpm/spec/trunk/modules/testsuite/src/test/resources/samples/parallelsplit/parallel-split-api10.xml
jbossbpm/spec/trunk/modules/testsuite/src/test/resources/samples/sequence/basic-sequence-api10.xml
jbossbpm/spec/trunk/modules/testsuite/src/test/resources/samples/task/basic-task-api10.xml
jbossbpm/spec/trunk/pom.xml
Log:
Add CTS tests
Modified: jbossbpm/spec/trunk/modules/api/pom.xml
===================================================================
--- jbossbpm/spec/trunk/modules/api/pom.xml 2008-07-30 19:52:06 UTC (rev 1785)
+++ jbossbpm/spec/trunk/modules/api/pom.xml 2008-07-31 07:40:59 UTC (rev 1786)
@@ -66,7 +66,7 @@
<destdir>target/schema</destdir>
<schemas>
<schema>
- <namespace>urn:api.bpm.jboss:jpdl-0.1</namespace>
+ <namespace>urn:bpm.jboss:pdl-0.1</namespace>
<file>jbpm-api-0.1.xsd</file>
</schema>
</schemas>
Modified: jbossbpm/spec/trunk/modules/api/src/main/java/org/jboss/bpm/client/ProcessManager.java
===================================================================
--- jbossbpm/spec/trunk/modules/api/src/main/java/org/jboss/bpm/client/ProcessManager.java 2008-07-30 19:52:06 UTC (rev 1785)
+++ jbossbpm/spec/trunk/modules/api/src/main/java/org/jboss/bpm/client/ProcessManager.java 2008-07-31 07:40:59 UTC (rev 1786)
@@ -160,7 +160,8 @@
}
/**
- * Register a Process
+ * Register a Process.
+ * This is not part of the API.
*/
protected void registerProcess(Process proc)
{
@@ -169,8 +170,9 @@
/**
* Remove a Process
+ * This is not part of the API.
*/
- public void removeProcess(Process proc)
+ protected void removeProcess(Process proc)
{
procs.remove(proc);
}
@@ -187,9 +189,9 @@
* If the process was aborted this method throws the causing RuntimeException if avaialable.
*
*/
- public Status waitForEnd(ObjectName id, long timeout)
+ public Status waitForEnd(ObjectName procID, long timeout)
{
- Process proc = getProcessByID(id);
+ Process proc = getProcessByID(procID);
Status status = proc.getStatus();
if (status == Status.None || status == Status.Ready)
@@ -224,9 +226,14 @@
{
log.warn(ex);
}
+ finally
+ {
+ // Remove the process
+ removeProcess(proc);
+ }
// Throw timeout exception if it took too long
- throw new ProcessTimeoutException("Process timeout for: " + id);
+ throw new ProcessTimeoutException("Process timeout for: " + procID);
}
private String getNamespaceURI(InputStream inStream)
Modified: jbossbpm/spec/trunk/modules/api/src/main/java/org/jboss/bpm/model/ProcessBuilder.java
===================================================================
--- jbossbpm/spec/trunk/modules/api/src/main/java/org/jboss/bpm/model/ProcessBuilder.java 2008-07-30 19:52:06 UTC (rev 1785)
+++ jbossbpm/spec/trunk/modules/api/src/main/java/org/jboss/bpm/model/ProcessBuilder.java 2008-07-31 07:40:59 UTC (rev 1786)
@@ -78,8 +78,13 @@
ProcessBuilder addEndEvent(String name);
/**
- * Add a {@link Task} with a given name
+ * Add a {@link Task} of {@link TaskType} NONE with a given name
*/
+ TaskBuilder addTask(String name);
+
+ /**
+ * Add a {@link Task} with a given name and type
+ */
TaskBuilder addTask(String name, TaskType type);
/**
Property changes on: jbossbpm/spec/trunk/modules/dialects
___________________________________________________________________
Name: svn:ignore
- .settings
+ .settings
target
Modified: jbossbpm/spec/trunk/modules/dialects/api10/src/main/java/org/jboss/bpm/dialect/api10/model/package-info.java
===================================================================
--- jbossbpm/spec/trunk/modules/dialects/api10/src/main/java/org/jboss/bpm/dialect/api10/model/package-info.java 2008-07-30 19:52:06 UTC (rev 1785)
+++ jbossbpm/spec/trunk/modules/dialects/api10/src/main/java/org/jboss/bpm/dialect/api10/model/package-info.java 2008-07-31 07:40:59 UTC (rev 1786)
@@ -19,7 +19,7 @@
* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
*/
-@XmlSchema(namespace="urn:api.bpm.jboss:jpdl-0.1")
+@XmlSchema(namespace="urn:bpm.jboss:pdl-0.1")
package org.jboss.bpm.dialect.api10.model;
import javax.xml.bind.annotation.XmlSchema;
Modified: jbossbpm/spec/trunk/modules/ri/src/main/java/org/jboss/bpm/client/internal/ProcessManagerImpl.java
===================================================================
--- jbossbpm/spec/trunk/modules/ri/src/main/java/org/jboss/bpm/client/internal/ProcessManagerImpl.java 2008-07-30 19:52:06 UTC (rev 1785)
+++ jbossbpm/spec/trunk/modules/ri/src/main/java/org/jboss/bpm/client/internal/ProcessManagerImpl.java 2008-07-31 07:40:59 UTC (rev 1786)
@@ -54,6 +54,20 @@
this.dialectRegistry = dialectRegistry;
}
+ // Provide public access
+ @Override
+ public void registerProcess(Process proc)
+ {
+ super.registerProcess(proc);
+ }
+
+ // Provide public access
+ @Override
+ public void removeProcess(Process proc)
+ {
+ super.removeProcess(proc);
+ }
+
public ObjectName startProcess(String name, Attachments att)
{
Set<Process> procSet = findProcessByName(name, Status.Ready);
Modified: jbossbpm/spec/trunk/modules/ri/src/main/java/org/jboss/bpm/model/internal/ProcessBuilderImpl.java
===================================================================
--- jbossbpm/spec/trunk/modules/ri/src/main/java/org/jboss/bpm/model/internal/ProcessBuilderImpl.java 2008-07-30 19:52:06 UTC (rev 1785)
+++ jbossbpm/spec/trunk/modules/ri/src/main/java/org/jboss/bpm/model/internal/ProcessBuilderImpl.java 2008-07-31 07:40:59 UTC (rev 1786)
@@ -142,6 +142,11 @@
return this;
}
+ public TaskBuilder addTask(String name)
+ {
+ return addTask(name, TaskType.None);
+ }
+
public TaskBuilder addTask(String name, TaskType type)
{
if (type == TaskType.None)
Modified: jbossbpm/spec/trunk/modules/ri/src/main/java/org/jboss/bpm/model/internal/ProcessImpl.java
===================================================================
--- jbossbpm/spec/trunk/modules/ri/src/main/java/org/jboss/bpm/model/internal/ProcessImpl.java 2008-07-30 19:52:06 UTC (rev 1785)
+++ jbossbpm/spec/trunk/modules/ri/src/main/java/org/jboss/bpm/model/internal/ProcessImpl.java 2008-07-31 07:40:59 UTC (rev 1786)
@@ -35,9 +35,8 @@
import org.jboss.bpm.InvalidProcessException;
import org.jboss.bpm.NotImplementedException;
-import org.jboss.bpm.client.ProcessEngine;
-import org.jboss.bpm.client.ProcessEngineLocator;
import org.jboss.bpm.client.ProcessManager;
+import org.jboss.bpm.client.internal.ProcessManagerImpl;
import org.jboss.bpm.model.EndEvent;
import org.jboss.bpm.model.FlowObject;
import org.jboss.bpm.model.InputSet;
@@ -187,22 +186,29 @@
public ObjectName startProcess(Attachments att)
{
- ProcessEngine engine = ProcessEngineLocator.locateProcessEngine();
- ProcessManager pm = engine.getProcessManager();
+ ProcessManagerImpl pm = (ProcessManagerImpl)ProcessManager.locateProcessManager();
+
+ if (getStatus() != Status.Ready)
+ throw new IllegalStateException("Cannot start process in state: " + getStatus());
+
+ // Register the process if needed
+ if (pm.findProcessByName(getName(), null).size() == 0)
+ {
+ pm.registerProcess(this);
+ }
+
return pm.startProcess(getName(), att);
}
public void waitForEnd()
{
- ProcessEngine engine = ProcessEngineLocator.locateProcessEngine();
- ProcessManager pm = engine.getProcessManager();
+ ProcessManager pm = ProcessManager.locateProcessManager();
pm.waitForEnd(getID(), -1);
}
public void waitForEnd(long timeout)
{
- ProcessEngine engine = ProcessEngineLocator.locateProcessEngine();
- ProcessManager pm = engine.getProcessManager();
+ ProcessManager pm = ProcessManager.locateProcessManager();
pm.waitForEnd(getID(), timeout);
}
@@ -251,8 +257,7 @@
// Set the anonymous default name
if (getName() == null)
{
- ProcessEngine engine = ProcessEngineLocator.locateProcessEngine();
- ProcessManager pm = engine.getProcessManager();
+ ProcessManager pm = ProcessManager.locateProcessManager();
this.name = "AnonymousProcess#" + pm.getProcesses().size();
}
Property changes on: jbossbpm/spec/trunk/modules/samples/airticket
___________________________________________________________________
Name: svn:ignore
- .gwt-cache
.settings
+ .gwt-cache
.settings
target
Modified: jbossbpm/spec/trunk/modules/samples/airticket/README.txt
===================================================================
--- jbossbpm/spec/trunk/modules/samples/airticket/README.txt 2008-07-30 19:52:06 UTC (rev 1785)
+++ jbossbpm/spec/trunk/modules/samples/airticket/README.txt 2008-07-31 07:40:59 UTC (rev 1786)
@@ -1,117 +1,22 @@
-WELCOME to the maven-googlewebtoolkit2-sample Project
-=====================================================
+WELCOME to the Airticket Sample Project
+=======================================
-Also see GWT-Maven documentation:
-http://gwt-maven.googlecode.com/svn/docs/maven-googlewebtoolkit2-plugin/index.html
-
About:
======
This sample project has some specific goals:
- + GWT-Maven 'Best Practice' & Usage
- + Java5+ integration on the GWT server side & Java1.4 on the GWT client side using a multi-module maven project.
- + GWT RPC structure via multi-module maven project - and inheriting a GWT module
- + The features offered by GWT-Maven (like building a WAR, running the GWTShell, mergewebxml, and GWT testing)
+ + BPM GWT 'Best Practice' & Usage
+ + GWT server side & GWT client side
Overview:
=========
-This sample package contains 4 different examples to show how GWT-Maven
-should be used with your project. If you intend to use multiple modules, you will want to build
-more than one of the examples. If you wish to set up a simpler single module (with just one pom.xml),
-then choose the example that is closest to the function of your project (likely the war project).
+This sample shows how a BPM GWT client interacts with the BPM engine based on Messages and Signals.
-This sample uses GWT-Maven with the "automatic" GWT setup mode enabled. This means
-that you do *not* have to download and install GWT yourself, the plugin will
-setup and extract GWT for you (when using this method).
-(You can optionally use manual method with a local GWT install, see documentation.)
-Which project to build:
-=======================
- + parent (this is the root parent module of the project)
- + rpc (this is the GWT RPC *INTERFACE* definition) Java 1.4
- + server (this is the GWT RPC *IMPLEMENTATION*, it builds a GWT module that war inherits) Java 1.5+
- + war (this is the GWT client code) Java 1.4
-
-Prerequisites:
-==============
- + Maven2 - http://maven.apache.org
- + Maven bin directory added to Path
-
-
-Running the parent example:
+Running the Client example:
===========================
-The parent example demonstrates a multi-module Maven build with a GWT project.
-When run it will build the rpc, server, and war sub projects.
-1. Use a command prompt to navigate into the maven-googlewebtoolkit2-sample directory.
-2. Execute "mvn clean install".
-3. Sub projects will have artifacts (see details for each below)
+Enable the 'gwt' profile to build and run the GWT client.
+ mvn -Pgwt gwt:gwt
-Running the WAR example:
-========================
-The WAR project builds a Web-Application-Archive file for a GWT project.
-This war can then be deployed to a servlet container, and or you can run this
-project in the GWTShell using GWT-Maven.
-This project demonstrates not only the usefulness of GWT-Maven in terms of
-building WAR files, and running the shell, but also the "merge web xml" aspect.
-Notice that this project has a local web.xml source file, that is used to create
-a deployment time file that includes a standard servlet entry, as well as a GWT-RPC entry.
-(GWT-Maven allows you to use the embedded Tomcat server with source web.xml and other
-files [context.xml, if you use Tomcat outside of the shell], and it configures the
-embedded Tomcat for you.)
-
-This project also includes a testing sample using the GWT-Maven testGwt goal, and
-includes EMMA based code coverage and reports for GWTTestCase based tests.
-Code coverage with GWT is a bit tricky, but using the coverage patch JAR (as this project does)
-and generating ONLY a report (not instrumentation data itself, which GWT does for you when patched)
-along with AntRun to move things around, creates an automated build with testing and reports.
-(If you want to see the testing stuff, uncomment the "testGwt" goal in the POM, it is commented
-out by default to keep things faster and simpler.)
-(Note* - when running tests the Surefire plugin is NOT used for GwtTestCase based tests, rather
-a special testGwt goal is included with GWT-Maven for GwtTestCase based tests, thus TWO test phases
-will happen during "mvn test", one for Surefire standard tests, and one for testGwt GWT tests.)
-
-1. Build the server sub-project, using the instructions in "Running the parent example" above.
-2. Use a command prompt to navigate into the maven-googlewebtoolkit2-sample/war directory.
-3. Execute "mvn package".
-4. Your sample war will be created in the war/target directory.
-
- OR you can run the GWTShell locally by executing "mvn gwt:gwt".
-
- Optionally: Execute "mvn test site" (with testGwt goal enabled) to run test and get coverage.
-(See "target/site" directory for output.)
-
-
-Running the RPC example
-========================
-The RPC example is meant to show defining GWT-RPC interfaces.
-This project creates a JAR archive that includes source, so that it can be used by other
-GWT projects (the WAR example here uses it). This project does not need GWT-Maven
-(no shell to run, no GWT compiler, etc) - but does require GWT dependencies.
-
-1. Use a command prompt to navigate into the maven-googlewebtoolkit2-sample/rpc directory.
-2. Execute "mvn install".
-3. Your JAR library, with source included, will be in the rpc/target directory.
-
-
-Running the SERVER sample
-=========================
-The Server example demonstrates implementing GWT-RPC interfaces (the one from the RPC example),
-creating a GWT library module (that other projects can inherit), and including a standard
-HttpServlet example in the same project. This project creates
-a JAR archive that is built for the server side of a GWT project. This JAR can then
-be inherited using GWT inheritance to expose a GWT-RPC endpoint.
-(This demonstrates that it can make sense to break up your GWT projects into client and server portions,
-sometimes that helps with re-use [more than one client can import and use the RPC] and with team divisions.)
-
-1. Use a command prompt to navigate into the maven-googlewebtoolkit2-sample/server directory.
-2. Execute "mvn install".
-3. Your JAR library, with source included, will be in the server/target directory.
-
-
-More help:
-==========
-Docs: http://gwt-maven.googlecode.com/svn/docs/maven-googlewebtoolkit2-plugin/i...
-Also refer to the the gwt-maven message board: http://groups.google.com/group/gwt-maven
-
Modified: jbossbpm/spec/trunk/modules/samples/airticket/client/pom.xml
===================================================================
--- jbossbpm/spec/trunk/modules/samples/airticket/client/pom.xml 2008-07-30 19:52:06 UTC (rev 1785)
+++ jbossbpm/spec/trunk/modules/samples/airticket/client/pom.xml 2008-07-31 07:40:59 UTC (rev 1786)
@@ -35,48 +35,57 @@
</dependency>
</dependencies>
- <!-- Plugins -->
- <build>
- <plugins>
- <plugin>
- <groupId>com.totsp.gwt</groupId>
- <artifactId>maven-googlewebtoolkit2-plugin</artifactId>
- <version>2.0-beta18</version>
- <configuration>
- <logLevel>INFO</logLevel>
- <compileTargets>
- <value>org.jboss.bpm.samples.airticket.Application</value>
- </compileTargets>
- <runTarget>org.jboss.bpm.samples.airticket.Application/Application.html
- </runTarget>
- <generatorRootClasses>
- <value>org.jboss.bpm.samples.airticket.Application</value>
- </generatorRootClasses>
- <overwriteGeneratedClasses>true</overwriteGeneratedClasses>
- <style>DETAILED</style>
- <generateGettersAndSetters> true</generateGettersAndSetters>
- <noServer>false</noServer>
- <extraJvmArgs>-Dgwt.coverage.enable=true</extraJvmArgs>
- </configuration>
- <executions>
- <execution>
- <goals>
- <goal>setup</goal>
- <goal>extractGwt</goal>
- <goal>mergewebxml</goal>
- <goal>compile</goal>
- <goal>gwt</goal>
- </goals>
- </execution>
- </executions>
- </plugin>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-war-plugin</artifactId>
- <configuration>
- <webXml>target/web.xml</webXml>
- </configuration>
- </plugin>
- </plugins>
- </build>
+ <!-- Profiles -->
+ <profiles>
+ <!--
+ Name: skiptests
+ Desc: Skips the tests
+ -->
+ <profile>
+ <id>gwt</id>
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>com.totsp.gwt</groupId>
+ <artifactId>maven-googlewebtoolkit2-plugin</artifactId>
+ <version>2.0-beta18</version>
+ <configuration>
+ <logLevel>INFO</logLevel>
+ <compileTargets>
+ <value>org.jboss.bpm.samples.airticket.Application</value>
+ </compileTargets>
+ <runTarget>org.jboss.bpm.samples.airticket.Application/Application.html
+ </runTarget>
+ <generatorRootClasses>
+ <value>org.jboss.bpm.samples.airticket.Application</value>
+ </generatorRootClasses>
+ <overwriteGeneratedClasses>true</overwriteGeneratedClasses>
+ <style>DETAILED</style>
+ <generateGettersAndSetters> true</generateGettersAndSetters>
+ <noServer>false</noServer>
+ <extraJvmArgs>-Dgwt.coverage.enable=true</extraJvmArgs>
+ </configuration>
+ <executions>
+ <execution>
+ <goals>
+ <goal>setup</goal>
+ <goal>extractGwt</goal>
+ <goal>mergewebxml</goal>
+ <goal>compile</goal>
+ <goal>gwt</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-war-plugin</artifactId>
+ <configuration>
+ <webXml>target/web.xml</webXml>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+ </profile>
+ </profiles>
</project>
\ No newline at end of file
Modified: jbossbpm/spec/trunk/modules/samples/airticket/server/src/main/java/org/jboss/bpm/samples/airticket/AirticketProcessBuilder.java
===================================================================
--- jbossbpm/spec/trunk/modules/samples/airticket/server/src/main/java/org/jboss/bpm/samples/airticket/AirticketProcessBuilder.java 2008-07-30 19:52:06 UTC (rev 1785)
+++ jbossbpm/spec/trunk/modules/samples/airticket/server/src/main/java/org/jboss/bpm/samples/airticket/AirticketProcessBuilder.java 2008-07-31 07:40:59 UTC (rev 1786)
@@ -67,7 +67,7 @@
addSequenceFlow("ValidateTask");
// Build the ValidateTask
- taskBuilder = procBuilder.addTask("ValidateTask", TaskType.None);
+ taskBuilder = procBuilder.addTask("ValidateTask");
taskBuilder.addExecutionHandler(ValidationHandler.class).
addInputSet().
addPropertyInput("Name", null).
@@ -85,7 +85,7 @@
addDefaultGate("SendInvalidTask");
// Build the CheckAvailabilityTask
- taskBuilder = procBuilder.addTask("CheckAvailabilityTask", TaskType.None);
+ taskBuilder = procBuilder.addTask("CheckAvailabilityTask");
taskBuilder.addExecutionHandler(AvailabilityHandler.class).
addInputSet().
addPropertyInput("From", null).
@@ -152,7 +152,7 @@
addGate("BookingTask");
// Build the CreditCardTask
- taskBuilder = procBuilder.addTask("CreditCardTask", TaskType.None);
+ taskBuilder = procBuilder.addTask("CreditCardTask");
taskBuilder.addInputSet().
addPropertyInput("CreditCard", null).
addPropertyInput("Expire", null).
@@ -160,7 +160,7 @@
addSequenceFlow("SynchronizedJoinGateway");
// Build the BookingTask
- taskBuilder = procBuilder.addTask("BookingTask", TaskType.None);
+ taskBuilder = procBuilder.addTask("BookingTask");
taskBuilder.addInputSet().
addPropertyInput("Name", null).
addPropertyInput("From", null).
Modified: jbossbpm/spec/trunk/modules/samples/airticket/server/src/main/resources/jbpm-beans.xml
===================================================================
--- jbossbpm/spec/trunk/modules/samples/airticket/server/src/main/resources/jbpm-beans.xml 2008-07-30 19:52:06 UTC (rev 1785)
+++ jbossbpm/spec/trunk/modules/samples/airticket/server/src/main/resources/jbpm-beans.xml 2008-07-31 07:40:59 UTC (rev 1786)
@@ -46,7 +46,7 @@
<bean name="jBPMDialectRegistry" class="org.jboss.bpm.client.DialectRegistry">
<property name="registry">
<map keyClass="java.lang.String" valueClass="java.lang.String">
- <entry><key>urn:api.bpm.jboss:jpdl-0.1</key><value>api10</value></entry>
+ <entry><key>urn:bpm.jboss:pdl-0.1</key><value>api10</value></entry>
<entry><key>urn:jbpm.org:jpdl-3.2</key><value>jpdl32</value></entry>
<entry><key>http://stp.eclipse.org/bpmn</key><value>stp</value></entry>
<entry><key>http://www.wfmc.org/2008/XPDL2.1</key><value>xpdl21</value></entry>
Modified: jbossbpm/spec/trunk/modules/testsuite/src/test/java/org/jboss/bpm/cts/engine/EngineShutdownTest.java
===================================================================
--- jbossbpm/spec/trunk/modules/testsuite/src/test/java/org/jboss/bpm/cts/engine/EngineShutdownTest.java 2008-07-30 19:52:06 UTC (rev 1785)
+++ jbossbpm/spec/trunk/modules/testsuite/src/test/java/org/jboss/bpm/cts/engine/EngineShutdownTest.java 2008-07-31 07:40:59 UTC (rev 1786)
@@ -47,7 +47,7 @@
protected void setUp() throws Exception
{
super.setUp();
- jpdlURL = getResourceURL("samples/engine/basic-engine-" + getDialect() + ".xml");
+ jpdlURL = getResourceURL("cts/engine/basic-engine-" + getDialect() + ".xml");
engine = ProcessEngineLocator.locateProcessEngine();
engine.cancelShutdown();
}
Modified: jbossbpm/spec/trunk/modules/testsuite/src/test/java/org/jboss/bpm/cts/process/ProcessIntegrityTest.java
===================================================================
--- jbossbpm/spec/trunk/modules/testsuite/src/test/java/org/jboss/bpm/cts/process/ProcessIntegrityTest.java 2008-07-30 19:52:06 UTC (rev 1785)
+++ jbossbpm/spec/trunk/modules/testsuite/src/test/java/org/jboss/bpm/cts/process/ProcessIntegrityTest.java 2008-07-31 07:40:59 UTC (rev 1786)
@@ -33,7 +33,6 @@
import org.jboss.bpm.model.ProcessBuilderFactory;
import org.jboss.bpm.model.StartEvent;
import org.jboss.bpm.model.Task;
-import org.jboss.bpm.model.Task.TaskType;
import org.jboss.bpm.test.DefaultEngineTestCase;
/**
@@ -48,7 +47,7 @@
{
// Create a Process through the ProcessBuilder
ProcessBuilder builder = ProcessBuilderFactory.newInstance().newProcessBuilder();
- Process proc = builder.addProcess(null).addStartEvent().addSequenceFlow("taskA").addTask("taskA", TaskType.None).
+ Process proc = builder.addProcess(null).addStartEvent().addSequenceFlow("taskA").addTask("taskA").
addSequenceFlow("end").addEndEvent("end").getProcess();
assertEquals("AnonymousProcess#0", proc.getName());
@@ -69,7 +68,7 @@
{
// Create a Process through the ProcessBuilder
ProcessBuilder builder = ProcessBuilderFactory.newInstance().newProcessBuilder();
- builder.addProcess(null).addTask("taskA", TaskType.None).addSequenceFlow("end").addEndEvent("end").getProcess();
+ builder.addProcess(null).addTask("taskA").addSequenceFlow("end").addEndEvent("end").getProcess();
fail("InvalidProcessException expected");
}
catch (InvalidProcessException ex)
@@ -84,8 +83,8 @@
{
// Create a Process through the ProcessBuilder
ProcessBuilder builder = ProcessBuilderFactory.newInstance().newProcessBuilder();
- builder.addProcess(null).addStartEvent().addSequenceFlow("taskA").addTask("taskA", TaskType.None).addSequenceFlow("end").addTask(
- "end", TaskType.None).getProcess();
+ builder.addProcess(null).addStartEvent().addSequenceFlow("taskA").addTask("taskA").addSequenceFlow("end").
+ addTask("end").getProcess();
fail("InvalidProcessException expected");
}
catch (InvalidProcessException ex)
@@ -100,8 +99,8 @@
{
// Create a Process through the ProcessBuilder
ProcessBuilder builder = ProcessBuilderFactory.newInstance().newProcessBuilder();
- builder.addProcess(null).addStartEvent().addSequenceFlow("taskA").addTask("taskA", TaskType.None).addSequenceFlow("end").addTask(
- "taskA", TaskType.None).addSequenceFlow("end").addEndEvent("end").getProcess();
+ builder.addProcess(null).addStartEvent().addSequenceFlow("taskA").addTask("taskA").addSequenceFlow("end").
+ addTask("taskA").addSequenceFlow("end").addEndEvent("end").getProcess();
fail("InvalidProcessException expected");
}
catch (InvalidProcessException ex)
Modified: jbossbpm/spec/trunk/modules/testsuite/src/test/java/org/jboss/bpm/cts/process/ProcessStartTest.java
===================================================================
--- jbossbpm/spec/trunk/modules/testsuite/src/test/java/org/jboss/bpm/cts/process/ProcessStartTest.java 2008-07-30 19:52:06 UTC (rev 1785)
+++ jbossbpm/spec/trunk/modules/testsuite/src/test/java/org/jboss/bpm/cts/process/ProcessStartTest.java 2008-07-31 07:40:59 UTC (rev 1786)
@@ -28,7 +28,6 @@
import org.jboss.bpm.model.Process;
import org.jboss.bpm.model.ProcessBuilder;
import org.jboss.bpm.model.ProcessBuilderFactory;
-import org.jboss.bpm.model.Task.TaskType;
import org.jboss.bpm.test.DefaultEngineTestCase;
/**
@@ -59,15 +58,15 @@
}
catch (RuntimeException rte)
{
- System.out.println(rte);
+ // expected;
}
}
private Process getProcess()
{
ProcessBuilder builder = ProcessBuilderFactory.newInstance().newProcessBuilder();
- Process proc = builder.addProcess(getName()).addStartEvent().addSequenceFlow("taskA").addTask("taskA",
- TaskType.None).addSequenceFlow("end").addEndEvent("end").getProcess();
+ Process proc = builder.addProcess(getName()).addStartEvent().addSequenceFlow("taskA").
+ addTask("taskA").addSequenceFlow("end").addEndEvent("end").getProcess();
return proc;
}
}
Added: jbossbpm/spec/trunk/modules/testsuite/src/test/java/org/jboss/bpm/cts/processmanager/ProcessRegistryTest.java
===================================================================
--- jbossbpm/spec/trunk/modules/testsuite/src/test/java/org/jboss/bpm/cts/processmanager/ProcessRegistryTest.java (rev 0)
+++ jbossbpm/spec/trunk/modules/testsuite/src/test/java/org/jboss/bpm/cts/processmanager/ProcessRegistryTest.java 2008-07-31 07:40:59 UTC (rev 1786)
@@ -0,0 +1,82 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * 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.bpm.cts.processmanager;
+
+// $Id$
+
+import javax.management.ObjectName;
+
+import org.jboss.bpm.client.ProcessManager;
+import org.jboss.bpm.model.Process;
+import org.jboss.bpm.model.ProcessBuilder;
+import org.jboss.bpm.model.ProcessBuilderFactory;
+import org.jboss.bpm.test.DefaultEngineTestCase;
+
+/**
+ * Test the ProcessRegistry
+ *
+ * @author thomas.diesler(a)jboss.com
+ * @since 08-Jul-2008
+ */
+public class ProcessRegistryTest extends DefaultEngineTestCase
+{
+ public void testStartProcess() throws Exception
+ {
+ Process proc = getProcess();
+ ObjectName procID = proc.getID();
+
+ ProcessManager pm = ProcessManager.locateProcessManager();
+ try
+ {
+ pm.getProcessByID(procID);
+ fail("A process created through the builder is not registered automatically");
+ }
+ catch (RuntimeException ex)
+ {
+ // expected
+ }
+
+ // Start the process, which automatically adds it to the registery
+ assertEquals(procID, proc.startProcess());
+ assertNotNull(pm.getProcessByID(procID));
+
+ proc.waitForEnd();
+
+ try
+ {
+ pm.getProcessByID(procID);
+ fail("A terminated process is removed from the registry");
+ }
+ catch (RuntimeException ex)
+ {
+ // expected
+ }
+ }
+
+ private Process getProcess()
+ {
+ ProcessBuilder builder = ProcessBuilderFactory.newInstance().newProcessBuilder();
+ Process proc = builder.addProcess(getName()).addStartEvent().addSequenceFlow("taskA").
+ addTask("taskA").addSequenceFlow("end").addEndEvent("end").getProcess();
+ return proc;
+ }
+}
Property changes on: jbossbpm/spec/trunk/modules/testsuite/src/test/java/org/jboss/bpm/cts/processmanager/ProcessRegistryTest.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Modified: jbossbpm/spec/trunk/modules/testsuite/src/test/java/org/jboss/bpm/samples/sequence/BasicSequenceTest.java
===================================================================
--- jbossbpm/spec/trunk/modules/testsuite/src/test/java/org/jboss/bpm/samples/sequence/BasicSequenceTest.java 2008-07-30 19:52:06 UTC (rev 1785)
+++ jbossbpm/spec/trunk/modules/testsuite/src/test/java/org/jboss/bpm/samples/sequence/BasicSequenceTest.java 2008-07-31 07:40:59 UTC (rev 1786)
@@ -33,7 +33,6 @@
import org.jboss.bpm.model.ProcessBuilder;
import org.jboss.bpm.model.ProcessBuilderFactory;
import org.jboss.bpm.model.Signal;
-import org.jboss.bpm.model.Task.TaskType;
import org.jboss.bpm.test.DefaultEngineTestCase;
/**
@@ -73,7 +72,7 @@
{
// Create a Process through the ProcessBuilder
ProcessBuilder procBuilder = ProcessBuilderFactory.newInstance().newProcessBuilder();
- Process proc = procBuilder.addProcess(getName()).addStartEvent().addSequenceFlow("stateA").addTask("stateA", TaskType.None).
+ Process proc = procBuilder.addProcess(getName()).addStartEvent().addSequenceFlow("stateA").addTask("stateA").
addSequenceFlow("end").addEndEvent("end").getProcess();
runProcess(proc);
Modified: jbossbpm/spec/trunk/modules/testsuite/src/test/java/org/jboss/bpm/samples/task/BasicTaskTest.java
===================================================================
--- jbossbpm/spec/trunk/modules/testsuite/src/test/java/org/jboss/bpm/samples/task/BasicTaskTest.java 2008-07-30 19:52:06 UTC (rev 1785)
+++ jbossbpm/spec/trunk/modules/testsuite/src/test/java/org/jboss/bpm/samples/task/BasicTaskTest.java 2008-07-31 07:40:59 UTC (rev 1786)
@@ -33,7 +33,6 @@
import org.jboss.bpm.model.ProcessBuilder;
import org.jboss.bpm.model.ProcessBuilderFactory;
import org.jboss.bpm.model.Signal;
-import org.jboss.bpm.model.Task.TaskType;
import org.jboss.bpm.test.DefaultEngineTestCase;
/**
@@ -73,7 +72,7 @@
{
// Create a Process through the ProcessBuilder
ProcessBuilder procBuilder = ProcessBuilderFactory.newInstance().newProcessBuilder();
- Process proc = procBuilder.addProcess(getName()).addStartEvent().addSequenceFlow("stateA").addTask("stateA", TaskType.None).
+ Process proc = procBuilder.addProcess(getName()).addStartEvent().addSequenceFlow("stateA").addTask("stateA").
addExecutionHandler(TaskA.class).addSequenceFlow("end").addEndEvent("end").getProcess();
runProcess(proc);
Copied: jbossbpm/spec/trunk/modules/testsuite/src/test/resources/cts/engine (from rev 1785, jbossbpm/spec/trunk/modules/testsuite/src/test/resources/samples/engine)
Modified: jbossbpm/spec/trunk/modules/testsuite/src/test/resources/cts/engine/basic-engine-api10.xml
===================================================================
--- jbossbpm/spec/trunk/modules/testsuite/src/test/resources/samples/engine/basic-engine-api10.xml 2008-07-30 19:52:06 UTC (rev 1785)
+++ jbossbpm/spec/trunk/modules/testsuite/src/test/resources/cts/engine/basic-engine-api10.xml 2008-07-31 07:40:59 UTC (rev 1786)
@@ -1,4 +1,4 @@
-<ns2:process name="basic-engine" xmlns:ns2="urn:api.bpm.jboss:jpdl-0.1">
+<ns2:process name="basic-engine" xmlns:ns2="urn:bpm.jboss:pdl-0.1">
<start>
<sequence to="stateA" />
</start>
Modified: jbossbpm/spec/trunk/modules/testsuite/src/test/resources/jbpm-beans.xml
===================================================================
--- jbossbpm/spec/trunk/modules/testsuite/src/test/resources/jbpm-beans.xml 2008-07-30 19:52:06 UTC (rev 1785)
+++ jbossbpm/spec/trunk/modules/testsuite/src/test/resources/jbpm-beans.xml 2008-07-31 07:40:59 UTC (rev 1786)
@@ -42,7 +42,7 @@
<bean name="jBPMDialectRegistry" class="org.jboss.bpm.client.DialectRegistry">
<property name="registry">
<map keyClass="java.lang.String" valueClass="java.lang.String">
- <entry><key>urn:api.bpm.jboss:jpdl-0.1</key><value>api10</value></entry>
+ <entry><key>urn:bpm.jboss:pdl-0.1</key><value>api10</value></entry>
<entry><key>urn:jbpm.org:jpdl-3.2</key><value>jpdl32</value></entry>
<entry><key>http://stp.eclipse.org/bpmn</key><value>stp</value></entry>
<entry><key>http://www.wfmc.org/2008/XPDL2.1</key><value>xpdl21</value></entry>
Modified: jbossbpm/spec/trunk/modules/testsuite/src/test/resources/samples/parallelsplit/parallel-split-api10.xml
===================================================================
--- jbossbpm/spec/trunk/modules/testsuite/src/test/resources/samples/parallelsplit/parallel-split-api10.xml 2008-07-30 19:52:06 UTC (rev 1785)
+++ jbossbpm/spec/trunk/modules/testsuite/src/test/resources/samples/parallelsplit/parallel-split-api10.xml 2008-07-31 07:40:59 UTC (rev 1786)
@@ -1,4 +1,4 @@
-<ns2:process name="testParallelSplit" xmlns:ns2="urn:api.bpm.jboss:jpdl-0.1">
+<ns2:process name="testParallelSplit" xmlns:ns2="urn:bpm.jboss:pdl-0.1">
<start>
<sequence to="gateway" />
</start>
Modified: jbossbpm/spec/trunk/modules/testsuite/src/test/resources/samples/sequence/basic-sequence-api10.xml
===================================================================
--- jbossbpm/spec/trunk/modules/testsuite/src/test/resources/samples/sequence/basic-sequence-api10.xml 2008-07-30 19:52:06 UTC (rev 1785)
+++ jbossbpm/spec/trunk/modules/testsuite/src/test/resources/samples/sequence/basic-sequence-api10.xml 2008-07-31 07:40:59 UTC (rev 1786)
@@ -1,4 +1,4 @@
-<ns2:process name="testBasicSequence" xmlns:ns2="urn:api.bpm.jboss:jpdl-0.1">
+<ns2:process name="testBasicSequence" xmlns:ns2="urn:bpm.jboss:pdl-0.1">
<start>
<sequence to="stateA" />
</start>
Modified: jbossbpm/spec/trunk/modules/testsuite/src/test/resources/samples/task/basic-task-api10.xml
===================================================================
--- jbossbpm/spec/trunk/modules/testsuite/src/test/resources/samples/task/basic-task-api10.xml 2008-07-30 19:52:06 UTC (rev 1785)
+++ jbossbpm/spec/trunk/modules/testsuite/src/test/resources/samples/task/basic-task-api10.xml 2008-07-31 07:40:59 UTC (rev 1786)
@@ -1,4 +1,4 @@
-<ns2:process name="testBasicTask" xmlns:ns2="urn:api.bpm.jboss:jpdl-0.1">
+<ns2:process name="testBasicTask" xmlns:ns2="urn:bpm.jboss:pdl-0.1">
<start>
<sequence to="stateA" />
</start>
Modified: jbossbpm/spec/trunk/pom.xml
===================================================================
--- jbossbpm/spec/trunk/pom.xml 2008-07-30 19:52:06 UTC (rev 1785)
+++ jbossbpm/spec/trunk/pom.xml 2008-07-31 07:40:59 UTC (rev 1786)
@@ -32,8 +32,8 @@
<module>modules/api</module>
<module>modules/ri</module>
<module>modules/dialects</module>
+ <module>modules/testsuite</module>
<module>modules/samples/airticket</module>
- <module>modules/testsuite</module>
</modules>
<!-- Properties -->
15 years, 9 months
JBoss JBPM SVN: r1785 - jbossbpm/spec/trunk/modules/testsuite/src/test/java/org/jboss/bpm/cts/process.
by do-not-reply@jboss.org
Author: thomas.diesler(a)jboss.com
Date: 2008-07-30 15:52:06 -0400 (Wed, 30 Jul 2008)
New Revision: 1785
Added:
jbossbpm/spec/trunk/modules/testsuite/src/test/java/org/jboss/bpm/cts/process/ProcessStartTest.java
Log:
WIP
Added: jbossbpm/spec/trunk/modules/testsuite/src/test/java/org/jboss/bpm/cts/process/ProcessStartTest.java
===================================================================
--- jbossbpm/spec/trunk/modules/testsuite/src/test/java/org/jboss/bpm/cts/process/ProcessStartTest.java (rev 0)
+++ jbossbpm/spec/trunk/modules/testsuite/src/test/java/org/jboss/bpm/cts/process/ProcessStartTest.java 2008-07-30 19:52:06 UTC (rev 1785)
@@ -0,0 +1,73 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * 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.bpm.cts.process;
+
+// $Id$
+
+import javax.management.ObjectName;
+
+import org.jboss.bpm.model.Process;
+import org.jboss.bpm.model.ProcessBuilder;
+import org.jboss.bpm.model.ProcessBuilderFactory;
+import org.jboss.bpm.model.Task.TaskType;
+import org.jboss.bpm.test.DefaultEngineTestCase;
+
+/**
+ * Test the process start opertaions
+ *
+ * @author thomas.diesler(a)jboss.com
+ * @since 08-Jul-2008
+ */
+public class ProcessStartTest extends DefaultEngineTestCase
+{
+ public void testStartProcessReturn() throws Exception
+ {
+ Process proc = getProcess();
+ ObjectName procID = proc.getID();
+ assertEquals(procID, proc.startProcess());
+ }
+
+ public void testStartTwice() throws Exception
+ {
+ Process proc = getProcess();
+ ObjectName procID = proc.getID();
+ assertEquals(procID, proc.startProcess());
+
+ try
+ {
+ proc.startProcess();
+ fail("Cannot start process twice");
+ }
+ catch (RuntimeException rte)
+ {
+ System.out.println(rte);
+ }
+ }
+
+ private Process getProcess()
+ {
+ ProcessBuilder builder = ProcessBuilderFactory.newInstance().newProcessBuilder();
+ Process proc = builder.addProcess(getName()).addStartEvent().addSequenceFlow("taskA").addTask("taskA",
+ TaskType.None).addSequenceFlow("end").addEndEvent("end").getProcess();
+ return proc;
+ }
+}
Property changes on: jbossbpm/spec/trunk/modules/testsuite/src/test/java/org/jboss/bpm/cts/process/ProcessStartTest.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
15 years, 9 months
JBoss JBPM SVN: r1784 - in jbossbpm/spec/trunk/modules/api/src/main/java/org/jboss/bpm: model and 1 other directory.
by do-not-reply@jboss.org
Author: thomas.diesler(a)jboss.com
Date: 2008-07-30 15:51:36 -0400 (Wed, 30 Jul 2008)
New Revision: 1784
Modified:
jbossbpm/spec/trunk/modules/api/src/main/java/org/jboss/bpm/client/ProcessManager.java
jbossbpm/spec/trunk/modules/api/src/main/java/org/jboss/bpm/model/ProcessBuilder.java
Log:
WIP
Modified: jbossbpm/spec/trunk/modules/api/src/main/java/org/jboss/bpm/client/ProcessManager.java
===================================================================
--- jbossbpm/spec/trunk/modules/api/src/main/java/org/jboss/bpm/client/ProcessManager.java 2008-07-30 19:51:30 UTC (rev 1783)
+++ jbossbpm/spec/trunk/modules/api/src/main/java/org/jboss/bpm/client/ProcessManager.java 2008-07-30 19:51:36 UTC (rev 1784)
@@ -146,8 +146,6 @@
/**
* Get a Process for a given id
- *
- * @throws
*/
public Process getProcessByID(ObjectName id)
{
@@ -164,9 +162,9 @@
/**
* Register a Process
*/
- public final boolean registerProcess(Process proc)
+ protected void registerProcess(Process proc)
{
- return procs.add(proc);
+ procs.add(proc);
}
/**
Modified: jbossbpm/spec/trunk/modules/api/src/main/java/org/jboss/bpm/model/ProcessBuilder.java
===================================================================
--- jbossbpm/spec/trunk/modules/api/src/main/java/org/jboss/bpm/model/ProcessBuilder.java 2008-07-30 19:51:30 UTC (rev 1783)
+++ jbossbpm/spec/trunk/modules/api/src/main/java/org/jboss/bpm/model/ProcessBuilder.java 2008-07-30 19:51:36 UTC (rev 1784)
@@ -79,8 +79,6 @@
/**
* Add a {@link Task} with a given name
- *
- * @param type TODO
*/
TaskBuilder addTask(String name, TaskType type);
15 years, 9 months
JBoss JBPM SVN: r1783 - jbossbpm/spec/trunk/modules/samples/airticket/server/src/main/java/org/jboss/bpm/samples/airticket.
by do-not-reply@jboss.org
Author: thomas.diesler(a)jboss.com
Date: 2008-07-30 15:51:30 -0400 (Wed, 30 Jul 2008)
New Revision: 1783
Modified:
jbossbpm/spec/trunk/modules/samples/airticket/server/src/main/java/org/jboss/bpm/samples/airticket/AirticketProcessBuilder.java
Log:
WIP
Modified: jbossbpm/spec/trunk/modules/samples/airticket/server/src/main/java/org/jboss/bpm/samples/airticket/AirticketProcessBuilder.java
===================================================================
--- jbossbpm/spec/trunk/modules/samples/airticket/server/src/main/java/org/jboss/bpm/samples/airticket/AirticketProcessBuilder.java 2008-07-30 19:51:25 UTC (rev 1782)
+++ jbossbpm/spec/trunk/modules/samples/airticket/server/src/main/java/org/jboss/bpm/samples/airticket/AirticketProcessBuilder.java 2008-07-30 19:51:30 UTC (rev 1783)
@@ -25,7 +25,6 @@
import javax.management.ObjectName;
-import org.jboss.bpm.client.ProcessManager;
import org.jboss.bpm.model.GatewayBuilder;
import org.jboss.bpm.model.Process;
import org.jboss.bpm.model.ProcessBuilder;
@@ -187,8 +186,6 @@
// Add the EndEvent
Process proc = procBuilder.addEndEvent("End").getProcess();
- ProcessManager pm = ProcessManager.locateProcessManager();
- pm.registerProcess(proc);
return proc;
}
}
\ No newline at end of file
15 years, 9 months
JBoss JBPM SVN: r1782 - in jbossbpm/spec/trunk/modules/testsuite/src/test/java/org/jboss/bpm: cts and 6 other directories.
by do-not-reply@jboss.org
Author: thomas.diesler(a)jboss.com
Date: 2008-07-30 15:51:25 -0400 (Wed, 30 Jul 2008)
New Revision: 1782
Added:
jbossbpm/spec/trunk/modules/testsuite/src/test/java/org/jboss/bpm/cts/
jbossbpm/spec/trunk/modules/testsuite/src/test/java/org/jboss/bpm/cts/engine/
jbossbpm/spec/trunk/modules/testsuite/src/test/java/org/jboss/bpm/cts/engine/EngineShutdownTest.java
jbossbpm/spec/trunk/modules/testsuite/src/test/java/org/jboss/bpm/cts/process/
jbossbpm/spec/trunk/modules/testsuite/src/test/java/org/jboss/bpm/cts/process/ProcessIntegrityTest.java
Removed:
jbossbpm/spec/trunk/modules/testsuite/src/test/java/org/jboss/bpm/client/
jbossbpm/spec/trunk/modules/testsuite/src/test/java/org/jboss/bpm/model/
jbossbpm/spec/trunk/modules/testsuite/src/test/java/org/jboss/bpm/samples/engine/
Modified:
jbossbpm/spec/trunk/modules/testsuite/src/test/java/org/jboss/bpm/samples/parallelsplit/ParallelSplitTest.java
jbossbpm/spec/trunk/modules/testsuite/src/test/java/org/jboss/bpm/samples/sequence/BasicSequenceTest.java
jbossbpm/spec/trunk/modules/testsuite/src/test/java/org/jboss/bpm/samples/task/BasicTaskTest.java
Log:
WIP
Copied: jbossbpm/spec/trunk/modules/testsuite/src/test/java/org/jboss/bpm/cts/engine/EngineShutdownTest.java (from rev 1775, jbossbpm/spec/trunk/modules/testsuite/src/test/java/org/jboss/bpm/samples/engine/EngineShutdownTest.java)
===================================================================
--- jbossbpm/spec/trunk/modules/testsuite/src/test/java/org/jboss/bpm/cts/engine/EngineShutdownTest.java (rev 0)
+++ jbossbpm/spec/trunk/modules/testsuite/src/test/java/org/jboss/bpm/cts/engine/EngineShutdownTest.java 2008-07-30 19:51:25 UTC (rev 1782)
@@ -0,0 +1,75 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * 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.bpm.cts.engine;
+
+// $Id$
+
+import java.net.URL;
+
+import org.jboss.bpm.EngineShutdownException;
+import org.jboss.bpm.client.ProcessEngine;
+import org.jboss.bpm.client.ProcessEngineLocator;
+import org.jboss.bpm.client.ProcessManager;
+import org.jboss.bpm.test.DefaultEngineTestCase;
+
+/**
+ * Test the engine shutdown
+ *
+ * @author thomas.diesler(a)jboss.com
+ * @since 03-Jul-2008
+ */
+public class EngineShutdownTest extends DefaultEngineTestCase
+{
+ private ProcessEngine engine;
+
+ private URL jpdlURL;
+
+ @Override
+ protected void setUp() throws Exception
+ {
+ super.setUp();
+ jpdlURL = getResourceURL("samples/engine/basic-engine-" + getDialect() + ".xml");
+ engine = ProcessEngineLocator.locateProcessEngine();
+ engine.cancelShutdown();
+ }
+
+ /**
+ * Try to create a Process during shutdown
+ */
+ public void testCreateProcess() throws Exception
+ {
+ // Create a Process through the ProcessManager
+ ProcessManager pm = ProcessManager.locateProcessManager();
+ assertNotNull("Process expected", pm.createProcess(jpdlURL));
+
+ // Try to create a Process during shutdown
+ try
+ {
+ engine.prepareForShutdown();
+ pm.createProcess(jpdlURL);
+ }
+ catch (EngineShutdownException ex)
+ {
+ assertEquals("Cannot create new Process while engine is shutting down", ex.getMessage());
+ }
+ }
+}
Copied: jbossbpm/spec/trunk/modules/testsuite/src/test/java/org/jboss/bpm/cts/process/ProcessIntegrityTest.java (from rev 1775, jbossbpm/spec/trunk/modules/testsuite/src/test/java/org/jboss/bpm/model/ProcessIntegrityTest.java)
===================================================================
--- jbossbpm/spec/trunk/modules/testsuite/src/test/java/org/jboss/bpm/cts/process/ProcessIntegrityTest.java (rev 0)
+++ jbossbpm/spec/trunk/modules/testsuite/src/test/java/org/jboss/bpm/cts/process/ProcessIntegrityTest.java 2008-07-30 19:51:25 UTC (rev 1782)
@@ -0,0 +1,112 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * 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.bpm.cts.process;
+
+// $Id$
+
+import java.util.List;
+
+import org.jboss.bpm.InvalidProcessException;
+import org.jboss.bpm.model.EndEvent;
+import org.jboss.bpm.model.FlowObject;
+import org.jboss.bpm.model.Process;
+import org.jboss.bpm.model.ProcessBuilder;
+import org.jboss.bpm.model.ProcessBuilderFactory;
+import org.jboss.bpm.model.StartEvent;
+import org.jboss.bpm.model.Task;
+import org.jboss.bpm.model.Task.TaskType;
+import org.jboss.bpm.test.DefaultEngineTestCase;
+
+/**
+ * Test the intergety of various process definitions
+ *
+ * @author thomas.diesler(a)jboss.com
+ * @since 08-Jul-2008
+ */
+public class ProcessIntegrityTest extends DefaultEngineTestCase
+{
+ public void testAnonymousProcess() throws Exception
+ {
+ // Create a Process through the ProcessBuilder
+ ProcessBuilder builder = ProcessBuilderFactory.newInstance().newProcessBuilder();
+ Process proc = builder.addProcess(null).addStartEvent().addSequenceFlow("taskA").addTask("taskA", TaskType.None).
+ addSequenceFlow("end").addEndEvent("end").getProcess();
+ assertEquals("AnonymousProcess#0", proc.getName());
+
+ StartEvent start = proc.getStartEvent();
+ assertNotNull("Start expected", start);
+
+ FlowObject nfo = proc.findFlowObject("taskA");
+ assertNotNull("FlowObject expected", nfo);
+ assertTrue("Task expected", nfo instanceof Task);
+
+ List<EndEvent> ends = proc.getEndEvents();
+ assertEquals(1, ends.size());
+ }
+
+ public void testNoStartState() throws Exception
+ {
+ try
+ {
+ // Create a Process through the ProcessBuilder
+ ProcessBuilder builder = ProcessBuilderFactory.newInstance().newProcessBuilder();
+ builder.addProcess(null).addTask("taskA", TaskType.None).addSequenceFlow("end").addEndEvent("end").getProcess();
+ fail("InvalidProcessException expected");
+ }
+ catch (InvalidProcessException ex)
+ {
+ assertTrue("Unexpected message: " + ex.getMessage(), ex.getMessage().indexOf("start event") > 0);
+ }
+ }
+
+ public void testNoEndState() throws Exception
+ {
+ try
+ {
+ // Create a Process through the ProcessBuilder
+ ProcessBuilder builder = ProcessBuilderFactory.newInstance().newProcessBuilder();
+ builder.addProcess(null).addStartEvent().addSequenceFlow("taskA").addTask("taskA", TaskType.None).addSequenceFlow("end").addTask(
+ "end", TaskType.None).getProcess();
+ fail("InvalidProcessException expected");
+ }
+ catch (InvalidProcessException ex)
+ {
+ assertTrue("Unexpected message: " + ex.getMessage(), ex.getMessage().indexOf("end event") > 0);
+ }
+ }
+
+ public void testNodeNameUniqueness() throws Exception
+ {
+ try
+ {
+ // Create a Process through the ProcessBuilder
+ ProcessBuilder builder = ProcessBuilderFactory.newInstance().newProcessBuilder();
+ builder.addProcess(null).addStartEvent().addSequenceFlow("taskA").addTask("taskA", TaskType.None).addSequenceFlow("end").addTask(
+ "taskA", TaskType.None).addSequenceFlow("end").addEndEvent("end").getProcess();
+ fail("InvalidProcessException expected");
+ }
+ catch (InvalidProcessException ex)
+ {
+ // expected;
+ }
+ }
+}
Modified: jbossbpm/spec/trunk/modules/testsuite/src/test/java/org/jboss/bpm/samples/parallelsplit/ParallelSplitTest.java
===================================================================
--- jbossbpm/spec/trunk/modules/testsuite/src/test/java/org/jboss/bpm/samples/parallelsplit/ParallelSplitTest.java 2008-07-30 19:51:16 UTC (rev 1781)
+++ jbossbpm/spec/trunk/modules/testsuite/src/test/java/org/jboss/bpm/samples/parallelsplit/ParallelSplitTest.java 2008-07-30 19:51:25 UTC (rev 1782)
@@ -75,10 +75,6 @@
Process proc = procBuilder.addProcess(getName()).addStartEvent().addSequenceFlow("gateway").addGateway("gateway", GatewayType.Parallel).
addSequenceFlow("endA").addSequenceFlow("endB").addEndEvent("endA").addEndEvent("endB").getProcess();
- // Register the Process with the ProcessManager
- ProcessManager pm = ProcessManager.locateProcessManager();
- pm.registerProcess(proc);
-
runProcess(proc);
}
Modified: jbossbpm/spec/trunk/modules/testsuite/src/test/java/org/jboss/bpm/samples/sequence/BasicSequenceTest.java
===================================================================
--- jbossbpm/spec/trunk/modules/testsuite/src/test/java/org/jboss/bpm/samples/sequence/BasicSequenceTest.java 2008-07-30 19:51:16 UTC (rev 1781)
+++ jbossbpm/spec/trunk/modules/testsuite/src/test/java/org/jboss/bpm/samples/sequence/BasicSequenceTest.java 2008-07-30 19:51:25 UTC (rev 1782)
@@ -76,10 +76,6 @@
Process proc = procBuilder.addProcess(getName()).addStartEvent().addSequenceFlow("stateA").addTask("stateA", TaskType.None).
addSequenceFlow("end").addEndEvent("end").getProcess();
- // Register the Process with the ProcessManager
- ProcessManager pm = ProcessManager.locateProcessManager();
- pm.registerProcess(proc);
-
runProcess(proc);
}
Modified: jbossbpm/spec/trunk/modules/testsuite/src/test/java/org/jboss/bpm/samples/task/BasicTaskTest.java
===================================================================
--- jbossbpm/spec/trunk/modules/testsuite/src/test/java/org/jboss/bpm/samples/task/BasicTaskTest.java 2008-07-30 19:51:16 UTC (rev 1781)
+++ jbossbpm/spec/trunk/modules/testsuite/src/test/java/org/jboss/bpm/samples/task/BasicTaskTest.java 2008-07-30 19:51:25 UTC (rev 1782)
@@ -76,10 +76,6 @@
Process proc = procBuilder.addProcess(getName()).addStartEvent().addSequenceFlow("stateA").addTask("stateA", TaskType.None).
addExecutionHandler(TaskA.class).addSequenceFlow("end").addEndEvent("end").getProcess();
- // Register the Process with the ProcessManager
- ProcessManager pm = ProcessManager.locateProcessManager();
- pm.registerProcess(proc);
-
runProcess(proc);
}
15 years, 9 months
JBoss JBPM SVN: r1781 - jbossbpm/spec/trunk/modules/ri/src/main/java/org/jboss/bpm/client/internal.
by do-not-reply@jboss.org
Author: thomas.diesler(a)jboss.com
Date: 2008-07-30 15:51:16 -0400 (Wed, 30 Jul 2008)
New Revision: 1781
Modified:
jbossbpm/spec/trunk/modules/ri/src/main/java/org/jboss/bpm/client/internal/ProcessManagerImpl.java
Log:
WIP
Modified: jbossbpm/spec/trunk/modules/ri/src/main/java/org/jboss/bpm/client/internal/ProcessManagerImpl.java
===================================================================
--- jbossbpm/spec/trunk/modules/ri/src/main/java/org/jboss/bpm/client/internal/ProcessManagerImpl.java 2008-07-30 19:25:47 UTC (rev 1780)
+++ jbossbpm/spec/trunk/modules/ri/src/main/java/org/jboss/bpm/client/internal/ProcessManagerImpl.java 2008-07-30 19:51:16 UTC (rev 1781)
@@ -34,7 +34,6 @@
import org.jboss.bpm.client.ProcessManager;
import org.jboss.bpm.model.Process;
import org.jboss.bpm.model.Process.Status;
-import org.jboss.bpm.model.internal.ProcessImpl;
import org.jboss.bpm.runtime.Attachments;
/**
@@ -63,8 +62,13 @@
if (procSet.size() > 1)
throw new IllegalStateException("Multiple processes with name: " + name);
- // Copy and register a copy of the process instance
- ProcessImpl proc = (ProcessImpl)procSet.iterator().next();
+ Process proc = procSet.iterator().next();
+ return startProcess(proc, att);
+ }
+
+ private ObjectName startProcess(Process proc, Attachments att)
+ {
+ // Register a copy the process instance
registerProcess(proc.copyProcess());
// Start the process in a thread
15 years, 9 months
JBoss JBPM SVN: r1780 - jbossbpm/spec/trunk/modules/samples/airticket/server/src/main/java/org/jboss/bpm/samples/airticket/client.
by do-not-reply@jboss.org
Author: thomas.diesler(a)jboss.com
Date: 2008-07-30 15:25:47 -0400 (Wed, 30 Jul 2008)
New Revision: 1780
Modified:
jbossbpm/spec/trunk/modules/samples/airticket/server/src/main/java/org/jboss/bpm/samples/airticket/client/ConfirmMessage.java
jbossbpm/spec/trunk/modules/samples/airticket/server/src/main/java/org/jboss/bpm/samples/airticket/client/GwtMessage.java
jbossbpm/spec/trunk/modules/samples/airticket/server/src/main/java/org/jboss/bpm/samples/airticket/client/InvalidDataMessage.java
jbossbpm/spec/trunk/modules/samples/airticket/server/src/main/java/org/jboss/bpm/samples/airticket/client/NotAvailableMessage.java
jbossbpm/spec/trunk/modules/samples/airticket/server/src/main/java/org/jboss/bpm/samples/airticket/client/OfferMessage.java
jbossbpm/spec/trunk/modules/samples/airticket/server/src/main/java/org/jboss/bpm/samples/airticket/client/OrderMessage.java
jbossbpm/spec/trunk/modules/samples/airticket/server/src/main/java/org/jboss/bpm/samples/airticket/client/RequestMessage.java
Log:
Fix serialVersionID
Modified: jbossbpm/spec/trunk/modules/samples/airticket/server/src/main/java/org/jboss/bpm/samples/airticket/client/ConfirmMessage.java
===================================================================
--- jbossbpm/spec/trunk/modules/samples/airticket/server/src/main/java/org/jboss/bpm/samples/airticket/client/ConfirmMessage.java 2008-07-30 19:18:52 UTC (rev 1779)
+++ jbossbpm/spec/trunk/modules/samples/airticket/server/src/main/java/org/jboss/bpm/samples/airticket/client/ConfirmMessage.java 2008-07-30 19:25:47 UTC (rev 1780)
@@ -25,5 +25,7 @@
public class ConfirmMessage extends GwtMessage
{
+ private static final long serialVersionUID = 1L;
+
public String price;
}
\ No newline at end of file
Modified: jbossbpm/spec/trunk/modules/samples/airticket/server/src/main/java/org/jboss/bpm/samples/airticket/client/GwtMessage.java
===================================================================
--- jbossbpm/spec/trunk/modules/samples/airticket/server/src/main/java/org/jboss/bpm/samples/airticket/client/GwtMessage.java 2008-07-30 19:18:52 UTC (rev 1779)
+++ jbossbpm/spec/trunk/modules/samples/airticket/server/src/main/java/org/jboss/bpm/samples/airticket/client/GwtMessage.java 2008-07-30 19:25:47 UTC (rev 1780)
@@ -27,6 +27,8 @@
public class GwtMessage implements Serializable
{
+ private static final long serialVersionUID = 1L;
+
public String name;
public String from;
public String to;
Modified: jbossbpm/spec/trunk/modules/samples/airticket/server/src/main/java/org/jboss/bpm/samples/airticket/client/InvalidDataMessage.java
===================================================================
--- jbossbpm/spec/trunk/modules/samples/airticket/server/src/main/java/org/jboss/bpm/samples/airticket/client/InvalidDataMessage.java 2008-07-30 19:18:52 UTC (rev 1779)
+++ jbossbpm/spec/trunk/modules/samples/airticket/server/src/main/java/org/jboss/bpm/samples/airticket/client/InvalidDataMessage.java 2008-07-30 19:25:47 UTC (rev 1780)
@@ -25,4 +25,6 @@
public class InvalidDataMessage extends GwtMessage
{
+ private static final long serialVersionUID = 1L;
+
}
\ No newline at end of file
Modified: jbossbpm/spec/trunk/modules/samples/airticket/server/src/main/java/org/jboss/bpm/samples/airticket/client/NotAvailableMessage.java
===================================================================
--- jbossbpm/spec/trunk/modules/samples/airticket/server/src/main/java/org/jboss/bpm/samples/airticket/client/NotAvailableMessage.java 2008-07-30 19:18:52 UTC (rev 1779)
+++ jbossbpm/spec/trunk/modules/samples/airticket/server/src/main/java/org/jboss/bpm/samples/airticket/client/NotAvailableMessage.java 2008-07-30 19:25:47 UTC (rev 1780)
@@ -25,4 +25,6 @@
public class NotAvailableMessage extends GwtMessage
{
+ private static final long serialVersionUID = 1L;
+
}
\ No newline at end of file
Modified: jbossbpm/spec/trunk/modules/samples/airticket/server/src/main/java/org/jboss/bpm/samples/airticket/client/OfferMessage.java
===================================================================
--- jbossbpm/spec/trunk/modules/samples/airticket/server/src/main/java/org/jboss/bpm/samples/airticket/client/OfferMessage.java 2008-07-30 19:18:52 UTC (rev 1779)
+++ jbossbpm/spec/trunk/modules/samples/airticket/server/src/main/java/org/jboss/bpm/samples/airticket/client/OfferMessage.java 2008-07-30 19:25:47 UTC (rev 1780)
@@ -25,5 +25,7 @@
public class OfferMessage extends GwtMessage
{
+ private static final long serialVersionUID = 1L;
+
public String price;
}
\ No newline at end of file
Modified: jbossbpm/spec/trunk/modules/samples/airticket/server/src/main/java/org/jboss/bpm/samples/airticket/client/OrderMessage.java
===================================================================
--- jbossbpm/spec/trunk/modules/samples/airticket/server/src/main/java/org/jboss/bpm/samples/airticket/client/OrderMessage.java 2008-07-30 19:18:52 UTC (rev 1779)
+++ jbossbpm/spec/trunk/modules/samples/airticket/server/src/main/java/org/jboss/bpm/samples/airticket/client/OrderMessage.java 2008-07-30 19:25:47 UTC (rev 1780)
@@ -25,6 +25,8 @@
public class OrderMessage extends GwtMessage
{
+ private static final long serialVersionUID = 1L;
+
public String creditCard;
public String expire;
public boolean acceptOffer;
Modified: jbossbpm/spec/trunk/modules/samples/airticket/server/src/main/java/org/jboss/bpm/samples/airticket/client/RequestMessage.java
===================================================================
--- jbossbpm/spec/trunk/modules/samples/airticket/server/src/main/java/org/jboss/bpm/samples/airticket/client/RequestMessage.java 2008-07-30 19:18:52 UTC (rev 1779)
+++ jbossbpm/spec/trunk/modules/samples/airticket/server/src/main/java/org/jboss/bpm/samples/airticket/client/RequestMessage.java 2008-07-30 19:25:47 UTC (rev 1780)
@@ -25,9 +25,5 @@
public class RequestMessage extends GwtMessage
{
- public String name;
- public String from;
- public String to;
- public String date;
- public String seats;
+ private static final long serialVersionUID = 1L;
}
\ No newline at end of file
15 years, 9 months
JBoss JBPM SVN: r1779 - in jbossbpm/spec/trunk/modules/samples/airticket/client: src/main/java/org/jboss/bpm/samples/airticket/client and 1 other directories.
by do-not-reply@jboss.org
Author: thomas.diesler(a)jboss.com
Date: 2008-07-30 15:18:52 -0400 (Wed, 30 Jul 2008)
New Revision: 1779
Modified:
jbossbpm/spec/trunk/modules/samples/airticket/client/pom.xml
jbossbpm/spec/trunk/modules/samples/airticket/client/src/main/java/org/jboss/bpm/samples/airticket/client/Application.java
jbossbpm/spec/trunk/modules/samples/airticket/client/src/main/resources/org/jboss/bpm/samples/airticket/public/Application.html
Log:
GWT App ok
Modified: jbossbpm/spec/trunk/modules/samples/airticket/client/pom.xml
===================================================================
--- jbossbpm/spec/trunk/modules/samples/airticket/client/pom.xml 2008-07-30 19:18:44 UTC (rev 1778)
+++ jbossbpm/spec/trunk/modules/samples/airticket/client/pom.xml 2008-07-30 19:18:52 UTC (rev 1779)
@@ -1,5 +1,18 @@
<?xml version="1.0" encoding="UTF-8"?>
-<project>
+
+<!-- ====================================================================== -->
+<!-- -->
+<!-- JBoss, the OpenSource J2EE webOS -->
+<!-- -->
+<!-- Distributable under LGPL license. -->
+<!-- See terms of license at http://www.gnu.org. -->
+<!-- -->
+<!-- ====================================================================== -->
+
+<!-- $Id$
+-->
+<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>
<name>JBossBPM - Spec Samples Airticket (Client)</name>
<groupId>org.jboss.bpm</groupId>
Modified: jbossbpm/spec/trunk/modules/samples/airticket/client/src/main/java/org/jboss/bpm/samples/airticket/client/Application.java
===================================================================
--- jbossbpm/spec/trunk/modules/samples/airticket/client/src/main/java/org/jboss/bpm/samples/airticket/client/Application.java 2008-07-30 19:18:44 UTC (rev 1778)
+++ jbossbpm/spec/trunk/modules/samples/airticket/client/src/main/java/org/jboss/bpm/samples/airticket/client/Application.java 2008-07-30 19:18:52 UTC (rev 1779)
@@ -5,9 +5,13 @@
import com.google.gwt.user.client.rpc.AsyncCallback;
import com.google.gwt.user.client.rpc.ServiceDefTarget;
import com.google.gwt.user.client.ui.Button;
+import com.google.gwt.user.client.ui.CheckBox;
import com.google.gwt.user.client.ui.ClickListener;
+import com.google.gwt.user.client.ui.DockPanel;
+import com.google.gwt.user.client.ui.Grid;
import com.google.gwt.user.client.ui.Image;
import com.google.gwt.user.client.ui.Label;
+import com.google.gwt.user.client.ui.Panel;
import com.google.gwt.user.client.ui.RootPanel;
import com.google.gwt.user.client.ui.TextBox;
import com.google.gwt.user.client.ui.Widget;
@@ -17,101 +21,258 @@
*/
public class Application implements EntryPoint
{
- private Button buttonSubmit = new Button("Submit");
- private Button buttonPull = new Button("Pull");
+ private AirticketServiceAsync sampleRemoteService;
private Label labelMessage = new Label();
- private Label labelState = new Label("SendRequest");
private Label labelName = new Label("Name:");
private Label labelFrom = new Label("From:");
private Label labelTo = new Label("To:");
private Label labelDate = new Label("Date:");
private Label labelSeats = new Label("Seats:");
+ private Label labelPrice = new Label("Price:");
+ private Label labelCreditCard = new Label("CreditCard:");
+ private Label labelExpire = new Label("Expire:");
+ private Label labelAccept = new Label("Accept:");
+ private Label labelNameRO = new Label();
+ private Label labelFromRO = new Label();
+ private Label labelToRO = new Label();
+ private Label labelDateRO = new Label();
+ private Label labelSeatsRO = new Label();
+ private Label labelPriceRO = new Label();
+
private TextBox textName = new TextBox();
private TextBox textFrom = new TextBox();
private TextBox textTo = new TextBox();
private TextBox textDate = new TextBox();
private TextBox textSeats = new TextBox();
-
+ private TextBox textCreditCard = new TextBox();
+ private TextBox textExpire = new TextBox();
+ private CheckBox checkAccept = new CheckBox();
+
+ private Button buttonSubmitRequest = new Button("Submit");
+ private Button buttonSubmitOrder = new Button("Submit");
+ private Button buttonSubmitConfirm = new Button("Submit");
+
/**
* This is the entry point method.
*/
public void onModuleLoad()
{
// image bundle
- final SampleImageBundle sampleImageBundle = (SampleImageBundle)GWT.create(SampleImageBundle.class);
- final Image logoImage = sampleImageBundle.getGWTLogo().createImage();
+ SampleImageBundle sampleImageBundle = (SampleImageBundle)GWT.create(SampleImageBundle.class);
+ Image logoImage = sampleImageBundle.getGWTLogo().createImage();
+ RootPanel.get("gwtLogo").add(logoImage);
- textName.setText("Kermit");
- textFrom.setText("MUC");
- textTo.setText("NYC");
- textDate.setText("30-Jul-2008");
- textSeats.setText("2");
+ sampleRemoteService = (AirticketServiceAsync)GWT.create(AirticketService.class);
+ ServiceDefTarget endpoint = (ServiceDefTarget)sampleRemoteService;
+ String moduleRelativeURL = GWT.getModuleBaseURL() + "airticketService";
+ endpoint.setServiceEntryPoint(moduleRelativeURL);
- setupSubmitListener();
+ buttonSubmitRequest.addClickListener(new MyClickListener());
+ buttonSubmitOrder.addClickListener(new MyClickListener());
+ buttonSubmitConfirm.addClickListener(new MyClickListener());
- RootPanel.get("bpmLogo").add(logoImage);
- RootPanel.get("labelMessage").add(labelMessage);
- RootPanel.get("labelState").add(labelState);
- RootPanel.get("labelName").add(labelName);
- RootPanel.get("labelFrom").add(labelFrom);
- RootPanel.get("labelTo").add(labelTo);
- RootPanel.get("labelDate").add(labelDate);
- RootPanel.get("labelSeats").add(labelSeats);
- RootPanel.get("textName").add(textName);
- RootPanel.get("textFrom").add(textFrom);
- RootPanel.get("textTo").add(textTo);
- RootPanel.get("textDate").add(textDate);
- RootPanel.get("textSeats").add(textSeats);
- RootPanel.get("buttonSubmit").add(buttonSubmit);
- RootPanel.get("buttonPull").add(buttonPull);
+ Panel panel = getRequestPanel();
+ RootPanel.get("gwtPanel").add(panel);
+ RootPanel.get("gwtMessage").add(labelMessage);
+
+ initRequestPanel(getDefaultData());
}
- private void setupSubmitListener()
+ private GwtMessage getDefaultData()
{
- buttonSubmit.addClickListener(new ClickListener()
+ GwtMessage gwtMsg = new GwtMessage();
+ gwtMsg.name = "Kermit";
+ gwtMsg.from = "MUC";
+ gwtMsg.to = "NYC";
+ gwtMsg.date = "30-Oct-2008";
+ gwtMsg.seats = "2";
+ return gwtMsg;
+ }
+
+ private Panel getRequestPanel()
+ {
+ DockPanel panel = new DockPanel();
+ Grid grid = new Grid(5, 2);
+ grid.setWidget(0, 0, labelName);
+ grid.setWidget(0, 1, textName);
+ grid.setWidget(1, 0, labelFrom);
+ grid.setWidget(1, 1, textFrom);
+ grid.setWidget(2, 0, labelTo);
+ grid.setWidget(2, 1, textTo);
+ grid.setWidget(3, 0, labelDate);
+ grid.setWidget(3, 1, textDate);
+ grid.setWidget(4, 0, labelSeats);
+ grid.setWidget(4, 1, textSeats);
+ panel.add(grid, DockPanel.CENTER);
+ panel.add(buttonSubmitRequest, DockPanel.SOUTH);
+ return panel;
+ }
+
+ private void initRequestPanel(GwtMessage gwtMsg)
+ {
+ textName.setText(gwtMsg.name);
+ textFrom.setText(gwtMsg.from);
+ textTo.setText(gwtMsg.to);
+ textDate.setText(gwtMsg.date);
+ textSeats.setText(gwtMsg.seats);
+ }
+
+ private Panel getOfferPanel()
+ {
+ DockPanel panel = new DockPanel();
+ Grid grid = new Grid(9, 2);
+ grid.setWidget(0, 0, labelName);
+ grid.setWidget(0, 1, labelNameRO);
+ grid.setWidget(1, 0, labelFrom);
+ grid.setWidget(1, 1, labelFromRO);
+ grid.setWidget(2, 0, labelTo);
+ grid.setWidget(2, 1, labelToRO);
+ grid.setWidget(3, 0, labelDate);
+ grid.setWidget(3, 1, labelDateRO);
+ grid.setWidget(4, 0, labelSeats);
+ grid.setWidget(4, 1, labelSeatsRO);
+ grid.setWidget(5, 0, labelPrice);
+ grid.setWidget(5, 1, labelPriceRO);
+ grid.setWidget(6, 0, labelCreditCard);
+ grid.setWidget(6, 1, textCreditCard);
+ grid.setWidget(7, 0, labelExpire);
+ grid.setWidget(7, 1, textExpire);
+ grid.setWidget(8, 0, labelAccept);
+ grid.setWidget(8, 1, checkAccept);
+ panel.add(grid, DockPanel.CENTER);
+ panel.add(buttonSubmitOrder, DockPanel.SOUTH);
+ return panel;
+ }
+
+ private void initOfferPanel(OfferMessage gwtMsg)
+ {
+ labelNameRO.setText(gwtMsg.name);
+ labelFromRO.setText(gwtMsg.from);
+ labelToRO.setText(gwtMsg.to);
+ labelDateRO.setText(gwtMsg.date);
+ labelSeatsRO.setText(gwtMsg.seats);
+ labelPriceRO.setText(gwtMsg.price);
+
+ textCreditCard.setText("1234-1234-1234-1234");
+ textExpire.setText("30-Jul-2012");
+ checkAccept.setChecked(true);
+ }
+
+ private Panel getConfirmPanel()
+ {
+ DockPanel panel = new DockPanel();
+ Grid grid = new Grid(6, 2);
+ grid.setWidget(0, 0, labelName);
+ grid.setWidget(0, 1, labelNameRO);
+ grid.setWidget(1, 0, labelFrom);
+ grid.setWidget(1, 1, labelFromRO);
+ grid.setWidget(2, 0, labelTo);
+ grid.setWidget(2, 1, labelToRO);
+ grid.setWidget(3, 0, labelDate);
+ grid.setWidget(3, 1, labelDateRO);
+ grid.setWidget(4, 0, labelSeats);
+ grid.setWidget(4, 1, labelSeatsRO);
+ grid.setWidget(5, 0, labelPrice);
+ grid.setWidget(5, 1, labelPriceRO);
+ panel.add(grid, DockPanel.CENTER);
+ panel.add(buttonSubmitConfirm, DockPanel.SOUTH);
+ return panel;
+ }
+
+ private void initConfirmPanel(ConfirmMessage gwtMsg)
+ {
+ labelNameRO.setText(gwtMsg.name);
+ labelFromRO.setText(gwtMsg.from);
+ labelToRO.setText(gwtMsg.to);
+ labelDateRO.setText(gwtMsg.date);
+ labelSeatsRO.setText(gwtMsg.seats);
+ labelPriceRO.setText(gwtMsg.price);
+ }
+
+ private void setVisiblePanel(Panel panel)
+ {
+ RootPanel.get("gwtPanel").remove(0);
+ RootPanel.get("gwtPanel").add(panel);
+ }
+
+ class MyClickListener implements ClickListener
+ {
+ public void onClick(Widget sender)
{
- public void onClick(Widget sender)
+ if (sender == buttonSubmitRequest)
{
- AirticketServiceAsync sampleRemoteService = (AirticketServiceAsync)GWT.create(AirticketService.class);
- ServiceDefTarget endpoint = (ServiceDefTarget)sampleRemoteService;
- String moduleRelativeURL = GWT.getModuleBaseURL() + "airticketService";
- endpoint.setServiceEntryPoint(moduleRelativeURL);
-
- final String state = labelState.getText();
- AsyncCallback callback = new AsyncCallback()
+ RequestMessage gwtMsg = new RequestMessage();
+ gwtMsg.name = textName.getText();
+ gwtMsg.from = textFrom.getText();
+ gwtMsg.to = textTo.getText();
+ gwtMsg.date = textDate.getText();
+ gwtMsg.seats = textSeats.getText();
+ sampleRemoteService.sendMessage(gwtMsg, new MessageCallback());
+ }
+ if (sender == buttonSubmitOrder)
+ {
+ OrderMessage gwtMsg = new OrderMessage();
+ gwtMsg.creditCard = textCreditCard.getText();
+ gwtMsg.expire = textExpire.getText();
+ if (gwtMsg.acceptOffer = checkAccept.isChecked())
{
- public void onSuccess(Object result)
- {
- if (state.equals("SendRequest"))
- {
- textName.setReadOnly(true);
- textFrom.setReadOnly(true);
- textTo.setReadOnly(true);
- textDate.setReadOnly(true);
- textSeats.setReadOnly(true);
- }
- }
+ sampleRemoteService.sendMessage(gwtMsg, new MessageCallback());
+ }
+ else
+ {
+ setVisiblePanel(getRequestPanel());
+ labelMessage.setText(null);
+ }
+ }
+ if (sender == buttonSubmitConfirm)
+ {
+ setVisiblePanel(getRequestPanel());
+ initRequestPanel(getDefaultData());
+ labelMessage.setText(null);
+ }
+ }
+ }
- public void onFailure(Throwable caught)
- {
- labelMessage.setText("Error: " + caught.getMessage());
- }
- };
-
- String name = textName.getText();
- String from = textFrom.getText();
- String to = textTo.getText();
- String date = textDate.getText();
- String seats = textSeats.getText();
-
- if (state.equals("SendRequest"))
+ class MessageCallback implements AsyncCallback
+ {
+ public void onSuccess(Object result)
+ {
+ sampleRemoteService.getMessage(this);
+ if (result instanceof GwtMessage)
+ {
+ if (result instanceof OfferMessage)
{
- sampleRemoteService.sendUserRequest(name, from , to, date, seats, callback);
+ labelMessage.setText("Airline Offer");
+ setVisiblePanel(getOfferPanel());
+ initOfferPanel((OfferMessage)result);
}
+ else if (result instanceof ConfirmMessage)
+ {
+ labelMessage.setText("Order Confirmation");
+ setVisiblePanel(getConfirmPanel());
+ initConfirmPanel((ConfirmMessage)result);
+ }
+ else if (result instanceof InvalidDataMessage)
+ {
+ labelMessage.setText("Invalid Request Data");
+ }
+ else if (result instanceof NotAvailableMessage)
+ {
+ labelMessage.setText("Seats not Available");
+ }
+ else
+ {
+ throw new IllegalStateException("Not Implemented: " + result);
+ }
}
- });
+ }
+
+ public void onFailure(Throwable caught)
+ {
+ labelMessage.setText("Error: " + caught.getMessage());
+ }
}
}
Modified: jbossbpm/spec/trunk/modules/samples/airticket/client/src/main/resources/org/jboss/bpm/samples/airticket/public/Application.html
===================================================================
--- jbossbpm/spec/trunk/modules/samples/airticket/client/src/main/resources/org/jboss/bpm/samples/airticket/public/Application.html 2008-07-30 19:18:44 UTC (rev 1778)
+++ jbossbpm/spec/trunk/modules/samples/airticket/client/src/main/resources/org/jboss/bpm/samples/airticket/public/Application.html 2008-07-30 19:18:52 UTC (rev 1779)
@@ -29,39 +29,15 @@
<iframe src="javascript:''" id="__gwt_historyFrame" style="width: 0; height: 0; border: 0"></iframe>
<table align=center>
<tr>
- <td id="bpmLogo"></td>
+ <td id="gwtLogo"></td>
<td><h2>JBossBPM - AirTicket Sample</h2></td>
</tr>
<tr>
- <td colspan="2" id="labelMessage"></td>
+ <td colspan="2" id="gwtMessage"></td>
</tr>
<tr>
- <td colspan="2" id="labelState"></td>
+ <td colspan="2" id="gwtPanel"></td>
</tr>
- <tr>
- <td id="labelName"></td>
- <td id="textName"></td>
- </tr>
- <tr>
- <td id="labelFrom"></td>
- <td id="textFrom"></td>
- </tr>
- <tr>
- <td id="labelTo"></td>
- <td id="textTo"></td>
- </tr>
- <tr>
- <td id="labelDate"></td>
- <td id="textDate"></td>
- </tr>
- <tr>
- <td id="labelSeats"></td>
- <td id="textSeats"></td>
- </tr>
- <tr align="center">
- <td id="buttonSubmit"></td>
- <td id="buttonPull"></td>
- </tr>
</table>
</body>
</html>
15 years, 9 months
JBoss JBPM SVN: r1778 - in jbossbpm/spec/trunk/modules/api/src/main/java/org/jboss/bpm: model and 1 other directory.
by do-not-reply@jboss.org
Author: thomas.diesler(a)jboss.com
Date: 2008-07-30 15:18:44 -0400 (Wed, 30 Jul 2008)
New Revision: 1778
Modified:
jbossbpm/spec/trunk/modules/api/src/main/java/org/jboss/bpm/client/ProcessManager.java
jbossbpm/spec/trunk/modules/api/src/main/java/org/jboss/bpm/model/Process.java
Log:
GWT App ok
Modified: jbossbpm/spec/trunk/modules/api/src/main/java/org/jboss/bpm/client/ProcessManager.java
===================================================================
--- jbossbpm/spec/trunk/modules/api/src/main/java/org/jboss/bpm/client/ProcessManager.java 2008-07-30 19:18:37 UTC (rev 1777)
+++ jbossbpm/spec/trunk/modules/api/src/main/java/org/jboss/bpm/client/ProcessManager.java 2008-07-30 19:18:44 UTC (rev 1778)
@@ -180,7 +180,7 @@
/**
* Start a Process with a given name
*/
- public abstract void startProcess(String name, Attachments att);
+ public abstract ObjectName startProcess(String name, Attachments att);
/**
* Wait for the Process to end. All Tokens that are generated at the Start Event for that Process must eventually
Modified: jbossbpm/spec/trunk/modules/api/src/main/java/org/jboss/bpm/model/Process.java
===================================================================
--- jbossbpm/spec/trunk/modules/api/src/main/java/org/jboss/bpm/model/Process.java 2008-07-30 19:18:37 UTC (rev 1777)
+++ jbossbpm/spec/trunk/modules/api/src/main/java/org/jboss/bpm/model/Process.java 2008-07-30 19:18:44 UTC (rev 1778)
@@ -25,7 +25,9 @@
import java.util.List;
+import javax.management.ObjectName;
+
import org.jboss.bpm.runtime.Attachments;
/**
@@ -129,12 +131,12 @@
/**
* Start the process
*/
- void startProcess();
+ ObjectName startProcess();
/**
* Start the process, with a given execution context
*/
- void startProcess(Attachments att);
+ ObjectName startProcess(Attachments att);
/**
* Find a flow object by name
15 years, 9 months
JBoss JBPM SVN: r1777 - in jbossbpm/spec/trunk/modules/samples/airticket/server: src/main/java/org/jboss/bpm/samples/airticket and 3 other directories.
by do-not-reply@jboss.org
Author: thomas.diesler(a)jboss.com
Date: 2008-07-30 15:18:37 -0400 (Wed, 30 Jul 2008)
New Revision: 1777
Added:
jbossbpm/spec/trunk/modules/samples/airticket/server/src/main/java/org/jboss/bpm/samples/airticket/ValidationHandler.java
jbossbpm/spec/trunk/modules/samples/airticket/server/src/main/java/org/jboss/bpm/samples/airticket/client/ConfirmMessage.java
jbossbpm/spec/trunk/modules/samples/airticket/server/src/main/java/org/jboss/bpm/samples/airticket/client/GwtMessage.java
jbossbpm/spec/trunk/modules/samples/airticket/server/src/main/java/org/jboss/bpm/samples/airticket/client/InvalidDataMessage.java
jbossbpm/spec/trunk/modules/samples/airticket/server/src/main/java/org/jboss/bpm/samples/airticket/client/NotAvailableMessage.java
jbossbpm/spec/trunk/modules/samples/airticket/server/src/main/java/org/jboss/bpm/samples/airticket/client/OfferMessage.java
jbossbpm/spec/trunk/modules/samples/airticket/server/src/main/java/org/jboss/bpm/samples/airticket/client/OrderMessage.java
jbossbpm/spec/trunk/modules/samples/airticket/server/src/main/java/org/jboss/bpm/samples/airticket/client/RequestMessage.java
Removed:
jbossbpm/spec/trunk/modules/samples/airticket/server/src/main/java/org/jboss/bpm/samples/airticket/server/RequestData.java
Modified:
jbossbpm/spec/trunk/modules/samples/airticket/server/pom.xml
jbossbpm/spec/trunk/modules/samples/airticket/server/src/main/java/org/jboss/bpm/samples/airticket/AirticketProcessBuilder.java
jbossbpm/spec/trunk/modules/samples/airticket/server/src/main/java/org/jboss/bpm/samples/airticket/client/AirticketService.java
jbossbpm/spec/trunk/modules/samples/airticket/server/src/main/java/org/jboss/bpm/samples/airticket/client/AirticketServiceAsync.java
jbossbpm/spec/trunk/modules/samples/airticket/server/src/main/java/org/jboss/bpm/samples/airticket/server/AirticketServiceImpl.java
jbossbpm/spec/trunk/modules/samples/airticket/server/src/test/java/org/jboss/bpm/samples/airticket/AirticketTest.java
Log:
GWT App ok
Modified: jbossbpm/spec/trunk/modules/samples/airticket/server/pom.xml
===================================================================
--- jbossbpm/spec/trunk/modules/samples/airticket/server/pom.xml 2008-07-30 19:18:21 UTC (rev 1776)
+++ jbossbpm/spec/trunk/modules/samples/airticket/server/pom.xml 2008-07-30 19:18:37 UTC (rev 1777)
@@ -1,3 +1,16 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!-- ====================================================================== -->
+<!-- -->
+<!-- JBoss, the OpenSource J2EE webOS -->
+<!-- -->
+<!-- Distributable under LGPL license. -->
+<!-- See terms of license at http://www.gnu.org. -->
+<!-- -->
+<!-- ====================================================================== -->
+
+<!-- $Id$
+-->
<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>
@@ -14,11 +27,6 @@
<!-- Dependencies -->
<dependencies>
- <dependency>
- <groupId>org.jboss.bpm</groupId>
- <artifactId>bpm-sample-airticket-rpc</artifactId>
- <version>${version}</version>
- </dependency>
</dependencies>
<!-- Build -->
Modified: jbossbpm/spec/trunk/modules/samples/airticket/server/src/main/java/org/jboss/bpm/samples/airticket/AirticketProcessBuilder.java
===================================================================
--- jbossbpm/spec/trunk/modules/samples/airticket/server/src/main/java/org/jboss/bpm/samples/airticket/AirticketProcessBuilder.java 2008-07-30 19:18:21 UTC (rev 1776)
+++ jbossbpm/spec/trunk/modules/samples/airticket/server/src/main/java/org/jboss/bpm/samples/airticket/AirticketProcessBuilder.java 2008-07-30 19:18:37 UTC (rev 1777)
@@ -69,7 +69,8 @@
// Build the ValidateTask
taskBuilder = procBuilder.addTask("ValidateTask", TaskType.None);
- taskBuilder.addInputSet().
+ taskBuilder.addExecutionHandler(ValidationHandler.class).
+ addInputSet().
addPropertyInput("Name", null).
addPropertyInput("From", null).
addPropertyInput("To", null).
@@ -77,7 +78,6 @@
addPropertyInput("Seats", null).
addOutputSet().
addPropertyOutput("isReqDataValid", null).
- addIORule("Name != null && From != null && To != null && Date != null && Seats > 0", ExpressionLanguage.MVEL).
addSequenceFlow("ValidateGateway");
// Build the ValidateGateway
Added: jbossbpm/spec/trunk/modules/samples/airticket/server/src/main/java/org/jboss/bpm/samples/airticket/ValidationHandler.java
===================================================================
--- jbossbpm/spec/trunk/modules/samples/airticket/server/src/main/java/org/jboss/bpm/samples/airticket/ValidationHandler.java (rev 0)
+++ jbossbpm/spec/trunk/modules/samples/airticket/server/src/main/java/org/jboss/bpm/samples/airticket/ValidationHandler.java 2008-07-30 19:18:37 UTC (rev 1777)
@@ -0,0 +1,59 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * 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.bpm.samples.airticket;
+
+// $Id$
+
+import org.jboss.bpm.model.InputSet;
+import org.jboss.bpm.model.OutputSet;
+import org.jboss.bpm.model.PropertyBuilder;
+import org.jboss.bpm.model.PropertyBuilderFactory;
+import org.jboss.bpm.runtime.ExecutionHandler;
+import org.jboss.bpm.runtime.Token;
+
+/**
+ * An ExecutionHandler that adds the required outputSet properties
+ *
+ * @author Thomas.Diesler(a)jboss.com
+ * @since 04-Jul-2008
+ */
+@SuppressWarnings("serial")
+public class ValidationHandler implements ExecutionHandler
+{
+ public void execute(Token token, InputSet inputSet, OutputSet outputSet)
+ {
+ String name = inputSet.getProperty("Name").getValue().getExpressionBody();
+ String from = inputSet.getProperty("From").getValue().getExpressionBody();
+ String to = inputSet.getProperty("To").getValue().getExpressionBody();
+ String date = inputSet.getProperty("Date").getValue().getExpressionBody();
+ String seats = inputSet.getProperty("Seats").getValue().getExpressionBody();
+
+ boolean isValid = name != null && name.length() > 0;
+ isValid &= from != null && from.length() > 0;
+ isValid &= to != null && to.length() > 0;
+ isValid &= date != null && date.length() > 0;
+ isValid &= seats != null && seats.length() > 0 && 0 < Integer.valueOf(seats);
+
+ PropertyBuilder builder = PropertyBuilderFactory.newInstance().newPropertyBuilder();
+ outputSet.addProperty(builder.newProperty("isReqDataValid", "" + isValid));
+ }
+}
Property changes on: jbossbpm/spec/trunk/modules/samples/airticket/server/src/main/java/org/jboss/bpm/samples/airticket/ValidationHandler.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Modified: jbossbpm/spec/trunk/modules/samples/airticket/server/src/main/java/org/jboss/bpm/samples/airticket/client/AirticketService.java
===================================================================
--- jbossbpm/spec/trunk/modules/samples/airticket/server/src/main/java/org/jboss/bpm/samples/airticket/client/AirticketService.java 2008-07-30 19:18:21 UTC (rev 1776)
+++ jbossbpm/spec/trunk/modules/samples/airticket/server/src/main/java/org/jboss/bpm/samples/airticket/client/AirticketService.java 2008-07-30 19:18:37 UTC (rev 1777)
@@ -4,5 +4,7 @@
public interface AirticketService extends RemoteService
{
- void sendUserRequest(String name, String from, String to, String date, String seats);
+ GwtMessage getMessage();
+
+ void sendMessage(GwtMessage message);
}
Modified: jbossbpm/spec/trunk/modules/samples/airticket/server/src/main/java/org/jboss/bpm/samples/airticket/client/AirticketServiceAsync.java
===================================================================
--- jbossbpm/spec/trunk/modules/samples/airticket/server/src/main/java/org/jboss/bpm/samples/airticket/client/AirticketServiceAsync.java 2008-07-30 19:18:21 UTC (rev 1776)
+++ jbossbpm/spec/trunk/modules/samples/airticket/server/src/main/java/org/jboss/bpm/samples/airticket/client/AirticketServiceAsync.java 2008-07-30 19:18:37 UTC (rev 1777)
@@ -4,5 +4,7 @@
public interface AirticketServiceAsync
{
- void sendUserRequest(String name, String from, String to, String date, String seats, AsyncCallback callback);
+ void getMessage(AsyncCallback callback);
+
+ void sendMessage(GwtMessage message, AsyncCallback callback);
}
Added: jbossbpm/spec/trunk/modules/samples/airticket/server/src/main/java/org/jboss/bpm/samples/airticket/client/ConfirmMessage.java
===================================================================
--- jbossbpm/spec/trunk/modules/samples/airticket/server/src/main/java/org/jboss/bpm/samples/airticket/client/ConfirmMessage.java (rev 0)
+++ jbossbpm/spec/trunk/modules/samples/airticket/server/src/main/java/org/jboss/bpm/samples/airticket/client/ConfirmMessage.java 2008-07-30 19:18:37 UTC (rev 1777)
@@ -0,0 +1,29 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * 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.bpm.samples.airticket.client;
+
+// $Id$
+
+public class ConfirmMessage extends GwtMessage
+{
+ public String price;
+}
\ No newline at end of file
Property changes on: jbossbpm/spec/trunk/modules/samples/airticket/server/src/main/java/org/jboss/bpm/samples/airticket/client/ConfirmMessage.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added: jbossbpm/spec/trunk/modules/samples/airticket/server/src/main/java/org/jboss/bpm/samples/airticket/client/GwtMessage.java
===================================================================
--- jbossbpm/spec/trunk/modules/samples/airticket/server/src/main/java/org/jboss/bpm/samples/airticket/client/GwtMessage.java (rev 0)
+++ jbossbpm/spec/trunk/modules/samples/airticket/server/src/main/java/org/jboss/bpm/samples/airticket/client/GwtMessage.java 2008-07-30 19:18:37 UTC (rev 1777)
@@ -0,0 +1,35 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * 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.bpm.samples.airticket.client;
+
+// $Id$
+
+import java.io.Serializable;
+
+public class GwtMessage implements Serializable
+{
+ public String name;
+ public String from;
+ public String to;
+ public String date;
+ public String seats;
+}
\ No newline at end of file
Property changes on: jbossbpm/spec/trunk/modules/samples/airticket/server/src/main/java/org/jboss/bpm/samples/airticket/client/GwtMessage.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added: jbossbpm/spec/trunk/modules/samples/airticket/server/src/main/java/org/jboss/bpm/samples/airticket/client/InvalidDataMessage.java
===================================================================
--- jbossbpm/spec/trunk/modules/samples/airticket/server/src/main/java/org/jboss/bpm/samples/airticket/client/InvalidDataMessage.java (rev 0)
+++ jbossbpm/spec/trunk/modules/samples/airticket/server/src/main/java/org/jboss/bpm/samples/airticket/client/InvalidDataMessage.java 2008-07-30 19:18:37 UTC (rev 1777)
@@ -0,0 +1,28 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * 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.bpm.samples.airticket.client;
+
+// $Id$
+
+public class InvalidDataMessage extends GwtMessage
+{
+}
\ No newline at end of file
Property changes on: jbossbpm/spec/trunk/modules/samples/airticket/server/src/main/java/org/jboss/bpm/samples/airticket/client/InvalidDataMessage.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added: jbossbpm/spec/trunk/modules/samples/airticket/server/src/main/java/org/jboss/bpm/samples/airticket/client/NotAvailableMessage.java
===================================================================
--- jbossbpm/spec/trunk/modules/samples/airticket/server/src/main/java/org/jboss/bpm/samples/airticket/client/NotAvailableMessage.java (rev 0)
+++ jbossbpm/spec/trunk/modules/samples/airticket/server/src/main/java/org/jboss/bpm/samples/airticket/client/NotAvailableMessage.java 2008-07-30 19:18:37 UTC (rev 1777)
@@ -0,0 +1,28 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * 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.bpm.samples.airticket.client;
+
+// $Id$
+
+public class NotAvailableMessage extends GwtMessage
+{
+}
\ No newline at end of file
Property changes on: jbossbpm/spec/trunk/modules/samples/airticket/server/src/main/java/org/jboss/bpm/samples/airticket/client/NotAvailableMessage.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added: jbossbpm/spec/trunk/modules/samples/airticket/server/src/main/java/org/jboss/bpm/samples/airticket/client/OfferMessage.java
===================================================================
--- jbossbpm/spec/trunk/modules/samples/airticket/server/src/main/java/org/jboss/bpm/samples/airticket/client/OfferMessage.java (rev 0)
+++ jbossbpm/spec/trunk/modules/samples/airticket/server/src/main/java/org/jboss/bpm/samples/airticket/client/OfferMessage.java 2008-07-30 19:18:37 UTC (rev 1777)
@@ -0,0 +1,29 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * 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.bpm.samples.airticket.client;
+
+// $Id$
+
+public class OfferMessage extends GwtMessage
+{
+ public String price;
+}
\ No newline at end of file
Property changes on: jbossbpm/spec/trunk/modules/samples/airticket/server/src/main/java/org/jboss/bpm/samples/airticket/client/OfferMessage.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added: jbossbpm/spec/trunk/modules/samples/airticket/server/src/main/java/org/jboss/bpm/samples/airticket/client/OrderMessage.java
===================================================================
--- jbossbpm/spec/trunk/modules/samples/airticket/server/src/main/java/org/jboss/bpm/samples/airticket/client/OrderMessage.java (rev 0)
+++ jbossbpm/spec/trunk/modules/samples/airticket/server/src/main/java/org/jboss/bpm/samples/airticket/client/OrderMessage.java 2008-07-30 19:18:37 UTC (rev 1777)
@@ -0,0 +1,31 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * 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.bpm.samples.airticket.client;
+
+// $Id$
+
+public class OrderMessage extends GwtMessage
+{
+ public String creditCard;
+ public String expire;
+ public boolean acceptOffer;
+}
\ No newline at end of file
Property changes on: jbossbpm/spec/trunk/modules/samples/airticket/server/src/main/java/org/jboss/bpm/samples/airticket/client/OrderMessage.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added: jbossbpm/spec/trunk/modules/samples/airticket/server/src/main/java/org/jboss/bpm/samples/airticket/client/RequestMessage.java
===================================================================
--- jbossbpm/spec/trunk/modules/samples/airticket/server/src/main/java/org/jboss/bpm/samples/airticket/client/RequestMessage.java (rev 0)
+++ jbossbpm/spec/trunk/modules/samples/airticket/server/src/main/java/org/jboss/bpm/samples/airticket/client/RequestMessage.java 2008-07-30 19:18:37 UTC (rev 1777)
@@ -0,0 +1,33 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * 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.bpm.samples.airticket.client;
+
+// $Id$
+
+public class RequestMessage extends GwtMessage
+{
+ public String name;
+ public String from;
+ public String to;
+ public String date;
+ public String seats;
+}
\ No newline at end of file
Property changes on: jbossbpm/spec/trunk/modules/samples/airticket/server/src/main/java/org/jboss/bpm/samples/airticket/client/RequestMessage.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Modified: jbossbpm/spec/trunk/modules/samples/airticket/server/src/main/java/org/jboss/bpm/samples/airticket/server/AirticketServiceImpl.java
===================================================================
--- jbossbpm/spec/trunk/modules/samples/airticket/server/src/main/java/org/jboss/bpm/samples/airticket/server/AirticketServiceImpl.java 2008-07-30 19:18:21 UTC (rev 1776)
+++ jbossbpm/spec/trunk/modules/samples/airticket/server/src/main/java/org/jboss/bpm/samples/airticket/server/AirticketServiceImpl.java 2008-07-30 19:18:37 UTC (rev 1777)
@@ -5,16 +5,27 @@
import javax.management.ObjectName;
+import org.jboss.bpm.NotImplementedException;
import org.jboss.bpm.client.MessageListener;
import org.jboss.bpm.client.MessageManager;
import org.jboss.bpm.client.ObjectNameFactory;
+import org.jboss.bpm.client.ProcessManager;
+import org.jboss.bpm.client.SignalListener;
+import org.jboss.bpm.client.SignalManager;
import org.jboss.bpm.model.Message;
import org.jboss.bpm.model.MessageBuilder;
import org.jboss.bpm.model.MessageBuilderFactory;
import org.jboss.bpm.model.Process;
+import org.jboss.bpm.model.Signal;
import org.jboss.bpm.samples.airticket.AirticketProcessBuilder;
import org.jboss.bpm.samples.airticket.client.AirticketService;
-import org.jboss.bpm.samples.airticket.client.RequestData;
+import org.jboss.bpm.samples.airticket.client.ConfirmMessage;
+import org.jboss.bpm.samples.airticket.client.GwtMessage;
+import org.jboss.bpm.samples.airticket.client.InvalidDataMessage;
+import org.jboss.bpm.samples.airticket.client.NotAvailableMessage;
+import org.jboss.bpm.samples.airticket.client.OfferMessage;
+import org.jboss.bpm.samples.airticket.client.OrderMessage;
+import org.jboss.bpm.samples.airticket.client.RequestMessage;
import com.google.gwt.user.server.rpc.RemoteServiceServlet;
@@ -23,36 +34,130 @@
{
private ObjectName listenerID = ObjectNameFactory.create("mydomain:type=MessageListener");
private List<Message> messageQueue = new ArrayList<Message>();
+ private ObjectName procID;
- public void sendUserRequest(String name, String from, String to, String date, String seats)
+ public GwtMessage getMessage()
{
- AirticketProcessBuilder procBuilder = new AirticketProcessBuilder(listenerID);
- Process proc = procBuilder.buildProcess();
-
+ GwtMessage returnMsg = null;
+ if (messageQueue.size() > 0)
+ {
+ Message bpmMsg = messageQueue.remove(0);
+ String msgName = bpmMsg.getName();
+ if (msgName.equals("OfferMsg"))
+ {
+ OfferMessage gwtMsg = new OfferMessage();
+ gwtMsg.name = bpmMsg.getProperty("Name").getValue().getExpressionBody();
+ gwtMsg.from = bpmMsg.getProperty("From").getValue().getExpressionBody();
+ gwtMsg.to = bpmMsg.getProperty("To").getValue().getExpressionBody();
+ gwtMsg.date = bpmMsg.getProperty("Date").getValue().getExpressionBody();
+ gwtMsg.seats = bpmMsg.getProperty("Seats").getValue().getExpressionBody();
+ gwtMsg.price = bpmMsg.getProperty("Price").getValue().getExpressionBody();
+ returnMsg = gwtMsg;
+ }
+ else if (msgName.equals("InvalidDataMsg"))
+ {
+ InvalidDataMessage gwtMsg = new InvalidDataMessage();
+ gwtMsg.name = bpmMsg.getProperty("Name").getValue().getExpressionBody();
+ gwtMsg.from = bpmMsg.getProperty("From").getValue().getExpressionBody();
+ gwtMsg.to = bpmMsg.getProperty("To").getValue().getExpressionBody();
+ gwtMsg.date = bpmMsg.getProperty("Date").getValue().getExpressionBody();
+ gwtMsg.seats = bpmMsg.getProperty("Seats").getValue().getExpressionBody();
+ returnMsg = gwtMsg;
+ }
+ else if (msgName.equals("NotAvailableMsg"))
+ {
+ NotAvailableMessage gwtMsg = new NotAvailableMessage();
+ gwtMsg.name = bpmMsg.getProperty("Name").getValue().getExpressionBody();
+ gwtMsg.from = bpmMsg.getProperty("From").getValue().getExpressionBody();
+ gwtMsg.to = bpmMsg.getProperty("To").getValue().getExpressionBody();
+ gwtMsg.date = bpmMsg.getProperty("Date").getValue().getExpressionBody();
+ gwtMsg.seats = bpmMsg.getProperty("Seats").getValue().getExpressionBody();
+ returnMsg = gwtMsg;
+ }
+ else if (msgName.equals("ConfirmMsg"))
+ {
+ ConfirmMessage gwtMsg = new ConfirmMessage();
+ gwtMsg.name = bpmMsg.getProperty("Name").getValue().getExpressionBody();
+ gwtMsg.from = bpmMsg.getProperty("From").getValue().getExpressionBody();
+ gwtMsg.to = bpmMsg.getProperty("To").getValue().getExpressionBody();
+ gwtMsg.date = bpmMsg.getProperty("Date").getValue().getExpressionBody();
+ gwtMsg.seats = bpmMsg.getProperty("Seats").getValue().getExpressionBody();
+ gwtMsg.price = bpmMsg.getProperty("Price").getValue().getExpressionBody();
+ returnMsg = gwtMsg;
+ }
+ else
+ {
+ throw new NotImplementedException(msgName);
+ }
+ }
+ return returnMsg;
+ }
+
+ public void sendMessage(GwtMessage gwtMsg)
+ {
MessageManager mm = MessageManager.locateMessageManager();
- mm.addMessageListener(new AirticketMessageListener());
-
- proc.startProcess();
- new RequestData(name, from, to, date, seats);
+ SignalManager sm = SignalManager.locateSignalManager();
- Message msg = getRequestMessage(name, from, to, date, seats);
- mm.sendMessage(proc.getID(), "ReceiveReqTask", msg);
+ System.out.println(gwtMsg);
+
+ if (gwtMsg instanceof RequestMessage)
+ {
+ // Create/Start the process
+ if (procID == null)
+ {
+ AirticketProcessBuilder procBuilder = new AirticketProcessBuilder(listenerID);
+ Process proc = procBuilder.buildProcess();
+ procID = proc.startProcess();
+
+ mm.addMessageListener(new AirticketMessageListener());
+ sm.addSignalListener(proc.getName(), new AirticketSignalListener());
+ }
+ else
+ {
+ ProcessManager pm = ProcessManager.locateProcessManager();
+ procID = pm.startProcess("Airticket", null);
+ }
+
+ Message msg = getRequestMessage((RequestMessage)gwtMsg);
+ mm.sendMessage(procID, "ReceiveReqTask", msg);
+ }
+ else if (gwtMsg instanceof OrderMessage)
+ {
+ Message msg = getOrderMessage((OrderMessage)gwtMsg);
+ mm.sendMessage(procID, "ReceiveOrderTask", msg);
+ }
+ else
+ {
+ throw new NotImplementedException(gwtMsg.getClass().getName());
+ }
}
- private Message getRequestMessage(String name, String from, String to, String date, String seats)
+ private Message getRequestMessage(RequestMessage gwtMsg)
{
MessageBuilderFactory msgFactory = MessageBuilderFactory.newInstance();
MessageBuilder msgBuilder = msgFactory.newMessageBuilder();
Message msg = msgBuilder.newMessage("ReqDataMsg", null).
- addProperty("Name", name).
- addProperty("From", from).
- addProperty("To", to).
- addProperty("Date", date).
- addProperty("Seats", seats).
+ addProperty("Name", gwtMsg.name).
+ addProperty("From", gwtMsg.from).
+ addProperty("To", gwtMsg.to).
+ addProperty("Date", gwtMsg.date).
+ addProperty("Seats", gwtMsg.seats).
getMessage();
return msg;
}
+ private Message getOrderMessage(OrderMessage gwtMsg)
+ {
+ MessageBuilderFactory msgFactory = MessageBuilderFactory.newInstance();
+ MessageBuilder msgBuilder = msgFactory.newMessageBuilder();
+ Message msg = msgBuilder.newMessage("AcceptOfferMsg", null).
+ addProperty("CreditCard", gwtMsg.creditCard).
+ addProperty("Expire", gwtMsg.expire).
+ addProperty("isOfferAccepted", "" + gwtMsg.acceptOffer).
+ getMessage();
+ return msg;
+ }
+
class AirticketMessageListener implements MessageListener
{
public void catchMessage(Message message)
@@ -65,6 +170,13 @@
{
return listenerID;
}
-
}
+
+ class AirticketSignalListener implements SignalListener
+ {
+ public void catchSignal(Signal signal)
+ {
+ System.out.println(signal);
+ }
+ }
}
Deleted: jbossbpm/spec/trunk/modules/samples/airticket/server/src/main/java/org/jboss/bpm/samples/airticket/server/RequestData.java
===================================================================
--- jbossbpm/spec/trunk/modules/samples/airticket/server/src/main/java/org/jboss/bpm/samples/airticket/server/RequestData.java 2008-07-30 19:18:21 UTC (rev 1776)
+++ jbossbpm/spec/trunk/modules/samples/airticket/server/src/main/java/org/jboss/bpm/samples/airticket/server/RequestData.java 2008-07-30 19:18:37 UTC (rev 1777)
@@ -1,22 +0,0 @@
-package org.jboss.bpm.samples.airticket.server;
-
-public class RequestData
-{
- private String name;
- private String from;
- private String to;
- private String date;
- private String seats;
-
- public RequestData(String name, String from, String to, String date, String seats)
- {
- super();
- this.name = name;
- this.from = from;
- this.to = to;
- this.date = date;
- this.seats = seats;
- }
-
-
-}
Modified: jbossbpm/spec/trunk/modules/samples/airticket/server/src/test/java/org/jboss/bpm/samples/airticket/AirticketTest.java
===================================================================
--- jbossbpm/spec/trunk/modules/samples/airticket/server/src/test/java/org/jboss/bpm/samples/airticket/AirticketTest.java 2008-07-30 19:18:21 UTC (rev 1776)
+++ jbossbpm/spec/trunk/modules/samples/airticket/server/src/test/java/org/jboss/bpm/samples/airticket/AirticketTest.java 2008-07-30 19:18:37 UTC (rev 1777)
@@ -47,40 +47,6 @@
*/
public class AirticketTest extends DefaultEngineTestCase
{
- private final class AirticketMessageListener implements MessageListener
- {
- private Process proc;
- private ObjectName targetID;
- private Message confirmMessage;
-
- private AirticketMessageListener(Process proc, ObjectName listenerID)
- {
- this.proc = proc;
- this.targetID = listenerID;
- }
-
- public Message getConfirmMessage()
- {
- return confirmMessage;
- }
-
- public void catchMessage(Message message)
- {
- MessageManager mm = MessageManager.locateMessageManager();
- if (message.getName().equals("InvalidDataMsg"))
- mm.sendMessage(proc.getID(), "ReceiveReqTask", getValidRequestMessage());
- else if (message.getName().equals("OfferMsg"))
- mm.sendMessage(proc.getID(), "ReceiveOrderTask", getAcceptOfferMessage());
- else if (message.getName().equals("ConfirmMsg"))
- confirmMessage = message;
- }
-
- public ObjectName getMessageListenerID()
- {
- return targetID;
- }
- }
-
@Override
protected void setUp() throws Exception
{
@@ -190,4 +156,38 @@
getMessage();
return msg;
}
+
+ class AirticketMessageListener implements MessageListener
+ {
+ private Process proc;
+ private ObjectName targetID;
+ private Message confirmMessage;
+
+ private AirticketMessageListener(Process proc, ObjectName listenerID)
+ {
+ this.proc = proc;
+ this.targetID = listenerID;
+ }
+
+ public Message getConfirmMessage()
+ {
+ return confirmMessage;
+ }
+
+ public void catchMessage(Message message)
+ {
+ MessageManager mm = MessageManager.locateMessageManager();
+ if (message.getName().equals("InvalidDataMsg"))
+ mm.sendMessage(proc.getID(), "ReceiveReqTask", getValidRequestMessage());
+ else if (message.getName().equals("OfferMsg"))
+ mm.sendMessage(proc.getID(), "ReceiveOrderTask", getAcceptOfferMessage());
+ else if (message.getName().equals("ConfirmMsg"))
+ confirmMessage = message;
+ }
+
+ public ObjectName getMessageListenerID()
+ {
+ return targetID;
+ }
+ }
}
\ No newline at end of file
15 years, 9 months