Decrease “Latency” on Grails Builds

This is a tip for those of you dealing with long build times, which for me, is anything greater than about 4 seconds ;)

The problem that those of us with NADD face is the second we are waiting for something to finish, we [alt|cmd]+Tab to a browser and start reading slashdot, rotten tomatoes, daringfireball, or any of a million other sites. Likely, you classify this “quick field trip” as multitasking and because you are so very good at multitasking (despite what all the experts say), you disregard the fact that your build was probably finished 10 minutes ago.
<Read on…>

Grails Newbie Mistakes & Gotchas

Whew, Grails has some gotchas. It is so great for so many reasons. But WOW! There are some time sinks tucked away for you to discover. In the hope of helping others, here is a list of the ones that hit me.
<Read on…>

How to Use Test Files in Grails

I’m embarking, balls-out, on a new project using Grails. I’ll be leveraging a significant portion of our Java codebase and the fact that I can do that,is just plain stellar.

It quickly came time to test out some of the integration. The very first question was how to load resources for testing. E.g., I have a service that handles file uploads. How do I pass it a test file?

The documentation isn’t straightforward on this. In fact, I found the solution attached to a bug report for grails 1.1. It’s pretty simple, once you pull in the spring packages:

import org.springframework.core.io.ClassPathResource
import org.springframework.core.io.Resource

And then in your testXXX() function:

Resource resource = new ClassPathResource("resources/crying-baby.jpg")
def file = resource.getFile()
assert file.exists()

And you are good to go. Note the assert at the end to verify things are working.

SMF: Solr

Setting up Solr was a bit different then the others. Solr’s distribution is multifaceted, containing multiple server examples, client code, as well as, a simple production ready server. So let me start off with a few steps I took in setting up Solr.
<Read on…>