Monthly Archives: January 2015

OpenEJB 5 + Groovy = service done fast!


If you read the previous post I wrote about ApplicationComposers run method you surely wonder what a service could look like using groovy and @Grab to resolve maven dependencies?

Here is a quick post showing it:

Continue reading

CukeSpace or BDD, Arquillian and Java 8


Cucumber supports since few days a Java 8 API.

If you didn’t see it yet here what it looks like (taken from cucumber-java8 tests):

import cucumber.api.Scenario;
import cucumber.api.java8.En;

import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotSame;

public class LambdaStepdefs implements En {
    private static LambdaStepdefs lastInstance;

    public LambdaStepdefs() {
        Before((Scenario scenario) -> {
            assertNotSame(this, lastInstance);
            lastInstance = this;
        });

        Given("I have (\\d+) cukes in my (.*)", (Integer cukes, String what) -> {
            assertEquals(42, cukes.intValue());
            assertEquals("belly", what);
        });
    }
}

This is great but does it work with Arquillian?

Continue reading

TomEE and JAXRS provider configuration depending on environment


TomEE supports “environment integration” through several solutions (altdd support, external configuration using conf/system.properties etc….). But how to configure a JAXRS provider depending the environment?

First why should I need it? Suppose you configured a JSON provider, quite common for a JAX-RS application no? You want your application to be efficient in production so you use “flat” JSON but in dev you surely prefer to get formatted (“pretty”) JSON to keep it readable.

How to do it with TomEE?

Continue reading

Did you ever realize OpenEJB ApplicationComposers is the EE Spring boot?


I spoke a lot of ApplicationComposers on this blog. If you don’t know it yet in two words it is originally a way to fully define its EE application programmatically and then run test against this described application.

However with a trivial main you can make it run your application!

Continue reading

TomEE: LazyValve or how to provide a Valve in a war


Tomcat Valve mecanism is a way to have a kind of servlet filter but before the servlet chain. In two words it is commonly used for container and security usages/needs.

Main issue is the common way to add a valve is to configure it in server.xml or context.xml. Even if this last one can be packaged in a war, the valve itself can’t since this file is used before the webapp classloader is setup to build the webapp setup/context.

To solve it TomEE now provides a LazyValve implementation.

Continue reading

JSon for configuration: Apache Johnzon made another step with comments


Using JSon for a configuration file is very tempting but there is a big drawback: you can’t comment anything with a strict JSon parser.

This is something which is blocking for a configuration IMO because you often need to explain why you configured something in the way it is.

Continue reading