I downloaded a load of Photomatix pre-sets from http://alikgriffin.com/. They came as an archive of .xmp files without any instructions on how to install them.

Fortunately I had already created and saved a pre-set so I just had to locate that on the file system. I found it in my ~/Application Support/Photmatix/Presets folder. Then I just dragged the contents of the archive into that folder and now I have 25 shiny new pre-sets to play with.

I am pleased to announce the availability of the In-Memory Database Maven Plugin version 1.4.0.

This release adds two new configuration settings:

  • <skip/> can be used to skip executing the plugin goals.
  • <attributes/> can be used to append additional options to the JDBC url connection string.

Using <skip/>

The <skip/> configuration option can be specified in the <configuration/> section for the plugin or an individual plugin execution. Typically this would be used to disable unit or integration tests:

<skip>${maven.test.skip}</skip>

The same can also be achieved passing the inmemdb.skip system property on the Maven command line:

$ mvn -Dinmemdb.skip clean install

Using <attributes/>

Additional attributes can be appended to the JDBC URL connection string using the <attributes/> element nested inside the <configuration/> section for the plugin or an individual plugin execution. For example:

<attributes>
    <territory>ga_IE</territory>
</attributes>

Maven Central Coordinates

The In-Memory Database Maven Plugin has been published in Maven Central at the following coordinates:

<plugin>
    <groupId>com.btmatthews.maven.plugins.inmemdb</groupId>
    <artifactId>inmemdb-maven-plugin</artifactId>
    <version>1.4.0</version>
</plugin>

Credits

This project contains contributions from:

License

The In-Memory Database Maven Plugin is made available under the Apache License and the source code is hosted on GitHub at https://github.com/bmatthews68/inmemdb-maven-plugin.

The LDAP Maven Plugin is a Maven plugin that can:

  • Import/export data to/from a LDAP directory server. Both the LDIF and DSML formats are supported.
  • Launch and shutdown a LDAP directory server in the Maven build life-cycle. The plugin supports the following LDAP directory servers:

Importing or exporting data

The plugin provides the following goals to import or export content from a LDAP directory server:

  • load is used to load content from a file into a LDAP directory server.
  • dump is used to dump content to a file from a LDAP directory sever.

The following file formats are supported:

  • LDIF – LDAP Directory Interchange Format
  • DSML – Directory Services Markup Language

LDAP Data Interchange Format (LDIF)

Import

The following POM fragment demonstrates how to load content into a LDAP directory server from a LDIF formatted file using the load goal of the LDAP Maven Plugin.

Export

The following POM fragment demonstrates how to export content from a LDAP directory server to a LDIF formatted file using the dump goal of the LDAP Maven Plugin.

Directory Service Markup Language (DSML)

Import

The following POM fragment demonstrates how to load content into a LDAP directory server from a DSML formatted file using the load goal of the LDAP Maven Plugin.

Export

The following POM fragment demonstrates how to export content from a LDAP directory server to a DSML formatted file using the dump goal of the LDAP Maven Plugin.

Running an LDAP Server in the build life-cycle

pom.xml

The following POM fragment uses the run goal to launch an embedded LDAP directory server prior to the execution of the integration tests and then uses the stop goal to shutdown the embedded LDAP directory server upon completion of the integration tests.

Connecting in Java

The following LDAP client libraries can be used to connect to the embedded LDAP server:

The LDAPUnit library provides an assortment of assertion and verification methods for use in unit and integration test cases.

Maven Central Coordinates

The LDAP Maven Plugin has been published in Maven Central at the following coordinates:

License & Source Code

The LDAP Maven Plugin is made available under the Apache License and the source code is hosted on GitHub at https://github.com/bmatthews68/ldap-maven-plugin.

I am pleased to announce the availability of the In-Memory Database Maven Plugin version 1.3.0.  This Maven plugin can be used to launch and shutdown an embedded in-memory SQL database within the Maven build life-cycle. During the launch the database can be seeded using DDL/DML scripts and/or DBUnit data sets.

