Description
idea is to be able to do:
@Test public void run() throws IOException { final Configuration configuration = new Configuration().randomHttpPort(); configuration.setDir(Files.mkdirs(new File("target/" + getClass().getSimpleName() + "-tomcat")).getAbsolutePath()); try (final Container container = new Container(configuration)) { // tomee-embedded (this "container url" is filtered: name prefix + it is a directory (target/test-classes) final File parent = Files.mkdirs(new File("target/" + getClass().getSimpleName())); final File war = ShrinkWrap.create(WebArchive.class, "the-webapp") .addClass(Foo.class) .addAsWebInfResource(EmptyAsset.INSTANCE, "beans.xml") // activate CDI .as(ExplodedExporter.class) .exportExploded(parent); final Context ctx = container.addContext("/", war.getAbsolutePath()); final Wrapper wrapper = Tomcat.addServlet(ctx, "awesome", AServlet.class.getName()); ctx.addServletMapping("/awesome", wrapper.getName()); assertEquals("Awesome", IO.slurp(new URL("http://localhost:" + configuration.getHttpPort() + "/awesome")).trim()); } catch (final Exception e) { e.printStackTrace(); fail(e.getMessage()); } }