2011-07-22 63 views
3

我已經使用由完整JBoss服務器內的Arquillian運行的一些JUnit測試(在名爲的jboss-remote-6內部)內設置了我們的項目。我幾乎在http://docs.jboss.org/arquillian/reference/latest/en-US/html/gettingstarted.html所做的一切都是爲說明書中無。Arquillian/JUnit測試從控制檯運行,但不在Eclipse內部

如果我在控制檯執行mvn test,一切都正確執行,並且斷言檢查。

但是,當我試圖在Eclipse中JUnit測試用例運行時,出現以下異常:

org.jboss.arquillian.impl.client.deployment.ValidationException: DeploymentScenario contains targets not maching any defined Container in the registry. _DEFAULT_ 
    at org.jboss.arquillian.impl.client.deployment.DeploymentGenerator.validate(DeploymentGenerator.java:95) 
    at org.jboss.arquillian.impl.client.deployment.DeploymentGenerator.generateDeployment(DeploymentGenerator.java:77) 
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) 
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) 
    at  sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) 
    at java.lang.reflect.Method.invoke(Method.java:597) 
(...) 

我設立這個項目的Maven的輪廓正確地「jbossas遠程-6」作爲在pom.xml中聲明。我究竟做錯了什麼? Google對這個特定的一個沒有幫助。

最好的問候, 塞巴斯蒂安

回答

3

有我做,使這項工作的各種事情。我的角色模型是jboss-javaee6 Maven原型,它還使用Arquillian在遠程JBoss 6服務器中對代碼進行單元測試。我做了以下步驟:

添加arquillian.xml

我加入了Arquillian.xml放在src /測試/資源:

<?xml version="1.0" encoding="UTF-8"?> 
<arquillian xmlns="http://jboss.com/arquillian" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
xsi:schemaLocation=" 
    http://jboss.org/schema/arquillian 
    http://jboss.org/schema/arquillian/arquillian-1.0.xsd"> 

    <container qualifier="jbossas-remote" default="true"> 
     <property name="httpPort">8080</property> 
    </container> 
</arquillian> 

拆封一WebArchive而不是JavaArchive

使用return Shrinkwrap.create(WebArchive.class, "test.war")代替可用的方法addAsWebInfResource()方法的JavaArchive.class,其中I C烏爾德添加產生的beans.xml空。

調整的pom.xml減少CLASSPATH長度

的Eclipse不斷用的javaw.exe給出CreateProcess的誤差= 87消息斷裂。這是由於控制檯命令的CLASSPATH太長所致。由於依賴的jboss-作爲客戶端添加依賴Bazillions,我把它改成的jboss-AS-profileservice客戶端的正常工作,而且具有更少很大的依賴性。

另一個重要的事情是有一個jndi.properties文件中的src /測試/資源目錄,如文檔的Arquillian規定。但這已經是這種情況了。我猜arquillian.xml帶來的變化 - 這個文件是從來沒有在文檔中提到,剛看到它的原型。

這是遠程JBoss測試我的Maven簡介:

<profile> 
    <id>jbossas-remote-6</id> 
    <dependencies> 
    <dependency> 
     <groupId>org.jboss.arquillian.container</groupId> 
     <artifactId>arquillian-jbossas-remote-6</artifactId> 
     <version>1.0.0.Alpha5</version>    
    </dependency> 
    <dependency> 
     <groupId>org.jboss.spec</groupId> 
     <artifactId>jboss-javaee-6.0</artifactId> 
     <version>2.0.0.Final</version> 
     <type>pom</type> 
     <scope>provided</scope> 
    </dependency> 
    <dependency> 
     <groupId>org.jboss.jbossas</groupId> 
     <artifactId>jboss-as-profileservice-client</artifactId> 
     <version>6.0.0.Final</version> 
     <type>pom</type>    
    </dependency> 
    </dependencies> 
<build> 
    <testResources> 
     <testResource> 
      <directory>src/test/resources</directory> 
     </testResource> 
    </testResources> 
</build> 

我希望我的回答將是某人有用。:)

相關問題