Where he blogs about his eclipse musings
Java and Unicode monday morning blues
May 25th
Monday morning excitement. JUnit tests that pass in the IDE fail in ant and cruise servers running on all platforms.
java.lang.AssertionError:
Expected: a string containing "... text=Ç..."
got: "... text=Å..."
My immediate reaction was the encoding used by the JVM. Setting the “file.encoding” system property to UTF-8 did not help. Running the ant based tests in remote debugging mode also confirmed that the two strings were indeed different.
Since the tests used Cobertura for code coverage, the next step was to disable cobertura. Cobertura manipulates the generated byte code to add logging statements for code coverage. Still the same error.
The hidden gem seemed to be the -encoding java compiler flag. Setting it to UTF-8 fixed the problem.
So the next time you have something fail because of an encoding issue, it could just be the compiler encoding and not just the encoding used in the runtime!
Cucumber On JRuby inside Eclipse
Apr 10th
Fredrick recently asked on the swtbot newsgroup:
My goal is to be able to write some user acceptance tests (using Cucumber) to be able to tests some of my Eclipse plug-ins.
Cucumber is a BDD framework written in (J)ruby. It executes plain text files as functional tests. As a first step, the goal was to be able to print a simple ‘hello world’:
This required being able to bundle jruby with the necessary gems, the jruby jar is already OSGi-fied, so creating a manifest was not required.
First drop in the jruby-complete.jar that we just created inside the target eclipse’s plugins directory.
Then create an eclipse application with the following in it:
public class CucumberRunner implements IApplication {
public Object start(IApplicationContext context) throws Exception {
Bundle bundle = Platform.getBundle("org.jruby.jruby");
URL jrubyHome = FileLocator.toFileURL(bundle.getEntry("/META-INF/jruby.home"));
RubyInstanceConfig config = new RubyInstanceConfig();
config.setJRubyHome(jrubyHome.toString());
Ruby runtime = JavaEmbedUtils.initialize(new ArrayList(), config);
RubyRuntimeAdapter evaler = JavaEmbedUtils.newRuntimeAdapter();
evaler.eval(runtime, "p 'Hello, Eclipse World'");
JavaEmbedUtils.terminate(runtime);
return EXIT_OK;
}
public void stop() {
// do nothing
}
}
Now all we needed was to be able to execute the cucumber executable instead of printing hello world
Import the cucumber plugin with a sample calculator to execute it:
Run JRuby From Within A Jar And Package Your Own Gems Along
Apr 10th
Jruby-in a jar already bundles rspec and rake, so the goal was to find out where it gets packaged.
Download the jruby source zip, extract it and open the build.xml file, search for “rspec” (there’s two occurences) and you’ll find that it’s passed in as an argument to the gem installer, add in another line with “cucumber”:
<target name="install-gems">
<property name="jruby.home" value="${basedir}"/>
<java classname="org.jruby.Main" fork="true" maxmemory="${jruby.launch.memory}" failonerror="true">
<classpath refid="build.classpath"/>
<classpath path="${jruby.classes.dir}"/>
<sysproperty key="jruby.home" value="${jruby.home}"/>
<arg value="--command"/>
<arg value="maybe_install_gems"/>
<arg value="rspec"/>
<arg value="rake"/>
<arg value="cucumber"/> <!-- add cucumber -->
<arg value="--env-shebang"/>
</java>
</target>
Then run ant:
$ ant jar-complete
To verify that everything is fine:
$ java -jar lib/jruby-complete.jar -S gem list *** LOCAL GEMS *** builder (2.1.2) cucumber (0.2.3) diff-lcs (1.1.2) polyglot (0.2.5) rake (0.8.4) rspec (1.2.2) sources (0.0.1) term-ansicolor (1.0.3) treetop (1.2.5)
Great we’ve now managed to package jruby-in-a-jar with some additional gems. Now to run cucumber on jruby in eclipse.
The process be praised
Feb 20th
I had an aha moment when I just realized what “people over processes” meant. Read more at the daily WTF!.
The process be praised!
Hitler Does Agile — Are You ?
Feb 20th
Via this link which David pasted on IRC
Hitler doing agile with very few unit tests + no nightly build = no safetynet.
Unfortunately this is quite representative of how a lot of eclipse projects work (ducks to take cover).
Are you builds running in the same way ? Do you write tests before you write code or test manually ? Do you run all the tests before you check in ? Do you have <a href="any CI server to run your builds on a variety of platforms that you support ? Do your unit tests have enough of code coverage to give you the confidence to refactor ? Is your build reproducible on any machine (in less than 5 manual steps) ?
If you’re answering no to any of the above, then this video is for you:
Using Mercurial with Eclipse CVS
Jan 24th
Continuous Integration is a practice where developers frequently integrate their work with others, sometimes multiple times a day. In order to do this, developers do an update-merge-resolve conflict-compile-test-commit, and repeat for best results.
However there are times when you’re making major changes and the ‘commit’ phase in the cycle could break everybody else’s work, but you still need to check in! Here’s how mercurial (or even git) can help:
The EclipseCon website, where do I click ?
Jan 22nd
I logged in into the EclipseCon website to propose a BoF. I wanted to login into the submission system and could not manage to do so after clicking about 4 links and had to open up gmail to pull some links out of my email.
I’d expect a ‘login’ link to be clearly visible on the eclipsecon website.
Here’s what I did:
1. Click on the “Propose a BoF” link
2. Look around for a login link that I can click, nothing
3. There is a ‘register’ link click on that, takes you to the same page
4. Nothing, open gmail and find a link to the submission system
I’ve filed a bug about this. The eclipsecon website could also use some love to improve usability.
How much does your network work ?
Dec 6th
This just made my day!
_________________________________________
/ How much net work could a network work, \
\ if a network could net work? /
-----------------------------------------
\ ^__^
\ (oo)\_______
(__)\ )\/\
||----w |
|| ||
Are you still using subversion 1.4.x ?
Dec 3rd
Given git and mercurial the title should have been “Are you still using subversion?”; but anyway.
SVN 1.5 has been around for a while now, and provides a range of new features that help improve the overall experience and makes SVN suck less.
I’ve opened this bug to request that projects that want to migrate to svn 1.5 at eclipse.org have the option to do so. The existing SVN is running on a SVN 1.4.0. Please drop in your comments on this bug.
SWTBot has moved to eclipse.org!
Dec 3rd
SWTBot has finally moved to eclipse.org.
There is a bit of documentation sitting at the old home that needs to move to eclipse.org. I’m hoping to move this over in the next couple of days.
The sourcecode will also move during the course of the week. I’m busy renaming plugin IDs and packages to use the org.eclipse.swtbot namespace. Meanwhile you can participate on the newsgroups.
Cheers!