The following database implementations are supported:

  • derby – An embedded/in-memory Apache Derby database.
  • h2 – An embedded/in-memory H2 database.
  •  hsqldb – An embedded/in-memory HSQLDB database.

The following source file formats are supported:

  • .sql – Contains DDL/DML SQL commands to create the database structure and/or insert test data
  • .csv – A file containing a comma separated value (CSV) data set. The first row of the data set contains the column names and the file name corresponds to the table name.
  • .xml – A file containing aflat DBUnit XML data set.
  • .dbunit.xml - A file containing aDBUnit XML data set.
  • .xls – A Microsoft Excel spread sheet containing one or more work sheets. The name of the work sheet correspond to the table name and the first row of each work sheet contains the column names.

Example

The In-Memory Database Maven Plugin can be used to automate integration tests having a dependency on an external database server.

pom.xml

The POM here is from taken from the webpp integration test for the In-Memory Database Maven Plugin.

<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:schemaLocation="

http://maven.apache.org/POM/4.0.0

             http://maven.apache.org/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>
    <groupId>webapp</groupId>
    <artifactId>webapp</artifactId>
    <version>1.0.0-SNAPSHOT</version>
    <packaging>war</packaging>
    <build>
        <plugins>
            <plugin>
                <groupId>com.btmatthews.maven.plugins.inmemdb</groupId>
                <artifactId>inmemdb-maven-plugin</artifactId>
                <version>1.3.0</version>
                <configuration>
                    <monitorKey>inmemdb</monitorKey>
                    <monitorPort>11527</monitorPort>
                </configuration>
                <executions>
                    <execution>
                        <id>run</id>
                        <goals>
                            <goal>run</goal>
                        </goals>
                        <phase>pre-integration-test</phase>
                        <configuration>
                            <daemon>true</daemon>
                            <type>derby</type>
                            <database>test</database>
                            <username>sa</username>
                            <password></password>
                            <sources>
                                <script>
                                    <sourceFile>src/test/resources/create_database.sql</sourceFile>
                                </script>
                                <dataSet>
                                    <sourceFile>src/test/resources/users.dbunit.xml</sourceFile>
                                </dataSet>
                            </sources>
                        </configuration>
                    </execution>

The In-Memory Database Maven Plugin is configured here to launch an in-memory Apache Derby database server as a daemon process during the pre-integration-test phase of the build life cycle. The database is initialised with a database schema and some seed data.

                    <execution>
                        <id>stop</id>
                        <goals>
                            <goal>stop</goal>
                        </goals>
                        <phase>post-integration-test</phase>
                    </execution>

The In-Memory Database Maven Plugin is configured here to shutdown the in-memory Apache Derby database server during the post-integration-test phase of the build life cycle.

                </executions>
            </plugin>
            <plugin>
                <groupId>org.mortbay.jetty</groupId>
                <artifactId>jetty-maven-plugin</artifactId>
                <version>8.1.8.v20121106</version>
                <configuration>
                    <stopKey>jetty</stopKey>
                    <stopPort>19080</stopPort>
                    <daemon>true</daemon>
                    <webApp>
                        <contextPath>/</contextPath>
                    </webApp>
                    <jettyXml>src/test/jetty/jetty.xml</jettyXml>
                    <connectors>
                        <connector implementation="org.eclipse.jetty.server.nio.SelectChannelConnector">
                            <port>9080</port>
                            <maxIdleTime>60000</maxIdleTime>
                        </connector>
                    </connectors>
                </configuration>
                <executions>
                    <execution>
                        <id>start-jetty</id>
                        <phase>pre-integration-test</phase>
                        <goals>
                            <goal>run</goal>
                        </goals>
                    </execution>

The Jetty Maven Plugin is configured here to launch the Jetty servlet container as a daemon process during the pre-integration-test phase of the build life cycle.

                    <execution>
                        <id>stop-jetty</id>
                        <phase>post-integration-test</phase>
                        <goals>
                            <goal>stop</goal>
                        </goals>
                    </execution>

