Showing posts with label eclipse. Show all posts
Showing posts with label eclipse. Show all posts

Friday, April 29, 2011

Using Eclipse snippets for faster JUnit test creation (with Mockito!)

I'm using this snippet to create a template of new unit test method supporting BDD mockito tests. This is a good example for adding static imports to a class from snippets.

@${testType:newType(org.junit.Test)}
public void should${testname}() {
 ${staticImport:importStatic('org.mockito.BDDMockito.*', 'org.mockito.Matchers.*', 'org.mockito.Mockito.*', 'org.junit.Assert.*')}// given

    // when
    ${cursor}
    // then

}

The result is astonishing ;)

import static org.mockito.BDDMockito.*;
import static org.mockito.Matchers.*;
import static org.mockito.Mockito.*;
import static org.junit.Assert.*;


(...)

 @Test
    public void shouldTestSomething() {
        // given

        // when
        CURSOR_LANDS_HERE
        // then

    }

Thursday, March 31, 2011

GWT Designer for Eclipse 3.6 can cause project compile freeze

Lately I installed GWT Designer for Eclipse Helios (3.6). I wanted to check it's features. They aren't so cool I've expected but that's other story. The problem was that suddenly my main GWT enabled project began to freeze during compilation.  The project is maven enabled also.
So it freezed in about half of compilation. All other features of Eclipse worked well. Restarting Eclipse and Windows didn't help anyway.
After about an hour of investigating I've found that GWT Designer caused this. After removing it all came back to order.

Ofcourse I suspect that something is wrong with my Eclipse for example I have too many bizzarre plugins installed but if I could have such problems you could have them too. So be warned :-)

Wednesday, June 24, 2009

Eclipse Galileo wylądowało...

Już jest! Do pobrania. Właśnie oglądam i chodzi podejrzanie wolno ;) ale widzę że ma kupę fajnych ficzerów. Pewnie nie zrobię relacji, bo będzie ich milion więc po co się dublować. Liczę, że Łukasz Splatch Dywicki zrobić jakieś ciekawe review.

To co od razu znalazłem, to w narzędziach zdalnych, jest połączenie z shellem linucha i można wszystko pięknie monitorować procesy, jest dostęp do plików, no i zwykły terminal. Strasznie mi się to podoba, bo mamy w pracy mnóstwo maszyn na linuxach i sporo się tam dzieje. Hmm, można np. logi podglądać :D

To je dobre! Jakby jaki Pepiczek powiedział.

Wednesday, September 17, 2008

A problem with HibernateTools of JBossTools on Eclipse Ganymede

Latest version of Hibernate Tools 3.2.3ga is broken. It's using nonexistent class SWTResourceUtil which existed in Eclipse Europa. Opening Hibernate views ends with

Java.lang.NoClassDefFoundError: org/eclipse/ui/internal/util/SWTResourceUtil at prg.hibernate.eclipse.console.workbench.xpl.AnyAdaptableLabelProvider.getImage(AnyAdaptableLabelProvider.java:166) at org.eclipse.jface.viewers.WrappedViewerLabelProvider.getImage(WrappedViewerLabelProvider.java:117) at org.eclipse.jface.viewers.WrappedViewerLabelProvider.update(WrappedViewerLabelProvider.java:165) at org.eclipse.jface.viewers.ViewerColumn.refresh(ViewerColumn.java:145) at org.eclipse.jface.viewers.AbstractTreeViewer.doUpdateItem(AbstractTreeViewer.java:932) at org.eclipse.jface.viewers.AbstractTreeViewer$UpdateItemSafeRunnable.run(AbstractTreeViewer.java:102) at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:37)
and more...

Some developers are now working for a fix but for now you can patch it by yourself. Find plugin org.eclipse.ui.workbench_xxxx.jar of previous version of Eclipse (3.3 for example) and open it with some ZIP extractor. Copy class org/eclipse/ui/internal/util/SWTResourceUtil.class to current plugin jar of your Ganymede installation and restart Eclipse.

Some say that Hibernate configuration plugin works slower than in Europa version but who cares as it works at least!(!)
The solution was taken from Hibernate bug report http://opensource.atlassian.com/projects/hibernate/browse/HBX-1068 

Tuesday, November 20, 2007

Eclipse Europa (3.3) OutOfMemoryError: PermGen space

I like new Eclipse Europa (v.3.3). It has many advatages. It's faster and better and more... My colleague posted good review (Polish only) some time ago so I won't repeat. But there is one stinky thing about Eclipse when one try to work with bigger project... Eclipse Europa suddenly crashes without any error message. The cause: OutOfMemoryError. This damn thing kills all invention as you have to restart Eclipse to continue work. But even with that trick in a pocket one won't go far because it will happen soon again.

How to check whether it is memory error? Find workspace\.metadata directory and open .log file. Then jump to the end and look for stack trace with OutOfMemoryError: PermGen space. That's the cause.

I found many gurus who had very good ideas and theories about memory options that should be passed to greedy Eclipse but not many of them made any impression on Eclipse's memory hunger. So forget about eclipse.ini and it's content. Just modify your shortcut and set something about that

"C:\Program Files\eclipse3.3\eclipse.exe" -vmargs -Xms256m -Xmx952m -XX:MaxPermSize=256m

I run 2GB box at my work. As for weird 952 Megs for maximum memory size. It was chosen throught set of experiments. I found that there's a connection between each argument. If you change Xms param suddenly Xmx becomes invalid (and crashes Eclipse during startup). So do some experiments too with your start params.

My experience is that Eclipse 3.3 never goes beyond 500 Megs of physical memory and 500 Megs of virtual so maybe almost 1 Gig is too much but I never saw OutOfMemoryError again.