38
Peter Ledbrook Grails Update 1 Monday, 30 May 2011

GR8Conf 2011: Grails 1.4 Update by Peter Ledbrook

  • Upload
    gr8conf

  • View
    2.423

  • Download
    0

Embed Size (px)

Citation preview

Page 1: GR8Conf 2011: Grails 1.4 Update by Peter Ledbrook

Peter Ledbrook

Grails Update

1Monday, 30 May 2011

Page 2: GR8Conf 2011: Grails 1.4 Update by Peter Ledbrook

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

Page 3: GR8Conf 2011: Grails 1.4 Update by Peter Ledbrook

New users

3

3Monday, 30 May 2011

Page 4: GR8Conf 2011: Grails 1.4 Update by Peter Ledbrook

Grails 1.4

• Groovy 1.8

• Spring 3.1

• Hibernate 3.6

• Tomcat 7

• Prototype => jQuery

4

4Monday, 30 May 2011

Page 5: GR8Conf 2011: Grails 1.4 Update by Peter Ledbrook

Grails 1.4

• Data storage

• Better testing

• User experience

• A better look

• A truly collaborative effort

5

5Monday, 30 May 2011

Page 6: GR8Conf 2011: Grails 1.4 Update by Peter Ledbrook

Grails 1.4

• Data storage

• Better testing

• User experience

• A better look

• A truly collaborative effort

6

6Monday, 30 May 2011

Page 7: GR8Conf 2011: Grails 1.4 Update by Peter Ledbrook

GORM API

• Plugins should not assume Hibernate!

7

7Monday, 30 May 2011

Page 8: GR8Conf 2011: Grails 1.4 Update by Peter Ledbrook

?

SQL database migration

8

Hibernate ‘update’+

Production data=

8Monday, 30 May 2011

Page 9: GR8Conf 2011: Grails 1.4 Update by Peter Ledbrook

SQL database migration

9

Liquibase

Autobase

+Database MigrationPlugin

9Monday, 30 May 2011

Page 10: GR8Conf 2011: Grails 1.4 Update by Peter Ledbrook

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

Page 11: GR8Conf 2011: Grails 1.4 Update by Peter Ledbrook

SQL reverse engineering

11

install-plugin db-reverse-engineer

class Person { String name Integer age ...}

11Monday, 30 May 2011

Page 12: GR8Conf 2011: Grails 1.4 Update by Peter Ledbrook

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

Page 13: GR8Conf 2011: Grails 1.4 Update by Peter Ledbrook

Grails 1.4

• Data storage

• Better testing

• User experience

• A better look

• A truly collaborative effort

13

13Monday, 30 May 2011

Page 14: GR8Conf 2011: Grails 1.4 Update by Peter Ledbrook

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

Page 15: GR8Conf 2011: Grails 1.4 Update by Peter Ledbrook

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

Page 16: GR8Conf 2011: Grails 1.4 Update by Peter Ledbrook

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

Page 17: GR8Conf 2011: Grails 1.4 Update by Peter Ledbrook

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

Page 18: GR8Conf 2011: Grails 1.4 Update by Peter Ledbrook

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

Page 19: GR8Conf 2011: Grails 1.4 Update by Peter Ledbrook

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

Page 20: GR8Conf 2011: Grails 1.4 Update by Peter Ledbrook

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

Page 21: GR8Conf 2011: Grails 1.4 Update by Peter Ledbrook

Grails 1.4

• Data storage

• Better testing

• User experience

• A better look

• A truly collaborative effort

21

21Monday, 30 May 2011

Page 22: GR8Conf 2011: Grails 1.4 Update by Peter Ledbrook

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

Page 23: GR8Conf 2011: Grails 1.4 Update by Peter Ledbrook

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

Page 24: GR8Conf 2011: Grails 1.4 Update by Peter Ledbrook

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

Page 25: GR8Conf 2011: Grails 1.4 Update by Peter Ledbrook

Grails 1.4

• Data storage

• Better testing

• User experience

• A better look

• A truly collaborative effort

25

25Monday, 30 May 2011

Page 26: GR8Conf 2011: Grails 1.4 Update by Peter Ledbrook

26

26Monday, 30 May 2011

Page 27: GR8Conf 2011: Grails 1.4 Update by Peter Ledbrook

Grails 1.4

• Data storage

• Better testing

• User experience

• A better look

• A truly collaborative effort

27

27Monday, 30 May 2011

Page 28: GR8Conf 2011: Grails 1.4 Update by Peter Ledbrook

Contributors

28

Marc Palmer

Resources

28Monday, 30 May 2011

Page 29: GR8Conf 2011: Grails 1.4 Update by Peter Ledbrook

Contributors

29

Rob Fletcher

Scaffolding &jQuery

29Monday, 30 May 2011

Page 30: GR8Conf 2011: Grails 1.4 Update by Peter Ledbrook

Contributors

30

Stéphane Maldini

AST Magic

30Monday, 30 May 2011

Page 31: GR8Conf 2011: Grails 1.4 Update by Peter Ledbrook

Contributors

31

Luke Daley

Snapshot deps & testing

31Monday, 30 May 2011

Page 32: GR8Conf 2011: Grails 1.4 Update by Peter Ledbrook

Contributors

32

Jonathan Pearlin

Maven

32Monday, 30 May 2011

Page 33: GR8Conf 2011: Grails 1.4 Update by Peter Ledbrook

Contributors

33

Kim Betti

JUnit Test Reports

33Monday, 30 May 2011

Page 34: GR8Conf 2011: Grails 1.4 Update by Peter Ledbrook

Contributors

34

34Monday, 30 May 2011

Page 35: GR8Conf 2011: Grails 1.4 Update by Peter Ledbrook

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

Page 36: GR8Conf 2011: Grails 1.4 Update by Peter Ledbrook

Grails in the cloud

36

?

36Monday, 30 May 2011

Page 37: GR8Conf 2011: Grails 1.4 Update by Peter Ledbrook

For the future

• A continued focus on

– Reliability

– User experience

– Modularity

– More cloud

37

37Monday, 30 May 2011

Page 38: GR8Conf 2011: Grails 1.4 Update by Peter Ledbrook

38

Thank you!

Questions?

38Monday, 30 May 2011