SlideShare a Scribd company logo
1 of 54
Download to read offline
2011   9   23
2011   9   23
2011   9   23
JSR241

                • Groovyis an agile, dynamic
                 programming language for the Java
                 Virtual Machine.

                • Groovyincludes features found in
                 Python, Ruby, and Smalltalk, but
                 uses syntax similar to the Java
                 programming language.



2011   9   23
HelloWorld.java

       public class HelloWorld {
         public static void main(String[] args) {
           System.out.println("Hello, World!");
         }
       }




2011   9   23
HelloWorld.groovy

       public class HelloWorld {
         public static void main(String[] args) {
           System.out.println("Hello, World!");
         }
       }


                 Java



2011   9   23
HelloWorld.groovy


                 println "Hello, World!"




2011   9   23
Grails




2011   9   23
2011   9   23
2011   9   23
G*Magazine




2011   9   23
G*Magazine Vol.3




2011   9   23
2011   9   23
2011   9   23
2011   9   23
2011   9   23
2011   9   23
2011   9   23
2011   9   23
2011   9   23
2011   9   23
2011   9   23
2011   9   23
2011   9   23
2011   9   23
2011   9   23
2011   9   23
class Book {

                    String title
                    String isbn

                    static constraints = {
                        title blank:false
                        isbn blank:false, unique:true
                    }
                }


2011   9   23
class Book {

                    static mapWith = 'mongo'

                    String title
                    String isbn

                    static constraints = {
                        title blank:false
                        isbn blank:false, unique:true
                    }
                }

2011   9   23
2011   9   23
2011   9   23
2011   9   23
2011   9   23
2011   9   23
2011   9   23
class FolderService {


                void rename(Long id, String newName) {
                  def folder = Folder.get(id)
                  folder.name = newName
                  folder.save()
                }


                List<Folder> findAll() {
                  Folder.findAll()
                }

           }


2011   9   23
class FolderService {

                @PreAuthorize("hasPermission(#id, 'sample.Folder', admin)")
                void rename(Long id, String newName) {
                  def folder = Folder.get(id)
                  folder.name = newName
                  folder.save()
                }

                @PostFilter("hasPermission(filterObject, read)")
                List<Folder> findAll() {
                  Folder.findAll()
                }

           }


2011   9   23
2011   9   23
2011   9   23
import spock.lang.*

                class HelloSpock extends Specification {

                    def "                  "() {
                        expect:
                        name.size() == length

                        where:
                        name       |   length
                        "Spock"    |   5
                        "Kirk"     |   4
                        "Scotty"   |   6
                    }
                }

2011   9   23
@Test
                public void test() {
                    assert 1 + 1 * 2 == 4
                }


                //
                Assertion failed:

                assert 1 + 1 * 2 == 4
                         |   |   |
                         3   2   false
2011   9   23
2011   9   23
class LoginSpec extends GebSpec {
                  def '          '() {
                        when: '                     '
                        to 'login'
                        at { title == 'Login' }

                        and: '      /               '
                        $('input[name="username"]').value 'username'
                        $('input[name="password"]').value 'password'
                        $('input[name="login_button"]').click()

                        then: '                     '
                        at { title == 'Welcome' }
                    }
                }
2011   9   23
class LoginPage {
             static at = { title == 'Login'}
             static content = {
               username { $('input[name="username"]') }
               password { $('input[name="password"]') }
               loginButton { $('input[name="login_button"]') }
             }
           }




2011   9   23
class LoginSpec extends GebSpec {
                  def '          '() {
                        given: '                '
                        to LoginPage

                        when: '        /        '
                        username = 'username'
                        password = 'password'
                        loginButton.click()

                        then: '                 '
                        at TopPage
                    }
                }
2011   9   23
class LoginSpec extends GebSpec {
         def '          '() {
                given:
                new User(username:'user', password:'pass').save()
                to LoginPage

                when:
                username = 'username'
                password = 'password'
                loginButton.click()

                then:
                at TopPage
            }
       }




2011   9   23
class LoginSpec extends GebSpec {
         def '          '() {
                given:
                fixtureLoader.load {
                    user User, username:'user', password:'pass'
                    admin User, username:'admin', password:'pass'
                }
                to LoginPage

                when:
                username = 'username'
                password = 'password'
                loginButton.click()

                then:
                at TopPage
            }
       }


2011   9   23
2011   9   23
2011   9   23
2011   9   23
2011   9   23
2011   9   23
2011   9   23
2011   9   23

More Related Content

What's hot

