Skip to content

Commit 0a7e736

Browse files
committed
Implemented SWS-83: airline sample now uses HSQLDB in memory to test.
Also using Maven2 profiles for the various database settings.
1 parent 271277b commit 0a7e736

File tree

21 files changed

+307
-81
lines changed

21 files changed

+307
-81
lines changed

samples/airline/client/axis1/build.xml

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -10,13 +10,10 @@
1010
<target name="init">
1111
<typedef resource="org/apache/maven/artifact/ant/antlib.xml" uri="urn:maven-artifact-ant">
1212
<classpath>
13-
<pathelement location="${basedir}/../maven-artifact-ant-2.0.4-dep.jar"/>
13+
<pathelement location="${basedir}/../../../maven-artifact-ant-2.0.4-dep.jar"/>
1414
</classpath>
1515
</typedef>
1616

17-
<!-- <artifact:remoteRepository id="java.net" url="https://maven-repository.dev.java.net/nonav/repository" -->
18-
<!-- layout="legacy"/> -->
19-
2017
<artifact:dependencies pathId="generate.classpath">
2118
<dependency groupId="axis" artifactId="axis-ant" version="1.4"/>
2219
<dependency groupId="axis" artifactId="axis" version="1.4"/>
@@ -25,11 +22,7 @@
2522
<artifact:dependencies pathId="compile.classpath">
2623
<dependency groupId="axis" artifactId="axis" version="1.4"/>
2724
</artifact:dependencies>
28-
<!-- -->
29-
<!-- <artifact:dependencies pathId="runtime.classpath"> -->
30-
<!-- <remoteRepository refid="java.net" /> -->
31-
<!-- <dependency groupId="com.sun.xml.messaging.saaj" artifactId="saaj-impl" version="1.3"/> -->
32-
<!-- </artifact:dependencies> -->
25+
3326
</target>
3427

3528
<target name="generate" depends="init">

samples/airline/client/jaxws/build.xml

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -9,15 +9,11 @@
99
<mkdir dir="${bin.dir}"/>
1010
<typedef resource="org/apache/maven/artifact/ant/antlib.xml" uri="urn:maven-artifact-ant">
1111
<classpath>
12-
<pathelement location="${basedir}/../maven-artifact-ant-2.0.4-dep.jar"/>
12+
<pathelement location="${basedir}/../../../maven-artifact-ant-2.0.4-dep.jar"/>
1313
</classpath>
1414
</typedef>
1515

16-
<artifact:remoteRepository id="java.net" url="https://maven-repository.dev.java.net/nonav/repository"
17-
layout="legacy" />
18-
1916
<artifact:dependencies pathId="generate.classpath">
20-
<remoteRepository refid="java.net"/>
2117
<dependency groupId="com.sun.xml.ws" artifactId="jaxws-tools" version="EA3"/>
2218
<dependency groupId="com.sun.xml.bind" artifactId="jaxb-xjc" version="2.1-EA2"/>
2319
<dependency groupId="com.sun.xml.stream.buffer" artifactId="streambuffer" version="0.3"/>
@@ -27,12 +23,10 @@
2723
</artifact:dependencies>
2824

2925
<artifact:dependencies pathId="compile.classpath">
30-
<remoteRepository refid="java.net"/>
3126
<dependency groupId="javax.xml.ws" artifactId="jaxws-api" version="2.1-SNAPSHOT"/>
3227
</artifact:dependencies>
3328

3429
<artifact:dependencies pathId="runtime.classpath">
35-
<remoteRepository refid="java.net"/>
3630
<dependency groupId="com.sun.xml.ws" artifactId="jaxws-rt" version="EA3"/>
3731
<dependency groupId="com.sun.xml.bind" artifactId="jaxb-impl" version="2.1-EA2"/>
3832
<dependency groupId="com.sun.xml.bind" artifactId="jaxb-xjc" version="2.1-EA2"/>

samples/airline/client/readme.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ SPRING WEB SERVICES
22

33
Client table of contents
44
---------------------------------------------------
5-
* axis - A client for the airline service written in Java using JAX-RPC (Axis 1).
5+
* axis1 - A client for the airline service written in Java using JAX-RPC (Axis 1).
66
* cs - A client for the airline service written in C#.
77
* jax-ws - A client for the airline service written in Java using JAX-WS.
88
* saaj - Two clients that are written in Java and use SAAJ.

