tomee-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Romain Manni-Bucau <rmannibu...@gmail.com>
Subject Re: tomee-embedded test case best practice?
Date Tue, 29 Nov 2011 06:01:30 GMT
Hi,

What is cool with arquillian is all its plugins. If you don't need them
maybe you don't need arquillian. However i think it manages more easily the
lifecycle of the container and it allows you through shrinkwrap to create
partial archive on the fly.

To use an already created war there is no magic today, you can do as in the
example and simply give the tomee-embedded its path or you can use the
maven t7 plugin to automatically deploy your built war.

Hope it helps...

- Romain

Le 29 nov. 2011 02:54, "afryer" <apfryer@hotmail.com> a écrit :

> I'm currently trying to setup automated integration testing of my webapp
> which uses ejbs and have been looking at some of the arquillian examples
>
> https://svn.apache.org/repos/asf/openejb/trunk/openejb/arquillian-tomee/arquillian-tomee-moviefun-example/src/test/java/org/superbiz/moviefun
> here .
>
> It looks like there's a couple of ways to startup an embedded tomee server
> and i was wondering if any way was preferrable to another.
>
> In MoviesHtmlUnitTest.java, the tomee server is started without arquillian
> using this code...
>
> @BeforeClass public static void start() throws IOException {
>        webApp = createWebApp();
>        Properties p = new Properties();
>        p.setProperty(EJBContainer.APP_NAME, "moviefun");
>        p.setProperty(EJBContainer.PROVIDER, "tomee-embedded"); // need web
> feature
>        p.setProperty(EJBContainer.MODULES, webApp.getAbsolutePath());
>        p.setProperty(EmbeddedTomEEContainer.TOMEE_EJBCONTAINER_HTTP_PORT,
> "9999");
>        container = EJBContainer.createEJBContainer(p);
>    }
>
> In MoviesSeleniumTest.java, the tomee server is started like this...
>
> @Deployment(testable = false)
>    public static WebArchive createDeployment() {
>        WebArchive archive = ShrinkWrap.create(WebArchive.class,
> "moviefun.war")
>                        .addClasses(ActionServlet.class,
> SetupServlet.class, Movie.class,
> MovieController.class, Movies.class, MoviesImpl.class, MoviesRemote.class,
> JsfUtil.class, PaginationHelper.class, ExampleDataProducer.class,
> Examples.class, Setup.class)
>                        .addAsResource(new
> ClassLoaderAsset("META-INF/ejb-jar.xml") ,
> "META-INF/ejb-jar.xml")
>                        .addAsResource(new
> ClassLoaderAsset("META-INF/persistence.xml") ,
> "META-INF/persistence.xml")
>                        .addAsLibraries(new
> File("target/test-libs/commons-beanutils.jar"),
>                                        new
> File("target/test-libs/commons-codec.jar"),
>                                        new
> File("target/test-libs/commons-collections.jar"),
>                                        new
> File("target/test-libs/commons-digester.jar"),
>                                        new
> File("target/test-libs/commons-logging.jar"),
>                                        new
> File("target/test-libs/jstl.jar"),
>                                        new
> File("target/test-libs/log4j.jar"),
>                                        new
> File("target/test-libs/standard.jar"));
>
>        addResources("src/main/webapp", "", archive);
>        System.out.println(archive.toString(true));
>                return archive;
>    }
>
> The first way looks simpler to me, but I'm wondering if I'm missing some
> benefit provided by the arquillian way.
>
> Also is there an easy way to just use the .war file created in the target
> folder and have that deployed in tomee-embedded.  Programmatically creating
> the archive seems like hard work to me if the war file has already been
> created, but again being new to all this, i could have easily missed the
> point.  I also don't get why you have to manually copy the dependent jars
> when you have already specified the jars you need in your maven
> depedencies.
> This is probably more arquillian related questions than openejb questions
> but appreciate any directions or tips i can get since i know openejb dev
> guys are working on this sort of integration testing capability.
>
> --
> View this message in context:
> http://openejb.979440.n4.nabble.com/tomee-embedded-test-case-best-practice-tp4117711p4117711.html
> Sent from the OpenEJB User mailing list archive at Nabble.com.
>

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message