Clojure - A new Lisp
Clojure - A new LispClojure - A new Lisp
Clojure - A new Lispelliando dias
 
G*におけるソフトウェアテスト・シーズンIII
G*におけるソフトウェアテスト・シーズンIIIG*におけるソフトウェアテスト・シーズンIII
G*におけるソフトウェアテスト・シーズンIIITakuma Watabiki
 
Apache Commons - Don\'t re-invent the wheel
Apache Commons - Don\'t re-invent the wheelApache Commons - Don\'t re-invent the wheel
Apache Commons - Don\'t re-invent the wheeltcurdt
 
Java 7 Launch Event at LyonJUG, Lyon France. Fork / Join framework and Projec...
Java 7 Launch Event at LyonJUG, Lyon France. Fork / Join framework and Projec...Java 7 Launch Event at LyonJUG, Lyon France. Fork / Join framework and Projec...
Java 7 Launch Event at LyonJUG, Lyon France. Fork / Join framework and Projec...julien.ponge
 
5. Ввод-вывод, доступ к файловой системе
5. Ввод-вывод, доступ к файловой системе5. Ввод-вывод, доступ к файловой системе
5. Ввод-вывод, доступ к файловой системеDEVTYPE
 
JJUG CCC 2011 Spring
JJUG CCC 2011 SpringJJUG CCC 2011 Spring
JJUG CCC 2011 SpringKiyotaka Oku
 
Unit/Integration Testing using Spock
Unit/Integration Testing using SpockUnit/Integration Testing using Spock
Unit/Integration Testing using SpockAnuj Aneja
 
Stubる - Mockingjayを使ったHTTPクライアントのテスト -
Stubる - Mockingjayを使ったHTTPクライアントのテスト -Stubる - Mockingjayを使ったHTTPクライアントのテスト -
Stubる - Mockingjayを使ったHTTPクライアントのテスト -Kenji Tanaka
 
GeeCON Prague 2014 - Metaprogramming with Groovy
GeeCON Prague 2014 - Metaprogramming with GroovyGeeCON Prague 2014 - Metaprogramming with Groovy
GeeCON Prague 2014 - Metaprogramming with GroovyIván López Martín
 
COScheduler In Depth
COScheduler In DepthCOScheduler In Depth
COScheduler In DepthWO Community
 
Core java pract_sem iii
Core java pract_sem iiiCore java pract_sem iii
Core java pract_sem iiiNiraj Bharambe
 
Слава Бобик «NancyFx для самых маленьких»
Слава Бобик «NancyFx для самых маленьких»Слава Бобик «NancyFx для самых маленьких»
Слава Бобик «NancyFx для самых маленьких»SpbDotNet Community
 
What’s new in C# 6
What’s new in C# 6What’s new in C# 6
What’s new in C# 6Fiyaz Hasan
 

What's hot (20)

Clojure - A new Lisp
Clojure - A new LispClojure - A new Lisp
Clojure - A new Lisp
 
G*におけるソフトウェアテスト・シーズンIII
G*におけるソフトウェアテスト・シーズンIIIG*におけるソフトウェアテスト・シーズンIII
G*におけるソフトウェアテスト・シーズンIII
 
Apache Commons - Don\'t re-invent the wheel
Apache Commons - Don\'t re-invent the wheelApache Commons - Don\'t re-invent the wheel
Apache Commons - Don\'t re-invent the wheel
 
Java 7 Launch Event at LyonJUG, Lyon France. Fork / Join framework and Projec...
Java 7 Launch Event at LyonJUG, Lyon France. Fork / Join framework and Projec...Java 7 Launch Event at LyonJUG, Lyon France. Fork / Join framework and Projec...
Java 7 Launch Event at LyonJUG, Lyon France. Fork / Join framework and Projec...
 
Java 7 LavaJUG
Java 7 LavaJUGJava 7 LavaJUG
Java 7 LavaJUG
 
5. Ввод-вывод, доступ к файловой системе
5. Ввод-вывод, доступ к файловой системе5. Ввод-вывод, доступ к файловой системе
5. Ввод-вывод, доступ к файловой системе
 
JJUG CCC 2011 Spring
JJUG CCC 2011 SpringJJUG CCC 2011 Spring
JJUG CCC 2011 Spring
 
Unit/Integration Testing using Spock
Unit/Integration Testing using SpockUnit/Integration Testing using Spock
Unit/Integration Testing using Spock
 
Stubる - Mockingjayを使ったHTTPクライアントのテスト -
Stubる - Mockingjayを使ったHTTPクライアントのテスト -Stubる - Mockingjayを使ったHTTPクライアントのテスト -
Stubる - Mockingjayを使ったHTTPクライアントのテスト -
 
