Articles Tagged ‘maven’
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…)
Tags: bom, container, database, db, docker, jdbc, junit, junit5, jupiter, kafka, maven, postgres, tdd, testcontainers, testing
Posted in Java, testing | 2 Comments »
Friday, August 31st, 2018
The OpenAPI and Swagger API description format are becoming important standards to specify API contracts for RESTful web services and the Microservices trend pushes the need for such contracts even further.
Therefore arises the need for software architects, testers and developers to write tests to verify if an exposed API follows such a specified contract.
In the following tutorial I will demonstrate a setup with Java, Maven, JUnit and the designated contract-testing-library, assertj-swagger that verifies the validity of such a contract exposed by a Spring Boot application against a local stored definition.
(more…)
Tags: Api, contract, contract-driven, failsafe, json, junit, maven, openapi, rest, schema, spring-boot, springfox, surefire, swagger, testing, yaml
Posted in Java, Web Services, testing | No Comments »
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…)
Tags: architecture, bandwidth, container, docker, docker-maven, downstream, failsafe, http, http-client, jigsaw, jitter, junit, latency, maven, module, network, resilient, surefire, testing, testrule, toxic, toxiproxy, toxiproxy-cli, upstream, wiremock
Posted in Java, testing | No Comments »
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…)
Tags: Apache, docker, integration-testing, it, junit, kafka, maven, surefire, tdd, testing, testrule, zookeeper
Posted in Java, testing | 1 Comment »
Sunday, January 14th, 2018
Reactive Streams is an initiative trying to standardize asynchronous stream processing with non-blocking back-pressure. With Java 9, new classes in the java.util.concurrent.flow package offer a semantically equivalent counterpart to this standard that may be adopted by other frameworks.
In the following short tutorial we’re implementing examples for reactive streams with Java 9 and the Flow API, with RxJava2, with Akka, with Reactor and finally there is an example in RxJava1, too though it does not follow the standard.
(more…)
Tags: akka, backpressure, consumer, diagramming, flow, flow-api, java9, jdk9, manifesto, maven, plantuml, producer, publisher, reactive, reactivex, reactor, rxjava, rxjava1, rxjava2, streams, subscriber, uml
Posted in Java | 3 Comments »
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…)
Tags: docker, freeotp, identity, kerberos, keycloak, maven, oauth, oauth2, openid, otp, principal, qr, realm, redhat, saml, security, spring, spring-boot, sso, thymeleaf
Posted in Java | No Comments »
Tuesday, October 3rd, 2017
On the one hand adding dependencies to a project is easy, on the other hand securing a project and checking for vulnerable dependencies is way harder.
The OWASP dependency check plugin for Maven allows us to scan our project’s dependencies for know vulnerabilities.
I will demonstrate its usage in the following short example.
(more…)
Tags: check, cvss, defect, maven, nist, nvd, owasp, security, vulerability
Posted in Java | 4 Comments »
Friday, September 8th, 2017
Sometimes I need to resolve Maven dependencies programmatically. Eclipse Aether is a library for working with artifact repositories and I’ll be using it in the following example to read dependency trees from a given POM descriptor file and download each dependency from a remote Maven repository to a local directory.
(more…)
Tags: aether, eclipse, maven, pom, reactor, repository, resolve
Posted in Java | 5 Comments »
Monday, July 3rd, 2017
Maintaining architecture rules and constraints for a specific software project or an application is not easy as textual documentation is easily forgotten after a while and hard to verify.
ArchUnit is a testing library that allows developers and software architects to write down such rules as executable tests that may be run by the development teams and the integration servers.
In the following article I will demonstrate the basic features of this library by applying rules and constraints to an existing application.
(more…)
Tags: architecture, archunit, constraints, cyclic, documentation, junit, maven, rules, surefire, tdd, testing
Posted in Java, testing | 1 Comment »
Tuesday, June 20th, 2017
In our tests we often need to create a bunch of test-objects that are populated with random-data. This data needs to follow specific rules as identifiers need to be unique or must be incremented, string-properties must follow special conventions and so on. In the following short tutorial I will demonstrate how to generate such test data using the Fixture Factory library. (more…)
Tags: data, factory, fake, fixture, junit, maven, mock, surefire, tdd, template, test
Posted in Java, testing | No Comments »
Monday, December 19th, 2016
When important data is written to STDIN/STDOUT and an application relies on specific system properties or environment variables, writing tests is getting more complicated.
System Rules is a collection of JUnit rules that helps us writing Java tests for everything that deals with java.lang.System.
In the following short examples I’d like to demonstrate how to deal with system properties, environment variables, STDOUT and STDERR and capturing both for testing e.g. for some golden master refactoring.
(more…)
Tags: environment, gradle, junit, maven, properties, system, system.in, system.out, tdd, testrule
Posted in Java, testing | No Comments »
Sunday, September 18th, 2016
When it comes to writing microservices in Java, plenty of tools and frameworks exist. In the following tutorial, I’d like to demonstrate another minimalistic framework called Bootique by implementing a simple microservice exposing its functions either as a RESTful web-service or as a runnable command executed using the command line. (more…)
Tags: bootique, cli, command, di, guice, http, jax-rs, jaxrs, jetty, maven, microservice, microservices, rest, yaml
Posted in Java | No Comments »
Tuesday, August 23rd, 2016
When building up search engines, indexing tons of data into a schema-less, distributed data store, Elasticsearch has always been a favourite tool of mine.
In addition to its core features, it also offers tools and documentation for us developers when we need to write integration tests for our Elasticsearch powered Java applications.
In the following tutorial I’d like to demonstrate how to implement a small sample application using Elasticsearch under the hood and how to write integration-tests with these tools for this application afterwards.
(more…)
Tags: cluster, elasticsearch, integration test, it, junit, lucene, maven, node, nosql, search, tdd, testing
Posted in Java, testing | 2 Comments »
Monday, May 16th, 2016
Writing tests not only to verify the behaviour of a web site but also the correctness of its layout especially for responsive websites is not always easy.
Luckily the Galen Framework eases the task of writing layout tests for us, offering a specialized domain-specific-language to write layout-specifications, it integrates well with Selenium Grid, Sauce Labs or BrowserStack, it offers an easy way to deal with different browser sizes and responsive designs and it generates nice, detailed test reports.
In the following tutorial I’m going to implement a JUnit test for the layout of a blog article of mine to demonstrate Galen’s basic features and the integration of it with JUnit and the Maven build tool.
(more…)
Tags: dsl, galen, gui, heatmap, junit, layout, maven, pageobject, report, selenium, specification, tdd, test, testng, webdriver
Posted in Java, testing | 1 Comment »
Friday, May 6th, 2016
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.
(more…)
Tags: gatling, Java, jmeter, load-test, maven, measuring, performance-test, scala, statistics, stress-test, tdd, testing
Posted in testing | No Comments »
Sunday, February 28th, 2016
Generating test suites for existing code allows us to verify the behaviour of an application before we’re making changes to its code base or for regression testing.
In the following short tutorial I’d like to demonstrate how to derive test suites from an existing Java application using EvoSuite and the EvoSuite Maven plug-in.
EvoSuite offers some nice features like running in a sandbox to avoid dangerous operations, virtual file-system and network and optimizing of different coverage criteria.
(more…)
Tags: evosuite, generator, junit, maven, regression, tdd, test, testing
Posted in Java, testing | 4 Comments »
Tuesday, January 5th, 2016
When writing tests for our software components sometimes we need to mock external services based on the HTTP protocol, might it be a RESTful web-service, an XML-RPC call or a simple GET request to some web-server.
In the following short tutorial I’d like to demonstrate how to create a mock HTTP server for testing and how to bootstrap and bind it to the life-cycle of a classical build-management tool like Maven.
(more…)
Tags: fake, http, https, integrationtest, junit, maven, mock, mockserver, rest, server, stub, test, verify
Posted in Java, testing | 3 Comments »
Tuesday, June 16th, 2015
A variety of different tools exists to help us analyze RESTful web-services and create documentations for their APIs in different formats.
In the following tutorial I’d like to demonstrate how to document an existing JAX-RS web-service in multiple formats like Swagger, AsciiDoc or Plain Text using Maven, the JAX-RS Analyzer and the JAX-RS Analyzer Maven Plugin.
The JAX-RS Analyzer gathers its information not only by reflection like most other tools but also by bytecode analysis and therefore does not require us to add special annotations for documentation to our code.
(more…)
Tags: Api, asciidoc, documentation, jax-rs, jaxrs, json, maven, rest, restful, swagger, webservice, ws
Posted in Enterprise, Java, Web Services | No Comments »
Sunday, May 10th, 2015
Mutation testing makes an interesting addition to the classical test coverage metrics.
They seed mutations (errors) into the code, run the project’s tests afterwards and if the tests fail, the mutation is killed – otherwise it lived and we have a possible indication of an issue with our tests.
In the following short tutorial. I’d like to demonstrate how to setup mutation tests with the PIT/Pitest library and Maven and generate reports.
(more…)
Tags: ci, junit, maven, metrics, mutation, pit, pitest, report, reporting, tdd, test, testing
Posted in Java, testing | 3 Comments »
Sunday, January 18th, 2015
When there is the need to create load tests or performance tests for an application, Apache JMeter is a handy tool and set up with ease.
In the following short tutorial I’d like to demonstrate how to configure JMeter to log into a Java EE web application with multiple users specified in a CSV file, how to generate some basic reports and how to integrate JMeter into a mavenized build using the JMeter Maven Plugin.
(more…)
Tags: assertion, authentication, benchmark, benchmarking, gatling, javaee, jmeter, listener, maven, profiling, sampler, test, testing
Posted in Java, testing | 2 Comments »
Sunday, December 28th, 2014
Whether behaviour-driven-development, specification by example or acceptance test driven development is the goal, the Cucumber framework eases our life when we need to establish a link between the non-technical, textual description for a new feature and the tests that prove that the application fulfils these requirements.
In the following short tutorial I’d like to demonstrate how to add Cucumber to a Java project and how to write feature descriptions and test-cases for each step of these descriptions. (more…)
Tags: attd, bdd, cucumber, gherkin, Java, jbehave, maven, sbe, tdd, test, testing
Posted in Java, testing | 23 Comments »
Sunday, December 21st, 2014
Especially when it comes to testing, setting up a decent environment for a secured Java EE web application isn’t always an easy thing to do.
In the following tutorial I’d like to demonstrate how to create a secured web application using form-based authentication and a JDBC realm to fetch users and roles and how to run the application in an embedded container for testing and development.
Additionally I’d like to show how to write and run integration tests to verify the security setup using a setup of Maven, Embedded GlassFish, Arquillian, jUnit and rest-assured.
(more…)
Tags: arquillian, authentication, eclipselink, glassfish, h2, it, javaee, jdbc, jdbcrealm, junit, maven, rest, rest-assured, security, testing
Posted in Enterprise, Java | 1 Comment »
Sunday, November 9th, 2014
Having written two articles about different websocket based chat server implementations in Java, I was recently asked how an implementation of the client side would look like in Java.
That’s why I added this article to demonstrate how to create a websocket chat client applications within a few steps with the Java API for Websocket.
In the following tutorial, we’re going to write a text-based chat client for the console first and afterwards we’re going to program a chat client with a graphical user interface, implemented in JavaFX.
(more…)
Tags: chat, client, fxml, glassfish, java fx, javafx, json, jsr-353, jsr-356, maven, websocket, websockets
Posted in Java, Web | 14 Comments »
Sunday, October 12th, 2014
Apache Camel not only is one of my favourite frameworks ever but it also allows the humble developer to create a full blown chat bot within a few lines of code and using the Camel XMPP component.
In the following tutorial, we’re going to create a simple chat bot and since Atlassian’s HipChat basic plan is now free for unlimited users, we’re using HipChat as our play- and testing ground for the bot.
(more…)
Tags: Apache, Atlassian, camel, chat, config, eip, hipchat, Java, maven, xmpp
Posted in Java | 13 Comments »
Tuesday, June 10th, 2014
When you need to derive meta-models from existing databases and want to create type-safe queries with an elegant, fluent-API, jOOQ definitely is a tool to consider here.
In the following tutorial I’d like to demonstrate how to integrate the jOOQ meta-model generator into a Maven build using the jOOQ Maven Plug-in, the Build Helper Maven Plug-in and Maven profiles to finally create a running application to query an existing RDBMS using such a generated meta-model.
(more…)
Tags: build-helper, generator, jooq, maven, metamodel, model, rdbms, sql
Posted in Java | No Comments »
Wednesday, May 7th, 2014
Recently in a project I encountered the following problem: The development team used Git with a branch-per-feature-like workflow and the integration server, Bamboo in this case, was configured not only to run the integration-tests for the master-branch but also for every change in a feature branch.
As the team developed a Java EE web application ports like 8080 occasionally were already bound and builds failed.
I knew a plug-in for Jenkins CI I to search for available ports and assign them to a build variable but I wanted to control such information directly within the Maven build life-cycle so I searched and finally found Sonatype’s Port Allocator Plug-in for Maven.
In the following short example I’m going to demonstrate how to allocate available random ports in a Maven build and assign them to an embedded servlet container.
(more…)
Tags: allocation, bamboo, ci, jenkins, jetty, maven, port
Posted in Development, Java, Web | 2 Comments »
Sunday, May 4th, 2014
Sometimes in a project there is the need to run tests for your client-side code, written in JavaScript from a Maven build.
One reason might be that Maven manages a complex build life-cycle in your project and you need a close integration for your JavaScript tests, another one might be that you’re in an environment where it is complicated to install and manage additional software like an integration- or build-server.
(more…)
Tags: bdd, devop, ghostdriver, headless, javascript, js, maven, phantomjs, tdd, testing, webdriver, yasmine
Posted in Development, Javascript, Web | 7 Comments »
Saturday, March 8th, 2014
Apache Avro is a serialization framework similar to Google’s Protocol Buffers or Apache Thrift and offering features like rich data structures, a compact binary format, simple integration with dynamic languages and more.
In the following short five minute tutorial, we’re going to specify a schema to serialize books in a JSON format, we’re using the Avro Maven plugin to generate the stub classes and finally we’re serializing the data into a single file.
(more…)
Tags: Apache, avro, google protocol buffers, maven, serialization, thrift
Posted in Java | 4 Comments »
Wednesday, October 16th, 2013
MongoDB is matured, document-oriented, cross-platform NoSQL database system with drivers available for a bunch of different programming languages.
In the following short examples I’m going to write some integration tests for MongoDB using the MongoDB Java driver and the Flapdoodle library to create an embedded MongoDB instance for testing.
We’re going to write tests for a simple persist-and-query scenarion and for a map-reduce function and in addition I’m going to show how to bind the start and stop of a MongoDB instance to a Maven goal using the embedmongo-maven-plugin.
(more…)
Tags: bson, flapdoodle, integration test, Java, json, map-reduce, maven, mongodb, nosql, testing
Posted in Java | 1 Comment »
Tuesday, September 3rd, 2013
The Templating Maven Plugin looks useful if one needs to copy and to filter source files in a project e.g. to add property values from the build environment to a class.
For a short demonstration I’ve added the following short snippet.
(more…)
Tags: filtering, maven, plugin, source, templating
Posted in Development, Java | 1 Comment »
Wednesday, May 29th, 2013
Recently I needed a quick solution to deploy a Java EE 6 web application on a GlassFish instance automatically and subsequent to a successful build of the project on the integration server.
It took only a few steps using Jenkins, Maven and the Cargo plugin and I’d like to share this quick solution with you here.
(more…)
Tags: cargo, cd, continouous deployment, continuous delivery, continuous integration, git, glassfish, hudson, java ee, jee, jenkins, maven
Posted in Development, Enterprise, Java | 3 Comments »
Sunday, April 14th, 2013
One common question that you may encounter one day when using object-relational-mapping in your application is how to slim down data that you’re retrieving from the persistence layer down to a specific subset for your use-case in an efficient manner and without using complex additional mapping frameworks. In some situations you might declare lazy loaded fields but another approach that I’d like to share with you here are JPA2 constructor expressions.
Constructor expressions allow us to create plain old java objects from the result of an JPA query. The advantage is that we may use different projections for different scenarios and without being managed, the POJOs might help us save some resources here.
In the following tutorial, we’re going to persist 100 book entities with multiple properties to an embedded database and we’re using constructor expressions afterwards to create smaller POJOs using a subset of the information available from each persisted book.
(more…)
Tags: criteria api, criteria builder, eclipselink, Java, jpa, jpql, maven, memory, persistence, projection, xml
Posted in Java | No Comments »
Sunday, March 10th, 2013
I recently stumbled upon a nice framework that allows to convert simple JUnit tests into micro benchmarks named JUnitBenchmarks.
It allows to set basic benchmark options and and to generate charts by adding some simple annotations and a test rule to your tests.
One might argue if it is wise to mix the aspects, testing and benchmarking and I’d agree for sure – nevertheless I think this framework can be handy sometimes so let’s create some benchmarks using JUnit and JUnitBenchmarks..
(more…)
Tags: benchmark, gc, Java, junit, maven, warmup
Posted in Java, testing | No Comments »
Thursday, December 6th, 2012
Sometimes we need to classify the tests in a project and a possible solution to achieve this goal is to assign different categories to the tests.
Often we’re doing this to separate the execution of fast-running and long-running tests or to run a specific set of tests that is only applicable in special situations.
To run a specific set of categorized tests there are different options and in the following tutorial we’ll be covering two of them: by configuring the Maven Surefire Plug-in or by using a JUnit Test Suite and the JUnit annotations.
(more…)
Tags: categories, junit, maven, suite, surefire, tdd, testing
Posted in Java, testing | 3 Comments »
Sunday, December 2nd, 2012
Encountering the situation that you want to extract meta-data or content from a file – might it be an office document, a spreadsheet or even a mp3 or an image – or you’d like to detect the content type for a given file then Apache Tika might be a helpful tool for you.
Apache Tika supports a variety of document formats and has a nice, extendable parser and detection API with a lot of built-in parsers available.
(more…)
Tags: Apache, content extraction, formats, Java, lucene, maven, parser, search, tika
Posted in Java | 25 Comments »
Sunday, November 18th, 2012
JUnit is one of the most popular testing frameworks out there. Version 4.11 has just been released and offers some nice improvements that you shouldn’t miss.
(more…)
Tags: hamcrest, junit, matcher, maven, tdd, test, testing
Posted in Java, testing | 4 Comments »
Tuesday, August 28th, 2012
The latest snippet from my Lucene examples demonstrates how to achieve a facet search using the Lucene 4.0 API and how easy it is to define multiple category paths to aggregate search results for different possible facets.
In the following example we’re indexing some books as a classical example and create multiple category paths for author, publication date and category afterwards ..
(more…)
Tags: analyzer, Api, facet, faceting, indexer, lucene, maven, sbt, search, taxonomy
Posted in Java | 1 Comment »
Tuesday, August 7th, 2012
Often in the life of a developer there is the need to create a windows executable for a Java application that is build and packaged in a Jar file.
The following short example shows how to create an executable Jar first and a windows executable containing vendor information, a nice icon and other stuff afterwards by using a combination of the Maven Shade Plugin and the launch4j Plugin for Maven.
(more…)
Tags: assembly, Build, exe, Java, launch4j, maven, plugin, shade, swing, windows
Posted in Java | 4 Comments »
Tuesday, July 31st, 2012
Having written some e-mail handling, sending or receiving library you’d like to run some integration tests against a real mail server?
Then GreenMail might help you out here .. the framework is not quite new on the market but it is really easy to setup IMAP,SMTP or POP3 services with it and it comes with some helpful libraries making your life a bit easier here.
That’s why I’ve come to the idea to share some examples for setting up different server instances, creating user accounts and – at last – fetching and validating e-mails…
(more…)
Tags: gradle, greenmail, imap, imaps, integrationtest, Java, javax.mail, mail, maven, pop3, smtp, smtps, tdd
Posted in Java, testing | 9 Comments »
Monday, July 16th, 2012
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 …
(more…)
Tags: closure, commons-collections, funcito, functional, functional programming, functionaljava, guava, Java, lambda, lambdaj, maven, predicate, scala, transformer
Posted in Development, Java, Scala | 4 Comments »
Friday, June 22nd, 2012
Creating cronjobs or scheduled service executions is made really easy in Java EE 6. Scheduled tasks may be created in a programmatical style or simply by adding some annotations to an EJB.
In the following tutorial we’re creating some simple scheduled tasks and let them run on an embedded GlassFish instance using the Maven Embedded GlassFish plugin..
(more…)
Tags: cron, embedded, Enterprise, glassfish, java ee, jee, maven, quartz, scheduleexpression, scheduler, service, task, timer, timer service
Posted in Enterprise, Java | 4 Comments »
Sunday, May 27th, 2012
Many programmers have suffered when trying to setup an environment to handle updates for their application without much effort. Some tried Java Web Start for this purpose and many encountered difficulties with this approach.
Now there is getdown that aims to replace Java Web Start by offering a simple architecture to handle updates that is fast, realiable and the only thing you need is a normal http server. Though getdown lets us handle our updates really easy it is possible to make this process even easier with the getdown maven plugin.
In the following example we’re building a simple swing application to be installed, updated and launched using getdown.
(more…)
Tags: getdown, Java, maven, tutorial, webstart
Posted in Java | 18 Comments »
Friday, May 18th, 2012
CoffeeScript is a neat language that is transcompiled into JavaScript but is more predictable and allows to write the same code with 1/3 fewer lines and of course with a (imho) nicer syntax.
CoffeeScript is nice but a vivid integration into our application build lifecycle with Maven is better and that is what the following example is all about.
(more…)
Tags: brew, coffeescript, compile, javascript, js, maven
Posted in Development, Web | No Comments »
Monday, April 16th, 2012
The OSGi Blueprint Container specification allows us to use dependency injection in our OSGi environment, declarative import and export of OSGi services, registering lifecycle listeners and wiring dependencies into our services with a few lines of XML code.
In the following tutorial we’re first building an OSGi bundle classical style and afterwards take a trip into the advantages of the Blueprint specification.
Our OSGi container of choice here will be Apache Karaf a lightweight container with a lot of nice features and – of course – blueprint enabled…
(more…)
Tags: apache karaf, bind, blueprint, bundle, dependency injection, export, felix, listener, maven, osgi, service, springdm, tutorial, wiring
Posted in Enterprise, Java | 13 Comments »
Friday, March 23rd, 2012
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.
(more…)
Tags: functional, Java, maven, scala, Snippet, tutorial
Posted in Java, Scala | No Comments »
Tuesday, March 6th, 2012
A lot has changed since Selenium RC and WebDriver has given us a new syntax to write tests for our web pages. PageObjects add an abstraction to the pages under test and finally we’re able to programatically start Selenium server instances and use them to run the tests.
In the following tutorial, we’re writing some tests using PageObjects, WebDriver, Selenium Server and finally we’re even taking some screenshots of our tested web pages..
(more…)
Tags: grid, junit, maven, pageobject, rc, regression test, selenium, tdd, testing, webdriver
Posted in Development, Java, testing | 1 Comment »
Sunday, January 8th, 2012
The more smartphones and tablets are sold the bigger the need for a mobile version of a modern website. PrimeFaces Mobile helps us developers here and allows us to quickly create mobile websites that display well on an iPhone, Android, Palm, Blackberry, Windows Mobile and others.
In the following tutorial we’re going to create a web application that is using Java Server Faces 2.1, PrimeFaces 3.1 and PrimeFaces Mobile 1.0 and runs on a simple web container like Tomcat or Jetty.
(more…)
Tags: facelet, facet, java server faces, jquery, jsf, maven, mobile, primefaces, tomcat
Posted in Java | 8 Comments »
Wednesday, October 12th, 2011
The Tomcat Maven Plugin not only allows us to deploy our mavenized application to an existing Tomcat server but also to run our web application with an embedded instance from our project’s directory. Recently I needed to add basic authentication to such an instance and wanted to share the steps necessary here
(more…)
Tags: authentication, basic-auth, maven, realm, servlet, tomcat
Posted in Java | 2 Comments »
Tuesday, September 20th, 2011
Today we’re going to take a look at the Maven Embedded GlassFish Plugin and how it allows us quick creation of GlassFish server instances in no time and Java EE 6 application deployment.
With a few lines of configuration in your Maven’s pom.xml we’ve got a running GlassFish instance and are able to redeploy our application fast by pressing enter in our console.
In the following tutorial we’re going to build a Java EE 6 Web Application with a stateless session bean and a web servlet and finally deploy – and redeploy the application using the Maven GlassFish Plugin.
(more…)
Tags: deployment, ejb, embedded, Enterprise, glassfish, javaee, jee, maven, servlet
Posted in Enterprise, Java | 7 Comments »
Tuesday, August 30th, 2011
Sometimes in a developer’s life there is no clean API available to gather information from a web application .. no SOAP, no XML-RPC and no REST .. just a website hiding the information we’re looking for somewhere in its DOM hierarchy – so the only solution is screenscraping.
Screenscraping always leaves me with a bad feeling – but luckily there is a tool that makes this job at least a bit easier for a developer .. jsoup to the rescue!
(more…)
Tags: crawler, dom, extraction, html, jsoup, maven, parser, screenscraping, tutorial
Posted in Java | 2 Comments »
Tuesday, August 23rd, 2011
Using the contract-first approach to define a web service offers some advantages in contrast to the code-first approach.
In the following tutorial we’re going to take a look at some details of this approach and we’re going to implement a real SOAP service using JAX-WS, Maven and the Eclipse IDE.
Finally we’re going to run our service implementation on an embedded Jetty instance and we’re going to take a look at soapUI and how to test our service using this neat tool.
(more…)
Tags: eclipse, jax-b, jax-ws, jaxb, jetty, maven, port, schema, soap, soapui, wsdl, xml, xsd
Posted in Enterprise, Java, Web Services | 4 Comments »
Tuesday, July 12th, 2011
Often ant tasks are used in Maven builds but wouldn’t it be more attractive to integrate the Groovy language into our build process?
GMaven is the answers to this problem and brings together Maven and Groovy. It allows us to execute Groovy scripts inline from our Maven configuration, from a local script or even from a remote location. In the following short examples I am going to show how to configure Maven to execute Groovy scripts from different locations.
(more…)
Tags: ant, Build, gmaven, gradle, groovy, maven, plugin, task
Posted in Groovy/Grails, Java | No Comments »
Tuesday, February 8th, 2011
Java EE 6 is out and it indeed offers an interesting stack of technologies. So in today’s tutorial we are going to build a small sample web application that builds on this stack using Enterprise JavaBeans, Java Persistence API, Bean Validation, CDI and finally Java Server Faces and PrimeFaces.
The application we’re going to develop is a simple blog app that allows us to create new articles, list them and – finally delete them. We’re also covering some additional topics like JSF navigation, i18n, Ajax-enabled components and the deployment on the GlassFish application server.
(more…)
Tags: bean, bean validation, cdi, eclipselink, ejb, example, glassfish, hibernate, IoC, java ee, javaee, jee, jndi, jsf, jsr-303, jsr-316, jsr-317, jsr-318, maven, mojarra, primefaces, toplink, tutorial, validator, weld
Posted in Java | 85 Comments »
Saturday, January 1st, 2011
Are you playing around with the shiny new 3.1 EJB API?
Using Maven for your Java projects?
Need an easy way to write and execute tests for your EJBs that depends on an Java Application Server?
No problem using Maven Archetypes, the Maven EJB Plugin and the GlassFish embedded Application Container..
(more…)
Tags: application server, arquillian, bean, ejb, embedded, enterprise java bean, example, glassfish, java ee 6, jee, jeeunit, jndi, jsr-318, junit, maven, testing, tutorial
Posted in Java | 8 Comments »
Thursday, November 25th, 2010
Often in a developer’s life there is a REST service to deal with and nowadays one wants a fast and clean solution to create a client for such a service.
The following tutorial shows a quick approach using JAX-RS with its reference implementation, Jersey in combination with JAX-B for annotation driven marshalling between XML or JSON structures and our Java-Beans.
(more…)
Tags: jax-b, jax-rs, jaxrs, jersey, jsr-311, marshalling, maven, rest, tutorial, webservice
Posted in Java, Web Services | 9 Comments »
Sunday, September 5th, 2010
Having read an interesting comparison by Lindenlabs evaluating modern message broker systems like ActiveMQ, ApacheQpid and amongst others – RabbitMQ – I wanted to take a quick look at the last one and built a small application producing and consuming some sample messages.
If you need some lecture on getting started with RabbitMQ or the key concepts of messaging I strongly recommend reading this list of introductional articles from the RabbitMQ homepage.
(more…)
Tags: amqp, consumer, jms, maven, messaging, rabbitmq, springsource
Posted in Java | 3 Comments »
Sunday, August 22nd, 2010
There is still the urban myth that using Spring IoC container without thousands lines of XML code isn’t possible – so today we’re taking a look at annotation based configuration with Spring 3 and of course we’re using Maven..
(more…)
Tags: annotation, aop, aspectj, dependency injection, guice, IoC, JSR-250, JSR-330, maven, spring
Posted in Java | 5 Comments »
Sunday, July 25th, 2010
In this tutorial we will take a look at the development of a simple OSGi Web Application and what tools can save us some time.
The Maven Bundle Plugin makes our life much easier here as does the OSGi Bundle Repository that offers some nice bundles – in our case the servlet API and an embedded Jetty web server.
So lets develop some bundles ..
(more…)
Tags: activator, bundle, bundle repository, example, felix, jetty, maven, obr, osgi, servlet, tutorial
Posted in Java | 3 Comments »
Monday, July 12th, 2010
Since Confluence 3.2. there is a new plugin module type that allows you to deploy templates in a bundle via the plugin API.
In addition it is possible to assign these templates to specific spaces and preview available templates in the Confluence administration area.
So let’s build some sample templates..
(more…)
Tags: Confluence, example, maven, plugin, template bundle, tutorial, velocity
Posted in Confluence | 6 Comments »
Tuesday, July 6th, 2010
Protocol Buffers are a serialization format developed by Google- you might ask if another IDL is really needed here – is Google barking at the wrong tree?
But protocol buffers offer some advantages over data serialization via XML or JSON – Google says they (compared to XML)..
- are 3 to 10 times smaller
- are 20 to 100 times faster
- provide generated data access classes for programmatic use
- provide backward compatibility
So lets play around a little with protocol buffers in Java and build a small application that serializes and deserializes some data using a defined format..
Tags: example, google, GWT, idl, Java, marshalling, maven, protocol buffers, serialization, tutorial
Posted in Development | 2 Comments »
Saturday, June 5th, 2010
In this short tutorial we are going to build a Java Server Faces Web-Application using JSF2.0, Facelets, Maven and Hibernate as ORM Mapper.
The goals for this first step are: Setting up the project structure using Maven, defining a frame template/decorator and a registration facelet, creating a managed bean and mapping it’s values to the facelet, adding some basic validation, displaying validation errors and finally adding a navigation structure.
In step2 of this tutorial we are going to add persistence using Hibernate, add some security, create a custom UI component and add some AJAX.
The Mojarra JSF implementation is used for this tutorial – perhaps I’m going to post more about the MyFaces implementation in another tutorial.
(more…)
Tags: eclipse, example, facelet, glassfish, hibernate, java server faces, jee, jsf, jsf 2, jsf2, maven, mojarra, mvc, servlet, tomcat, tutorial
Posted in Development, Java | 6 Comments »
Sunday, May 23rd, 2010
Developing plugins for the Confluence Wiki a developer sometimes needs to save additional metadata to a page object using Bandana or the ContentPropertyManager. Wouldn’t it be nice if this metadata was available in the built-in Lucene index?
That is were the Confluence Extractor Module comes into play..
(more…)
Tags: Confluence, document, example, extractor, field, howto, indexer, lucene, luke, maven, plugin, search, tutorial
Posted in Confluence | 3 Comments »
Saturday, April 17th, 2010
There is a nice Maven plugin helping you signing your Android app – the Maven Jar Signer Plugin. If you want to learn more about Maven integration in an android project take a look at this article. (more…)
Tags: Android, apk, jar, key, maven, pom.xml, sign, signing, smartphone
Posted in Android, Java | 1 Comment »
Thursday, April 15th, 2010
Searching for nice coding kata sites I found this one – codingkata.org – I really liked because of the quick start and nice maven integration.
Just head over to the kata overview select the kata you wish to try out, copy the generated maven command line option and run it in the console – heres the code for the hello-world sample: (more…)
Tags: coding, kata, learning, maven, training
Posted in Development | No Comments »
Tuesday, April 13th, 2010
The goal is to build a small macro plugin deployable via the Confluence plugin API rendering some spaces.
Please note that I am going to build the plugin using just Maven and not the Atlassian Maven Wrapper called the “Atlassian Plugin SDK” – more information about that is available at the Atlassian website.
The macro output will be rendered using a Velocity template and all messages are stored for i18n in properties files bundled with the plugin.
If you need to set up an instance of Confluence first, head over to this article. (more…)
Tags: Atlassian, Confluence, dependency injection, macro, maven, renderer, velocity
Posted in Confluence, Java | 10 Comments »
Thursday, April 8th, 2010
Having written the article “How to build a Confluence SOAP client in 5 minutes” some readers asked me for some more information and help using the JAX-WS plugin that I mentioned in the article instead of the Axis plugin – so here we go ;) (more…)
Tags: Axis, Axis2, jax-ws, maven, maven2, soap, tutorial, webservice, wsdl, wsimport
Posted in Java, Web Services | 13 Comments »
Sunday, April 4th, 2010
In a maven project there are lots of dependencies to handle – often one wants to know which version of a software comes from.
The solution to this problem is the Maven Dependency Plugin which helps you to find used/unused/declared/undeclared dependencies in your project.
In addition the plugin allows you to copy or unpack artifacts. (more…)
Tags: dependency, maven, plugin
Posted in Development, Java | No Comments »
Saturday, April 3rd, 2010
Building a simple IMAP Client that displays the subject of the messages in the “inbox” Folder using Maven (I just like Maven). (more…)
Tags: imap, javax, mail client, maven
Posted in Java, Snippet | No Comments »
Friday, April 2nd, 2010
With the Maven Android Plugin it is possible to build and deploy/undeploy your android app and start/stop the emulator – if you’re used to maven you won’t be going without it ;)
If you’re interested in signing your apk using maven – take a look at this article. (more…)
Tags: adt, Android, eclipse, ide, m2eclipse, maven
Posted in Android, Java | No Comments »
Sunday, March 28th, 2010
In this tutorial we are going to build a SOAP client for the popular Confluence Wiki in about five minutes. The client is going to receive rendered HTML Markup from a specified Confluence Page.
(more…)
Tags: Axis, Axis2, Confluence, jax-ws, maven, rpc, soap, web service, wiki, ws, wsdl, wsimport
Posted in Confluence, Development, Java, Web Services | 11 Comments »
Thursday, March 25th, 2010
Helo – today I wanted to post a small tutorial for a small index and search operation using the Lucene indexer and Maven for the project setup.
(more…)
Tags: demo, document, index, indexer, lucene, maven, multi-field-search, search, snippets, solr, tutorial
Posted in Java | 2 Comments »
Tuesday, March 23rd, 2010
Sometimes I get the impression that there are many Maven haters in the Groovy/Grails community – now with version 1.2 of the Grails framework they are able to abandon the evil satanic Grails Maven Plugin and embrace the neverending joys of a slim, nice, sexy dependency resolution dsl .. here we go .. lets define some dependencies wheee … (more…)
Tags: Apache, Build cycle, dependency, deployment, grails, groovy, ivy, maven
Posted in Groovy/Grails | 1 Comment »
Monday, March 22nd, 2010
We are all waiting for a stable release of Maven3 with following updates ..
- faster, more performant .. save us time building our software and some precious memory ;)
- improved artifact resolution api and plugin api
- better osgi integration
- a few bugfixes
- no mixing of application dependencies and tooling dependencies
- though it does not matter that much to me: polyglot features .. e.g.: “Writing your pom files in Groovy”
- version-less parent elements for multi-module or multi-pom projects, no need to define the parent version in every submodule
- better artifact resolution, which dependency or pom supplied which artifact to the outcome .. got that information from: “Splitter from the world of Java”
(more…)
Tags: Api, ASF, deployment, Development, integration, m2e, maven, maven2, maven3, sonatype
Posted in Java | No Comments »
Thursday, March 18th, 2010
Sometimes there is a dependency not available at a remote repository and one is too lazy to set up a local maven repository – that’s when one adds a directory in the project structure and wants maven to find dependencies there.
(more…)
Tags: Build, deployment, Development, Java, maven, repository
Posted in Development, Java | No Comments »