版本:html
eclipse: 4.2.0java
seam: 2.3.0.Finalapi
jboss-as: 7.1.0.Finaleclipse
當前ftc項目pom.xml中的dependency已經包含了arquiilian依賴,因此不用再從官網上覆制大片xml到本身的pom.xml中了。但要想在eclipse中執行單元測試還須要一點點改動:maven
咱們首先在cn.ftc.test包下寫一個測試類,代碼以下:單元測試
package cn.ftc.test; 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.asset.EmptyAsset; import org.jboss.shrinkwrap.api.spec.JavaArchive; import org.junit.Assert; import org.junit.Test; import org.junit.runner.RunWith; @RunWith(Arquillian.class) public class ExcelProcessorTest { @Deployment public static JavaArchive createDeployment() { return ShrinkWrap.create(JavaArchive.class) .addClass(ExcelProcessorTest.class) .addAsManifestResource(EmptyAsset.INSTANCE, "beans.xml"); } @Test public void should_create_greeting() { System.out.println("hello"); } }
<container qualifier="jboss" default="true"> <configuration> <property name="jbossHome">你的JBoss安裝目錄</property> </configuration> </container>
<profile> <id>arq-jbossas-7-managed</id> <activation> <property> <name>arquillian</name> <value>jbossas-managed-7</value> </property> </activation> <dependencies> <dependency> <groupId>org.jboss.as</groupId> <artifactId>jboss-as-arquillian-container-managed</artifactId> <version>7.1.1.Final</version> <!-- 添加這一行 --> <scope>test</scope> </dependency> </dependencies>
<profile> <id>arq-jbossas-7-remote</id> <activation> <property> <name>arquillian</name> <value>jbossas-remote-7</value> </property> </activation> <dependencies> <dependency> <groupId>org.jboss.as</groupId> <artifactId>jboss-as-arquillian-container-remote</artifactId> <version>7.1.1.Final</version> <!-- 添加此行 --> <scope>test</scope> </dependency> </dependencies>