GeeCON Prague 2014 - Metaprogramming with Groovy
GeeCON Prague 2014 - Metaprogramming with GroovyGeeCON Prague 2014 - Metaprogramming with Groovy
GeeCON Prague 2014 - Metaprogramming with Groovy
 
COScheduler In Depth
COScheduler In DepthCOScheduler In Depth
COScheduler In Depth
 
Core java pract_sem iii
Core java pract_sem iiiCore java pract_sem iii
Core java pract_sem iii
 
Java
JavaJava
Java
 
Unit Testing with Foq
Unit Testing with FoqUnit Testing with Foq
Unit Testing with Foq
 
DCN Practical
DCN PracticalDCN Practical
DCN Practical
 
srgoc
srgocsrgoc
srgoc
 
Слава Бобик «NancyFx для самых маленьких»
Слава Бобик «NancyFx для самых маленьких»Слава Бобик «NancyFx для самых маленьких»
Слава Бобик «NancyFx для самых маленьких»
 
Spockを使おう!
Spockを使おう!Spockを使おう!
Spockを使おう!
 
What’s new in C# 6
What’s new in C# 6What’s new in C# 6
What’s new in C# 6
 
Network
NetworkNetwork
Network
 

Viewers also liked

Jenkinsを用いたAndroidアプリビルド作業効率化
Jenkinsを用いたAndroidアプリビルド作業効率化Jenkinsを用いたAndroidアプリビルド作業効率化
Jenkinsを用いたAndroidアプリビルド作業効率化Kenichi Kambara
 
Gradle talk, Javarsovia 2010
Gradle talk, Javarsovia 2010Gradle talk, Javarsovia 2010
Gradle talk, Javarsovia 2010Tomek Kaczanowski
 
The outlineoftestprocess
The outlineoftestprocessThe outlineoftestprocess
The outlineoftestprocesskyon mm
 
Groovy Testing Aug2009
Groovy Testing Aug2009Groovy Testing Aug2009
Groovy Testing Aug2009guest4a266c
 
Groovy 1.8の新機能について
Groovy 1.8の新機能についてGroovy 1.8の新機能について
Groovy 1.8の新機能についてUehara Junji
 
うさぎ組 in G* WorkShop -うさみみの日常-
うさぎ組 in G* WorkShop -うさみみの日常-うさぎ組 in G* WorkShop -うさみみの日常-
うさぎ組 in G* WorkShop -うさみみの日常-kyon mm
 
AgileJapan2010 基調講演:野中郁次郎先生による「実践知のリーダシップ~スクラムと知の場作り」
AgileJapan2010 基調講演:野中郁次郎先生による「実践知のリーダシップ~スクラムと知の場作り」AgileJapan2010 基調講演:野中郁次郎先生による「実践知のリーダシップ~スクラムと知の場作り」
AgileJapan2010 基調講演:野中郁次郎先生による「実践知のリーダシップ~スクラムと知の場作り」Kenji Hiranabe
 
Groovier testing with Spock
Groovier testing with SpockGroovier testing with Spock
Groovier testing with SpockRobert Fletcher
 
Spock Framework 2
Spock Framework 2Spock Framework 2
Spock Framework 2Ismael
 
Gradle a new Generation Build Tool
Gradle a new Generation Build ToolGradle a new Generation Build Tool
Gradle a new Generation Build ToolShinya Mochida
 
Androidリリース作業の効率化(2)
Androidリリース作業の効率化(2)Androidリリース作業の効率化(2)
Androidリリース作業の効率化(2)Kenichi Kambara
 
Spock Framework
Spock FrameworkSpock Framework
Spock FrameworkIsmael
 
Groovy, Transforming Language
Groovy, Transforming LanguageGroovy, Transforming Language
Groovy, Transforming LanguageUehara Junji
 
Jenkinsプラグインの作り方
Jenkinsプラグインの作り方Jenkinsプラグインの作り方
Jenkinsプラグインの作り方Kiyotaka Oku
 
Jenkinsプラグイン開発
Jenkinsプラグイン開発Jenkinsプラグイン開発
Jenkinsプラグイン開発Takahisa Wada
 
レガシーコード改善はじめました 横浜道場
レガシーコード改善はじめました 横浜道場レガシーコード改善はじめました 横浜道場
レガシーコード改善はじめました 横浜道場Hiroyuki Ohnaka
 
Testing Web Applications with GEB
Testing Web Applications with GEBTesting Web Applications with GEB
Testing Web Applications with GEBHoward Lewis Ship
 