The Jetty Maven Plugin is configured here to shutdown the Jetty servlet container during the post-integration-test phase of the build life
cycle.

                </executions>
                <dependencies>
                    <dependency>
                        <groupId>org.apache.derby</groupId>
                        <artifactId>derbyclient</artifactId>
                        <version>10.9.1.0</version>
                    </dependency>
                    <dependency>
                        <groupId>commons-dbcp</groupId>
                        <artifactId>commons-dbcp</artifactId>
                        <version>1.3</version>
                    </dependency>
                </dependencies>
            </plugin>

The org.apache.derby:derbyclient and commons-dbcp:commons-dbcp dependencies are required in order to define the data source that connects to the in-memory Apache Derby database.

            <plugin>
                <artifactId>maven-failsafe-plugin</artifactId>
                <version>2.12.4</version>
                <executions>
                    <execution>
                        <goals>
                            <goal>integration-test</goal>
                            <goal>verify</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>

The Maven Failsafe Plugin is used to execute the integration tests during the integration-test phase of the build life cycle.

        </plugins>
    </build>
    <dependencies>
        <dependency>
            <groupId>javax.servlet</groupId>
            <artifactId>javax.servlet-api</artifactId>
            <version>3.0.1</version>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>com.btmatthews.selenium.junit4</groupId>
            <artifactId>selenium-junit4-runner</artifactId>
            <version>1.0.4</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>junit</groupId>
            <artifactId>junit</artifactId>
            <version>4.11</version>
            <scope>test</scope>
        </dependency>
    </dependencies>
</project>

The com.btmatthews.selenium.junit4:selenium-junit-runner and junit:junit dependencies are required by the integration tests.

jetty.xml

Add the following fragment of XML to the jetty.xml to define a data source for the test database.

<New class="org.eclipse.jetty.plus.jndi.Resource">
    <Arg>
        <Ref id="Server" />
    </Arg>
    <Arg>jdbc/test</Arg>
    <Arg>
        <New class="org.apache.commons.dbcp.BasicDataSource">
            <Set name="username">sa</Set>
            <Set name="password"></Set>
            <Set name="url">jdbc:derby://localhost/memory:test</Set>
            <Set name="driverClassName">org.apache.derby.jdbc.ClientDriver</Set>
        </New>
    </Arg>
</New>

web.xml

Add the following <resource-ref> to the web.xml to make the data source defined in
jetty.xml available inside the web application:

<resource-ref>
    <res-ref-name>jdbc/test</res-ref-name>
    <res-type>javax.sql.DataSource</res-type>
    <res-auth>Container</res-auth>
</resource-ref>

Maven Central Coordinates

The In-Memory Database Maven Plugin has been published in Maven Central at the following coordinates:

<plugin>
    <groupId>com.btmatthews.maven.plugins.inmemdb</groupId>
    <artifactId>inmemdb-maven-plugin</artifactId>
    <version>1.3.0</version>
</plugin>

Credits

This project contains contributions from:

License & Source Code

The In-Memory Database Maven Plugin is made available under the Apache License and the source code is hosted on GitHub at https://github.com/bmatthews68/inmemdb-maven-plugin.

On a recent project I had problems deploying a web application built on the Struts 2 MVCframework to a fresh WebSphere installation. I wasted a lot of time labouring under the incorrect assumption (for once) that the architectural changes I had introduced in the latest sprint were the cause of my troubles.

But it turned out to be an environmental issue. We were deploying Struts 2 as a servlet filter and out of the box WebSphere does not support HTTP requests that are served by a servlet filter. A custom property called com.ibm.ws.webcontainer.invokefilterscompatibilty must be set for the web container. I guess I should have just deployed straight to the UAT environment!

