Hello World BPEL Sample
======================================
This sample demonstrates an SCA service implemented by a BPEL process.
The README in the samples directory (the directory above this) provides
general instructions about building and running samples. Take a look there
first.
If you just want to run it to see what happens open a command prompt, navigate
to this sample directory, and do
ant compile run
OR if you don't have ant, on Windows do
mkdir target\classes
mkdir target\wsdl2java-source
java -cp ..\..\lib\tuscany-sca-manifest.jar org.apache.tuscany.sdo.generate.XSD2JavaGenerator -targetDirectory target/wsdl2java-source -prefix HelloWorld -noContainment -noUnsettable src/main/resources/helloworld.wsdl
java -cp ..\..\lib\tuscany-sca-manifest.jar org.apache.tuscany.tools.wsdl2java.generate.WSDL2JavaGenerator -targetDirectory target/wsdl2java-source src/main/resources/helloworld.wsdl
unzip ..\..\lib\ode-dao-jpa-ojpa-derby-1.1.zip -d target\database
javac -d target\classes -cp target\classes;..\..\lib\tuscany-sca-manifest.jar -sourcepath src\main\java;target\wsdl2java-source -target 1.5 -g -source 1.5 src\main\java\helloworld\BPELClient.java
copy src\main\resources\* target\classes
java -cp ..\..\lib\tuscany-sca-manifest.jar;target\classes;target\database helloworld.BPELClient
and on *nix do
mkdir target/classes
mkdir target/wsdl2java-source
java -cp ../../lib/tuscany-sca-manifest.jar org.apache.tuscany.sdo.generate.XSD2JavaGenerator -targetDirectory target/wsdl2java-source -prefix HelloWorld -noContainment -noUnsettable src/main/resources/helloworld.wsdl
java -cp ../../lib/tuscany-sca-manifest.jar org.apache.tuscany.tools.wsdl2java.generate.WSDL2JavaGenerator -targetDirectory target/wsdl2java-source src/main/resources/helloworld.wsdl
unzip ../../lib/ode-dao-jpa-ojpa-derby-1.1.zip -d target/database
javac -d target/classes -cp target/classes;../../lib/tuscany-sca-manifest.jar -sourcepath src/main/java;target/wsdl2java-source -target 1.5 -g -source 1.5 src/main/java/helloworld/BPELClient.java
cp src/main/resources/* target/classes
java -cp ../../lib/tuscany-sca-manifest.jar:target/classes:target/database helloworld.BPELClient
The sample will start an embedded BPEL engine, deploy a process and invoke it.
Sample Overview
---------------
The sample provides a single component that is wired to a service with a
web service binding.
helloworld-bpel/
src/
main/
java/
helloworld/
BPELClient.java - client application for
BEPELHelloWorldComponent
resources/
deploy.xml - ODE deployment descriptor
helloworld.bpel - helloworld bpel process
helloworld.componentType - helloworld bpel service description
helloworld.composite - the SCA assembly for this sample
helloworld.wsdl - the service description that describes
the bpel process
log4j.properties - logging configuration
test/
java/
helloworld/
BPELHelloWorldTestCase.java - JUnit test case
helloworld-bpel.png - a pictorial representation of the
sample .composite file
build.xml - the Ant build file
pom.xml - the Maven build file
Building And Running The Sample Using Ant
-----------------------------------------
With the binary distribution the sample can be built and run using Ant as
follows
cd helloworld-bpel
ant compile
ant run
You should see the following output from the run target.
run:
[java] Starting BPELHelloWorldComponent
[java] >>> Deploying : D:\temp\SCA1.1-RC1\tuscany-sca-1.1-incubating\samples\helloworld-bpel\target\classes
[java] ::arg::::::
[java] Hello
[java] ::message::
[java] Hello
[java] Status: RESPONSE
[java] Response:
[java] Hello World
[java] Hello World
[java] Stopping BPELHelloWorldComponent
[java] Stopped !!!
BUILD SUCCESSFUL
Total time: 36 seconds
Building And Running The Sample Using Maven
-------------------------------------------
With either the binary or source distributions the sample can be built and run
using Maven as follows. When using Maven, a simple test is present that exercise
the same logic as the client to invoke the BPEl process.
cd helloworld-bpel
mvn
You should see the following output from the test phase.
-
-------------------------------------------------------
T E S T S
-------------------------------------------------------
Running helloworld.BPELHelloWorldTestCase
Starting BPELHelloWorldComponent
>>> Deploying : D:\dev\Opensource\Apache\Tuscany\source\java-sca-1.1\samples\helloworld-bpel\target\classes
::arg::::::
Hello
::message::
Hello
Status: RESPONSE
Response:
Hello World
Stopping BPELHelloWorldComponent
Stopped !!!
Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 18.656 sec
Results :
Tests run: 1, Failures: 0, Errors: 0, Skipped: 0
[INFO] [jar:jar]
[INFO] Building jar: D:\dev\Opensource\Apache\Tuscany\source\java-sca-1.1\samples\helloworld-bpel\target\sample-helloworld-bpel.jar
[INFO] [install:install]
[INFO] Installing D:\dev\Opensource\Apache\Tuscany\source\java-sca-1.1\samples\helloworld-bpel\target\sample-helloworld-bpel.jar to C:\Documents and Settings\lresend
e\.m2\repository\org\apache\tuscany\sca\sample-helloworld-bpel\1.1-incubating-SNAPSHOT\sample-helloworld-bpel-1.1-incubating-SNAPSHOT.jar
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESSFUL
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 53 seconds
[INFO] Finished at: Sun Jan 13 09:54:39 PST 2008
[INFO] Final Memory: 24M/43M
[INFO] ------------------------------------------------------------------------
This shows that the Junit test cases have run successfully.