Viewers also liked (20)

Jenkinsを用いたAndroidアプリビルド作業効率化
Jenkinsを用いたAndroidアプリビルド作業効率化Jenkinsを用いたAndroidアプリビルド作業効率化
Jenkinsを用いたAndroidアプリビルド作業効率化
 
Gradle talk, Javarsovia 2010
Gradle talk, Javarsovia 2010Gradle talk, Javarsovia 2010
Gradle talk, Javarsovia 2010
 
The outlineoftestprocess
The outlineoftestprocessThe outlineoftestprocess
The outlineoftestprocess
 
Groovy Testing Aug2009
Groovy Testing Aug2009Groovy Testing Aug2009
Groovy Testing Aug2009
 
Groovy 1.8の新機能について
Groovy 1.8の新機能についてGroovy 1.8の新機能について
Groovy 1.8の新機能について
 
うさぎ組 in G* WorkShop -うさみみの日常-
うさぎ組 in G* WorkShop -うさみみの日常-うさぎ組 in G* WorkShop -うさみみの日常-
うさぎ組 in G* WorkShop -うさみみの日常-
 
AgileJapan2010 基調講演:野中郁次郎先生による「実践知のリーダシップ~スクラムと知の場作り」
AgileJapan2010 基調講演:野中郁次郎先生による「実践知のリーダシップ~スクラムと知の場作り」AgileJapan2010 基調講演:野中郁次郎先生による「実践知のリーダシップ~スクラムと知の場作り」
AgileJapan2010 基調講演:野中郁次郎先生による「実践知のリーダシップ~スクラムと知の場作り」
 
Groovier testing with Spock
Groovier testing with SpockGroovier testing with Spock
Groovier testing with Spock
 
Spock Framework 2
Spock Framework 2Spock Framework 2
Spock Framework 2
 
Gradle a new Generation Build Tool
Gradle a new Generation Build ToolGradle a new Generation Build Tool
Gradle a new Generation Build Tool
 
Androidリリース作業の効率化(2)
Androidリリース作業の効率化(2)Androidリリース作業の効率化(2)
Androidリリース作業の効率化(2)
 
Spock Framework
Spock FrameworkSpock Framework
Spock Framework
 
Groovy, Transforming Language
Groovy, Transforming LanguageGroovy, Transforming Language
Groovy, Transforming Language
 
Jenkinsプラグインの作り方
Jenkinsプラグインの作り方Jenkinsプラグインの作り方
Jenkinsプラグインの作り方
 
Hands on the Gradle
Hands on the GradleHands on the Gradle
Hands on the Gradle
 
Jenkins導入ライブ
Jenkins導入ライブJenkins導入ライブ
Jenkins導入ライブ
 
How about Gradle?
How about Gradle?How about Gradle?
How about Gradle?
 
Jenkinsプラグイン開発
Jenkinsプラグイン開発Jenkinsプラグイン開発
Jenkinsプラグイン開発
 
レガシーコード改善はじめました 横浜道場
レガシーコード改善はじめました 横浜道場レガシーコード改善はじめました 横浜道場
レガシーコード改善はじめました 横浜道場
 
Testing Web Applications with GEB
Testing Web Applications with GEBTesting Web Applications with GEB
Testing Web Applications with GEB
 

Similar to Introduction to Groovy and Grails for Java developers

Griffon不定期便〜G*ワークショップ編〜
Griffon不定期便〜G*ワークショップ編〜Griffon不定期便〜G*ワークショップ編〜
Griffon不定期便〜G*ワークショップ編〜Kiyotaka Oku
 
HelsinkiJS meet-up. Dmitry Soshnikov - ECMAScript 6
HelsinkiJS meet-up. Dmitry Soshnikov - ECMAScript 6HelsinkiJS meet-up. Dmitry Soshnikov - ECMAScript 6
HelsinkiJS meet-up. Dmitry Soshnikov - ECMAScript 6Dmitry Soshnikov
 
Implicit parameters, when to use them (or not)!
Implicit parameters, when to use them (or not)!Implicit parameters, when to use them (or not)!
Implicit parameters, when to use them (or not)!Julien Truffaut
 
[2019-07] GraphQL in depth (serverside)
[2019-07] GraphQL in depth (serverside)[2019-07] GraphQL in depth (serverside)
[2019-07] GraphQL in depth (serverside)croquiscom
 
Hidden Treasures of the Python Standard Library
Hidden Treasures of the Python Standard LibraryHidden Treasures of the Python Standard Library
Hidden Treasures of the Python Standard Librarydoughellmann
 
