Featured in
Architecture & Design

Mini-talks: The Machine Intelligence Landscape: A Venture Capital Perspective by David Beyer. The future of global, trustless transactions on the largest graph: blockchain by Olaf Carlson-Wee. Algorithms for Anti-Money Laundering by Richard Minerich.

Featured in
Process & Practices

In-App Subscriptions Made Easy

There are various types of subscriptions: recurring, non-recurring, free-trial periods, various billing cycles and any possible billing variation one can imagine. But with lack of information online, you might discover that mobile subscriptions behave differently from what you expected. This article will make your life somewhat easier when addressing an in-app subscriptions implementation.

Featured in
Operations & Infrastructure

Mini-talks: The Machine Intelligence Landscape: A Venture Capital Perspective by David Beyer. The future of global, trustless transactions on the largest graph: blockchain by Olaf Carlson-Wee. Algorithms for Anti-Money Laundering by Richard Minerich.

Featured in
Enterprise Architecture

Mini-talks: The Machine Intelligence Landscape: A Venture Capital Perspective by David Beyer. The future of global, trustless transactions on the largest graph: blockchain by Olaf Carlson-Wee. Algorithms for Anti-Money Laundering by Richard Minerich.

Restfuse 1.0.0 - A Library For Easy REST/HTTP Integration Tests

EclipseSource has released the first stable version for an open source JUnit extension that automates testing of REST/HTTP services. Restfuse is a set of JUnit annotations that, along with the respective HttpJUnitRunner, offer assertions against the response of an HTTP call. Both synchronous and asynchronous remote calls are supported.

Restfuse is already in Maven Central so using it requires no special repository:

The test above calls an HTTP endpoint synchronously and then checks for a text-based response (text/plain) with the "done" string. Notice that the first assertOk is a Restfuse assert that checks for the HTTP 200 OK status call while the second assertEquals is the usual string equality assert offered by JUnit. While this endpoint is assumed to return plain text, one could easily parse JSON/XML or something else and perform asserts in a structured manner.

Restfuse also supports asynchronous calls. The canonical example is a long running operation (e.g. progress on a file upload). The client continuously polls the server endpoint in order to gather constant feedback on the actual status. Let's assume a server endpoint that returns a number between 0 and 100 that denotes progress on some operation:

The test above checks that each response is a higher number than the previous one.

One of the most surprising dependencies of Restfuse is the Jetty HTTP server. The reason for this is that Restfuse also supports asynchronous services that follow the Web Hooks guidelines. Instead of polling multiple times the server, a client endpoint performs a call only once and then waits for a response initiated by the server in a completely different connection. Here is the Restfuse example: