Black Pepper Blog

I am a senior consultant specialising in agile Java development. I am very interested in the craft of software development and how myself as an individual and the teams I am part of can improve

I wrote an entry previously about manipulating a GWT RichTextArea widget via Selenium. Recently I've been investigating moving to Selenium 2, also known as Selenium WebDriver.

As with Selenium 1 the mechanism for manipulating a RichTextArea widget in Selenium 2:

  1. Select the iframe that the RichTextArea resides in
  2. Type the required text into the body of the iframe
  3. Select the top level frame

Assuming a RichTextArea with an ID of "gwt-debug-text-editor" the following Java code fragment gives a concrete example of doing this


I have been writing a Selenium test for a GWT application, which on the whole has been working really well.  The only fly in the ointment was manipulating a GWT RichTextArea widget.

 A RichTextArea is not a standard HTML input component, rather it is emulated by the GWT framework, therefore the normal SeleniumRC method of type() doesn't work when applied to the RichTextArea directly. After some reading and experimentation it can be done as follows:

  1. Select the iframe that the RichTextArea resides in
  2. Type the required text into the body of the iframe
  3. Select the top level frame

 Assuming a RichTextArea with an ID of "gwt-debug-text-editor" the following Java code fragment gives a concrete example of doing this


I recently upgraded to Ubuntu 8.10, and everything works really well apart from the dual monitor support.

 My laptop has an NVidia graphics chip set. The laptop screen works well, but the attached second monitor was blank and did not show up in the display configuration applet (System > Preferences > Screen Resolution).

After installing the proprietary NVidia driver (required when I selected "Extra" level visual effects from the Appearance applet (System > Preferences > Appearance) the fix is relatively straight forward, a slight tweak to the /etc/X11/xorg.conf file, changing the the "Device" section to look like this:

Section "Device"
    Identifier  "Configured Video Device"
    Driver  "nvidia"
    Option  "NoLogo"    "True"

    ## JohnE added the following options for dual monitor support
    Option  "TwinView" "True"
    Option  "TwinViewOrientation" "RightOf"
    Option  "UseDisplayDevice" "CRT,DFP"
EndSection

I've come across an oddity in my functional tests for a GWT application I am working on.

The Selenium RC test I have should simulate a user clicking on a button, implemented as a GWT PushButton (com.google.gwt.user.client.ui.PushButton). The problem is that the click on the button never seemed to work using the following code

 
selenium.click(BUTTON_ID);
 

A GWT PushButton is not a standard HTML <input type="submit" ...> or a <button ...> rather it is a styled button constructed from DIV and other HTML tags.


When using Tomcat 5.5 for either development or production it is sometimes useful to have multiple instances of Tomcat running at the same time.

The instructions below allow you to set up the minimum tomcat configuration to run multiple Tomcat instances.

  1. Install a Tomcat 5.5 distribution. The CATALINA_HOME environment variable will point to this location.
  2. Create a directory that will be your Catalina base, identified by the environment variable CATALINA_BASE
  3. Within this directory create the following directories
    • logs
    • conf
    • webapps
  4. From your base Tomcat 5.5 distribution copy the following files from $CATALINA_HOME/conf to the conf directory that you have just created:
    • catalina.properties
    • context.xml
    • server.xml
    • tomcat-users.xml
    • web.xml

With this structure one can now run Tomcat. Open a terminal, ensure that the environment variable CATALINA_HOME is set to point at the directory created in (1) above, set the environment variable CATALINA_BASE to point at the directory created in (2) above.


I've recently been using JPA for the persistence layer of a project, and I'm liking it a lot. As I am a firm believer in TDD I've been applying this to the persistence layer of my application, and I thought that I'd share my approach to this.

The persistence layer uses Hibernate as the JPA provider and for test purposes this is great as it allows the RDBMS to be changed with relative ease.

In order to test the integration of the JPA provider with an RDBMS I will be using HSQLDB as the the RDBMS. This has the benefit of having a very lightweight in-memory execution model that makes it quick and easy to set up and tear down the entire database infrastructure. HSQLDB won't actually be the production RDBMS (this is likely to be MySQL), however the JPA/Hibernate combination makes it fairly trivial to use different RDBMS engines.


Agile development processes provide several core disciplines that affect the overall quality of the system under construction. One of the fundamental disciplines in agile development is that of pair programming (“pairing”).