Testing Plugin 0.2 sneakily released (Peter Ledbrook)

, , September 29th, 2008

Peter Ledbrook has “sneakily’ released versions 0.2 and 0.3 of the Grails Testing plugin. You probably have heard about this plugin on the Grails podcast, it promises to make your testing chores a lot easier. The following are excerpts from the announcement made at the grails-user list

Version 0.2

I have released version 0.2 of the testing plugin. This doesn’t
contain either the tag lib stuff or the URL mapping test classes, but
it does include:

  • A bunch of bug fixes
  • getAll() static method for domain classes
  • More render() implementations for controllers
  • Support for mocking command objects
  • Added constructor and “.properties” based data binding
  • “.errors” on domain classes and command objects is a real “Errors” instance
  • save() method calls validate() and adds the new domain instance to
  • the list of test instances
  • “.session” is now an implementation of HttpSession, not a map

svn HEAD contains support for “withFormat” in controllers and it has
basic support for testing tag libraries. Not well tested yet though.
Now all I need is some time to document this stuff.

Version 0.3

Quickly following on, there is now a 0.3 release :)

  • Fixes a bug in ControllerUnitTestCase
  • Supports “withFormat” in controllers
  • Basic support for testing tag libraries, through the new TagLibUnitTestCase

The TagLibUnitTestCase adds an “out”property to the tag, which you can
access and call toString() on to get the content written to the output
writer. It also has support for the render tag - simply check the
“renderArgs” property to find out whether it was called with the right
arguments.

Just thought, if you call “render” more than once in a tag, this won’t
work. For other tags, you will need to do something like:

def tagLibControl = mockFor(MyTagLib)
tagLibControl.demand.link(1..1) { … }

def tagLib = new MyTagLib()
tagLib.myTag([:])

In other words, you’ll have to mock the tag method calls. It supports
the “g.” prefix, but not custom namespaces yet. Any ideas welcome.

Last minute update

Sorry, in the haste to get 0.2 and 0.3 out I think I missed mentioning
a significant change. The validate() method does return a boolean now,
just as it does “in the wild”, i.e. when used in a running
application. You need to access the errors object as you would in
normal code:

def cds2 = new CustomerDataset()
cds2.name = ”
cds2.validate()
assertEquals 1, cds2.errors.errorCount
assertEquals “blank”, cds2.errors[”name”]

The “errors” object on the domain instance is now a proper Spring
Errors instance, but we have overridden property access so that you
can still use notation like “cds2.errors[”name”]” and
“cds2.errors.name”.

You can download the plugin directly from the svn trunk.

Tags: , ,

Griffon has Flown the Coop! (Danno Ferrin)

, , September 29th, 2008

Original Source

Danno Ferrin just announced that Griffon now has its own project space at the Codehaus.

Griffon durring it’s intial development was hosted as a module under the Groovy project. Well, with a public release the time has now come for Griffon to leave the nest and find a new home to roost in.

In addition to it’s own hompage the project has moved the user mailing list and added announcement, development, and code commit mailing lists. Code commits come off of our own subversion depot. The bug tracker has already had a couple of JIRAs posted and closed. And just this weekend continuious integration builds have been wired to run on the remote servers at codehaus (Xvfb FTW).

So what does that mean for you? Same deliverables, just coming from a different address.

Related to this news, some of the builders maintained by the Griffon team will be moving into the Griffon umbrella, these are SwingXBuilder, JideBuilder and GraphicsBuilder. The builders will still be released on their own timeline though and will not require you to link any Griffon runtime library in order to use them, same way as it has been before.

[Editor: mispellings are intentional, they are Danno’s signature].

Tags: , ,

Grails Podcast Episode 67: Newscast for September 27 2008 (Sven Haiges & Glen Smith)

, September 28th, 2008

Original Source

The SoapBox of this episode is about the P6Spy Plugin : P6Spy is an open source framework to support applications that intercept and optionally modify database statements.

