Embedded Glassfish for Integration Tests
This post was originally published here by Valtech UK consultant Mashooq Badar.
Sun Glassfish server can be run in embeded mode, very useful for automated integration tests. Here’s how: Maven Dependencies: <dependency> <groupId>org.glassfish.distributions</groupId> <artifactId>web-all</artifactId> <version>10.0-build-20080430</version> <scope>test</scope> </dependency> <dependency> <groupId>org.glassfish.embedded</groupId> <artifactId>gf-embedded-api</artifactId> <version>1.0-alpha-4</version> <scope>test</scope> </dependency> If you are not using maven then add the above libs to you classpath. Getting the server started in simple final URI APP_URI= UriBuilder.fromUri(“http://localhost/”).port(8888).path(“myapp”).build(); [...]
