Skip to main content

Alexis Moussine-Pouchkine on GlassFish Testing with Maven and JavaDB

Posted by editor on January 18, 2010 at 2:01 PM PST

In this week's Spotlight, we're highlighting Alexis Moussine-Pouchkine's recent post, Testing with the GlassFish Maven plugin and JavaDB Embedded. Alexis begins by referring back to some of his earlier posts, and showing how they're related to his current discussion:

Having GlassFish v3 usable in embedded mode made it easy to create a maven plugin with multiple goals (see this previous entry). This in turn makes it easy to configure the plugin for maven-driven unit testing.

Alexis goes illustrates how to do this with a code snippet that embeds the Maven plugin.

Most business applications that utilize an application server (for example, GlassFish) are going to also interface with a database. One of the advantages of the GlassFish Maven plugin is that you can configure it (within your pom.xml file) such that testing can be repeated without your having to stop and restart the app server. Working with a database, however, add complexity. In particular, if the testing requires stopping and restarting the database, then the automation gained by embedding Maven is basically lost: you still have to stop and restart a large application each time you need to rerun your test.

Solving this problem is the essential point of Alexis's post:

This is where JavaDB embedded can come in handy. The trick with an application server like GlassFish is that it's not enough to use the embedded driver (org.apache.derby.jdbc.EmbeddedDriver), you also need to reference an embedded JTA datasource. GlassFish v3 ships with one such datasource pre-configured: jdbc/__TimerPool so lazy as I am, I simply reused this in [my] setup...

Alexis demonstrates how this is done through the creation of a JPA persistence-unit, which lets his test create an embedded instance of JavaDB.

The closing statement of Testing with the GlassFish Maven plugin and JavaDB Embedded implies Alexis will be continuing to work on this project. I'll be watching for the next post.

In Java Today, Adam Bien asks Do We Need Stateless Session Bean Pooling?:

Pooling is still mentioned in the EJB 3.1 / Java EE 6 specification. The question is: do you have to care? The answers are: 1. Pooling is not a requirement, it is just an assumption: "...Since stateless session bean instances are typically pooled, the time of the client’s invocation of the create method need not have any direct relationship to the container’s invocation of the PostConstruct/ejbCreate method on the stateless session bean instance..."[EJB 3.1 spec, page 78]. 2. EJB container can either pool the instances or create a new one for each request...

Geerjan Wielenga discovered Modeling Computational Fluid Dynamics on the NetBeans Platform:

Yet another NetBeans Platform application is STAR-CCM+ by CD-adapco. For computational fluid dynamics modeling, "STAR-CCM+ delivers the entire engineering simulation process in a single integrated software environment. This unique approach brings unrivalled ease-of-use and automation to CAD preparation, meshing, model set-up and iterative design studies, enabling your engineers to deliver better results, faster. Innovations such as built-in surface-wrapping, advanced automated meshing (creating either polyhedral or predominantly hexahedral volume meshes) and the ability to 'copy and paste' components between models have quickly established STAR-CCM+ a reputation for producing high-quality results in a single code with minimum user effort...

The latest Java ME SDK Team Blog entry describes How to create a custom device:

I've got a question how to create custom emulator skins several times. It can't be answered in a few words, a short tutorial with an example will be the best way of explanation. Skin800x480The zip bundle here contains an example of standard CLDC/MIDP device with a display of 800 x 480 pixels and a few buttons. Due to lack of creativity I call the device "Skin800x480" and I have to admit it looks quite ugly. I will use it as a reference throughout this tutorial...

In today's Weblogs, Hamada Zahera posted get the best for SCJP ?:

Now SCJP certification become one of the most important sun certifications for java and it's simple to take it ,coz SUN will consider you as a Java programmer .There are many JProgrammers didn't take this certification although they are very well ,but taking this certification become more important than before specially to raise your rank as a programmer and also it's bonus for you to find better job than you have...

Aaron Houston covers SVJAVAFXJUG - JavaFX Layout Secrets with Amy Fowler 13 Jan 2010:

The Silicon Valley JavaFX JUG met for its 2nd meeting on Jan 13th, 2010. SVJAVAFXJUG once again had another rock star speaker in Amy Fowler. Amy Fowler is a Senior Staff Engineer at Sun Microsystems, and is one of the founding members of the Java Swing GUI Toolkit. . Over 70 people attended this meeting at Sun's Santa Clara Auditorium. Plus, 40 folks were watching remotely via ustream. ...

Fabrizio Giudici continues his exploration of The Finder Pattern:

In many previous code examples in this blog I've used the “Finder pattern”, that I've elected as one of my best practices (it's standard in all my new APIs and will be retrofitted to the old ones). Before moving on with more examples, I think it's high time I shortly introduced it formally....

In the Forums, exfalso, working with Java 3D, is seeing a NoSuchMethodError after changing Mainboard: "Hi! Today i tried to run my java3d-applet after changing the Mainboard of my notebook. Now I always get this exception when trying to load a vrml-model: Exception in thread "main" java.lang.NoSuchMethodError: vrml.node.Node..."

Johannes Wahle has an LWUIT problem, TabbedPane's keyPressed() (and some others) will never be called / hasFocus() is alway false: "Hello, since TabbedPane's requestFocus(), lets the internal list request the focus, all key events will be delivered to the list and keyPressed, keyReleased etc will never be called for TabbedPane. Thus the only way to customize TabbedPane's behavior is via SelectionListener..."

josealvarezdelara Can not deploy a simple JSF 2.0 app into GF V3: "Hi. When I try to deploy the EAR file I get the following exception: GRAVE: Exception while deploying the app java.lang.NullPointerException ..."

Our current Spotlight is Alexis Moussine-Pouchkine's Testing with the GlassFish Maven plugin and JavaDB Embedded: "Having GlassFish v3 usable in embedded mode made it easy to create a maven plugin with multiple goals (see this previous entry). This in turn makes it easy to configure the plugin for maven-driven unit testing. Here's an example..."

This week's Poll What is your favorite Oracle/Sun supported IDE?. Voting will end this Friday.

We've just published a new Feature Article, Maven Repository Managers for the Enterprise, by John Smart. We're also featuring Jeff Friesen's Reading Newsfeeds in JavaFX with FeedRead, in which Jeff demonstrates how to apply JavaFX's RSS and Atom newsfeed capabilities to create a snazzy little JavaFX app that can run stand-alone or in a browser.

The latest Java Mobility Podcast is Java Mobile Podcast 92: MIDP 3.0 in Depth: Tutorials and Demonstrations: Excerpts from the JavaOne 2009 MIDP 3.0 In Depth: Tutorials and Demonstrations session with Roger Riggs, Lakshmi Dontamsetti and Stan Kao.

Current and upcoming Java Events:

Registered users can submit event listings for the Events Page using our events submission form. All submissions go through an editorial review before being posted to the site.

Archives and Subscriptions: This blog is delivered weekdays as the Java Today RSS feed. Also, once this page is no longer featured as the front page of it will be archived along with other past issues in the Archive.

-- Kevin Farnham
O'Reilly Media