<?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/"
	>

<channel>
	<title>Managed Chaos &#187; Java</title>
	<atom:link href="http://blogs.agilefaqs.com/category/java/feed/" rel="self" type="application/rss+xml" />
	<link>http://blogs.agilefaqs.com</link>
	<description>Naresh Jain&#039;s Random Thoughts on Software Development and Adventure Sports</description>
	<lastBuildDate>Sat, 21 Jan 2012 11:54:57 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=</generator>
		<item>
		<title>Duplicate Code and Ceremony in Java</title>
		<link>http://blogs.agilefaqs.com/2011/07/21/duplicate-code-and-ceremony-in-java/</link>
		<comments>http://blogs.agilefaqs.com/2011/07/21/duplicate-code-and-ceremony-in-java/#comments</comments>
		<pubDate>Thu, 21 Jul 2011 11:37:50 +0000</pubDate>
		<dc:creator>Naresh Jain</dc:creator>
				<category><![CDATA[Agile]]></category>
		<category><![CDATA[Code Smells]]></category>
		<category><![CDATA[Java]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[Programming Languages]]></category>
		<category><![CDATA[code smells]]></category>
		<category><![CDATA[duplicate code]]></category>
		<category><![CDATA[Duplication]]></category>
		<category><![CDATA[Dynamic Languages]]></category>
		<category><![CDATA[Dynamic Method Invocation]]></category>
		<category><![CDATA[Dynamic Typing]]></category>
		<category><![CDATA[Refactoring]]></category>
		<category><![CDATA[Static Languages]]></category>
		<category><![CDATA[Static Typing]]></category>

		<guid isPermaLink="false">http://blogs.agilefaqs.com/?p=1783</guid>
		<description><![CDATA[How would you kill this duplication in a strongly typed, static language like Java? private int calculateAveragePreviousPercentageComplete&#40;&#41; &#123; int result = 0; for &#40;StudentActivityByAlbum activity : activities&#41; result += activity.getPreviousPercentageCompleted&#40;&#41;; return result / activities.size&#40;&#41;; &#125; &#160; private int calculateAverageCurrentPercentageComplete&#40;&#41; &#123; int result = 0; for &#40;StudentActivityByAlbum activity : activities&#41; result += activity.getPercentageCompleted&#40;&#41;; return result / [...]]]></description>
			<content:encoded><![CDATA[<p>How would you kill this duplication in a strongly typed, static language like Java?</p>

<div class="wp_syntax"><div class="code"><pre class="java" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">private</span> <span style="color: #000066; font-weight: bold;">int</span> calculateAveragePreviousPercentageComplete<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
    <span style="color: #000066; font-weight: bold;">int</span> result <span style="color: #339933;">=</span> <span style="color: #cc66cc;">0</span><span style="color: #339933;">;</span>
    <span style="color: #000000; font-weight: bold;">for</span> <span style="color: #009900;">&#40;</span>StudentActivityByAlbum activity <span style="color: #339933;">:</span> activities<span style="color: #009900;">&#41;</span>
        result <span style="color: #339933;">+=</span> activity.<span style="color: #006633;">getPreviousPercentageCompleted</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    <span style="color: #000000; font-weight: bold;">return</span> result <span style="color: #339933;">/</span> activities.<span style="color: #006633;">size</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span>
&nbsp;
<span style="color: #000000; font-weight: bold;">private</span> <span style="color: #000066; font-weight: bold;">int</span> calculateAverageCurrentPercentageComplete<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
    <span style="color: #000066; font-weight: bold;">int</span> result <span style="color: #339933;">=</span> <span style="color: #cc66cc;">0</span><span style="color: #339933;">;</span>
    <span style="color: #000000; font-weight: bold;">for</span> <span style="color: #009900;">&#40;</span>StudentActivityByAlbum activity <span style="color: #339933;">:</span> activities<span style="color: #009900;">&#41;</span>
        result <span style="color: #339933;">+=</span> activity.<span style="color: #006633;">getPercentageCompleted</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    <span style="color: #000000; font-weight: bold;">return</span> result <span style="color: #339933;">/</span> activities.<span style="color: #006633;">size</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span>
&nbsp;
<span style="color: #000000; font-weight: bold;">private</span> <span style="color: #000066; font-weight: bold;">int</span> calculateAverageProgressPercentage<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
    <span style="color: #000066; font-weight: bold;">int</span> result <span style="color: #339933;">=</span> <span style="color: #cc66cc;">0</span><span style="color: #339933;">;</span>
    <span style="color: #000000; font-weight: bold;">for</span> <span style="color: #009900;">&#40;</span>StudentActivityByAlbum activity <span style="color: #339933;">:</span> activities<span style="color: #009900;">&#41;</span>
        result <span style="color: #339933;">+=</span> activity.<span style="color: #006633;">getProgressPercentage</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    <span style="color: #000000; font-weight: bold;">return</span> result <span style="color: #339933;">/</span> activities.<span style="color: #006633;">size</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span></pre></div></div>

<p>Here is my horrible solution:</p>

<div class="wp_syntax"><div class="code"><pre class="java" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">private</span> <span style="color: #000066; font-weight: bold;">int</span> calculateAveragePreviousPercentageComplete<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
    <span style="color: #000000; font-weight: bold;">return</span> <span style="color: #000000; font-weight: bold;">new</span> Average<span style="color: #009900;">&#40;</span>activities<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
        <span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000066; font-weight: bold;">int</span> value<span style="color: #009900;">&#40;</span>StudentActivityByAlbum activity<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
            <span style="color: #000000; font-weight: bold;">return</span> activity.<span style="color: #006633;">getPreviousPercentageCompleted</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
        <span style="color: #009900;">&#125;</span>
    <span style="color: #009900;">&#125;</span>.<span style="color: #006633;">result</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span>
&nbsp;
<span style="color: #000000; font-weight: bold;">private</span> <span style="color: #000066; font-weight: bold;">int</span> calculateAverageCurrentPercentageComplete<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
    <span style="color: #000000; font-weight: bold;">return</span> <span style="color: #000000; font-weight: bold;">new</span> Average<span style="color: #009900;">&#40;</span>activities<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
        <span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000066; font-weight: bold;">int</span> value<span style="color: #009900;">&#40;</span>StudentActivityByAlbum activity<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
            <span style="color: #000000; font-weight: bold;">return</span> activity.<span style="color: #006633;">getPercentageCompleted</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
        <span style="color: #009900;">&#125;</span>
    <span style="color: #009900;">&#125;</span>.<span style="color: #006633;">result</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span>
&nbsp;
<span style="color: #000000; font-weight: bold;">private</span> <span style="color: #000066; font-weight: bold;">int</span> calculateAverageProgressPercentage<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
    <span style="color: #000000; font-weight: bold;">return</span> <span style="color: #000000; font-weight: bold;">new</span> Average<span style="color: #009900;">&#40;</span>activities<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
        <span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000066; font-weight: bold;">int</span> value<span style="color: #009900;">&#40;</span>StudentActivityByAlbum activity<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
            <span style="color: #000000; font-weight: bold;">return</span> activity.<span style="color: #006633;">getProgressPercentage</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
        <span style="color: #009900;">&#125;</span>
    <span style="color: #009900;">&#125;</span>.<span style="color: #006633;">result</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span>
&nbsp;
<span style="color: #000000; font-weight: bold;">private</span> <span style="color: #000000; font-weight: bold;">static</span> <span style="color: #000000; font-weight: bold;">abstract</span> <span style="color: #000000; font-weight: bold;">class</span> Average <span style="color: #009900;">&#123;</span>
    <span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000066; font-weight: bold;">int</span> result<span style="color: #339933;">;</span>
&nbsp;
    <span style="color: #000000; font-weight: bold;">public</span> Average<span style="color: #009900;">&#40;</span>List<span style="color: #339933;">&lt;</span>StudentActivityByAlbum<span style="color: #339933;">&gt;</span> activities<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
        <span style="color: #000066; font-weight: bold;">int</span> total <span style="color: #339933;">=</span> <span style="color: #cc66cc;">0</span><span style="color: #339933;">;</span>
        <span style="color: #000000; font-weight: bold;">for</span> <span style="color: #009900;">&#40;</span>StudentActivityByAlbum activity <span style="color: #339933;">:</span> activities<span style="color: #009900;">&#41;</span>
            total <span style="color: #339933;">+=</span> value<span style="color: #009900;">&#40;</span>activity<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
        result <span style="color: #339933;">=</span> total <span style="color: #339933;">/</span> activities.<span style="color: #006633;">size</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    <span style="color: #009900;">&#125;</span>
&nbsp;
    <span style="color: #000000; font-weight: bold;">protected</span> <span style="color: #000000; font-weight: bold;">abstract</span> <span style="color: #000066; font-weight: bold;">int</span> value<span style="color: #009900;">&#40;</span>StudentActivityByAlbum activity<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span></pre></div></div>

<p>if this were Ruby</p>

<div class="wp_syntax"><div class="code"><pre class="ruby" style="font-family:monospace;"><span style="color:#0066ff; font-weight:bold;">@activities</span>.<span style="color:#9900CC;">inject</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#006666;">0.0</span><span style="color:#006600; font-weight:bold;">&#41;</span><span style="color:#006600; font-weight:bold;">&#123;</span> <span style="color:#006600; font-weight:bold;">|</span>total, activity<span style="color:#006600; font-weight:bold;">|</span> total <span style="color:#006600; font-weight:bold;">+</span> activity.<span style="color:#9900CC;">previous_percentage_completed</span>? <span style="color:#006600; font-weight:bold;">&#125;</span> <span style="color:#006600; font-weight:bold;">/</span> <span style="color:#0066ff; font-weight:bold;">@activities</span>.<span style="color:#9900CC;">size</span>
<span style="color:#0066ff; font-weight:bold;">@activities</span>.<span style="color:#9900CC;">inject</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#006666;">0.0</span><span style="color:#006600; font-weight:bold;">&#41;</span><span style="color:#006600; font-weight:bold;">&#123;</span> <span style="color:#006600; font-weight:bold;">|</span>total, activity<span style="color:#006600; font-weight:bold;">|</span> total <span style="color:#006600; font-weight:bold;">+</span> activity.<span style="color:#9900CC;">percentage_completed</span>? <span style="color:#006600; font-weight:bold;">&#125;</span> <span style="color:#006600; font-weight:bold;">/</span> <span style="color:#0066ff; font-weight:bold;">@activities</span>.<span style="color:#9900CC;">size</span>
<span style="color:#0066ff; font-weight:bold;">@activities</span>.<span style="color:#9900CC;">inject</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#006666;">0.0</span><span style="color:#006600; font-weight:bold;">&#41;</span><span style="color:#006600; font-weight:bold;">&#123;</span> <span style="color:#006600; font-weight:bold;">|</span>total, activity<span style="color:#006600; font-weight:bold;">|</span> total <span style="color:#006600; font-weight:bold;">+</span> activity.<span style="color:#9900CC;">progress_percentage</span>? <span style="color:#006600; font-weight:bold;">&#125;</span> <span style="color:#006600; font-weight:bold;">/</span> <span style="color:#0066ff; font-weight:bold;">@activities</span>.<span style="color:#9900CC;">size</span></pre></div></div>

<p>or even something more kewler</p>

<div class="wp_syntax"><div class="code"><pre class="ruby" style="font-family:monospace;">average_of <span style="color:#ff3333; font-weight:bold;">:previous_percentage_completed</span>?
average_of <span style="color:#ff3333; font-weight:bold;">:percentage_completed</span>?
average_of <span style="color:#ff3333; font-weight:bold;">:progress_percentage</span>?
&nbsp;
<span style="color:#9966CC; font-weight:bold;">def</span> average_of<span style="color:#006600; font-weight:bold;">&#40;</span>message<span style="color:#006600; font-weight:bold;">&#41;</span>
	<span style="color:#0066ff; font-weight:bold;">@activities</span>.<span style="color:#9900CC;">inject</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#006666;">0.0</span><span style="color:#006600; font-weight:bold;">&#41;</span><span style="color:#006600; font-weight:bold;">&#123;</span> <span style="color:#006600; font-weight:bold;">|</span>total, activity<span style="color:#006600; font-weight:bold;">|</span> total <span style="color:#006600; font-weight:bold;">+</span> activity.<span style="color:#9900CC;">send</span> message <span style="color:#006600; font-weight:bold;">&#125;</span> <span style="color:#006600; font-weight:bold;">/</span> <span style="color:#0066ff; font-weight:bold;">@activities</span>.<span style="color:#9900CC;">size</span>
<span style="color:#9966CC; font-weight:bold;">end</span></pre></div></div>

]]></content:encoded>
			<wfw:commentRss>http://blogs.agilefaqs.com/2011/07/21/duplicate-code-and-ceremony-in-java/feed/</wfw:commentRss>
		<slash:comments>11</slash:comments>
		</item>
		<item>
		<title>ActionScript 3 v/s Java 6 Summary</title>
		<link>http://blogs.agilefaqs.com/2010/05/04/actionscript-3-vs-java-6-summary/</link>
		<comments>http://blogs.agilefaqs.com/2010/05/04/actionscript-3-vs-java-6-summary/#comments</comments>
		<pubDate>Tue, 04 May 2010 07:25:23 +0000</pubDate>
		<dc:creator>Naresh Jain</dc:creator>
				<category><![CDATA[Java]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[ActionScript 3]]></category>
		<category><![CDATA[Java 6]]></category>
		<category><![CDATA[Syntax]]></category>

		<guid isPermaLink="false">http://blogs.agilefaqs.com/?p=1275</guid>
		<description><![CDATA[Here is a quick list of differences I found between AS3 and Java 6 (mostly language syntax and concepts) AS3 places classes inside package blocks. Which allows AS3 to have multiple package definitions per file In AS3 the variable have function scope not block scope AS3 is a mostly type safe language with Dynamic behavior. [...]]]></description>
			<content:encoded><![CDATA[<p>Here is a quick list of differences I found between AS3 and Java 6 (mostly language syntax and concepts)</p>
<ul>
<li>AS3 places classes inside package blocks. Which allows AS3 to have multiple package definitions per file</li>
<li>In AS3 the variable have function scope not block scope</li>
<li>AS3 is a mostly type safe language with Dynamic behavior. This means you can add new capabilities (functions and properties) to existing objects at run time.</li>
<li>AS3 has metadata while Java has annotations</li>
<li>In AS3 semicolons are options if you have one statement per line</li>
<li>In AS3 casts look more like a function call through the type being cast or we can use the as operator</li>
<li>AS3 does not support generics and typed collections, except it has typed arrays through the Vector class</li>
<li>AS3 has E4X integrated into the language to query/manipulation XML</li>
<li>In AS3, constructors are always public</li>
<li>AS3 does not allow properties on interfaces. Only functions can be declared on interfaces</li>
<li>There is no concept of &#8220;abstract&#8221; in AS3</li>
<li>In AS3, because functions are Objects, they can be passed around (like Function Pointers)</li>
<li>AS3 has the concept of anonymous functions useful for declaring callbacks or event handlers inline</li>
<li>In AS3, the override keyword is required if the subclass declares a function with the same name</li>
<li>AS3 does not support Function overloading. Default parameter values might help you achieve it to some extent</li>
<li>AS3 has properties as a first-class citizen of the language. get and set keywords are defined as special getters/setters for properties</li>
<li>AS3 allows Property access via strings</li>
<li>AS3 supports Untyped property access &#8211; allows accessing property through the String accessor, even if the property is not present at compile time (you&#8217;ll get run-time error)</li>
<li>All AS3 objects can act like String maps</li>
<li>AS3 supports Untyped variables (mostly type safe language). This allows you to told references without declaring its type</li>
<li>AS3 allows Initializing dynamic properties using JSON-like syntax. Create and Initializes the object in one statement</li>
</ul>
<p>Thanks to Chet Haase for his insightful <a href="http://www.javaworld.com/javaworld/jw-02-2009/jw-02-actionscript1.html" target="_blank">article on ActionScript for Java developers</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://blogs.agilefaqs.com/2010/05/04/actionscript-3-vs-java-6-summary/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Setting up Tomcat Cluster for Session Replication</title>
		<link>http://blogs.agilefaqs.com/2009/11/09/setting-up-tomcat-cluster-for-session-replication/</link>
		<comments>http://blogs.agilefaqs.com/2009/11/09/setting-up-tomcat-cluster-for-session-replication/#comments</comments>
		<pubDate>Mon, 09 Nov 2009 12:58:38 +0000</pubDate>
		<dc:creator>Naresh Jain</dc:creator>
				<category><![CDATA[Deployment]]></category>
		<category><![CDATA[Java]]></category>
		<category><![CDATA[Networking]]></category>
		<category><![CDATA[Open Source]]></category>
		<category><![CDATA[Tools]]></category>
		<category><![CDATA[multicast]]></category>
		<category><![CDATA[mysql]]></category>
		<category><![CDATA[session replication]]></category>
		<category><![CDATA[tomcat]]></category>
		<category><![CDATA[tomcat clustering]]></category>
		<category><![CDATA[web app]]></category>

		<guid isPermaLink="false">http://blogs.agilefaqs.com/?p=1110</guid>
		<description><![CDATA[If you have your web application running on one tomcat instance and want to add another tomcat instance (ideally on a different machine), following steps will guide you. Step 1: Independently deploy your web application (WAR file) on each instance and make sure they can work independently. Step 2: Stop tomcat Step 3: Update the [...]]]></description>
			<content:encoded><![CDATA[<p>If you have your web application running on one tomcat instance and want to add another tomcat instance (ideally on a different machine), following steps will guide you.</p>
<p>Step 1: Independently deploy your web application (WAR file) on each instance and make sure they can work independently. </p>
<p>Step 2: Stop tomcat</p>
<p>Step 3: Update the &lt;Cluster&gt; element under the &lt;Engine&gt; element in the Server.xml file (under the conf dir in tomcat installation dir) on both your servers with:</p>

<div class="wp_syntax"><div class="code"><pre class="xml" style="font-family:monospace;"><span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;Engine</span> <span style="color: #000066;">name</span>=<span style="color: #ff0000;">&quot;&lt;meaningful_unique_name&gt;</span></span>&quot; defaultHost=&quot;localhost&quot;&gt;      
     <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;Cluster</span> <span style="color: #000066;">className</span>=<span style="color: #ff0000;">&quot;org.apache.catalina.ha.tcp.SimpleTcpCluster&quot;</span></span>
<span style="color: #009900;">              <span style="color: #000066;">channelSendOptions</span>=<span style="color: #ff0000;">&quot;8&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>
          <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;Manager</span> <span style="color: #000066;">className</span>=<span style="color: #ff0000;">&quot;org.apache.catalina.ha.session.DeltaManager&quot;</span></span>
<span style="color: #009900;">                   <span style="color: #000066;">expireSessionsOnShutdown</span>=<span style="color: #ff0000;">&quot;false&quot;</span></span>
<span style="color: #009900;">                   <span style="color: #000066;">notifyListenersOnReplication</span>=<span style="color: #ff0000;">&quot;true&quot;</span><span style="color: #000000; font-weight: bold;">/&gt;</span></span>
          <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;Channel</span> <span style="color: #000066;">className</span>=<span style="color: #ff0000;">&quot;org.apache.catalina.tribes.group.GroupChannel&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>
               <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;Membership</span> <span style="color: #000066;">className</span>=<span style="color: #ff0000;">&quot;org.apache.catalina.tribes.membership.McastService&quot;</span></span>
<span style="color: #009900;">                           <span style="color: #000066;">address</span>=<span style="color: #ff0000;">&quot;228.0.0.4&quot;</span></span>
<span style="color: #009900;">                           <span style="color: #000066;">port</span>=<span style="color: #ff0000;">&quot;45564&quot;</span></span>
<span style="color: #009900;">                           <span style="color: #000066;">frequency</span>=<span style="color: #ff0000;">&quot;500&quot;</span></span>
<span style="color: #009900;">                           <span style="color: #000066;">dropTime</span>=<span style="color: #ff0000;">&quot;3000&quot;</span><span style="color: #000000; font-weight: bold;">/&gt;</span></span>
               <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;Receiver</span> <span style="color: #000066;">className</span>=<span style="color: #ff0000;">&quot;org.apache.catalina.tribes.transport.nio.NioReceiver&quot;</span></span>
<span style="color: #009900;">                         <span style="color: #000066;">address</span>=<span style="color: #ff0000;">&quot;auto&quot;</span></span>
<span style="color: #009900;">                         <span style="color: #000066;">port</span>=<span style="color: #ff0000;">&quot;4000&quot;</span></span>
<span style="color: #009900;">                         <span style="color: #000066;">autoBind</span>=<span style="color: #ff0000;">&quot;100&quot;</span></span>
<span style="color: #009900;">                         <span style="color: #000066;">selectorTimeout</span>=<span style="color: #ff0000;">&quot;5000&quot;</span></span>
<span style="color: #009900;">                         <span style="color: #000066;">maxThreads</span>=<span style="color: #ff0000;">&quot;6&quot;</span><span style="color: #000000; font-weight: bold;">/&gt;</span></span>
               <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;Sender</span> <span style="color: #000066;">className</span>=<span style="color: #ff0000;">&quot;org.apache.catalina.tribes.transport.ReplicationTransmitter&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>
                   <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;Transport</span> <span style="color: #000066;">className</span>=<span style="color: #ff0000;">&quot;org.apache.catalina.tribes.transport.nio.PooledParallelSender&quot;</span><span style="color: #000000; font-weight: bold;">/&gt;</span></span>
               <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/Sender<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
               <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;Interceptor</span> <span style="color: #000066;">className</span>=<span style="color: #ff0000;">&quot;org.apache.catalina.tribes.group.interceptors.TcpFailureDetector&quot;</span><span style="color: #000000; font-weight: bold;">/&gt;</span></span>
               <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;Interceptor</span> <span style="color: #000066;">className</span>=<span style="color: #ff0000;">&quot;org.apache.catalina.tribes.group.interceptors.MessageDispatch15Interceptor&quot;</span><span style="color: #000000; font-weight: bold;">/&gt;</span></span>
          <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/Channel<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
          <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;Valve</span> <span style="color: #000066;">className</span>=<span style="color: #ff0000;">&quot;org.apache.catalina.ha.tcp.ReplicationValve&quot;</span></span>
<span style="color: #009900;">                 <span style="color: #000066;">filter</span>=<span style="color: #ff0000;">&quot;.*\.gif;.*\.js;.*\.jpg;.*\.png;.*\.css;.*\.txt;&quot;</span><span style="color: #000000; font-weight: bold;">/&gt;</span></span>
          <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;ClusterListener</span> <span style="color: #000066;">className</span>=<span style="color: #ff0000;">&quot;org.apache.catalina.ha.session.ClusterSessionListener&quot;</span><span style="color: #000000; font-weight: bold;">/&gt;</span></span>
     <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/Cluster<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
     ...
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/Engine<span style="color: #000000; font-weight: bold;">&gt;</span></span></span></pre></div></div>

<p>For more details on these parameters, check <a href="https://sec1.woopra.com/docs/cluster-howto.html" target="_blank">https://sec1.woopra.com/docs/cluster-howto.html</a></p>
<p>Step 4: Start tomcat and make sure it starts up correctly. You should be able to access http://locahost:8080. Most default tomcat installations come with an examples web app. Try access http://localhost:8080/examples/jsp/ You should see a list of JSP files.</p>
<p>Step 4.a: Also if you see catalina.out log file, you should see:</p>

<div class="wp_syntax"><div class="code"><pre class="xml" style="font-family:monospace;">INFO: Initializing Coyote HTTP/1.1 on http-8080
Nov 9, 2009 9:29:43 AM org.apache.catalina.startup.Catalina load
INFO: Initialization processed in 762 ms
Nov 9, 2009 9:29:43 AM org.apache.catalina.core.StandardService start
INFO: Starting service <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;server_name<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
Nov 9, 2009 9:29:43 AM org.apache.catalina.core.StandardEngine start
INFO: Starting Servlet Engine: Apache Tomcat/6.0.16
Nov 9, 2009 9:29:43 AM org.apache.catalina.ha.tcp.SimpleTcpCluster start
INFO: Cluster is about to start
Nov 9, 2009 9:29:43 AM org.apache.catalina.tribes.transport.ReceiverBase bind
INFO: Receiver Server Socket bound to:/<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;server_ip<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>:4000
Nov 9, 2009 9:29:43 AM org.apache.catalina.tribes.membership.McastServiceImpl setupSocket
INFO: Setting cluster mcast soTimeout to 500
Nov 9, 2009 9:29:43 AM org.apache.catalina.tribes.membership.McastServiceImpl waitForMembers
INFO: Sleeping for 1000 milliseconds to establish cluster membership, start level:4</pre></div></div>

<p>Step 5: Stop tomcat. </p>
<p>Step 6: We&#8217;ll use the examples web app to test if our session replication is working as expected.</p>
<p>Step 6.a: Open the Web.xml file of the &#8220;examples&#8221; web app in your webapps. Mark this web app distributable, by adding a &lt;distributable/&gt; element at the end of the Web.xml file (just before the &lt;/web-app&gt; element)</p>
<p>Step 6.b: Add the <a href='http://blogs.agilefaqs.com/wp-content/uploads/2009/11/session.jsp'>session JSP file</a>. This JSP prints the contents of the session and also adds/increments a counter stored in the session. </p>
<p>Step 6.c: Start tomcat on both machines</p>
<p>Step 6.d: You should see the following log in catalina.out</p>

<div class="wp_syntax"><div class="code"><pre class="xml" style="font-family:monospace;">Nov 9, 2009 9:29:44 AM org.apache.catalina.ha.tcp.SimpleTcpCluster memberAdded
INFO: Replication member added:org.apache.catalina.tribes.membership.MemberImpl[tcp://{-64, -88, 0, 101}:4000,{-64, -88, 0, 101},4000, alive=10035,id={68 106 92 39 -110 -8 73 124 -116 -122 -15 -3 11 117 56 105 }, payload={}, command={}, domain={}, ] 
&nbsp;
Nov 9, 2009 9:29:49 AM org.apache.catalina.ha.session.DeltaManager start
INFO: Register manager /examples to cluster element Engine with name <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;server_name<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
Nov 9, 2009 9:29:49 AM org.apache.catalina.ha.session.DeltaManager start
INFO: Starting clustering manager at /examples
Nov 9, 2009 9:29:49 AM org.apache.catalina.ha.session.DeltaManager getAllClusterSessions
WARNING: Manager [localhost#/examples], requesting session state from org.apache.catalina.tribes.membership.MemberImpl[tcp://{-64, -88, 0, 101}:4000,{-64, -88, 0, 101},4000, alive=15538,id={68 106 92 39 -110 -8 73 124 -116 -122 -15 -3 11 117 56 105 }, payload={}, command={}, domain={}, ]. This operation will timeout if no session state has been received within 60 seconds.
Nov 9, 2009 9:29:49 AM org.apache.catalina.ha.session.DeltaManager waitForSendAllSessions
INFO: Manager [localhost#/examples]; session state send at 11/9/09 9:29 AM received in 101 ms.
&nbsp;
Nov 9, 2009 9:29:49 AM org.apache.catalina.core.ApplicationContext log
INFO: ContextListener: contextInitialized()
Nov 9, 2009 9:29:49 AM org.apache.catalina.core.ApplicationContext log
INFO: SessionListener: contextInitialized()
Nov 9, 2009 9:29:50 AM org.apache.coyote.http11.Http11Protocol start
INFO: Starting Coyote HTTP/1.1 on http-8080
Nov 9, 2009 9:29:50 AM org.apache.jk.common.ChannelSocket init
INFO: JK: ajp13 listening on /0.0.0.0:8009
Nov 9, 2009 9:29:50 AM org.apache.jk.server.JkMain start
INFO: Jk running ID=0 time=0/49  config=null
Nov 9, 2009 9:29:50 AM org.apache.catalina.startup.Catalina start
INFO: Server startup in 6331 ms</pre></div></div>

<p>Step 6.e: Try to access http://localhost:8080/examples/jsp/session.jsp Try refreshing the page a few times, you should see the counter getting updated.</p>
<p>Step 6.f: You should see the same behavior when you try to access the other tomcat server. Open another tab in your browser and hit http://&lt;other_server_ip&gt;:8080/examples/jsp/session.jsp</p>
<p>Step 6.g: At this point we know the app works fine and the session is working correctly. Now we want to check if the tomcat cluster is replicating the session info. To check this, we want to pass the session from server 1 to session 2 and see if it increments the counter from where we left.</p>
<p>Step 6.h: Before accessing the page, make sure you copy the j_session_id from server 1 (displayed on the http://localhost:8080/examples/jsp/session.jsp). Also make sure to clear all cookies from server 2. (All browsers give you a facility to clear cookies from a specific host/ip).</p>
<p>Step 6.i: Now hit http://&lt;server_2_ip&gt;:8080/examples/jsp/session.jsp;jsessionid=&lt;jsession_id_from_server1&gt;</p>
<p>Step 6.j: If you see the counter incrementing from where ever you had left, congrats! You have session replication working.</p>
<p>Step 6.k: Also catalina.out log file should have:</p>

<div class="wp_syntax"><div class="code"><pre class="xml" style="font-family:monospace;">Nov 9, 2009 9:42:03 AM org.apache.catalina.core.ApplicationContext log
INFO: SessionListener: sessionCreated('CDC57B8C5CFDFDDC2C8572E7D14C0D28')
Nov 9, 2009 9:42:03 AM org.apache.catalina.core.ApplicationContext log
INFO: SessionListener: attributeAdded('CDC57B8C5CFDFDDC2C8572E7D14C0D28', 'counter', '1')
Nov 9, 2009 9:42:05 AM org.apache.catalina.core.ApplicationContext log
INFO: SessionListener: attributeReplaced('CDC57B8C5CFDFDDC2C8572E7D14C0D28', 'counter', '2')</pre></div></div>

<p>While this might like smooth, I ran into lot of issues when getting to this point. Following are some trap routes I ran into:</p>
<p>1) java.sql.SQLException: No suitable driver tomcat cluster<br />
 Make sure your DB Driver jar (in our case mysql-connector-java-x.x.xx-bin.jar) is in tomcat/lib folder</p>
<p>2) In catalina.org if you see the following exception:</p>

<div class="wp_syntax"><div class="code"><pre class="java" style="font-family:monospace;">Nov <span style="color: #cc66cc;">7</span>, <span style="color: #cc66cc;">2009</span> <span style="color: #cc66cc;">3</span><span style="color: #339933;">:</span><span style="color: #cc66cc;">48</span><span style="color: #339933;">:</span><span style="color: #cc66cc;">53</span> PM org.<span style="color: #006633;">apache</span>.<span style="color: #006633;">catalina</span>.<span style="color: #006633;">ha</span>.<span style="color: #006633;">session</span>.<span style="color: #006633;">DeltaManager</span> requestCompleted
SEVERE<span style="color: #339933;">:</span> Unable to serialize delta request <span style="color: #000000; font-weight: bold;">for</span> sessionid <span style="color: #009900;">&#91;</span>1F43C3926FF3CC231574EF248896DCA6<span style="color: #009900;">&#93;</span>
java.<span style="color: #006633;">io</span>.<span style="color: #003399;">NotSerializableException</span><span style="color: #339933;">:</span> com.<span style="color: #006633;">company</span>.<span style="color: #006633;">product</span>.<span style="color: #000000; font-weight: bold;">Class</span>
	at java.<span style="color: #006633;">io</span>.<span style="color: #003399;">ObjectOutputStream</span>.<span style="color: #006633;">writeObject0</span><span style="color: #009900;">&#40;</span><span style="color: #003399;">ObjectOutputStream</span>.<span style="color: #006633;">java</span><span style="color: #339933;">:</span><span style="color: #cc66cc;">1156</span><span style="color: #009900;">&#41;</span>
	at java.<span style="color: #006633;">io</span>.<span style="color: #003399;">ObjectOutputStream</span>.<span style="color: #006633;">writeObject</span><span style="color: #009900;">&#40;</span><span style="color: #003399;">ObjectOutputStream</span>.<span style="color: #006633;">java</span><span style="color: #339933;">:</span><span style="color: #cc66cc;">326</span><span style="color: #009900;">&#41;</span>
	at java.<span style="color: #006633;">util</span>.<span style="color: #003399;">ArrayList</span>.<span style="color: #006633;">writeObject</span><span style="color: #009900;">&#40;</span><span style="color: #003399;">ArrayList</span>.<span style="color: #006633;">java</span><span style="color: #339933;">:</span><span style="color: #cc66cc;">570</span><span style="color: #009900;">&#41;</span>
	at sun.<span style="color: #006633;">reflect</span>.<span style="color: #006633;">NativeMethodAccessorImpl</span>.<span style="color: #006633;">invoke0</span><span style="color: #009900;">&#40;</span><span style="color: #000000; font-weight: bold;">Native</span> <span style="color: #003399;">Method</span><span style="color: #009900;">&#41;</span>
	at sun.<span style="color: #006633;">reflect</span>.<span style="color: #006633;">NativeMethodAccessorImpl</span>.<span style="color: #006633;">invoke</span><span style="color: #009900;">&#40;</span>NativeMethodAccessorImpl.<span style="color: #006633;">java</span><span style="color: #339933;">:</span><span style="color: #cc66cc;">39</span><span style="color: #009900;">&#41;</span>
	at sun.<span style="color: #006633;">reflect</span>.<span style="color: #006633;">DelegatingMethodAccessorImpl</span>.<span style="color: #006633;">invoke</span><span style="color: #009900;">&#40;</span>DelegatingMethodAccessorImpl.<span style="color: #006633;">java</span><span style="color: #339933;">:</span><span style="color: #cc66cc;">25</span><span style="color: #009900;">&#41;</span>
	at java.<span style="color: #006633;">lang</span>.<span style="color: #006633;">reflect</span>.<span style="color: #003399;">Method</span>.<span style="color: #006633;">invoke</span><span style="color: #009900;">&#40;</span><span style="color: #003399;">Method</span>.<span style="color: #006633;">java</span><span style="color: #339933;">:</span><span style="color: #cc66cc;">597</span><span style="color: #009900;">&#41;</span></pre></div></div>

<p>This means that you are storing com.company.product.Class object (or some other object that holds a reference to this Object) in your session. And you&#8217;ll need to make com.company.product.Class implement Serializable interface. </p>
<p>3) In your catalina.out log if you see</p>

<div class="wp_syntax"><div class="code"><pre class="xml" style="font-family:monospace;">INFO: Register manager /<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;your_app_name<span style="color: #000000; font-weight: bold;">&gt;</span></span></span> to cluster element Engine with name <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;tomcat_engine_name<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
Nov 7, 2009 11:56:20 AM org.apache.catalina.ha.session.DeltaManager start
INFO: Starting clustering manager at /<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;your_app_name<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
Nov 7, 2009 11:56:20 AM org.apache.catalina.ha.session.DeltaManager getAllClusterSessions
INFO: Manager [localhost#/<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;your_app_name<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>]: <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;strong<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>skipping state transfer. No members active in cluster group<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/strong<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>.</pre></div></div>

<p>If both your tomcat instance are up and running, then check if your tomcat servers can communicate with each other using Multicast with the following commands:</p>
<p>$ ping -t 1 -c 2 228.0.0.4<br />
PING 228.0.0.4 (228.0.0.4): 56 data bytes<br />
64 bytes from &lt;server_1_ip&gt;: icmp_seq=0 ttl=64 time=0.076 ms<br />
64 bytes from &lt;server_2_ip&gt;: icmp_seq=0 ttl=64 time=0.645 ms</p>
<p>&#8212; 228.0.0.4 ping statistics &#8212;<br />
1 packets transmitted, 1 packets received, +1 duplicates, 0.0% packet loss</p>
<p>or </p>
<p>$ sudo tcpdump -ni en0 host 228.0.0.4<br />
tcpdump: verbose output suppressed, use -v or -vv for full protocol decode<br />
listening on en0, link-type EN10MB (Ethernet), capture size 65535 bytes<br />
22:11:50.016147 IP &lt;server_1_ip&gt;.45564 > 228.0.0.4.45564: UDP, length 69<br />
22:11:50.033336 IP &lt;server_2_ip&gt;.45564 > 228.0.0.4.45564: UDP, length 69<br />
22:11:50.516746 IP &lt;server_1_ip&gt;.45564 > 228.0.0.4.45564: UDP, length 69<br />
22:11:50.533613 IP &lt;server_2_ip&gt;.45564 > 228.0.0.4.45564: UDP, length 69<br />
&#8230;</p>
<p>If you don&#8217;t see the results as described above, you might want to read my blog on <a href="http://blogs.agilefaqs.com/2009/11/08/enabling-multicast-on-your-macos-unix/">Enabling Multicast</a>. </p>
]]></content:encoded>
			<wfw:commentRss>http://blogs.agilefaqs.com/2009/11/09/setting-up-tomcat-cluster-for-session-replication/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>Unable to initialize TldLocationsCache</title>
		<link>http://blogs.agilefaqs.com/2009/07/09/unable-to-initialize-tldlocationscache/</link>
		<comments>http://blogs.agilefaqs.com/2009/07/09/unable-to-initialize-tldlocationscache/#comments</comments>
		<pubDate>Thu, 09 Jul 2009 15:15:59 +0000</pubDate>
		<dc:creator>Naresh Jain</dc:creator>
				<category><![CDATA[Java]]></category>
		<category><![CDATA[Tips]]></category>
		<category><![CDATA[Tools]]></category>
		<category><![CDATA[cargo]]></category>
		<category><![CDATA[jasper exception]]></category>
		<category><![CDATA[jetty]]></category>
		<category><![CDATA[maven]]></category>
		<category><![CDATA[Selenium]]></category>
		<category><![CDATA[tld]]></category>

		<guid isPermaLink="false">http://blogs.agilefaqs.com/?p=814</guid>
		<description><![CDATA[On one of the projects we are using Cargo Maven Plugin to run an embedded Jetty server for our builds. Out of the blue, today, I started getting the following error when I was running my Selenium Tests after deploying the application. 1 2 3 4 5 6 7 WARN: Nested in org.apache.jasper.JasperException: org.apache.jasper.JasperException: Unable [...]]]></description>
			<content:encoded><![CDATA[<p>On one of the projects we are using <a href="http://cargo.codehaus.org/Maven2+plugin" target="_blank">Cargo Maven Plugin</a> to run an embedded <a href="http://www.mortbay.org/jetty/" target="_blank">Jetty</a> server for our builds. Out of the blue, today, I started getting the following error when I was running my <a href="http://seleniumhq.org/" target="_blank">Selenium Tests</a> after deploying the application.</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
</pre></td><td class="code"><pre class="java" style="font-family:monospace;">WARN<span style="color: #339933;">:</span>  Nested in org.<span style="color: #006633;">apache</span>.<span style="color: #006633;">jasper</span>.<span style="color: #006633;">JasperException</span><span style="color: #339933;">:</span> org.<span style="color: #006633;">apache</span>.<span style="color: #006633;">jasper</span>.<span style="color: #006633;">JasperException</span><span style="color: #339933;">:</span> Unable to initialize TldLocationsCache<span style="color: #339933;">:</span> <span style="color: #000066; font-weight: bold;">null</span><span style="color: #339933;">:</span>
org.<span style="color: #006633;">apache</span>.<span style="color: #006633;">jasper</span>.<span style="color: #006633;">JasperException</span><span style="color: #339933;">:</span> Unable to initialize TldLocationsCache<span style="color: #339933;">:</span> <span style="color: #000066; font-weight: bold;">null</span>
at org.<span style="color: #006633;">apache</span>.<span style="color: #006633;">jasper</span>.<span style="color: #006633;">compiler</span>.<span style="color: #006633;">TldLocationsCache</span>.<span style="color: #006633;">init</span> <span style="color: #009900;">&#40;</span>TldLocationsCache.<span style="color: #006633;">java</span><span style="color: #339933;">:</span><span style="color: #cc66cc;">253</span><span style="color: #009900;">&#41;</span>
at org.<span style="color: #006633;">apache</span>.<span style="color: #006633;">jasper</span>.<span style="color: #006633;">compiler</span>.<span style="color: #006633;">TldLocationsCache</span>.<span style="color: #006633;">getLocation</span> <span style="color: #009900;">&#40;</span>TldLocationsCache.<span style="color: #006633;">java</span><span style="color: #339933;">:</span><span style="color: #cc66cc;">224</span><span style="color: #009900;">&#41;</span>
at org.<span style="color: #006633;">apache</span>.<span style="color: #006633;">jasper</span>.<span style="color: #006633;">JspCompilationContext</span>.<span style="color: #006633;">getTldLocation</span> <span style="color: #009900;">&#40;</span>JspCompilationContext.<span style="color: #006633;">java</span><span style="color: #339933;">:</span><span style="color: #cc66cc;">526</span><span style="color: #009900;">&#41;</span>
at org.<span style="color: #006633;">apache</span>.<span style="color: #006633;">jasper</span>.<span style="color: #006633;">compiler</span>.<span style="color: #003399;">Parser</span>.<span style="color: #006633;">parseTaglibDirective</span> <span style="color: #009900;">&#40;</span><span style="color: #003399;">Parser</span>.<span style="color: #006633;">java</span><span style="color: #339933;">:</span><span style="color: #cc66cc;">422</span><span style="color: #009900;">&#41;</span>
...</pre></td></tr></table></div>

<p>No clue why this is happening. Surprising this is, this issue cannot be reproduced on a Windows box. Only on my Mac with JDK 1.6 and Maven 2.0, I&#8217;m getting this issue.</p>
<p>On goolging for this issue, I make across <a href="http://jira.codehaus.org/browse/CARGO-651" target="_blank">this bug report</a> which kind of indicated that this might be an issue with the <a href="http://cargo.codehaus.org/Maven2+plugin" target="_blank">Cargo Maven Plugin</a>. On upgrading the plugin to version 1.0, the issue was solved. <img src='http://blogs.agilefaqs.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p>Need to find out what caused the problem in the first place.</p>
]]></content:encoded>
			<wfw:commentRss>http://blogs.agilefaqs.com/2009/07/09/unable-to-initialize-tldlocationscache/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Brett&#8217;s Refactoring Exercise Solution Take 1</title>
		<link>http://blogs.agilefaqs.com/2009/06/13/bretts-refactoring-exercise-solution-take-1/</link>
		<comments>http://blogs.agilefaqs.com/2009/06/13/bretts-refactoring-exercise-solution-take-1/#comments</comments>
		<pubDate>Sat, 13 Jun 2009 07:10:29 +0000</pubDate>
		<dc:creator>Naresh Jain</dc:creator>
				<category><![CDATA[Agile]]></category>
		<category><![CDATA[Design]]></category>
		<category><![CDATA[Java]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[Testing]]></category>
		<category><![CDATA[acceptance test]]></category>
		<category><![CDATA[deprecated]]></category>
		<category><![CDATA[duplicate code]]></category>
		<category><![CDATA[fitnesse]]></category>
		<category><![CDATA[primitive obsession smell]]></category>
		<category><![CDATA[Refactoring]]></category>
		<category><![CDATA[type-safe-enums]]></category>

		<guid isPermaLink="false">http://blogs.agilefaqs.com/?p=767</guid>
		<description><![CDATA[Recently Brett Schuchert from Object Mentor has started posting code snippets on his blog and inviting people to refactor it. Similar to the Daily Refactoring Teaser that I&#8217;m conducting at Directi. (I&#8217;m planning to make it public soon). Following is my refactored solution (take 1) to the poorly written code. Wrote some Acceptance Test to [...]]]></description>
			<content:encoded><![CDATA[<p>Recently <a href="http://schuchert.wikispaces.com" target="_blank">Brett Schuchert</a> from <a href="http://objectmentor.com" target="_blank">Object Mentor</a> has started posting code snippets on his blog and inviting people to refactor it. Similar to the Daily Refactoring Teaser that I&#8217;m conducting at <a href="http://directi.com" target="_blank">Directi</a>. (I&#8217;m planning to make it public soon).</p>
<p>Following is my refactored solution (take 1) to the <a href="http://blog.objectmentor.com/articles/2009/06/09/another-refactoring-exercise-design-patterns-recommended" target="_blank">poorly written code</a>.</p>
<p>Wrote some Acceptance Test to understand how the RpnCalculator works:</p>
<p><a href="http://blogs.agilefaqs.com/wp-content/uploads/2009/06/rpncalculatoracceptancetest.png"><img class="aligncenter size-full wp-image-768" title="rpncalculatoracceptancetest" src="http://blogs.agilefaqs.com/wp-content/uploads/2009/06/rpncalculatoracceptancetest.png" alt="" width="256" height="722" /></a></p>
<p>Then I updated the perform method to</p>

<div class="wp_syntax"><div class="code"><pre class="java" style="font-family:monospace;">@Deprecated
<span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000066; font-weight: bold;">void</span> perform<span style="color: #009900;">&#40;</span><span style="color: #000000; font-weight: bold;">final</span> <span style="color: #003399;">String</span> operatorName<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
  perform<span style="color: #009900;">&#40;</span>operators.<span style="color: #006633;">get</span><span style="color: #009900;">&#40;</span>operatorName<span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span>
&nbsp;
<span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000066; font-weight: bold;">void</span> perform<span style="color: #009900;">&#40;</span><span style="color: #000000; font-weight: bold;">final</span> Operator operator<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
  operator.<span style="color: #006633;">eval</span><span style="color: #009900;">&#40;</span>stack<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
  currentMode <span style="color: #339933;">=</span> Mode.<span style="color: #006633;">inserting</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span></pre></div></div>

<p>Notice I&#8217;ve deprecated the old method which takes String. I want to kill <a href="http://blogs.agilefaqs.com/2009/10/20/primitive-obsession/" target="_self">primitive obsession</a> at its root.</p>
<p>Had to temporarily add the following map (this should go away once our deprecated method is knocked off).</p>

<div class="wp_syntax"><div class="code"><pre class="java" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">private</span> <span style="color: #000000; font-weight: bold;">static</span> <span style="color: #003399;">Map</span> operators <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> <span style="color: #003399;">HashMap</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
  <span style="color: #009900;">&#123;</span>
    put<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;+&quot;</span>, Operator.<span style="color: #006633;">ADD</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    put<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;-&quot;</span>, Operator.<span style="color: #006633;">SUBTRACT</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    put<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;!&quot;</span>, Operator.<span style="color: #006633;">FACTORIAL</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
  <span style="color: #009900;">&#125;</span>
&nbsp;
  @Override
  <span style="color: #000000; font-weight: bold;">public</span> Operator get<span style="color: #009900;">&#40;</span><span style="color: #000000; font-weight: bold;">final</span> <span style="color: #003399;">Object</span> key<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
    <span style="color: #000000; font-weight: bold;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #339933;">!</span><span style="color: #000000; font-weight: bold;">super</span>.<span style="color: #006633;">containsKey</span><span style="color: #009900;">&#40;</span>key<span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
      <span style="color: #000000; font-weight: bold;">throw</span> <span style="color: #000000; font-weight: bold;">new</span> MathOperatorNotFoundException<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    <span style="color: #009900;">&#125;</span>
    <span style="color: #000000; font-weight: bold;">return</span> <span style="color: #000000; font-weight: bold;">super</span>.<span style="color: #006633;">get</span><span style="color: #009900;">&#40;</span>key<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
  <span style="color: #009900;">&#125;</span>
<span style="color: #009900;">&#125;</span><span style="color: #339933;">;</span></pre></div></div>

<p>Defined various Operators</p>

<div class="wp_syntax"><div class="code"><pre class="java" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">private</span> <span style="color: #000000; font-weight: bold;">static</span> <span style="color: #000000; font-weight: bold;">abstract</span> <span style="color: #000000; font-weight: bold;">class</span> Operator <span style="color: #009900;">&#123;</span>
  <span style="color: #000000; font-weight: bold;">private</span> <span style="color: #000000; font-weight: bold;">static</span> <span style="color: #000000; font-weight: bold;">final</span> Operator ADD <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> BinaryOperator<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
    @Override
    <span style="color: #000000; font-weight: bold;">protected</span> <span style="color: #000066; font-weight: bold;">int</span> eval<span style="color: #009900;">&#40;</span><span style="color: #000000; font-weight: bold;">final</span> <span style="color: #000066; font-weight: bold;">int</span> op1, <span style="color: #000000; font-weight: bold;">final</span> <span style="color: #000066; font-weight: bold;">int</span> op2<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
      <span style="color: #000000; font-weight: bold;">return</span> op1 <span style="color: #339933;">+</span> op2<span style="color: #339933;">;</span>
    <span style="color: #009900;">&#125;</span>
  <span style="color: #009900;">&#125;</span><span style="color: #339933;">;</span>
&nbsp;
  <span style="color: #000000; font-weight: bold;">private</span> <span style="color: #000000; font-weight: bold;">static</span> <span style="color: #000000; font-weight: bold;">final</span> Operator SUBTRACT <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> BinaryOperator<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
    @Override
    <span style="color: #000000; font-weight: bold;">protected</span> <span style="color: #000066; font-weight: bold;">int</span> eval<span style="color: #009900;">&#40;</span><span style="color: #000000; font-weight: bold;">final</span> <span style="color: #000066; font-weight: bold;">int</span> op1, <span style="color: #000000; font-weight: bold;">final</span> <span style="color: #000066; font-weight: bold;">int</span> op2<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
      <span style="color: #000000; font-weight: bold;">return</span> op2 <span style="color: #339933;">-</span> op1<span style="color: #339933;">;</span>
    <span style="color: #009900;">&#125;</span>
  <span style="color: #009900;">&#125;</span><span style="color: #339933;">;</span>
&nbsp;
  <span style="color: #000000; font-weight: bold;">private</span> <span style="color: #000000; font-weight: bold;">static</span> <span style="color: #000000; font-weight: bold;">final</span> Operator FACTORIAL <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> UnaryOperator<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
    @Override
    <span style="color: #000000; font-weight: bold;">protected</span> <span style="color: #000066; font-weight: bold;">int</span> eval<span style="color: #009900;">&#40;</span><span style="color: #000000; font-weight: bold;">final</span> <span style="color: #000066; font-weight: bold;">int</span> op1<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
      <span style="color: #000066; font-weight: bold;">int</span> result <span style="color: #339933;">=</span> <span style="color: #cc66cc;">1</span><span style="color: #339933;">;</span>
      <span style="color: #000066; font-weight: bold;">int</span> currentOperandValue <span style="color: #339933;">=</span> op1<span style="color: #339933;">;</span>
      <span style="color: #000000; font-weight: bold;">while</span> <span style="color: #009900;">&#40;</span>currentOperandValue <span style="color: #339933;">&amp;</span>gt<span style="color: #339933;">;</span> <span style="color: #cc66cc;">1</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
        result <span style="color: #339933;">*=</span> currentOperandValue<span style="color: #339933;">;</span>
        <span style="color: #339933;">--</span>currentOperandValue<span style="color: #339933;">;</span>
      <span style="color: #009900;">&#125;</span>
      <span style="color: #000000; font-weight: bold;">return</span> result<span style="color: #339933;">;</span>
    <span style="color: #009900;">&#125;</span>
  <span style="color: #009900;">&#125;</span><span style="color: #339933;">;</span>
&nbsp;
  <span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000000; font-weight: bold;">abstract</span> <span style="color: #000066; font-weight: bold;">void</span> eval<span style="color: #009900;">&#40;</span><span style="color: #000000; font-weight: bold;">final</span> OperandStack stack<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span></pre></div></div>

<p>Declared two types of Operators (BinaryOperator and UnaryOperator) to avoid duplication and to make it easy for adding new operators.</p>

<div class="wp_syntax"><div class="code"><pre class="java" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000000; font-weight: bold;">static</span> <span style="color: #000000; font-weight: bold;">abstract</span> <span style="color: #000000; font-weight: bold;">class</span> BinaryOperator <span style="color: #000000; font-weight: bold;">extends</span> Operator <span style="color: #009900;">&#123;</span>
  @Override
  <span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000066; font-weight: bold;">void</span> eval<span style="color: #009900;">&#40;</span><span style="color: #000000; font-weight: bold;">final</span> OperandStack s<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
    s.<span style="color: #006633;">push</span><span style="color: #009900;">&#40;</span>eval<span style="color: #009900;">&#40;</span>s.<span style="color: #006633;">pop</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>, s.<span style="color: #006633;">pop</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
  <span style="color: #009900;">&#125;</span>
&nbsp;
  <span style="color: #000000; font-weight: bold;">protected</span> <span style="color: #000000; font-weight: bold;">abstract</span> <span style="color: #000066; font-weight: bold;">int</span> eval<span style="color: #009900;">&#40;</span><span style="color: #000066; font-weight: bold;">int</span> op1, <span style="color: #000066; font-weight: bold;">int</span> op2<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span></pre></div></div>

<p>and</p>

<div class="wp_syntax"><div class="code"><pre class="java" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000000; font-weight: bold;">static</span> <span style="color: #000000; font-weight: bold;">abstract</span> <span style="color: #000000; font-weight: bold;">class</span> UnaryOperator <span style="color: #000000; font-weight: bold;">extends</span> Operator <span style="color: #009900;">&#123;</span>
  @Override
  <span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000066; font-weight: bold;">void</span> eval<span style="color: #009900;">&#40;</span><span style="color: #000000; font-weight: bold;">final</span> OperandStack s<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
    s.<span style="color: #006633;">push</span><span style="color: #009900;">&#40;</span>eval<span style="color: #009900;">&#40;</span>s.<span style="color: #006633;">pop</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
  <span style="color: #009900;">&#125;</span>
&nbsp;
  <span style="color: #000000; font-weight: bold;">protected</span> <span style="color: #000000; font-weight: bold;">abstract</span> <span style="color: #000066; font-weight: bold;">int</span> eval<span style="color: #009900;">&#40;</span><span style="color: #000066; font-weight: bold;">int</span> op1<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span></pre></div></div>

]]></content:encoded>
			<wfw:commentRss>http://blogs.agilefaqs.com/2009/06/13/bretts-refactoring-exercise-solution-take-1/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Cobertura Gottachs</title>
		<link>http://blogs.agilefaqs.com/2008/10/03/cobertura-gottachs/</link>
		<comments>http://blogs.agilefaqs.com/2008/10/03/cobertura-gottachs/#comments</comments>
		<pubDate>Thu, 02 Oct 2008 19:11:55 +0000</pubDate>
		<dc:creator>Naresh Jain</dc:creator>
				<category><![CDATA[Agile]]></category>
		<category><![CDATA[Java]]></category>
		<category><![CDATA[Testing]]></category>
		<category><![CDATA[Automated Build]]></category>
		<category><![CDATA[Code Coverage]]></category>

		<guid isPermaLink="false">http://blogs.agilefaqs.com/?p=345</guid>
		<description><![CDATA[Today I spent a good 3 hours trouble shooting issues with code coverage on a legacy project. I&#8217;ve been using Cobertura for a good 3 years now. Hence I decided to use Cobertura to help a team working on a legacy project. What looked like a simple 10 mins job, ended up taking forever. To [...]]]></description>
			<content:encoded><![CDATA[<p>Today I spent a good 3 hours trouble shooting issues with code coverage on a legacy project. I&#8217;ve been using <a href="http://cobertura.sourceforge.net/" target="_blank">Cobertura</a> for a good 3 years now. Hence I decided to use Cobertura to help a team working on a legacy project. What looked like a simple 10 mins job, ended up taking forever.</p>
<p>To start off, the team did not have an automated build. So I quickly put an <a href="http://ant.apache.org/" target="_blank">Ant</a> script together. Last 2 days I had helped them write some acceptance tests using <a href="http://fitnesse.org" target="_blank">FitNesse</a>. I set up the build file to run the FitNesse tests as part of the build. Once I had the testing in place, I wanted to see what kind of code coverage we had. So we started adding Cobertura Ant tasks to the build. This was a fairly trivial task. But surprisingly cobertura-report kept displaying N/A for Line and Branch coverage. Clearly there was something wrong.</p>
<p>After spending a good amount of time, I realized that we need to compile the source code with debug=true option, else Cobertura does not generate any coverage numbers. What&#8217;s amazing is, it does not complain (in the normal mode) about this nor does cobertura&#8217;s documentation talks about this. When I ran the ant build in verbose mode, it showed the following warning</p>
<blockquote><p>[cobertura-instrument] WARN visitEnd, No line number information found for class</p></blockquote>
<p>That&#8217;s when it occurred to me that I need to compile my source code with debug=true option.</p>
<p>Once I solved this problem I hit the next roadblock. Even thought I fixed the debug=true option issue, cobertura-report was still displaying N/A for Line and Branch coverage. I quickly wrote a dummy unit tests and that seemed to work. Cobertura report started showing some numbers. But I was not able to generate any coverage numbers from the main Java application (server) that I was trying to test.</p>
<p>I knew there was some problem with the Shutdown hook not been executed correctly to flush the coverage numbers to the ser file. It turned out that if you have a server which is started as a daemon process in a forked JVM in the build, it needs to have a way to shutdown the server gracefully. So I ended up writing a shutdown command for the server which would basically do a <em>System.exit(0)</em>. One need to explicitly call the shutdown script before calling the cobertura report target.</p>
<p>Finally after 3 hrs, there was some ray of hope in my life when I saw a good 86% code coverage. This meant I could now go and refactor the code till I dropped dead.</p>
]]></content:encoded>
			<wfw:commentRss>http://blogs.agilefaqs.com/2008/10/03/cobertura-gottachs/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>toString(), equals() and hashCode(): To Override or Not to?</title>
		<link>http://blogs.agilefaqs.com/2008/08/31/tostring-equals-and-hashcode-to-override-or-not-to/</link>
		<comments>http://blogs.agilefaqs.com/2008/08/31/tostring-equals-and-hashcode-to-override-or-not-to/#comments</comments>
		<pubDate>Sun, 31 Aug 2008 11:27:21 +0000</pubDate>
		<dc:creator>Naresh Jain</dc:creator>
				<category><![CDATA[Agile]]></category>
		<category><![CDATA[Java]]></category>

		<guid isPermaLink="false">http://blogs.agilefaqs.com/?p=323</guid>
		<description><![CDATA[During a pairing session with Michael Feathers, he told me why he does not like to override toString(), equals() and hashCode() methods in Java. If you look around, different people use toString() method to return random pieces of text. The guidelines says that the toString() method should Returns a string representation of the object. In [...]]]></description>
			<content:encoded><![CDATA[<div>During a pairing session with <a href="http://www.objectmentor.com/omTeam/feathers_m.html" target="_blank">Michael Feathers</a>, he told me why he does not like to override toString(), equals() and hashCode() methods in Java.</div>
<div>If you look around, different people use toString() method to return random pieces of text. The guidelines says that the toString() method should</div>
<blockquote>
<div>Returns a string representation of the object. In general, the </p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
</pre></td><td class="code"><pre class="java" style="font-family:monospace;">toString</pre></td></tr></table></div>

<p> method returns a string that &#8220;textually represents&#8221; this object. The result should be a concise but informative representation that is easy for a person to read. It is recommended that all subclasses override this method.</p></div>
</blockquote>
<div></div>
<div>What does string representation of the object really mean? Does it mean all the values of all the instance variables? Does it mean just a selected values? Usually developers decide on some selected value which uniquely identifies the object. But there is no clear guideline. </div>
<div>Similarly when we talk about the equals() method, different developers look at object equality differently. Depending on the state of the object and the context, one might have to think about equality differently. So instead of overriding equals() method, Michael prefers to create methods like matchesId() or matchesName() which are very explicit in terms of what they are matching to. </div>
<div>So the next time you override one of these methods think about them.</div>
]]></content:encoded>
			<wfw:commentRss>http://blogs.agilefaqs.com/2008/08/31/tostring-equals-and-hashcode-to-override-or-not-to/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>@Override annotation, I&#8217;m looking at you</title>
		<link>http://blogs.agilefaqs.com/2008/08/18/override-annotation-im-looking-at-you/</link>
		<comments>http://blogs.agilefaqs.com/2008/08/18/override-annotation-im-looking-at-you/#comments</comments>
		<pubDate>Mon, 18 Aug 2008 18:26:33 +0000</pubDate>
		<dc:creator>Naresh Jain</dc:creator>
				<category><![CDATA[Java]]></category>

		<guid isPermaLink="false">http://blogs.agilefaqs.com/?p=318</guid>
		<description><![CDATA[Being out of touch with Java coding and moving between Java 5 and 6 can be a great way to assume yourself. Couple of days back I stumbled upon a fairly well know Java 5 feature, @Override annotation. Annotations were introduced in Java 5. According to the JavaDoc public @interface Override Indicates that a method [...]]]></description>
			<content:encoded><![CDATA[<p>Being out of touch with Java coding and moving between Java 5 and 6 can be a great way to assume yourself. Couple of days back I stumbled upon a fairly well know Java 5 feature, @Override annotation. Annotations were introduced in Java 5. According to the <a href="http://java.sun.com/javase/6/docs/api/java/lang/Override.html" target="_blank">JavaDoc</a></p>
<blockquote>
<pre>public @interface <strong>Override</strong></pre>
<p>Indicates that a method declaration is intended to override a method declaration in a superclass. If a method is annotated with this annotation type but does not override a superclass method, compilers are required to generate an error message.</p></blockquote>
<p>One would read this and think the following code should work perfectly fine:</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
</pre></td><td class="code"><pre class="java" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">interface</span> I <span style="color: #009900;">&#123;</span>
  <span style="color: #000066; font-weight: bold;">void</span> m1<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span></pre></td></tr></table></div>


<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
</pre></td><td class="code"><pre class="java" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">class</span> C <span style="color: #000000; font-weight: bold;">implements</span> I <span style="color: #009900;">&#123;</span></pre></td></tr></table></div>


<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
</pre></td><td class="code"><pre class="java" style="font-family:monospace;">  @Override
  <span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000066; font-weight: bold;">void</span> m1<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
  <span style="color: #009900;">&#125;</span>
<span style="color: #009900;">&#125;</span></pre></td></tr></table></div>

<p>But guess what? In Java 5, the compiler gives the following error: &#8220;The method m1() of type C must override a superclass method&#8221;</p>
<div>The same exact code works perfectly fine on Java 6. You go back and read the Javadocs again and you can&#8217;t seem to find a fault. But it turns out that in Java 5, @Override annotation only applied to methods overridden from a superclass and not from Interfaces. (So if you implement a method from an Interface, @Override annotation cannot be applied in Java 5).</div>
<div></div>
<div>This was apparently a bug in Java 5, which was fixed in Java 6. Here is the bug report : <a href="http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=6399361" target="_blank">http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=6399361</a></div>
<div>This is great, but there is no mention on public JDK 6 JavaDocs nor in the release notes.</div>
<div>Eclipse IDE 3.3.1.1 recognizes the new feature and add the @Override annotation auto-magically every time I override a method or implement an interface method. Pretty cool! Unfortunately for all you Intelij fans, there is <a href="http://www.jetbrains.net/jira/browse/IDEA-18276" target="_blank">an open bug</a> still waiting to be fixed.</div>
]]></content:encoded>
			<wfw:commentRss>http://blogs.agilefaqs.com/2008/08/18/override-annotation-im-looking-at-you/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>svn: Unable to open an ra_local session to URL</title>
		<link>http://blogs.agilefaqs.com/2008/08/04/svn-unable-to-open-an-ra_local-session-to-url/</link>
		<comments>http://blogs.agilefaqs.com/2008/08/04/svn-unable-to-open-an-ra_local-session-to-url/#comments</comments>
		<pubDate>Mon, 04 Aug 2008 08:20:22 +0000</pubDate>
		<dc:creator>Naresh Jain</dc:creator>
				<category><![CDATA[Java]]></category>
		<category><![CDATA[fitnesse]]></category>
		<category><![CDATA[subversion]]></category>
		<category><![CDATA[svn]]></category>

		<guid isPermaLink="false">http://blogs.agilefaqs.com/?p=311</guid>
		<description><![CDATA[Currently I&#8217;m working on adding Revision Control support to FitNesse. In the process, I&#8217;m creating a SVN adapter using svnkit library. Once I&#8217;ve added a file, if I try to commit the file using 1 2 3 4 5 6 protected void commit&#40;File file&#41; throws SVNException &#123; final SVNClientManager manager = SVNClientManager.newInstance&#40;&#41;; final SVNCommitClient commitClient [...]]]></description>
			<content:encoded><![CDATA[<p>Currently I&#8217;m working on adding Revision Control support to <a href="http://fitnesse.org" target="_blank">FitNesse</a>. In the process, I&#8217;m creating a SVN adapter using <a href="http://svnkit.com" target="_blank">svnkit library</a>.</p>
<p>Once I&#8217;ve added a file, if I try to commit the file using</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
</pre></td><td class="code"><pre class="java" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">protected</span> <span style="color: #000066; font-weight: bold;">void</span> commit<span style="color: #009900;">&#40;</span><span style="color: #003399;">File</span> file<span style="color: #009900;">&#41;</span> <span style="color: #000000; font-weight: bold;">throws</span> SVNException <span style="color: #009900;">&#123;</span>
<span style="color: #000000; font-weight: bold;">final</span> SVNClientManager manager <span style="color: #339933;">=</span> SVNClientManager.<span style="color: #006633;">newInstance</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #000000; font-weight: bold;">final</span> SVNCommitClient commitClient <span style="color: #339933;">=</span> manager.<span style="color: #006633;">getCommitClient</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #000000; font-weight: bold;">final</span> <span style="color: #003399;">File</span><span style="color: #009900;">&#91;</span><span style="color: #009900;">&#93;</span> filesToCommit <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> <span style="color: #003399;">File</span><span style="color: #009900;">&#91;</span><span style="color: #009900;">&#93;</span> <span style="color: #009900;">&#123;</span> file <span style="color: #009900;">&#125;</span><span style="color: #339933;">;</span>
commitClient.<span style="color: #006633;">doCommit</span><span style="color: #009900;">&#40;</span>filesToCommit, <span style="color: #000066; font-weight: bold;">false</span>, <span style="color: #0000ff;">&quot;Auto Commit&quot;</span>, <span style="color: #000066; font-weight: bold;">false</span>, <span style="color: #000066; font-weight: bold;">false</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span></pre></td></tr></table></div>

<p>I get the following exception:</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
</pre></td><td class="code"><pre class="java" style="font-family:monospace;">svn<span style="color: #339933;">:</span> Unable to open an ra_local session to <span style="color: #003399;">URL</span>
at org.<span style="color: #006633;">tmatesoft</span>.<span style="color: #006633;">svn</span>.<span style="color: #006633;">core</span>.<span style="color: #006633;">internal</span>.<span style="color: #006633;">wc</span>.<span style="color: #006633;">SVNErrorManager</span>.<span style="color: #006633;">error</span><span style="color: #009900;">&#40;</span>SVNErrorManager.<span style="color: #006633;">java</span><span style="color: #339933;">:</span><span style="color: #cc66cc;">55</span><span style="color: #009900;">&#41;</span>
at org.<span style="color: #006633;">tmatesoft</span>.<span style="color: #006633;">svn</span>.<span style="color: #006633;">core</span>.<span style="color: #006633;">internal</span>.<span style="color: #006633;">wc</span>.<span style="color: #006633;">SVNErrorManager</span>.<span style="color: #006633;">error</span><span style="color: #009900;">&#40;</span>SVNErrorManager.<span style="color: #006633;">java</span><span style="color: #339933;">:</span><span style="color: #cc66cc;">40</span><span style="color: #009900;">&#41;</span>
at org.<span style="color: #006633;">tmatesoft</span>.<span style="color: #006633;">svn</span>.<span style="color: #006633;">core</span>.<span style="color: #006633;">wc</span>.<span style="color: #006633;">SVNCommitClient</span>.<span style="color: #006633;">doCommit</span><span style="color: #009900;">&#40;</span>SVNCommitClient.<span style="color: #006633;">java</span><span style="color: #339933;">:</span><span style="color: #cc66cc;">582</span><span style="color: #009900;">&#41;</span>
at org.<span style="color: #006633;">tmatesoft</span>.<span style="color: #006633;">svn</span>.<span style="color: #006633;">core</span>.<span style="color: #006633;">wc</span>.<span style="color: #006633;">SVNCommitClient</span>.<span style="color: #006633;">doCommit</span><span style="color: #009900;">&#40;</span>SVNCommitClient.<span style="color: #006633;">java</span><span style="color: #339933;">:</span><span style="color: #cc66cc;">549</span><span style="color: #009900;">&#41;</span></pre></td></tr></table></div>

<p>Trying to Google for this, did not take me anywhere. Finally after debugging thru svnkit&#8217;s code, I stumbled upon the following line which throws the exception:</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
</pre></td><td class="code"><pre class="java" style="font-family:monospace;">SVNRepository repository <span style="color: #339933;">=</span> SVNRepositoryFactory.<span style="color: #006633;">create</span><span style="color: #009900;">&#40;</span>SVNURL.<span style="color: #006633;">parseURIDecoded</span><span style="color: #009900;">&#40;</span>url<span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></td></tr></table></div>

<p>Basically, they have SVNRepositoryFactory class which expects the client to register an appropriate driver to handle the given protocol. Their javadocs says:</p>
<blockquote><p>Depending on what protocol a user exactly would like to use to access the repository he should first of all set up an appropriate extension of this factory. So, if the user is going to work with the repository via the custom svn-protocol (or svn+xxx) he initially calls</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
</pre></td><td class="code"><pre class="java" style="font-family:monospace;">SVNRepositoryFactoryImpl.<span style="color: #006633;">setup</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></td></tr></table></div>

</blockquote>
<p>More details: <a href="http://svnkit.com/kb/javadoc/org/tmatesoft/svn/core/io/SVNRepositoryFactory.html" target="_blank">http://svnkit.com/kb/javadoc/org/tmatesoft/svn/core/io/SVNRepositoryFactory.html</a></p>
<p>Solution: Since I&#8217;m using File System (file://) protocol, I had to add the following line in a static block of my adapter class:</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
</pre></td><td class="code"><pre class="java" style="font-family:monospace;">FSRepositoryFactory.<span style="color: #006633;">setup</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></td></tr></table></div>

]]></content:encoded>
			<wfw:commentRss>http://blogs.agilefaqs.com/2008/08/04/svn-unable-to-open-an-ra_local-session-to-url/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Cannot instantiate DocumentBuilderFactory in JDK 5</title>
		<link>http://blogs.agilefaqs.com/2006/12/30/cannot-instantiate-documentbuilderfactory-in-jdk-5/</link>
		<comments>http://blogs.agilefaqs.com/2006/12/30/cannot-instantiate-documentbuilderfactory-in-jdk-5/#comments</comments>
		<pubDate>Sat, 30 Dec 2006 05:32:42 +0000</pubDate>
		<dc:creator>Naresh Jain</dc:creator>
				<category><![CDATA[Java]]></category>

		<guid isPermaLink="false">http://blogs.agilefaqs.com/?p=10</guid>
		<description><![CDATA[Few months back I moved to JDK 5. After this move, recently, I tried running some Acceptance tests using an old fitnesse.jar, which was compiled using JDK 1.4. And guess what? I get the following exception : 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 [...]]]></description>
			<content:encoded><![CDATA[<p>Few months back I moved to <span class="caps">JDK 5</span>. After this move, recently, I tried running some Acceptance tests using an old fitnesse.jar, which was compiled using <span class="caps">JDK 1</span>.4. And guess what? I get the following exception :</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
</pre></td><td class="code"><pre class="java" style="font-family:monospace;">javax.<span style="color: #006633;">xml</span>.<span style="color: #006633;">parsers</span>.<span style="color: #006633;">FactoryConfigurationError</span><span style="color: #339933;">:</span>
<span style="color: #003399;">Provider</span> com.<span style="color: #006633;">sun</span>.<span style="color: #006633;">org</span>.<span style="color: #006633;">apache</span>.<span style="color: #006633;">xerces</span>.<span style="color: #006633;">internal</span>.<span style="color: #006633;">jaxp</span>.
<span style="color: #006633;">DocumentBuilderFactoryImpl</span> could not be instantiated<span style="color: #339933;">:</span> java.<span style="color: #006633;">lang</span>.<span style="color: #003399;">NullPointerException</span>
<span style="color: #009900;">&#91;</span>java<span style="color: #009900;">&#93;</span> at javax.<span style="color: #006633;">xml</span>.<span style="color: #006633;">parsers</span>.<span style="color: #006633;">DocumentBuilderFactory</span>.<span style="color: #006633;">newInstance</span>
<span style="color: #009900;">&#40;</span>DocumentBuilderFactory.<span style="color: #006633;">java</span><span style="color: #339933;">:</span><span style="color: #cc66cc;">104</span><span style="color: #009900;">&#41;</span>
<span style="color: #009900;">&#91;</span>java<span style="color: #009900;">&#93;</span> at fitnesse.<span style="color: #006633;">util</span>.<span style="color: #006633;">XmlUtil</span>.<span style="color: #339933;">&amp;</span>lt<span style="color: #339933;">;</span>clinit<span style="color: #339933;">&amp;</span>gt<span style="color: #339933;">;</span>
<span style="color: #009900;">&#91;</span>java<span style="color: #009900;">&#93;</span> at fitnesse.<span style="color: #006633;">wiki</span>.<span style="color: #006633;">WikiPageProperties</span>.<span style="color: #006633;">loadFromXmlStream</span>
<span style="color: #009900;">&#91;</span>java<span style="color: #009900;">&#93;</span> at fitnesse.<span style="color: #006633;">wiki</span>.<span style="color: #006633;">FileSystemPage</span>.<span style="color: #006633;">attemptToReadPropertiesFile</span>
<span style="color: #009900;">&#91;</span>java<span style="color: #009900;">&#93;</span> at fitnesse.<span style="color: #006633;">wiki</span>.<span style="color: #006633;">FileSystemPage</span>.<span style="color: #006633;">loadAttributes</span>
<span style="color: #009900;">&#91;</span>java<span style="color: #009900;">&#93;</span> at fitnesse.<span style="color: #006633;">wiki</span>.<span style="color: #006633;">FileSystemPage</span>.<span style="color: #006633;">makePageData</span>
<span style="color: #009900;">&#91;</span>java<span style="color: #009900;">&#93;</span> at fitnesse.<span style="color: #006633;">wiki</span>.<span style="color: #006633;">CachingPage</span>.<span style="color: #006633;">getData</span>
<span style="color: #009900;">&#91;</span>java<span style="color: #009900;">&#93;</span> at fitnesse.<span style="color: #006633;">responders</span>.<span style="color: #006633;">run</span>.<span style="color: #006633;">FitClientResponder</span>.<span style="color: #006633;">readyToSend</span>
<span style="color: #009900;">&#91;</span>java<span style="color: #009900;">&#93;</span> at fitnesse.<span style="color: #006633;">responders</span>.<span style="color: #006633;">run</span>.<span style="color: #006633;">PuppetResponse</span>.<span style="color: #006633;">readyToSend</span>
<span style="color: #009900;">&#91;</span>java<span style="color: #009900;">&#93;</span> at fitnesse.<span style="color: #006633;">FitNesseExpediter</span>.<span style="color: #006633;">sendResponse</span>
<span style="color: #009900;">&#91;</span>java<span style="color: #009900;">&#93;</span> at fitnesse.<span style="color: #006633;">FitNesseExpediter</span>.<span style="color: #006633;">start</span>
<span style="color: #009900;">&#91;</span>java<span style="color: #009900;">&#93;</span> at fitnesse.<span style="color: #006633;">FitNesseServer</span>.<span style="color: #006633;">serve</span>
<span style="color: #009900;">&#91;</span>java<span style="color: #009900;">&#93;</span> at fitnesse.<span style="color: #006633;">FitNesseServer</span>.<span style="color: #006633;">serve</span>
<span style="color: #009900;">&#91;</span>java<span style="color: #009900;">&#93;</span> at fitnesse.<span style="color: #006633;">socketservice</span>.<span style="color: #006633;">SocketService</span>$ServerRunner.<span style="color: #006633;">run</span>
<span style="color: #009900;">&#91;</span>java<span style="color: #009900;">&#93;</span> at java.<span style="color: #006633;">lang</span>.<span style="color: #003399;">Thread</span>.<span style="color: #006633;">run</span><span style="color: #009900;">&#40;</span><span style="color: #003399;">Thread</span>.<span style="color: #006633;">java</span><span style="color: #339933;">:</span><span style="color: #cc66cc;">595</span><span style="color: #009900;">&#41;</span></pre></td></tr></table></div>

<p>If I use <span class="caps">JDK 1</span>.4, everything works fine. But there seems to be some backward compatibility issues with <span class="caps">JDK 1</span>.5.</p>
<p>After trying different things for a while, I came across a site that stated that â€œThe <span class="caps">J2SE 1</span>.4 platform included the â€˜Crimsonâ€˜ reference implementation for <span class="caps">JAXP 1</span>.1. The <span class="caps">J2SE 5</span> platform includes a reference implementation for <span class="caps">JAXP 1</span>.3 based on the Apache â€˜Xercesâ€˜ library.â€</p>
<p>In <span class="caps">JDK 1</span>.4, xerces and xalan are embedded in the <span class="caps">JDK</span>. In <span class="caps">JDK 1</span>.5 too, but the packages are under com/sun (so com.sun.org.apacheâ€¦.).</p>
<p>So you would think all this should be transparent to developers. But no.</p>
<p>To verify the above statement, I opened up the DocumentBuilderFactory in <span class="caps">JDK 1</span>.5 and I found</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
</pre></td><td class="code"><pre class="java" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000000; font-weight: bold;">static</span> DocumentBuilderFactory newInstance<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
<span style="color: #000000; font-weight: bold;">try</span> <span style="color: #009900;">&#123;</span>
<span style="color: #000000; font-weight: bold;">return</span> <span style="color: #009900;">&#40;</span>DocumentBuilderFactory<span style="color: #009900;">&#41;</span> FactoryFinder.<span style="color: #006633;">find</span><span style="color: #009900;">&#40;</span>
<span style="color: #666666; font-style: italic;">/* The default property name according to the JAXP spec */</span>
<span style="color: #0000ff;">&quot;javax.xml.parsers.DocumentBuilderFactory&quot;</span>,
<span style="color: #666666; font-style: italic;">/* The fallback implementation class name */</span>
<span style="color: #0000ff;">&quot;com.sun.org.apache.xerces.internal.jaxp.
DocumentBuilderFactoryImpl&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span> <span style="color: #000000; font-weight: bold;">catch</span> <span style="color: #009900;">&#40;</span>FactoryFinder.<span style="color: #006633;">ConfigurationError</span> e<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
<span style="color: #000000; font-weight: bold;">throw</span> <span style="color: #000000; font-weight: bold;">new</span> FactoryConfigurationError<span style="color: #009900;">&#40;</span>e.<span style="color: #006633;">getException</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>,
e.<span style="color: #006633;">getMessage</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span></pre></td></tr></table></div>

<p>}<br />
while the <span class="caps">JDK 1</span>.4â€˜s DocumentBuilderFactory class had:</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
</pre></td><td class="code"><pre class="java" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000000; font-weight: bold;">static</span> DocumentBuilderFactory newInstance<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>
<span style="color: #000000; font-weight: bold;">throws</span> FactoryConfigurationError
<span style="color: #009900;">&#123;</span>
<span style="color: #000000; font-weight: bold;">try</span> <span style="color: #009900;">&#123;</span>
<span style="color: #000000; font-weight: bold;">return</span> <span style="color: #009900;">&#40;</span>DocumentBuilderFactory<span style="color: #009900;">&#41;</span> FactoryFinder.<span style="color: #006633;">find</span><span style="color: #009900;">&#40;</span>
<span style="color: #666666; font-style: italic;">/* The default property name according to the JAXP spec */</span>
<span style="color: #0000ff;">&quot;javax.xml.parsers.DocumentBuilderFactory&quot;</span>,
<span style="color: #666666; font-style: italic;">/* The fallback implementation class name */</span>
<span style="color: #0000ff;">&quot;org.apache.crimson.jaxp.
DocumentBuilderFactoryImpl&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span> <span style="color: #000000; font-weight: bold;">catch</span> <span style="color: #009900;">&#40;</span>FactoryFinder.<span style="color: #006633;">ConfigurationError</span> e<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
<span style="color: #000000; font-weight: bold;">throw</span> <span style="color: #000000; font-weight: bold;">new</span> FactoryConfigurationError <span style="color: #009900;">&#40;</span>e.<span style="color: #006633;">getException</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>,
e.<span style="color: #006633;">getMessage</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span>
<span style="color: #009900;">&#125;</span></pre></td></tr></table></div>

<p>After all this research I still donâ€˜t know what is the exact problem. But I have a solution.</p>
<p><strong>Solution</strong>: Luckily adding the xerces.jar to the classpath solved the problem.</p>
<p>Would appreciate if someone would let me know the answer.</p>
]]></content:encoded>
			<wfw:commentRss>http://blogs.agilefaqs.com/2006/12/30/cannot-instantiate-documentbuilderfactory-in-jdk-5/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Beta version of Lattu released</title>
		<link>http://blogs.agilefaqs.com/2006/12/11/beta-version-of-lattu-released/</link>
		<comments>http://blogs.agilefaqs.com/2006/12/11/beta-version-of-lattu-released/#comments</comments>
		<pubDate>Mon, 11 Dec 2006 07:33:40 +0000</pubDate>
		<dc:creator>Naresh Jain</dc:creator>
				<category><![CDATA[Java]]></category>

		<guid isPermaLink="false">http://blogs.agilefaqs.com/?p=12</guid>
		<description><![CDATA[I just released the first beta version of Lattu. Lattu is a framework for testing Eclipse RCP Applications. It can run both Unit and Functional tests. Essentially, it is an Eclipse Plugin which provides Fitnesse extension to run unit and acceptance tests. It uses JUnit for unit testing and Abbot for GUI tests. More details: [...]]]></description>
			<content:encoded><![CDATA[<p>I just released the first beta version of Lattu.</p>
<p>Lattu is a framework for testing <a href="http://www.eclipse.org/rcp/" target="_blank">Eclipse RCP Applications</a>. It can run both Unit and Functional tests. Essentially, it is an Eclipse Plugin which provides <a href="http://www.fitnesse.org" target="_blank">Fitnesse</a> extension to run unit and acceptance tests. It uses <a href="http://www/junit.org" target="_blank">JUnit<a> for unit testing and <a href="http://abbot.sourceforge.net" target="_blank">Abbot<a> for <span class="caps">GUI</span> tests.</p>
<p>More details: <a href="http://lattu.sourceforge.net" target="_blank">http://lattu.sourceforge.net</a></p>
]]></content:encoded>
			<wfw:commentRss>http://blogs.agilefaqs.com/2006/12/11/beta-version-of-lattu-released/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Date aware FitLibrary Fixtures</title>
		<link>http://blogs.agilefaqs.com/2006/11/23/date-aware-fitlibrary-fixtures/</link>
		<comments>http://blogs.agilefaqs.com/2006/11/23/date-aware-fitlibrary-fixtures/#comments</comments>
		<pubDate>Thu, 23 Nov 2006 22:45:06 +0000</pubDate>
		<dc:creator>Naresh Jain</dc:creator>
				<category><![CDATA[Java]]></category>

		<guid isPermaLink="false">http://blogs.agilefaqs.com/?p=15</guid>
		<description><![CDATA[Having problems parsing Dates in your fit/fitnesse tests? Here is a simple way to fix date parsing problem using FitLibrary. Fit Page &#124;set date format as&#124;MM/dd/yyyy&#124; &#124;date&#124; &#124;11/23/2006&#124; &#124;set date format as&#124;dd-MMM-yyyy&#124; &#124;date&#124; &#124;23-Nov-2006&#124; Fixture Class 1 2 3 4 5 6 &#60;br /&#62; public void setDateFormatAs&#40;String format&#41; &#123;&#60;br /&#62; ValueAdapter.registerParseDelegate&#40;java.sql.Date.class, new SimpleDateFormat&#40;format&#41;&#41;;&#60;br /&#62; ValueAdapter.registerParseDelegate&#40;java.util.Date.class, [...]]]></description>
			<content:encoded><![CDATA[<p>Having problems parsing Dates in your fit/fitnesse tests?</p>
<p>Here is a simple way to fix date parsing problem using FitLibrary.</p>
<p><strong>Fit Page</strong></p>
<p>|set date format as|MM/dd/yyyy|</p>
<p>|date|<br />
|11/23/2006|</p>
<p>|set date format as|dd-MMM-yyyy|</p>
<p>|date|<br />
|23-Nov-2006|</p>
<p><strong>Fixture Class</strong></p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
</pre></td><td class="code"><pre class="java" style="font-family:monospace;"><span style="color: #339933;">&lt;</span>br <span style="color: #339933;">/&gt;</span>
<span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000066; font-weight: bold;">void</span> setDateFormatAs<span style="color: #009900;">&#40;</span><span style="color: #003399;">String</span> format<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span><span style="color: #339933;">&lt;</span>br <span style="color: #339933;">/&gt;</span>
ValueAdapter.<span style="color: #006633;">registerParseDelegate</span><span style="color: #009900;">&#40;</span>java.<span style="color: #006633;">sql</span>.<span style="color: #003399;">Date</span>.<span style="color: #000000; font-weight: bold;">class</span>, <span style="color: #000000; font-weight: bold;">new</span> <span style="color: #003399;">SimpleDateFormat</span><span style="color: #009900;">&#40;</span>format<span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;&lt;</span>br <span style="color: #339933;">/&gt;</span>
ValueAdapter.<span style="color: #006633;">registerParseDelegate</span><span style="color: #009900;">&#40;</span>java.<span style="color: #006633;">util</span>.<span style="color: #003399;">Date</span>.<span style="color: #000000; font-weight: bold;">class</span>, <span style="color: #000000; font-weight: bold;">new</span> <span style="color: #003399;">SimpleDateFormat</span><span style="color: #009900;">&#40;</span>format<span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;&lt;</span>br <span style="color: #339933;">/&gt;</span>
<span style="color: #009900;">&#125;</span><span style="color: #339933;">&lt;/</span>p<span style="color: #339933;">&gt;</span>
	<span style="color: #339933;">&lt;</span>p<span style="color: #339933;">&gt;</span></pre></td></tr></table></div>

</p>
<p><strong>How this works?</strong><br />
The ValueAdapter class holds a static HashMap called <span class="caps">PARSE</span>_DELEGATES which contains all the ParseDelegators. The ParseDelegator&#8216;s job is to implement a parse method which take a String and returns the Object of your Data Type. You can register the Data Type and its respective ParseDelegator using the <strong>registerParseDelegate()</strong> method.</p>
<p>In this case, my ParseDelegator is SimpleDateFormat which has the following method</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
</pre></td><td class="code"><pre class="java" style="font-family:monospace;"><span style="color: #339933;">&lt;</span>br <span style="color: #339933;">/&gt;</span>
<span style="color: #000000; font-weight: bold;">public</span> <span style="color: #003399;">Date</span> parse<span style="color: #009900;">&#40;</span><span style="color: #003399;">String</span> source<span style="color: #009900;">&#41;</span> <span style="color: #000000; font-weight: bold;">throws</span> <span style="color: #003399;">ParseException</span><span style="color: #009900;">&#123;</span><span style="color: #339933;">&lt;</span>br <span style="color: #339933;">/&gt;</span>
<span style="color: #003399;">ParsePosition</span> pos <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> <span style="color: #003399;">ParsePosition</span><span style="color: #009900;">&#40;</span><span style="color: #cc66cc;">0</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;&lt;</span>br <span style="color: #339933;">/&gt;</span>
<span style="color: #003399;">Date</span> result <span style="color: #339933;">=</span> parse<span style="color: #009900;">&#40;</span>source, pos<span style="color: #009900;">&#41;</span><span style="color: #339933;">;&lt;</span>br <span style="color: #339933;">/&gt;</span>
<span style="color: #000000; font-weight: bold;">if</span> <span style="color: #009900;">&#40;</span>pos.<span style="color: #006633;">index</span> <span style="color: #339933;">==</span> <span style="color: #cc66cc;">0</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">&lt;</span>br <span style="color: #339933;">/&gt;</span>
<span style="color: #000000; font-weight: bold;">throw</span> <span style="color: #000000; font-weight: bold;">new</span> <span style="color: #003399;">ParseException</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;Unparseable date: &quot;</span> <span style="color: #339933;">+</span> source ,<span style="color: #339933;">&lt;</span>br <span style="color: #339933;">/&gt;</span>
pos.<span style="color: #006633;">errorIndex</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;&lt;</span>br <span style="color: #339933;">/&gt;</span>
<span style="color: #000000; font-weight: bold;">return</span> result<span style="color: #339933;">;&lt;</span>br <span style="color: #339933;">/&gt;</span>
<span style="color: #009900;">&#125;</span><span style="color: #339933;">&lt;/</span>p<span style="color: #339933;">&gt;</span>
	<span style="color: #339933;">&lt;</span>p<span style="color: #339933;">&gt;</span></pre></td></tr></table></div>

</p>
<p>All that matters is the following method signature:<br />
<strong>public Date parse(String source){</strong></p>
<p>You can use the same mechanism to parse any object of choice.</p>
]]></content:encoded>
			<wfw:commentRss>http://blogs.agilefaqs.com/2006/11/23/date-aware-fitlibrary-fixtures/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>WebSphere Deployment Descriptor Load Exception</title>
		<link>http://blogs.agilefaqs.com/2006/08/24/websphere-deployment-descriptor-load-exception/</link>
		<comments>http://blogs.agilefaqs.com/2006/08/24/websphere-deployment-descriptor-load-exception/#comments</comments>
		<pubDate>Thu, 24 Aug 2006 12:33:14 +0000</pubDate>
		<dc:creator>Naresh Jain</dc:creator>
				<category><![CDATA[Java]]></category>

		<guid isPermaLink="false">http://blogs.agilefaqs.com/?p=22</guid>
		<description><![CDATA[Getting the following error message while deploying an application in Websphere? com.ibm.etools.j2ee.commonarchivecore.exception. DeploymentDescriptorLoadException: IWAE0022E Exception occurred loading deployment descriptor Context: Check your web.xml. If you are using the following XSD as the DOCTYPE of your web.xml http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd Then you might want to check your servlet tag to make sure they match the Servlet 2.4 specification. [...]]]></description>
			<content:encoded><![CDATA[<p>Getting the following error message while deploying an application in Websphere?</p>
<p>com.ibm.etools.j2ee.commonarchivecore.exception.<br />
DeploymentDescriptorLoadException: <span class="caps">IWAE0022E </span>Exception occurred loading deployment descriptor</p>
<p>Context:<br />
Check your web.xml.<br />
If you are using the following <span class="caps">XSD</span> as the <span class="caps">DOCTYPE</span> of your web.xml http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd<br />
Then you might want to check your servlet tag to make sure they match the Servlet 2.4 specification.</p>
<p>For example, the following servlet causes the above exception when it tries to deploy the app.</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
</pre></td><td class="code"><pre class="java" style="font-family:monospace;"><span style="color: #339933;">&lt;</span>br <span style="color: #339933;">/&gt;</span>
<span style="color: #339933;">&amp;</span>lt<span style="color: #339933;">;</span>servlet<span style="color: #339933;">&amp;</span>gt<span style="color: #339933;">;&lt;</span>br <span style="color: #339933;">/&gt;</span>
<span style="color: #339933;">&amp;</span>lt<span style="color: #339933;">;</span>servlet<span style="color: #339933;">-</span>name<span style="color: #339933;">&amp;</span>gt<span style="color: #339933;">;</span>sampleservlet<span style="color: #339933;">&amp;</span>lt<span style="color: #339933;">;/</span>servlet<span style="color: #339933;">-</span>name<span style="color: #339933;">&amp;</span>gt<span style="color: #339933;">;&lt;</span>br <span style="color: #339933;">/&gt;</span>
<span style="color: #339933;">&amp;</span>lt<span style="color: #339933;">;</span>servlet<span style="color: #339933;">-</span>class<span style="color: #339933;">&amp;</span>gt<span style="color: #339933;">;</span>ABCClass<span style="color: #339933;">&amp;</span>lt<span style="color: #339933;">;/</span>servlet<span style="color: #339933;">-</span>class<span style="color: #339933;">&amp;</span>gt<span style="color: #339933;">;&lt;</span>br <span style="color: #339933;">/&gt;</span>
<span style="color: #339933;">&amp;</span>lt<span style="color: #339933;">;</span>init<span style="color: #339933;">-</span>param<span style="color: #339933;">&amp;</span>gt<span style="color: #339933;">;&lt;</span>br <span style="color: #339933;">/&gt;</span>
<span style="color: #339933;">&amp;</span>lt<span style="color: #339933;">;</span>param<span style="color: #339933;">-</span>name<span style="color: #339933;">&amp;</span>gt<span style="color: #339933;">;</span>ABCParamName<span style="color: #339933;">&amp;</span>lt<span style="color: #339933;">;/</span>param<span style="color: #339933;">-</span>name<span style="color: #339933;">&amp;</span>gt<span style="color: #339933;">;&lt;</span>br <span style="color: #339933;">/&gt;</span>
<span style="color: #339933;">&amp;</span>lt<span style="color: #339933;">;</span>param<span style="color: #339933;">-</span>value<span style="color: #339933;">&amp;</span>gt<span style="color: #339933;">;</span>ABCParamValue<span style="color: #339933;">&amp;</span>lt<span style="color: #339933;">;/</span>param<span style="color: #339933;">-</span>value<span style="color: #339933;">&amp;</span>gt<span style="color: #339933;">;&lt;</span>br <span style="color: #339933;">/&gt;</span>
<span style="color: #339933;">&amp;</span>lt<span style="color: #339933;">;</span>description<span style="color: #339933;">&amp;</span>gt<span style="color: #339933;">;</span>some desc<span style="color: #339933;">&amp;</span>lt<span style="color: #339933;">;/</span>description<span style="color: #339933;">&amp;</span>gt<span style="color: #339933;">;&lt;</span>br <span style="color: #339933;">/&gt;</span>
<span style="color: #339933;">&amp;</span>lt<span style="color: #339933;">;/</span>init<span style="color: #339933;">-</span>param<span style="color: #339933;">&amp;</span>gt<span style="color: #339933;">;&lt;</span>br <span style="color: #339933;">/&gt;</span>
<span style="color: #339933;">&amp;</span>lt<span style="color: #339933;">;/</span>servlet<span style="color: #339933;">&amp;</span>gt<span style="color: #339933;">;&lt;</span>br <span style="color: #339933;">/&gt;</span></pre></td></tr></table></div>

</p>
<p>Surprising this works perfectly fine if your web.xml is using http://java.sun.com/dtd/web-app_2_3.dtd as the <span class="caps">DOCTYPE</span></p>
<p>Solution:<br />
Removing the</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
</pre></td><td class="code"><pre class="java" style="font-family:monospace;"><span style="color: #339933;">&lt;</span>br <span style="color: #339933;">/&gt;</span>
<span style="color: #339933;">&amp;</span>lt<span style="color: #339933;">;</span>description<span style="color: #339933;">&amp;</span>gt<span style="color: #339933;">;</span>some desc<span style="color: #339933;">&amp;</span>lt<span style="color: #339933;">;/</span>description<span style="color: #339933;">&amp;</span>gt<span style="color: #339933;">;&lt;</span>br <span style="color: #339933;">/&gt;</span></pre></td></tr></table></div>

<p>
tag from</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
</pre></td><td class="code"><pre class="java" style="font-family:monospace;"><span style="color: #339933;">&lt;</span>br <span style="color: #339933;">/&gt;</span>
<span style="color: #339933;">&amp;</span>lt<span style="color: #339933;">;</span>init<span style="color: #339933;">-</span>param<span style="color: #339933;">&amp;</span>gt<span style="color: #339933;">;&lt;</span>br <span style="color: #339933;">/&gt;</span></pre></td></tr></table></div>

<p>
tag fixes the problem.</p>
<p>Another problem with DTDs:<br />
If you are using <span class="caps">DTD</span>, the order of the tag elements within the web.xml must follow the order reflected in the <span class="caps">DTD</span>. Else you will get similar exception message. The order of the tags in web.xml is very important when using <span class="caps">DTD</span>. But it should not matter if you are using <span class="caps">XSD</span>.</p>
<p>If you open the <span class="caps">DTD</span>, it would list the order of the tags in there.<br />
For example, web-app_2_3.dtd specifies the following order that the tags must have in order for the document to be considered a valid <span class="caps">XML</span> document:</p>
<p>
<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
</pre></td><td class="code"><pre class="java" style="font-family:monospace;"><span style="color: #339933;">&lt;</span>br <span style="color: #339933;">/&gt;</span>
<span style="color: #339933;">&amp;</span>lt<span style="color: #339933;">;!</span>ELEMENT web<span style="color: #339933;">-</span>app <span style="color: #009900;">&#40;</span>icon<span style="color: #339933;">?</span>, display<span style="color: #339933;">-</span>name<span style="color: #339933;">?</span>, description<span style="color: #339933;">?</span>, distributable<span style="color: #339933;">?</span>, context<span style="color: #339933;">-</span>param<span style="color: #339933;">*</span>, filter<span style="color: #339933;">*</span>, filter<span style="color: #339933;">-</span>mapping<span style="color: #339933;">*</span>, listener<span style="color: #339933;">*</span>, servlet<span style="color: #339933;">*</span>, servlet<span style="color: #339933;">-</span>mapping<span style="color: #339933;">*</span>, session<span style="color: #339933;">-</span>config<span style="color: #339933;">?</span>, mime<span style="color: #339933;">-</span>mapping<span style="color: #339933;">*</span>, welcome<span style="color: #339933;">-</span>file<span style="color: #339933;">-</span>list<span style="color: #339933;">?</span>, error<span style="color: #339933;">-</span>page<span style="color: #339933;">*</span>, taglib<span style="color: #339933;">*</span>, resource<span style="color: #339933;">-</span>env<span style="color: #339933;">-</span>ref<span style="color: #339933;">*</span>, resource<span style="color: #339933;">-</span>ref<span style="color: #339933;">*</span>, security<span style="color: #339933;">-</span>constraint<span style="color: #339933;">*</span>, login<span style="color: #339933;">-</span>config<span style="color: #339933;">?</span>, security<span style="color: #339933;">-</span>role<span style="color: #339933;">*</span>, env<span style="color: #339933;">-</span>entry<span style="color: #339933;">*</span>, ejb<span style="color: #339933;">-</span>ref<span style="color: #339933;">*</span>, ejb<span style="color: #339933;">-</span>local<span style="color: #339933;">-</span>ref<span style="color: #339933;">*</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">&amp;</span>gt<span style="color: #339933;">;&lt;</span>br <span style="color: #339933;">/&gt;</span></pre></td></tr></table></div>

</p>
<p>Hence</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
</pre></td><td class="code"><pre class="java" style="font-family:monospace;"><span style="color: #339933;">&lt;</span>br <span style="color: #339933;">/&gt;</span>
<span style="color: #339933;">&amp;</span>lt<span style="color: #339933;">;</span>ejb<span style="color: #339933;">-</span>ref<span style="color: #339933;">&amp;</span>gt<span style="color: #339933;">;&lt;</span>br <span style="color: #339933;">/&gt;</span></pre></td></tr></table></div>

<p>
tag element must be before</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
</pre></td><td class="code"><pre class="java" style="font-family:monospace;"><span style="color: #339933;">&lt;</span>br <span style="color: #339933;">/&gt;</span>
<span style="color: #339933;">&amp;</span>lt<span style="color: #339933;">;</span>ejb<span style="color: #339933;">-</span>local<span style="color: #339933;">-</span>ref<span style="color: #339933;">&amp;</span>gt<span style="color: #339933;">;&lt;</span>br <span style="color: #339933;">/&gt;</span></pre></td></tr></table></div>

<p>
tag.</p>
]]></content:encoded>
			<wfw:commentRss>http://blogs.agilefaqs.com/2006/08/24/websphere-deployment-descriptor-load-exception/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Selenium Presentation at Agile 2006 conference</title>
		<link>http://blogs.agilefaqs.com/2006/08/01/selenium-presentation-at-agile-2006-conference/</link>
		<comments>http://blogs.agilefaqs.com/2006/08/01/selenium-presentation-at-agile-2006-conference/#comments</comments>
		<pubDate>Tue, 01 Aug 2006 09:56:36 +0000</pubDate>
		<dc:creator>Naresh Jain</dc:creator>
				<category><![CDATA[Java]]></category>

		<guid isPermaLink="false">http://blogs.agilefaqs.com/?p=27</guid>
		<description><![CDATA[Recently I co-presented with Alex Ruiz on Agile User Interface Development at the Agile 2006 conference. Alex presented on Abbot and I gave a demo on Selenium. The objective of my talk was to show: How to write acceptance tests for Web UIs? The focus was on driving UI development from a functional stand-point using [...]]]></description>
			<content:encoded><![CDATA[<p>Recently I co-presented with Alex Ruiz on <strong>Agile User Interface Development</strong> at the Agile 2006 conference. Alex presented on Abbot and I gave a demo on Selenium.</p>
<p>The objective of my talk was to show:</p>
<ol>
<li>How to write acceptance tests for Web UIs? The focus was on driving UI development from a functional stand-point using acceptance tests.</li>
<li>How to quickly build regression/functional tests for an application with existing <span class="caps">UI </span>[legacy code] using Selenium?</li>
<li>Last but not the least, to introduce Selenium</li>
</ol>
<p>For the demo, I used VQWiki as my test application. The wiki is a simple yet powerful application to demonstrate some of the core selenium and acceptance testing fundas. Coz of this, the Wiki turned out to be an interesting application for the demo. I had tests in Selenium core and Selenium remote control. This was sufficient to show the power of Selenium. Finally when I recorded a test scenario using Selenium <span class="caps">IDE</span>, the audience went gaga over Selenium.</p>
<p>I&#8216;m hoping to upload the tutorial soon. Till then you can have a look at the <a href="http://202.53.78.202/agile2005/downloads/Agile 2006 Selenium Presentation.pdf">presentation</a> here.</p>
]]></content:encoded>
			<wfw:commentRss>http://blogs.agilefaqs.com/2006/08/01/selenium-presentation-at-agile-2006-conference/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>Is Fitnesse ready for enterprise use?</title>
		<link>http://blogs.agilefaqs.com/2006/07/24/is-fitnesse-ready-for-enterprise-use/</link>
		<comments>http://blogs.agilefaqs.com/2006/07/24/is-fitnesse-ready-for-enterprise-use/#comments</comments>
		<pubDate>Mon, 24 Jul 2006 15:20:07 +0000</pubDate>
		<dc:creator>Naresh Jain</dc:creator>
				<category><![CDATA[Java]]></category>

		<guid isPermaLink="false">http://blogs.agilefaqs.com/?p=29</guid>
		<description><![CDATA[I think Fitnesse can be a very handy tool. I appreciate Object Mentor&#8216;s contributions. But there are certain features which are not supported by Fitnesse. These small things can be very painful on projects. I think a part of the reason is, lack of feedback from people using it. I hope this blog can be [...]]]></description>
			<content:encoded><![CDATA[<p>I think Fitnesse can be a very handy tool. I appreciate Object Mentor&#8216;s contributions. But there are certain features which are not supported by Fitnesse. These small things can be very painful on projects. I think a part of the reason is, lack of feedback from people using it. I hope this blog can be perceived as feedback.</p>
<p>An initial list of complains from people about Fitnesse:</p>
<ol>
<li>Lack of version control compatibility. This issue can be quite limiting if you are using a version control system which has pessimistic locking [makes all checked in files to read-only].</li>
<li>Crazy wiki syntax</li>
<li>Search sucks big time</li>
<li>Lack of support for integration with Ant and similar tools</li>
<li>Continuous Integration servers do not have a built in mechanism to display Fitnesse results. For Ex: CruiseControl does not have a style sheet to display Fitnesse results.</li>
<li>Fitnesse cannot execute tests inside an application/web server. By default Fitnesse spins of a new process called FitServer, which runs all the tests. In this setup it is not possible to debug your fixtures and application code.</li>
<li>Lack of standard out-of-box Fixtures which let you deal with databases. I know about JdbcFixtures. But it is crazy to expect people who write fit tests to know <span class="caps">SQL</span>. It is also crazy to mention all the DB connection properties on every single fit document [test].</li>
<li>Lack of patterns /anti-patterns around Fitnesse. Ex: Should we use statics to share data between fixtures? How to design Fixtures [to inherit or not to inherit]? Etc.</li>
</ol>
<p>Following is the list of work around we found:</p>
<ol>
<li>Version control compatibility: Fitnesse is pretty extensible. It lets you add plugins by adding new responders. So we added a plugin which lets one checkout files from ClearCase. Now users can click on the ckeckout menu item and easy checkout files from the fitnesse page. This can be easily extended to other version control systems. Please note that we have not added checkin facility. The rationale behind it is, we have FitnesseRoot under the project directory. So once the developer has done all the changes and are ready to checkin, they find checkouts at the project level and checkins all the files, including the content.txt and properties.xml file. This is great coz it lets developers do atomic checkins.<br />
Hopefully I can add support for different Version controls and contribute it back to Fitnesse or spawn another open source project.</li>
<li>There is not much we can do about the wiki syntax except reading the MarkupLanguageReference. There are lot of good tricks and tips.</li>
<li>Right now we are using Google Desktop to search our wiki pages. In future, I plan to write a plugin for FitNesse to make use of the Lucene Search Engine.</li>
<li>We are able to run all our fit tests thru add by using the following target.

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
</pre></td><td class="code"><pre class="java" style="font-family:monospace;"><span style="color: #339933;">&lt;</span>br <span style="color: #339933;">/&gt;</span>
<span style="color: #339933;">&amp;</span>lt<span style="color: #339933;">;</span>target name<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;fitNesseTest&quot;</span> description<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;Run FitNesse acceptance tests.&quot;</span> <span style="color: #000000; font-weight: bold;">if</span><span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;project.fitnesse.tests&quot;</span><span style="color: #339933;">&amp;</span>gt<span style="color: #339933;">;&lt;</span>br <span style="color: #339933;">/&gt;</span>
<span style="color: #339933;">&amp;</span>lt<span style="color: #339933;">;</span>echo<span style="color: #339933;">&amp;</span>gt<span style="color: #339933;">;</span>About to run fitnesse server<span style="color: #339933;">&amp;</span>lt<span style="color: #339933;">;/</span>echo<span style="color: #339933;">&amp;</span>gt<span style="color: #339933;">;&lt;</span>br <span style="color: #339933;">/&gt;</span>
<span style="color: #339933;">&amp;</span>lt<span style="color: #339933;">;</span>property name<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;fitnesse.port&quot;</span> value<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;8090&quot;</span> <span style="color: #339933;">/&amp;</span>gt<span style="color: #339933;">;&lt;</span>br <span style="color: #339933;">/&gt;</span>
<span style="color: #339933;">&amp;</span>lt<span style="color: #339933;">;</span>parallel<span style="color: #339933;">&amp;</span>gt<span style="color: #339933;">;&lt;</span>br <span style="color: #339933;">/&gt;</span>
<span style="color: #339933;">&amp;</span>lt<span style="color: #339933;">;</span>daemons<span style="color: #339933;">&amp;</span>gt<span style="color: #339933;">;&lt;</span>br <span style="color: #339933;">/&gt;</span>
<span style="color: #339933;">&amp;</span>lt<span style="color: #339933;">;</span>java classname<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;fitnesse.FitNesse&quot;</span> classpath<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;${fitnesse.root}/fitnesse.jar&quot;</span><span style="color: #339933;">&amp;</span>gt<span style="color: #339933;">;&lt;</span>br <span style="color: #339933;">/&gt;</span>
<span style="color: #339933;">&amp;</span>lt<span style="color: #339933;">;</span>arg value<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;-p&quot;</span> <span style="color: #339933;">/&amp;</span>gt<span style="color: #339933;">;&lt;</span>br <span style="color: #339933;">/&gt;</span>
<span style="color: #339933;">&amp;</span>lt<span style="color: #339933;">;</span>arg value<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;${fitnesse.port}&quot;</span> <span style="color: #339933;">/&amp;</span>gt<span style="color: #339933;">;&lt;</span>br <span style="color: #339933;">/&gt;</span>
<span style="color: #339933;">&amp;</span>lt<span style="color: #339933;">;</span>arg value<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;-e&quot;</span> <span style="color: #339933;">/&amp;</span>gt<span style="color: #339933;">;&lt;</span>br <span style="color: #339933;">/&gt;</span>
<span style="color: #339933;">&amp;</span>lt<span style="color: #339933;">;</span>arg value<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;0&quot;</span> <span style="color: #339933;">/&amp;</span>gt<span style="color: #339933;">;&lt;</span>br <span style="color: #339933;">/&gt;</span>
<span style="color: #339933;">&amp;</span>lt<span style="color: #339933;">;</span>arg value<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;-d&quot;</span> <span style="color: #339933;">/&amp;</span>gt<span style="color: #339933;">;&lt;</span>br <span style="color: #339933;">/&gt;</span>
<span style="color: #339933;">&amp;</span>lt<span style="color: #339933;">;</span>arg value<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;${fitnesse.root.location}&quot;</span> <span style="color: #339933;">/&amp;</span>gt<span style="color: #339933;">;&lt;</span>br <span style="color: #339933;">/&gt;</span>
<span style="color: #339933;">&amp;</span>lt<span style="color: #339933;">;/</span>java<span style="color: #339933;">&amp;</span>gt<span style="color: #339933;">;&lt;</span>br <span style="color: #339933;">/&gt;</span>
<span style="color: #339933;">&amp;</span>lt<span style="color: #339933;">;/</span>daemons<span style="color: #339933;">&amp;</span>gt<span style="color: #339933;">;&lt;</span>br <span style="color: #339933;">/&gt;</span>
<span style="color: #339933;">&amp;</span>lt<span style="color: #339933;">;</span>sequential<span style="color: #339933;">&amp;</span>gt<span style="color: #339933;">;&lt;</span>br <span style="color: #339933;">/&gt;</span>
<span style="color: #339933;">&amp;</span>lt<span style="color: #339933;">;</span>echo<span style="color: #339933;">&amp;</span>gt<span style="color: #339933;">;</span>sleeping <span style="color: #000000; font-weight: bold;">for</span> <span style="color: #cc66cc;">3</span> seconds to let FitNesse server start<span style="color: #339933;">&amp;</span>lt<span style="color: #339933;">;/</span>echo<span style="color: #339933;">&amp;</span>gt<span style="color: #339933;">;&lt;</span>br <span style="color: #339933;">/&gt;</span>
<span style="color: #339933;">&amp;</span>lt<span style="color: #339933;">;</span>sleep seconds<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;3&quot;</span> <span style="color: #339933;">/&amp;</span>gt<span style="color: #339933;">;&lt;</span>br <span style="color: #339933;">/&gt;</span>
<span style="color: #339933;">&amp;</span>lt<span style="color: #339933;">;</span>echo<span style="color: #339933;">&amp;</span>gt<span style="color: #339933;">;</span>running fit tests from $<span style="color: #009900;">&#123;</span>fitnesse.<span style="color: #006633;">location</span><span style="color: #009900;">&#125;</span><span style="color: #339933;">&amp;</span>lt<span style="color: #339933;">;/</span>echo<span style="color: #339933;">&amp;</span>gt<span style="color: #339933;">;&lt;</span>br <span style="color: #339933;">/&gt;</span>
<span style="color: #339933;">&amp;</span>lt<span style="color: #339933;">;</span>echo<span style="color: #339933;">&amp;</span>gt<span style="color: #339933;">;</span>Running fit tests at <span style="color: #0000ff;">&quot;${project.smoke.tests.suite.page}&quot;</span><span style="color: #339933;">&amp;</span>lt<span style="color: #339933;">;/</span>echo<span style="color: #339933;">&amp;</span>gt<span style="color: #339933;">;&lt;</span>br <span style="color: #339933;">/&gt;</span>
<span style="color: #339933;">&amp;</span>lt<span style="color: #339933;">;</span>java classname<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;fitnesse.runner.TestRunner&quot;</span> classpath<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;${fitnesse.root}/fitnesse.jar &quot;</span> fork<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;true&quot;</span> jvm<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;${java.home}/bin/java.exe&quot;</span> dir<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;${fitnesse.location}&quot;</span> resultproperty<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;fit.test.failures&quot;</span><span style="color: #339933;">&amp;</span>gt<span style="color: #339933;">;&lt;</span>br <span style="color: #339933;">/&gt;</span>
<span style="color: #339933;">&amp;</span>lt<span style="color: #339933;">;</span>classpath<span style="color: #339933;">&amp;</span>gt<span style="color: #339933;">;&lt;</span>br <span style="color: #339933;">/&gt;</span>
<span style="color: #339933;">&amp;</span>lt<span style="color: #339933;">;!--</span> you can add classpath here. <span style="color: #006633;">Not</span> required <span style="color: #000000; font-weight: bold;">if</span> you are using standard fitnesse<span style="color: #339933;">--&amp;</span>gt<span style="color: #339933;">;&lt;</span>br <span style="color: #339933;">/&gt;</span>
<span style="color: #339933;">&amp;</span>lt<span style="color: #339933;">;/</span>classpath<span style="color: #339933;">&amp;</span>gt<span style="color: #339933;">;&lt;</span>br <span style="color: #339933;">/&gt;</span>
<span style="color: #339933;">&amp;</span>lt<span style="color: #339933;">;</span>arg value<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;-debug&quot;</span><span style="color: #339933;">/&amp;</span>gt<span style="color: #339933;">;&lt;</span>br <span style="color: #339933;">/&gt;</span>
<span style="color: #339933;">&amp;</span>lt<span style="color: #339933;">;</span>arg value<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;-nopath&quot;</span><span style="color: #339933;">/&amp;</span>gt<span style="color: #339933;">;&lt;</span>br <span style="color: #339933;">/&gt;</span>
<span style="color: #339933;">&amp;</span>lt<span style="color: #339933;">;</span>arg value<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;-html&quot;</span> <span style="color: #339933;">/&amp;</span>gt<span style="color: #339933;">;&lt;</span>br <span style="color: #339933;">/&gt;</span>
<span style="color: #339933;">&amp;</span>lt<span style="color: #339933;">;</span>arg value<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;${fitnesse.output.html.file.location}&quot;</span> <span style="color: #339933;">/&amp;</span>gt<span style="color: #339933;">;&lt;</span>br <span style="color: #339933;">/&gt;</span>
<span style="color: #339933;">&amp;</span>lt<span style="color: #339933;">;!--</span> optional <span style="color: #339933;">--&amp;</span>gt<span style="color: #339933;">;&lt;</span>br <span style="color: #339933;">/&gt;</span>
<span style="color: #339933;">&amp;</span>lt<span style="color: #339933;">;</span>arg value<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;-xml&quot;</span> <span style="color: #339933;">/&amp;</span>gt<span style="color: #339933;">;&lt;</span>br <span style="color: #339933;">/&gt;</span>
<span style="color: #339933;">&amp;</span>lt<span style="color: #339933;">;</span>arg value<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;${fitnesse.output.xml.file.location}&quot;</span> <span style="color: #339933;">/&amp;</span>gt<span style="color: #339933;">;&lt;</span>br <span style="color: #339933;">/&gt;</span>
<span style="color: #339933;">&amp;</span>lt<span style="color: #339933;">;!--</span> end of optional <span style="color: #339933;">--&amp;</span>gt<span style="color: #339933;">;&lt;</span>br <span style="color: #339933;">/&gt;</span>
<span style="color: #339933;">&amp;</span>lt<span style="color: #339933;">;</span>arg value<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;${fitnesse.host.address}&quot;</span> <span style="color: #339933;">/&amp;</span>gt<span style="color: #339933;">;&amp;</span>lt<span style="color: #339933;">;!--</span> usually localhost <span style="color: #339933;">--&amp;</span>gt<span style="color: #339933;">;&lt;</span>br <span style="color: #339933;">/&gt;</span>
<span style="color: #339933;">&amp;</span>lt<span style="color: #339933;">;</span>arg value<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;${fitnesse.port}&quot;</span> <span style="color: #339933;">/&amp;</span>gt<span style="color: #339933;">;&lt;</span>br <span style="color: #339933;">/&gt;</span>
<span style="color: #339933;">&amp;</span>lt<span style="color: #339933;">;</span>arg value<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;${project.smoke.tests.suite.page}&quot;</span> <span style="color: #339933;">/&amp;</span>gt<span style="color: #339933;">;&amp;</span>lt<span style="color: #339933;">;!--</span> Ex<span style="color: #339933;">:</span> FronPage.<span style="color: #006633;">projectName</span> <span style="color: #339933;">--&amp;</span>gt<span style="color: #339933;">;&lt;</span>br <span style="color: #339933;">/&gt;</span>
<span style="color: #339933;">&amp;</span>lt<span style="color: #339933;">;/</span>java<span style="color: #339933;">&amp;</span>gt<span style="color: #339933;">;&lt;</span>br <span style="color: #339933;">/&gt;</span>
<span style="color: #339933;">&amp;</span>lt<span style="color: #339933;">;</span>echo<span style="color: #339933;">&amp;</span>gt<span style="color: #339933;">;</span>Finished FIT tests<span style="color: #339933;">:</span> $<span style="color: #009900;">&#123;</span>fit.<span style="color: #006633;">test</span>.<span style="color: #006633;">failures</span><span style="color: #009900;">&#125;</span> failures<span style="color: #339933;">/</span>exceptions<span style="color: #339933;">&amp;</span>lt<span style="color: #339933;">;/</span>echo<span style="color: #339933;">&amp;</span>gt<span style="color: #339933;">;&lt;</span>br <span style="color: #339933;">/&gt;</span>
<span style="color: #339933;">&amp;</span>lt<span style="color: #339933;">;</span>fail message<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;FIT test failures/exceptions: ${fit.test.failures}&quot;</span><span style="color: #339933;">&amp;</span>gt<span style="color: #339933;">;&lt;</span>br <span style="color: #339933;">/&gt;</span>
<span style="color: #339933;">&amp;</span>lt<span style="color: #339933;">;</span>condition<span style="color: #339933;">&amp;</span>gt<span style="color: #339933;">;&lt;</span>br <span style="color: #339933;">/&gt;</span>
<span style="color: #339933;">&amp;</span>lt<span style="color: #339933;">;</span>not<span style="color: #339933;">&amp;</span>gt<span style="color: #339933;">;&lt;</span>br <span style="color: #339933;">/&gt;</span>
<span style="color: #339933;">&amp;</span>lt<span style="color: #339933;">;</span>equals arg1<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;${fit.test.failures}&quot;</span> arg2<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;0&quot;</span> <span style="color: #339933;">/&amp;</span>gt<span style="color: #339933;">;&lt;</span>br <span style="color: #339933;">/&gt;</span>
<span style="color: #339933;">&amp;</span>lt<span style="color: #339933;">;/</span>not<span style="color: #339933;">&amp;</span>gt<span style="color: #339933;">;&lt;</span>br <span style="color: #339933;">/&gt;</span>
<span style="color: #339933;">&amp;</span>lt<span style="color: #339933;">;/</span>condition<span style="color: #339933;">&amp;</span>gt<span style="color: #339933;">;&lt;</span>br <span style="color: #339933;">/&gt;</span>
<span style="color: #339933;">&amp;</span>lt<span style="color: #339933;">;/</span>fail<span style="color: #339933;">&amp;</span>gt<span style="color: #339933;">;&lt;</span>br <span style="color: #339933;">/&gt;</span>
<span style="color: #339933;">&amp;</span>lt<span style="color: #339933;">;/</span>sequential<span style="color: #339933;">&amp;</span>gt<span style="color: #339933;">;&lt;</span>br <span style="color: #339933;">/&gt;</span>
<span style="color: #339933;">&amp;</span>lt<span style="color: #339933;">;/</span>parallel<span style="color: #339933;">&amp;</span>gt<span style="color: #339933;">;&lt;</span>br <span style="color: #339933;">/&gt;</span>
<span style="color: #339933;">&amp;</span>lt<span style="color: #339933;">;/</span>target<span style="color: #339933;">&amp;</span>gt<span style="color: #339933;">;&lt;</span>br <span style="color: #339933;">/&gt;</span></pre></td></tr></table></div>

<p>
It would be great to have build-in ant task which an do this.</li>
<li>There are some simple things you can do to integrate Fitnesse with Continuous integration server like CruiseControl. For more details: <a href="http://jroller.com/page/njain?entry=integrating_fitnesse_with_cruisecontrol">Integrating Fitnesse with CruiseControl</a></li>
<li>I have an open source project called Patang, which lets you run Fit and Fitnesse tests inside the application/web server. For more details: <a href="http://sourceforge.net/projects/patang">Patang on SourceForge</a> and <a href="http://www.jroller.com/page/njain?entry=running_fitnesse_inside_the_container">Running Fitnesse inside the container</a></li>
<li>We have developed a list of standard fixtures which help you insert data into the database tables, clean it up based on ids, etc. It uses properties file to read all the database connection parameters. It also hides any <span class="caps">SQL</span> from the user. I&#8216;ll shortly blog about these fixtures. May be it deserves another small open source project.</li>
<li>Am planning to expand the Patterns on the Fitnesse website.</li>
</ol>
<p>After reading this blog, you might get a feeling that I&#8216;m crazy about spawning new open source projects. That&#8216;s not true. There is a reason behind me making that decision.</p>
]]></content:encoded>
			<wfw:commentRss>http://blogs.agilefaqs.com/2006/07/24/is-fitnesse-ready-for-enterprise-use/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
	</channel>
</rss>

