<?xml version="1.0" encoding="UTF-8"?>
<!-- generator="wordpress/2.3.3" -->
<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/"
	>

<channel>
	<title>Java Blog - Java, J2EE, SOA, Spring and Hibernate</title>
	<link>http://javablog.info</link>
	<description></description>
	<pubDate>Thu, 17 Apr 2008 00:24:36 +0000</pubDate>
	<generator>http://wordpress.org/?v=2.3.3</generator>
	<language>en</language>
			<item>
		<title>URL Request Parameters using Javascript</title>
		<link>http://javablog.info/2008/04/17/url-request-parameters-using-javascript/</link>
		<comments>http://javablog.info/2008/04/17/url-request-parameters-using-javascript/#comments</comments>
		<pubDate>Thu, 17 Apr 2008 00:24:36 +0000</pubDate>
		<dc:creator>Ravi Nallakukkala</dc:creator>
		
		<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://javablog.info/2008/04/17/url-request-parameters-using-javascript/</guid>
		<description><![CDATA[function getRequestParameter( name ) {
name = name.replace(/[\[]/,&#8221;\\\[&#8221;).replace(/[\]]/,&#8221;\\\]&#8221;);
var regexS = &#8220;[\\?&#38;]&#8221;+name+&#8221;=([^&#38;#]*)&#8221;;
var regex = new RegExp( regexS );
var results = regex.exec( window.location.href );
if( results == null )
return &#8220;&#8221;;
else
return results[1];
}
Let&#8217;s say you have the following URL:
http://www.foo.com/index.html?customerCode=123&#38;consignment=321&#38;debug=true
You want to get the value of consignment parameter so you call the javascript function as follows:
var value = getRequestParameter( &#8216;consignment&#8217; );
]]></description>
			<content:encoded><![CDATA[<p>function getRequestParameter( name ) {<br />
name = name.replace(/[\[]/,&#8221;\\\[&#8221;).replace(/[\]]/,&#8221;\\\]&#8221;);<br />
var regexS = &#8220;[\\?&amp;]&#8221;+name+&#8221;=([^&amp;#]*)&#8221;;<br />
var regex = new RegExp( regexS );<br />
var results = regex.exec( window.location.href );<br />
if( results == null )<br />
return &#8220;&#8221;;<br />
else<br />
return results[1];<br />
}</p>
<p>Let&#8217;s say you have the following URL:<br />
http://www.foo.com/index.html?customerCode=123&amp;consignment=321&amp;debug=true</p>
<p>You want to get the value of consignment parameter so you call the javascript function as follows:<br />
var value = getRequestParameter( &#8216;consignment&#8217; );</p>
]]></content:encoded>
			<wfw:commentRss>http://javablog.info/2008/04/17/url-request-parameters-using-javascript/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Understanding JavaScript Prototypes</title>
		<link>http://javablog.info/2008/01/14/understanding-javascript-prototypes/</link>
		<comments>http://javablog.info/2008/01/14/understanding-javascript-prototypes/#comments</comments>
		<pubDate>Mon, 14 Jan 2008 17:43:17 +0000</pubDate>
		<dc:creator>Ravi Nallakukkala</dc:creator>
		
		<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://javablog.info/2008/01/14/understanding-javascript-prototypes/</guid>
		<description><![CDATA[I  never got the basics of Javascript Prototypes correct until i found this excellent article by Morris Johns
]]></description>
			<content:encoded><![CDATA[<p>I  never got the basics of Javascript Prototypes correct until i found this excellent <a href="http://blog.morrisjohns.com/illumination_on_javascript_prototypes">article</a> by <a href="http://blog.morrisjohns.com/">Morris Johns</a></p>
]]></content:encoded>
			<wfw:commentRss>http://javablog.info/2008/01/14/understanding-javascript-prototypes/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Exception handling framework using Spring AOP</title>
		<link>http://javablog.info/2007/11/29/exception-handling-framework-using-spring-aop/</link>
		<comments>http://javablog.info/2007/11/29/exception-handling-framework-using-spring-aop/#comments</comments>
		<pubDate>Thu, 29 Nov 2007 07:39:44 +0000</pubDate>
		<dc:creator>Ravi Nallakukkala</dc:creator>
		
		<category><![CDATA[Design]]></category>

		<guid isPermaLink="false">http://javablog.info/2007/04/11/exception-handling-framework-using-spring-aop/</guid>
		<description><![CDATA[In this article I will look at the various features which are required for a good exception handling framework and how Aspect oriented programming (AOP) will be used in the design of an Exception handling framework.
Lets Look at the key feature of an Exception handling framework

Propagating business and technical exceptions from the server side to [...]]]></description>
			<content:encoded><![CDATA[<p>In this article I will look at the various features which are required for a good exception handling framework and how Aspect oriented programming (AOP) will be used in the design of an Exception handling framework.</p>
<p>Lets Look at the key feature of an Exception handling framework</p>
<ul>
<li>Propagating business and technical exceptions from the server side to the client side modules in a consistent manner.</li>
<li>Returning error codes into human readable error messages.</li>
<li>Handling checked and unchecked exceptions in a unified way.</li>
<li>Throwing checked and unchecked exceptions and creating new instances initialized with an error code picked from a predefined set.</li>
<li>Implementing new exception classes in a predefined inheritance hierarchy.</li>
</ul>
<p>Learn more about exceptions <a href="http://java.sun.com/docs/books/tutorial/essential/exceptions/" target="_blank">here</a> and find out the difference between Checked and unchecked exceptions <a href="http://www.javapractices.com/Topic129.cjp" target="_blank">here</a>.</p>
<p>By large, Exceptions are classified in two categories</p>
<p> <a href="http://javablog.info/2007/11/29/exception-handling-framework-using-spring-aop/#more-29" class="more-link">(more&#8230;)</a></p>
]]></content:encoded>
			<wfw:commentRss>http://javablog.info/2007/11/29/exception-handling-framework-using-spring-aop/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Converting an Array to a Collection</title>
		<link>http://javablog.info/2007/11/29/converting-an-array-to-a-collection/</link>
		<comments>http://javablog.info/2007/11/29/converting-an-array-to-a-collection/#comments</comments>
		<pubDate>Thu, 29 Nov 2007 06:35:42 +0000</pubDate>
		<dc:creator>Ravi Nallakukkala</dc:creator>
		
		<category><![CDATA[Java/ J2EE]]></category>

		<guid isPermaLink="false">http://javablog.info/2007/11/29/converting-an-array-to-a-collection/</guid>
		<description><![CDATA[Sometimes the common problems seems to be we don&#8217;t remember the API, one such scenario I recently faced was how to convert a Array to a collection? Following seems to decent ways  
// Fixed-size list
List list = Arrays.asList(array);
// Growable list
list = new LinkedList(Arrays.asList(array));
// Duplicate elements are discarded
Set set = new HashSet(Arrays.asList(array));
]]></description>
			<content:encoded><![CDATA[<p>Sometimes the common problems seems to be we don&#8217;t remember the API, one such scenario I recently faced was how to convert a Array to a collection? Following seems to decent ways <img src='http://www.javablog.info/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' /> </p>
<p>// Fixed-size list<br />
List list = Arrays.asList(<font color="#0066ff"><em>array</em></font>);</p>
<p>// Growable list<br />
list = new LinkedList(Arrays.asList(<font color="#0066ff"><em>array</em></font>));</p>
<p>// Duplicate elements are discarded<br />
Set set = new HashSet(Arrays.asList(<font color="#0066ff"><em>array</em></font>));</p>
]]></content:encoded>
			<wfw:commentRss>http://javablog.info/2007/11/29/converting-an-array-to-a-collection/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Spring Based JUnit Integration Test approach</title>
		<link>http://javablog.info/2007/11/29/spring-based-junit-integration-tests/</link>
		<comments>http://javablog.info/2007/11/29/spring-based-junit-integration-tests/#comments</comments>
		<pubDate>Thu, 29 Nov 2007 04:13:58 +0000</pubDate>
		<dc:creator>Ravi Nallakukkala</dc:creator>
		
		<category><![CDATA[Design]]></category>

		<category><![CDATA[Spring]]></category>

		<guid isPermaLink="false">http://javablog.info/2007/04/09/spring-based-junit-integration-tests/</guid>
		<description><![CDATA[The Spring Framework provides a good support for the integration tests for enterprise software applications and these support classes are packaged in spring-mock.jar and all these classes are JUnit test classes. org.springframework.test package provides valuable JUnit TestCase superclasses for integration testing using a Spring container and this approach is completely independent of any web/ application [...]]]></description>
			<content:encoded><![CDATA[<p>The Spring Framework provides a good support for the integration tests for enterprise software applications and these support classes are packaged in spring-mock.jar and all these classes are JUnit test classes. org.springframework.test package provides valuable JUnit TestCase superclasses for integration testing using a Spring container and this approach is completely independent of any web/ application server.</p>
<p>Spring out-of-box provide the following functionality:</p>
<ul>
<li>Transaction management though spring container.</li>
<li>Dependency Injection feature.</li>
<li>Spring Ioc Container caching between execution.</li>
</ul>
<p>On Surface, Spring Test cases can be classified into</p>
<ul>
<li>JUnit with Dependency Injection.</li>
<li>Junit with Dependency Injection and Transactional Control.</li>
</ul>
<p><strong>Spring based JUnit with Dependency Injection</strong></p>
<p>For JUnit Classes which need to use Dependency injection feature of spring will be required to inherit the class â€˜AbstractDependencyInjectionSpringContextTestsâ€˜ and the subclass need to implement the superclassâ€™s abstract method â€˜protected abstract String[] getConfigLocations();â€™ the implementation of this method need to return the spring configuration XML files which are required to participate in the execution of the test case.<br />
E.g,<br />
public final class ExampleDaoTests extends <strong>AbstractDependencyInjectionSpringContextTests</strong>  {</p>
<p>// this reference will be automatically injected through spring<br />
private ExampleDao exampleDao;</p>
<p>// a setter method to enable DI for the Dao instance variable<br />
public void setExampleDao(ExampleDao exampleDao) {<br />
this.exampleDao = exampleDao;<br />
}</p>
<p>public void testExample() throws Exception {<br />
BusinessObject bo = this.exampleDao.loadBo(new Long(10));<br />
assertNotNull(title);<br />
}</p>
<p>// specifies the Spring configuration to load for this test.<br />
protected String[] getConfigLocations() {<br />
return new String[] { â€œclasspath:com/foo/daos.xmlâ€ };<br />
}<br />
}</p>
<p><strong>&lt;&lt; Spring Configuration file &gt;&gt;</strong></p>
<p>&lt;?xml version=â€1.0? encoding=â€UTF-8??&gt;<br />
&lt;!DOCTYPE beans PUBLIC  â€œ-//SPRING//DTD BEAN 2.0//ENâ€<br />
â€œhttp://www.springframework.org/dtd/http://www.springframework.org/dtd/spring-beans-2.0.dtdâ€&gt;<br />
&lt;beans&gt;</p>
<p>&lt;!â€“ this bean will be injected into the ExampleDaoTests class â€“&gt;<br />
&lt;bean id=â€exampleDaoâ€ class=â€com.foo.dao.hibernate.ExampleDaoâ€&gt;<br />
&lt;property name=â€sessionFactoryâ€ ref=â€sessionFactoryâ€/&gt;<br />
&lt;/bean&gt;</p>
<p>&lt;bean id=â€sessionFactoryâ€ class=â€org.springframework.orm.hibernate3.LocalSessionFactoryBeanâ€&gt;<br />
&lt;!â€“ dependencies elided for clarity â€“&gt;<br />
&lt;/bean&gt;<br />
&lt;/beans&gt;</p>
<p><strong>Spring based JUnit with Transaction Control/ Integration Test</strong></p>
<p>One common problem in integration test is to access a database and still maintain the state of the persistence store. When using a database, changes to the database state may effect the future tests and CURD operations canâ€™t be verified outside a transaction.</p>
<p>The org.springframework.test.AbstractTransactionalSpringContextTests superclass (and subclasses) exist to meet this requirement. By default, this class create and rollback a transaction for each test. From a developer/ development point of view, You simply write code that assumes the existence of a transaction.</p>
<p>It has to be noted that, this class extends AbstractDependencyInjectionSpringContextTests so spring dependency injection is made available for all the subclasses extending AbstractTransactionalSpringContextTests</p>
<p>Spring based JUnit also provides an option to commit a transaction (unusual, but occasionally useful when you want a particular test to populate the database) - you can invoke the setComplete() method inherited from AbstractTransactionalSpringContextTests. This will force the transaction to commit instead of roll back.</p>
<p>There is also convenient ability to end a transaction before the test case ends, through calling the endTransaction() method. This will roll back the transaction by default, and commit it only if setComplete() had previously been called. This functionality is useful if you want to test the behavior of â€˜disconnectedâ€™ data objects, such as Hibernate-mapped objects that will be used in a web or remoting tier outside a transaction. Often, lazy loading errors are discovered only through UI testing; if you call endTransaction() you can ensure correct operation of the UI through your JUnit test suite.<br />
E.g,</p>
<p>//as this test class extends â€˜AbstractTransactionalSpringContextTestsâ€™ so all the<br />
//test methods will be bound with a transaction.<br />
public final class ExampleDaoTests extends <strong>AbstractTransactionalSpringContextTests </strong> {</p>
<p>// this reference will be automatically injected through spring<br />
private ExampleDao exampleDao;</p>
<p>// a setter method to enable DI for the Dao instance variable<br />
public void setExampleDao(ExampleDao exampleDao) {<br />
this.exampleDao = exampleDao;<br />
}</p>
<p>public void testExample() throws Exception {<br />
BusinessObject bo = createBo(); // create the Business Objects<br />
exampleDao.create(bo); // Business Object will be created</p>
<p>//now retrieve the object which was created in the database.<br />
BusinessObject returnedObject = exampleDao.findById(bo.getId());<br />
assertEquals(bo.getId(), returnedObject.getId());<br />
//after the execution of the test method, data which was inse<br />
}</p>
<p>// specifies the Spring configuration to load for this test.<br />
protected String[] getConfigLocations() {<br />
return new String[] { â€œclasspath:com/foo/daos.xmlâ€ };<br />
}<br />
}</p>
<p><strong>&lt;&lt; Spring Configuration file &gt;&gt;</strong></p>
<p>&lt;?xml version=â€1.0? encoding=â€UTF-8??&gt;<br />
&lt;!DOCTYPE beans PUBLIC  â€œ-//SPRING//DTD BEAN 2.0//ENâ€<br />
â€œhttp://www.springframework.org/dtd/http://www.springframework.org/dtd/spring-beans-2.0.dtdâ€&gt;<br />
&lt;beans&gt;</p>
<p>&lt;!â€“ this bean will be injected into the ExampleDaoTests class â€“&gt;<br />
&lt;bean id=â€exampleDaoâ€ class=â€com.foo.dao.hibernate.ExampleDaoâ€&gt;<br />
&lt;property name=â€sessionFactoryâ€ ref=â€sessionFactoryâ€/&gt;<br />
&lt;/bean&gt;</p>
<p>&lt;bean id=â€sessionFactoryâ€ class=â€org.springframework.orm.hibernate3.LocalSessionFactoryBeanâ€&gt;<br />
&lt;!â€“ dependencies elided for clarity â€“&gt;<br />
&lt;/bean&gt;</p>
<p>&lt;/beans&gt;</p>
]]></content:encoded>
			<wfw:commentRss>http://javablog.info/2007/11/29/spring-based-junit-integration-tests/feed/</wfw:commentRss>
		</item>
		<item>
		<title>JBoss Seam EnitityQuery and Restrictions</title>
		<link>http://javablog.info/2007/11/21/jboss-seam-enitityquery-and-restrictions/</link>
		<comments>http://javablog.info/2007/11/21/jboss-seam-enitityquery-and-restrictions/#comments</comments>
		<pubDate>Wed, 21 Nov 2007 21:47:36 +0000</pubDate>
		<dc:creator>Ravi Nallakukkala</dc:creator>
		
		<category><![CDATA[Hibernate]]></category>

		<guid isPermaLink="false">http://javablog.info/2007/11/21/jboss-seam-enitityquery-and-restrictions/</guid>
		<description><![CDATA[http://www.jboss.com/index.html?module=bb&#38;op=viewtopic&#38;t=120649
Additional info on restrictions usage:
1) Seam forces one EL expression per restriction.
2) can combine a EL expression and constants in one restriciton
Example:
&#8220;name like concat(lower(#{customer.name}),&#8217;%') or description like &#8216;ILI%&#8217;)&#8221;
3) Multiple restrictions are treated as &#8220;and&#8221; operation.
]]></description>
			<content:encoded><![CDATA[<p>http://www.jboss.com/index.html?module=bb&amp;op=viewtopic&amp;t=120649</p>
<p>Additional info on restrictions usage:</p>
<p>1) Seam forces one EL expression per restriction.<br />
2) can combine a EL expression and constants in one restriciton<br />
Example:<br />
&#8220;name like concat(lower(#{customer.name}),&#8217;%') or description like &#8216;ILI%&#8217;)&#8221;<br />
3) Multiple restrictions are treated as &#8220;and&#8221; operation.</p>
]]></content:encoded>
			<wfw:commentRss>http://javablog.info/2007/11/21/jboss-seam-enitityquery-and-restrictions/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Displaying Classpath in ANT</title>
		<link>http://javablog.info/2007/10/17/displaying-classpath-in-ant/</link>
		<comments>http://javablog.info/2007/10/17/displaying-classpath-in-ant/#comments</comments>
		<pubDate>Wed, 17 Oct 2007 04:14:57 +0000</pubDate>
		<dc:creator>Ravi Nallakukkala</dc:creator>
		
		<category><![CDATA[Build]]></category>

		<guid isPermaLink="false">http://javablog.info/2007/10/17/displaying-classpath-in-ant/</guid>
		<description><![CDATA[Here&#8217;s a sample code by which one can display the classpath
&#60;path id=&#8221;test.classpath&#8220;&#62;
   &#60;path path=&#8221;${test.dir}&#8221;/&#62;
   &#60;fileset dir=&#8221;${config.dir}/lib&#8221;&#62;
    &#60;include name=&#8221;*-all.jar&#8221; /&#62;
   &#60;/fileset&#62;
  &#60;/path&#62;
  &#60;property name=&#8221;current.test.classpath&#8221; refid=&#8221;test.classpath&#8220;/&#62;
  
                &#60;echo level=&#8221;info&#8221;&#62; message=&#8221;test.classpath=${current.test.classpath}&#8221; &#60;/echo&#62;
]]></description>
			<content:encoded><![CDATA[<p>Here&#8217;s a sample code by which one can display the classpath</p>
<p>&lt;path id=&#8221;<strong>test.classpath</strong>&#8220;&gt;<br />
   &lt;path path=&#8221;${test.dir}&#8221;/&gt;<br />
   &lt;fileset dir=&#8221;${config.dir}/lib&#8221;&gt;<br />
    &lt;include name=&#8221;*-all.jar&#8221; /&gt;<br />
   &lt;/fileset&gt;<br />
  &lt;/path&gt;<br />
  &lt;property name=&#8221;<strong>current.test.classpath</strong>&#8221; refid=&#8221;<strong>test.classpath</strong>&#8220;/&gt;<br />
  <br />
                &lt;echo level=&#8221;info&#8221;&gt; message=&#8221;test.classpath=${<strong>current.test.classpath</strong>}&#8221; &lt;/echo&gt;</p>
]]></content:encoded>
			<wfw:commentRss>http://javablog.info/2007/10/17/displaying-classpath-in-ant/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Oracle/PLSQL: Sequences (Autonumber)</title>
		<link>http://javablog.info/2007/08/01/oracleplsql-sequences-autonumber/</link>
		<comments>http://javablog.info/2007/08/01/oracleplsql-sequences-autonumber/#comments</comments>
		<pubDate>Wed, 01 Aug 2007 21:01:06 +0000</pubDate>
		<dc:creator>Ravi Nallakukkala</dc:creator>
		
		<category><![CDATA[Database]]></category>

		<guid isPermaLink="false">http://javablog.info/2007/08/01/oracleplsql-sequences-autonumber/</guid>
		<description><![CDATA[In Oracle, you can create an autonumber field by using sequences. A sequence is an object in Oracle that is used to generate a number sequence. This can be useful when you need to create a unique number to act as a primary key.
The syntax for a sequence is:
CREATE SEQUENCE sequence_name
MINVALUE  value
MAXVALUE value
START WITH value
INCREMENT [...]]]></description>
			<content:encoded><![CDATA[<p>In Oracle, you can create an autonumber field by using sequences. A sequence is an object in Oracle that is used to generate a number sequence. This can be useful when you need to create a unique number to act as a primary key.</p>
<p>The syntax for a sequence is:</p>
<p>CREATE SEQUENCE sequence_name<br />
MINVALUE  value<br />
MAXVALUE value<br />
START WITH value<br />
INCREMENT BY value<br />
CACHE value;</p>
<p>For example:<br />
CREATE SEQUENCE supplier_seq<br />
MINVALUE 1<br />
MAXVALUE 999999999999999999999999999<br />
START WITH 1<br />
INCREMENT BY 1<br />
CACHE 20;</p>
<p>Now that you&#8217;ve created a sequence object to simulate an autonumber field, we&#8217;ll cover how to retrieve a value from this sequence object.</p>
<p>To retrieve the next value in the sequence order, you need to use nextval.<br />
For example:supplier_seq.nextval</p>
]]></content:encoded>
			<wfw:commentRss>http://javablog.info/2007/08/01/oracleplsql-sequences-autonumber/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Limit &#038; offset functionality in mySql, PostgreSQL</title>
		<link>http://javablog.info/2007/07/05/limit-offset-functionality-in-mysql-postgresql/</link>
		<comments>http://javablog.info/2007/07/05/limit-offset-functionality-in-mysql-postgresql/#comments</comments>
		<pubDate>Thu, 05 Jul 2007 21:04:41 +0000</pubDate>
		<dc:creator>Ravi Nallakukkala</dc:creator>
		
		<category><![CDATA[Database]]></category>

		<guid isPermaLink="false">http://javablog.info/2007/07/05/limit-offset-functionality-in-mysql-postgresql/</guid>
		<description><![CDATA[One of the excellent features provided by both my mySql &#38; Postgre is support for Limit and offset functionality.
Usage syntax
SELECT &#60;select_list&#62;
    FROM &#60;table_expression&#62;
    [LIMIT { number &#124; ALL }] [OFFSET number]
This is a useful feature when implementing pagination!
unfortunately this functionality is not currently being supported by Oracle!
]]></description>
			<content:encoded><![CDATA[<p>One of the excellent features provided by both my mySql &amp; Postgre is support for Limit and offset functionality.</p>
<p>Usage syntax</p>
<pre class="SYNOPSIS">SELECT &lt;<var class="REPLACEABLE">select_list&gt;</var>
    FROM &lt;<var class="REPLACEABLE">table_expression&gt;</var>
    [<span class="OPTIONAL">LIMIT { <var class="REPLACEABLE">number</var> | ALL }</span>] [<span class="OPTIONAL">OFFSET <var class="REPLACEABLE">number</var></span>]</pre>
<p>This is a useful feature when implementing pagination!<br />
unfortunately this functionality is not currently being supported by Oracle!</p>
]]></content:encoded>
			<wfw:commentRss>http://javablog.info/2007/07/05/limit-offset-functionality-in-mysql-postgresql/feed/</wfw:commentRss>
		</item>
		<item>
		<title>String IndexOf Case in-sensitive search - PHP</title>
		<link>http://javablog.info/2007/06/04/string-indexof-case-in-sensitive-search-php/</link>
		<comments>http://javablog.info/2007/06/04/string-indexof-case-in-sensitive-search-php/#comments</comments>
		<pubDate>Mon, 04 Jun 2007 22:02:29 +0000</pubDate>
		<dc:creator>Ravi Nallakukkala</dc:creator>
		
		<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://javablog.info/2007/06/04/string-indexof-case-in-sensitive-search-php/</guid>
		<description><![CDATA[PHP supports a function &#8220;strpos&#8221; which return the position index of the element found or a false if the element is not found.
Usage
$content = &#8216; Search for a string here&#8230;&#8217;;
$find = &#8217;search&#8217;;//lower case s
$pos =strpos($content, $pos);
now $pos will hold a value false;
For case in-sensitive searches, PHP version &#62;5 supports a function &#8220;stripos&#8221; which return the [...]]]></description>
			<content:encoded><![CDATA[<p>PHP supports a function &#8220;strpos&#8221; which return the position index of the element found or a false if the element is not found.</p>
<p><strong>Usage</strong></p>
<p>$content = &#8216; Search for a string here&#8230;&#8217;;<br />
$find = &#8217;search&#8217;;//lower case s<br />
$pos =strpos($content, $pos);<br />
now $pos will hold a value false;</p>
<p>For case in-sensitive searches, PHP version &gt;5 supports a function &#8220;stripos&#8221; which return the position index of the element found or a false if the element is not found; Lower versions of the PHP can use the following code to achieve the same functionality</p>
<p>if (!function_exists(&#8221;stripos&#8221;)) {<br />
function stripos($str,$needle) {<br />
return strpos(strtolower($str),strtolower($needle));<br />
}<br />
}</p>
]]></content:encoded>
			<wfw:commentRss>http://javablog.info/2007/06/04/string-indexof-case-in-sensitive-search-php/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Javascript Child Window invoking a parent window</title>
		<link>http://javablog.info/2007/05/18/javascript-child-window-invoking-parent-window/</link>
		<comments>http://javablog.info/2007/05/18/javascript-child-window-invoking-parent-window/#comments</comments>
		<pubDate>Fri, 18 May 2007 22:15:00 +0000</pubDate>
		<dc:creator>Ravi Nallakukkala</dc:creator>
		
		<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://javablog.info/2007/05/18/javascript-child-window-invoking-parent-window/</guid>
		<description><![CDATA[Here&#8217;s on the most simplest example of demonstrating Child window to parent window communication using javascript.
The trick is  in using the javascript function &#8220;parent.opener.&#60;js method name to invoke in parent&#62;&#8221;
Parent window HTML code 
&#60;html&#62;
&#60;body&#62;
&#60;script&#62;
function clickme() {
winopen(&#8217;DeleteUserConfirmation.html&#8217;,'popup575&#215;505&#8242;,
&#8216;WIDTH=575,HEIGHT=500,RESIZABLE=No,SCROLLBARS=YES,
TOOLBAR=NO,LEFT=200,TOP=100&#8242;);
}
function winopen(url,stuff,morestuff)
{
var popwin = window.open(url,stuff,morestuff);
if( typeof(popwin) != &#8220;undefined&#8221; &#38;&#38; popwin ) {
popwin.focus();
}
}
function forward(){
alert(&#8217;function in parent window&#8217;);
}
&#60;/script&#62;
&#60;a href=&#8221;javascript:clickme()&#8221;&#62; Click for [...]]]></description>
			<content:encoded><![CDATA[<p>Here&#8217;s on the most simplest example of demonstrating Child window to parent window communication using javascript.</p>
<p>The trick is  in using the javascript function &#8220;parent.opener.&lt;js method name to invoke in parent&gt;&#8221;</p>
<p><strong>Parent window </strong><strong>HTML </strong><strong>code </strong></p>
<p>&lt;html&gt;<br />
&lt;body&gt;<br />
&lt;script&gt;<br />
function clickme() {<br />
winopen(&#8217;DeleteUserConfirmation.html&#8217;,'popup575&#215;505&#8242;,<br />
&#8216;WIDTH=575,HEIGHT=500,RESIZABLE=No,SCROLLBARS=YES,<br />
TOOLBAR=NO,LEFT=200,TOP=100&#8242;);<br />
}<br />
function winopen(url,stuff,morestuff)<br />
{<br />
var popwin = window.open(url,stuff,morestuff);<br />
if( typeof(popwin) != &#8220;undefined&#8221; &amp;&amp; popwin ) {<br />
popwin.focus();<br />
}<br />
}<br />
function forward(){<br />
alert(&#8217;function in parent window&#8217;);<br />
}<br />
&lt;/script&gt;<br />
&lt;a href=&#8221;javascript:clickme()&#8221;&gt; Click for Popup Window&lt;/a&gt;<br />
&lt;/body&gt;<br />
&lt;/html&gt;</p>
<p><strong>Child window HTML code</strong></p>
<p>&lt;!DOCTYPE HTML PUBLIC &#8220;-//W3C//DTD HTML 4.0 Transitional//EN&#8221;&gt;</p>
<p>&lt;html &gt;<br />
&lt;head&gt;<br />
&lt;title&gt;Second Window&lt;/title&gt;<br />
&lt;/head&gt;<br />
&lt;table cellpadding=&#8221;0&#8243; cellspacing=&#8221;0&#8243; border=&#8221;0&#8243; width=&#8221;100%&#8221; &gt;<br />
&lt;tr&gt;<br />
&lt;td align=&#8221;center&#8221;&gt;<br />
&lt;p&gt; &lt;/p&gt;<br />
&lt;p&gt;&lt;B&gt;What&#8217;s your choice?&lt;/B&gt;&lt;/p&gt;<br />
&lt;p&gt;&lt;a href=&#8221;javascript:parent.opener.forward();window.close();&#8221;&gt;&lt;b&gt;Call Parent Window&lt;/b&gt;&lt;/a&gt; &lt;a href=&#8221;javascript:window.close()&#8221;&gt;Close me&lt;/a&gt;&lt;/p&gt;<br />
&lt;/td&gt;<br />
&lt;/tr&gt;<br />
&lt;/table&gt;<br />
&lt;/body&gt;<br />
&lt;/HTML&gt;</p>
]]></content:encoded>
			<wfw:commentRss>http://javablog.info/2007/05/18/javascript-child-window-invoking-parent-window/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Hiding dropdown using Javascript</title>
		<link>http://javablog.info/2007/05/14/hiding-dropdown-using-javascript/</link>
		<comments>http://javablog.info/2007/05/14/hiding-dropdown-using-javascript/#comments</comments>
		<pubDate>Mon, 14 May 2007 18:30:03 +0000</pubDate>
		<dc:creator>Ravi Nallakukkala</dc:creator>
		
		<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://javablog.info/2007/05/14/hiding-dropdown-using-javascript/</guid>
		<description><![CDATA[I started working on a task  where we need to display drop down based on the text selected in another drop down. The contents of the second drop down are retrieved though an AJAX call.
Here&#8217;s and example which does displays a drop down with three values Admin, Student and Teacher. on selection of a [...]]]></description>
			<content:encoded><![CDATA[<p>I started working on a task  where we need to display drop down based on the text selected in another drop down. The contents of the second drop down are retrieved though an AJAX call.</p>
<p>Here&#8217;s and example which does displays a drop down with three values Admin, Student and Teacher. on selection of a teacher, a grades drop down will be displayed.<br />
&lt;html&gt;<br />
&lt;body&gt;</p>
<p>&lt;script TYPE=&#8221;text/javascript&#8221;&gt;<br />
function handleGrades(obj) {<br />
if(obj.value== 2){<br />
buildGradesDropDown();<br />
document.getElementById(&#8221;GradesDropDown&#8221;).style.visibility = &#8220;visible&#8221;;<br />
} else{<br />
document.getElementById(&#8221;GradesDropDown&#8221;).style.visibility = &#8220;hidden&#8221;;<br />
}<br />
}</p>
<p>function buildGradesDropDown() {<br />
var dropdown = &#8216;Grade : &lt;select name=&#8221;selGradeId&#8221; id=&#8221;selGradeId&#8221; &gt;&#8217;;<br />
//Ajax call should be here, to retrieve the data for the dropdown<br />
dropdown += getOption(&#8217;first&#8217;,1);<br />
dropdown += getOption(&#8217;second&#8217;,2);<br />
dropdown += getOption(&#8217;third&#8217;,3);<br />
dropdown += &#8216;&lt;/select&gt;&#8217;;<br />
document.getElementById(&#8221;GradesDropDown&#8221;).innerHTML = dropdown;<br />
//alert(document.getElementById(&#8221;GradesDropDown&#8221;).innerHTML);<br />
}</p>
<p>function getOption(value,display) {<br />
return &#8216;&lt;Option value=&#8217;+value+&#8217;&gt;&#8217;+display +&#8217;&lt;/option&gt;&#8217;;<br />
}<br />
&lt;/script&gt;</p>
<p>&lt;form &gt;<br />
Select Role<br />
&lt;select name=&#8221;selSchoolId&#8221; id=&#8221;day&#8221; onchange=&#8221;handleGrades(this);&#8221;&gt;<br />
&lt;option value=&#8221;1&#8243;&gt;Admin&lt;/option&gt;<br />
&lt;option value=&#8221;2&#8243;&gt;Student&lt;/option&gt;<br />
&lt;option value=&#8221;3&#8243;&gt;Teacher&lt;/option&gt;<br />
&lt;/select&gt;</p>
<p>&lt;div id=&#8221;GradesDropDown&#8221; style=&#8221;visibility:hidden&#8221;&gt;</p>
<p>&lt;/div&gt;<br />
&lt;/form&gt;<br />
&lt;/body&gt;<br />
&lt;/html&gt;</p>
]]></content:encoded>
			<wfw:commentRss>http://javablog.info/2007/05/14/hiding-dropdown-using-javascript/feed/</wfw:commentRss>
		</item>
		<item>
		<title>java.lang.NoSuchMethodError: weblogic.servlet.jsp.StandardTagLib.fakeEmptyBodyTag( Ljavax/servlet/jsp/PageContext; Ljavax/servlet/jsp/tagext/BodyTag;IZ</title>
		<link>http://javablog.info/2007/04/18/javalangnosuchmethoderror-weblogicservletjspstandardtaglibfakeemptybodytag-ljavaxservletjsppagecontext-ljavaxservletjsptagextbodytagiz/</link>
		<comments>http://javablog.info/2007/04/18/javalangnosuchmethoderror-weblogicservletjspstandardtaglibfakeemptybodytag-ljavaxservletjsppagecontext-ljavaxservletjsptagextbodytagiz/#comments</comments>
		<pubDate>Wed, 18 Apr 2007 23:15:08 +0000</pubDate>
		<dc:creator>Ravi Nallakukkala</dc:creator>
		
		<category><![CDATA[Java/ J2EE]]></category>

		<category><![CDATA[Servers]]></category>

		<guid isPermaLink="false">http://javablog.info/2007/04/18/javalangnosuchmethoderror-weblogicservletjspstandardtaglibfakeemptybodytag-ljavaxservletjsppagecontext-ljavaxservletjsptagextbodytagiz/</guid>
		<description><![CDATA[I was trying to deploy my Ear containing a war file in Weblogic 8.1, got the following exception
java.lang.NoSuchMethodError: weblogic.servlet.jsp.StandardTagLib.fakeEmptyBodyTag(Ljavax/servlet/jsp/PageContext;Ljavax/servlet/jsp/tagext/BodyTag;IZ)V
	at jsp_servlet._login.__login._jspService(__login.java:1016)
	at weblogic.servlet.jsp.JspBase.service(JspBase.java:33)
	at weblogic.servlet.internal.ServletStubImpl$ServletInvocationAction.run(ServletStubImpl.java:1053)
	at weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubImpl.java:387)
	at weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubImpl.java:431)
	at weblogic.servlet.internal.TailFilter.doFilter(TailFilter.java:28)
	at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:27)
	at com.pearson.ph.phcore.presentation.servlets.CheckLoginFilter.doFilter(CheckLoginFilter.java:76)
	at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:27)
	at com.pearson.ph.phcore.presentation.servlets.CheckLoginFilter.doFilter(CheckLoginFilter.java:76)
	at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:27)
	at com.pearson.ph.itext.presentation.servlets.SessionFilter.doFilter(SessionFilter.java:87)
	at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:27)
	at weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.run(WebAppServletContext.java:6297)
	at weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubject.java:317)
	at weblogic.security.service.SecurityManager.runAs(SecurityManager.java:97)
	at weblogic.servlet.internal.WebAppServletContext.invokeServlet(WebAppServletContext.java:3575)
	at weblogic.servlet.internal.ServletRequestImpl.execute(ServletRequestImpl.java:2573)
	at weblogic.kernel.ExecuteThread.execute(ExecuteThread.java:178)
	at weblogic.kernel.ExecuteThread.run(ExecuteThread.java:151)

Solution
Seems this is an issue with Weblogic server 8.1, when upgraded to Weblogic 8.1 sp4 the problem [...]]]></description>
			<content:encoded><![CDATA[<p>I was trying to deploy my Ear containing a war file in Weblogic 8.1, got the following exception</p>
<pre><font>java.lang.NoSuchMethodError: weblogic.servlet.jsp.StandardTagLib.fakeEmptyBodyTag(Ljavax/servlet/jsp/PageContext;Ljavax/servlet/jsp/tagext/BodyTag;IZ)V
	at jsp_servlet._login.__login._jspService(__login.java:1016)
	at weblogic.servlet.jsp.JspBase.service(JspBase.java:33)
	at weblogic.servlet.internal.ServletStubImpl$ServletInvocationAction.run(ServletStubImpl.java:1053)
	at weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubImpl.java:387)
	at weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubImpl.java:431)
	at weblogic.servlet.internal.TailFilter.doFilter(TailFilter.java:28)
	at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:27)
	at com.pearson.ph.phcore.presentation.servlets.CheckLoginFilter.doFilter(CheckLoginFilter.java:76)
	at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:27)
	at com.pearson.ph.phcore.presentation.servlets.CheckLoginFilter.doFilter(CheckLoginFilter.java:76)
	at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:27)
	at com.pearson.ph.itext.presentation.servlets.SessionFilter.doFilter(SessionFilter.java:87)
	at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:27)
	at weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.run(WebAppServletContext.java:6297)
	at weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubject.java:317)
	at weblogic.security.service.SecurityManager.runAs(SecurityManager.java:97)
	at weblogic.servlet.internal.WebAppServletContext.invokeServlet(WebAppServletContext.java:3575)
	at weblogic.servlet.internal.ServletRequestImpl.execute(ServletRequestImpl.java:2573)
	at weblogic.kernel.ExecuteThread.execute(ExecuteThread.java:178)
	at weblogic.kernel.ExecuteThread.run(ExecuteThread.java:151)</font></pre>
<pre></pre>
<p><strong>Solution</strong><br />
Seems this is an issue with Weblogic server 8.1, when upgraded to Weblogic 8.1 sp4 the problem goes away.</p>
]]></content:encoded>
			<wfw:commentRss>http://javablog.info/2007/04/18/javalangnosuchmethoderror-weblogicservletjspstandardtaglibfakeemptybodytag-ljavaxservletjsppagecontext-ljavaxservletjsptagextbodytagiz/feed/</wfw:commentRss>
		</item>
		<item>
		<title>IntelliJ Plugin TddTracker</title>
		<link>http://javablog.info/2007/04/16/intellij-plugin-tddtracker/</link>
		<comments>http://javablog.info/2007/04/16/intellij-plugin-tddtracker/#comments</comments>
		<pubDate>Mon, 16 Apr 2007 23:08:03 +0000</pubDate>
		<dc:creator>Ravi Nallakukkala</dc:creator>
		
		<category><![CDATA[Tools]]></category>

		<guid isPermaLink="false">http://javablog.info/2007/04/16/intellij-plugin-tddtracker/</guid>
		<description><![CDATA[This is one of those plug-in which a developer would love to have in the development environment, the main purpose of this plug-in is report the time taken to execute a JUnit.
Highlights (release 0.4)

Reports the time taken for the execution of each test method, typically the results are displayed in as shown below.

Usage

Upon running a [...]]]></description>
			<content:encoded><![CDATA[<p>This is one of those plug-in which a developer would love to have in the development environment, the main purpose of this plug-in is report the time taken to execute a JUnit.</p>
<p><span style="font-weight: bold">Highlights</span> (release 0.4)</p>
<ul>
<li>Reports the time taken for the execution of each test method, typically the results are displayed in as shown below.</li>
</ul>
<p><span style="font-weight: bold">Usage</span><br style="font-weight: bold" /></p>
<ul>
<li>Upon running a JUnit test class, this plug-in gets invoked automatically.</li>
</ul>
<p><span style="font-weight: bold">Favorable</span></p>
<ul>
<li>Great reports in development environment, no need for any extra profiling.</li>
</ul>
<p><span style="font-weight: bold">Unfavorable</span></p>
<ul>
<li>This plug-in doesnâ€™t integrate with Fireworks plug-in (through which you can run a test suite)</li>
</ul>
<p>For more information about this tool, IntelliJ plug-in repository <a href="http://plugins.intellij.net/plugin/?id=148" target="_blank">here</a> and user documentation <a href="http://www.intellij.org/twiki/bin/view/Main/TddTrackerPlugin" target="_blank">here </a></p>
]]></content:encoded>
			<wfw:commentRss>http://javablog.info/2007/04/16/intellij-plugin-tddtracker/feed/</wfw:commentRss>
		</item>
		<item>
		<title>UnitTest IntelliJ plugin</title>
		<link>http://javablog.info/2007/04/16/unittest-intellij-plugin/</link>
		<comments>http://javablog.info/2007/04/16/unittest-intellij-plugin/#comments</comments>
		<pubDate>Mon, 16 Apr 2007 21:09:13 +0000</pubDate>
		<dc:creator>Ravi Nallakukkala</dc:creator>
		
		<category><![CDATA[Tools]]></category>

		<guid isPermaLink="false">http://javablog.info/2007/04/16/unittest-intellij-plugin/</guid>
		<description><![CDATA[A tool for creating JUnit tests (class/ methods).
Highlights (based on release 0.303)

Extremely easy to use, very well documented.
You can create your own location patterns for the Test class to be created.

Usage

On a class or method press Ctrl-T (in Ariadna) Ctrl-Shift-T (in Aurora) to go to the test class or test method
On a test class or [...]]]></description>
			<content:encoded><![CDATA[<p>A tool for creating JUnit tests (class/ methods).</p>
<p><strong>Highlights </strong>(based on release 0.303<span>)</span></p>
<ul>
<li>Extremely easy to use, very well documented.</li>
<li>You can create your own location patterns for the Test class to be created.</li>
</ul>
<p><strong>Usage</strong></p>
<ul>
<li>On a class or method press Ctrl-T (in Ariadna) Ctrl-Shift-T (in Aurora) to go to the test class or test method</li>
<li>On a test class or test method press Ctrl-T/Ctrl-Shift-T to go back to the tested class or tested method</li>
<li>If the test class or test method is missing it will be automatically created.</li>
</ul>
<p><strong>Favorable<br />
</strong></p>
<ul>
<li>Easy of use and integrates well with IntelliJ</li>
<li>You have more control on the location of the created test classes.</li>
<li>Very good documentation.</li>
<li>Toggle between the code and test using CTRL + SHIFT + T</li>
<li>This plug-in along with <a href="/2007/04/16/fireworks-intellij-plugin/">fireworks plug-in </a>should be good fit.</li>
</ul>
<p><strong>Unfavorable</strong></p>
<ul>
<li>Not an Intelligent to analysis the code and write some test cases.</li>
</ul>
<p>For more information on this tool <a href="http://www.intellij.org/twiki/bin/view/Main/JUnitTestPlugin" target="_blank">here</a> and User guide available <a href="http://www.intellij.org/twiki/bin/view/Main/JUnitTestPluginUserGuide" target="_blank">here</a></p>
]]></content:encoded>
			<wfw:commentRss>http://javablog.info/2007/04/16/unittest-intellij-plugin/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Code generation of JUnit test cases</title>
		<link>http://javablog.info/2007/04/16/code-generation-of-junit-test-cases/</link>
		<comments>http://javablog.info/2007/04/16/code-generation-of-junit-test-cases/#comments</comments>
		<pubDate>Mon, 16 Apr 2007 18:34:11 +0000</pubDate>
		<dc:creator>Ravi Nallakukkala</dc:creator>
		
		<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://javablog.info/2007/04/16/code-generation-of-junit-test-cases/</guid>
		<description><![CDATA[Found a good discussion on IBM site; but remember this is a discussion in 2003 things could have changed by now
]]></description>
			<content:encoded><![CDATA[<p>Found a good discussion on <a href="http://www-128.ibm.com/developerworks/forums/dw_thread.jsp?message=25075&amp;cat=10&amp;thread=7324&amp;treeDisplayType=threadmode1&amp;forum=179#25075">IBM site</a>; but remember this is a discussion in 2003 things could have changed by now</p>
]]></content:encoded>
			<wfw:commentRss>http://javablog.info/2007/04/16/code-generation-of-junit-test-cases/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Fireworks IntelliJ plugin</title>
		<link>http://javablog.info/2007/04/16/fireworks-intellij-plugin/</link>
		<comments>http://javablog.info/2007/04/16/fireworks-intellij-plugin/#comments</comments>
		<pubDate>Mon, 16 Apr 2007 18:30:31 +0000</pubDate>
		<dc:creator>Ravi Nallakukkala</dc:creator>
		
		<category><![CDATA[Tools]]></category>

		<guid isPermaLink="false">http://javablog.info/2007/04/16/fireworks-intellij-plugin/</guid>
		<description><![CDATA[This is a plugin meant for running all JUnits as a single test suite.

Highlights

Runs with JUnit 3.8 and 4.
Helps in Run all the JUnits together (as a single test suite) based on a regular expression (e.g, *test).

Usage

Goto fireworks tab and select run (ALT + SHIFT +K).

Favorable

Helps to run all the JUnit together and Integrates with [...]]]></description>
			<content:encoded><![CDATA[<p>This is a plugin meant for running all JUnits as a single test suite.<br />
<strong><br />
Highlights</strong></p>
<ul>
<li>Runs with JUnit 3.8 and 4.</li>
<li>Helps in Run all the JUnits together (as a single test suite) based on a regular expression (e.g, *test).</li>
</ul>
<p><strong>Usage</strong></p>
<ul>
<li>Goto fireworks tab and select run (ALT + SHIFT +K).</li>
</ul>
<p><strong>Favorable</strong></p>
<ul>
<li>Helps to run all the JUnit together and Integrates with IntelliJ</li>
</ul>
<p><strong>Unfavorable</strong><br />
NA</p>
<p>For more information on this tool <a href="http://swing1979.googlepages.com/fireworks" target="_blank">here</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://javablog.info/2007/04/16/fireworks-intellij-plugin/feed/</wfw:commentRss>
		</item>
		<item>
		<title>JUnitGenerator IntelliJ plugin</title>
		<link>http://javablog.info/2007/04/16/junitgenerator-intellij-plugin/</link>
		<comments>http://javablog.info/2007/04/16/junitgenerator-intellij-plugin/#comments</comments>
		<pubDate>Mon, 16 Apr 2007 07:59:45 +0000</pubDate>
		<dc:creator>Ravi Nallakukkala</dc:creator>
		
		<category><![CDATA[Tools]]></category>

		<guid isPermaLink="false">http://javablog.info/2007/04/16/junitgenerator-intellij-plugin/</guid>
		<description><![CDATA[Continuing the quest for a JUnit generator tool, my next stop was with JUnit Generator â€“ IntelliJ Plugin. Lets look at features and the fitments of this tool towards my requirement (Junit Generation for a given source code).
Highlights (based on 1.1.7 release)


Generates JUnit test classes/methods for all the public source methods .
The generated JUnit code [...]]]></description>
			<content:encoded><![CDATA[<p>Continuing the quest for a JUnit generator tool, my next stop was with JUnit Generator â€“ IntelliJ Plugin. Lets look at features and the fitments of this tool towards my requirement (Junit Generation for a given source code).</p>
<p><strong>Highlights </strong>(based on 1.1.7 release)<strong><br />
</strong></p>
<ul>
<li>Generates JUnit test classes/methods for all the public source methods .</li>
<li>The generated JUnit code is not complaint with JUnit 4.</li>
<li>Easy of Installation/ usage.</li>
</ul>
<p><strong>Usage</strong></p>
<ul>
<li>Open the file for which you need to write the JUnit test class, select Alt+Insert you will see &#8220;JUnit Test&#8221; menu in the list.</li>
</ul>
<p><strong>Favorable</strong></p>
<ul>
<li>Auto generates the skeleton code for JUnit test class.</li>
<li>Integrates with IntelliJ</li>
</ul>
<p><strong>Unfavorable<br />
</strong></p>
<ul>
<li>Only the Skeleton code is generated.</li>
<li>If the JUnit already existing, For an Existing JUnit IntelliJ (6.0.5 build #6180)  throws an Internal error instead of showing the differences in the current JUnit code to generated code as promised by the tool</li>
</ul>
<p>For more information about this tool, go from <a href="http://www.intellij.org/twiki/bin/view/Main/JUnitGenerator" target="_blank">here </a></p>
]]></content:encoded>
			<wfw:commentRss>http://javablog.info/2007/04/16/junitgenerator-intellij-plugin/feed/</wfw:commentRss>
		</item>
		<item>
		<title>JUnit 4 Synchronizer IntelliJ plugin</title>
		<link>http://javablog.info/2007/04/16/junit-4-synchronizer-intellij-plugin/</link>
		<comments>http://javablog.info/2007/04/16/junit-4-synchronizer-intellij-plugin/#comments</comments>
		<pubDate>Mon, 16 Apr 2007 05:27:00 +0000</pubDate>
		<dc:creator>Ravi Nallakukkala</dc:creator>
		
		<category><![CDATA[Tools]]></category>

		<guid isPermaLink="false">http://javablog.info/2007/04/16/junit-4-synchronizer-intellij-plugin/</guid>
		<description><![CDATA[I started a searching for a free tool (which hopefully) will generated some JUnit test code for a given source code. In process of this search, as a first start point I started evaluating the plug-ins which are available for IntelliJ; JUnit 4 Synchronizer is my first stop in the evaluation process.
Highlights (based on release [...]]]></description>
			<content:encoded><![CDATA[<p>I started a searching for a free tool (which hopefully) will generated some JUnit test code for a given source code. In process of this search, as a first start point I started evaluating the plug-ins which are available for IntelliJ; JUnit 4 Synchronizer is my first stop in the evaluation process.</p>
<p><strong>Highlights </strong>(based on release 0.1.1)<strong><br />
</strong></p>
<ul>
<li>Generates Skeleton JUnit Code.</li>
<li>Generates JUnit 4 test classes/methods for source methods annotated with the @Testable annotation.</li>
</ul>
<p><strong>Usage</strong></p>
<ul>
<li>From IntelliJ IDE, Tools &#8211;&gt; RunSynchronize JUnit Tests, this creates a @Testable annotation</li>
<li>All the desired source methods needs to be Annotate with @Testable annotation.</li>
<li>Run Synchronize JUnit Tests to create test methods.</li>
<li>Repeat steps 2 and 3 as often as desired to create new unit tests</li>
</ul>
<p><strong>Favorable</strong></p>
<ul>
<li>Auto generates the skeleton code for JUnit test class.</li>
<li>Integrates with IntelliJ</li>
</ul>
<p><strong>Unfavorable</strong></p>
<ul>
<li>Source code needs to have test Annotations in the source code. In other words, Source code has dependency on test code (as @Testable annotation is available in &#8216;test&#8217; folder).</li>
<li>Only the Skeleton code is generate</li>
</ul>
<p>For more information about the plugin, <a href="http://plugins.intellij.net/plugin/?id=1267" target="_blank">go here</a></p>
]]></content:encoded>
			<wfw:commentRss>http://javablog.info/2007/04/16/junit-4-synchronizer-intellij-plugin/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Equals and hashcode Approach/ Implementation for Business Objects (Bo)</title>
		<link>http://javablog.info/2007/04/15/equals-and-hashcode-implementation-for-business-objects-bo/</link>
		<comments>http://javablog.info/2007/04/15/equals-and-hashcode-implementation-for-business-objects-bo/#comments</comments>
		<pubDate>Sun, 15 Apr 2007 07:58:37 +0000</pubDate>
		<dc:creator>Ravi Nallakukkala</dc:creator>
		
		<category><![CDATA[Design]]></category>

		<category><![CDATA[Hibernate]]></category>

		<guid isPermaLink="false">http://javablog.info/2007/04/15/equals-and-hashcode-implementation-for-business-objects-bo/</guid>
		<description><![CDATA[A common source for bugs while writing code Business Objects for relational database using Object Relation Mapping tools is the implementation of the Equals and Hashcode methods.
If you would like to know more about the Equals and Hashcode importance for an ORM  Click here.
To summarize the ORM implementation, There are two types of keys: [...]]]></description>
			<content:encoded><![CDATA[<p>A common source for bugs while writing code Business Objects for relational database using Object Relation Mapping tools is the implementation of the Equals and Hashcode methods.</p>
<p>If you would like to know more about the Equals and Hashcode importance for an ORM  <a href="http://www.hibernate.org/109.html" target="_blank">Click here.</a></p>
<p>To summarize the ORM implementation, There are two types of keys: Technical Keys and Business keys.</p>
<p>Technical keys are the primary key on the for a table to uniquely identify a database row, these numbers are auto generated sequence number (Item Unique IDentification/ IUID).</p>
<p>Business keys are the Business primary (/ composite) keys which uniquely identify the business objects   in the database tables.</p>
<p>One of the important factor while writing a equals and hashcode method is to decide on what attributes needs to go into these methods; Some guidelines for deciding the attributes for Equals and hashcode methods.</p>
<ul>
<li>It is not necessary to cover all the attributes in Business Objects in equals/ hashcode methods.</li>
<li>Include the Technical Keys and Business keys in equals and hashcode methods.</li>
<li>Equals and hashcode methods should take care of the null cases.</li>
</ul>
<p>Implementation wise, <a href="http://projects.apache.org/projects/jakarta_commons_lang.html" target="_blank">Apache commons-lang </a>has a very good implementation for hashcode and equals method. Here&#8217;s an example of equals and hashcode methods using the apache commons-lang<code>.</code></p>
<p><code> @Entity<br />
@Table(name = "APP_CONFIGURATION")<br />
@SequenceGenerator(name = "OPS_SEQ", sequenceName = "SQ_CONFIGURATION_CNTR")<br />
public class ConfigurationBo extends AbstractBo {</code></p>
<p>private static final long serialVersionUID = -5098377177228374794L;</p>
<p>@Column(name = &#8220;ITEMNAME&#8221;, length = 100)<br />
private String name;</p>
<p>@Column(name = &#8220;STRINGVALUE&#8221;, length = 100)<br />
private String stringValue;</p>
<p>@Column(name = &#8220;INTVALUE&#8221;)<br />
private Integer intValue;</p>
<p>@Column(name = &#8220;TYPENAME&#8221;, length = 20)<br />
private String type;</p>
<p>public Integer getIntValue() {<br />
return intValue;<br />
}</p>
<p>public void setIntValue(Integer intValue) {<br />
this.intValue = intValue;<br />
}</p>
<p>public String getName() {<br />
return name;<br />
}</p>
<p>public void setName(String name) {<br />
this.name = name;<br />
}</p>
<p>public String getStringValue() {<br />
return stringValue;<br />
}</p>
<p>public void setStringValue(String stringValue) {<br />
this.stringValue = stringValue;<br />
}</p>
<p>public String getType() {<br />
return type;<br />
}</p>
<p>public void setType(String type) {<br />
this.type = type;<br />
}</p>
<p>/**<br />
* {@inheritDoc}<br />
*/<br />
@Override<br />
public boolean equals(Object obj) {<br />
if (this == obj) {<br />
return true;<br />
}<br />
if (!(obj.getClass() == this.getClass())) {<br />
return false;<br />
}<br />
ConfigurationBo other = (ConfigurationBo) obj;</p>
<p>return new EqualsBuilder()<br />
.appendSuper(super.equals(obj))<br />
.append(this.name, other.name)<br />
.append(this.type, other.type)<br />
.isEquals();<br />
}</p>
<p>/**<br />
* {@inheritDoc}<br />
*/<br />
@Override<br />
public int hashCode() {<br />
return new HashCodeBuilder()<br />
.appendSuper(super.hashCode())<br />
.append(this.name)<br />
.append(this.type)<br />
.toHashCode();<br />
}</p>
<p>/**<br />
* {@inheritDoc}<br />
*/<br />
@Override<br />
public String toString() {<br />
return super.toString() + &#8220;[name=&#8221; + name + &#8220;, type=&#8221; + type + &#8220;]&#8221;;<br />
}</p>
<p>}</p>
]]></content:encoded>
			<wfw:commentRss>http://javablog.info/2007/04/15/equals-and-hashcode-implementation-for-business-objects-bo/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Drive from Atlanta to Birmingham</title>
		<link>http://javablog.info/2007/04/13/drive-from-atlanta-to-birmingham/</link>
		<comments>http://javablog.info/2007/04/13/drive-from-atlanta-to-birmingham/#comments</comments>
		<pubDate>Fri, 13 Apr 2007 09:29:58 +0000</pubDate>
		<dc:creator>Ravi Nallakukkala</dc:creator>
		
		<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://javablog.info/2007/04/13/drive-from-atlanta-to-birmingham/</guid>
		<description><![CDATA[It been long time that i had got an opportunity to demonstrate my driving skills on road, and was memorizing when did I had a good test for my good driving skills, the first thing that comes to my mind is a drive from Atlanta to Birmingham.
Let me give my driving background first, I&#8217;m always [...]]]></description>
			<content:encoded><![CDATA[<p>It been long time that i had got an opportunity to demonstrate my driving skills on road, and was memorizing when did I had a good test for my good driving skills, the first thing that comes to my mind is a drive from Atlanta to Birmingham.</p>
<p>Let me give my driving background first, I&#8217;m always fascinated by Cars and a great fan of  Formula 1 and in particular to Michael Schumacher and Ferrari. I&#8217;m used for driving manual gear cars with a drive on right side, mostly driven in Asia and United kingdom where traffic is considerable good, when moved to states, needed to drive a automated gear cars, not much of traffic on streets, cars hasa left drive (rigth traffic), to make life even difficult very polite drivers , low seep limits on a good roads and photo enforcement in most of the places <img src='http://www.javablog.info/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' /> </p>
<p>Sometime back I was working in Atlanta, GA, the one place where I love to drive. Here most of the traffic drives is very very aggressively. I&#8217;m a frequent visitor to Phoenix, AZ; so any guess how does Birmingham come into picture? Yes its because of Southwest airlines.   Couple of times I had to pickup my flight from Birmingham, according to maps, the drive time between the two places should be approximately  to 2 hours 20Min&#8217;s (around 150 miles). After driving for a while a in Atlanta, thought its an 1 hr and 40Min&#8217;s drive and having obtained a boarding card, ideally a door to door of 2 hours and 30 - 40 min&#8217;s is an ideal time for drive (need to be a bit careful in time calculations, Alabama is in CST and Georgia in EST).</p>
<p>Already, I missed couple of factors,</p>
<ul>
<li>I&#8217;m starting my drive on a Friday afternoon  2pm (weekend traffic).</li>
<li>Any road works?</li>
</ul>
<p>The drive from Atlanta to Birmingham is on I20 from east to west; for most part of the freeway official speed-limit is 75miles/ hour. Every time I had driven from Atlanta to Birmingham, it was definitely never without action, excitement!</p>
<p>My Trip to  Birmingham started on a bad note,  Got stuck in traffic in Atlanta Just before I could enter I 20 freeway, It was a delay of 6Min&#8217;s, was getting nervous as I knew I&#8217;m on road which I have no knowledge about, and that&#8217;s the last southwest flight from Birmingham to Phoenix; so pretty much knew what should I do if I miss my flight <img src='http://www.javablog.info/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> . Once Entered into I 20, well its all mine, Friday traffic was there, but as long as I was in Georgia, the whole traffic moves at a higher speed so no real  problems till 50miles, all of sudden a &#8220;Work Zone&#8221; sign for next 6miles; hmm getting interesting <img src='http://www.javablog.info/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' />  drove about a mile at reduced speed, then another surprise, slow traffic  and eventually no movement in the car (may be 10feet) for 25 minutes, totally frustrated, saw a small gap in front of me, so moved around 3feet, here you goo&#8230;.bang!!! its from the back, someone hit me from back!  hmm stopped the car to check the damage, a small dent and its was a old lady driver who expressed her apology, considering time constraints immediately back to car; after 40 Min&#8217;s of near stand still situation, suddenly found my car running at 40miles/hour then slowly to hitting the speed limit  on the road, car speed limit slow traffic,  a quick mathematics says I need an &#8220;average speed&#8221; of 80miles + 10-15minutes for car parking and security + boarding (Assumption was Birmingham is a small airport). May times, was revisiting my decision, would it be good to return back ? but same time wanna to give a try.</p>
<p>The opportunity to test driving skill was presented to me in a most beautiful way, drove to the potential of my car for next 50miles, the expected average speed was so high that my speed is not making any significant impact on the overall time, so complete 100miles; here comes another surprise, &#8220;work zone next 6miles&#8221;, hmm I don&#8217;t remember if I had followed the speed limits, but mostly it was a empty work zone roads! after that its all driving on I20 in a deep forests no sharp turns and not many narrow roads, but once reached the outskirts of Birmingham, traffic was there, not so crowded, comparatively,  the average speed seems to be low in Birmingham, reached airport 13Min&#8217;s before my flight schedule, car parking in Birmingham was the best (just 1min walk), I parked in C12 slot (which later realized is the nearest place to reach airport security), a 30sec run, I&#8217;m  in airport, a minute to find the security location and if my flight was still there, around 10 Min&#8217;s left at in front of security, Luckily, I&#8217;m the lone one at security counter (small airports are handy ah <img src='http://www.javablog.info/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' /> )  6minutes left,1 minute run to boarding area, &#8220;well, you are too close sir&#8221; was the greeting I got!  Sounded like honey to ears, &#8221; I made it&#8221;.</p>
<p>Now thinking back, the only thing, I was missing the other day was &#8220;Rain&#8221;, I love driving in rainy conditions, it would have been awesome had it rained, although I wasn&#8217;t sure If I could have make it to my flight <img src='http://www.javablog.info/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' /></p>
]]></content:encoded>
			<wfw:commentRss>http://javablog.info/2007/04/13/drive-from-atlanta-to-birmingham/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Things I hate in IntelliJ compared to Eclipse</title>
		<link>http://javablog.info/2007/04/11/things-i-hate-in-intellij-compared-to-eclipse-ide/</link>
		<comments>http://javablog.info/2007/04/11/things-i-hate-in-intellij-compared-to-eclipse-ide/#comments</comments>
		<pubDate>Wed, 11 Apr 2007 16:40:12 +0000</pubDate>
		<dc:creator>Ravi Nallakukkala</dc:creator>
		
		<category><![CDATA[Editors]]></category>

		<guid isPermaLink="false">http://javablog.info/2007/04/11/things-i-hate-in-intellij-compared-to-eclipse-ide/</guid>
		<description><![CDATA[I come from a strong Eclipse background and in my new assignment, my project team uses IntelliJ IDE; So thought let me check this IntelliJ editor. As expected (after being loyal to Eclipse for many years) first I noticed all the bad things about IntelliJ, Here&#8217;s my list of bad things  (Let me know [...]]]></description>
			<content:encoded><![CDATA[<p>I come from a strong Eclipse background and in my new assignment, my project team uses IntelliJ IDE; So thought let me check this IntelliJ editor. As expected (after being loyal to Eclipse for many years) first I noticed all the bad things about IntelliJ, Here&#8217;s my list of bad things  (Let me know if there is a better way of using IntelliJ to get around my problems)</p>
<ul>
<li>Once you setup  you project on IntelliJ, next time when you open IntelliJ, It takes long time to open the project/ IDE (does some scanning of Java/ jar files) worst part is you can&#8217;t even minimize that window/ run the process in back ground.</li>
<li>Upon installing a plug-in, Eclipse asks for a restart of workbench and upon your approval  for restart, eclipse automatically restarts, For the same, Interestingly IntelliJ asks &#8220;You need to shut down IDEA to activate changes in plugins. would you like do it now? &#8220;; (Notice question doesn&#8217;t say &#8216;Restart&#8217; ); So as expected, you have to (re)start your IDEA explicitly after installing a plugin.</li>
<li>You Can&#8217;t drag and drop a Java file from one folder to another folder.</li>
<li>IntelliJ expects a developer to configure the classpath twice, once to build the application and the second to run the application compared with eclipse where the same class is used by default.</li>
<li>With little time i spend on IntelliJ, haven&#8217;t found a way to add some pre-configured code templates.</li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://javablog.info/2007/04/11/things-i-hate-in-intellij-compared-to-eclipse-ide/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Spring Framework Declarative Transaction with Annotations</title>
		<link>http://javablog.info/2007/04/10/spring-framework-declarative-transaction-with-annotations/</link>
		<comments>http://javablog.info/2007/04/10/spring-framework-declarative-transaction-with-annotations/#comments</comments>
		<pubDate>Tue, 10 Apr 2007 06:20:40 +0000</pubDate>
		<dc:creator>Ravi Nallakukkala</dc:creator>
		
		<category><![CDATA[Spring]]></category>

		<guid isPermaLink="false">http://javablog.info/2007/04/10/spring-framework-declarative-transaction-with-annotations/</guid>
		<description><![CDATA[
Using Spring 2.0 and Java 5, it is possible to declare the transactions using annotation-based approach.
Spring framework supports @Transactional annotation for declarative transaction handling, this annotation can be used on a concrete class or method (with public visibility) of a concrete class. This annotation can be used on an interface, but this will only work [...]]]></description>
			<content:encoded><![CDATA[<ul>
<li>Using Spring 2.0 and Java 5, it is possible to declare the transactions using annotation-based approach.</li>
<li>Spring framework supports @Transactional annotation for declarative transaction handling, this annotation can be used on a concrete class or method (with public visibility) of a concrete class. This annotation can be used on an interface, but this will only work as you would expect it to if you are using interface-based proxies.</li>
<li>The default @Transactional settings are:
<ul>
<li>The propagation setting is PROPAGATION_REQUIRED</li>
<li>The isolation level is ISOLATION_DEFAULT</li>
<li>The transaction is read/write</li>
<li>The transaction timeout defaults to the default timeout of the underlying transaction system, or none if timeouts are not supported</li>
<li>Any RuntimeException will trigger rollback, and any checked Exception will not.</li>
</ul>
</li>
<li>Enabling the configuration of transactional behavior based on annotations can be done as follows</li>
</ul>
<p>&lt;tx:annotation-driven transaction-manager=&#8221;txManager&#8221;/&gt; where txManager points the underlying transaction manager and the tx namespace refers to http://www.springframework.org/schema/tx</p>
<ul>
<li>Transaction rollback can be controlled though Transactional annotation for the property â€˜rollbackForâ€™ and â€˜rollbackForClassNameâ€™.</li>
<li>Timeout for the transaction can be controlled through the Transactional annotation for the property &#8216;timeout&#8217;.</li>
<li>Example usage for Declarative transaction with Annotations</li>
</ul>
<p> <a href="http://javablog.info/2007/04/10/spring-framework-declarative-transaction-with-annotations/#more-28" class="more-link">(more&#8230;)</a></p>
]]></content:encoded>
			<wfw:commentRss>http://javablog.info/2007/04/10/spring-framework-declarative-transaction-with-annotations/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Unit Testing - Junit Approach</title>
		<link>http://javablog.info/2007/04/08/unit-testing-junit-approach/</link>
		<comments>http://javablog.info/2007/04/08/unit-testing-junit-approach/#comments</comments>
		<pubDate>Sun, 08 Apr 2007 19:56:32 +0000</pubDate>
		<dc:creator>Ravi Nallakukkala</dc:creator>
		
		<category><![CDATA[Design]]></category>

		<guid isPermaLink="false">http://javablog.info/2007/04/08/unit-testing-junit-approach/</guid>
		<description><![CDATA[Unit Testing involves testing unit components or modules of Code and validating that they work properly. Itâ€™s a proactive procedure, which means that code written by developers needs to be unit tested at the unit level. All test cases are independent of each other and are to be written and executed by development team.
Prior fixing [...]]]></description>
			<content:encoded><![CDATA[<p>Unit Testing involves testing unit components or modules of Code and validating that they work properly. Itâ€™s a proactive procedure, which means that code written by developers needs to be unit tested at the unit level. All test cases are independent of each other and are to be written and executed by development team.</p>
<p>Prior fixing a bug, write a unit test to reproduce it. When the bug is fixed, verify the fix using the unit test. All methods need to be covered by the tests. The tests need to covers all paths through the unit. Unit Tests will ensure errors are picked up at the earlier stage and will facilitate easy integration.</p>
<p><strong>Unit Testing Process</strong></p>
<p>The figure below illustrates the Unit Testing Procedure and it encourages developers to write test cases before they start developing their use cases.</p>
<p><img src="/images/Junitapproach.JPG" title="Unit test life cycle" alt="Unit test life cycle" align="middle" height="522" width="346" /></p>
<p><strong>Guidelines for Unit Test Cases</strong></p>
<ul>
<li>Write the test before implementing the functionality using a test driven approach. Every software component (business modules, services, DAOs, models or controllers of the presentation tier) will be designed to be tested.</li>
<li>When a bug is identified in the code and later fixed, as a good practice write a unit test to validate it.</li>
<li>Use Mock Object to collaborate with other components.</li>
<li>Write the tests for normal success case, boundary conditions or any exceptional conditions.</li>
<li>Make a decision if itâ€™s really appropriate to write tests for simple methods or simple classes. These will get tested later during Integration Testing (like DTOs, get/set,..).</li>
<li>Unit Test for Business Objects that only encapsulate data is not necessary. Only if the BO implements Business Logic, then this has to be tested using a unit test.</li>
<li>While testing the Business Logic Layer, unit tests need to be written for every service interface. Use Mock Objects for DAOâ€™s. Components used within the service implementation that contain validation logic will need to be tested independently. E.g. Validators, Convertors.</li>
<li>For the Presentation Layer one would need to set up the page, pageView, pageModel and the PageContext. Mock Objects will be used to model the PageContext.</li>
<li>The Test Coverage should be continuously monitored. Clover/ Cobertura could be used to for code coverage.</li>
<li>The names of Java source files for testing end with â€˜Testâ€™, as in MyClassTest.java.</li>
<li>While testing the Data Access Layer, make sure every DAO method has been tested. After each test the transaction should be rolled back so cleaning of the database is not required. (spring framework will do job of automatic rollback of data changes to the database).</li>
</ul>
<p><strong>Unit Testing Tools<br />
</strong>Consider a combination of JUnit and EasyMock to write Unit Test Cases. These tools are integrated with Eclipse (hopefully with Intellij) to merge unit tests with the development process.</p>
<p><strong>Unit Testing Framework - JUnit </strong><br />
JUnit provides a Java based framework for unit testing. In order to setup JUnit one has to download the junit.jar file which is freely downloadable and append it to your classpath. JUnit will be integrated with the Eclipse development environment.</p>
<ul>
<li>While writing unit tests, any class that contains test methods should subclass the TestCase class. A TestCase can define any number of public testXXX() methods.</li>
<li>To check the expected and the actual test results, one has to invoke the variation of assert() method.</li>
<li>The Test Class having several testXXX() methods can use the setup() and teardown() methods to initialize and release any common objects under test.</li>
<li>TestCase instances can be composed into TestSuite hierarchies so that all test methods are invoked</li>
</ul>
<p><strong>EasyMock<br />
</strong>EasyMock, an open source library provides an easy medium to generate mock objects for a given interface. This facilitates running Junit tests for individual classes with the collaborators being simulated with Easy Mock Objects.</p>
<p>To get a Mock Object, we need to perform the following steps:</p>
<ul>
<li>Create a Mock Object for the interface we would like to simulate</li>
<li>Setup the Expected behavior. Record the expected method calls.</li>
<li>Switch the Mock Object to replay state. If no expected behavior is set, then call to any methods of the collaborator class with throw an exceptions.</li>
<li>Call object under test</li>
<li>Validate if the expectations have been met.</li>
<li>Code Snippet using JUnit &amp; EasyMock</li>
</ul>
<p>import junit.framework.TestCase;<br />
import static org.easymock.EasyMock.createMock;<br />
import static org.easymock.EasyMock.expect;<br />
import static org.easymock.EasyMock.replay;<br />
import static org.easymock.EasyMock.reset;<br />
import static org.easymock.EasyMock.verify;</p>
<p>public class UserServiceImplTest extends TestCase {<br />
private UserDao userDaoMock;<br />
private UserService us;<br />
public void setUp() throws Exception {</p>
<p>// 1. create the mock for our DAO<br />
userDaoMock = createMock(UserDao.class);</p>
<p>// 2. create an instance of the class under test<br />
us = new UserServiceImpl();</p>
<p>// 3. wire test object and mock<br />
us.setUserDao(userDaoMock);</p>
<p>}</p>
<p>/**<br />
* after each test method call the mock has to be reset<br />
*/<br />
public void tearDown() throws Exception {<br />
reset(userDaoMock);<br />
}<br />
}</p>
]]></content:encoded>
			<wfw:commentRss>http://javablog.info/2007/04/08/unit-testing-junit-approach/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Eclipse IntelliJ Shortcut keys a comparison</title>
		<link>http://javablog.info/2007/04/06/intellij-shortcuts/</link>
		<comments>http://javablog.info/2007/04/06/intellij-shortcuts/#comments</comments>
		<pubDate>Fri, 06 Apr 2007 04:44:32 +0000</pubDate>
		<dc:creator>Ravi Nallakukkala</dc:creator>
		
		<category><![CDATA[Editors]]></category>

		<guid isPermaLink="false">http://javablog.info/2007/04/06/intellij-shortcuts/</guid>
		<description><![CDATA[In my new project, my team was using IntelliJ as their IDE and I come from a strong Eclipse background, Initially it was hard time to find out all the Shortcut Keys for IntelliJ so thought I could document the shortcut keys that I commonly use, I will update this list as my learning experience [...]]]></description>
			<content:encoded><![CDATA[<p>In my new project, my team was using IntelliJ as their IDE and I come from a strong Eclipse background, Initially it was hard time to find out all the Shortcut Keys for IntelliJ so thought I could document the shortcut keys that I commonly use, I will update this list as my learning experience continues with IntelliJ</p>
<table border="1" cellPadding="0" cellSpacing="0" style="border-collapse: collapse; border: medium none" class="MsoTableGrid">
<tr>
<td width="197" vAlign="top" style="padding-right: 5.4pt; padding-left: 5.4pt; padding-bottom: 0in; width: 2.05in; padding-top: 0in; border: windowtext 1pt solid"><strong>Description</strong></td>
<td width="197" vAlign="top" style="border-right: windowtext 1pt solid; padding-right: 5.4pt; border-top: windowtext 1pt solid; padding-left: 5.4pt; padding-bottom: 0in; border-left: medium none; width: 2.05in; padding-top: 0in; border-bottom: windowtext 1pt solid"><strong>Eclipse shortcut</strong></td>
<td width="197" vAlign="top" style="border-right: windowtext 1pt solid; padding-right: 5.4pt; border-top: windowtext 1pt solid; padding-left: 5.4pt; padding-bottom: 0in; border-left: medium none; width: 2.05in; padding-top: 0in; border-bottom: windowtext 1pt solid"><strong>IntelliJ Shortcut</strong></td>
</tr>
<tr>
<td width="197" vAlign="top" style="border-right: 1pt solid; padding-right: 5.4pt; border-top: medium none; padding-left: 5.4pt; padding-bottom: 0in; border-left: 1pt solid; width: 2.05in; padding-top: 0in; border-bottom: 1pt solid">Navigate a Java Type</td>
<td width="197" vAlign="top" style="border-right: 1pt solid; padding-right: 5.4pt; border-top: medium none; padding-left: 5.4pt; padding-bottom: 0in; border-left: medium none; width: 2.05in; padding-top: 0in; border-bottom: 1pt solid">CTRL + ALT + T</td>
<td width="197" vAlign="top" style="border-right: 1pt solid; padding-right: 5.4pt; border-top: medium none; padding-left: 5.4pt; padding-bottom: 0in; border-left: medium none; width: 2.05in; padding-top: 0in; border-bottom: 1pt solid">CTRL + N</td>
</tr>
<tr>
<td width="197" vAlign="top" style="border-right: 1pt solid; padding-right: 5.4pt; border-top: medium none; padding-left: 5.4pt; padding-bottom: 0in; border-left: 1pt solid; width: 2.05in; padding-top: 0in; border-bottom: 1pt solid">Navigate a Resource</td>
<td width="197" vAlign="top" style="border-right: 1pt solid; padding-right: 5.4pt; border-top: medium none; padding-left: 5.4pt; padding-bottom: 0in; border-left: medium none; width: 2.05in; padding-top: 0in; border-bottom: 1pt solid">CTRL + ALT + R</td>
<td width="197" vAlign="top" style="border-right: 1pt solid; padding-right: 5.4pt; border-top: medium none; padding-left: 5.4pt; padding-bottom: 0in; border-left: medium none; width: 2.05in; padding-top: 0in; border-bottom: 1pt solid">CTRL + SHIFT +N</td>
</tr>
<tr>
<td width="197" vAlign="top" style="border-right: 1pt solid; padding-right: 5.4pt; border-top: medium none; padding-left: 5.4pt; padding-bottom: 0in; border-left: 1pt solid; width: 2.05in; padding-top: 0in; border-bottom: 1pt solid">Last Modified Source</td>
<td width="197" vAlign="top" style="border-right: 1pt solid; padding-right: 5.4pt; border-top: medium none; padding-left: 5.4pt; padding-bottom: 0in; border-left: medium none; width: 2.05in; padding-top: 0in; border-bottom: 1pt solid">ALT + Left arrow</td>
<td width="197" vAlign="top" style="border-right: 1pt solid; padding-right: 5.4pt; border-top: medium none; padding-left: 5.4pt; padding-bottom: 0in; border-left: medium none; width: 2.05in; padding-top: 0in; border-bottom: 1pt solid">CTRL + ALT + left arrow</td>
</tr>
<tr>
<td width="197" vAlign="top" style="border-right: 1pt solid; padding-right: 5.4pt; border-top: medium none; padding-left: 5.4pt; padding-bottom: 0in; border-left: 1pt solid; width: 2.05in; padding-top: 0in; border-bottom: 1pt solid">Debug</td>
<td width="197" vAlign="top" style="border-right: 1pt solid; padding-right: 5.4pt; border-top: medium none; padding-left: 5.4pt; padding-bottom: 0in; border-left: medium none; width: 2.05in; padding-top: 0in; border-bottom: 1pt solid">F11</td>
<td width="197" vAlign="top" style="border-right: 1pt solid; padding-right: 5.4pt; border-top: medium none; padding-left: 5.4pt; padding-bottom: 0in; border-left: medium none; width: 2.05in; padding-top: 0in; border-bottom: 1pt solid">Shift + F9</td>
</tr>
<tr>
<td width="197" vAlign="top" style="border-right: 1pt solid; padding-right: 5.4pt; border-top: medium none; padding-left: 5.4pt; padding-bottom: 0in; border-left: 1pt solid; width: 2.05in; padding-top: 0in; border-bottom: 1pt solid">Open Declaration</td>
<td width="197" vAlign="top" style="border-right: 1pt solid; padding-right: 5.4pt; border-top: medium none; padding-left: 5.4pt; padding-bottom: 0in; border-left: medium none; width: 2.05in; padding-top: 0in; border-bottom: 1pt solid">F3</td>
<td width="197" vAlign="top" style="border-right: 1pt solid; padding-right: 5.4pt; border-top: medium none; padding-left: 5.4pt; padding-bottom: 0in; border-left: medium none; width: 2.05in; padding-top: 0in; border-bottom: 1pt solid">CTRL + SHIFT + B</td>
</tr>
<tr>
<td width="197" vAlign="top" style="border-right: 1pt solid; padding-right: 5.4pt; border-top: medium none; padding-left: 5.4pt; padding-bottom: 0in; border-left: 1pt solid; width: 2.05in; padding-top: 0in; border-bottom: 1pt solid">Open Hierarchy</td>
<td width="197" vAlign="top" style="border-right: 1pt solid; padding-right: 5.4pt; border-top: medium none; padding-left: 5.4pt; padding-bottom: 0in; border-left: medium none; width: 2.05in; padding-top: 0in; border-bottom: 1pt solid">F4</td>
<td width="197" vAlign="top" style="border-right: 1pt solid; padding-right: 5.4pt; border-top: medium none; padding-left: 5.4pt; padding-bottom: 0in; border-left: medium none; width: 2.05in; padding-top: 0in; border-bottom: 1pt solid">CTRL + H</td>
</tr>
<tr>
<td width="197" vAlign="top" style="border-right: 1pt solid; padding-right: 5.4pt; border-top: medium none; padding-left: 5.4pt; padding-bottom: 0in; border-left: 1pt solid; width: 2.05in; padding-top: 0in; border-bottom: 1pt solid">Organize Imports</td>
<td width="197" vAlign="top" style="border-right: 1pt solid; padding-right: 5.4pt; border-top: medium none; padding-left: 5.4pt; padding-bottom: 0in; border-left: medium none; width: 2.05in; padding-top: 0in; border-bottom: 1pt solid">CRTL + SHIFT + O</td>
<td width="197" vAlign="top" style="border-right: 1pt solid; padding-right: 5.4pt; border-top: medium none; padding-left: 5.4pt; padding-bottom: 0in; border-left: medium none; width: 2.05in; padding-top: 0in; border-bottom: 1pt solid">CTRL + ALT + O</td>
</tr>
<tr>
<td width="197" vAlign="top" style="border-right: 1pt solid; padding-right: 5.4pt; border-top: medium none; padding-left: 5.4pt; padding-bottom: 0in; border-left: 1pt solid; width: 2.05in; padding-top: 0in; border-bottom: 1pt solid">Find</td>
<td width="197" vAlign="top" style="border-right: 1pt solid; padding-right: 5.4pt; border-top: medium none; padding-left: 5.4pt; padding-bottom: 0in; border-left: medium none; width: 2.05in; padding-top: 0in; border-bottom: 1pt solid">CTRL + F</td>
<td width="197" vAlign="top" style="border-right: 1pt solid; padding-right: 5.4pt; border-top: medium none; padding-left: 5.4pt; padding-bottom: 0in; border-left: medium none; width: 2.05in; padding-top: 0in; border-bottom: 1pt solid">CTRL + F</td>
</tr>
<tr>
<td width="197" vAlign="top" style="border-right: 1pt solid; padding-right: 5.4pt; border-top: medium none; padding-left: 5.4pt; padding-bottom: 0in; border-left: 1pt solid; width: 2.05in; padding-top: 0in; border-bottom: 1pt solid">Find Again/ previous</td>
<td width="197" vAlign="top" style="border-right: 1pt solid; padding-right: 5.4pt; border-top: medium none; padding-left: 5.4pt; padding-bottom: 0in; border-left: medium none; width: 2.05in; padding-top: 0in; border-bottom: 1pt solid">F3 / SHIFT + F3</td>
<td width="197" vAlign="top" style="border-right: 1pt solid; padding-right: 5.4pt; border-top: medium none; padding-left: 5.4pt; padding-bottom: 0in; border-left: medium none; width: 2.05in; padding-top: 0in; border-bottom: 1pt solid">F3 / SHIFT + F3</td>
</tr>
<tr>
<td width="197" vAlign="top" style="border-right: 1pt solid; padding-right: 5.4pt; border-top: medium none; padding-left: 5.4pt; padding-bottom: 0in; border-left: 1pt solid; width: 2.05in; padding-top: 0in; border-bottom: 1pt solid">Step Into</td>
<td width="197" vAlign="top" style="border-right: 1pt solid; padding-right: 5.4pt; border-top: medium none; padding-left: 5.4pt; padding-bottom: 0in; border-left: medium none; width: 2.05in; padding-top: 0in; border-bottom: 1pt solid">F5</td>
<td width="197" vAlign="top" style="border-right: 1pt solid; padding-right: 5.4pt; border-top: medium none; padding-left: 5.4pt; padding-bottom: 0in; border-left: medium none; width: 2.05in; padding-top: 0in; border-bottom: 1pt solid">F7</td>
</tr>
<tr>
<td width="197" vAlign="top" style="border-right: 1pt solid; padding-right: 5.4pt; border-top: medium none; padding-left: 5.4pt; padding-bottom: 0in; border-left: 1pt solid; width: 2.05in; padding-top: 0in; border-bottom: 1pt solid">Step Over</td>
<td width="197" vAlign="top" style="border-right: 1pt solid; padding-right: 5.4pt; border-top: medium none; padding-left: 5.4pt; padding-bottom: 0in; border-left: medium none; width: 2.05in; padding-top: 0in; border-bottom: 1pt solid">F6</td>
<td width="197" vAlign="top" style="border-right: 1pt solid; padding-right: 5.4pt; border-top: medium none; padding-left: 5.4pt; padding-bottom: 0in; border-left: medium none; width: 2.05in; padding-top: 0in; border-bottom: 1pt solid">F8</td>
</tr>
<tr>
<td width="197" vAlign="top" style="border-right: 1pt solid; padding-right: 5.4pt; border-top: medium none; padding-left: 5.4pt; padding-bottom: 0in; border-left: 1pt solid; width: 2.05in; padding-top: 0in; border-bottom: 1pt solid">Step Out</td>
<td width="197" vAlign="top" style="border-right: 1pt solid; padding-right: 5.4pt; border-top: medium none; padding-left: 5.4pt; padding-bottom: 0in; border-left: medium none; width: 2.05in; padding-top: 0in; border-bottom: 1pt solid">F7</td>
<td width="197" vAlign="top" style="border-right: 1pt solid; padding-right: 5.4pt; border-top: medium none; padding-left: 5.4pt; padding-bottom: 0in; border-left: medium none; width: 2.05in; padding-top: 0in; border-bottom: 1pt solid">Shift + F8</td>
</tr>
<tr>
<td width="197" vAlign="top" style="border-right: 1pt solid; padding-right: 5.4pt; border-top: medium none; padding-left: 5.4pt; padding-bottom: 0in; border-left: 1pt solid; width: 2.05in; padding-top: 0in; border-bottom: 1pt solid">Resume</td>
<td width="197" vAlign="top" style="border-right: 1pt solid; padding-right: 5.4pt; border-top: medium none; padding-left: 5.4pt; padding-bottom: 0in; border-left: medium none; width: 2.05in; padding-top: 0in; border-bottom: 1pt solid">F8</td>
<td width="197" vAlign="top" style="border-right: 1pt solid; padding-right: 5.4pt; border-top: medium none; padding-left: 5.4pt; padding-bottom: 0in; border-left: medium none; width: 2.05in; padding-top: 0in; border-bottom: 1pt solid">F9</td>
</tr>
<tr>
<td width="197" vAlign="top" style="border-right: 1pt solid; padding-right: 5.4pt; border-top: medium none; padding-left: 5.4pt; padding-bottom: 0in; border-left: 1pt solid; width: 2.05in; padding-top: 0in; border-bottom: 1pt solid">To find impl of an abstract Method</td>
<td width="197" vAlign="top" style="border-right: 1pt solid; padding-right: 5.4pt; border-top: medium none; padding-left: 5.4pt; padding-bottom: 0in; border-left: medium none; width: 2.05in; padding-top: 0in; border-bottom: 1pt solid">?</td>
<td width="197" vAlign="top" style="border-right: 1pt solid; padding-right: 5.4pt; border-top: medium none; padding-left: 5.4pt; padding-bottom: 0in; border-left: medium none; width: 2.05in; padding-top: 0in; border-bottom: 1pt solid">Ctrl + Alt + B</td>
</tr>
</table>
]]></content:encoded>
			<wfw:commentRss>http://javablog.info/2007/04/06/intellij-shortcuts/feed/</wfw:commentRss>
		</item>
	</channel>
</rss>