create-netflix-clone-02-server.pdf
create-netflix-clone-02-server.pdfcreate-netflix-clone-02-server.pdf
create-netflix-clone-02-server.pdfShaiAlmog1
 
Java Concurrency Gotchas
Java Concurrency GotchasJava Concurrency Gotchas
Java Concurrency GotchasAlex Miller
 
The Future of JVM Languages
The Future of JVM Languages The Future of JVM Languages
The Future of JVM Languages VictorSzoltysek
 
Use of Apache Commons and Utilities
Use of Apache Commons and UtilitiesUse of Apache Commons and Utilities
Use of Apache Commons and UtilitiesPramod Kumar
 
CodeCamp Iasi 10 march 2012 - Practical Groovy
CodeCamp Iasi 10 march 2012 - Practical GroovyCodeCamp Iasi 10 march 2012 - Practical Groovy
CodeCamp Iasi 10 march 2012 - Practical GroovyCodecamp Romania
 
GR8Conf 2011: Effective Groovy
GR8Conf 2011: Effective GroovyGR8Conf 2011: Effective Groovy
GR8Conf 2011: Effective GroovyGR8Conf
 
ConFess Vienna 2015 - Metaprogramming with Groovy
ConFess Vienna 2015 - Metaprogramming with GroovyConFess Vienna 2015 - Metaprogramming with Groovy
ConFess Vienna 2015 - Metaprogramming with GroovyIván López Martín
 
Closures for Java
Closures for JavaClosures for Java
Closures for Javanextlib
 
Groovy grails types, operators, objects
Groovy grails types, operators, objectsGroovy grails types, operators, objects
Groovy grails types, operators, objectsHusain Dalal
 
FalsyValues. Dmitry Soshnikov - ECMAScript 6
FalsyValues. Dmitry Soshnikov - ECMAScript 6FalsyValues. Dmitry Soshnikov - ECMAScript 6
FalsyValues. Dmitry Soshnikov - ECMAScript 6Dmitry Soshnikov
 

Similar to Introduction to Groovy and Grails for Java developers (20)

Groovy intro for OUDL
Groovy intro for OUDLGroovy intro for OUDL
Groovy intro for OUDL
 
Griffon不定期便〜G*ワークショップ編〜
Griffon不定期便〜G*ワークショップ編〜Griffon不定期便〜G*ワークショップ編〜
Griffon不定期便〜G*ワークショップ編〜
 
HelsinkiJS meet-up. Dmitry Soshnikov - ECMAScript 6
HelsinkiJS meet-up. Dmitry Soshnikov - ECMAScript 6HelsinkiJS meet-up. Dmitry Soshnikov - ECMAScript 6
HelsinkiJS meet-up. Dmitry Soshnikov - ECMAScript 6
 
Implicit parameters, when to use them (or not)!
Implicit parameters, when to use them (or not)!Implicit parameters, when to use them (or not)!
Implicit parameters, when to use them (or not)!
 
Realm to Json & Royal
Realm to Json & RoyalRealm to Json & Royal
Realm to Json & Royal
 
[2019-07] GraphQL in depth (serverside)
[2019-07] GraphQL in depth (serverside)[2019-07] GraphQL in depth (serverside)
[2019-07] GraphQL in depth (serverside)
 
Introduction kot iin
Introduction kot iinIntroduction kot iin
Introduction kot iin
 
Hidden Treasures of the Python Standard Library
Hidden Treasures of the Python Standard LibraryHidden Treasures of the Python Standard Library
Hidden Treasures of the Python Standard Library
 
create-netflix-clone-02-server.pdf
create-netflix-clone-02-server.pdfcreate-netflix-clone-02-server.pdf
create-netflix-clone-02-server.pdf
 
Java Concurrency Gotchas
Java Concurrency GotchasJava Concurrency Gotchas
Java Concurrency Gotchas
 
The Future of JVM Languages
The Future of JVM Languages The Future of JVM Languages
The Future of JVM Languages
 
Use of Apache Commons and Utilities
Use of Apache Commons and UtilitiesUse of Apache Commons and Utilities
Use of Apache Commons and Utilities
 
Ast transformations
Ast transformationsAst transformations
Ast transformations
 
CodeCamp Iasi 10 march 2012 - Practical Groovy
CodeCamp Iasi 10 march 2012 - Practical GroovyCodeCamp Iasi 10 march 2012 - Practical Groovy
CodeCamp Iasi 10 march 2012 - Practical Groovy
 
