The document summarizes Guillaume Laforge's background and expertise in Groovy and JVM technologies. It then provides an overview of the rich Groovy ecosystem, including frameworks like Grails and Griffon for building applications, GPars for concurrency, and tools for testing, building projects, and interacting with web services. Specific examples are given of how to create a simple console application in Griffon and use various concurrency abstractions in GPars.
Vue.js + Django - configuración para desarrollo con webpack y HMRJavier Abadía
Presentación del meetup de Vue.js en Madrid, el 12/Sep/2017 donde explicamos cómo configurar Django y webpack para desarrollar SPAs con Vue.js y backend con Django: incluye configuración de Hot-Module-Reloading, autenticación, API y rutas.
El código de ejemplo se puede encontrar aquí: https://github.com/jabadia/gif_catalog
Basic Tutorial of React for ProgrammersDavid Rodenas
This is the support of a course to teach React programming for Java and C# programmers. It covers from its origins in Facebook til separation of presentational and container components. What is JSX, rules, state, props, refactoring, conditionals, repeats, forms, synchronizing values, composition, and so on.
Django + Vue, JavaScript de 3ª generación para modernizar DjangoJavier Abadía
Slides de la charla que di en la PyConEs 2017 en Cáceres, el 24 de Septiembre.
Explicaba cómo montar un entorno de desarrollo ágil con Django en el back, Vue en el front y webpack para empaquetar el front y proporcionar Hot Module Reloading
Vue.js + Django - configuración para desarrollo con webpack y HMRJavier Abadía
Presentación del meetup de Vue.js en Madrid, el 12/Sep/2017 donde explicamos cómo configurar Django y webpack para desarrollar SPAs con Vue.js y backend con Django: incluye configuración de Hot-Module-Reloading, autenticación, API y rutas.
El código de ejemplo se puede encontrar aquí: https://github.com/jabadia/gif_catalog
Basic Tutorial of React for ProgrammersDavid Rodenas
This is the support of a course to teach React programming for Java and C# programmers. It covers from its origins in Facebook til separation of presentational and container components. What is JSX, rules, state, props, refactoring, conditionals, repeats, forms, synchronizing values, composition, and so on.
Django + Vue, JavaScript de 3ª generación para modernizar DjangoJavier Abadía
Slides de la charla que di en la PyConEs 2017 en Cáceres, el 24 de Septiembre.
Explicaba cómo montar un entorno de desarrollo ágil con Django en el back, Vue en el front y webpack para empaquetar el front y proporcionar Hot Module Reloading
Take a look at what Rails 5 has in store for you. We go through all the new features and improvements across development, testing, caching and much more. So let's dive in.
How to build to do app using vue composition api and vuex 4 with typescriptKaty Slemon
In this tutorial, we will build a to-do app using Vue Composition API & Vuex 4 with Typescript. We will learn and explore Composition API & Options API as well
Writing JavaScript as a hobby and writing JavaScript as a job are two very different things. Learn some common practices for making your JavaScript friendly to a team environment.
Universal JS Web Applications with React - Luciano Mammino - Codemotion Rome ...Luciano Mammino
Since we started to see JS on the server side, the dream of developers has been to reduce the gap and the cost of switch between frontend/backend technologies. Today with Node.js, React and a whole ecosystem of tools, this dream is becoming real! In this talk, I am going to discuss Universal (a.k.a. Isomorphic) JavaScript and present some practical example regarding the significant patterns related to routing, data retrieval and rendering. I will use Node, React, Webpack, Babel and React Router and give you a series of example to get you started easily with this new technology trend.
(interactive slides at http://slides.com/lucianomammino/universal-js-web-applications-with-react-codemotion-rome-2017 )
Although Web and mobile apps are getting more capable every day, often your application makes the most sense on the desktop. In this talk, we’ll look at some recent technologies that have allowed significant desktop apps — like Barnes & Noble’s NOOK Study e-textbook reader, or Adobe’s Brackets IDE — to be written in HTML5 and JavaScript. Projects like the Chromium Embedded Framework, node-webkit, and AppJS provide an excellent native-to-JS bridge. With them in hand, you can bring the full power of the Node.js and front-end ecosystems to bear, while still gaining the advantages of running as a native app.
This is a presentation I prepared for a local meetup. The audience is a mix of web designers and developers who have a wide range of development experience.
«От экспериментов с инфраструктурой до внедрения в продакшен»FDConf
В процессе разработки инструментов для инфраструктурных нужд получилось изучить технологии, которые легли в основу нового стека фронтенд разработки для мобильной версии «Одноклассников».
В результате удалось решить следующие задачи:
— улучшение качества продукта за счёт юнит тестирования и методологии TDD;
— снижение порога входа для новых фронтенд разработчиков;
— автоматизация процессов разработки, сборки и тестирования.
В докладе рассматривается использование следующих технологий: karma, jasmine, webpack, bower и gulp.
Take a look at what Rails 5 has in store for you. We go through all the new features and improvements across development, testing, caching and much more. So let's dive in.
How to build to do app using vue composition api and vuex 4 with typescriptKaty Slemon
In this tutorial, we will build a to-do app using Vue Composition API & Vuex 4 with Typescript. We will learn and explore Composition API & Options API as well
Writing JavaScript as a hobby and writing JavaScript as a job are two very different things. Learn some common practices for making your JavaScript friendly to a team environment.
Universal JS Web Applications with React - Luciano Mammino - Codemotion Rome ...Luciano Mammino
Since we started to see JS on the server side, the dream of developers has been to reduce the gap and the cost of switch between frontend/backend technologies. Today with Node.js, React and a whole ecosystem of tools, this dream is becoming real! In this talk, I am going to discuss Universal (a.k.a. Isomorphic) JavaScript and present some practical example regarding the significant patterns related to routing, data retrieval and rendering. I will use Node, React, Webpack, Babel and React Router and give you a series of example to get you started easily with this new technology trend.
(interactive slides at http://slides.com/lucianomammino/universal-js-web-applications-with-react-codemotion-rome-2017 )
Although Web and mobile apps are getting more capable every day, often your application makes the most sense on the desktop. In this talk, we’ll look at some recent technologies that have allowed significant desktop apps — like Barnes & Noble’s NOOK Study e-textbook reader, or Adobe’s Brackets IDE — to be written in HTML5 and JavaScript. Projects like the Chromium Embedded Framework, node-webkit, and AppJS provide an excellent native-to-JS bridge. With them in hand, you can bring the full power of the Node.js and front-end ecosystems to bear, while still gaining the advantages of running as a native app.
This is a presentation I prepared for a local meetup. The audience is a mix of web designers and developers who have a wide range of development experience.
«От экспериментов с инфраструктурой до внедрения в продакшен»FDConf
В процессе разработки инструментов для инфраструктурных нужд получилось изучить технологии, которые легли в основу нового стека фронтенд разработки для мобильной версии «Одноклассников».
В результате удалось решить следующие задачи:
— улучшение качества продукта за счёт юнит тестирования и методологии TDD;
— снижение порога входа для новых фронтенд разработчиков;
— автоматизация процессов разработки, сборки и тестирования.
В докладе рассматривается использование следующих технологий: karma, jasmine, webpack, bower и gulp.
Gradle is a flexible general purpose build system with a build-by-convention framework a la Maven on top. It uses Apache Ivy under the hood for its dependency management. Its build scripts are written in Groovy.
ClojureScript - Making Front-End development Fun again - John Stevenson - Cod...Codemotion
Front-end development has an amazing assortment of libraries and tools, yet it can seem very complex and doest seem much fun. So we'll live code a ClojureScript application (with a bit of help from Git) and show how development doesn't have to be complex or slow. Through live evaluation, we can build a reactive, functional application. Why not take a look at a well designed language that uses modern functional & reactive concepts for building Front-End apps. You are going to have to trans-pile anyway, so why not use a language, libraries and tooling that is bursting with fun to use.
This talk I will show you the golang project layout and some best practice like as the following:
1. RESTful api and GraphQL
2. Model testing (Postgres, SQLite, MySQL)
3. Software Quality
4. Data Metrics
5. Go Testing
OSGi ecosystems compared on Apache Karaf - Christian Schneidermfrancis
OSGi Community Event 2015
A look at three competing OSGi ecosystems (Declarative Services, Blueprint, CDI). Capabilities of each DI framework. Comparison of support for EE technologies like JPA, Security, SOAP and REST services, UIs. Looking into some of the recent advancements like Aries JPA 2 featuring closure based transactions, JAAS Security, JSP and JSF on OSGi. Attendees will get a good overview about the stacks as well as recommendations where each is most applicable.
Gephi Toolkit Developer Tutorial.
The Gephi Toolkit project package essential modules (Graph, Layout, Filters, IO...) in a standard Java library, which any Java project can use for getting things done. The toolkit is just a single JAR that anyone could reuse.
This tutorial introduce the project, show possibilities and code examples to get started.
Fort de ses 1.7 millions de téléchargements l'an passé, Groovy continue son bonhomme de chemin en tête parmi les langages de programmation alternatifs pour la JVM.
Groovy 2.0, sorti l'an passé, introduisait dans son offre de la modularité, le support de JDK 7 au niveau syntaxique avec "Project Coin" autant qu'au niveau JVM avec l'utilisation d'"invoke dynamic", et proposait des fonctionnalités de typage et de compilation statique.
Groovy 2.1, quant à lui, s'appuie sur ces bases pour compléter le support d'"invoke dynamic" pour plus de performances. Il propose des améliorations permettant de documenter, d'aider les IDEs, et de vérifier statiquement les Domain-Specific Languages construits avec Groovy. Vous pourrez créer des méta-annotations regroupant d'autres annotations, pour éviter l'annotation "hell". Et enfin, vous irez encore plus loin dans la customisation du compilateur !
Accrochez votre ceinture, paré au décollage !
"Groovy 2.0 and beyond" presentation given at the Groovy/Grails eXchange conference.
Video can be seen here:
http://skillsmatter.com/podcast/groovy-grails/keynote-speech
Groovy Domain Specific Languages - SpringOne2GX 2012Guillaume Laforge
Paul King, Andrew Eisenberg and Guillaume Laforge present about implementation of Domain-Specific Languages in Groovy, while at the SpringOne2GX 2012 conference in Washington DC.
Accelerate your Kubernetes clusters with Varnish CachingThijs Feryn
A presentation about the usage and availability of Varnish on Kubernetes. This talk explores the capabilities of Varnish caching and shows how to use the Varnish Helm chart to deploy it to Kubernetes.
This presentation was delivered at K8SUG Singapore. See https://feryn.eu/presentations/accelerate-your-kubernetes-clusters-with-varnish-caching-k8sug-singapore-28-2024 for more details.
LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...DanBrown980551
Do you want to learn how to model and simulate an electrical network from scratch in under an hour?
Then welcome to this PowSyBl workshop, hosted by Rte, the French Transmission System Operator (TSO)!
During the webinar, you will discover the PowSyBl ecosystem as well as handle and study an electrical network through an interactive Python notebook.
PowSyBl is an open source project hosted by LF Energy, which offers a comprehensive set of features for electrical grid modelling and simulation. Among other advanced features, PowSyBl provides:
- A fully editable and extendable library for grid component modelling;
- Visualization tools to display your network;
- Grid simulation tools, such as power flows, security analyses (with or without remedial actions) and sensitivity analyses;
The framework is mostly written in Java, with a Python binding so that Python developers can access PowSyBl functionalities as well.
What you will learn during the webinar:
- For beginners: discover PowSyBl's functionalities through a quick general presentation and the notebook, without needing any expert coding skills;
- For advanced developers: master the skills to efficiently apply PowSyBl functionalities to your real-world scenarios.
The Art of the Pitch: WordPress Relationships and SalesLaura Byrne
Clients don’t know what they don’t know. What web solutions are right for them? How does WordPress come into the picture? How do you make sure you understand scope and timeline? What do you do if sometime changes?
All these questions and more will be explored as we talk about matching clients’ needs with what your agency offers without pulling teeth or pulling your hair out. Practical tips, and strategies for successful relationship building that leads to closing the deal.
Software Delivery At the Speed of AI: Inflectra Invests In AI-Powered QualityInflectra
In this insightful webinar, Inflectra explores how artificial intelligence (AI) is transforming software development and testing. Discover how AI-powered tools are revolutionizing every stage of the software development lifecycle (SDLC), from design and prototyping to testing, deployment, and monitoring.
Learn about:
• The Future of Testing: How AI is shifting testing towards verification, analysis, and higher-level skills, while reducing repetitive tasks.
• Test Automation: How AI-powered test case generation, optimization, and self-healing tests are making testing more efficient and effective.
• Visual Testing: Explore the emerging capabilities of AI in visual testing and how it's set to revolutionize UI verification.
• Inflectra's AI Solutions: See demonstrations of Inflectra's cutting-edge AI tools like the ChatGPT plugin and Azure Open AI platform, designed to streamline your testing process.
Whether you're a developer, tester, or QA professional, this webinar will give you valuable insights into how AI is shaping the future of software delivery.
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...James Anderson
Effective Application Security in Software Delivery lifecycle using Deployment Firewall and DBOM
The modern software delivery process (or the CI/CD process) includes many tools, distributed teams, open-source code, and cloud platforms. Constant focus on speed to release software to market, along with the traditional slow and manual security checks has caused gaps in continuous security as an important piece in the software supply chain. Today organizations feel more susceptible to external and internal cyber threats due to the vast attack surface in their applications supply chain and the lack of end-to-end governance and risk management.
The software team must secure its software delivery process to avoid vulnerability and security breaches. This needs to be achieved with existing tool chains and without extensive rework of the delivery processes. This talk will present strategies and techniques for providing visibility into the true risk of the existing vulnerabilities, preventing the introduction of security issues in the software, resolving vulnerabilities in production environments quickly, and capturing the deployment bill of materials (DBOM).
Speakers:
Bob Boule
Robert Boule is a technology enthusiast with PASSION for technology and making things work along with a knack for helping others understand how things work. He comes with around 20 years of solution engineering experience in application security, software continuous delivery, and SaaS platforms. He is known for his dynamic presentations in CI/CD and application security integrated in software delivery lifecycle.
Gopinath Rebala
Gopinath Rebala is the CTO of OpsMx, where he has overall responsibility for the machine learning and data processing architectures for Secure Software Delivery. Gopi also has a strong connection with our customers, leading design and architecture for strategic implementations. Gopi is a frequent speaker and well-known leader in continuous delivery and integrating security into software delivery.
Slack (or Teams) Automation for Bonterra Impact Management (fka Social Soluti...Jeffrey Haguewood
Sidekick Solutions uses Bonterra Impact Management (fka Social Solutions Apricot) and automation solutions to integrate data for business workflows.
We believe integration and automation are essential to user experience and the promise of efficient work through technology. Automation is the critical ingredient to realizing that full vision. We develop integration products and services for Bonterra Case Management software to support the deployment of automations for a variety of use cases.
This video focuses on the notifications, alerts, and approval requests using Slack for Bonterra Impact Management. The solutions covered in this webinar can also be deployed for Microsoft Teams.
Interested in deploying notification automations for Bonterra Impact Management? Contact us at sales@sidekicksolutionsllc.com to discuss next steps.
Smart TV Buyer Insights Survey 2024 by 91mobiles.pdf91mobiles
91mobiles recently conducted a Smart TV Buyer Insights Survey in which we asked over 3,000 respondents about the TV they own, aspects they look at on a new TV, and their TV buying preferences.
JMeter webinar - integration with InfluxDB and GrafanaRTTS
Watch this recorded webinar about real-time monitoring of application performance. See how to integrate Apache JMeter, the open-source leader in performance testing, with InfluxDB, the open-source time-series database, and Grafana, the open-source analytics and visualization application.
In this webinar, we will review the benefits of leveraging InfluxDB and Grafana when executing load tests and demonstrate how these tools are used to visualize performance metrics.
Length: 30 minutes
Session Overview
-------------------------------------------
During this webinar, we will cover the following topics while demonstrating the integrations of JMeter, InfluxDB and Grafana:
- What out-of-the-box solutions are available for real-time monitoring JMeter tests?
- What are the benefits of integrating InfluxDB and Grafana into the load testing stack?
- Which features are provided by Grafana?
- Demonstration of InfluxDB and Grafana using a practice web application
To view the webinar recording, go to:
https://www.rttsweb.com/jmeter-integration-webinar
2. Guillaume Laforge / @glaforge
• Groovy Project Manager
• Head of Groovy Development
at SpringSource
• Initiator of the Grails framework
• Founder of the Gaelyk toolkit
• Co-author of Groovy in Action
• Member of «Les Cast Codeurs» podcast
• Speaker: JavaOne, QCon, JavaZone, Sun TechDays,
Devoxx, The Spring Experience, SpringOne2GX,
JAX, Dynamic Language World, IJTC, and more...
2
3. The Groovy Ecosystem
• Many projects based on Groovy!
• Serve various purposes:
– build applications (ie. frameworks)
•Grails (web apps), Griffon (Swing apps),
Gaelyk (Google App Engine)
– tame new concurrency paradigms
•GPars (actors, agents, fork/join, map/filter/reduce...)
– enhanced testing
•Easyb (BDD), Spock (BDD&mock), Gmock (mocking)
– help building projects
•Gant (ant sugar), Gradle (adhoc build system)
– web services interaction
•HTTPBuilder (REST), GroovyWS (SOAP)
3
8. Grails (3/4)
• Grails is an MVC web application stack
– Domain classes mapped to datastores (RDBMS, NoSQL)
•Transparent mapping
– Controllers and service classes in Groovy
– GSP (JSP-like template engine), with powerful taglibs
• Smart reloading as you make changes live
• Comes with its own command-line interface
– Creating artifacts, building/testing the project, etc.
8
9. Grails (4/4)
• Hundreds of plugins available (559!)
– Which let you expand your application easily
– Providing functionality you won’t have to implement
– You may hear about ‘Plugin Oriented Architecture’
• Some of the most used ones
– Searchable: add Google-like search interface
– Mail: easily send emails
– Quartz: for your batch jobs
– GraniteDS / Flex Scaffold: use a Flex UI frontend
– Spring Security: authentication / authorization
– and 554 other ones :-)
9
10. Griffon (1/4)
• Griffon is a Grails-like application framework for
developing rich desktop applications
– MVC, DRY, CoC patterns
– Easy threading,
data binding
and observing
– Support in IDEs
– Lost of plugins too!
10
11. Griffon (2/4)
• Let’s create a simple demo console
for executing Groovy scripts
• A data model
import groovy.beans.Bindable
class DemoConsoleModel {
String scriptSource
@Bindable scriptResult
@Bindable boolean enabled = true
}
11
12. Griffon (3/4)
• A controller
class DemoConsoleController {
)
GroovyShell shell = new GroovyShell(
// automatically injected by Griffon
def model, view
def executeScript(evt = null) {
model.enabled = false
doOutside {
rce)
def re sult = shell.evaluate(model.scriptSou
edt {
model.enabled = true
model.scriptResult = result
}
}
}
}
12
15. • Lightweight Groovy toolkit for building and
deploying applications on Google App Engine
– On top of the Groovy servlet
•executing scripts as mere servlets
•for the controllers
– On top of the Groovy template engine
•JSP-flavored templates
•for the views
– Plus lots of sugaring of GAE SDK APIs
14
16. • Don’t miss my Gaelyk presentation!
–Tuesday, 13:00-13:50, Room C1
15
18. GPars (1/6)
• Concurrency library
• Multiple high-level abstractions
– actors
– map / filter / reduce
– fork / join
– asynchronous closures
– agents
– dataflow concurrency
• Can be used with Java!
17
19. GPars (2/6)
• Improving over JSR-166y’s ParallelArray
oin
GParsPool.withPool { // using fork/j
// a map-reduce functional style
def smallestSelfPortrait =
me }
images.parallel.filter { it.contains
.map { it.resize() }
.min { it.sizeInMB }
}
• Asynchronous closures returning Futures
GParsExecutorsPool.withPool { // using JDK executors
// adds callAsync() to closures
assert 6 == { it * 2 }.callAsync(3).get()
}
18
20. GPars (3/6)
• Improving over JSR-166y’s Fork / Join
– Think devide and conquer problems
withPool(2) { pool ->
println "Number of files: " +
file ->
runForkJoin(new File("./src")) { File
long count = 0
file.eachFile {
if (it.isDirectory()) {
t"
println "Forking a child task for $i
// fork a child task
forkOffChild(it)
} else {
count++
}
}
// use results of children tasks
// to calculate and store own result
return count + childrenResults.sum(0)
}
}
19
21. GPars (4/6)
•Actors
loop {
println 'Waiting for a gift'
react { gift ->
if (myWife.likes(gift)) {
reply 'Thank you!'
} else {
reply 'Try again, please'
react { anotherGift ->
if (myChildren.like(anotherGift))
reply 'Thank you!'
}
}
}
}
– (see also dynamic dispatch actors, and more)
20
22. GPars (5/6)
• DataFlow concurrency
new DataFlows().with {
task {
z = x + y
println "Result: ${z.val}"
}
task {
x = 10
}
task {
y = 5
}
}
21
23. GPars (6/6)
•Agents class Conference extends Agent<Intege
r> {
def Conference() { super(0) }
– thread-safe private register(long num) { data += num }
num }
non-blocking pr ivate unregister(long num) { data -=
}
shared ce()
final Agent conference = new Conferen
mutable
// send commands in parallel threads
state final Thread t1 = Thread.start {
wrappers conference << { register 10 }
}
final Thread t2 = Thread.start {
conference << { register 5 }
}
final Thread t3 = Thread.start {
conference << { unregister 3 }
}
[t1, t2, t3]*.join()
assert 12 == conference.val
22
25. Easyb (1/4)
• From the website:
– «Easyb is a behavior driven development (BDD)
framework for the Java platform. By using a specification
based Domain-Specific Language, Easyb aims to enable
executable, yet readable documentation»
• Write specifications in Groovy
• BDD == given / when / then paradigm
• Run them from CLI, Maven, or Ant
– provides various report formats
24
26. Easyb (2/4)
• First, let’s write a story
given "an invalid zip code"
ialized"
an d "given the zipcodevalidator is init
lid zip code"
wh en "validate is invoked with the inva
turn false"
th en "the validator instance should re
25
27. Easyb (3/4)
• Let’s write the test itself
given "an invalid zip code", {
invalidzipcode = "221o1"
}
ialized", {
an d "given the zipcodevalidator is init
zipvalidate = new ZipCodeValidator()
}
lid zip code", {
wh en "validate is invoked with the inva
zipcode)
value = zipvalidate.validate(invalid
}
turn false", {
th en "the validator instance should re
value.shouldBe false
}
• Then write code that makes the test pass
26
28. Easyb (4/4)
• There’s also the specification format
instance", {
before "initialize zipcodevalidator
zipvalidate = new ZipCodeValidator()
}
{
it "should deny invalid zip codes", zip ->
[" 221o1", "2210", "22010-121o"].each {
zipvalidate.validate(zip).is false
}
}
{
it "should accept valid zip codes",
{ zip ->
["22101", "22100", "22010-1210"].each
ue
zipvalidate.validate(zip).shouldBe tr
}
}
27
29. Spock (1/3)
• From the horse’s mouth:
– « Spock is a testing and specification framework for Java
and Groovy applications. What makes it stand out from
the crowd is its beautiful and highly expressive
specification language. »
n {
class HelloSpock extends Specificatio
() {
def "can you figure out what I'm up to?"
expect:
name.size() == size
where:
name | size
"Kirk" | 4
"Spock" | 5
"Scotty" | 6
}
}
28
30. Spock (2/3)
• Extensible (but transparent) use of AST
transformations to «pervert» the Groovy language
– reuse of labels for the BDD actions
• Spock brought Groovy 1.7’s enhanced asserts
Condition not satisfied:
max(a, b) == c
| | | | |
3 1 3 | 2
false
29
31. Spock (3/3)
• Another example of the expressive language
– with powerful mocking capabilities
ce"() {
def "subscribers receive published events at least on
when: publisher.send(event)
nt)
then: (1.._) * subscriber.receive(eve
where: even t << ["started", "paused", "stopped"]
}
30
32. Geb — Browser testing (1/2)
import geb.* • Selenium
Browser.drive("http://google.com/ncr
") { based
assert title == "Google"
field
// enter wikipedia into the search
$("input", name: "q").value("wikipe
dia")
• Usages
// wait for the change to results
page to happen – Web testing
t a new request)
// (google updates the page withou
waitFor { title.endsWith("Google Se
arch") } – Screen
scraping
// is the first link to wikipedia?
def firstLink = $("li.g", 0).find("a
.l")
ia"
– Process
assert firstLink.text() == "Wikiped
automation
// click the link
firstLink.click()
// wait for Google's javascript to
redirect • JQuery-like
// us to Wikipedia
waitFor { title == "Wikipedia" }
syntax for
} matching
31
33. Geb — Browser testing (2/2)
import geb.spock.GebSpec
• Integrated with class MySpec extends GebSpec {
– Spock def "test something"() {
– EasyB when:
go "/help"
– JUnit 3/4 then:
$("h1").text() == "Help"
}
• An example
// base URL to avoid repetition
with Spock String getBaseUrl() {
"http://myapp.com"
}
// chose a specific browser
WebDriver createDriver() {
new FirefoxDriver()
}
}
32
34. GMock (1/3)
• GMock is a mocking framework for Groovy
path/file.txt"))
File mo ckFile = mock(File, constructor("/a/
")
mockFile.getName().returns("file.txt
play {
")
def file = new File("/a/path/file.txt
()
assertEquals "file.txt", file.getName
}
• Mocking capabilities
– method calls – constructor calls
– property access – time matching
– static calls – order matching
– partial mocks – regex method matching
33
38. Groovy’s own AntBuilder
• Groovy comes with a DSL wrapper around Ant
– so you can reuse any Ant trask with a Groovy syntax
new AntBuilder().sequential {
mkdir dir: "target/classes" vy.ant.Groovyc"
taskdef name: "gro ovyc", classname: "org.codehaus.groo
"target/classes", {
groovyc srcdir: "src/main", destdir:
classpath {
fileset dir: "lib", {
include name: "*.jar"
}
pathelement path: "target/classes"
}
debug: "on"
javac source: "1.5", target: "1.5",
}
me.jar", {
jar basedi r: "target/classes", destfile: "jarna
manifest { "My project"
attribute name: "Implementation-Title", value:
value: "1.2.3"
attrib ute name: "Implementation-Version",
}
}
echo "BUILD SUCCESSFUL"
}
37
39. Gant
• Gant is a tool for scripting Ant tasks using Groovy
instead of XML to specify the logic
includeTargets << gant.targets.Clean
]
cleanPattern << ['**/*~', '**/*.bak'
cleanDirectory << 'build'
uff.') {
target(stuff: 'A target to do some st
println 'Stuff'
depends clean
Ant.'
echo message: 'A default message from
otherStuff()
}
other stuff') {
target(otherStuff: 'A target to do some
println 'OtherStuff'
Ant.'
echo message: 'Another message from
clean()
}
setDefaultTarget stuff
38
40. Gradle (1/3)
• Gradle is an enterprise-grade build system
– A very flexible general purpose build tool like Ant
– Switchable, build-by-convention frameworks à la Maven,
for Java, Groovy and Scala projects
–Groovy build scripts
– Powerful support for multi-project builds
– Dependency management based on Ivy
– Full support for existing Maven or Ivy repository infra
– Support for transitive dependency management
– Ant tasks and builds as first class citizens
39
41. Gradle (2/3)
• For example, for a classical Java project
apply plugin: ‘java’
repositories {
mavenCentral()
}
dependencies {
compile group: ‘commons-collection’,
.2’
modu le: ‘commons-collection’, version: ‘3
testCompile group: ‘junit’,
module: ‘junit’, version: ‘4.+’
}
40
42. Gradle (3/3)
• Major projects migrate to Gradle
– Hibernate
– Various SpringSource projects
– Groovy -based projects
•Grails, Groovy, GPars, Gaelyk
– Customers with 200+ multi-projects
41
43. Other build and quality tools
• You can use Ant, Gant, Maven (GMaven plugin) or
Gradle to build your projects
– fits nicely in any existing build and continuous
integration infrastructure
• A few Groovy-friendly tools provide handy metrics
– CodeNarc: provides various rules for static analysis of
your Groovy codebase (style, size, braces, naming...)
– GMetrics: code metrics
– Simian: detects duplication in your Groovy code base
– Cobertura, Clover: give code coverage metrics
42
47. GMetrics (1/2)
• Provides calculations and reporting of size and
complexity metrics
• Calculations
– Cyclomatic complexity
– ABC size and complexity
– Lines per method
– Lines per class
46
51. HTTPBuilder (1/3)
• HTTPBuilder provides a convenient builder API for
complex HTTP requests
)
def http = new HTTP Builder( 'http://ajax.googleapis.com'
http.request(GET, JSON) {
'
uri.path = '/ajax/services/search/web
Hobbes']
ur i.query = [v: '1.0', q: 'Calvin and
refox/3.0.4'
headers.'User- Agent' = 'Mozilla/5.0 Ubuntu/8.10 Fi
response.success = { resp, json ->
println resp.statusLine
json.responseData.results.each { l}"
println " ${ it.titleNoFormatting}: ${it.visibleUr
}
}
}
50
52. HTTPBuilder (2/3)
• Posting to a URL
import groovyx.net.http.HTTPBuilder
pe.URLENC
import static groovyx.net.http.ContentTy
r.com/statuses/' )
de f http = new HTTPBuilder( 'http://twitte
tpbuilder']
def po stBody = [status: 'update!', source: 'ht
tBody,
http.post( path: 'update.xml', body: pos
resp ‐>
requestContentType: URLENC ) {
ine}"
printl n "Tweet response status: ${resp.statusL
200
assert resp.statusLine.statusCode ==
}
51
53. HTTPBuilder (3/3)
• Posting XML content to a URL
http.request(POST, XML) {
body = {
auth {
user 'Bob'
password 'pass'
}
}
}
52
54. GroovyWS (1/4)
« I always feel a bit dirty,
DISCLAIMER speaking about SOAP »
53
55. GroovyWS (2/4)
• Publishing and consuming WS-I
compliant SOAP web services
import groovyx.net.ws.WSClient
def proxy = new WSClient( asmx?WSDL",
"http://www.w3 schools.com/webservices/tempconvert.
this.class.classLoader)
proxy.initialize()
t(0)
def result = proxy.CelsiusToFahrenhei
grees Farhenheit"
println "You are probably freezing at ${result} de
• Can also deal with complex objects
54
56. GroovyWS (3/4)
• Publishing a service
– considering a service
class MathService { }
double add(do uble arg0, double arg1) { arg0 + arg1
g0 }
do uble square(double arg0) { arg0 * ar
}
– publishing the service
import groovyx.net.ws.WSServer
def server = new WSServer() /MathService")
server.setNode(" MathService", "http://localhost:6980
server.start()
55
57. GroovyWS (4/4)
• Make sure to check soapUI
– lets you write SOAP Web Services testing
– using Groovy scripts to define a scenario!
• You’ll feel much less dirty :-)
56
59. Summary
• «Groovy» is way more than just a language!
• It’s also a very rich and active ecosystem!
– Grails, Griffon, Gradle, GPars, Spock, Gaelyk...
58
61. Thanks for your attention!
e
e Laforg velopment
Gu illaum oovy De m
of Gr e@gmail.co
Head laforg
E mail: g glaforge
@
T witter:
• References:
• http://groovy.codehaus.org/
• http://grails.org
• http://gaelyk.appspot.com/
60
62. Images used in this
presentation
Zeus: http://clarte.eu.com/religions/articles/LArtdetrouveretderoberleFeuspirituelmultiplicateur/zeus-greek-mythology-687267_1024_768.jpg
Building: http://www.morguefile.com/archive/display/211651
Announce: http://www.napleswebdesign.net/wp-content/uploads/2009/06/press_release_11.jpg
Processors: http://www.morguefile.com/archive/display/12930
Trafic lights: http://www.flickr.com/photos/mad_house_photography/4440871380/sizes/l/in/photostream/
Bolts: http://www.morguefile.com/archive/display/29038
Web: http://www.morguefile.com/archive/display/137778
Light bulb: https://newsline.llnl.gov/retooling/mar/03.28.08_images/lightBulb.png
Quality metrics: http://www.morguefile.com/archive/display/14314
Duke ok GAE http://weblogs.java.net/blog/felipegaucho/archive/ae_gwt_java.png
Green leaf: http://www.flickr.com/photos/epsos/3384297473/
Jeepers creepers: http://www.flickr.com/photos/27663074@N07/3413698337/
Earth: http://www.flickr.com/photos/wwworks/2222523978/
Trafic light: http://rihancompany.com/var/243/35581-Traffic%20light%20drawing.jpg
Griffon: http://aldaria02.a.l.pic.centerblog.net/lz2levrz.jpg
Soap: http://www.flickr.com/photos/geishaboy500/104137788/
Disclaimer: http://4.bp.blogspot.com/_OyM252mHWvo/TT53ltKn7xI/AAAAAAAAC-A/YUNqmzfwce0/s1600/disclaimer.jpg.png
61