[jbossseam-issues] [JBoss JIRA] Commented: (JBSEAM-2371) Integration testing Seam components with Maven
Hemant Saxena (JIRA)
jira-events at lists.jboss.org
Thu Apr 24 11:03:20 EDT 2008
[ http://jira.jboss.com/jira/browse/JBSEAM-2371?page=comments#action_12410515 ]
Hemant Saxena commented on JBSEAM-2371:
---------------------------------------
I am able to successfully perform intregrated testing for seam components with jboss embedded container under my production mavenized project. Key to work is the separate inclusion of jboss-embedded dependency.
Here are the details:
We have parent POM and sub POMs structure in our project.
In parent POM, include:
====================
Step1:
<!-- JBoss Seam Test -->
<dependency>
<groupId>org.testng</groupId>
<artifactId>testng</artifactId>
<version>5.7</version>
<classifier>jdk15</classifier>
</dependency>
</dependencies>
</dependencyManagement>
Step2:
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.4.2</version>
</plugin>
</plugins>
</pluginManagement>
In the ejb/POM:
============
Step1:
<!-- TestNG -->
<dependency>
<groupId>org.testng</groupId>
<artifactId>testng</artifactId>
<scope>test</scope>
<classifier>jdk15</classifier>
</dependency>
<dependency>
<groupId>javax.el</groupId>
<artifactId>el-api</artifactId>
<scope>test</scope>
</dependency>
<!-- JBoss EJB3 Microcontainer for testing -->
<dependency>
<groupId>org.jboss.embedded</groupId>
<artifactId>jboss-embedded-all</artifactId>
<version>beta3</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.jboss.embedded</groupId>
<artifactId>jboss-embedded-all</artifactId>
<version>beta3</version>
<exclusions>
<exclusion>
<groupId>org.jboss.embedded</groupId>
<artifactId>jboss-embedded</artifactId>
</exclusion>
<exclusion>
<groupId>org.jboss.microcontainer</groupId>
<artifactId>jboss-deployers-client-spi</artifactId>
</exclusion>
<exclusion>
<groupId>org.jboss.microcontainer</groupId>
<artifactId>jboss-deployers-core-spi</artifactId>
</exclusion>
</exclusions>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.jboss.embedded</groupId>
<artifactId>hibernate-all</artifactId>
<version>beta3</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.jboss.embedded</groupId>
<artifactId>thirdparty-all</artifactId>
<version>beta3</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.jboss.embedded</groupId>
<artifactId>jboss-embedded</artifactId>
<version>beta3</version>
<scope>test</scope>
<exclusions>
<exclusion>
<groupId>org.jboss.microcontainer</groupId>
<artifactId>jboss-deployers-client-spi</artifactId>
</exclusion>
</exclusions>
</dependency>
step2:
<plugins>
<plugin>
<artifactId>maven-dependency-plugin</artifactId>
<executions>
<execution>
<configuration>
<artifactItems>
<artifactItem>
<groupId>org.jboss.embedded</groupId>
<artifactId>jboss-embedded-bootstrap</artifactId>
<type>zip</type>
<version>beta3</version>
</artifactItem>
</artifactItems>
<outputDirectory>${project.build.testOutputDirectory}</outputDirectory>
</configuration>
<id>download-embedded-jboss-bootstrap</id>
<phase>process-test-resources</phase>
<goals>
<goal>unpack</goal>
</goals>
</execution>
<execution>
<configuration>
<artifactItems>
<artifactItem>
<groupId>javax.xml.bind</groupId>
<artifactId>jaxb-api</artifactId>
<version>2.1</version>
</artifactItem>
</artifactItems>
<outputDirectory>${project.build.testOutputDirectory}/endorsed</outputDirectory>
</configuration>
<id>download-jaxb-api</id>
<phase>process-test-resources</phase>
<goals>
<goal>copy</goal>
</goals>
</execution>
</executions>
Step 3:
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<configuration>
<suiteXmlFiles>
<suiteXmlFile>src/test/java/com/autotrader/adsinvmgr/testng.xml</suiteXmlFile>
</suiteXmlFiles>
<additionalClasspathElements>
<additionalClasspathElement>${project.build.testOutputDirectory}/bootstrap</additionalClasspathElement>
</additionalClasspathElements>
<childDelegation>true</childDelegation>
<useSystemClassLoader>true</useSystemClassLoader>
<argLine>-Djava.endorsed.dirs=${project.build.testOutputDirectory}/endorsed -Dsun.lang.ClassLoader.allowArraySyntax=true</argLine>
</configuration>
</plugin>
You dont need to do argLine inclusion if you are using jdk5. It only requires for jdk6. Then start writing your test cases under (src/test/java) as defined in Seam Docs ( extending SeamTest).
PS:
when surefire plugin execute testng, it has the following output folders defined for classpath:
- ejb/target/classes
- ejb/target/test-classes
so files/folders like meta-inf/persistence.xml, seam.properties comes from ejb/classes. We dont need to add them seperately.
Please feel free to contact me for template project or for any further questions.
> Integration testing Seam components with Maven
> ----------------------------------------------
>
> Key: JBSEAM-2371
> URL: http://jira.jboss.com/jira/browse/JBSEAM-2371
> Project: Seam
> Issue Type: Task
> Components: Build, Test Harness
> Affects Versions: 2.0.0.GA
> Environment: Maven 2.0.7
> Reporter: Siarhei Dudzin
> Priority: Critical
> Fix For: 2.1.x
>
> Attachments: testproject-master-JBSEAM-2371.zip
>
>
> Various users have reported integration testing with Seam is not working in 'Mavenized' projects.
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://jira.jboss.com/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira
More information about the seam-issues
mailing list