samples/airline/client/saaj/build.xml

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,22 +8,17 @@
88
<target name="init">
99
<typedef resource="org/apache/maven/artifact/ant/antlib.xml" uri="urn:maven-artifact-ant">
1010
<classpath>
11-
<pathelement location="${basedir}/../maven-artifact-ant-2.0.4-dep.jar"/>
11+
<pathelement location="${basedir}/../../../maven-artifact-ant-2.0.4-dep.jar"/>
1212
</classpath>
1313
</typedef>
1414

15-
<artifact:remoteRepository id="java.net" url="https://maven-repository.dev.java.net/nonav/repository"
16-
layout="legacy"/>
17-
1815
<artifact:dependencies pathId="compile.classpath">
19-
<remoteRepository refid="java.net" />
2016
<dependency groupId="javax.xml.soap" artifactId="saaj-api" version="1.3"/>
2117
<dependency groupId="com.sun.xml.wss" artifactId="xws-security" version="2.0-ea2"/>
2218
<dependency groupId="com.sun.org.apache.xml.security" artifactId="xmlsec" version="2.0"/>
2319
</artifact:dependencies>
2420

2521
<artifact:dependencies pathId="runtime.classpath">
26-
<remoteRepository refid="java.net" />
2722
<dependency groupId="com.sun.xml.messaging.saaj" artifactId="saaj-impl" version="1.3"/>
2823
</artifact:dependencies>
2924

samples/airline/hsqldb/build.xml

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
<?xml version="1.0"?>
2+
3+
<project name="spring-ws-airline-sample-jax-ws-client" default="run-hsqldb" xmlns:artifact="urn:maven-artifact-ant">
4+
5+
<target name="init">
6+
<typedef resource="org/apache/maven/artifact/ant/antlib.xml" uri="urn:maven-artifact-ant">
7+
<classpath>
8+
<pathelement location="${basedir}/../../maven-artifact-ant-2.0.4-dep.jar"/>
9+
</classpath>
10+
</typedef>
11+
12+
13+
<artifact:dependencies pathId="classpath">
14+
<dependency groupId="hsqldb" artifactId="hsqldb" version="1.8.0.7"/>
15+
</artifact:dependencies>
16+
</target>
17+
18+
<target name="clean">
19+
<delete>
20+
<fileset dir="${basedir}">
21+
<include name="airline.*"/>
22+
</fileset>
23+
</delete>
24+
</target>
25+
26+
<target name="run-hsqldb" depends="init">
27+
<java classname="org.hsqldb.Server" fork="true" failonerror="true">
28+
<classpath refid="classpath"/>
29+
<arg line="-database.0 airline -dbname.0 airline"/>
30+
</java>
31+
32+
</target>
33+
34+
35+
</project>

samples/airline/pom.xml

