Articles Tagged ‘docker’

Annotation based Kubernetes and Openshift Manifests for Java Applications with ap4k

Thursday, February 28th, 2019

Writing our manifest files for Kubernetes / Openshift often forces us to edit xml, json and yml files by hand.

A new library, ap4k allows to specify metadata for these manifest files directly in our Java code using annotations.

In the following short example I am going to demonstrate how to generate manifest files using Maven and ap4k.

(more…)

Using Throwaway Containers for Integration Testing with Java, JUnit 5 and Testcontainers.

Wednesday, January 30th, 2019

A lot of boilerplate code is written when developers need to test their applications with different connected systems like databases, stream platforms and other collaborators.

Docker allows to handle those dependencies but there is still some glue code required to bind the container’s lifecycle and the configuration to the concrete integration test.

Testcontainers is a testing library that offers lightweight throwaway instances of anything able to run in a Docker container, with bindings to configure the specific containers and also provides wrappers to manage our own custom containers.

In the following short tutorial I am going to demonstrate how to start Apache Kafka as well as a classical Postgresql database from a JUnit 5 integration test.

(more…)

Testing Java Applications for Resilience by Simulating Network Problems with Toxiproxy, JUnit and the Docker Maven Plugin

Sunday, July 29th, 2018

When implementing distributed systems, client-server architectures and simple applications with network related functionalities, everything is fine when we’re in the development or in the testing stage because the network is reliable and the communicating systems are not as stressed as they are in production.

But to sleep well we want to validate how resilient we have implemented our systems, how they behave when the network fails, the latency rises, the bandwidth is limited, connections time out and so on.

In the following tutorial I will demonstrate how to set up a testing environment to simulate different classical network problems with a tool named Toxiproxy and I will show how to integrate it with the well known Java testing stack with Maven and JUnit.

(more…)

Setting up Kafka Brokers for Testing with Kafka-Unit

Wednesday, March 28th, 2018

When writing test for applications that interact with Kafka brokers we often need to setup a decent environment including an instance of Kafka and ZooKeeper.

Though Kafka ships with some classes for testing, setting up a simple testing environment is quite easier with the kafka-unit library that offers JUnit test rule support or a fast programmatic setup within no time.

In the following short example, I’d like to show how create a simple setup using Maven, Surefire and kafka-unit. (more…)

Identity Management, One-Time-Passwords and Two-Factor-Auth with Spring Boot and Keycloak

Sunday, November 26th, 2017

Communicating with  identity and access management systems is a common task for many web-applications exposing secured resources.

Keycloak is an open source software that provides not also such authorization services but also offers a lot of features from Single-Sign-On, Identity-Brokering, Social-Login, User-Federation, multiple client-adapters up to the administration console or support for protocols like OpenID, SAML, OAuth2, Kerberos and more.

I will demonstrate how to integrate a Spring Boot web application with Keycloak and configure an authentication flow that requires a two-factor-authentication with user credentials and also one-time-passwords. (more…)

Continuous Delivery with Bitbucket Cloud and Bitbucket Pipelines

Friday, July 1st, 2016

Atlassian has added a continuous integration service as a new feature to their Bitbucket Cloud product. It’s called Bitbucket Pipelines and it is similar to Travis CI for GitHub offering a nice integration for continuous integration/delivery pipelines for projects hosted on Bitbucket.

It’s still in the beta phase and requires a sign-up but nevertheless I’d like to demonstrate the current state of this service and how easy it is to add scripted pipelines to a project.

(more…)

Search
Categories