You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomee.apache.org by Romain Manni-Bucau <rm...@gmail.com> on 2015/02/22 23:01:14 UTC

some hacks for test

Hi guys

just to let you know I added 3 rules:

1) ContainerRule
2) ApplicationRule

this is mainly ApplicationComposerRule but split in 2 to allow to use
chain like:


@Rule
public final TestRule rule = RuleChain
        .outerRule(new ContainerRule(new Container()))
        .around(new ApplicationRule(new MyApp1()))
        .around(new ApplicationRule(new MyApp2()));

Idea is to be able to use MyApp1 to mock a webapp (rest service) super
trivially or to handle app dependencies more easily

3) TomEEEmbeddedRule: a simple rule starting a tomee embedded and
doing a deployClasspathAsWebApp:

@Rule
public final TomEEEmbeddedRule tomee = new TomEEEmbeddedRule(
        new Configuration()
                .randomHttpPort()
                .property("client.url",
"http://localhost:${tomee.embedded.http}/rest/api/"), "")
        .injectOn(this);

Super nice for websocket testing ;)



Romain Manni-Bucau
@rmannibucau
http://www.tomitribe.com
http://rmannibucau.wordpress.com
https://github.com/rmannibucau

Re: some hacks for test

Posted by Jean-Louis Monteiro <jl...@tomitribe.com>.
Sounds cool

--
Jean-Louis Monteiro
http://twitter.com/jlouismonteiro
http://www.tomitribe.com

On Sun, Feb 22, 2015 at 11:42 PM, Daniel Cunha <da...@gmail.com> wrote:

> +1
>
> On Sun, Feb 22, 2015 at 7:01 PM, Romain Manni-Bucau
> <rm...@gmail.com> wrote:
> > Hi guys
> >
> > just to let you know I added 3 rules:
> >
> > 1) ContainerRule
> > 2) ApplicationRule
> >
> > this is mainly ApplicationComposerRule but split in 2 to allow to use
> > chain like:
> >
> >
> > @Rule
> > public final TestRule rule = RuleChain
> >         .outerRule(new ContainerRule(new Container()))
> >         .around(new ApplicationRule(new MyApp1()))
> >         .around(new ApplicationRule(new MyApp2()));
> >
> > Idea is to be able to use MyApp1 to mock a webapp (rest service) super
> > trivially or to handle app dependencies more easily
> >
> > 3) TomEEEmbeddedRule: a simple rule starting a tomee embedded and
> > doing a deployClasspathAsWebApp:
> >
> > @Rule
> > public final TomEEEmbeddedRule tomee = new TomEEEmbeddedRule(
> >         new Configuration()
> >                 .randomHttpPort()
> >                 .property("client.url",
> > "http://localhost:${tomee.embedded.http}/rest/api/"), "")
> >         .injectOn(this);
> >
> > Super nice for websocket testing ;)
> >
> >
> >
> > Romain Manni-Bucau
> > @rmannibucau
> > http://www.tomitribe.com
> > http://rmannibucau.wordpress.com
> > https://github.com/rmannibucau
>
>
>
> --
> Daniel Cunha (soro)
>

Re: some hacks for test

Posted by Daniel Cunha <da...@gmail.com>.
+1

On Sun, Feb 22, 2015 at 7:01 PM, Romain Manni-Bucau
<rm...@gmail.com> wrote:
> Hi guys
>
> just to let you know I added 3 rules:
>
> 1) ContainerRule
> 2) ApplicationRule
>
> this is mainly ApplicationComposerRule but split in 2 to allow to use
> chain like:
>
>
> @Rule
> public final TestRule rule = RuleChain
>         .outerRule(new ContainerRule(new Container()))
>         .around(new ApplicationRule(new MyApp1()))
>         .around(new ApplicationRule(new MyApp2()));
>
> Idea is to be able to use MyApp1 to mock a webapp (rest service) super
> trivially or to handle app dependencies more easily
>
> 3) TomEEEmbeddedRule: a simple rule starting a tomee embedded and
> doing a deployClasspathAsWebApp:
>
> @Rule
> public final TomEEEmbeddedRule tomee = new TomEEEmbeddedRule(
>         new Configuration()
>                 .randomHttpPort()
>                 .property("client.url",
> "http://localhost:${tomee.embedded.http}/rest/api/"), "")
>         .injectOn(this);
>
> Super nice for websocket testing ;)
>
>
>
> Romain Manni-Bucau
> @rmannibucau
> http://www.tomitribe.com
> http://rmannibucau.wordpress.com
> https://github.com/rmannibucau



-- 
Daniel Cunha (soro)