tomee-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Christian Schlichtherle <christian-b...@schlichtherle.de>
Subject Re: Testing deployment with JMX interface
Date Tue, 20 Aug 2013 12:17:41 GMT
Hi,

I can't even get the simplest injection of EJBs working with TomEE Embedded. Here's my EJB:

package net.java.trueupdate.manager.impl.openejb;

import javax.ejb.Stateless;

@Stateless
public class Foo {
    @Override public String toString() { return "Hello world!"; }
}

Here's my test class:

package net.java.trueupdate.manager.impl.openejb;

import java.util.logging.Logger;
import javax.ejb.EJB;
import org.jboss.arquillian.container.test.api.Deployment;
import org.jboss.arquillian.junit.Arquillian;
import org.jboss.shrinkwrap.api.ShrinkWrap;
import org.jboss.shrinkwrap.api.spec.JavaArchive;
import org.junit.Test;
import org.junit.runner.RunWith;

@RunWith(Arquillian.class)
public class FooIT {

    private static final Logger
            logger = Logger.getLogger(FooIT.class.getName());

    @Deployment
    public static JavaArchive createDeployment() {
        final JavaArchive archive = ShrinkWrap.create(JavaArchive.class)
                .addClass(Foo.class);
        logger.info(archive.toString(true));
        return archive;
    }

    @EJB
    private Foo bean;

    @Test
    public void testInjection() {
        logger.info(bean.toString());
    }
}

And here's my pom.xml:

<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>

    <parent>
        <groupId>net.java.trueupdate</groupId>
        <artifactId>trueupdate-manager</artifactId>
        <version>0.1-SNAPSHOT</version>
    </parent>

    <artifactId>trueupdate-manager-impl-openejb</artifactId>
    <packaging>ejb</packaging>

    <dependencies>
        <dependency>
            <groupId>org.apache.openejb</groupId>
            <artifactId>arquillian-tomee-embedded</artifactId>
            <version>1.5.2</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.apache.openejb</groupId>
            <artifactId>javaee-api</artifactId>
            <version>6.0-5</version>
            <scope>provided</scope>
        </dependency>
    </dependencies>
</project>

Note that the parent POM pulls in Junit.

If I swap arquillian-tomee-embedded:1.5.2 with arquillian-openejb-embedded-4:4.5.2 then it
works. However, I am under the impression that I need TomEE to get to the JMX MBeans for Tomcat.

Regards,
Christian


Mime
View raw message