Here is the procedure for setting the com.ibm.ws.webcontainer.invokefilterscompatibility custom property:

  1. In the administrative console click Servers > Application Servers > server_name> Web Container Settings > Web Container.
  2. Under Additional Properties select Custom Properties.
  3. On the Custom Properties page, click New.
  4. On the settings page, enter com.ibm.ws.webcontainer.invokefilterscompatibility in the Name field and true in the Value field.
  5. Click Apply or OK.
  6. Click Save on the console task bar to save your configuration changes.
  7. Restart the server.

On my current assignment we are developing a multi-tennant web application and are giving the individual tennants the ability to customize the look and feel of the application. We are using Jackrabbit to host the style sheets, images and scripts that for each of the look and feels.

Initially I tried to deploy Jackrabbit as using the Shared J2EE Resource deployment model on WebSphere 6.1. Due to a leathal cocktail of stupidity and environmental constraints I couldn’t get it working earlier in the project and decided to settle for the Application Bundle deployment model.

Now we need to have more that one instance of the application running in the test environment and we’ve had to finally figure out how to get the Shared J2EE Resource deployment model up and running.

It turned out to be a lot easier than I exepcted. In order to get Jackrabbit working I just needed to customize the ra.xml deployment descriptor from jackrabbit-jca-2.2.x.rar by changing the <transaction-support/> element to from XATransaction to NoTransaction.

This change is necessary because Jackrabbit does not support local transactions and actually raises an exception when called by WebSphere.

Rather than have to customise this by hand I a put together the Maven POM below to build custom RAR for me. You must place the ra.xml deployment descriptor in src/main/rar/META-INF.

The SpringBeanJobFactory allows you to inject properties from the scheduler context, job data map and trigger data entries into the job bean. But there is no way out of the box to inject beans from the application context.

So I came up with the factory bean below that extends the SpringBeanJobFactory to add auto-wiring support:

You can add Google Analytics to a site generated with the Maven Site Plugin as by adding a <googleAnalyticsAccountId/> element containing your Web Property ID.

I recently released Selenium JUnit 4 Runner. It is an extension for JUnit 4 providing a test runner to execute Selenium test cases. Both the Selenium 1.0 (Server) and 2.0 (Web Driver) APIs are supported.

Here is a very simple example:

@RunWith(SeleniumJUnit4ClassRunner.class)
    @WebDriverConfiguration
    public GoogleHomePageTest {

    @SeleniumWebDriver
    private WebDriver webDriver;

    @Test
    public void testGoogleSearch() {
        webDriver.navigate().to("http://www.google.com");
        assertEquals("Google", webDriver.getTitle());
    }
}

The Selenium JUnit 4 Class Runner launches the Selenium web driver or connects to the Selenium server before executing any methods annotated with @BeforeClass. It then autowires any members of the test class or method rules that have been annotated with @SeleniumBrowser or @SeleniumWebDriver.

Maven Coordinates

Selenium JUnit 4 Runner is available from Maven Central at the following coordinates:

<dependency>
    <groupId>com.btmatthews.selenium.junit</groupId>
    <artifactId>selenium-junit4-runner</artifactId>
    <version>1.0.0</version>
    <type>test</type>
</dependency>

The instructions below are based on Installing Maven 3 on Ubuntu 10.04 LTS Server from Luke Bourke. I am installing Maven 3.0.3 on Ubuntu 11.04 LTS Server with Oracle Java 6.

Download the Maven 3.0.3 binary distribution from your local mirror:

$ wget http://ftp.heanet.ie/mirrors/www.apache.org/dist/maven/binaries/apache-maven-3.0.3-bin.tar.gz

Uncompress the binary distribution and copy it to the /usr/local directory:

$ tar -zxf apache-maven-3.0.3-bin.tar.gz
$ sudo cp -R apache-maven-3.0.3 /usr/local

Create symbolic link in /usr/bin:

$ sudo ln -s /usr/local/apache-maven-3.0.3/bin/mvn /usr/bin/mvn