Arquillian run modes
silenius Oct 10, 2010 9:36 PMWhile the following TestNG test works fine with the mode RunModeType.AS_CLIENT:
@Run(RunModeType.AS_CLIENT) public class FooServiceTest extends Arquillian { private static final Logger log = Logger.getLogger(FooServiceTest.class.getName()); @Deployment public static EnterpriseArchive createDeployment() throws IOException { final JavaArchive ejbJar = ShrinkWrap.create(JavaArchive.class, "ejb.jar").addClasses(FooService.class, FooServiceBean.class); final WebArchive war = ShrinkWrap.create(WebArchive.class, "foo.war").addClasses(EJBBean.class, EJBInterceptor.class, BaseActionBean.class, FooActionBean.class).addLibraries("stripes-1.5.3.jar") .setWebXML("WEB-INF/web.xml"); // Find a better way to inject dependencies final EnterpriseArchive ear = ShrinkWrap.create(EnterpriseArchive.class, "stripes-ejb3.ear").addModule(ejbJar) .addModule(war); log.info(ear.toString(true)); return ear; } @Test public void shouldGreetUser() throws IOException { final String name = "Earthlings"; final URL url = new URL("http://localhost:8080/foo/Foo.action"); StringBuilder builder = new StringBuilder(); BufferedReader reader = new BufferedReader(new InputStreamReader(url.openStream())); String line; while ((line = reader.readLine()) != null) { builder.append(line); } reader.close(); log.info("Returned response:"); log.info(builder.toString()); assertEquals(builder.toString(), FooService.GREETING + name); } }
It fails with the default mode RunModeType.IN_CONTAINER.
Doing the following request
127.0.0.1 - - [11/Oct/2010:02:10:06 +0100] "GET /test/ArquillianServletRunner?outputMode=serializedObject&className=my.package.FooServiceTest&methodName=shouldGreetUser HTTP/1.1" 200 2971
instead of
127.0.0.1 - - [11/Oct/2010:02:33:35 +0100] "GET /foo/Foo.action HTTP/1.1" 200 17
Does anyone knows why this happens?
Cheers,
Samuel