GR8Conf 2011: Effective Groovy
GR8Conf 2011: Effective GroovyGR8Conf 2011: Effective Groovy
GR8Conf 2011: Effective Groovy
 
ConFess Vienna 2015 - Metaprogramming with Groovy
ConFess Vienna 2015 - Metaprogramming with GroovyConFess Vienna 2015 - Metaprogramming with Groovy
ConFess Vienna 2015 - Metaprogramming with Groovy
 
Presentatie - Introductie in Groovy
Presentatie - Introductie in GroovyPresentatie - Introductie in Groovy
Presentatie - Introductie in Groovy
 
Closures for Java
Closures for JavaClosures for Java
Closures for Java
 
Groovy grails types, operators, objects
Groovy grails types, operators, objectsGroovy grails types, operators, objects
Groovy grails types, operators, objects
 
FalsyValues. Dmitry Soshnikov - ECMAScript 6
FalsyValues. Dmitry Soshnikov - ECMAScript 6FalsyValues. Dmitry Soshnikov - ECMAScript 6
FalsyValues. Dmitry Soshnikov - ECMAScript 6
 

More from Kiyotaka Oku

Osaka Venture Meetup #3
Osaka Venture Meetup #3Osaka Venture Meetup #3
Osaka Venture Meetup #3Kiyotaka Oku
 
巨大不明ビルドの継続的統合を目的とするビルドパイプラインを主軸とした作戦要綱
巨大不明ビルドの継続的統合を目的とするビルドパイプラインを主軸とした作戦要綱巨大不明ビルドの継続的統合を目的とするビルドパイプラインを主軸とした作戦要綱
巨大不明ビルドの継続的統合を目的とするビルドパイプラインを主軸とした作戦要綱Kiyotaka Oku
 
BaseScriptについて
BaseScriptについてBaseScriptについて
BaseScriptについてKiyotaka Oku
 
ミニ四駆ジャパンカップで勝つ方法を考える
ミニ四駆ジャパンカップで勝つ方法を考えるミニ四駆ジャパンカップで勝つ方法を考える
ミニ四駆ジャパンカップで勝つ方法を考えるKiyotaka Oku
 
Jenkins plugin memo
Jenkins plugin memoJenkins plugin memo
Jenkins plugin memoKiyotaka Oku
 
GDK48総選挙の裏側
GDK48総選挙の裏側GDK48総選挙の裏側
GDK48総選挙の裏側Kiyotaka Oku
 
日本Grails/Groovyユーザーグループ
日本Grails/Groovyユーザーグループ日本Grails/Groovyユーザーグループ
日本Grails/GroovyユーザーグループKiyotaka Oku
 
Jenkins and Groovy
Jenkins and GroovyJenkins and Groovy
Jenkins and GroovyKiyotaka Oku
 
とある断片の超動的言語
とある断片の超動的言語とある断片の超動的言語
とある断片の超動的言語Kiyotaka Oku
 
Groovy and-hudson2
Groovy and-hudson2Groovy and-hudson2
Groovy and-hudson2Kiyotaka Oku
 

More from Kiyotaka Oku (20)

Osaka Venture Meetup #3
Osaka Venture Meetup #3Osaka Venture Meetup #3
Osaka Venture Meetup #3
 
巨大不明ビルドの継続的統合を目的とするビルドパイプラインを主軸とした作戦要綱
巨大不明ビルドの継続的統合を目的とするビルドパイプラインを主軸とした作戦要綱巨大不明ビルドの継続的統合を目的とするビルドパイプラインを主軸とした作戦要綱
巨大不明ビルドの継続的統合を目的とするビルドパイプラインを主軸とした作戦要綱
 
BaseScriptについて
BaseScriptについてBaseScriptについて
BaseScriptについて
 
javafx-mini4wd
javafx-mini4wdjavafx-mini4wd
javafx-mini4wd
 
ミニ四駆ジャパンカップで勝つ方法を考える
ミニ四駆ジャパンカップで勝つ方法を考えるミニ四駆ジャパンカップで勝つ方法を考える
ミニ四駆ジャパンカップで勝つ方法を考える
 
Jenkins plugin memo
Jenkins plugin memoJenkins plugin memo
Jenkins plugin memo
 
Spockの基礎
Spockの基礎Spockの基礎
Spockの基礎
 
JUC2012
JUC2012JUC2012
JUC2012
 
GDK48総選挙の裏側
GDK48総選挙の裏側GDK48総選挙の裏側
GDK48総選挙の裏側
 
Jenkins入門
Jenkins入門Jenkins入門
Jenkins入門
 
