You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tomee.apache.org by "Romain Manni-Bucau (JIRA)" <ji...@apache.org> on 2014/09/14 16:19:33 UTC

[jira] [Resolved] (TOMEE-1345) basic support of Tomcat embedded in tomee-embedded

     [ https://issues.apache.org/jira/browse/TOMEE-1345?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Romain Manni-Bucau resolved TOMEE-1345.
---------------------------------------
       Resolution: Fixed
    Fix Version/s: 2.0.0
         Assignee: Romain Manni-Bucau

> basic support of Tomcat embedded in tomee-embedded
> --------------------------------------------------
>
>                 Key: TOMEE-1345
>                 URL: https://issues.apache.org/jira/browse/TOMEE-1345
>             Project: TomEE
>          Issue Type: New Feature
>            Reporter: Romain Manni-Bucau
>            Assignee: Romain Manni-Bucau
>             Fix For: 2.0.0
>
>
> idea is to be able to do:
> {code}
>     @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());
>         }
>     }
> {code}



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)