Team, I'd like to switch to Brian Matthew's inmemdb-maven-plugin (https://github.com/bmatthews68/inmemdb-maven-plugin) for our JUnit and mvn jetty:run testing. It handles the in-memory Derby database that runs while we activate our tests. This will allow us to delete the org.apache.roller.derby.ant.StartDerbyTask and .StopDerbyTask classes, as well as the maven-antrun-plugin activation of these classes in our pom.xml.

In its place, in app/pom.xml this is all we'll need to add (you can add this to the pom and test it now if you'd like, mvn clean install & mvn jetty:run -- but will need right now to use EclipseLink for the latter):

            <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>
                        <phase>test-compile</phase>
                        <goals>
                            <goal>run</goal>
                        </goals>
                        <configuration>
                            <daemon>true</daemon>
                            <type>derby</type>
<database>rollerdb</database>
                            <username>APP</username>
                            <password>APP</password>
                            <port>3223</port>
                            <sources>
                                <script>
<sourceFile>${pom.basedir}/target/dbscripts/derby/createdb.sql</sourceFile>
                                </script>
                            </sources>
                        </configuration>
                    </execution>
                    <execution>
                        <id>stop</id>
                        <phase>package</phase>
                        <goals>
                            <goal>stop</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>

It runs almost 10% faster than the Ant stuff (mvn clean install 1:14 vs 1:07 with EclipseLink, 1:24 vs. 1:16 with Hibernate on my machine), that said we could probably optimize our present start and stop classes to make that difference much smaller.

I tested it on Saturday and submitted a couple of improvement requests (ability to specify port and to suppress the empty derby.log file generated), which were quickly incorporated and a new release version put on Central (1.3) today. This new version has two minor drawbacks (which I just submitted two more issues on #12 and #13 here: [1]), it unfortunately requires Maven 3.0.5 as the minimum, which Jenkins handles but would require some people to upgrade on their machine. Also, I requested that an option to still generate the derby.log file in case we ever need to activate Derby SQL statement logging during the tests (right now the fallback is to use version 1.2 when we need that level of debugging.)

WDYT?

Regards,
Glen

[1] https://github.com/bmatthews68/inmemdb-maven-plugin/issues

Reply via email to