tirsdag 20. mai 2008

Architecture: Swing, Maven2, NetBeans etc.

Development setup

  • Maven
  • NetBeans, plugins

Modules: swing-gui (client), service (ejb, ws, xml-dummies), model, parent
  • Unit tests, test-data
  • Code harness
  • Libraries / Frameworks: SWAF, Hibernate

Maven in NetBeans

I use NetBeans (6.1 ) with maven plugin, as described here. should maybe read 10 Steps to Happiness with Maven and the NetBeans Platform.
Maven is found on Apache site.

Swing

I found a host of useful examples on java2s, (with Outline=TreeTable examples) and in "Swing Hacks". I use some stuff from SwingLabs, check documentation.

MVC + Swing

I use Swing Application Framework, note that this Framework is "bleeding edge" according to self, but seeing it was used by Matisse NetBeans plugin, I concluded I might as well try it. (Alternatives: Eclipse RCP, NetBeans Platform, and Spring RCP (cf intro) and JGoodies).
I was pointed to Swing Fuse by this article on DI with Swing Fuse. Worth also to look up Google guice.

SDN has a nice article on Java SE Application Design With MVC.
On undo/redo from JavaWorld, or MVC-alternative.
Check Holub's More on getters and setters.

Unit testing

Unit testing the Swing GUI may not be worthwile, cf. jfcUnit Tests Swing GUIs (sidebar).
Injection of test data can be done with Castor.

More

Check the Capability Pattern.


torsdag 8. mai 2008

JNDI in JUnit tests

Sun har også en provider som kan brukes - se jndi-tutorial.
I ended up using Simple-JNDI - simple-jndi, thanks to:
James Strachan's Weblog
Injecting Constants as Spring Bean Properties | Unicon

My setup for lookup-key "java:comp/env/jdbc/ds":

jndi.properties:
java.naming.factory.initial=org.osjava.sj.SimpleContextFactory
org.osjava.sj.root=${project.build.directory}\\test-classes\\jndi
org.osjava.sj.colon.replace=--
org.osjava.sj.delimiter=/

src/test/resources/jndi/java--comp/env/jdbc/ds.properties:
type=javax.sql.DataSource
driver=oracle.jdbc.OracleDriver
url=${db.url}
user=${db.user}
password=${db.password}