IDE : Netbeans database explorer view

image

It is very handy to see the database changes then in there in the IDE specially when working on hibernate. Net beans has this beautiful service/plugin, where you can fire query, see result set, modify tables and can analyse the association like foreign key and relation ship between tables in the graphical form.

IDE : Eclipse Vs NetBeans

 

NetBeans is an open-source project dedicated to providing rock solid software development products.I love Net Beans and its free like eclipse (Idea Injelli J is cool but its a paid IDE). If you want to do a quick start, instead of wasting time in IDE setup especially for web application development my vote goes for Net Beans.

The other day I have to do some experiment in a struts web app, I started using eclipse, now it told me to download tomcat, struts libs, setup environment variables and so many things  before i can see my hello world app. Then I just downloaded Netbeans click on a sample project of struts, there it goes, with the eye blink, the entire project was ready, compiled with all dependencies and deployed on bundled tomcat Smile. I started playing with app and experimented what I had to learn without much hassels of project setup etc as i had to do with eclipse. The User interface is very intuitive.

 

image

 

Pros and cons

So, now that the two environments are on a fairly even footing in the features and functionality they provide, what’s the difference? A lot of it has to do with personal preference and what the IDE is being used for. In fact, many developers use both Eclipse and NetBeans — just for different projects or clients. Each solution still has its own drawbacks and frustrations. Here are two of the most common distinctions users make between the IDEs:

  • Ease of use
    According to quite a few developers, Netbeans is easier to navigate right out of the box as long as you don’t try to use all the bells and whistles at first. It’s potentially more difficult to grasp at an advanced level compared to Eclipse because you really have to know what you are doing in Java to complete more complex projects. It could be ideal for beginner Java developers who just need the basics to start with and who are willing to take a “learn as you go” attitude to the rest of the platform. At one time, NetBeans featured a more pleasing and intuitive interface than Eclipse; but Eclipse has improved in this department recently.
  • Plugins
    Eclipse has a huge array of plugins delivering capabilities that aren’t necessarily available with NetBeans. Sorting through the plugins and dealing with plugins that break because of updates to new versions can be a headache. Third-party plugins offer lots of variety but aren’t necessarily reliable because of a lack of quality control. This reliance on plugins has led to quite a few complaints about the stability of the Eclipse platform; there’s a lot that can go wrong as the number of plugins increases. That being said, if you get the right plugins, it can make life a lot easier.

NetBeans tools tend to be a little more standardized as part of the Sun/Oracle brand. For example, a GUI builder comes with the NetBeans platform while it’s only available as a plugin for Eclipse. At the same time, many Google development tools like those for Android are easily obtainable as plugins for Eclipse and are not part of the regular NetBeans package. Some plugins are available for NetBeans (including a few that can be ported from Eclipse), but these plugins introduce a whole different set of complexities and the plugin technology isn’t as mature for NetBeans when compared to Eclipse.

At this time, it appears that Eclipse will continue to dominate the field due to user familiarity and the availability of custom options. However, the fact that NetBeans is a viable option means Eclipse will need to keep their plugin issues under control to retain customer loyalty .

testNG: How to write time test

 

Some time performance is critical. Lets a repository call does return the response withing request time out units then it will cause the application to break. Just to keep those things and performance in mind, testNG tests can be calibrate on the measure of time in milli seconds.

The “Time Test” means if an unit test takes longer than the specified number of milliseconds to run, the test will terminated and mark as failed.

import org.testng.annotations.*;public class TestNGTest4 {

	@Test(timeOut = 1000)  
	public void infinity() {  
		while (true); 
              // userRepository.getAllUsersInEntireWorld(); 
	}  

}

In above example, the infinity() method will not return, so the TestNG engine will mark it as failed and throw an exception

FAILED: infinity
org.testng.internal.thread.ThreadTimeoutException: 
Method public void TestNGTest4.infinity() didn't finish within the time-out 1000
... Removed 18 stack frames

 

How to create and deploy the jar to local repository using maven

Maven: Making a War and Jar at the Same Time
Maven 2 nice automates building WAR files, but it places your compiled classes in WEB-INF/classes instead of making a new jar in /WEB-INF/lib.

If you want your stuff to be compiled as a .jar as well as a .war, you can do this by specifying the jar goal in the command line:

[shell>mvn clean jar install

Note this will make myproject.jar in target/, not in target/myproject/WEB-INF/lib, so you will need to use the Ant plugin to move this stuff around.

But this is not always an option: for deep, modular builds using the reactor, you may want to build your whole thing using one “mvn install”. To do this, do the following:
Specify “war” packaging at the top of your pom.xml.
Then add the following to your build section.

<build>
</plugins>
<!–This plugin will create the jar for the project –>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<executions>
<execution>
<id>make-a-jar</id>
<phase>compile</phase>
<goals>
<goal>jar</goal>
</goals>
</execution>
</executions>
</plugin>
<!–This plugin will deploy the war in local repository–>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-install-plugin</artifactId>
<executions>
<execution>
<phase>install</phase>
<goals>
<goal>install-file</goal>
</goals>
<configuration>
<packaging>jar</packaging>
<artifactId>${project.artifactId}</artifactId>
<groupId>${project.groupId}</groupId>
<version>${project.version}</version>
<file>
${project.build.directory}/${project.artifactId}-${project.version}.jar
</file>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
<build>