Netbeans 6.7 Maven and Hudson Demo

Netbeans 6.7 has excellent integration with both Hudson and Maven. This video is a demonstration of creating a web application starting with a Maven project, building in Hudson, and deploying in Tomcat in less than two and a half minutes.

Rant on Testing Darkstar

I have been using the Darkstar server / framework to develop my game, Mooks. I have also been trying to adhere to TDD principles. What makes this difficult is that Darkstar uses a set of static objects to provide access to the model and service layers. While they do provide a way to inject you own services into this static context, when you begin testing different implementations of those services or using different mocks things break in unique ways.

Let’s take the following function
[sourcecode language=”java”]
function ManagedReference getReferenceFromObject(ManagedObject o) {
return Appcontext.getDataManager().createReference(o);
}
[/sourcecode]

This code accesses the static DataManager instance.

Now let’s look at the following two tests:

[sourcecode language=”java”]
@Test(expected=RuntimeException.class)
public void testThrowsException() {
DataManager throwsException = EasyMock.createNiceMock(DataManager.class);
EasyMock.expect(throwsException.createReference(null)).andThrow(new RuntimeException("Expected"));
InternalContext.setDataManager(throwsException)
}
[/sourcecode]

and

[sourcecode language=”java”]
@Test
public void testReturns() {
DataManager returnsNull = EasyMock.createNiceMock(DataManager.class);
EasyMock.expect(returnsNull .createReference(null)).andReturn(null);
InternalContext.setDataManager(returnsNull);
assertIsNull(getReferenceFromObject(null));
}
[/sourcecode]

As long as the tests are running sequentially, this is all fine. Once you run the tests concurrently, it becomes a race as to which DataManager is used. Additionally, if one were to write a bad test that assumed the DataManager being set, it would pass as long as the correct test was run prior to it. This breaks some of the “unitness” of unit tests.

What would be nice if there were a documented way to configure HOW Darkstar does its deserialization and injection into the context in such a way that it will instead inject its managers into the helper layer. Something as simple as Spring’s @Autowired annotation would be sufficient.

Of course part of this rant is just a cry for help, maybe someone somewhere knows how to get better DI into Darkstar and I am just barking up a dead tree.

Google Meetup

Monday July 20, 2009, I attended the Google Meetup at Steel in Midtown Atlanta. My boss had sent out a message about it on Yammer which piqued my curiosity and then sealed my attendance (and this post) with the promise of free food; he sure knows how to motive his part time grad student employees!

The purpose of Google Meetup was for the company to get the feel of the community at large. For the most part, the social media crowd was well-represented with a punkish self employed blogger, a few students, two representatives from Georgia Tech, some sales guys, and a few managers in the audience. Google was represented by an engineer from Atlanta who works on the GWT project, a project manager for Google Search, and a couple of sales/public relations representatives.

The first half of the meetup was an informal meet and greet. The second half was a Q&A session were the Googlers took questions from the audience as well as from questions which had previously been posted on the meet up ad.

The questions generally led to some informative answers, or at least clarifications. The representatives spoke about Chrome, ChromeOS, Android, and the plans and motivations behind the projects. They also explained some of the community initiatives that Google was running such as Google.org and Google 101. One of the common themes in the answers was that the community that Google operates in does affect the company. For instance, the effort to port Android to netbooks by the community led Google to pre-annouce ChromeOS so that the volunteers would not feel like they had been led on.

Overall, I was a little disappointed that the session wasn’t as technology heavy as I had expected. The crowd was typically older and more management or marketing targeted. This may have been a side effect of the event being advertised solely through Meetup and word-of-mouth.