quality@glassfish.java.net

Re: Unit testing EJB modules with GlassFish Embeddable

From: Wouter van Reeven <wouter_at_van.reeven.nl>
Date: Tue, 5 Jan 2010 20:22:56 +0100

Hi Richard,


Using the next pom.xml I was able to start an EJB 3.1 container, deploy
a Session bean to it and call a method on it:

<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/maven-v4_0_0.xsd">
    <modelVersion>4.0.0</modelVersion>
    <groupId>nl.reeven.van.test.ejb</groupId>
    <artifactId>EJBTester</artifactId>
    <packaging>jar</packaging>
    <version>1.0-SNAPSHOT</version>
    <name>EJBTester</name>
    <url>http://maven.apache.org</url>
    <build>
        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-compiler-plugin</artifactId>
                <version>2.0.2</version>
                <configuration>
                    <source>1.6</source>
                    <target>1.6</target>
                </configuration>
            </plugin>
        </plugins>
    </build>
    <dependencies>
        <dependency>
            <groupId>org.glassfish.extras</groupId>
            <artifactId>glassfish-embedded-all</artifactId>
            <version>3.0</version>
        </dependency>
        <dependency>
            <groupId>org.eclipse.persistence</groupId>
            <artifactId>eclipselink</artifactId>
            <version>2.0.0-RC1</version>
        </dependency>
        <dependency>
            <groupId>org.eclipse.persistence</groupId>
            <artifactId>javax.persistence</artifactId>
            <version>2.0.0</version>
        </dependency>
        <dependency>
            <groupId>junit</groupId>
            <artifactId>junit</artifactId>
            <version>3.8</version>
            <scope>test</scope>
        </dependency>
    </dependencies>
    <repositories>
        <repository>
            <id>java.net2</id>
            <name>Java.Net Maven2 Repository, hosts the javaee-api dependency</name>
            <url>http://download.java.net/maven/2</url>
        </repository>
        <repository>
            <id>GlassFish</id>
            <name>GlassFish Maven2 Repository, hosts the javaee-api dependency</name>
            <url>http://download.java.net/maven/glassfish</url>
        </repository>
        <repository>
            <url>http://ftp.ing.umu.se/mirror/eclipse/rt/eclipselink/maven.repo</url>
            <id>eclipselink</id>
            <layout>default</layout>
            <name>Repository for library Library[eclipselink]</name>
        </repository>
    </repositories>
</project>

If you like I can share my project with you.


HTH, Wouter

On Tue, Jan 05, 2010 at 09:00:35AM -0800, Ludo wrote:
> Richard Kolb wrote:
>> Hi Alexis
>>
>> 2010/1/5 Alexis Moussine-Pouchkine <alexis.mp
>> <http://alexis.mp>@sun.com <http://sun.com>>
>>
>> Can you share your full POM?
>>
>>
>> thanks, here you go.
>>
>> I can get GlassFish to start with a mvn install - the plugin is also
>> in the pom
>>
>> But I am trying to get a basic unit test working as per the Ant sample.
>>
>>
> fomr the pom and the stack trace, it seems that the test execution is
> using the jar from
>
> <dependency>
> <groupId>javax</groupId>
> <artifactId>javaee-api</artifactId>
> <version>6.0</version>
> <scope>provided</scope>
>
> which is only an API stripped jar containing no method byte code...This dep is for compiling only, not running anything, including embbeded mode.
> Ludo
> </dependency>
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: quality-unsubscribe_at_glassfish.dev.java.net
> For additional commands, e-mail: quality-help_at_glassfish.dev.java.net

-- 
Veel shit is mest voor de toekomst.
[Unknown Source]
Skype: wvreeven
Facebook: wvreeven
Twitter: wvreeven