Load Testing Web Applications with Gatling and Maven

I have written about other performance testing tools for web applications before. Nevertheless I’d like to demonstrate a library for load testing web applications named Gatling in combination with the build tool Maven. Gatling offers a nice Scala DSL, high performance using Akka, Netty and asynchronous IO and plug-ins for all modern build tools. In the following tutorial I’m going to show how to record simulations using an HTTP proxy, rewriting simulations in Scala and running and reporting simulations with Maven. ...

May 6, 2016 · 5 min · 1064 words · Micha Kops

Testing Asynchronous Applications with Java and Awaitility

Writing tests for asynchronous applications has never been much fun as we’re always struggling with the problem how to determine state changes, handle process terminations, dealing with timeouts or failures and stuff like this. Awaitility eases this process for us offering a nice DSL, rich support for languages like Scala or Groovy and an easy-to-use syntax that’s even more fun when using it with Java 8′s lambda expressions. In the following short introduction I’d like to demonstrate writing some tests different scenarios. ...

August 23, 2015 · 6 min · 1143 words · Micha Kops

Creating Grammar Parsers in Java and Scala with Parboiled

Parboiled is a modern. lightweight and easy to use library to parse expression grammars in Java or Scala and in my humble opinion it is perfect for use cases where you need something between regular expressions and a complex parser generator like ANTLR. In the following tutorial we’re going to create a simple grammar to specify a task list and write an implementation of a parser also as unit tests for each grammar rule in Java. ...

January 26, 2014 · 11 min · 2176 words · Micha Kops

Using Apache Camel with Scala and the Camel Scala DSL

Whenever I encounter a situation where I have to mix a blend of different services and endpoints and apply one or more of the traditional enterprise integration patterns then Apache Camel often is my weapon of choice. I simply love how easy it is to set up some datasources, add some routing magic, data transformers, load balancers, content enrichers and enjoy the result. Another thing that I’m beginning to love is Scala and so this is the perfect time to write an article about using Scala and Apache Camel together. ...

February 13, 2013 · 15 min · 3186 words · Micha Kops

A short Introduction to ScalaTest

ScalaTest is an excellent framework to write concise, readable tests for your Scala or Java code with less effort. In addition it integrates well with a variety of frameworks like JUnit, TestNG, Ant, Maven, sbt, ScalaCheck, JMock, EasyMock, Mockito, ScalaMock, Selenium, Eclipse, NetBeans, and IntelliJ. In the following short tutorial we’re going to write some tests using ScalaTest exploring features like rich matchers, BDD syntax support or web tests using Selenium/Webdriver. ...

January 13, 2013 · 7 min · 1346 words · Micha Kops

Aspects of Functional Programming in Java

Functional programming is a trending topic these days and a lot of Java programmers are hot for the features that modern functional programming languages might offer. Waiting for Java 8 and native closure support is a nice thing but for now we’re going to take a look at several Java frameworks that are trying to implement typical structures from those functional languages where possible using the capabilities of the Java language to emulate elements like higher-order-functions, closures, options and others … ...

July 16, 2012 · 16 min · 3233 words · Micha Kops

Snippet: Mixing Scala, Java in a Maven Project

Having just returned from the Atlassian Camp 2012 I just toyed around with Java and Scala and wanted to share the following snippet that demonstrates how to mix code from both languages in a Maven project using the maven-scala-plugin. Setting up the Maven Project First create a new Maven project in your IDE or by running mvn archetype:generate. In the next step, add the dependency for scala-library and the scala maven repositories to your pom.xml and hook the maven-scala-plugin to Maven’s lifecycle. My pom.xml finally looks like this one: ...

March 23, 2012 · 2 min · 327 words · Micha Kops

Misc Snippets

Data Normalizing Formula newVal = (oldVal-min) / (max-min) Ugly Scala Example package com.hascode import scala.collection.mutable.LinkedList object NormalizerExample extends App { val dataSet = LinkedList(1., 6.5, 3., 6.2, 20., 31.2, 50.2, 12., 0.24, 1.224, 2.2, 3.) for ((num, index) <- dataSet.zipWithIndex) { dataSet(index) = (num - dataSet.min) / (dataSet.max - dataSet.min) } println("Normalized: " + dataSet) } Normalized: LinkedList(0.01521216973578863, 0.12921819759798853, 0.05947594797769014, 0.12324029048767723, 0.3982240175619966, 0.6213992163469515, 1.0, 1.0, 0.07531115879828326, 0.40498283261802576, 0.7319742489270387, 1.0)

March 1, 2010 · 1 min · 69 words · Micha Kops

Scala Snippets

SBT – Eclipse Plugin Add to your ~/.sbt/plugins/plugins.sbt addSbtPlugin("com.typesafe.sbteclipse" % "sbteclipse-plugin" % "2.1.1")

March 1, 2010 · 1 min · 13 words · Micha Kops