<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	xmlns:georss="http://www.georss.org/georss" xmlns:geo="http://www.w3.org/2003/01/geo/wgs84_pos#" xmlns:media="http://search.yahoo.com/mrss/"
	>

<channel>
	<title>The JavaDude Weblog</title>
	<atom:link href="http://javadude.wordpress.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://javadude.wordpress.com</link>
	<description>Jabbering about Java Development and whatever comes along. JavaFX &#124; Android &#124; Glassfish &#124; Netbeans &#124; JEE5</description>
	<lastBuildDate>Tue, 01 Dec 2009 08:54:49 +0000</lastBuildDate>
	<generator>http://wordpress.com/</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<cloud domain='javadude.wordpress.com' port='80' path='/?rsscloud=notify' registerProcedure='' protocol='http-post' />
<image>
		<url>http://www.gravatar.com/blavatar/7b8f0e95aa26ed236a7773266bdd2ea7?s=96&#038;d=http://s.wordpress.com/i/buttonw-com.png</url>
		<title>The JavaDude Weblog</title>
		<link>http://javadude.wordpress.com</link>
	</image>
			<item>
		<title>Getting Started with Netbeans and Shiro &#8211; Part 1</title>
		<link>http://javadude.wordpress.com/2009/12/01/getting-started-with-netbeans-and-shiro-part-1/</link>
		<comments>http://javadude.wordpress.com/2009/12/01/getting-started-with-netbeans-and-shiro-part-1/#comments</comments>
		<pubDate>Tue, 01 Dec 2009 08:52:19 +0000</pubDate>
		<dc:creator>devdude</dc:creator>
				<category><![CDATA[HowTo]]></category>
		<category><![CDATA[netbeans]]></category>
		<category><![CDATA[jsecurity]]></category>
		<category><![CDATA[ki]]></category>
		<category><![CDATA[security]]></category>
		<category><![CDATA[shiro]]></category>

		<guid isPermaLink="false">http://javadude.wordpress.com/?p=812</guid>
		<description><![CDATA[Apache Shiro (formerly known as JSecurity and KI) is a security framework that handles authentication, authorization, enterprise session management and cryptography. With the move from sourceforge to Apache the GPL license turned into the Apache license. The current version is still 0.9 (still JSecurity), but you can build yourself a current version until the version [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=javadude.wordpress.com&blog=3891833&post=812&subd=javadude&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p>Apache Shiro (formerly known as JSecurity and KI) is a security framework that handles authentication, authorization, enterprise session management and cryptography. With the move from sourceforge to Apache the GPL license turned into the Apache license. The current version is still 0.9 (still JSecurity), but you can build yourself a current version until the version is released. Shiro is NOT basd on JAAS.</p>
<p><strong>Pre-Requirements for this tutorial:</strong></p>
<ul>
<li>Netbeans (any newer version 6.5.1 + already installed)</li>
<li>Maven (assuming most people dont use it yet)</li>
<li>Shiro code base (via svn)</li>
<li>Ubuntu (applies only to the installation of maven)<span id="more-812"></span></li>
</ul>
<p><strong>Installation of maven under Ubuntu:</strong></p>
<ul>
<li><em>sudo apt-get install maven2 </em>(will result in a substantial 130MB  download)
<div id="attachment_813" class="wp-caption alignnone" style="width: 310px"><a href="http://javadude.files.wordpress.com/2009/12/svh20091201_002.jpeg"><img class="size-medium wp-image-813" title="SVH20091201_002" src="http://javadude.files.wordpress.com/2009/12/svh20091201_002.jpeg?w=300&#038;h=245" alt="" width="300" height="245" /></a><p class="wp-caption-text">Install maven</p></div></li>
</ul>
<p><strong>Download and building Shiro:</strong></p>
<ul>
<li>svn it into a local folder of your choice (preferably called shiro) from apache.org with  <em>svn co http://svn.apache.org/repos/asf/incubator/shiro/trunk/ </em>
<p>&nbsp;</p>
<p><div id="attachment_814" class="wp-caption alignnone" style="width: 310px"><em><em><a href="http://javadude.files.wordpress.com/2009/12/svh20091201_003.jpeg"><img class="size-medium wp-image-814" title="SVH20091201_003" src="http://javadude.files.wordpress.com/2009/12/svh20091201_003.jpeg?w=300&#038;h=152" alt="" width="300" height="152" /></a></em></em><p class="wp-caption-text">svn shiro</p></div>
<p><em> </em></li>
<li>Build it with mvn install (which downloads even more pom files and a build and test process that can take some minutes)
<div id="attachment_815" class="wp-caption alignnone" style="width: 310px"><a href="http://javadude.files.wordpress.com/2009/12/svh20091201_004.jpeg"><img class="size-medium wp-image-815" title="SVH20091201_004" src="http://javadude.files.wordpress.com/2009/12/svh20091201_004.jpeg?w=300&#038;h=236" alt="" width="300" height="236" /></a><p class="wp-caption-text">Build Shiro with Maven</p></div></li>
</ul>
<p><strong>Create most simple java project</strong></p>
<p>The shiro package you svn&#8217;ed earlier comes with a couple of samples, which really give you a good start, but it is always good to start from the scratch with virtually nothing. This simple application follows pretty much the quickstart.java sample from the Shiro team (<a href="http://cwiki.apache.org/confluence/display/SHIRO/QuickStart" target="_blank">link</a>).</p>
<p>Create a new Java Application</p>
<p>&nbsp;</p>
<p><div id="attachment_816" class="wp-caption alignnone" style="width: 310px"><a href="http://javadude.files.wordpress.com/2009/12/svh20091201_005.jpeg"><img class="size-medium wp-image-816" title="SVH20091201_005" src="http://javadude.files.wordpress.com/2009/12/svh20091201_005.jpeg?w=300&#038;h=196" alt="" width="300" height="196" /></a><p class="wp-caption-text">Create new application</p></div>
<p>Add the Shiro (from the core folder that we maven&#8217;d), log4J and SLF4J library (from the samples folder)</p>
<div id="attachment_817" class="wp-caption alignnone" style="width: 310px"><a href="http://javadude.files.wordpress.com/2009/12/svh20091201_007.jpeg"><img class="size-medium wp-image-817" title="SVH20091201_007" src="http://javadude.files.wordpress.com/2009/12/svh20091201_007.jpeg?w=300&#038;h=218" alt="" width="300" height="218" /></a><p class="wp-caption-text">Libraries</p></div>
<p>Import the packages</p>
<pre class="brush: java;">
import org.apache.shiro.SecurityUtils;
import org.apache.shiro.authc.*;
import org.apache.shiro.mgt.DefaultSecurityManager;
import org.apache.shiro.realm.text.PropertiesRealm;
import org.apache.shiro.session.Session;
import org.apache.shiro.subject.Subject;
</pre>
<p>Create most basic functionality</p>
<pre class="brush: java;">
 public static void main(String[] args) {

 DefaultSecurityManager securityManager = new DefaultSecurityManager();
 securityManager.setRealm(new PropertiesRealm());
 SecurityUtils.setSecurityManager( securityManager );

 Subject currentUser = SecurityUtils.getSubject();

 if ( !currentUser.isAuthenticated() ) {

 //UsernamePasswordToken token = new UsernamePasswordToken(&quot;jamesbond&quot;, &quot;007&quot; );
 UsernamePasswordToken token = new UsernamePasswordToken(&quot;lonestarr&quot;, &quot;vespa&quot; );

 token.setRememberMe(true);
 try {
 currentUser.login(token);
 } catch (UnknownAccountException uae) {
 System.out.println(&quot;There is no user with username of &quot; + token.getPrincipal() );
 } catch ( IncorrectCredentialsException ice ) {
 System.out.println(&quot;Password for account &quot; + token.getPrincipal() + &quot; was incorrect!&quot;);
 } catch ( LockedAccountException lae ) {
 System.out.println(&quot;The account for username &quot; + token.getPrincipal() + &quot; is locked.  &quot; +
 &quot;Please contact your administrator to unlock it.&quot;);
 }
 // ... catch more exceptions here (maybe custom ones specific to your application?
 catch ( AuthenticationException ae ) {
 //unexpected condition?  error?
 }
 }
 System.out.println(&quot; User [&quot; + currentUser.getPrincipal() + &quot;] logged in successfully.&quot;);

 //test a role:
 if ( currentUser.hasRole( &quot;agent&quot; ) ) {
 System.out.println(&quot;License to kill.&quot; );
 } else {
 System.out.println( &quot;Sorry, Martini only.&quot; );
 }

 //test a typed permission (not instance-level)
 if ( currentUser.isPermitted( &quot;gadgets:astonmartin&quot; ) ) {
 System.out.println(&quot;Keys for your company car.&quot;);
 } else {
 System.out.println(&quot;Sorry, subway ticket only.&quot;);
 }

 //test a typed permission (not instance-level)
 if ( currentUser.isPermitted( &quot;lightsaber:weild&quot; ) ) {
 System.out.println(&quot;You may use a lightsaber ring.  Use it wisely.&quot;);
 } else {
 System.out.println(&quot;Sorry, lightsaber rings are for schwartz masters only.&quot;);
 }

 //all done - log out!
 currentUser.logout();

 System.exit(0);
 }
</pre>
<p>Remarks:</p>
<ul>
<li>We dont have a seurity realm, so the sample code play with the default user, password, roles that are part of the Shiro package in core/src/main/resources/org/apache/shiro/realm/text/default-shiro-users.properties
<pre class="brush: xml;">
...
# ------------------------------
# Users and their assigned roles
# ------------------------------
# user 'root' with password 'secret' and the 'root' role
user.root = secret,root
# user 'guest' with the password 'guest' and the 'guest' role
user.guest = guest,guest
# user 'presidentskroob' with password '12345' (&quot;That's the same combination on my luggage!!!&quot; , and role 'president'
user.presidentskroob = 12345,president
# user 'darkhelmet' with password 'ludicrousspeed' and roles 'darklord' and 'schwartz'
user.darkhelmet = ludicrousspeed,darklord,schwartz
# user 'lonestarr' with password 'vespa' and roles 'goodguy' and 'schwartz'
user.lonestarr = vespa,goodguy,schwartz

# -------------------------------
# Roles with assigned permissions
# -------------------------------
# 'root' role has all permissions, indicated by the wildcard '*'
role.root = *
# The 'schwartz' role can do anything (*) with any lightsaber:
role.schwartz = lightsaber:*
# The 'goodguy' role is allowed to 'drive' (action) the winnebago (type) with license plate 'eagle5' (instance specific id)
role.goodguy = winnebago:drive:eagle5
...
</pre>
</li>
<li>Try to exchange the user to the James Bond user, and you will see you cant login.</li>
<li>Take note of the very simple use of the security related functions, such as<br />
<em>currentUser.login(token);<br />
currentUser.hasRole( &#8220;agent&#8221; )<br />
currentUser.isPermitted( &#8220;gadgets:astonmartin&#8221; )<br />
currentUser.logout();</em></li>
</ul>
<p>In part 2 we will add a text-based security realm.</p>
  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/javadude.wordpress.com/812/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/javadude.wordpress.com/812/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/javadude.wordpress.com/812/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/javadude.wordpress.com/812/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/javadude.wordpress.com/812/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/javadude.wordpress.com/812/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/javadude.wordpress.com/812/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/javadude.wordpress.com/812/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/javadude.wordpress.com/812/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/javadude.wordpress.com/812/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=javadude.wordpress.com&blog=3891833&post=812&subd=javadude&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://javadude.wordpress.com/2009/12/01/getting-started-with-netbeans-and-shiro-part-1/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/c590146f757718a268c168a7eee0f53f?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">devdude</media:title>
		</media:content>

		<media:content url="http://javadude.files.wordpress.com/2009/12/svh20091201_002.jpeg?w=300" medium="image">
			<media:title type="html">SVH20091201_002</media:title>
		</media:content>

		<media:content url="http://javadude.files.wordpress.com/2009/12/svh20091201_003.jpeg?w=300" medium="image">
			<media:title type="html">SVH20091201_003</media:title>
		</media:content>

		<media:content url="http://javadude.files.wordpress.com/2009/12/svh20091201_004.jpeg?w=300" medium="image">
			<media:title type="html">SVH20091201_004</media:title>
		</media:content>

		<media:content url="http://javadude.files.wordpress.com/2009/12/svh20091201_005.jpeg?w=300" medium="image">
			<media:title type="html">SVH20091201_005</media:title>
		</media:content>

		<media:content url="http://javadude.files.wordpress.com/2009/12/svh20091201_007.jpeg?w=300" medium="image">
			<media:title type="html">SVH20091201_007</media:title>
		</media:content>
	</item>
		<item>
		<title>Update to Android 1.6</title>
		<link>http://javadude.wordpress.com/2009/11/16/update-to-android-1-6/</link>
		<comments>http://javadude.wordpress.com/2009/11/16/update-to-android-1-6/#comments</comments>
		<pubDate>Mon, 16 Nov 2009 00:19:59 +0000</pubDate>
		<dc:creator>devdude</dc:creator>
				<category><![CDATA[HowTo]]></category>
		<category><![CDATA[android]]></category>
		<category><![CDATA[dev1]]></category>
		<category><![CDATA[htc]]></category>

		<guid isPermaLink="false">http://javadude.wordpress.com/?p=807</guid>
		<description><![CDATA[Using the HTC developer phone the update to Android 1.6 will most probably the last one you can run on this device. Version 2.0 will not run on it (officially)
To update the version from 1.5 to 1.6 you follow the same steps as in my previous blog entry about Android update (link) using the lastest [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=javadude.wordpress.com&blog=3891833&post=807&subd=javadude&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p style="text-align:justify;">Using the HTC developer phone the update to Android 1.6 will most probably the last one you can run on this device. Version 2.0 will not run on it (officially)<br />
To update the version from 1.5 to 1.6 you follow the same steps as in my previous blog entry about Android update (<a href="http://javadude.wordpress.com/2009/05/16/update-to-android-1-5/" target="_blank">link</a>) using the lastest files from HTC (<a href="http://developer.htc.com/adp.html" target="_blank">link</a>):</p>
<ul style="text-align:justify;">
<li>Radio Image: <strong>ota-radio-2_22_19_26I.zip</strong> (same file as for 1.5)</li>
<li>Recovery Image: <strong>signed-dream_devphone_userdebug-ota-14721.zip</strong></li>
</ul>
<p style="text-align:justify;">The release notes of 1.6 (from September 2009) you find at <a href="http://developer.android.com/sdk/android-1.6-highlights.html" target="_blank">android.com</a>.</p>
<p style="text-align:justify;">If you dare to walk outside the standard path, go to <a href="http://www.cyanogenmod.com/" target="_blank">Cyanogen.com</a> for a homebew, but popular mod.</p>
  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/javadude.wordpress.com/807/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/javadude.wordpress.com/807/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/javadude.wordpress.com/807/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/javadude.wordpress.com/807/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/javadude.wordpress.com/807/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/javadude.wordpress.com/807/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/javadude.wordpress.com/807/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/javadude.wordpress.com/807/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/javadude.wordpress.com/807/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/javadude.wordpress.com/807/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=javadude.wordpress.com&blog=3891833&post=807&subd=javadude&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://javadude.wordpress.com/2009/11/16/update-to-android-1-6/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/c590146f757718a268c168a7eee0f53f?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">devdude</media:title>
		</media:content>
	</item>
		<item>
		<title>ZK 3.6.3 and ZK5.0rc with Glassfish V3 and EE6</title>
		<link>http://javadude.wordpress.com/2009/11/15/zk-3-6-3-and-zk5-0rc-with-glassfish-v3-and-ee6/</link>
		<comments>http://javadude.wordpress.com/2009/11/15/zk-3-6-3-and-zk5-0rc-with-glassfish-v3-and-ee6/#comments</comments>
		<pubDate>Sun, 15 Nov 2009 06:19:58 +0000</pubDate>
		<dc:creator>devdude</dc:creator>
				<category><![CDATA[glassfish]]></category>
		<category><![CDATA[zk]]></category>
		<category><![CDATA[v3]]></category>

		<guid isPermaLink="false">http://javadude.wordpress.com/?p=802</guid>
		<description><![CDATA[In my previous post I described how to get a EE6 web application using the ZK3.6.3 framework on Glassfish V3. I noted while redeploying or undeploying the web-application it made the GF instance plus the JVM crash (running Ubuntu 9.04,9.10 and JDK 1.6.b16).
This problem does NOT exist anymore with the latest build from last week. [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=javadude.wordpress.com&blog=3891833&post=802&subd=javadude&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p style="text-align:justify;">In my previous post I described how to get a EE6 web application using the ZK3.6.3 framework on Glassfish V3. I noted while redeploying or undeploying the web-application it made the GF instance plus the JVM crash (running Ubuntu 9.04,9.10 and JDK 1.6.b16).</p>
<p style="text-align:justify;">This problem does NOT exist anymore with the latest build from last week. Make sure you update to build b72. Start the updatetool in glassfish-home/bin. (you might have to start it several times, I got several times time-out errors, or better click on the reminder if you choose the automatic update check feature).</p>
<div id="attachment_803" class="wp-caption alignnone" style="width: 310px"><a href="http://javadude.files.wordpress.com/2009/11/svh20091115_001.jpeg"><img class="size-medium wp-image-803" title="SVH20091115_001" src="http://javadude.files.wordpress.com/2009/11/svh20091115_001.jpeg?w=300&#038;h=147" alt="SVH20091115_001" width="300" height="147" /></a><p class="wp-caption-text">Glassfish V3b72</p></div>
  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/javadude.wordpress.com/802/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/javadude.wordpress.com/802/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/javadude.wordpress.com/802/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/javadude.wordpress.com/802/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/javadude.wordpress.com/802/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/javadude.wordpress.com/802/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/javadude.wordpress.com/802/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/javadude.wordpress.com/802/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/javadude.wordpress.com/802/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/javadude.wordpress.com/802/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=javadude.wordpress.com&blog=3891833&post=802&subd=javadude&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://javadude.wordpress.com/2009/11/15/zk-3-6-3-and-zk5-0rc-with-glassfish-v3-and-ee6/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/c590146f757718a268c168a7eee0f53f?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">devdude</media:title>
		</media:content>

		<media:content url="http://javadude.files.wordpress.com/2009/11/svh20091115_001.jpeg?w=300" medium="image">
			<media:title type="html">SVH20091115_001</media:title>
		</media:content>
	</item>
		<item>
		<title>ZK NB Plugin News</title>
		<link>http://javadude.wordpress.com/2009/11/10/zk-nb-plugin-news/</link>
		<comments>http://javadude.wordpress.com/2009/11/10/zk-nb-plugin-news/#comments</comments>
		<pubDate>Tue, 10 Nov 2009 00:54:38 +0000</pubDate>
		<dc:creator>devdude</dc:creator>
				<category><![CDATA[news]]></category>
		<category><![CDATA[zk]]></category>
		<category><![CDATA[netbeans]]></category>

		<guid isPermaLink="false">http://javadude.wordpress.com/?p=795</guid>
		<description><![CDATA[As expected, as a matter of not even days, the Netbeans plugin for ZK 3.6.3 was released. Download it from sourceforge.net.
You might also notice they released a plugin for the release candidate of ZK5 (which you find in the same download section). Though the plugin creates a J2EE 1.4 web application, it might be worth [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=javadude.wordpress.com&blog=3891833&post=795&subd=javadude&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p style="text-align:justify;">As expected, as a matter of not even days, the <strong>Netbeans plugin</strong> for <strong>ZK 3.6.3</strong> was released. Download it from <a href="http://sourceforge.net/projects/rem1/files/" target="_blank">sourceforge.net</a>.</p>
<p style="text-align:justify;">You might also notice they released a plugin for the release candidate of <strong>ZK5</strong> (which you find in the same download section). Though the plugin creates a <em>J2EE 1.4 </em>web application, it might be worth installing to test the features of the upcoming version.</p>
  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/javadude.wordpress.com/795/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/javadude.wordpress.com/795/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/javadude.wordpress.com/795/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/javadude.wordpress.com/795/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/javadude.wordpress.com/795/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/javadude.wordpress.com/795/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/javadude.wordpress.com/795/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/javadude.wordpress.com/795/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/javadude.wordpress.com/795/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/javadude.wordpress.com/795/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=javadude.wordpress.com&blog=3891833&post=795&subd=javadude&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://javadude.wordpress.com/2009/11/10/zk-nb-plugin-news/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/c590146f757718a268c168a7eee0f53f?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">devdude</media:title>
		</media:content>
	</item>
		<item>
		<title>ZK 3.6.3 with Netbeans 6.8 Beta on Glassfish V3</title>
		<link>http://javadude.wordpress.com/2009/11/06/zk-3-6-3-with-netbeans-6-8-beta-on-glassfish-v3/</link>
		<comments>http://javadude.wordpress.com/2009/11/06/zk-3-6-3-with-netbeans-6-8-beta-on-glassfish-v3/#comments</comments>
		<pubDate>Fri, 06 Nov 2009 06:21:15 +0000</pubDate>
		<dc:creator>devdude</dc:creator>
				<category><![CDATA[HowTo]]></category>
		<category><![CDATA[zk]]></category>
		<category><![CDATA[glassfish]]></category>
		<category><![CDATA[jee6]]></category>
		<category><![CDATA[netbeans]]></category>

		<guid isPermaLink="false">http://javadude.wordpress.com/?p=764</guid>
		<description><![CDATA[I am using Netbeans 6.8B for a few days and mainly testing if my existing JEE5 projects can be opened, deployed and executed on GF3. I am using ZK as Web/Ajax Framework. Usually the ZK team releases a new NB plugin to help you to create ZK based Java Web projects. Currently the plugin supports [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=javadude.wordpress.com&blog=3891833&post=764&subd=javadude&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p style="text-align:justify;">I am using Netbeans 6.8B for a few days and mainly testing if my existing JEE5 projects can be opened, deployed and executed on GF3. I am using ZK as Web/Ajax Framework. Usually the ZK team releases a new NB plugin to help you to create ZK based Java Web projects. Currently the plugin supports 3.6.2, some days back ZK 3.6.3 was released, so I guess in a few days time we will have a 3.6.3 plugin. The plugin creates a skeleton for a JEE5 webproject and I doubt they will support Java EE6 before EE6 is finally released (December?).</p>
<p style="text-align:justify;">I was curious to see if I get the latest ZK running on GF V3 as a JEE6 application.</p>
<p><span style="text-decoration:underline;"><strong>Part 1: ZK 3.6.2 with Netbeans 6.8B as EE5 Web Project</strong></span></p>
<p>First, lets try first to add the 3.6.2. plugin to NB 6.8B</p>
<div id="attachment_765" class="wp-caption alignnone" style="width: 310px"><a href="http://javadude.files.wordpress.com/2009/11/svh20091105_001.jpeg"><img class="size-medium wp-image-765" title="SVH20091105_001" src="http://javadude.files.wordpress.com/2009/11/svh20091105_001.jpeg?w=300&#038;h=225" alt="SVH20091105_001" width="300" height="225" /></a><p class="wp-caption-text">ZK plugin 3.6.2</p></div>
<p><span id="more-764"></span>Create a new Java Web Project with ZK (under EE5)</p>
<div id="attachment_766" class="wp-caption alignnone" style="width: 310px"><a href="http://javadude.files.wordpress.com/2009/11/svh20091105_002.jpeg"><img class="size-medium wp-image-766" title="SVH20091105_002" src="http://javadude.files.wordpress.com/2009/11/svh20091105_002.jpeg?w=300&#038;h=201" alt="Create ZK project (EE5)" width="300" height="201" /></a><p class="wp-caption-text">Create ZK project (EE5)</p></div>
<div id="attachment_767" class="wp-caption alignnone" style="width: 310px"><a href="http://javadude.files.wordpress.com/2009/11/svh20091105_003.jpeg"><img class="size-medium wp-image-767" title="SVH20091105_003" src="http://javadude.files.wordpress.com/2009/11/svh20091105_003.jpeg?w=300&#038;h=201" alt="f" width="300" height="201" /></a><p class="wp-caption-text">Create ZK project (EE5)</p></div>
<p>Project successfully created with all settings as expected.</p>
<div id="attachment_768" class="wp-caption alignnone" style="width: 310px"><a href="http://javadude.files.wordpress.com/2009/11/svh20091105_004.jpeg"><img class="size-medium wp-image-768" title="SVH20091105_004" src="http://javadude.files.wordpress.com/2009/11/svh20091105_004.jpeg?w=300&#038;h=218" alt="SVH20091105_004" width="300" height="218" /></a><p class="wp-caption-text">ZK Web Project Properties</p></div>
<div id="attachment_769" class="wp-caption alignnone" style="width: 310px"><a href="http://javadude.files.wordpress.com/2009/11/svh20091105_005.jpeg"><img class="size-medium wp-image-769" title="SVH20091105_005" src="http://javadude.files.wordpress.com/2009/11/svh20091105_005.jpeg?w=300&#038;h=218" alt="SVH20091105_005" width="300" height="218" /></a><p class="wp-caption-text">ZK Web Project Properties</p></div>
<p>Build, Deploy and Run the project.</p>
<div id="attachment_770" class="wp-caption alignnone" style="width: 310px"><a href="http://javadude.files.wordpress.com/2009/11/svh20091105_006.jpeg"><img class="size-medium wp-image-770" title="SVH20091105_006" src="http://javadude.files.wordpress.com/2009/11/svh20091105_006.jpeg?w=300&#038;h=261" alt="SVH20091105_006" width="300" height="261" /></a><p class="wp-caption-text">Deploying and Running ZK Web project (EE5) in GF V3</p></div>
<p>That, looks fine. Lets see what the plugin actually does, when you create a new project. It adds the library (project properties) and insert some lines to the web.xml file.</p>
<p><strong>project.properties</strong></p>
<pre class="brush: xml;">
..
j2ee.deploy.on.save=true
j2ee.platform=1.5
j2ee.server.type=gfv3ee6
jar.compress=false
javac.classpath=\
 ${libs.ZK3.6.2.classpath}:\
 ${libs.hibernate-support.classpath}
# Space-separated list of extra javac options
javac.compilerargs=
..
</pre>
<p><strong>web.xml</strong></p>
<pre class="brush: xml;">
..
&lt;!-- //// --&gt;
 &lt;!-- ZK --&gt;
 &lt;listener&gt;
 &lt;description&gt;ZK listener for session cleanup&lt;/description&gt;
 &lt;listener-class&gt;org.zkoss.zk.ui.http.HttpSessionListener&lt;/listener-class&gt;
 &lt;/listener&gt;
 &lt;servlet&gt;
 &lt;description&gt;ZK loader for ZUML pages&lt;/description&gt;
 &lt;servlet-name&gt;zkLoader&lt;/servlet-name&gt;
 &lt;servlet-class&gt;org.zkoss.zk.ui.http.DHtmlLayoutServlet&lt;/servlet-class&gt;
 &lt;!-- Must. Specifies URI of the update engine (DHtmlUpdateServlet).
 It must be the same as &lt;url-pattern&gt; for the update engine.
 --&gt;
 &lt;init-param&gt;
 &lt;param-name&gt;update-uri&lt;/param-name&gt;
 &lt;param-value&gt;/zkau&lt;/param-value&gt;
 &lt;/init-param&gt;
 &lt;!-- Optional. Specifies whether to compress the output
 of the ZK loader. It speeds up the transmission over slow Internet.
 However, if you configure a filter to post-processing the
 output, you might have to disable it.

 Default: true
 &lt;init-param&gt;
 &lt;param-name&gt;compress&lt;/param-name&gt;
 &lt;param-value&gt;true&lt;/param-value&gt;
 &lt;/init-param&gt;
 --&gt;
 &lt;!-- Optional. Specifies the default log level: OFF, ERROR, WARNING,
 INFO, DEBUG and FINER. If not specified, the system default is used.
 &lt;init-param&gt;
 &lt;param-name&gt;log-level&lt;/param-name&gt;
 &lt;param-value&gt;OFF&lt;/param-value&gt;
 &lt;/init-param&gt;
 --&gt;
 &lt;load-on-startup&gt;1&lt;/load-on-startup&gt;&lt;!-- Must --&gt;
 &lt;/servlet&gt;
 &lt;servlet-mapping&gt;
 &lt;servlet-name&gt;zkLoader&lt;/servlet-name&gt;
 &lt;url-pattern&gt;*.zul&lt;/url-pattern&gt;
 &lt;/servlet-mapping&gt;
 &lt;servlet-mapping&gt;
 &lt;servlet-name&gt;zkLoader&lt;/servlet-name&gt;
 &lt;url-pattern&gt;*.zhtml&lt;/url-pattern&gt;
 &lt;/servlet-mapping&gt;
 &lt;servlet-mapping&gt;
 &lt;servlet-name&gt;zkLoader&lt;/servlet-name&gt;
 &lt;url-pattern&gt;*.svg&lt;/url-pattern&gt;
 &lt;/servlet-mapping&gt;
 &lt;servlet-mapping&gt;
 &lt;servlet-name&gt;zkLoader&lt;/servlet-name&gt;
 &lt;url-pattern&gt;*.xml2html&lt;/url-pattern&gt;
 &lt;/servlet-mapping&gt;

 &lt;!-- Optional. Uncomment it if you want to use richlets.
 --&gt;
 &lt;servlet-mapping&gt;
 &lt;servlet-name&gt;zkLoader&lt;/servlet-name&gt;
 &lt;url-pattern&gt;/zk/*&lt;/url-pattern&gt;
 &lt;/servlet-mapping&gt;

 &lt;servlet&gt;
 &lt;description&gt;The asynchronous update engine for ZK&lt;/description&gt;
 &lt;servlet-name&gt;auEngine&lt;/servlet-name&gt;
 &lt;servlet-class&gt;org.zkoss.zk.au.http.DHtmlUpdateServlet&lt;/servlet-class&gt;

 &lt;!-- [Optional] Specifies the AU processor for particular prefix.
 &lt;init-param&gt;
 &lt;param-name&gt;processor0&lt;/param-name&gt;
 &lt;param-value&gt;/upload=com.my.MyUploader&lt;/param-value&gt;
 &lt;/init-param&gt;
 --&gt;
 &lt;/servlet&gt;
 &lt;servlet-mapping&gt;
 &lt;servlet-name&gt;auEngine&lt;/servlet-name&gt;
 &lt;url-pattern&gt;/zkau/*&lt;/url-pattern&gt;
 &lt;/servlet-mapping&gt;

 &lt;!-- Uncomment if you want to use the ZK filter to post process the HTML output
 generated by other technology, such as JSP and velocity.
 &lt;filter&gt;
 &lt;filter-name&gt;zkFilter&lt;/filter-name&gt;
 &lt;filter-class&gt;org.zkoss.zk.ui.http.DHtmlLayoutFilter&lt;/filter-class&gt;
 &lt;init-param&gt;
 &lt;param-name&gt;extension&lt;/param-name&gt;
 &lt;param-value&gt;html&lt;/param-value&gt;
 &lt;/init-param&gt;
 &lt;init-param&gt;
 &lt;param-name&gt;compress&lt;/param-name&gt;
 &lt;param-value&gt;true&lt;/param-value&gt;
 &lt;/init-param&gt;
 &lt;/filter&gt;
 &lt;filter-mapping&gt;
 &lt;filter-name&gt;zkFilter&lt;/filter-name&gt;
 &lt;url-pattern&gt;/test/filter.dsp&lt;/url-pattern&gt;
 &lt;/filter-mapping&gt;
 &lt;filter-mapping&gt;
 &lt;filter-name&gt;zkFilter&lt;/filter-name&gt;
 &lt;url-pattern&gt;/test/filter2.dsp&lt;/url-pattern&gt;
 &lt;/filter-mapping&gt;
 --&gt;

 &lt;!-- ///////////// --&gt;
 &lt;!-- DSP (optional) --&gt;
 &lt;!-- We need it to show zkdemo correctly (due to categorybar.dsp)
 --&gt;
 &lt;servlet&gt;
 &lt;servlet-name&gt;dspLoader&lt;/servlet-name&gt;
 &lt;servlet-class&gt;org.zkoss.web.servlet.dsp.InterpreterServlet&lt;/servlet-class&gt;
 &lt;init-param&gt;
 &lt;param-name&gt;class-resource&lt;/param-name&gt;
 &lt;param-value&gt;true&lt;/param-value&gt;
 &lt;/init-param&gt;
 &lt;/servlet&gt;
 &lt;servlet-mapping&gt;
 &lt;servlet-name&gt;dspLoader&lt;/servlet-name&gt;
 &lt;url-pattern&gt;*.dsp&lt;/url-pattern&gt;
 &lt;/servlet-mapping&gt;

 &lt;!-- /////////// --&gt;
..
</pre>
<p>This changes we need to apply if we create a Web project without plugin support.</p>
<p><span style="text-decoration:underline;"><strong>Part 2: Add ZK 3.6.3 manually to Netbeans as Global Library</strong></span></p>
<p>In the absence of the plugin (which certainly comes soon) we manually add ZK3.6.3 to Netbeans. I recommend to have the 3.6.2 plugin installed, so we can user the new zul page create assitant. After downloading the release 3.6.3 from the <a href="http://zkoss.org/release/rn-3.6.3.dsp" target="_blank">www.zkoss.org</a> we need to create the same structure as for 3.6.2 in the local .netbeans directory. Create a directory zk363.</p>
<div id="attachment_779" class="wp-caption alignnone" style="width: 237px"><a href="http://javadude.files.wordpress.com/2009/11/svh20091106_017.jpeg"><img class="size-medium wp-image-779" title="SVH20091106_017" src="http://javadude.files.wordpress.com/2009/11/svh20091106_017.jpeg?w=227&#038;h=300" alt="SVH20091106_017" width="227" height="300" /></a><p class="wp-caption-text">.netbeans directory structure</p></div>
<p>Unzip the ZK bin file and copy all jar files (from the different folders under lib) into the new directory zk363. No other files or directories in that folder.</p>
<div id="attachment_780" class="wp-caption alignnone" style="width: 192px"><a href="http://javadude.files.wordpress.com/2009/11/svh20091106_018.jpeg"><img class="size-medium wp-image-780" title="SVH20091106_018" src="http://javadude.files.wordpress.com/2009/11/svh20091106_018.jpeg?w=182&#038;h=300" alt="SVH20091106_018" width="182" height="300" /></a><p class="wp-caption-text">Content of the ZK3.6.3 release (zk-bin-3.6.3)</p></div>
<p>Now start Netbeans and open the Library Manager (Tools|Libraries) and &#8216;Add New Library&#8217;, name it ZK3.6.3 and add the complete folder from above.</p>
<div id="attachment_781" class="wp-caption alignnone" style="width: 310px"><a href="http://javadude.files.wordpress.com/2009/11/svh20091106_013.jpeg"><img class="size-medium wp-image-781" title="SVH20091106_013" src="http://javadude.files.wordpress.com/2009/11/svh20091106_013.jpeg?w=300&#038;h=224" alt="SVH20091106_013" width="300" height="224" /></a><p class="wp-caption-text">Create Global Library ZK3.6.3</p></div>
<div id="attachment_782" class="wp-caption alignnone" style="width: 310px"><a href="http://javadude.files.wordpress.com/2009/11/svh20091106_014.jpeg"><img class="size-medium wp-image-782" title="SVH20091106_014" src="http://javadude.files.wordpress.com/2009/11/svh20091106_014.jpeg?w=300&#038;h=224" alt="SVH20091106_014" width="300" height="224" /></a><p class="wp-caption-text">Create Global Library</p></div>
<p>Now you can add ZK 3.6.3 to any of your web projects.</p>
<p><span style="text-decoration:underline;"><strong>Part 3: Create EE6 Web Project<br />
</strong></span></p>
<p>Lets create a new JEE6 web project using the just created ZK3.6.3 Library.</p>
<div id="attachment_774" class="wp-caption alignnone" style="width: 310px"><a href="http://javadude.files.wordpress.com/2009/11/svh20091105_007.jpeg"><img class="size-medium wp-image-774" title="SVH20091105_007" src="http://javadude.files.wordpress.com/2009/11/svh20091105_007.jpeg?w=300&#038;h=202" alt="SVH20091105_007" width="300" height="202" /></a><p class="wp-caption-text">New Web Project</p></div>
<div id="attachment_775" class="wp-caption alignnone" style="width: 310px"><a href="http://javadude.files.wordpress.com/2009/11/svh20091105_008.jpeg"><img class="size-medium wp-image-775" title="SVH20091105_008" src="http://javadude.files.wordpress.com/2009/11/svh20091105_008.jpeg?w=300&#038;h=180" alt="SVH20091105_008" width="300" height="180" /></a><p class="wp-caption-text">New Web Project</p></div>
<div id="attachment_776" class="wp-caption alignnone" style="width: 310px"><a href="http://javadude.files.wordpress.com/2009/11/svh20091105_009.jpeg"><img class="size-medium wp-image-776" title="SVH20091105_009" src="http://javadude.files.wordpress.com/2009/11/svh20091105_009.jpeg?w=300&#038;h=180" alt="SVH20091105_009" width="300" height="180" /></a><p class="wp-caption-text">New Web Project</p></div>
<p>Add the global library.</p>
<div id="attachment_783" class="wp-caption alignnone" style="width: 310px"><a href="http://javadude.files.wordpress.com/2009/11/svh20091106_016.jpeg"><img class="size-medium wp-image-783" title="SVH20091106_016" src="http://javadude.files.wordpress.com/2009/11/svh20091106_016.jpeg?w=300&#038;h=218" alt="SVH20091106_016" width="300" height="218" /></a><p class="wp-caption-text">Add ZK3.6.3 Library</p></div>
<p>First problem: Since we dont have the plugin doing the configuration for us we need to copy the required entries manually (you can copy the complete fragment from the above web.xml).</p>
<p>Second problem: JEE6 works without web.xml, but we still can create and use it.</p>
<div id="attachment_784" class="wp-caption alignnone" style="width: 310px"><a href="http://javadude.files.wordpress.com/2009/11/svh20091106_007.jpeg"><img class="size-medium wp-image-784" title="SVH20091106_007" src="http://javadude.files.wordpress.com/2009/11/svh20091106_007.jpeg?w=300&#038;h=202" alt="SVH20091106_007" width="300" height="202" /></a><p class="wp-caption-text">Create web.xml</p></div>
<div id="attachment_785" class="wp-caption alignnone" style="width: 310px"><a href="http://javadude.files.wordpress.com/2009/11/svh20091106_008.jpeg"><img class="size-medium wp-image-785" title="SVH20091106_008" src="http://javadude.files.wordpress.com/2009/11/svh20091106_008.jpeg?w=300&#038;h=174" alt="SVH20091106_008" width="300" height="174" /></a><p class="wp-caption-text">Create web.xml</p></div>
<div id="attachment_786" class="wp-caption alignnone" style="width: 310px"><a href="http://javadude.files.wordpress.com/2009/11/svh20091106_009.jpeg"><img class="size-medium wp-image-786" title="SVH20091106_009" src="http://javadude.files.wordpress.com/2009/11/svh20091106_009.jpeg?w=300&#038;h=95" alt="x" width="300" height="95" /></a><p class="wp-caption-text">web.xml skeleton</p></div>
<p>Add the above zk configuration and we have a web.xml like this:</p>
<pre class="brush: xml;">
&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot;?&gt;

&lt;web-app xmlns=&quot;http://java.sun.com/xml/ns/javaee&quot;
 xmlns:xsi=&quot;http://www.w3.org/2001/XMLSchema-instance&quot;
 xsi:schemaLocation=&quot;http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd&quot;
 version=&quot;3.0&quot;&gt;
 &lt;session-config&gt;
 &lt;session-timeout&gt;
 30
 &lt;/session-timeout&gt;
 &lt;/session-config&gt;

&lt;!-- //// --&gt;
 &lt;!-- ZK --&gt;
 &lt;listener&gt;
 &lt;description&gt;ZK listener for session cleanup&lt;/description&gt;
 &lt;listener-class&gt;org.zkoss.zk.ui.http.HttpSessionListener&lt;/listener-class&gt;
 &lt;/listener&gt;
 &lt;servlet&gt;
 &lt;description&gt;ZK loader for ZUML pages&lt;/description&gt;
 &lt;servlet-name&gt;zkLoader&lt;/servlet-name&gt;
 &lt;servlet-class&gt;org.zkoss.zk.ui.http.DHtmlLayoutServlet&lt;/servlet-class&gt;
 &lt;!-- Must. Specifies URI of the update engine (DHtmlUpdateServlet).
 It must be the same as &lt;url-pattern&gt; for the update engine.
 --&gt;
 &lt;init-param&gt;
 &lt;param-name&gt;update-uri&lt;/param-name&gt;
 &lt;param-value&gt;/zkau&lt;/param-value&gt;
 &lt;/init-param&gt;
 &lt;!-- Optional. Specifies whether to compress the output
 of the ZK loader. It speeds up the transmission over slow Internet.
 However, if you configure a filter to post-processing the
 output, you might have to disable it.

 Default: true
 &lt;init-param&gt;
 &lt;param-name&gt;compress&lt;/param-name&gt;
 &lt;param-value&gt;true&lt;/param-value&gt;
 &lt;/init-param&gt;
 --&gt;
 &lt;!-- Optional. Specifies the default log level: OFF, ERROR, WARNING,
 INFO, DEBUG and FINER. If not specified, the system default is used.
 &lt;init-param&gt;
 &lt;param-name&gt;log-level&lt;/param-name&gt;
 &lt;param-value&gt;OFF&lt;/param-value&gt;
 &lt;/init-param&gt;
 --&gt;
 &lt;load-on-startup&gt;1&lt;/load-on-startup&gt;&lt;!-- Must --&gt;
 &lt;/servlet&gt;
 &lt;servlet-mapping&gt;
 &lt;servlet-name&gt;zkLoader&lt;/servlet-name&gt;
 &lt;url-pattern&gt;*.zul&lt;/url-pattern&gt;
 &lt;/servlet-mapping&gt;
 &lt;servlet-mapping&gt;
 &lt;servlet-name&gt;zkLoader&lt;/servlet-name&gt;
 &lt;url-pattern&gt;*.zhtml&lt;/url-pattern&gt;
 &lt;/servlet-mapping&gt;
 &lt;servlet-mapping&gt;
 &lt;servlet-name&gt;zkLoader&lt;/servlet-name&gt;
 &lt;url-pattern&gt;*.svg&lt;/url-pattern&gt;
 &lt;/servlet-mapping&gt;
 &lt;servlet-mapping&gt;
 &lt;servlet-name&gt;zkLoader&lt;/servlet-name&gt;
 &lt;url-pattern&gt;*.xml2html&lt;/url-pattern&gt;
 &lt;/servlet-mapping&gt;

 &lt;!-- Optional. Uncomment it if you want to use richlets.
 --&gt;
 &lt;servlet-mapping&gt;
 &lt;servlet-name&gt;zkLoader&lt;/servlet-name&gt;
 &lt;url-pattern&gt;/zk/*&lt;/url-pattern&gt;
 &lt;/servlet-mapping&gt;

 &lt;servlet&gt;
 &lt;description&gt;The asynchronous update engine for ZK&lt;/description&gt;
 &lt;servlet-name&gt;auEngine&lt;/servlet-name&gt;
 &lt;servlet-class&gt;org.zkoss.zk.au.http.DHtmlUpdateServlet&lt;/servlet-class&gt;

 &lt;!-- [Optional] Specifies the AU processor for particular prefix.
 &lt;init-param&gt;
 &lt;param-name&gt;processor0&lt;/param-name&gt;
 &lt;param-value&gt;/upload=com.my.MyUploader&lt;/param-value&gt;
 &lt;/init-param&gt;
 --&gt;
 &lt;/servlet&gt;
 &lt;servlet-mapping&gt;
 &lt;servlet-name&gt;auEngine&lt;/servlet-name&gt;
 &lt;url-pattern&gt;/zkau/*&lt;/url-pattern&gt;
 &lt;/servlet-mapping&gt;

 &lt;!-- Uncomment if you want to use the ZK filter to post process the HTML output
 generated by other technology, such as JSP and velocity.
 &lt;filter&gt;
 &lt;filter-name&gt;zkFilter&lt;/filter-name&gt;
 &lt;filter-class&gt;org.zkoss.zk.ui.http.DHtmlLayoutFilter&lt;/filter-class&gt;
 &lt;init-param&gt;
 &lt;param-name&gt;extension&lt;/param-name&gt;
 &lt;param-value&gt;html&lt;/param-value&gt;
 &lt;/init-param&gt;
 &lt;init-param&gt;
 &lt;param-name&gt;compress&lt;/param-name&gt;
 &lt;param-value&gt;true&lt;/param-value&gt;
 &lt;/init-param&gt;
 &lt;/filter&gt;
 &lt;filter-mapping&gt;
 &lt;filter-name&gt;zkFilter&lt;/filter-name&gt;
 &lt;url-pattern&gt;/test/filter.dsp&lt;/url-pattern&gt;
 &lt;/filter-mapping&gt;
 &lt;filter-mapping&gt;
 &lt;filter-name&gt;zkFilter&lt;/filter-name&gt;
 &lt;url-pattern&gt;/test/filter2.dsp&lt;/url-pattern&gt;
 &lt;/filter-mapping&gt;
 --&gt;

 &lt;!-- ///////////// --&gt;
 &lt;!-- DSP (optional) --&gt;
 &lt;!-- We need it to show zkdemo correctly (due to categorybar.dsp)
 --&gt;
 &lt;servlet&gt;
 &lt;servlet-name&gt;dspLoader&lt;/servlet-name&gt;
 &lt;servlet-class&gt;org.zkoss.web.servlet.dsp.InterpreterServlet&lt;/servlet-class&gt;
 &lt;init-param&gt;
 &lt;param-name&gt;class-resource&lt;/param-name&gt;
 &lt;param-value&gt;true&lt;/param-value&gt;
 &lt;/init-param&gt;
 &lt;/servlet&gt;
 &lt;servlet-mapping&gt;
 &lt;servlet-name&gt;dspLoader&lt;/servlet-name&gt;
 &lt;url-pattern&gt;*.dsp&lt;/url-pattern&gt;
 &lt;/servlet-mapping&gt;

 &lt;!-- /////////// --&gt;

&lt;/web-app&gt;
</pre>
<p>Finally we create a new zul page (New File..|Web|ZK/zkcanvas)</p>
<div id="attachment_788" class="wp-caption alignnone" style="width: 310px"><a href="http://javadude.files.wordpress.com/2009/11/svh20091106_019.jpeg"><img class="size-medium wp-image-788" title="SVH20091106_019" src="http://javadude.files.wordpress.com/2009/11/svh20091106_019.jpeg?w=300&#038;h=202" alt="SVH20091106_019" width="300" height="202" /></a><p class="wp-caption-text">New File</p></div>
<div id="attachment_789" class="wp-caption alignnone" style="width: 310px"><a href="http://javadude.files.wordpress.com/2009/11/svh20091106_020.jpeg"><img class="size-medium wp-image-789" title="SVH20091106_020" src="http://javadude.files.wordpress.com/2009/11/svh20091106_020.jpeg?w=300&#038;h=202" alt="SVH20091106_020" width="300" height="202" /></a><p class="wp-caption-text">Name</p></div>
<div id="attachment_790" class="wp-caption alignnone" style="width: 310px"><a href="http://javadude.files.wordpress.com/2009/11/svh20091106_021.jpeg"><img class="size-medium wp-image-790" title="SVH20091106_021" src="http://javadude.files.wordpress.com/2009/11/svh20091106_021.jpeg?w=300&#038;h=77" alt="SVH20091106_021" width="300" height="77" /></a><p class="wp-caption-text">index.zul</p></div>
<p>Drag and drop any of the controls (better one that does not require further programming, like the Date picker) and drop it into the zul page.</p>
<p>Deploy and run it. Voila !</p>
<div id="attachment_793" class="wp-caption alignnone" style="width: 310px"><a href="http://javadude.files.wordpress.com/2009/11/svh20091106_022.jpeg"><img class="size-medium wp-image-793" title="SVH20091106_022" src="http://javadude.files.wordpress.com/2009/11/svh20091106_022.jpeg?w=300&#038;h=123" alt="SVH20091106_022" width="300" height="123" /></a><p class="wp-caption-text">index.zul with datepicker in the browser</p></div>
  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/javadude.wordpress.com/764/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/javadude.wordpress.com/764/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/javadude.wordpress.com/764/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/javadude.wordpress.com/764/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/javadude.wordpress.com/764/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/javadude.wordpress.com/764/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/javadude.wordpress.com/764/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/javadude.wordpress.com/764/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/javadude.wordpress.com/764/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/javadude.wordpress.com/764/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=javadude.wordpress.com&blog=3891833&post=764&subd=javadude&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://javadude.wordpress.com/2009/11/06/zk-3-6-3-with-netbeans-6-8-beta-on-glassfish-v3/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/c590146f757718a268c168a7eee0f53f?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">devdude</media:title>
		</media:content>

		<media:content url="http://javadude.files.wordpress.com/2009/11/svh20091105_001.jpeg?w=300" medium="image">
			<media:title type="html">SVH20091105_001</media:title>
		</media:content>

		<media:content url="http://javadude.files.wordpress.com/2009/11/svh20091105_002.jpeg?w=300" medium="image">
			<media:title type="html">SVH20091105_002</media:title>
		</media:content>

		<media:content url="http://javadude.files.wordpress.com/2009/11/svh20091105_003.jpeg?w=300" medium="image">
			<media:title type="html">SVH20091105_003</media:title>
		</media:content>

		<media:content url="http://javadude.files.wordpress.com/2009/11/svh20091105_004.jpeg?w=300" medium="image">
			<media:title type="html">SVH20091105_004</media:title>
		</media:content>

		<media:content url="http://javadude.files.wordpress.com/2009/11/svh20091105_005.jpeg?w=300" medium="image">
			<media:title type="html">SVH20091105_005</media:title>
		</media:content>

		<media:content url="http://javadude.files.wordpress.com/2009/11/svh20091105_006.jpeg?w=300" medium="image">
			<media:title type="html">SVH20091105_006</media:title>
		</media:content>

		<media:content url="http://javadude.files.wordpress.com/2009/11/svh20091106_017.jpeg?w=227" medium="image">
			<media:title type="html">SVH20091106_017</media:title>
		</media:content>

		<media:content url="http://javadude.files.wordpress.com/2009/11/svh20091106_018.jpeg?w=182" medium="image">
			<media:title type="html">SVH20091106_018</media:title>
		</media:content>

		<media:content url="http://javadude.files.wordpress.com/2009/11/svh20091106_013.jpeg?w=300" medium="image">
			<media:title type="html">SVH20091106_013</media:title>
		</media:content>

		<media:content url="http://javadude.files.wordpress.com/2009/11/svh20091106_014.jpeg?w=300" medium="image">
			<media:title type="html">SVH20091106_014</media:title>
		</media:content>

		<media:content url="http://javadude.files.wordpress.com/2009/11/svh20091105_007.jpeg?w=300" medium="image">
			<media:title type="html">SVH20091105_007</media:title>
		</media:content>

		<media:content url="http://javadude.files.wordpress.com/2009/11/svh20091105_008.jpeg?w=300" medium="image">
			<media:title type="html">SVH20091105_008</media:title>
		</media:content>

		<media:content url="http://javadude.files.wordpress.com/2009/11/svh20091105_009.jpeg?w=300" medium="image">
			<media:title type="html">SVH20091105_009</media:title>
		</media:content>

		<media:content url="http://javadude.files.wordpress.com/2009/11/svh20091106_016.jpeg?w=300" medium="image">
			<media:title type="html">SVH20091106_016</media:title>
		</media:content>

		<media:content url="http://javadude.files.wordpress.com/2009/11/svh20091106_007.jpeg?w=300" medium="image">
			<media:title type="html">SVH20091106_007</media:title>
		</media:content>

		<media:content url="http://javadude.files.wordpress.com/2009/11/svh20091106_008.jpeg?w=300" medium="image">
			<media:title type="html">SVH20091106_008</media:title>
		</media:content>

		<media:content url="http://javadude.files.wordpress.com/2009/11/svh20091106_009.jpeg?w=300" medium="image">
			<media:title type="html">SVH20091106_009</media:title>
		</media:content>

		<media:content url="http://javadude.files.wordpress.com/2009/11/svh20091106_019.jpeg?w=300" medium="image">
			<media:title type="html">SVH20091106_019</media:title>
		</media:content>

		<media:content url="http://javadude.files.wordpress.com/2009/11/svh20091106_020.jpeg?w=300" medium="image">
			<media:title type="html">SVH20091106_020</media:title>
		</media:content>

		<media:content url="http://javadude.files.wordpress.com/2009/11/svh20091106_021.jpeg?w=300" medium="image">
			<media:title type="html">SVH20091106_021</media:title>
		</media:content>

		<media:content url="http://javadude.files.wordpress.com/2009/11/svh20091106_022.jpeg?w=300" medium="image">
			<media:title type="html">SVH20091106_022</media:title>
		</media:content>
	</item>
		<item>
		<title>Singapore JUG Update</title>
		<link>http://javadude.wordpress.com/2009/11/05/singapore-jug-update/</link>
		<comments>http://javadude.wordpress.com/2009/11/05/singapore-jug-update/#comments</comments>
		<pubDate>Thu, 05 Nov 2009 01:48:15 +0000</pubDate>
		<dc:creator>devdude</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[jug]]></category>
		<category><![CDATA[meetup]]></category>
		<category><![CDATA[singapore]]></category>

		<guid isPermaLink="false">http://javadude.wordpress.com/?p=759</guid>
		<description><![CDATA[Last monday we met for the third time. 15 people showed up following in a relaxed 2 hours on these topics:

Servlet 3.0 (part of EE6) by Chuk
JVM based languages Clojure, Scala bu Chuk (guess more to come soon once the he add the other languages)
Pomodoro Time Management by me
Netbeans, Cobertura, Hudson hands-on by me

You want [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=javadude.wordpress.com&blog=3891833&post=759&subd=javadude&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p>Last monday we met for the third time. 15 people showed up following in a relaxed 2 hours on these topics:</p>
<ul>
<li>Servlet 3.0 (part of EE6) by Chuk</li>
<li>JVM based languages Clojure, Scala bu Chuk (guess more to come soon once the he add the other languages)</li>
<li>Pomodoro Time Management by me</li>
<li>Netbeans, Cobertura, Hudson hands-on by me</li>
</ul>
<p>You want to join ? Next meetup not yet scheduled. Drop by <a href="http://www.meetup.com/JUG-Singapore/" target="_blank">ww.meetup.com/JUG-Singapore</a></p>
  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/javadude.wordpress.com/759/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/javadude.wordpress.com/759/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/javadude.wordpress.com/759/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/javadude.wordpress.com/759/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/javadude.wordpress.com/759/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/javadude.wordpress.com/759/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/javadude.wordpress.com/759/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/javadude.wordpress.com/759/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/javadude.wordpress.com/759/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/javadude.wordpress.com/759/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=javadude.wordpress.com&blog=3891833&post=759&subd=javadude&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://javadude.wordpress.com/2009/11/05/singapore-jug-update/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/c590146f757718a268c168a7eee0f53f?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">devdude</media:title>
		</media:content>
	</item>
		<item>
		<title>Release Fever Update</title>
		<link>http://javadude.wordpress.com/2009/11/05/release-fever-update/</link>
		<comments>http://javadude.wordpress.com/2009/11/05/release-fever-update/#comments</comments>
		<pubDate>Thu, 05 Nov 2009 01:27:57 +0000</pubDate>
		<dc:creator>devdude</dc:creator>
				<category><![CDATA[news]]></category>
		<category><![CDATA[ee6]]></category>
		<category><![CDATA[netbeans]]></category>
		<category><![CDATA[ubuntu]]></category>
		<category><![CDATA[zk]]></category>

		<guid isPermaLink="false">http://javadude.wordpress.com/?p=757</guid>
		<description><![CDATA[Quite a number of new releases (that bother me) hit us the last few days (weeks) and more to come.

Ubuntu 9.10 (the broken Koala) (link)
Netbeans 6.8 BETA (link)
Java EE6 in NB 6.8B (official release eventually in December) (link)
ZK 3.6.3 (link)

       <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=javadude.wordpress.com&blog=3891833&post=757&subd=javadude&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p>Quite a number of new releases (that bother me) hit us the last few days (weeks) and more to come.</p>
<ul>
<li>Ubuntu 9.10 (the broken Koala) (link)</li>
<li>Netbeans 6.8 BETA (<a href="http://netbeans.org/community/releases/68/" target="_blank">link</a>)</li>
<li>Java EE6 in NB 6.8B (official release eventually in December) (link)</li>
<li>ZK 3.6.3 (<a href="http://docs.zkoss.org/wiki/New_Features_of_ZK_3.6.3" target="_blank">link</a>)</li>
</ul>
  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/javadude.wordpress.com/757/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/javadude.wordpress.com/757/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/javadude.wordpress.com/757/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/javadude.wordpress.com/757/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/javadude.wordpress.com/757/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/javadude.wordpress.com/757/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/javadude.wordpress.com/757/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/javadude.wordpress.com/757/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/javadude.wordpress.com/757/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/javadude.wordpress.com/757/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=javadude.wordpress.com&blog=3891833&post=757&subd=javadude&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://javadude.wordpress.com/2009/11/05/release-fever-update/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/c590146f757718a268c168a7eee0f53f?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">devdude</media:title>
		</media:content>
	</item>
		<item>
		<title>Tutorial: Getting started with Netbeans and JUnit plus Cobertura and Hudson (Part 3)</title>
		<link>http://javadude.wordpress.com/2009/09/26/tutorial-getting-started-with-netbeans-and-junit-plus-cobertura-and-hudson-part-3/</link>
		<comments>http://javadude.wordpress.com/2009/09/26/tutorial-getting-started-with-netbeans-and-junit-plus-cobertura-and-hudson-part-3/#comments</comments>
		<pubDate>Sat, 26 Sep 2009 09:18:47 +0000</pubDate>
		<dc:creator>devdude</dc:creator>
				<category><![CDATA[HowTo]]></category>
		<category><![CDATA[netbeans]]></category>
		<category><![CDATA[tutorial]]></category>
		<category><![CDATA[cobertura]]></category>
		<category><![CDATA[code coverage]]></category>
		<category><![CDATA[hudson]]></category>
		<category><![CDATA[junit]]></category>
		<category><![CDATA[test]]></category>

		<guid isPermaLink="false">http://javadude.wordpress.com/?p=729</guid>
		<description><![CDATA[Following part 1 and 2 which covered the JUnit test class creation and the coverage evaluation by Cobertura, we will add in part 3 another dimension: Automation. So far we run the tests manually, but we want to achieve a continuous integration and test environment.
Part 3 (Cobertura and Hudson)
Preparation:

Part 1 (link)
Part 2 (link)
Download Hudson (website)
Running [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=javadude.wordpress.com&blog=3891833&post=729&subd=javadude&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p>Following part 1 and 2 which covered the JUnit test class creation and the coverage evaluation by Cobertura, we will add in part 3 another dimension: Automation. So far we run the tests manually, but we want to achieve a continuous integration and test environment.</p>
<p><strong>Part 3 (Cobertura and Hudson</strong>)</p>
<p style="text-align:justify;"><strong>Preparation</strong>:</p>
<ul>
<li>Part 1 (<a href="http://javadude.wordpress.com/2009/09/25/tutorial-getting-started-with-netbeans-and-junit-plus-cobertura/" target="_blank">link</a>)</li>
<li>Part 2 (<a href="http://javadude.wordpress.com/2009/09/25/tutorial-getting-started-with-netbeans-and-junit-plus-cobertura-part-2/" target="_blank">link</a>)</li>
<li>Download Hudson (<a href="https://hudson.dev.java.net/" target="_blank">website</a>)</li>
<li>Running Subversion with the project uploaded<br />
<span id="more-729"></span></li>
</ul>
<p><strong>Tutorial:</strong></p>
<ul>
<li><strong>Download and install Hudson</strong><br />
Hudson can run standalone (easier for testing, trialing and experimenting) or as a deployed application on an application server.<br />
Once you downloaded it, just navigate with a terminal session (aka Dos-Box) and start it with &#8220;<em>java -jar hudson.war</em>&#8220;<br />
You will get something like this:</p>
<div id="attachment_734" class="wp-caption alignnone" style="width: 310px"><a href="http://javadude.files.wordpress.com/2009/09/svh20090925_013.jpeg"><img class="size-medium wp-image-734" title="SVH20090925_013" src="http://javadude.files.wordpress.com/2009/09/svh20090925_013.jpeg?w=300&#038;h=217" alt="Hudson" width="300" height="217" /></a><p class="wp-caption-text">Hudson</p></div>
<p>I will not go into any details of how to configure Hudson, but jump straight to our project. Maybe in another tutorial I will explain the basic setup of Hudson, but it so simple and the documentation is so good, it is easy for your to do the necessary settings.</li>
<li><strong>Tweak our Netbeans Project</strong><br />
As per standard setting when creating a new Netbeans project, the libraries are not kept in the project folder, but copied for deployment only. But Hudson need to access these libraries, one approach to solve this, is to keep the library files in the project folder.</p>
<div id="attachment_733" class="wp-caption alignnone" style="width: 267px"><a href="http://javadude.files.wordpress.com/2009/09/svh20090925_012.jpeg"><img class="size-medium wp-image-733" title="SVH20090925_012" src="http://javadude.files.wordpress.com/2009/09/svh20090925_012.jpeg?w=257&#038;h=300" alt="Netbeans Project" width="257" height="300" /></a><p class="wp-caption-text">Netbeans Project (Standard Folder)</p></div>
<div id="attachment_736" class="wp-caption alignnone" style="width: 310px"><a href="http://javadude.files.wordpress.com/2009/09/svh20090925_015.jpeg"><img class="size-medium wp-image-736" title="SVH20090925_015" src="http://javadude.files.wordpress.com/2009/09/svh20090925_015.jpeg?w=300&#038;h=216" alt="SVH20090925_015" width="300" height="216" /></a><p class="wp-caption-text">Local Libraries</p></div>
<p>Open the project in Netbeans and open the project properties (right click project name).  In the libraries section you just click Browse and Next.</p>
<div id="attachment_737" class="wp-caption alignnone" style="width: 310px"><a href="http://javadude.files.wordpress.com/2009/09/svh20090925_016.jpeg"><img class="size-medium wp-image-737" title="SVH20090925_016" src="http://javadude.files.wordpress.com/2009/09/svh20090925_016.jpeg?w=300&#038;h=185" alt="Libraries" width="300" height="185" /></a><p class="wp-caption-text">Libraries</p></div>
<p>Once this is done the libraries are kept locally in your project folder.<br />
Now comes the interesting part, you remember the recommendation from the previous part of the tutorial saying you should modify only the build.xml file ?</p>
<div id="attachment_738" class="wp-caption alignnone" style="width: 310px"><a href="http://javadude.files.wordpress.com/2009/09/svh20090925_017.jpeg"><img class="size-medium wp-image-738" title="SVH20090925_017" src="http://javadude.files.wordpress.com/2009/09/svh20090925_017.jpeg?w=300&#038;h=123" alt="build-impl.xml" width="300" height="123" /></a><p class="wp-caption-text">build-impl.xml</p></div>
<p>Netbeans needs to recreate its build file after our changes. So either we change it for Netbeans and select cancel (not knowing what changes need to be done) or we redo our changes or keep them finally in our own build.xml file.</li>
<li><strong>Create new Job in Hudson</strong><br />
Your Hudson is running and you can access it via http://localhost:8080 (assuming you run it as standalone on your local machine)<br />
You see a mainpage like this</p>
<div id="attachment_741" class="wp-caption alignnone" style="width: 310px"><a href="http://javadude.files.wordpress.com/2009/09/svh20090926_001.jpeg"><img class="size-medium wp-image-741" title="SVH20090926_001" src="http://javadude.files.wordpress.com/2009/09/svh20090926_001.jpeg?w=300&#038;h=154" alt="Hudson Portal" width="300" height="154" /></a><p class="wp-caption-text">Hudson Portal</p></div>
<p><strong>Create new Hudson Job</strong> (Build a free-style software project)</p>
<div id="attachment_743" class="wp-caption alignnone" style="width: 310px"><a href="http://javadude.files.wordpress.com/2009/09/svh20090926_003.jpeg"><img class="size-medium wp-image-743" title="SVH20090926_003" src="http://javadude.files.wordpress.com/2009/09/svh20090926_003.jpeg?w=300&#038;h=154" alt="Create new Hudson Job" width="300" height="154" /></a><p class="wp-caption-text">Create new Hudson Job</p></div>
<p><strong>Configuration</strong> of new Job in Hudson</p>
<div id="attachment_742" class="wp-caption alignnone" style="width: 299px"><a href="http://javadude.files.wordpress.com/2009/09/svh20090926_004.jpeg"><img class="size-medium wp-image-742" title="SVH20090926_004" src="http://javadude.files.wordpress.com/2009/09/svh20090926_004.jpeg?w=289&#038;h=300" alt="New Hudson Job" width="289" height="300" /></a><p class="wp-caption-text">New Hudson Job</p></div>
<p>The following parts of the configuration page are interesting for us<br />
<strong>SVN repository</strong></p>
<div id="attachment_744" class="wp-caption alignnone" style="width: 310px"><a href="http://javadude.files.wordpress.com/2009/09/svh20090926_005.jpeg"><img class="size-medium wp-image-744" title="SVH20090926_005" src="http://javadude.files.wordpress.com/2009/09/svh20090926_005.jpeg?w=300&#038;h=137" alt="SVN" width="300" height="137" /></a><p class="wp-caption-text">SVN</p></div>
<p><strong>Invoke Ant</strong> (please note it needs to be downloaded and configured first in the main Hudson configuration)</p>
<div id="attachment_745" class="wp-caption alignnone" style="width: 310px"><a href="http://javadude.files.wordpress.com/2009/09/svh20090926_006.jpeg"><img class="size-medium wp-image-745" title="SVH20090926_006" src="http://javadude.files.wordpress.com/2009/09/svh20090926_006.jpeg?w=300&#038;h=72" alt="Invoke Ant" width="300" height="72" /></a><p class="wp-caption-text">Invoke Ant</p></div>
<p><strong>Trigger JUnit Report Creation</strong> (default path is usually <em>**/build/test/results/*.xml</em>)</p>
<div id="attachment_746" class="wp-caption alignnone" style="width: 310px"><a href="http://javadude.files.wordpress.com/2009/09/svh20090926_007.jpeg"><img class="size-medium wp-image-746" title="SVH20090926_007" src="http://javadude.files.wordpress.com/2009/09/svh20090926_007.jpeg?w=300&#038;h=48" alt="JUnit Report" width="300" height="48" /></a><p class="wp-caption-text">JUnit Report</p></div>
<p><strong>Trigger Corbertura Report</strong> (default path is <em>**/build/report/cobertura/coverage.xml</em>)</p>
<div id="attachment_747" class="wp-caption alignnone" style="width: 310px"><a href="http://javadude.files.wordpress.com/2009/09/svh20090926_008.jpeg"><img class="size-medium wp-image-747" title="SVH20090926_008" src="http://javadude.files.wordpress.com/2009/09/svh20090926_008.jpeg?w=300&#038;h=127" alt="Trigger Cobertura Report" width="300" height="127" /></a><p class="wp-caption-text">Trigger Cobertura Report</p></div>
<p>All other configuration we dont need right now (I added the email function to drop me an email if the build is broken).</li>
<li><strong>Trigger the first Build</strong>
<div id="attachment_749" class="wp-caption alignnone" style="width: 310px"><a href="http://javadude.files.wordpress.com/2009/09/svh20090926_010.jpeg"><img class="size-medium wp-image-749" title="SVH20090926_010" src="http://javadude.files.wordpress.com/2009/09/svh20090926_010.jpeg?w=300&#038;h=220" alt="Job Screen (no build yet)" width="300" height="220" /></a><p class="wp-caption-text">Job Screen (no build yet)</p></div>
<div id="attachment_750" class="wp-caption alignnone" style="width: 310px"><a href="http://javadude.files.wordpress.com/2009/09/svh20090926_011.jpeg"><img class="size-medium wp-image-750" title="SVH20090926_011" src="http://javadude.files.wordpress.com/2009/09/svh20090926_011.jpeg?w=300&#038;h=220" alt="First Build" width="300" height="220" /></a><p class="wp-caption-text">First Build</p></div>
<p>If everything is running fine we should have result like this (inclusive all Ant and JUnit log output)</p>
<pre class="brush: xml;">
...
BUILD SUCCESSFUL
Total time: 10 seconds
Recording test results
Publishing Cobertura coverage report...
Publishing Cobertura coverage results...
Finished: SUCCESS
</pre>
<p>Starting with the second build we will see a graph giving us tendencies over the last builds.<br />
In our sample project we have covered 100% of the classes but only 50% of the lines.</p>
<div id="attachment_751" class="wp-caption alignnone" style="width: 310px"><a href="http://javadude.files.wordpress.com/2009/09/svh20090926_013.jpeg"><img class="size-medium wp-image-751" title="SVH20090926_013" src="http://javadude.files.wordpress.com/2009/09/svh20090926_013.jpeg?w=300&#038;h=265" alt="kk" width="300" height="265" /></a><p class="wp-caption-text">Build Overview</p></div>
<p>Test Code 50%<br />
@Test<br />
public void testApp() {<br />
TestMe tst = new TestMe();<br />
int res = tst.doSomething(3);<br />
assertEquals(&#8220;Correct value&#8221;, 0, res);</p>
<p>//res = tst.doSomething(6);<br />
//assertEquals(&#8220;Correct value&#8221;, 2, res);</p>
<p>//res = tst.doSomething(11);<br />
//assertEquals(&#8220;Correct value&#8221;, -1, res);<br />
}</p>
<p>Lets re-insert the full test code and we get this after our next build:</p>
<p><div id="attachment_753" class="wp-caption alignnone" style="width: 310px"><a href="http://javadude.files.wordpress.com/2009/09/svh20090926_014.jpeg"><img class="size-medium wp-image-753" title="SVH20090926_014" src="http://javadude.files.wordpress.com/2009/09/svh20090926_014.jpeg?w=300&#038;h=265" alt="b" width="300" height="265" /></a><p class="wp-caption-text">Build Overview</p></div></li>
</ul>
<p><strong>Where to go from here:</strong></p>
<ul>
<li>Explore all the features of Hudson, eg. Javadoc feature, trigger other builds and use fingerprints.</li>
<li>Make Hudson production ready by deploying it on an application server such as Glassfish and securing it with logins,..</li>
</ul>
<p><strong>What else could I plug-in or do:</strong></p>
<ul>
<li>There is a huge number of plugins available that help you to integrate with all kind of tools and frameworks.</li>
<li>You can try the Netbeans Hudson feature (version 6.7 and higher)</li>
<li>You could try using the Firefox plugin to constantly see the build status.</li>
</ul>
  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/javadude.wordpress.com/729/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/javadude.wordpress.com/729/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/javadude.wordpress.com/729/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/javadude.wordpress.com/729/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/javadude.wordpress.com/729/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/javadude.wordpress.com/729/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/javadude.wordpress.com/729/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/javadude.wordpress.com/729/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/javadude.wordpress.com/729/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/javadude.wordpress.com/729/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=javadude.wordpress.com&blog=3891833&post=729&subd=javadude&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://javadude.wordpress.com/2009/09/26/tutorial-getting-started-with-netbeans-and-junit-plus-cobertura-and-hudson-part-3/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/c590146f757718a268c168a7eee0f53f?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">devdude</media:title>
		</media:content>

		<media:content url="http://javadude.files.wordpress.com/2009/09/svh20090925_013.jpeg?w=300" medium="image">
			<media:title type="html">SVH20090925_013</media:title>
		</media:content>

		<media:content url="http://javadude.files.wordpress.com/2009/09/svh20090925_012.jpeg?w=257" medium="image">
			<media:title type="html">SVH20090925_012</media:title>
		</media:content>

		<media:content url="http://javadude.files.wordpress.com/2009/09/svh20090925_015.jpeg?w=300" medium="image">
			<media:title type="html">SVH20090925_015</media:title>
		</media:content>

		<media:content url="http://javadude.files.wordpress.com/2009/09/svh20090925_016.jpeg?w=300" medium="image">
			<media:title type="html">SVH20090925_016</media:title>
		</media:content>

		<media:content url="http://javadude.files.wordpress.com/2009/09/svh20090925_017.jpeg?w=300" medium="image">
			<media:title type="html">SVH20090925_017</media:title>
		</media:content>

		<media:content url="http://javadude.files.wordpress.com/2009/09/svh20090926_001.jpeg?w=300" medium="image">
			<media:title type="html">SVH20090926_001</media:title>
		</media:content>

		<media:content url="http://javadude.files.wordpress.com/2009/09/svh20090926_003.jpeg?w=300" medium="image">
			<media:title type="html">SVH20090926_003</media:title>
		</media:content>

		<media:content url="http://javadude.files.wordpress.com/2009/09/svh20090926_004.jpeg?w=289" medium="image">
			<media:title type="html">SVH20090926_004</media:title>
		</media:content>

		<media:content url="http://javadude.files.wordpress.com/2009/09/svh20090926_005.jpeg?w=300" medium="image">
			<media:title type="html">SVH20090926_005</media:title>
		</media:content>

		<media:content url="http://javadude.files.wordpress.com/2009/09/svh20090926_006.jpeg?w=300" medium="image">
			<media:title type="html">SVH20090926_006</media:title>
		</media:content>

		<media:content url="http://javadude.files.wordpress.com/2009/09/svh20090926_007.jpeg?w=300" medium="image">
			<media:title type="html">SVH20090926_007</media:title>
		</media:content>

		<media:content url="http://javadude.files.wordpress.com/2009/09/svh20090926_008.jpeg?w=300" medium="image">
			<media:title type="html">SVH20090926_008</media:title>
		</media:content>

		<media:content url="http://javadude.files.wordpress.com/2009/09/svh20090926_010.jpeg?w=300" medium="image">
			<media:title type="html">SVH20090926_010</media:title>
		</media:content>

		<media:content url="http://javadude.files.wordpress.com/2009/09/svh20090926_011.jpeg?w=300" medium="image">
			<media:title type="html">SVH20090926_011</media:title>
		</media:content>

		<media:content url="http://javadude.files.wordpress.com/2009/09/svh20090926_013.jpeg?w=300" medium="image">
			<media:title type="html">SVH20090926_013</media:title>
		</media:content>

		<media:content url="http://javadude.files.wordpress.com/2009/09/svh20090926_014.jpeg?w=300" medium="image">
			<media:title type="html">SVH20090926_014</media:title>
		</media:content>
	</item>
		<item>
		<title>Tutorial: Getting started with Netbeans and JUnit plus Cobertura (Part 2)</title>
		<link>http://javadude.wordpress.com/2009/09/25/tutorial-getting-started-with-netbeans-and-junit-plus-cobertura-part-2/</link>
		<comments>http://javadude.wordpress.com/2009/09/25/tutorial-getting-started-with-netbeans-and-junit-plus-cobertura-part-2/#comments</comments>
		<pubDate>Fri, 25 Sep 2009 04:33:05 +0000</pubDate>
		<dc:creator>devdude</dc:creator>
				<category><![CDATA[HowTo]]></category>
		<category><![CDATA[netbeans]]></category>
		<category><![CDATA[tutorial]]></category>
		<category><![CDATA[ci]]></category>
		<category><![CDATA[cobertura]]></category>
		<category><![CDATA[code coverage]]></category>
		<category><![CDATA[hudson]]></category>
		<category><![CDATA[junit]]></category>
		<category><![CDATA[test]]></category>

		<guid isPermaLink="false">http://javadude.wordpress.com/?p=708</guid>
		<description><![CDATA[Following part 1 which covered the class and JUnit class creation and ended in a suspected successful test.
Part 1 (covering Cobertura setup and execution)
Preparation:

Part 1 (link)
Download Cobertura (website)


Tutorial:

 Extract the Cobertura file (named cobertura-1.9.3-bin.zip, 1.9.3 is the actual version at the time of creation of this tutorial)
You will find 4 library files (jars) that you [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=javadude.wordpress.com&blog=3891833&post=708&subd=javadude&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p>Following part 1 which covered the class and JUnit class creation and ended in a suspected successful test.</p>
<p><strong>Part 1 (covering Cobertura setup and execution</strong>)</p>
<p style="text-align:justify;"><strong>Preparation</strong>:</p>
<ul>
<li>Part 1 (<a href="http://javadude.wordpress.com/2009/09/25/tutorial-getting-started-with-netbeans-and-junit-plus-cobertura/" target="_blank">link</a>)</li>
<li>Download Cobertura (<a href="http://cobertura.sourceforge.net/index.html" target="_blank">website</a>)<br />
<span id="more-708"></span></li>
</ul>
<p><strong>Tutorial</strong>:</p>
<ul>
<li> <strong>Extract the Cobertura file </strong>(named cobertura-1.9.3-bin.zip, 1.9.3 is the actual version at the time of creation of this tutorial)<br />
You will find 4 library files (jars) that you need to copy somewhere. I copied them into my <em>ANT folder</em> under <em>Netbeans</em> for this tutorial, but I would recommend to copy the files into the lib folder of your project.</p>
<div id="attachment_711" class="wp-caption alignnone" style="width: 310px"><a href="http://javadude.files.wordpress.com/2009/09/svh20090925_001.jpeg"><img class="size-medium wp-image-711" title="SVH20090925_001" src="http://javadude.files.wordpress.com/2009/09/svh20090925_001.jpeg?w=300&#038;h=141" alt="Cobertura Tutorial" width="300" height="141" /></a><p class="wp-caption-text">Cobertura Tutorial</p></div>
<div id="attachment_712" class="wp-caption alignnone" style="width: 294px"><a href="http://javadude.files.wordpress.com/2009/09/svh20090925_002.jpeg"><img class="size-medium wp-image-712" title="SVH20090925_002" src="http://javadude.files.wordpress.com/2009/09/svh20090925_002.jpeg?w=284&#038;h=300" alt="Cobertura Tutorial" width="284" height="300" /></a><p class="wp-caption-text">Cobertura Tutorial</p></div></li>
<li><strong>Add the libraries to our project</strong><br />
<em>Project Properties|Libraries|Run Test folder</em><br />
As I remarked before, here I point to a relative path outside my project folder which is not good practice.</p>
<p><div id="attachment_702" class="wp-caption alignnone" style="width: 310px"><a href="http://javadude.files.wordpress.com/2009/09/svh20090924_009.jpeg"><img class="size-medium wp-image-702" title="SVH20090924_009" src="http://javadude.files.wordpress.com/2009/09/svh20090924_009.jpeg?w=300&#038;h=216" alt="Cobertura Tutorial" width="300" height="216" /></a><p class="wp-caption-text">Cobertura Tutorial</p></div></li>
<li><strong>Modify the Netbeans project properties file</strong><br />
There is currently no Cobertura plugin available for Netbeans (at least I am not aware of one, except one on project kenai server, but it&#8217;s not implemented yet)<br />
Open the file explorer view of our project and opent he file project.properties (which is created by Netbeans and updated when we change project settings). For serious projects I recommend to always make a copy before manually changing its content.<br />
We add 3 lines for our instrumented class files.</p>
<p><div id="attachment_713" class="wp-caption alignnone" style="width: 309px"><a href="http://javadude.files.wordpress.com/2009/09/svh20090925_003.jpeg"><img class="size-medium wp-image-713" title="SVH20090925_003" src="http://javadude.files.wordpress.com/2009/09/svh20090925_003.jpeg?w=299&#038;h=148" alt="c" width="299" height="148" /></a><p class="wp-caption-text">Cobertura Tutorial</p></div>
<div id="attachment_703" class="wp-caption alignnone" style="width: 310px"><a href="http://javadude.files.wordpress.com/2009/09/svh20090924_010.jpeg"><img class="size-medium wp-image-703" title="SVH20090924_010" src="http://javadude.files.wordpress.com/2009/09/svh20090924_010.jpeg?w=300&#038;h=124" alt="Cobertura Tutorial" width="300" height="124" /></a><p class="wp-caption-text">Cobertura Tutorial</p></div>
<pre class="brush: xml;">
# FOR COBERTURA
build.instrumented.dir=${build.dir}/instrumented
build.report.dir=${build.dir}/report
build.report.cobertura.dir=${build.report.dir}/cobertura
</pre>
</li>
<li><strong>Modify the Ant build script </strong><br />
Ant can do a lot, Maven maybe more. I am not an Ant expert, but at least I could bend  my brain around it and figure out how it works. So far I was the lazy Netbeans user &#8220;what is ant?&#8221;<br />
I will not explain Ant (curious readers can proceed to <a href="http://ant.apache.org/" target="_blank">ant.apache.org</a>), but you should understand the concept of tasks and dependencies.<br />
Netbeans creates to build files: a <em>build.xml</em> in your project root and a <em>build-impl.xml</em> in the nbproject subfolder. You are advised to add ant tasks in the <em>build.xml</em> file, the other file is maintained by Netbeans.<br />
First we need to tell ant to create the instrumented class files (Cobertura add some stuff to each line of our byte code). The instrumented bytecode is kept separately and does not affect our production classes.<br />
open the build.xml file, it should be empty except some header (that also imports the other buildfile) and some remarks explaining how it works. Right at the end (before the &lt;/project&gt;)  we add this</p>
<pre class="brush: xml;">
&lt;property environment=&quot;env&quot;/&gt;
&lt;taskdef classpath=&quot;cobertura.jar&quot; resource=&quot;tasks.properties&quot;/&gt;
&lt;target name=&quot;-pre-compile-test&quot;&gt;
 &lt;delete dir=&quot;${build.instrumented.dir}&quot; /&gt;
 &lt;delete dir=&quot;${build.report.cobertura.dir}&quot; /&gt;
 &lt;mkdir dir=&quot;${build.instrumented.dir}&quot; /&gt;
 &lt;mkdir dir=&quot;${build.report.cobertura.dir}&quot; /&gt;
 &lt;cobertura-instrument todir=&quot;${build.instrumented.dir}&quot;&gt;
 &lt;fileset dir=&quot;${build.classes.dir}&quot;&gt;
 &lt;include name=&quot;**/*.class&quot;/&gt;
 &lt;/fileset&gt;
 &lt;/cobertura-instrument&gt;
&lt;/target&gt;
</pre>
<p>It is not a new task (there are no dependencies here) but it overrides the task with same name in the build-impl.xml file.</p>
<pre class="brush: xml;">
&lt;    &lt;target name=&quot;-post-compile-test&quot;&gt;
 &lt;!-- Empty placeholder for easier customization. --&gt;
 &lt;!-- You can override this target in the ../build.xml file. --&gt;
 &lt;/target&gt;
</pre>
<p>Every time we test the whole project this task is called and will create the instrumented class files for us.</li>
<li><strong>Modify the class path for test execution</strong><br />
This is the part which I didnt figure as fast. The cobertura result was created and always showed 0% coverage. You need to tell Netbeans/Ant to use the instrumented classes for the test not the regular ones in your build folder.</p>
<div id="attachment_717" class="wp-caption alignnone" style="width: 267px"><a href="http://javadude.files.wordpress.com/2009/09/svh20090925_004.jpeg"><img class="size-full wp-image-717" title="SVH20090925_004" src="http://javadude.files.wordpress.com/2009/09/svh20090925_004.jpeg?w=257&#038;h=200" alt="Cobertura Tutorial" width="257" height="200" /></a><p class="wp-caption-text">Cobertura Tutorial</p></div>
<p>Open the project.properties file again and make sure to add the line <strong>${build.instrumented.dir}:\</strong> before your regular build path.<br />
Note the entries with ${file.reference.asm-3.0.jar}:\ were added by Netbeans when we added the Cobertura libraries. You could adjust the classpath order using the project properties as well.</p>
<pre class="brush: xml;">
javac.test.classpath=\
 ${javac.classpath}:\
 ${build.instrumented.dir}:\
 ${build.classes.dir}:\
 ${libs.junit_4.classpath}
..
run.test.classpath=\
 ${javac.test.classpath}:\
 ${build.instrumented.dir}:\
 ${build.test.classes.dir}:\
 ${file.reference.asm-3.0.jar}:\
 ${file.reference.asm-tree-3.0.jar}:\
 ${file.reference.cobertura.jar}:\
 ${file.reference.jakarta-oro-2.0.8.jar}:\
 ${file.reference.log4j-1.2.9.jar}
</pre>
<p>Executing the test for our project now will use the instrumented classes and creates a coverage result files for us (cobertura.ser, NO, you cant open the file in the editor)</li>
<li><strong>Modify the build script</strong> to convert the result file in human readable websites.<br />
I do this (breaking the previous rule) in the build-impl.xml file, but it would be fairly easy to migrate this to &#8220;our&#8221; build.xml file.<br />
Look for this section</p>
<pre class="brush: xml;">
 &lt;target depends=&quot;init,compile-test,-pre-test-run,-do-test-run&quot; if=&quot;have.tests&quot; name=&quot;-post-test-run&quot;&gt;
 &lt;fail if=&quot;tests.failed&quot;&gt;Some tests failed; see details above.&lt;/fail&gt;
 &lt;/target&gt;
</pre>
<p>and ammend it:</p>
<pre class="brush: xml;">
 &lt;target depends=&quot;init,compile-test,-pre-test-run,-do-test-run&quot; if=&quot;have.tests&quot; name=&quot;-post-test-run&quot;&gt;
 &lt;fail if=&quot;tests.failed&quot;&gt;Some tests failed; see details above.&lt;/fail&gt;
 &lt;!-- You can disable the html portion if you are using the hudson plugin and rely on the xml --&gt;
 &lt;cobertura-report format=&quot;html&quot; srcdir=&quot;${src.dir}&quot; destdir=&quot;${build.report.cobertura.dir}&quot;/&gt;
 &lt;!-- Used by the hudson plug-in --&gt;
 &lt;cobertura-report format=&quot;xml&quot; srcdir=&quot;${src.dir}&quot; destdir=&quot;${build.report.cobertura.dir}&quot;/&gt;
 &lt;delete file=&quot;cobertura.ser&quot; /&gt;
 &lt;/target&gt;
</pre>
</li>
<li><strong>Execute the tests and enjoy the results</strong><br />
You trigger the test for the whole project and your output will be like this</p>
<pre class="brush: xml;">
init:
deps-jar:
compile:
Deleting directory /home/sven/NetBeansProjects/CoberturaDemo/build/instrumented
Deleting directory /home/sven/NetBeansProjects/CoberturaDemo/build/report/cobertura
Created dir: /home/sven/NetBeansProjects/CoberturaDemo/build/instrumented
Created dir: /home/sven/NetBeansProjects/CoberturaDemo/build/report/cobertura
Cobertura 1.9.3 - GNU GPL License (NO WARRANTY) - See COPYRIGHT file
Cobertura 1.9.3 - GNU GPL License (NO WARRANTY) - See COPYRIGHT file
Instrumenting 1 file to /home/sven/NetBeansProjects/CoberturaDemo/build/instrumented
Instrumenting 1 file to /home/sven/NetBeansProjects/CoberturaDemo/build/instrumented
Cobertura: Saved information on 1 classes.
Cobertura: Saved information on 1 classes.
Instrument time: 77ms
Instrument time: 77ms
compile-test:
Testsuite: demo.TestMeTest
Smaller than 5
Tests run: 1, Failures: 0, Errors: 0, Time elapsed: 0.099 sec

------------- Standard Output ---------------
Smaller than 5
------------- ---------------- ---------------
Cobertura: Loaded information on 1 classes.
Cobertura: Saved information on 1 classes.
test-report:
Cobertura 1.9.3 - GNU GPL License (NO WARRANTY) - See COPYRIGHT file
Cobertura 1.9.3 - GNU GPL License (NO WARRANTY) - See COPYRIGHT file
Cobertura: Loaded information on 1 classes.
Cobertura: Loaded information on 1 classes.
Report time: 251ms
Report time: 251ms
Cobertura 1.9.3 - GNU GPL License (NO WARRANTY) - See COPYRIGHT file
Cobertura 1.9.3 - GNU GPL License (NO WARRANTY) - See COPYRIGHT file
Cobertura: Loaded information on 1 classes.
Cobertura: Loaded information on 1 classes.
Report time: 107ms
Report time: 107ms
Deleting: /home/sven/NetBeansProjects/CoberturaDemo/cobertura.ser
test:
BUILD SUCCESSFUL (total time: 3 seconds)
</pre>
<p>You still will end up seeing the JUnit test result pane with &#8220;test passed&#8221;, but lets go to the report folder in our project and open the index.html file (Ignore the coverage.xml file because it is used by theHudson plugin that we will discuss in part 3)</p>
<div id="attachment_719" class="wp-caption alignnone" style="width: 310px"><a href="http://javadude.files.wordpress.com/2009/09/svh20090925_005.jpeg"><img class="size-medium wp-image-719" title="SVH20090925_005" src="http://javadude.files.wordpress.com/2009/09/svh20090925_005.jpeg?w=300&#038;h=238" alt="Coberture Tutorial" width="300" height="238" /></a><p class="wp-caption-text">Coberture Tutorial</p></div>
<p>Ops, there is still something in <span style="color:#ff0000;"><strong>red</strong></span> !</p>
<div id="attachment_720" class="wp-caption alignnone" style="width: 310px"><a href="http://javadude.files.wordpress.com/2009/09/svh20090925_007.jpeg"><img class="size-medium wp-image-720" title="SVH20090925_007" src="http://javadude.files.wordpress.com/2009/09/svh20090925_007.jpeg?w=300&#038;h=144" alt="Corbertura Tutorial" width="300" height="144" /></a><p class="wp-caption-text">Corbertura Tutorial</p></div>
<p>Cobertura tells us exactly which part of our method was never touched by our tests !</p>
<div id="attachment_721" class="wp-caption alignnone" style="width: 310px"><a href="http://javadude.files.wordpress.com/2009/09/svh20090925_008.jpeg"><img class="size-medium wp-image-721" title="SVH20090925_008" src="http://javadude.files.wordpress.com/2009/09/svh20090925_008.jpeg?w=300&#038;h=164" alt="Corbertura Tutorial" width="300" height="164" /></a><p class="wp-caption-text">Corbertura Tutorial</p></div></li>
<li>Increase the code coverage|<br />
Lets go back to our project and add test cases</p>
<pre class="brush: java;">
..
 @Test
 public void testApp() {
 TestMe tst = new TestMe();
 int res = tst.doSomething(3);
 assertEquals(&quot;Correct value&quot;, 0, res);

 res = tst.doSomething(6);
 assertEquals(&quot;Correct value&quot;, 2, res);

 res = tst.doSomething(11);
 assertEquals(&quot;Correct value&quot;, -1, res);
 }
..
</pre>
<p>and test again</p>
<p><div id="attachment_722" class="wp-caption alignnone" style="width: 310px"><a href="http://javadude.files.wordpress.com/2009/09/svh20090925_010.jpeg"><img class="size-medium wp-image-722" title="SVH20090925_010" src="http://javadude.files.wordpress.com/2009/09/svh20090925_010.jpeg?w=300&#038;h=164" alt="Cobertura Tutorial" width="300" height="164" /></a><p class="wp-caption-text">Cobertura Tutorial</p></div>
<p>Voila ! All lines and branches are covered. 100% (Find my remark later)&#8230;<span style="color:#339966;"><strong>GREEN</strong></span> all over.</p>
<p><div id="attachment_723" class="wp-caption alignnone" style="width: 310px"><a href="http://javadude.files.wordpress.com/2009/09/svh20090925_011.jpeg"><img class="size-medium wp-image-723" title="SVH20090925_011" src="http://javadude.files.wordpress.com/2009/09/svh20090925_011.jpeg?w=300&#038;h=164" alt="Cobertura Tutorial" width="300" height="164" /></a><p class="wp-caption-text">Cobertura Tutorial</p></div></li>
</ul>
<p><strong>Resume:</strong><br />
I love this tool. Thanks for creating it. I cant add quality to the source (it is open source) but at least I could create this tutorial for more folks to get started. Use Corbertura !<br />
I will try Corbertura with Hudson in the next part and also try it on web applications.<br />
<strong><br />
2 more remark</strong>:<br />
Dont let fool yourself in the assumptions that covering all lines in your codebase really reflects a complete test, you still need to test the business logic of your application against various use cases !<br />
In reality 100% coder coverage is not realistic. The complexity explodes with combination of for/while loops combined with if statements, and also platform dependendant or very exceptional parts might not be possible to be covered. But try your best <img src='http://s.wordpress.com/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' /><br />
<strong>References:</strong><br />
I could not get the tutorial running without using this pre-existing fragments/snippets/ideas and websites</p>
<ul>
<li>http://cobertura.sourceforge.net</li>
<li>http://ant.apache.org/</li>
<li>http://wiki.netbeans.org/CoberturaAnt</li>
<li>http://www.devdaily.com/blog/post/java/sample-cobertura-ant-build-script/</li>
<li>http://www.ibm.com/developerworks/java/library/j-cobertura/</li>
<li>http://weblogs.java.net/blog/fabriziogiudici/archive/2007/02/automating_test.html</li>
<li>http://cobertura.sourceforge.net/mavenCobertura.html</li>
<li>http://kenai.com/projects/nbcobertura</li>
</ul>
<p><strong>Update (2009-09-25):</strong><br />
There is a problem with the path of Cobertura. The above tutorial only works because the 4 jar files are in the ant folder, which is in the path !  I realized this after testing the project in a different environment.</p>
  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/javadude.wordpress.com/708/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/javadude.wordpress.com/708/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/javadude.wordpress.com/708/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/javadude.wordpress.com/708/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/javadude.wordpress.com/708/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/javadude.wordpress.com/708/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/javadude.wordpress.com/708/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/javadude.wordpress.com/708/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/javadude.wordpress.com/708/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/javadude.wordpress.com/708/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=javadude.wordpress.com&blog=3891833&post=708&subd=javadude&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://javadude.wordpress.com/2009/09/25/tutorial-getting-started-with-netbeans-and-junit-plus-cobertura-part-2/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/c590146f757718a268c168a7eee0f53f?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">devdude</media:title>
		</media:content>

		<media:content url="http://javadude.files.wordpress.com/2009/09/svh20090925_001.jpeg?w=300" medium="image">
			<media:title type="html">SVH20090925_001</media:title>
		</media:content>

		<media:content url="http://javadude.files.wordpress.com/2009/09/svh20090925_002.jpeg?w=284" medium="image">
			<media:title type="html">SVH20090925_002</media:title>
		</media:content>

		<media:content url="http://javadude.files.wordpress.com/2009/09/svh20090924_009.jpeg?w=300" medium="image">
			<media:title type="html">SVH20090924_009</media:title>
		</media:content>

		<media:content url="http://javadude.files.wordpress.com/2009/09/svh20090925_003.jpeg?w=299" medium="image">
			<media:title type="html">SVH20090925_003</media:title>
		</media:content>

		<media:content url="http://javadude.files.wordpress.com/2009/09/svh20090924_010.jpeg?w=300" medium="image">
			<media:title type="html">SVH20090924_010</media:title>
		</media:content>

		<media:content url="http://javadude.files.wordpress.com/2009/09/svh20090925_004.jpeg" medium="image">
			<media:title type="html">SVH20090925_004</media:title>
		</media:content>

		<media:content url="http://javadude.files.wordpress.com/2009/09/svh20090925_005.jpeg?w=300" medium="image">
			<media:title type="html">SVH20090925_005</media:title>
		</media:content>

		<media:content url="http://javadude.files.wordpress.com/2009/09/svh20090925_007.jpeg?w=300" medium="image">
			<media:title type="html">SVH20090925_007</media:title>
		</media:content>

		<media:content url="http://javadude.files.wordpress.com/2009/09/svh20090925_008.jpeg?w=300" medium="image">
			<media:title type="html">SVH20090925_008</media:title>
		</media:content>

		<media:content url="http://javadude.files.wordpress.com/2009/09/svh20090925_010.jpeg?w=300" medium="image">
			<media:title type="html">SVH20090925_010</media:title>
		</media:content>

		<media:content url="http://javadude.files.wordpress.com/2009/09/svh20090925_011.jpeg?w=300" medium="image">
			<media:title type="html">SVH20090925_011</media:title>
		</media:content>
	</item>
		<item>
		<title>Tutorial: Getting started with Netbeans and JUnit plus Cobertura (Part 1)</title>
		<link>http://javadude.wordpress.com/2009/09/25/tutorial-getting-started-with-netbeans-and-junit-plus-cobertura/</link>
		<comments>http://javadude.wordpress.com/2009/09/25/tutorial-getting-started-with-netbeans-and-junit-plus-cobertura/#comments</comments>
		<pubDate>Fri, 25 Sep 2009 03:06:10 +0000</pubDate>
		<dc:creator>devdude</dc:creator>
				<category><![CDATA[HowTo]]></category>
		<category><![CDATA[methodology]]></category>
		<category><![CDATA[opensource]]></category>
		<category><![CDATA[tutorial]]></category>
		<category><![CDATA[netbeans]]></category>
		<category><![CDATA[code coverage]]></category>
		<category><![CDATA[cobertura]]></category>
		<category><![CDATA[ci]]></category>
		<category><![CDATA[test]]></category>
		<category><![CDATA[junit]]></category>
		<category><![CDATA[ant]]></category>
		<category><![CDATA[hudson]]></category>

		<guid isPermaLink="false">http://javadude.wordpress.com/?p=691</guid>
		<description><![CDATA[I believe strongly in testing. I saw companies and products without any automatic test frameworks and the slightest change to the codebase (often in the urgent &#8216;we-need-to-fix-it-now-and-give-to-the-customer-in-1hr&#8217; mode) made parts of the product or modules prone to crashes because no one could test the changes against the complete application. In my current endevour to create [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=javadude.wordpress.com&blog=3891833&post=691&subd=javadude&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p style="text-align:justify;">I believe strongly in testing. I saw companies and products without any automatic test frameworks and the slightest change to the codebase (often in the urgent &#8216;we-need-to-fix-it-now-and-give-to-the-customer-in-1hr&#8217; mode) made parts of the product or modules prone to crashes because no one could test the changes against the complete application. In my current endevour to create a new product we embrace testing, though we dont practice <strong>TDD</strong> (test-driven-development), but at least we maximize the amount of automatic testing with tools/frameworks like Netbeans, Hudson, Cobertura and others. If you dont practice TDD, how can you judge how much of your codebase is really tested, even you assume all you business testcases are covered ?</p>
<p>The other day<strong> Code Coverage</strong> crossed my way (Thanks Chris!). Eager to find out how to &#8220;do it&#8221; or to &#8220;use it&#8221; I found a few tools suitable for the Netbeans environment. It actually drilled down to only one tool: <strong>Cobertura</strong>. It fits exactly into our landscape using <strong>Netbeans</strong> and <strong>Hudson</strong> and it is opensource.<br />
To get started with Cobertura you should be familiar (a bit) with Netbeans, JUnit and Ant. The Cobertura website offers sufficient reference for all functions and introduction to get you started. But what I missed is a tutorial the start from the scratch using Netbeans and Cobertura. I found 3 references (I will add them at the end,) which are not complete or just not working for me), so let me share the most basic getting-started steps with you.<br />
Please note: This is how I get started, it might not be complete, foolproof or even correct in all details. Please feel free to comment, correct or give other feedback !</p>
<p style="text-align:justify;"><span id="more-691"></span><strong>Part 1 (covering project creation and JUnit test</strong>)</p>
<p style="text-align:justify;"><strong>Preparation</strong>:</p>
<ul>
<li>You have basic knowledge of Java and Netbeans.</li>
<li>Netbeans 6.5.1 (I guess older or newer versions work also)</li>
</ul>
<p><strong>Tutorial</strong>:</p>
<ul>
<li><strong>Create a new Java Project</strong> using the new project wizard of Netbeans<br />
Call it <em>CoberturaDemo</em>. Deselect <em>create Main class</em>.</p>
<div id="attachment_692" class="wp-caption alignnone" style="width: 310px"><a href="http://javadude.files.wordpress.com/2009/09/svh20090924_001.jpeg"><img class="size-medium wp-image-692" title="SVH20090924_001" src="http://javadude.files.wordpress.com/2009/09/svh20090924_001.jpeg?w=300&#038;h=202" alt="Cobertura Tutorial" width="300" height="202" /></a><p class="wp-caption-text">Cobertura Tutorial</p></div>
<div id="attachment_693" class="wp-caption alignnone" style="width: 310px"><a href="http://javadude.files.wordpress.com/2009/09/svh20090924_002.jpeg"><img class="size-medium wp-image-693" title="SVH20090924_002" src="http://javadude.files.wordpress.com/2009/09/svh20090924_002.jpeg?w=300&#038;h=202" alt="Cobertura Tutorial" width="300" height="202" /></a><p class="wp-caption-text">Cobertura Tutorial</p></div></li>
<li><strong>Create a new class</strong><br />
Name it <em>TestMe</em> in the package <em>demo</em></p>
<p><div id="attachment_694" class="wp-caption alignnone" style="width: 310px"><a href="http://javadude.files.wordpress.com/2009/09/svh20090924_003.jpeg"><img class="size-medium wp-image-694" title="SVH20090924_003" src="http://javadude.files.wordpress.com/2009/09/svh20090924_003.jpeg?w=300&#038;h=202" alt="Cobertura Tutorial" width="300" height="202" /></a><p class="wp-caption-text">Cobertura Tutorial</p></div></li>
<li><strong>Add some basic functionality</strong> that we can test later.<br />
It is only a function that checks an int value if smaller than 5 or even in 2 if {} statements and returns 0 or 2. Useless function but we have something to &#8220;code-cover&#8221; !</p>
<p><div id="attachment_695" class="wp-caption alignnone" style="width: 310px"><a href="http://javadude.files.wordpress.com/2009/09/svh20090924_004.jpeg"><img class="size-medium wp-image-695" title="SVH20090924_004" src="http://javadude.files.wordpress.com/2009/09/svh20090924_004.jpeg?w=300&#038;h=209" alt="Cobertura Tutorial" width="300" height="209" /></a><p class="wp-caption-text">Cobertura Tutorial</p></div>
<pre class="brush: java;">
package demo;

public class TestMe {

 public int doSomething(int i) {
 if (i &lt; 5) {
 System.out.println(&quot;Smaller than 5&quot;);
 return 0;
 }

 if (i % 2 == 0) {
 System.out.println(&quot;Even number&quot;);
 return 2;
 }

 return -1;
 }
}
</pre>
</li>
<li><strong>Add JUnit Test Skeleton for our class</strong><br />
By right-click the <em>TestMe.java</em> file in the demo package. Tools | Create JUnit test.<br />
For this tutorial we leave the defaults since we are not discussing them.<br />
Netbeans will create a test skeleton file for you (TestMeTest.java)..<br />
Comment: TestMe.java was not a good name choice. All Junit Test files are called {yourClassName}Test.java.</p>
<div id="attachment_696" class="wp-caption alignnone" style="width: 292px"><a href="http://javadude.files.wordpress.com/2009/09/svh20090924_005.jpeg"><img class="size-medium wp-image-696" title="SVH20090924_005" src="http://javadude.files.wordpress.com/2009/09/svh20090924_005.jpeg?w=282&#038;h=300" alt="Cobertura Tutorial" width="282" height="300" /></a><p class="wp-caption-text">Cobertura Tutorial</p></div>
<div id="attachment_697" class="wp-caption alignnone" style="width: 251px"><a href="http://javadude.files.wordpress.com/2009/09/svh20090924_006.jpeg"><img class="size-medium wp-image-697" title="SVH20090924_006" src="http://javadude.files.wordpress.com/2009/09/svh20090924_006.jpeg?w=241&#038;h=300" alt="Cobertura Tutorial" width="241" height="300" /></a><p class="wp-caption-text">Cobertura Tutorial</p></div></li>
<li><strong>Create a real JUnit test</strong><br />
The skeleton does NOTHING for us, so we need to add a test. You believe Netbeans creates testcases for you ?<br />
We create a simple test, only 1 for now, that throws a value at the method and checks for the expected value.</p>
<p><div id="attachment_700" class="wp-caption alignnone" style="width: 310px"><a href="http://javadude.files.wordpress.com/2009/09/svh20090924_007.jpeg"><img class="size-medium wp-image-700" title="SVH20090924_007" src="http://javadude.files.wordpress.com/2009/09/svh20090924_007.jpeg?w=300&#038;h=285" alt="Cobertura Tutorial" width="300" height="285" /></a><p class="wp-caption-text">Cobertura Tutorial</p></div>
<pre class="brush: java;">
package demo;

import org.junit.Test;
import static org.junit.Assert.*;

public class TestMeTest {

 public TestMeTest() {
 }

 @Test
 public void testApp() {
 TestMe tst = new TestMe();
 int res = tst.doSomething(3);
 assertEquals(&quot;Correct value&quot;, 0, res);
 }
}
</pre>
</li>
<li><strong>Execute JUnit test</strong><br />
We are already at out first testing stage ! Note that java class cannot be run, but the JUnit test.<br />
Right click on the project (project explorer) and select Test.<br />
You should get something like this:</p>
<div id="attachment_701" class="wp-caption alignnone" style="width: 310px"><a href="http://javadude.files.wordpress.com/2009/09/svh20090924_008.jpeg"><img class="size-medium wp-image-701" title="SVH20090924_008" src="http://javadude.files.wordpress.com/2009/09/svh20090924_008.jpeg?w=300&#038;h=69" alt="Cobertura Tutorial" width="300" height="69" /></a><p class="wp-caption-text">Cobertura Tutorial</p></div>
<p>You can experiment, aka break it, by changing the expected value to 99 and execute test again.</li>
</ul>
<p style="text-align:justify;"><strong>Resume Part 1:</strong><br />
We crceate a Java class and a JUnit test class for it. We executed the test and saw &#8220;test passed&#8221;. We could belive &#8220;<em>my class is tested ! lets move on..</em>&#8220;.<br />
<strong>NO</strong> ! Half the code is <strong>NOT</strong> tested and JUnit wont tell us either ! Of course it is obvious for this most simple sample, but just think about your projects that are usually a bit more complex. Would you &#8220;see&#8221; it, if not everything is covered ? Certainly NOT. So we need a tool to tell us.</p>
<p><strong>Part 2 </strong>will introduce Cobertura as our new magic wizard to our demo project.<br />
<strong>Part 3</strong> will cover Hudson and the Cobertura plugin for Hudson.</p>
<p>Stay tuned.</p>
  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/javadude.wordpress.com/691/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/javadude.wordpress.com/691/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/javadude.wordpress.com/691/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/javadude.wordpress.com/691/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/javadude.wordpress.com/691/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/javadude.wordpress.com/691/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/javadude.wordpress.com/691/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/javadude.wordpress.com/691/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/javadude.wordpress.com/691/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/javadude.wordpress.com/691/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=javadude.wordpress.com&blog=3891833&post=691&subd=javadude&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://javadude.wordpress.com/2009/09/25/tutorial-getting-started-with-netbeans-and-junit-plus-cobertura/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/c590146f757718a268c168a7eee0f53f?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">devdude</media:title>
		</media:content>

		<media:content url="http://javadude.files.wordpress.com/2009/09/svh20090924_001.jpeg?w=300" medium="image">
			<media:title type="html">SVH20090924_001</media:title>
		</media:content>

		<media:content url="http://javadude.files.wordpress.com/2009/09/svh20090924_002.jpeg?w=300" medium="image">
			<media:title type="html">SVH20090924_002</media:title>
		</media:content>

		<media:content url="http://javadude.files.wordpress.com/2009/09/svh20090924_003.jpeg?w=300" medium="image">
			<media:title type="html">SVH20090924_003</media:title>
		</media:content>

		<media:content url="http://javadude.files.wordpress.com/2009/09/svh20090924_004.jpeg?w=300" medium="image">
			<media:title type="html">SVH20090924_004</media:title>
		</media:content>

		<media:content url="http://javadude.files.wordpress.com/2009/09/svh20090924_005.jpeg?w=282" medium="image">
			<media:title type="html">SVH20090924_005</media:title>
		</media:content>

		<media:content url="http://javadude.files.wordpress.com/2009/09/svh20090924_006.jpeg?w=241" medium="image">
			<media:title type="html">SVH20090924_006</media:title>
		</media:content>

		<media:content url="http://javadude.files.wordpress.com/2009/09/svh20090924_007.jpeg?w=300" medium="image">
			<media:title type="html">SVH20090924_007</media:title>
		</media:content>

		<media:content url="http://javadude.files.wordpress.com/2009/09/svh20090924_008.jpeg?w=300" medium="image">
			<media:title type="html">SVH20090924_008</media:title>
		</media:content>
	</item>
	</channel>
</rss>