GR8Conf 2011: Grails 1.4 Update by Peter Ledbrook

Post on 17-May-2015

2.425 views 0 download

Tags:

Transcript of GR8Conf 2011: Grails 1.4 Update by Peter Ledbrook

Peter Ledbrook

Grails Update

1Monday, 30 May 2011

Past year

• Grails 1.3 line– Plugins in dependency DSL

• More and more plugins– Spring Security Core et al.– RabbitMQ– Gemfire– Resources, etc.

• noSQL– Redis, MongoDB, Riak, etc.

2

2Monday, 30 May 2011

New users

3

3Monday, 30 May 2011

Grails 1.4

• Groovy 1.8

• Spring 3.1

• Hibernate 3.6

• Tomcat 7

• Prototype => jQuery

4

4Monday, 30 May 2011

Grails 1.4

• Data storage

• Better testing

• User experience

• A better look

• A truly collaborative effort

5

5Monday, 30 May 2011

Grails 1.4

• Data storage

• Better testing

• User experience

• A better look

• A truly collaborative effort

6

6Monday, 30 May 2011

GORM API

• Plugins should not assume Hibernate!

7

7Monday, 30 May 2011

?

SQL database migration

8

Hibernate ‘update’+

Production data=

8Monday, 30 May 2011

SQL database migration

9

Liquibase

Autobase

+Database MigrationPlugin

9Monday, 30 May 2011

SQL database migration

10

Pre-production, Hibernate ‘update’ or ‘create-drop’

dbm-generate-changelogdbm-changelog-sync

Change domain model

dbm-gorm-diffdbm-update

10Monday, 30 May 2011

SQL reverse engineering

11

install-plugin db-reverse-engineer

class Person { String name Integer age ...}

11Monday, 30 May 2011

Other database stuff

• Abstract base domain classes– These now result in a table

• findOrCreateWhere()• findOrSaveWhere()

12

def user = User.findByLogin('admin')if (!user) { user = new User(login: 'admin') user.save(failOnError: true)}

def user = User.findOrSaveWhere(login: 'admin')

12Monday, 30 May 2011

Grails 1.4

• Data storage

• Better testing

• User experience

• A better look

• A truly collaborative effort

13

13Monday, 30 May 2011

Unit testing pre-1.4

• mockDomainClass() had only partial GORM support– always lagged changes in GORM

• Inheritance-based– hierarchy duplicated for Spock– difficult to extend

• Weak support for web-related testing– controllers– tag libraries

14

14Monday, 30 May 2011

The mixin approach

15

class MyControllerUnitTests extends ControllerUnitTestCase { void setUp() { mockDomain(Person, [ new Person(...), new Person(...) ]) }

void testIndex() { def model = this.controller.index() ... }}

15Monday, 30 May 2011

The mixin approach

16

class MyControllerUnitTests { void setUp() { mockDomain(Person, [ new Person(...), new Person(...) ]) }

void testIndex() { def model = this.controller.index() ... }}

16Monday, 30 May 2011

The mixin approach

17

@TestFor(MyController)@Mock(Person)class MyControllerUnitTests { void setUp() { mockDomain(Person, [ new Person(...), new Person(...) ]) }

void testIndex() { def model = this.controller.index() ... }}

17Monday, 30 May 2011

The mixin approach

18

@TestFor(MyController)@Mock(Person)class MyControllerUnitTests { void setUp() { new Person(...).save() new Person(...).save() }

void testIndex() { def model = this.controller.index() ... }}

18Monday, 30 May 2011

The mixin approach (optional)

19

@TestFor(MyController)@Mock(Person)class MyControllerUnitTests { @Before void before() { new Person(...).save() new Person(...).save() }

@Test void indexAction() { def model = this.controller.index() ... }}

19Monday, 30 May 2011

Support for testing...

• Tag libraries• Command objects• XML & JSON responses• File upload• View and template rendering• Filters• URL mappings• Criteria queries• and more!

20

20Monday, 30 May 2011

Grails 1.4

• Data storage

• Better testing

• User experience

• A better look

• A truly collaborative effort

21

21Monday, 30 May 2011

New automatic reloading

• Reloading in run-app works with– Typed service references– Domain classes– src/groovy, src/java

• Any command with -agent• Interactive mode and integration tests?

22

22Monday, 30 May 2011

Plugin portal

23

How many people use each plugin?We don’t know

+ Plugin usage tracking+ Grails usage tracking+ More info about plugins

LicenceDevelopersIssue trackerSCMDependencies (JAR & plugin)

23Monday, 30 May 2011

Other stuff

• Snapshot handling fixed– No need to clear Ivy cache when new snapshot available

• Interactive mode– Eliminate Permgen errors?

• H2 console– Out of the box interrogation of database

• Binary plugins– Plugins as JAR dependencies!

• AST transforms– Use domain classes from Java!– Real ‘errors’ and ‘log’ properties!

• Public methods on controllers == actions

24

24Monday, 30 May 2011

Grails 1.4

• Data storage

• Better testing

• User experience

• A better look

• A truly collaborative effort

25

25Monday, 30 May 2011

26

26Monday, 30 May 2011

Grails 1.4

• Data storage

• Better testing

• User experience

• A better look

• A truly collaborative effort

27

27Monday, 30 May 2011

Contributors

28

Marc Palmer

Resources

28Monday, 30 May 2011

Contributors

29

Rob Fletcher

Scaffolding &jQuery

29Monday, 30 May 2011

Contributors

30

Stéphane Maldini

AST Magic

30Monday, 30 May 2011

Contributors

31

Luke Daley

Snapshot deps & testing

31Monday, 30 May 2011

Contributors

32

Jonathan Pearlin

Maven

32Monday, 30 May 2011

Contributors

33

Kim Betti

JUnit Test Reports

33Monday, 30 May 2011

Contributors

34

34Monday, 30 May 2011

Other contributions

• 60+ pull requests on grails-core• 35+ pull requests on grails-docs• More and more plugins• GitHub for the win!

– grails-core– grails-docs– grails-website– grails-maven– and many, many plugins

35

35Monday, 30 May 2011

Grails in the cloud

36

?

36Monday, 30 May 2011

For the future

• A continued focus on

– Reliability

– User experience

– Modularity

– More cloud

37

37Monday, 30 May 2011

38

Thank you!

Questions?

38Monday, 30 May 2011