greach 2014 sesamestreet grails2 workshop
DESCRIPTION
During this workshop a practical example of a web application will be developed. Its nature will be ludic (based on Sesame Street characters) but complex enough to put into spot the different features of Grails likewise as Domain Classes, Validators, GORM, Controllers, Services, Testing, etc. Everything will be developed using Groovy/Grails Tool Suite. This workshop will cover all the commands necessary from the beginning of the project to its end, as well as the fine settings required to run it properly. The whole point will underline what Grails specific traits are over the other rapid development models in use at the moment. All necessary program code to develop the workshop application will be supplied in advance to the attendants.TRANSCRIPT
![Page 1: Greach 2014 Sesamestreet Grails2 Workshop](https://reader034.vdocuments.site/reader034/viewer/2022052505/5562234cd8b42ad44d8b4e82/html5/thumbnails/1.jpg)
WorkshopCan You tell me how to get to Sesame Street? I wanna be a Grails rookie star there!
Fernando Redondo Ramírez
@pronoide_fer
![Page 2: Greach 2014 Sesamestreet Grails2 Workshop](https://reader034.vdocuments.site/reader034/viewer/2022052505/5562234cd8b42ad44d8b4e82/html5/thumbnails/2.jpg)
Roadmap
• Who am I
• Brief introduction…
• Hands on!
![Page 3: Greach 2014 Sesamestreet Grails2 Workshop](https://reader034.vdocuments.site/reader034/viewer/2022052505/5562234cd8b42ad44d8b4e82/html5/thumbnails/3.jpg)
Whoami
• Entreprenour and Business Manager at Pronoide
since 2003
• Java & Friends Trainer
• Doing things with Java from 1999 on
• Computer Engineer
• Happily married and proud father of two children
who love all Sesase Street stuff
![Page 4: Greach 2014 Sesamestreet Grails2 Workshop](https://reader034.vdocuments.site/reader034/viewer/2022052505/5562234cd8b42ad44d8b4e82/html5/thumbnails/4.jpg)
Brief introduction
- Just another grails workshop (jagw)?
- Yes indeed!, but:
• We’ll leverage grails 2
• We’ll use TDD and we’re goingto do a lot of tests
• We’ll deal with the whole app code
• We won’t do Scaffolding ;)
• No plugins are necessary
![Page 5: Greach 2014 Sesamestreet Grails2 Workshop](https://reader034.vdocuments.site/reader034/viewer/2022052505/5562234cd8b42ad44d8b4e82/html5/thumbnails/5.jpg)
Hands on!
Before start, you have to…
1. Install git in your computerhttp://git-scm.com/book/en/Getting-Started-Installing-Git
2. Install jruby or rubyhttp://jruby.org/getting-startedhttps://www.ruby-lang.org/en/installation/
3. Install git presenter (gem install git_presenter)
4. Download Groovy/Grails Tool Suite 3.4 https://spring.io/tools/ggts/all
5. Start Groovy/Grails Tool Suite 3.4 (GGTS) and choose orcreate a workspace (remember run it with a JDK)
6. Download http://pronoide.com/downloads/greach-workshop-2014.zip and unzip it into workspace folder.
7. Hold on! Please wait me right here…
![Page 6: Greach 2014 Sesamestreet Grails2 Workshop](https://reader034.vdocuments.site/reader034/viewer/2022052505/5562234cd8b42ad44d8b4e82/html5/thumbnails/6.jpg)
Stage I: Create web application
i. Create webapp (create-app sesame-street)
note: it’s no necessary if you choose the git way
![Page 7: Greach 2014 Sesamestreet Grails2 Workshop](https://reader034.vdocuments.site/reader034/viewer/2022052505/5562234cd8b42ad44d8b4e82/html5/thumbnails/7.jpg)
Stage I: Create web application
i. Import webapp (XXXXXXX)
note: it’s compulsory if you choose the git way
![Page 8: Greach 2014 Sesamestreet Grails2 Workshop](https://reader034.vdocuments.site/reader034/viewer/2022052505/5562234cd8b42ad44d8b4e82/html5/thumbnails/8.jpg)
Stage II: Create domain
ii. Create the domain classes (create-domain-class
sesamestreet.Muppet)
![Page 9: Greach 2014 Sesamestreet Grails2 Workshop](https://reader034.vdocuments.site/reader034/viewer/2022052505/5562234cd8b42ad44d8b4e82/html5/thumbnails/9.jpg)
Stage II: Create domain
iii. Define properties, constants, constraints and mappings
![Page 10: Greach 2014 Sesamestreet Grails2 Workshop](https://reader034.vdocuments.site/reader034/viewer/2022052505/5562234cd8b42ad44d8b4e82/html5/thumbnails/10.jpg)
Stage II: Create domain
iv. Let’s refactor and write down a Unit Test
![Page 11: Greach 2014 Sesamestreet Grails2 Workshop](https://reader034.vdocuments.site/reader034/viewer/2022052505/5562234cd8b42ad44d8b4e82/html5/thumbnails/11.jpg)
Stage II: Create domain
v. Run Unit tests (test-app)
![Page 12: Greach 2014 Sesamestreet Grails2 Workshop](https://reader034.vdocuments.site/reader034/viewer/2022052505/5562234cd8b42ad44d8b4e82/html5/thumbnails/12.jpg)
Stage II: Create domain
vi. Write an integration test (create-integration-test ) and
run it (test-app integration:)
![Page 13: Greach 2014 Sesamestreet Grails2 Workshop](https://reader034.vdocuments.site/reader034/viewer/2022052505/5562234cd8b42ad44d8b4e82/html5/thumbnails/13.jpg)
Stage II: Create domain
vii. Let’s change database config and run again (test-app
integration:)
![Page 14: Greach 2014 Sesamestreet Grails2 Workshop](https://reader034.vdocuments.site/reader034/viewer/2022052505/5562234cd8b42ad44d8b4e82/html5/thumbnails/14.jpg)
Stage III: Create business layer
viii. We have to create the service skeleton
(create-service sesamestret.MuppetDiscovery)
![Page 15: Greach 2014 Sesamestreet Grails2 Workshop](https://reader034.vdocuments.site/reader034/viewer/2022052505/5562234cd8b42ad44d8b4e82/html5/thumbnails/15.jpg)
Stage III: Create business layer
ix. Let’s write the unit test first and run it (test-app
-unit sesamestreet.MuppetDiscoveryServiceUnitTests)
![Page 16: Greach 2014 Sesamestreet Grails2 Workshop](https://reader034.vdocuments.site/reader034/viewer/2022052505/5562234cd8b42ad44d8b4e82/html5/thumbnails/16.jpg)
Stage III: Create business layer
x. Implement this service and its logging
![Page 17: Greach 2014 Sesamestreet Grails2 Workshop](https://reader034.vdocuments.site/reader034/viewer/2022052505/5562234cd8b42ad44d8b4e82/html5/thumbnails/17.jpg)
Stage III: Create business layer
xii. create an integration test and run all tests (test-app)
![Page 18: Greach 2014 Sesamestreet Grails2 Workshop](https://reader034.vdocuments.site/reader034/viewer/2022052505/5562234cd8b42ad44d8b4e82/html5/thumbnails/18.jpg)
Stage IV: Create web layer
xiii. Create a controller
(create-controller sesamestreet.MuppetDiscovery)
![Page 19: Greach 2014 Sesamestreet Grails2 Workshop](https://reader034.vdocuments.site/reader034/viewer/2022052505/5562234cd8b42ad44d8b4e82/html5/thumbnails/19.jpg)
Stage IV: Create web layer
xiv. Refactor an write down test unit controller first of all
![Page 20: Greach 2014 Sesamestreet Grails2 Workshop](https://reader034.vdocuments.site/reader034/viewer/2022052505/5562234cd8b42ad44d8b4e82/html5/thumbnails/20.jpg)
Stage IV: Create web layer
xv. Create integration test for controller too!
![Page 21: Greach 2014 Sesamestreet Grails2 Workshop](https://reader034.vdocuments.site/reader034/viewer/2022052505/5562234cd8b42ad44d8b4e82/html5/thumbnails/21.jpg)
Stage IV: Create web layer
xvi. Let’s write down the initial GSP page of searches
![Page 22: Greach 2014 Sesamestreet Grails2 Workshop](https://reader034.vdocuments.site/reader034/viewer/2022052505/5562234cd8b42ad44d8b4e82/html5/thumbnails/22.jpg)
Stage IV: Create web layer
xvii. GSP page for the best matched muppet
![Page 23: Greach 2014 Sesamestreet Grails2 Workshop](https://reader034.vdocuments.site/reader034/viewer/2022052505/5562234cd8b42ad44d8b4e82/html5/thumbnails/23.jpg)
Stage IV: Create web layer
xviii. GSP page for no matched muppets
![Page 24: Greach 2014 Sesamestreet Grails2 Workshop](https://reader034.vdocuments.site/reader034/viewer/2022052505/5562234cd8b42ad44d8b4e82/html5/thumbnails/24.jpg)
Stage IV: Create web layer
xix. presentation fine tuning (main.gsp/main.css)
![Page 25: Greach 2014 Sesamestreet Grails2 Workshop](https://reader034.vdocuments.site/reader034/viewer/2022052505/5562234cd8b42ad44d8b4e82/html5/thumbnails/25.jpg)
Stage V: Run Webapp
xx. Start the web application (run-app)
![Page 26: Greach 2014 Sesamestreet Grails2 Workshop](https://reader034.vdocuments.site/reader034/viewer/2022052505/5562234cd8b42ad44d8b4e82/html5/thumbnails/26.jpg)
Stage V: Run Webapp
xxi. Load data and map default controller
![Page 27: Greach 2014 Sesamestreet Grails2 Workshop](https://reader034.vdocuments.site/reader034/viewer/2022052505/5562234cd8b42ad44d8b4e82/html5/thumbnails/27.jpg)
Stage V: Run Webapp
xxii. play with the database
![Page 28: Greach 2014 Sesamestreet Grails2 Workshop](https://reader034.vdocuments.site/reader034/viewer/2022052505/5562234cd8b42ad44d8b4e82/html5/thumbnails/28.jpg)
Stage V: Run Webapp
xxii. play with the webapp
![Page 29: Greach 2014 Sesamestreet Grails2 Workshop](https://reader034.vdocuments.site/reader034/viewer/2022052505/5562234cd8b42ad44d8b4e82/html5/thumbnails/29.jpg)
Extra ball: Spock test!
xxii. configure plugin and run (compile --refresh-depencies)
![Page 30: Greach 2014 Sesamestreet Grails2 Workshop](https://reader034.vdocuments.site/reader034/viewer/2022052505/5562234cd8b42ad44d8b4e82/html5/thumbnails/30.jpg)
Extra ball: Spock test!
xxii. let’s write some specs samples for unit and integration
![Page 31: Greach 2014 Sesamestreet Grails2 Workshop](https://reader034.vdocuments.site/reader034/viewer/2022052505/5562234cd8b42ad44d8b4e82/html5/thumbnails/31.jpg)
Extra ball: Spock test!
xxii. let’s write some specs samples for unit and integration
and run them (test-app :spock)
![Page 32: Greach 2014 Sesamestreet Grails2 Workshop](https://reader034.vdocuments.site/reader034/viewer/2022052505/5562234cd8b42ad44d8b4e82/html5/thumbnails/32.jpg)
We're done!
I wish i would have had this app
4 years ago… Meanwhile at the
time being a new period begins:
Superheroes and fairies, but
that remains for the next year
greach…
![Page 33: Greach 2014 Sesamestreet Grails2 Workshop](https://reader034.vdocuments.site/reader034/viewer/2022052505/5562234cd8b42ad44d8b4e82/html5/thumbnails/33.jpg)
thanks!
• @pronoide_fer
• https://github.com/fredondo/
• http://pronoide.com
• http://blog.pronoide.es