Browsing articles in "Groovy"
Mar
27
2008

MockFor(March): Unit Testing Grails Services

Ok. We’ve had a look at Taglibs and Controllers, it’s time to take a looks at Services. Let’s start with a simple one… My NotificationService gets called when people post new comments. But before we send a notification, we check to see whether notifications are turned on for the blog in question. This requires a little navigation of the object graph… boolean isEmailNotifyActive(Comment comment) { BlogProperty bp = comment.blogEntry.blog.blogProperties?.find { prop -> prop.name == “emailNotify” [...]

Mar
12
2008

MockFor(March): Unit Testing Grails Controllers

Alrighty team, it’s time for a grab-bag of Grails Controller unit testing fragments to get you started. Most of these have been shamelessly stolen from the Graeme’s Grails.org wiki sample code, and spiced up to suit. On the testing board today is our LoginController, since it’s pretty low hanging fruit for simple test cases that showcase the common stuff you’re likely to want to do. Let’s start with the index method, that’s gotta be a [...]

Mar
7
2008

MockFor(March): Unit Testing Grails Taglibs

Alrighty, I’m starting a little series this month exploring Grails unit tests. Some of you guys are already further along this road than me, so if you have smarter ways of doing things, don’t hesitate to add comments. My Grails testing kungfu is pretty white belt. We’re starting the journey with taglibs, since they typically front pretty minimal logic, and often don’t need too much mocking. Probably the only things you *have* to mock out [...]

Mar
5
2008

Hanging out with James Gosling in Canberra

In a very cool set of circumstances I had the chance to hang out with James Gosling this afternoon at a Canberra Q&A session. There were only six of us there, and we had an hour with an open agenda: ask whatever you like! So I did… JAG is one very loveable character. The hardcore software engineer who made it big, changed the world, and still remains a nice guy. I asked him a bunch [...]

Mar
4
2008

MockFor(March): Overcoming Grails testing inertia

A Java guy, Rails guy, and Grails guy walk into a bar… Or so the gag begins… but whatever they talk about, one things for sure, at the end of the day, the Grails guy probably ends up with a bunch of stubs in their tests folder. Well as least I do. It’s weird. I’m mostly an enterprise guy, working at the big end of town. Looking at my test metrics onsite yesterday, I’m pretty [...]

Feb
29
2008

Groovyblogs turns 1!

Well it’s been a year today since Groovyblogs went pens down and a lot of things have happened. In the last year it’s seen: Browser Thumbnails Language Translations Ajax Feed Preview Keyword Filtering and tons more since then… It’s also seem more than the odd outage through either (1) the little one’s affinity with the flashing light on the UPS, or (2) lightening strike (really!), (3) catastrophic server failure of the original whitebox hardware and [...]

Feb
26
2008

G2X Washup: from back in .au

G2X was one sensational event and Jay/Bob/Scott and the boys sure know how to put on a NFJS show. Jay is just one infectious guy who really “gets it” when it comes to what developers are looking for. The food was just sensational, the speaker line-up meant you has “clashing” sessions all the time (where you wanted to go to more than one session in a timeslot, but you don’t implement clone()), and the Grails [...]

Feb
23
2008

G2X: Andy Glover on Gant & BDD

I’ve been meaning to have a look at both Gant and easyb for a while, so I headed off to Andy Glover’s sessions where he had one on each. Gant looks pretty cool. Gives you all the power of Ant, but using Groovy imperatives rather than xml. Very cool for branching and doing other funkyness during the build. You also get Ivy bundled in the mix, so you get Maven-like dependency goodness out of the [...]

Feb
23
2008

G2X Day 1: Graeme’s Keynote

Ok. Gotta blog up some of this stuff before it gets stale. Last night Graeme took us through what’s on the planning on the horizon for Grails 1.1. JPA support. Lot of people asking about this (really?). So there is likely to be a JPA plugin down the track but since JPA doesn’t support Criteria, it’s gonna be a fair bit of work for the team to implement. JSP Taglib in GSPs. You’ll be able [...]

Feb
20
2008

G2X Day 0: Landed

Well it was over 20 hours to get here, but I’m landed in Washington DC ahead of the Groovy Grails Exchange which starts tomorrow morning. I’m going to hopefully blog up a bit of the action while I’m here since my talks aren’t until later in the week. I’ve got to say that Washington is a really beautiful city, and reminds me heaps of Canberra (must be a capital city thing). We’ve been staying a [...]

Glen Smith

About Glen

Co-author Grails in Action