Piotr Gabryanczyk’s Blog

Java, Refactoring, AOP, Spring, DDD, TDD, etc.

  • Blogroll

    • I have joined Anti-IF Campaign

Archive for the ‘intellij’ Category

IntelliJ idea.exe.vmoptions revised for version 7 and JDK 6

Posted by Piotr Gabryanczyk on June 26, 2007

IntelliJ 7 was a bit unstable with JDK 1.6 on previous set of options I presented on this blog so I decided to tweak it again.

Here are the options I ended up with:

-Xms256m
-Xmx256m
-XX:MaxPermSize=150m
-XX:MaxGCPauseMillis=10
–XX:MaxHeapFreeRatio=70
-XX:+UseConcMarkSweepGC
–XX:+CMSIncrementalPacing
-Didea.no.jdk.check=true

Posted in intellij, java, jvm | 2 Comments »

Migrating JUnit + JMock tests to TestNG

Posted by Piotr Gabryanczyk on March 17, 2007

Following QCon presentation of Alexandru Popescu and Cedric Beust on TestNG and TDD I started switching IntellJ Eclipse Dependency Sync plugin to use TestNG.
It was very simple with TestNG IntelliJ plugin which has “Convert JUnit test to TestNG” intention.

JMock integration
One thing I struggled with was JMock integration. Although EasyMock seems to be very popular, many people prefer JMock as it provides more “fluent” interface. I think I am it this camp 🙂

The integration of JMock and TestNG turned out to be very simple:
– test class needs to extend MockObjectTestCase
– make sure that setUp() and tearDown() methods in the super class are called. So you need to override them in your test class and annotate with @BeforeMethod, @AfterMethod.

Here is the example:

  1 public class DependencySynchronizerTest extends JDummyTestCase {
  2
  3     @BeforeMethod public void setUp() throws Exception {
  4         super.setUp();
  5         ...
  6     }
  7
  8     @AfterMethod protected void tearDown() throws Exception {
  9         super.tearDown();
 10     }
 11
 12     @Test public void testTraceChangesUserApprovesLibraryName() {
 13         expectFullRegistrationToBeDone();
 14         dependencySynchronizer.traceChanges(file);
 15     }
 16     ...
 17 }

Posted in intellij, java, testing | 4 Comments »

IntelliJ & Eclipse Dependency Sync plugin

Posted by Piotr Gabryanczyk on December 14, 2006

Some time ago I wrote a plugin for IntelliJ developers who work in Eclipse environment.

This plugin synchronizes content of eclipse .classpath file with IntelliJ libraries. It is quite helpful when your colleagues add/remove some new libraries to the project in Eclipse and you suddenly can not build it.

Unexpectedly in few months plugin has been downloaded over 750 times! Some people even requested new features.

Project Facilities

As project was lacking some structure – documentation, discussion forum, source repository I decided to use Google Code and Google Groups to provide all these facilities.

So the mailing group is here and project site here.

Documentation Video

I even made the video showing the plugin in action.

Bugs and Feature Requests

If you would like to request any features please use the issue tracking system.

Enjoy!

Posted in eclipse, intellij, java, video | 1 Comment »

IntelliJ and Garbage Collection

Posted by Piotr Gabryanczyk on December 12, 2006

I recently read the article about garbage collection (here) and decided to tweak my IntelliJ settings.

I am using IntelliJ 6.0.2 and JDK 1.5.0_08.

I ended up with the following settings:

-Xms256m
-Xmx512m
-XX:MaxPermSize=200m
-XX:MaxGCPauseMillis=10
–XX:MaxHeapFreeRatio=70
-XX:+UseConcMarkSweepGC
–XX:+CMSIncrementalPacing

Let’s explain them:

Heap size

-Xms256m
-Xmx512m

The more the better…

Perm size

IntelliJ likes a lot of memory for caching references and class meta information. That is why we need to make sure that cache is not purged. Cache is stored in “Old Generation” space which size is determined by the following option

-XX:MaxPermSize=200m

200m is good for the size of project I am using. General rule is to observe memory indicator after using find symbol option with include non project files selected. If it doesn’t move you have chosen enough memory.

Maximum Pause

-XX:MaxGCPauseMillis=10

We ask GC to pause the application for no more then 10 milliseconds.

Proportion of free space

-XX:MaxHeapFreeRatio=70

We ask GC to kick off when more than 30% of memory is occupied, so when we start compilation GC will not interfere because it will be enough memory free.

Concurrent Mark-Sweep (CMS) Collector

-XX:+UseConcMarkSweepGC

We want GC to run in parallel with other threads without freezing the application. This option doesn’t stop GC from freezing the application but it reduces it significantly.

Incremental Mode

–XX:+CMSIncrementalPacing

We don’t wont to freeze the application so we do GC incrementally with breaks so the application can take a breath. We use Pacing so GC can learn how to use CPU based on application CPU usage.

Posted in intellij, java, jvm | 21 Comments »