日本Grails/Groovyユーザーグループ
日本Grails/Groovyユーザーグループ日本Grails/Groovyユーザーグループ
日本Grails/Groovyユーザーグループ
 
GroovyConsole2
GroovyConsole2GroovyConsole2
GroovyConsole2
 
GroovyConsole
GroovyConsoleGroovyConsole
GroovyConsole
 
Devsumi Openjam
Devsumi OpenjamDevsumi Openjam
Devsumi Openjam
 
Jenkins and Groovy
Jenkins and GroovyJenkins and Groovy
Jenkins and Groovy
 
とある断片の超動的言語
とある断片の超動的言語とある断片の超動的言語
とある断片の超動的言語
 
Mote Hudson
Mote HudsonMote Hudson
Mote Hudson
 
Groovy and-hudson2
Groovy and-hudson2Groovy and-hudson2
Groovy and-hudson2
 
Gaelyk
GaelykGaelyk
Gaelyk
 
JDO
JDOJDO
JDO
 

Recently uploaded

Story boards and shot lists for my a level piece
Story boards and shot lists for my a level pieceStory boards and shot lists for my a level piece
Story boards and shot lists for my a level piececharlottematthew16
 
APIForce Zurich 5 April Automation LPDG
APIForce Zurich 5 April  Automation LPDGAPIForce Zurich 5 April  Automation LPDG
APIForce Zurich 5 April Automation LPDGMarianaLemus7
 
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...shyamraj55
 
Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 365Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 3652toLead Limited
 
Vertex AI Gemini Prompt Engineering Tips
Vertex AI Gemini Prompt Engineering TipsVertex AI Gemini Prompt Engineering Tips
Vertex AI Gemini Prompt Engineering TipsMiki Katsuragi
 
costume and set research powerpoint presentation
costume and set research powerpoint presentationcostume and set research powerpoint presentation
costume and set research powerpoint presentationphoebematthew05
 
Developer Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQLDeveloper Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQLScyllaDB
 
"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii Soldatenko"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii SoldatenkoFwdays
 
Human Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsHuman Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsMark Billinghurst
 
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)Mark Simos
 
Understanding the Laravel MVC Architecture
Understanding the Laravel MVC ArchitectureUnderstanding the Laravel MVC Architecture
Understanding the Laravel MVC ArchitecturePixlogix Infotech
 
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024BookNet Canada
 
Powerpoint exploring the locations used in television show Time Clash
Powerpoint exploring the locations used in television show Time ClashPowerpoint exploring the locations used in television show Time Clash
Powerpoint exploring the locations used in television show Time Clashcharlottematthew16
 
SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024Scott Keck-Warren
 
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks..."LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...Fwdays
 
Unraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdfUnraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdfAlex Barbosa Coqueiro
 
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmaticsKotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmaticscarlostorres15106
 
My Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationMy Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationRidwan Fadjar
 

Recently uploaded (20)

Story boards and shot lists for my a level piece
Story boards and shot lists for my a level pieceStory boards and shot lists for my a level piece
Story boards and shot lists for my a level piece
 
APIForce Zurich 5 April Automation LPDG
APIForce Zurich 5 April  Automation LPDGAPIForce Zurich 5 April  Automation LPDG
APIForce Zurich 5 April Automation LPDG
 
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
 
E-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptx
E-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptxE-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptx
E-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptx
 
Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 365Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 365
 
Vertex AI Gemini Prompt Engineering Tips
Vertex AI Gemini Prompt Engineering TipsVertex AI Gemini Prompt Engineering Tips
Vertex AI Gemini Prompt Engineering Tips
 
costume and set research powerpoint presentation
costume and set research powerpoint presentationcostume and set research powerpoint presentation
costume and set research powerpoint presentation
 
Developer Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQLDeveloper Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQL
 
"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii Soldatenko"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii Soldatenko
 
Human Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsHuman Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR Systems
 
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
 
Hot Sexy call girls in Panjabi Bagh 🔝 9953056974 🔝 Delhi escort Service
Hot Sexy call girls in Panjabi Bagh 🔝 9953056974 🔝 Delhi escort ServiceHot Sexy call girls in Panjabi Bagh 🔝 9953056974 🔝 Delhi escort Service
Hot Sexy call girls in Panjabi Bagh 🔝 9953056974 🔝 Delhi escort Service
 
Understanding the Laravel MVC Architecture
Understanding the Laravel MVC ArchitectureUnderstanding the Laravel MVC Architecture
Understanding the Laravel MVC Architecture
 
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
 
