Skip to content

First try – Spring travel example

December 15, 2011

Being the reference for the use case of tagsobe, a natural first step was to compile the travel example from spring.

svn export spring

The export is fast and places 1238 files and directories of 5.8MB on my disk. Phew – it is a maven project – so cd to spring and try

mvn install

In more than 7 minutes, this commands downloaded 174 libraries, before, with a relief, I read BUILD SUCCESSFUL. Out of the box!

The result is target/travel.war of 20MB size. To give it a second shot, I did

rm -rf target

mvn install

This time of course only 22 seconds were used. To go on, I copied the result to a freshly installed tomcat:

unzip unzip
cp spring/target/travel.war apache-tomcat-7.0.23/webapps/
cd apache-tomcat-7.0.23/bin/
chmod u+x
./ run

Navigating the browser to http://localhost:8080, I was surprised seeing the application already running fine. What’s going on? – A quick peek into src/main/resources/META-INF/persistence.xml and …/META-INF/spring/data.xml (obvious, eh?) revealed hibernate was switched on an in-memory HSQLDB database.

We want an in-memory-database later, but surely a technology-agnostic one – SQLite, maybe.

For the moment, we stick with HSQLDB and check that the new app can correctly be benched by the test script (should be, because the test script was written against the online version of the app).

But oh! – an error occurred in the second step:

$ java -jar tagsobe.jar http://localhost:8080/travel/hotels/search
 GET /travel/hotels/search 0parse 324load
 GET /travel/hotels/%2Ftravel%2Fhotels%3Bjsessionid%3DDE26CE13099A918A1306921EB9056ECA?=Find+Hotels&searchString=a&pageSize=5 140parse 5load
java.lang.IllegalStateException: Response code: 400
 at org.tagbrowser.api.TagBrowser.request(

WTF? Error Code 400? – Of course no trace of that in the apps logs. A closer look revealed, the code does not exactly match the online sample

After changing the TestScript – a step that should not happen too often – to:

TagBrowser browser = new TagBrowser();
browser.submit(0, "a", "Find Hotels");
browser.clickName("View Hotel");
browser.submit(0, "Book Hotel");
browser.submit(0, "keith", "melbourne", "Login");
browser.submit(0, "12-01-2041", "12-02-2041", "false", "OCEAN_VIEWdfg",
"OCEAN_VIEWdgf", "OCEAN_VIEW", "1111222233334444",
"KEITH MELBOURNE", "1", "1", "2010", "Proceed");
browser.submit(0, "Confirm");
browser.contains("Current Hotel Bookings");

the example could be scanned successfully:

GET /travel/hotels/search 0parse 376load
GET /travel/hotels;jsessionid=41F09BE304E905D1A7129CEA28154E7B?=Find+Hotels&searchString=a&pageSize=5 119parse 9load
GET /travel/hotels/1 8parse 6load
GET /travel/users/login 3parse 19load
POST /travel/hotels/booking?execution=e1s1 5parse 41load
POST /travel/hotels/booking?execution=e1s2 9parse 31load
POST /travel/hotels/search 5parse 36load

From → Spring

Leave a Comment

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s

%d bloggers like this: