Testing Web Applications with VirtualBox Demo (10 Minutes)
Description
This demos shows the benefits of using VirtualBox to test your applications on operating systems other than your primary development system (which is OpenSolaris, of course).
We start with Apache Roller as our Java development project. Deployed locally on OpenSolaris we can test it's appearance and operation on Unbutu and Windows XP. We also show the Roller development environment set up on Ubuntu, yet we can configure the database to remain on OpenSolaris. Finally, we create one of the web sample applications on OpenSolaris, and demonstrate how easy it is to deploy it remotely to Ubuntu.
OpenSolaris Versions Supported
OpenSolaris 2008.05
Points to Hit
- With VirtualBox, it's free and painless to test your applications on other operating systems.
- Application components (database, web container, etc.) can be split and tested across operating systems.
- "Remote" deployment can be tested to other operating systems.
- Roller fails to deploy to GlassFish.
Demo Prep
One Time
- Install VirtualBox
- Install Ubuntu (or your favorite Linux) as a Guest OS including the Guest Additions.
- Configure Ubuntu with Host Interface Networking (rather than the default NAT).
- Configure Ubuntu to use a static IP address. Add that address, along with the Ubuntu server's host name, to your OpenSolaris /etc/hosts file.
- Install Windows XP as a Guest OS, including the Guest Additions.
- Install Google Chrome on Windows
- Install the Roller application on OpenSolaris and Ubuntu, following the setup steps from this NetBeans profiler demo.
- Install the NetBeans ready sample applications from the Pro AJAX and Java Frameworks book. You can get them from Exercise 2 of Sang Shin's Ajax Examples Hands on Lab.
- Install Sun JDK 6 by running sudo apt-get install sun-java6-jdk.
- Install GlassFish on Ubuntu
Pre-demo
- Have Ubuntu in a Saved state, preferrably with GlassFish running (asadmin start-domain domain1)
- Have Windows XP in a Saved state
- Start NetBeans
- Open the Roller Web Project
Gotchas
- If you will not have a network connection, you need to configure OpenSolaris with a static IP address, so the Ubuntu will have something to reference OpenSolaris.
- Edit /etc/nwam/llp
- Comment out "<device dhcp>"
- Add "<device static <ip address>>"
- For example:
#yukonx0 dhcp
yukonx0 static 10.0.1.175 - Restart NWAM: svcadm restart nwam
- I find it difficult to get both Unbutu and Windows XP running at the same time w/out running into memory constraints. And I have 4 GB.
Demo
- Run the Roller Web project. Most everyone should be familiar with the basic interface.
- Create a Weblog (this page has some DHTML).
- Enter a long handle - notice how the page dynamically adjusts.
- View the themes - they dynamically update.
Windows XP
- Start Windows XP from its saved state
- Start IE and point to roller-test running on OpenSolaris: http:/<ip address>/roller-test.
- Create a Weblog
- Enter a long handle - it just gets truncated
- View the themes. With the Theme combo-box selected, notice you can scroll through them quickly with your mouse wheel or arrow keys.
Ubuntu
- Start Ubuntu from it's saved state (you may need to shut down Windows), open Firefox and launch roller.
- Create a Weblog
- Enter a long handle - notice it wraps (rather than the page adjusting)
- View the themes - they cannot be scrolled the mouse wheel.
Remote Deployment
- Start GlassFish on Ubuntu using asadmin start-domain domain1
- Return to OpenSolaris and add a new remote Server, "GlassFish Ubuntu".
- Use the server menu to view the Admin Console for the server running on Ubuntu.
- Open the chapter04 Foundations of Ajax sample project. Set it's runtime server to GlassFishUbuntu.
- Run the project.
- Run the project from w/in Ubuntu using localhost (to prove it's been deployed there)
- Test the project from Windows XP to show cross VM networking.
- Start by launching the GlassFish Admin Console by going to http://<ip address>:4848.
- From the Admin Console, launch the sample web application
- Compare how the AjaxTags Autocomplete example behaves on Windows XP and Google Chrome.
Demo Reset
These are the necessary steps to take in order to successfully run the demo again on the same machine.
- Undeploy the Roller from Tomcat.
- Set the runtime server of the chapter04 project back to the local GlassFish server.
- Delete the remote GlassFish server from the Services Window.