Lines changed: 145 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,148 @@
99
<artifactId>airline</artifactId>
1010
<packaging>war</packaging>
1111
<name>Spring WS Airline Sample</name>
12+
<profiles>
13+
<profile>
14+
<id>hsqldb</id>
15+
<activation>
16+
<activeByDefault>true</activeByDefault>
17+
</activation>
18+
<dependencies>
19+
<dependency>
20+
<groupId>hsqldb</groupId>
21+
<artifactId>hsqldb</artifactId>
22+
<version>1.8.0.7</version>
23+
<scope>runtime</scope>
24+
</dependency>
25+
</dependencies>
26+
<properties>
27+
<!-- Change these properties to reflect your HSQLDB connection settings -->
28+
<jdbc.driverClassName>org.hsqldb.jdbcDriver</jdbc.driverClassName>
29+
<jdbc.username>sa</jdbc.username>
30+
<jdbc.password></jdbc.password>
31+
<jdbc.url>jdbc:hsqldb:hsql://localhost/airline</jdbc.url>
32+
<hibernate.dialect>org.hibernate.dialect.HSQLDialect</hibernate.dialect>
33+
</properties>
34+
<build>
35+
<plugins>
36+
<plugin>
37+
<groupId>org.codehaus.mojo</groupId>
38+
<artifactId>sql-maven-plugin</artifactId>
39+
<dependencies>
40+
<dependency>
41+
<groupId>hsqldb</groupId>
42+
<artifactId>hsqldb</artifactId>
43+
<version>1.8.0.7</version>
44+
</dependency>
45+
</dependencies>
46+
<configuration>
47+
<driver>${jdbc.driverClassName}</driver>
48+
<url>${jdbc.url}</url>
49+
<username>${jdbc.username}</username>
50+
<password>${jdbc.password}</password>
51+
<srcFiles>
52+
<srcFile>${basedir}/src/main/sql/hsqldb/airline-schema.sql</srcFile>
53+
<srcFile>${basedir}/src/main/sql/airline-dataload.sql</srcFile>
54+
</srcFiles>
55+
</configuration>
56+
</plugin>
57+
</plugins>
58+
</build>
59+
</profile>
60+
<profile>
61+
<id>mysql</id>
62+
<dependencies>
63+
<dependency>
64+
<groupId>mysql</groupId>
65+
<artifactId>mysql-connector-java</artifactId>
66+
<version>5.0.4</version>
67+
</dependency>
68+
</dependencies>
69+
<properties>
70+
<!-- Change these properties to reflect your MySQL connection settings -->
71+
<jdbc.driverClassName>com.mysql.jdbc.Driver</jdbc.driverClassName>
72+
<jdbc.username>airline</jdbc.username>
73+
<jdbc.password>airline</jdbc.password>
74+
<jdbc.url>jdbc:mysql://localhost/airline</jdbc.url>
75+
<hibernate.dialect>org.hibernate.dialect.MySQLInnoDBDialect</hibernate.dialect>
76+
</properties>
77+
<build>
78+
<plugins>
79+
<plugin>
80+
<groupId>org.codehaus.mojo</groupId>
81+
<artifactId>sql-maven-plugin</artifactId>
82+
<dependencies>
83+
<dependency>
84+
<groupId>mysql</groupId>
85+
<artifactId>mysql-connector-java</artifactId>
86+
<version>5.0.4</version>
87+
</dependency>
88+
</dependencies>
89+
<configuration>
90+
<driver>${jdbc.driverClassName}</driver>
91+
<url>${jdbc.url}</url>
92+
<username>${jdbc.username}</username>
93+
<password>${jdbc.password}</password>
94+
<srcFiles>
95+
<srcFile>${basedir}/src/main/sql/mysql/airline-schema.sql</srcFile>
96+
<srcFile>${basedir}/src/main/sql/airline-dataload.sql</srcFile>
97+
</srcFiles>
98+
</configuration>
99+
</plugin>
100+
</plugins>
101+
</build>
102+
</profile>
103+
<profile>
104+
<id>postgresql</id>
105+
<dependencies>
106+
<dependency>
107+
<groupId>postgresql</groupId>
108+
<artifactId>postgresql</artifactId>
109+
<version>8.1-407.jdbc3</version>
110+
</dependency>
111+
</dependencies>
112+
<properties>
113+
<!-- Change these properties to reflect your PostgreSQL connection settings -->
114+
<jdbc.driverClassName>org.postgresql.Driver</jdbc.driverClassName>
115+
<jdbc.username>airline</jdbc.username>
116+
<jdbc.password>airline</jdbc.password>
117+
<jdbc.url>jdbc:postgresql://localhost/airline</jdbc.url>
118+
<hibernate.dialect>org.hibernate.dialect.PostgreSQLDialect</hibernate.dialect>
119+
</properties>
120+
<build>
121+
<plugins>
122+
<plugin>
123+
<groupId>org.codehaus.mojo</groupId>
124+
<artifactId>sql-maven-plugin</artifactId>
125+
<dependencies>
126+
<dependency>
127+
<groupId>postgresql</groupId>
128+
<artifactId>postgresql</artifactId>
129+
<version>8.1-407.jdbc3</version>
130+
</dependency>
131+
</dependencies>
132+
<configuration>
133+
<driver>${jdbc.driverClassName}</driver>
134+
<url>${jdbc.url}</url>
135+
<username>${jdbc.username}</username>
136+
<password>${jdbc.password}</password>
137+
<srcFiles>
138+
<srcFile>${basedir}/src/main/sql/postgresql/airline-schema.sql</srcFile>
139+
<srcFile>${basedir}/src/main/sql/airline-dataload.sql</srcFile>
140+
</srcFiles>
141+
</configuration>
142+
</plugin>
143+
</plugins>
144+
</build>
145+
</profile>
146+
</profiles>
12147
<build>
148+
<resources>
149+
<resource>
150+
<directory>src/main/resources</directory>
151+
<filtering>true</filtering>
152+
</resource>
153+
</resources>
13154
<plugins>
14155
<plugin>
15156
<groupId>org.apache.maven.plugins</groupId>
@@ -155,9 +296,10 @@
155296
</exclusions>
156297
</dependency>
157298
<dependency>
158-
<groupId>mysql</groupId>
159-
<artifactId>mysql-connector-java</artifactId>
160-
<version>5.0.4</version>
299+
<groupId>hsqldb</groupId>
300+
<artifactId>hsqldb</artifactId>
301+
<version>1.8.0.7</version>
302+
<scope>test</scope>
161303
</dependency>
162304
<!-- Various dependencies -->
163305
<dependency>

