summaryrefslogtreecommitdiffstats
path: root/sca-java-2.x/trunk/samples/getting-started/contributions/helloworld-bpel/README
blob: 533743ebf66692bd78e51accd880b074747f5d23 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
Hello World BPEL Sample
======================================
This sample demonstrates an SCA service implemented by a BPEL process. 

The README in the <distribution-unpack-dir>/samples directory provides 
general instructions about building and running samples. (where
distribution-unpack-dir is the directory in which you unpacked the tuscany
binary distribution archive). Take a look there first (noting at you read it that this sample
is not a new style sample). 

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:::::: <?xml version="1.0" encoding="UTF-8"?>
     [java] <hello xmlns="http://tuscany.apache.org/implementation/bpel/example/helloworld.wsdl"><message xmlns="http://tuscany.apache.org/implementation/bpel/exampl
e/helloworld.wsdl">Hello</message></hello>
     [java] ::message:: <?xml version="1.0" encoding="UTF-8"?>
     [java] <message><TestPart><hello xmlns="http://tuscany.apache.org/implementation/bpel/example/helloworld.wsdl"><message xmlns="http://tuscany.apache.org/impleme
ntation/bpel/example/helloworld.wsdl">Hello</message></hello></TestPart></message>
     [java] Status: RESPONSE
     [java] Response: <?xml version="1.0" encoding="UTF-8"?>
     [java] <message><TestPart><hello xmlns="http://tuscany.apache.org/implementation/bpel/example/helloworld.wsdl">Hello World</hello></TestPart></message>
     [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:::::: <?xml version="1.0" encoding="UTF-8"?>
<hello xmlns="http://tuscany.apache.org/implementation/bpel/example/helloworld.wsdl"><message xmlns="http://tuscany.apache.org/implementation/bpel/example/helloworld
.wsdl">Hello</message></hello>
::message:: <?xml version="1.0" encoding="UTF-8"?>
<message><TestPart><hello xmlns="http://tuscany.apache.org/implementation/bpel/example/helloworld.wsdl"><message xmlns="http://tuscany.apache.org/implementation/bpel
/example/helloworld.wsdl">Hello</message></hello></TestPart></message>
Status: RESPONSE
Response: <?xml version="1.0" encoding="UTF-8"?>
<message><TestPart><hello xmlns="http://tuscany.apache.org/implementation/bpel/example/helloworld.wsdl">Hello World</hello></TestPart></message>
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.