Powerpoint exploring the locations used in television show Time Clash
Powerpoint exploring the locations used in television show Time ClashPowerpoint exploring the locations used in television show Time Clash
Powerpoint exploring the locations used in television show Time Clash
 
SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024
 
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks..."LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
 
Unraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdfUnraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdf
 
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmaticsKotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
 
My Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationMy Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 Presentation
 

Introduction to Groovy and Grails for Java developers

  • 1. 2011 9 23
  • 2. 2011 9 23
  • 3. 2011 9 23
  • 4. JSR241 • Groovyis an agile, dynamic programming language for the Java Virtual Machine. • Groovyincludes features found in Python, Ruby, and Smalltalk, but uses syntax similar to the Java programming language. 2011 9 23
  • 5. HelloWorld.java public class HelloWorld { public static void main(String[] args) { System.out.println("Hello, World!"); } } 2011 9 23
  • 6. HelloWorld.groovy public class HelloWorld { public static void main(String[] args) { System.out.println("Hello, World!"); } } Java 2011 9 23
  • 7. HelloWorld.groovy println "Hello, World!" 2011 9 23
  • 8. Grails 2011 9 23
  • 9. 2011 9 23
  • 10. 2011 9 23
  • 13. 2011 9 23
  • 14. 2011 9 23
  • 15. 2011 9 23
  • 16. 2011 9 23
  • 17. 2011 9 23
  • 18. 2011 9 23
  • 19. 2011 9 23
  • 20. 2011 9 23
  • 21. 2011 9 23
  • 22. 2011 9 23
  • 23. 2011 9 23
  • 24. 2011 9 23
  • 25. 2011 9 23
  • 26. 2011 9 23
  • 27. 2011 9 23
  • 28. class Book { String title String isbn static constraints = { title blank:false isbn blank:false, unique:true } } 2011 9 23
  • 29. class Book { static mapWith = 'mongo' String title String isbn static constraints = { title blank:false isbn blank:false, unique:true } } 2011 9 23
  • 30. 2011 9 23
  • 31. 2011 9 23
  • 32. 2011 9 23
  • 33. 2011 9 23
  • 34. 2011 9 23
  • 35. 2011 9 23
  • 36. class FolderService { void rename(Long id, String newName) { def folder = Folder.get(id) folder.name = newName folder.save() } List<Folder> findAll() { Folder.findAll() } } 2011 9 23
  • 37. class FolderService { @PreAuthorize("hasPermission(#id, 'sample.Folder', admin)") void rename(Long id, String newName) { def folder = Folder.get(id) folder.name = newName folder.save() } @PostFilter("hasPermission(filterObject, read)") List<Folder> findAll() { Folder.findAll() } } 2011 9 23
  • 38. 2011 9 23
  • 39. 2011 9 23
  • 40. import spock.lang.* class HelloSpock extends Specification { def " "() { expect: name.size() == length where: name | length "Spock" | 5 "Kirk" | 4 "Scotty" | 6 } } 2011 9 23
  • 41. @Test public void test() { assert 1 + 1 * 2 == 4 } // Assertion failed: assert 1 + 1 * 2 == 4 | | | 3 2 false 2011 9 23
  • 42. 2011 9 23
  • 43. class LoginSpec extends GebSpec { def ' '() { when: ' ' to 'login' at { title == 'Login' } and: ' / ' $('input[name="username"]').value 'username' $('input[name="password"]').value 'password' $('input[name="login_button"]').click() then: ' ' at { title == 'Welcome' } } } 2011 9 23
  • 44. class LoginPage { static at = { title == 'Login'} static content = { username { $('input[name="username"]') } password { $('input[name="password"]') } loginButton { $('input[name="login_button"]') } } } 2011 9 23
  • 45. class LoginSpec extends GebSpec { def ' '() { given: ' ' to LoginPage when: ' / ' username = 'username' password = 'password' loginButton.click() then: ' ' at TopPage } } 2011 9 23
  • 46. class LoginSpec extends GebSpec { def ' '() { given: new User(username:'user', password:'pass').save() to LoginPage when: username = 'username' password = 'password' loginButton.click() then: at TopPage } } 2011 9 23
  • 47. class LoginSpec extends GebSpec { def ' '() { given: fixtureLoader.load { user User, username:'user', password:'pass' admin User, username:'admin', password:'pass' } to LoginPage when: username = 'username' password = 'password' loginButton.click() then: at TopPage } } 2011 9 23
  • 48. 2011 9 23
  • 49. 2011 9 23
  • 50. 2011 9 23
  • 51. 2011 9 23
  • 52. 2011 9 23
  • 53. 2011 9 23
  • 54. 2011 9 23