Articles Tagged ‘Java’
Thursday, April 6th, 2017
There is a new testing framework out there called Karate that is build on top of the popular Cucumber framework.
Karate makes it easy to script interactions with out web-services under test and verify the results. In addition it offers us a lot of useful features like parallelization, script/feature re-use, data-tables, JsonPath and XPath support, gherkin syntax, switchable staging-configurations and many others.
In the following tutorial we’ll be writing different scenarios and features for a real-world RESTful web-service to demonstrate some of its features.
(more…)
Tags: attd, bdd, cucumber, feature, http, Java, javascript, json, junit, karate, rest, restful, scenario, soap, tdd, testing, xml
Posted in Java, Web Services, testing | 4 Comments »
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, January 25th, 2015
When it comes to indexing in a Neo4j graph database, different options exist for a developer to create and maintain the index.
In the following short examples I’d like to demonstrate different possibilities for index management.
(more…)
Tags: cypher, database, gradle, graph, Java, neo4j, schema, start, yed
Posted in Java | No Comments »
Wednesday, January 7th, 2015
Having written about the basics of using Cucumber in a Java project in my last blog article, I now would like to demonstrate how to use a similar setup in a Java EE web project with Arquillian and the Cukespace library.
In the following tutorial, we’re going to write a full Java EE web application and add BDD-style tests to the project so that we’re able to test our business layer on the one hand and the user interface on the other hand using Arquillian Drone and Selenium.
(more…)
Tags: arquillian, atdd, bdd, cucumber, cukespace, drone, gherkin, Java, javaee, jsf, junit, sbe, tdd, testing
Posted in Enterprise, Java, testing | 4 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, 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 »
Sunday, July 6th, 2014
Lucene is my favourite search engine library and the more often I use it in my projects the more features or functionality I find that were unknown to me.
Two of those features I’d like to share in the following tutorial is one the one hand the possibility to specify different analyzers on a per-field basis and on the other hand the API to create a simple character based tokenizer and analyzer within a few steps.
Finally we’re going to create a small index- and search application to test both features in a real scenario.
(more…)
Tags: analyzer, charanalyzer, index, Java, lucene, luke, search, tokenizer
Posted in Java | No 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, August 13th, 2013
Java EE 7 is out now and so I was curious to play around with the new specifications and APIs from in this technology stack.
That’s why I didn’t hesitate to add yet another websocket-chat tutorial to the existing ones on the internet in favour of gathering some experience with this technology and a possible integration using a GlassFish 4 server, the new Java API for JSON Processing for data serialization combined with custom websocket encoders/decoders and finally adding some Bootstrap and jQuery on the client side.
(more…)
Tags: bootstrap, chat, client, encoder, glassfish, grizzly, html5, Java, javaee, javascript, json, json-p, websocket, websockets
Posted in Enterprise, Java | 65 Comments »
Tuesday, July 9th, 2013
Recently I needed to control an embedded web container from a Java application and I wanted to see how this could be achieved using an embedded instance of either Tomcat or Jetty here.
In the following short examples I would like to show how to embed both servers in an application in no time using Gradle or Maven as build tool.
(more…)
Tags: catalina, gradle, Java, jetty, server, servlet, tomcat
Posted in Apps, Java, Web | 11 Comments »
Sunday, June 23rd, 2013
It’s been a long way for Java FX from the days of the F3 project the current release 2.2. Today there are many options how to create a Java FX application .. you may be using Java, Scala, Groovy or Visage, you may create your application in a programmatic way using the comfortable integrated builders or you may create your views using XML layouts and easy data-bindings with a few annotations.
If you need to bind your UI component properties to a specific application state, there’s a nice properties- and bindings API that makes your life easier.
In the following tutorial, I’m going to create a simple game application – one version using FXML templates, model- and controller classes and using external stylesheets – the other version as a programmatic version in one java class.
Finally I’m showing how easy it is to create a shippable application either as runnable jar or as Java Web Start/JNLP application by using Gradle and the Java FX Plugin for Gradle.
(more…)
Tags: game, gradle, gui, Java, java fx, javafx, plugin, rc, rich client
Posted in Apps, Java | No 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 17th, 2013
Blueprint is a new API in Confluence 5 that allows developers to create new content elements and to hook into the Confluence “create” dialogue – not to be confused with OSGi blueprints, the CSS blueprint framework or Tinkerpop Blueprints here.
Content may be added using simple XHTML templates, dynamic templates enriched with data from context providers or even customized JavaScript dialogues.
Another feature is, that pages of a specific blueprint type may be aggregated in a collector view that displays all pages created with the specific blueprint
In the following short example we’re going to create a simple blueprint adding some dynamic data to the blueprint template using a context provider.
(more…)
Tags: Atlassian, blueprint, Confluence, content-creator, Java, template, wiki
Posted in Confluence | 3 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 »
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 »
Monday, November 12th, 2012
There are a lot of frameworks out there to create offline applications and rich clients in Java.
One exotic alternative is to use the HTML, CSS and Javascript for this purpose and render the application in a Java frame using SWT and SWT’s browser component.
(more…)
Tags: bootstrap, css, html, Java, ri, richclient, swt
Posted in Apps, Java | 3 Comments »
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 »
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, 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 »
Wednesday, November 2nd, 2011
The MemoryAnalyzer Plugin for Eclipse allows us to quickly analyze heap dumps from a virtual machine and search for memory leaks. In the following tutorial we’re going to create and run a small application that is going to cause an OutOfMemoryException during its runtime.
In addition, we’re forcing the virtual machine to save a heap dump and finally analyzing this data using Eclipse and the MemoryAnalyzer plugin.
(more…)
Tags: analyzer, dump, eclipse, heap, hprof, Java, jmap, jps, jvm, memory, virtual machine
Posted in Java | 2 Comments »
Monday, April 25th, 2011
Last year I passed the exam for the “Oracle Certified Professional Java Programmer”successfully and wanted to share my exam preparation notes about common problems and pitfalls to be aware of.
That’s why I have added some code and examples for my top 25 challenges below.
(more…)
Tags: certification, exam, Java, ocjp, ocpjp, oracle, preparation, programmer, scjp
Posted in Java | No 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 »
Wednesday, March 24th, 2010
Short Facts:
- About 850 pages – heavy weight – use it for self defence! ;)
- Preparation material for the Sun Exam 310-065 (Sun Certified Java Programmer for Java SE 6)
- CD-Rom with a nice exam simulator included
- Authors: Kathy Sierry and Bert Bates
- ISBN: 978-0071591065
(more…)
Tags: Book, certification, exam, Java, java se 6, review, scjp, sun certified java programmer
Posted in Java, Reading Corner | 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 »