1 groovy for java developers and testers how java developers and testers could use groovy to...
TRANSCRIPT
1
Groovy for Java developers and testers
How Java developers and testers could use Groovy to increase their efficiency
AUGUST 6, 2015
2
• Life Science Department, Saint-Petersburg, Russia
Mikhail Denisov
Demo project: https://git.epam.com/mikhail_denisov/itweek2015-groovy
3
WHY GROOVY?
Smooth Java integration. Runs on the JVM, 100% compatible with Java bytecode1
Concise, familiar and easy to learn syntax (“syntactic sugar”)3
Dynamic language, with static-typing and static compilation capabilities4
GDK - the extension to the JDK5
Metaprogramming (Builders, DSL), functional programming, scripting6
Supported by many systems and frameworks2
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
GROOVY BY EXAMPLES
Working with database and files1
HTML, JSON and XML parsing2
JSON and XML generation3
Working with SOAP-service4
Groovlets5
Advanced Groovy6
6
Maven POM.xml configuration with Groovy-Eclipse-Compiler
http://docs.groovy-lang.org/latest/html/documentation/tools-groovyeclipse.html
22
SOAP Web Service interaction with WSLite
SOAP WebService “Magic Square”
WSDL: http://www.cs.fsu.edu/~engelen/magic.wsdl
Add WSLite to pom.xml
27
Groovlet: display results as HTML page
Create script src/main/webapp/scripts/magic1.groovy
Build application, run it in the servlet containerBrowse the link http://localhost:8080/itweek2015-groovy/scripts/magic1.groovyResult would be like this
28
Groovlet: scripts/magic2.groovy - params, <form>, <table>
application, context
javax.servlet.ServletContext
session javax.servlet.HttpSessionrequest javax.servlet.HttpServletresponse javax.servlet.HttpResponseout response.getWriter()
Groovlet implicit objects:
34
ADVANCED GROOVY: DSL
How many lines are needed to run it as a DSL script?
please show the square_root of 1024
36
ADVANCED GROOVY: GPars
Case: we have to collect data from many independent sources (collect all jokes about Chuck)