Tuesday, July 24, 2007

NetBeans Modules

I'd like to sum up chapter three and four of my relatively new book "Rich Client Programming - Plugging into the NetBeans Platform". It is about all the different types of modules which the Platform provides and when you should use each of it.

End-User Interface Module
No other module depends on this kind of module.

Simple Library
Other modules can depend on this type of module. (E.g. Apache Commons Collection)

Modular Library
There is a strict separation of API (specification) and it's implementation. There are at least two modules necessary to support this requirement, one for the API (incl. Documentation) and one for the implementation.

Three basic types of modules in the NetBeans runtime container

User-Visible Functionality – Director of the enablement state of other modules.

Without them nothing works. No User-Visible functionality. Only used by other libraries. Out of control of end users.

Eager modules are enabled as soon as possible. Eager modules cannot be disabled directly by the user. Bridges functionality between two independent modules.

Monday, July 23, 2007

And again ...

... a very felicitous family-party. We celebrated my uncle's 60th birthday in Franzensdorf with a lot of presies, food, and beverages (as always ;o). And here are some of the pictures which my mother took.

From Onkel Sepp 60er

From Onkel Sepp 60er

From Onkel Sepp 60er

From Onkel Sepp 60er

From Onkel Sepp 60er

From Onkel Sepp 60er


Monday, July 16, 2007

Vista Sidebar under XP...

... and it worx fine!


Addicted 2 Coffee?

You don't know, well try this link and get the answer.

Here is my result:

Mingle2 - Free Online Dating


Wednesday, July 04, 2007

Things I'd like 2 do...

... or in other words: I'd like 2 dig into. There are many new tutorials and blog-entries about NetBeans and other Java based technologies and almost every day the number of tutorials grow. To keep track on those I'd like to sum up the very new ones or those I'd really should have a closer look on:


Tuesday, July 03, 2007

Maven feat. JUnit 4

Because of my bachelor-project I'd like to describe how to configure maven 2.0.7 to execute JUnit 4 tests. I'd like to show three possible ways how to set everything up. First I show some screenshots how to integrate everything in my favourite IDE NetBeans (M9).

I won't show all the preconfigs e.g. how to install all the necessary software you'll need to follow along. Have a look at one of my last posts for those issues. After you have installed Java, NetBeans M9, Maven 2.0.7, all necessary maven-plugins in NetBeans, you will be able to do the following:
  1. Create a new Maven Project (File/New Project/Maven/Maven Project/Maven Quickstart Archetype)

  2. Change your pom.xml to configure maven to use junit 4 not 3.8.1 by adding the maven-surefire-junit4 and deleting the junit dependency. Maven will automatically download all necessary dependencies, even the transitive ones and because surefire-junit4-2.3 depends on junit-4.0 this jar will also be downloaded.

  3. Change IDE's source-level to a Java-Version greater than 1.4 (in my case 1.6) because JUnit 4 needs it. Right click on your maven-project, got to Sources menu on the left and select your source-level.

  4. Lets create a simple JUnit 4 Test by right clicking your test-package, new/Empty Test...

  5. Create a very simple "helloworld"-Test Method by implementing the following:

  6. So lets invoke maven and the surefire-plugin by right clicking your maven-project and Test.

  7. The following output will be produced. I don't have an idea why we aren't able to see the same output as the output which will be produced by invoking maven over the command-line (by the way: this is another possibility to run JUnit 4 tests) ? Do you have an idea?

  8. You can find the same output under the NetBeans-File tab, in the project's target/surefire-reports folder:

So that's it with NetBeans and two of three possible ways how to run maven with Junit 4. No I'd like to show how to configure Maven and Eclipse (by the way: I use the new version of Eclipse ==> Codename: Europa). So here we go...

  1. First you have to install the M2 Eclipse Plugin: Have a look at my "Debugging Custom Maven Plugins"-How To. There you will find how to install the plugin in the IDE.
  2. Then you have to create a Maven Project by cklicking: File/New/Other... and Maven/Maven2 Project.

  3. Configure your project's general settings. First set groupId, artifactId, version etc. then click Next and configure all necessary project-dependencies. Select version 2.3 for the surefire-junit4 plugin.

  4. Now you should see the following or something similar: If not right click your project, Maven/Update Sources and now you should see almost the same. If not check all your settings or post a comment so I'll be able to help you.

  5. Again you have to change your Java JRE settings to a higher source-level than 1.4 because of Junit version 4. Right click your project, chose Properties and then select another JRE. Then you have to change your source-level by writing the following in to you build-section of your project's pom.xml

  6. Now you have to invoke maven's install-plugin by executing the command: mvn install. Maven will then download all necessary plugins e.g. junit-4.0.jar, etc.

  7. After writing a simple JUnit 4 Test you'll be able to run the test within Eclipse by right clicking the test => "Run As/JUnit Test". After you invoked this command Eclipse opens the JUnit-View and you should see something like this:

  8. Now, I tried to run the test via M2 Eclipse Plugin but the build failed. Have a look at the output, you'll see the error-log and maybe it makes sense to you but I don't have any ideas why the tests fail. If you invoke the same command (mvn test) over the command-line everything works fine so it seems to me that the M2 Plugin is Buggy.

Maybe, if you have a solution you can post it, I'd be very thankful.
Have fun coding with maven and JUnit with your favourite IDE.


Sunday, July 01, 2007

Smart Verdicts

I'd like to dedicate this post to some smart verdicts which I have found since I've started reading articles and books about Software-Engineering. Of course your are welcome to add verdicts if you also have found some.

"We never have time to do it right, but always have time to do it again."

To be continued...