Unit Testing with a GigaSpaceFactoryBean

I was talking to Shay Banon (Gigaspace Software Architect) he mentioned using GigaSpaceFactoryBean for writing gigaspace unit tests. I could find no examples on their site, although I concede it may be there somewhere. This shows post shows a simple example.

He also mentioned using the admin api to do full end to end integration testing.  The admin api has huge potential as its able to control gigaspace containers, deploy into them and collect statistics.  Its a powerful api.

This is documented on their site: http://www.gigaspaces.com/wiki/display/XAP7/Administration+and+Monitoring+API
Continue reading

Digg This
Reddit This
Stumble Now!
Buzz This
Vote on DZone
Share on Facebook
Bookmark this on Delicious
Kick It on DotNetKicks.com
Shout it
Share on LinkedIn
Bookmark this on Technorati
Post on Twitter
Google Buzz (aka. Google Reader)

Gigaspace API design – the GigaSpace write method

Now don’t get me wrong, I like gigaspaces and I am not into bashing someones API for the sake of it.  Take a look at the GigaSpace interface documented in javadoc: http://www.gigaspaces.com/docs/JavaDoc7.1/org/openspaces/core/GigaSpace.html Its time the API was cleaned up.  Take the write method for instance:

<T> LeaseContext<T> write(T entry,
                          long lease,
                          long timeout,
                          int modifiers)
                      throws DataAccessException

These are the things I dislike about it:
Continue reading

Digg This
Reddit This
Stumble Now!
Buzz This
Vote on DZone
Share on Facebook
Bookmark this on Delicious
Kick It on DotNetKicks.com
Shout it
Share on LinkedIn
Bookmark this on Technorati
Post on Twitter
Google Buzz (aka. Google Reader)

TimeUnit use it more of the Time please!

Time for my first blog of the year. Yea! Mind you its a bit small, but then perhaps that is a good thing.

Look at these two setters. Setter methods like the first example are very common. Take a look at the second its so much better. With the second the responsibility to convert is neatly delegated to another class instead of forcing the user of the api to work it out. In addition the programmer can supply hours, minutes or any other that TimeUnit supports.

public void setDuration(long durationInMs) {
    this.duration = durationInMs;
}

public void setDuration(long duration, TimeUnit timeUnit) {
    this.duration = timeUnit.toMillis(duration);
}

TimeUnit was brought to you by: java.util.concurrent.TimeUnit! Its handy, so use it! ;-)

Digg This
Reddit This
Stumble Now!
Buzz This
Vote on DZone
Share on Facebook
Bookmark this on Delicious
Kick It on DotNetKicks.com
Shout it
Share on LinkedIn
Bookmark this on Technorati
Post on Twitter
Google Buzz (aka. Google Reader)