Podcast Voicemail: +1 408 3319 118 (you can listen to your recording and skip or record again after presssing #)

Tags: ,

Roundup of Griffon links

, September 23rd, 2008

The following list is a compendium (in chronological order) of Griffon related links. You may notice that half of them are written by Geertjan Wielenga, zone leader at Javalobby and known blogger on such topics as NetBeans, Swing and Groovy. In Geertjan’s own words

It’s not like I’m constantly looking for useful scenarios for Griffon and then blogging about it. It’s more like I keep tripping over them accidentally, all the time. I just can’t help it!

Announcements

First Impressions and how-tos

Tags: ,

Grails and LiquiBase - How to use (Jakob Kuelzer)

, September 19th, 2008

Original Source

Jakob Kuelzer wrote a quick guide about getting LiquiBase working on your Grails project. He starts by describing what is LiquiBase and why it may be a good idea to add it to your project. He then points you to the LiquiBase plugin for Grails download and manual page. From there the story is very similar as to every other Grails plugin. He finishes by giving some useful advice depending on the current state of you project and when to add LiquiBase to it.

LiquiBase is a tool that helps developers to track and apply changes to database schemas. Basically what it does is storing all changes that are made to a database in a special XML file, called a database changelog file. This changelog file can be used to determine if there are any changes between the schema in the changelog file and the schema found in a database. The nice thing about LiquiBase is that it is database neutral so you can use with any database Java is able to connect to, and that are a lot…

But there is more to LiquiBase that just tracking changes. The outstanding feature of LiquiBase is that it is able to migrate data using the information stored in the database changelog file. This doesn’t sound like very much when you are starting a project from scratch, but as soon as you start entering data in your evolving application, you’ll understand. And as every application evolves, this is a feature handy for every developer, especially for Grails developers as Hibernate as ORM basically supports only two modes of operation to handle the database schema (configured via the hibernate.hbm2ddl.auto option): wiping out the database and applying a new schema (called create or create-drop) or attempting to update the schema (simply called update). The update option looks like a good way to go at first but as it turns out it has its drawbacks, especially if there is data in the database.

Tags: ,

Mastering Grails: RESTful Grails (Scott Davis)

, September 19th, 2008

Original Source

Developerworks has published the ninth chapter of Scott’s Mastering Grails series: RESTful Grails.

This month, I’m going to show how your Grails applications can be a source of raw data — specifically, XML — that other Web applications can use. I’d normally describe this as setting up Web services for your Grails application, but the term is loaded with hidden meanings these days. Many people associate Web services with SOAP and a full-blown service-oriented architecture (SOA). Two plug-ins for Grails allow you to expose a SOAP interface to your application if you choose that route. But rather than deal with a specific implementation such as SOAP, I’ll show you how to return Plain Old XML (POX) using an interface based on Representational State Transfer (REST).

When it comes to RESTful Web services, it’s as important to understand the why as much as the how. Roy Fielding’s doctoral dissertation — the source of the REST acronym — outlines two approaches to Web services: one that’s service-oriented and another that’s resource-oriented. Before I show you the code to implement your own RESTful resource-oriented architecture (ROA), I’ll clarify the differences between these two design philosophies, and I’ll discuss the two competing definitions of REST in popular usage. As your reward for taking in all the talk in the first part of this article, you’ll find plenty of Grails code later on.

Scott sheds some light on the SOAP vs REST debacle, which interestingly enough is similar to the “essence vs ceremony” one found in the language arena. After a bit of theory he dives head first into implementing RESTful services with Grails, which is really quite simple. If you are expecting to see tons of configuration, myriads of line of code and probably tools that help you deal with ugly pointy files (a.k.a XML) then you are int for a suprise, no such thing in Grails! This article will walk you over implementing each of the 4 REST verbs (GET, DELETE, POST, PUT) one after the other, while showing possible extension points you may exercise in your application to enhance the end user experience and still keep your a readable codebase. Enjoy!

Tags: ,

Grails Podcast Episode 66: Newscast for Sept 14, 2008 (Sven Haiges & Glen Smith)

, September 15th, 2008

Original Source

The Grails podcast has a new home

New Podcast Feed: http://feeds.grailspodcast.com/grailspodcast

Podcast Voicemail: +1 408 3319 118 (you can listen to your recording and skip or record again after presssing #)

Tags: ,

Grails Remoting Plugin 1.0 released (Peter Ledbrook)

, , September 12th, 2008

Peter Ledbrook has released version 1.0 of the Grails Remoting Plugin [release notes]. As you probable know Grails has no problem producing/consuming XML/JSON data, which can be used as interchange format for almost anything. In the case those formats are not enough to send your data across the wire you can rely on the Spring framework remoting facilities, which is precisely what this plugin offers. The Remoting Plugin makes it a breeze to export and consume services with the following protocols

  • RMI
  • Hessin
  • Burlap
  • HttpInvoker (Spring’s own RMI version over HTTP)

Tags: , ,

Announcing Griffon 0.0 (Danno Ferrin)

, , , September 11th, 2008

Original Source

Swing developers rejoice, the productivity gains and ease of use of a framework like Grails has arrived. The Groovy Swing team is proud to announce the initial release of Griffon, a Grails-like framework for Swing application development. In words of Danno Ferrin, the most prolific contributor to the project:

After over a year of poking and prodding at the various parts of desktop Java the Groovy swing developers are proud to announce the first release of Griffon, a Grails-like tool for Swing development. While not yet industrial strength we felt it was important to put out a release so people can get a feel for what Griffon is and where it will be going. And since all good computer scientists start counting from zero, 0.0 seemed to be the perfect release number.

Griffon Kittens

What are some of the highlights of Griffon?

  • A Grails like build system for desktop apps, including targets to run the application.
  • A directory structure that rewards MVC separation of code.
  • Use of Groovy programming language features to reinforce MVC separation (builders, @Bindable annotation, metaclass method injection, scripts, etc).
  • A view layer based on Groovy’s SwingBuilder, allowing for a declarative layout of GUI code.
  • An infrastructure to allow seamless injection of other widget libraries. JIDE and SwingX are supported out of the box.
  • Automatic packaging and signing for WebStart, Applet, and traditional application deployment.

Why call it Grails-like instead of rails-like? The structure of the directories and some of the design idioms do have a heritage back to Ruby on Rails, but Griffon is more inspired by Grails than it was by Rails. And by “inspired” I mean “taking large chunks of Grails code to bootstrap the codebase” (thanks to the ASL 2.0 this is permissible). Not all Grails features have been brought over yet. Plugins and GORM are two notable standouts that we would like to add in future releases.

To download the current release please visit the wiki page at http://groovy.codehaus.org/Download+Griffon and follow the links. There is also an installation guide and a quick start tutorial on the wiki as well.

Those who attended the ScriptBowl session at JavaOne 2008 got a sneak peek of Griffon in action when Guillaume Laforge presented Greet, a Twitter client, on stage. Later Danno Ferrin did the same on another session. Griffon relies heavily on the conventions set out by Grails, which means any Grails developer will be able to pick up the framework and create Swing applications easily.

Being the initial release expect some rough edges here and there, and as Danno notes, some of the more appealing features of Grails like GORM and the plugin system are not implemented yet. The Griffon project has a mailing list for those interested to participate in the discussion.

Tags: , , ,

Grails Podcast Episode 65: Interview with James Ervin, current Groovy Eclipse Plugin Project Lead (Sven Haiges)

, , , September 10th, 2008

Original Source

In this Grails Podcast Interview with James Ervin we talk about all things Groovy Eclipse Plugin. James is Twittering about the Groovy Eclipse Plugin @GroovyEclipse and also be sure to check out his Blog at http://iacobus.blogspot.com.

If you want to join the Groovy Eclipse Team or would like to provide some kind of sponsorship for this project as a company, mail the Grails Podcast at grailspodcast@gmail.com and we’ll be happy to connect you.

Tags: , , ,