samples/airline/readme.txt

Lines changed: 22 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -8,29 +8,34 @@ Features a web service on top of an airline reservation system, backed by a data
88
Marshalling techniques (JAXB 1), and JDOM in combination with XPath queries to pull information from a message. All
99
messages follow the airline.xsd schema in src/main/webapp.
1010

11-
Multiple clients are available, showing interoperability with Axis 1, SAAJ, C#, JMS and more.
11+
Multiple clients are available, showing interoperability with Axis 1, SAAJ, C#, and more.
1212

1313
2. INSTALLATION
1414

15-
The Airline sample is a normal web application that connects to a database of your choice.
15+
The Airline sample is a normal web application that connects to a database of your choice. By using Maven2 profiles, it
16+
supports three databases: HSQLDB (the easiest to setup), MySQL, or PostgreSQL.
1617

17-
1. Create a database using one of the scripts in src/etc/db. First, initialize the database using either the MySQL or
18-
PostgreSQL initDB.sql script, and after that run src/etc/db/populateDb.sql.
19-
2. Adjust the jdbc.properties in src/main/resources/org/springframework/ws/samples/airline/dao
20-
to reflect your database connection settings. By default MySQL is used.
21-
3. Adjust the hibernate.properties in src/main/resources/org/springframework/ws/samples/airline/dao/hibernate. By
22-
default MySQL is used.
23-
4. (Optional) Adjust the applicationContext-ws-jms.xml in src/main/resources/org/springframework/ws/samples/airline/ws/
24-
to reflect your JMS connections settings. By default ActiveMQ 2.1 is used. Make sure to start ActiveMQ before
25-
4. run "mvn package" and deploy the war file generated in target; or run "mvn jetty:run" to run the sample
26-
using the Jetty Web container built into Maven 2.
27-
5.
18+
To execute the sample with the supplied HSQLDB:
2819

29-
Note that both MySQL drivers are linked in using Maven so you don't have include these in your server if you're using
30-
this database.
20+
1. Start a command shell in the subdirectory hsqldb, and run "ant". This starts a HSQLDB server with a database named
21+
airline.
22+
2. Run "mvn sql:execute" to create the schema and insert data into the database.
23+
3. Run "mvn jetty:run" to run the sample in the Jetty6 Web container.
24+
25+
To execute the sample with MySQL or PostgreSQL:
26+
27+
1. Change the properties in the pom.xml file to reflect your database connection settings. There are three profiles
28+
(one for each supported database), so make sure to edit the right section. The areas to change are indicated with
29+
comments.
30+
2. Run "mvn -P <database> sql:execute", where <database> is "mysql" or "postgresql", to create the schema and insert
31+
data into the database.
32+
3. Run "mvn -P <database> jetty:run", where <database> is "mysql" or "postgresql", to run the sample in the Jetty6
33+
Web container.
34+
35+
To create a war file instead of running in Jetty, follow the steps above, but replace the "jetty:run" with "package" in
36+
the last step.
3137

3238
3. THE CLIENTS
3339

3440
The client directory contains a number of sample clients. More instructions are provided in the readme files in the
35-
directories.
36-
41+
directories.

samples/airline/src/etc/db/mysql/dropDB.sql

Lines changed: 0 additions & 1 deletion
This file was deleted.

samples/airline/src/etc/db/postgresql/dropDB.sql

Lines changed: 0 additions & 6 deletions
This file was deleted.
Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
11
# Properties file with hibernate-related settings.
22

3-
#hibernate.dialect=org.hibernate.dialect.HSQLDialect
4-
hibernate.dialect=org.hibernate.dialect.MySQLInnoDBDialect
5-
#hibernate.dialect=org.hibernate.dialect.PostgreSQLDialect
3+
hibernate.dialect=${hibernate.dialect}
64
hibernate.cache.provider_class=org.hibernate.cache.HashtableCacheProvider
75
#hibernate.hbm2ddl.auto=create-drop
86
#hibernate.show_sql=true

0 commit comments

Comments
 (0)