Presentation is loading. Please wait.

Presentation is loading. Please wait.

1 Groovy for Java developers and testers How Java developers and testers could use Groovy to increase their efficiency AUGUST 6, 2015.

Similar presentations


Presentation on theme: "1 Groovy for Java developers and testers How Java developers and testers could use Groovy to increase their efficiency AUGUST 6, 2015."— Presentation transcript:

1 1 Groovy for Java developers and testers How Java developers and testers could use Groovy to increase their efficiency AUGUST 6, 2015

2 2 Life Science Department, Saint-Petersburg, Russia Mikhail_Denisov@epam.com Mikhail Denisov Demo project: https://git.epam.com/mikhail_denisov/itweek2015-groovy

3 3 WHY GROOVY? Smooth Java integration. Runs on the JVM, 100% compatible with Java bytecode 1 Concise, familiar and easy to learn syntax (“syntactic sugar”) 3 Dynamic language, with static-typing and static compilation capabilities 4 GDK - the extension to the JDK 5 Metaprogramming (Builders, DSL), functional programming, scripting 6 Supported by many systems and frameworks 2

4 4 AstraZeneca SOA Factory project Over 20 web-services (DB and AD interaction) Service Bus proxy for each service 4 environments: dev, test, preprod, prod 3 regions: Emea, America, Asia 20 * 2 * 3 * 4 = 480 endpoints SOA Factory project

5 5 GROOVY BY EXAMPLES Working with database and files 1 HTML, JSON and XML parsing 2 JSON and XML generation 3 Working with SOAP-service 4 Groovlets 5 Advanced Groovy 6

6 6 Maven POM.xml configuration with Groovy-Eclipse-Compiler http://docs.groovy-lang.org/latest/html/documentation/tools-groovyeclipse.html

7 7 GROOVY BASICS: variables and collections

8 8 GROOVY BASICS: closures and GDK

9 9 GROOVY BASICS: objects and classes

10 10 Working with database and files Case: update database with data from file

11 11 GROOVY TESTS: interface implementation with Map

12 12 HTML parsing with RegExp

13 13 JSON parsing with JsonSlurper, GPath expressions

14 14 JSON parsing with JsonSlurper, GPath expressions

15 15 XML parsing: Google News RSS

16 16 GROOVY METAPROGRAMMING: working with metaClass

17 17 GROOVY METAPROGRAMMING: expanding Java classes

18 18 GROOVY METAPROGRAMMING: missing method interception

19 19 XML GENERATION: class MarkupBuilder

20 20 XML GENERATION: class MarkupBuilder

21 21 JSON GENERATION: class JsonBuilder

22 22 SOAP Web Service interaction with WSLite SOAP WebService “Magic Square” WSDL: http://www.cs.fsu.edu/~engelen/magic.wsdlhttp://www.cs.fsu.edu/~engelen/magic.wsdl Add WSLite to pom.xml

23 23 SOAP Web Service interaction with WSLite

24 24 SOAP Web Service: service MagicSquare.groovy

25 25 SOAP Web Service: test MagicSquareTest.groovy

26 26 Groovlet: display results as HTML page web.xml – add groovy.servlet.GroovyServlet

27 27 Groovlet: display results as HTML page Create script src/main/webapp/scripts/magic1.groovy Build application, run it in the servlet container Browse the link http://localhost:8080/itweek2015-groovy/scripts/magic1.groovyhttp://localhost:8080/itweek2015-groovy/scripts/magic1.groovy Result would be like this

28 28 Groovlet: scripts/magic2.groovy - params,, application, context javax.servlet.ServletContext sessionjavax.servlet.HttpSession requestjavax.servlet.HttpServlet responsejavax.servlet.HttpResponse outresponse.getWriter() Groovlet implicit objects:

29 29 Groovlet: add parameters and HTML markup: results

30 30 Groovlet: script/magic3.groovy - add CSS

31 31 Groovlet: scripts/magic3.groovy - result

32 32 SOAFactory PROJECT UTILS

33 33 SOAFactory PROJECT UTILS

34 34 How many lines are needed to run it as a DSL script? please show the square_root of 1024

35 35

36 36 Case: we have to collect data from many independent sources (collect all jokes about Chuck)

37 37

38 38 Groovy for Java developers and testers Q & A AUGUST 6, 2015


Download ppt "1 Groovy for Java developers and testers How Java developers and testers could use Groovy to increase their efficiency AUGUST 6, 2015."

Similar presentations


Ads by Google