UPGRADING TO GRAILS 2



BRING THE PAIN


Grails 1.3.7 -> 2.0.4

WHOAMI


Ryan Applegate
@rappleg
https://github.com/rappleg

Work for ReachLocal
Grails Developer - 3+ years
Java Background - 7 years

Why Upgrade to 2.0.x?



Better Reloading - JVM Agent
Performance Improvements
New Unit Testing API
Interactive Console
etc...

Why Not?



Major Version Release - Regression?
Large App - grails stats ~ 123k LOC
2 Week Sprints

What could possibly go wrong?
-Scott Vlaminck

Upgrade Docs


http://grails.org/doc/2.0.4/guide/gettingStarted.html
#upgradingFromPreviousVersionsOfGrails


http://pledbrook.github.com/grails-howtos/en/upgradeToGrails2.html


http://naleid.com/blog/2012/05/01/upgrading-to-grails-2-unit-testing/

Let's do This



1 Week Jira Estimate
Download Grails 2.0.4
grails upgrade --force
grails run-app

*headdesk*


The Pain



App Won't Start
20+ Major Breaking Changes
2k+ Test Failures

run-app Gotchas


Unresolved Dependencies - Leaving forked plugins in both BuildConfig and application.properties

OutOfMemoryExceptions - Memory Hog 
-XX:MaxPermSize=512m and Xmx=2G

Logging Convention Changes
service -> services
controller -> controllers
etc...

test-app Gotchas


No matter what you read on Grails blog posts or in the Grails docs JUnit style tests are not fully backwards compatible with Grails 2.


Ugly Truth

Some tests may need to be re-written to use new Mixins if test failures aren't obvious. 

Mixins are your Friend


grails.test.mixin.*

TestFor
TestMixin
Mock
GrailsUnitTestMixin
DomainClassUnitTestMixin
ServiceUnitTestMixin
ControllerUnitTestMixin
...

Test Pollution


Unit Test in Integration Test folder

@TestFor in Integration Test 

  registerMetaClass NOT needed with TestMixins


http://naleid.com/blog/2012/05/22/fixing-grails-
tests-that-pass-in-isolation-but-fail-when-run-as-a- 
suite

Final Thoughts



Juice worth the squeeze


Full Regression is a must
Be ready to potentially re-write unit tests
Grails 2 is a Memory Hog


 Questions?




Slides Available

http://www.rvl.io/rappleg/upgrading-to-grails-2

upgrading to grails 2

By rappleg

upgrading to grails 2

  • 1,893