2015-03-01 15 views
6

Tôi nhận được jbossHome 'null' phải tồn tại lỗi trong khi cố gắng chạy thử nghiệm đơn vị. Tôi tạo ra một lớp thử nghiệm đơn giản chỉ để cấu hình arquillian:jbossHome 'null' phải tồn tại

@RunWith(Arquillian.class) 
public class EmpresaResourceTest { 

@Deployment @OverProtocol("Servlet 3.0") 
public static JavaArchive createDeployment() { 
    System.out.println("entrou"); 
    return ShrinkWrap.create(JavaArchive.class) 
      .addClass(
        EmpresaResource.class 
        ) 
      .addAsManifestResource(EmptyAsset.INSTANCE, "beans.xml"); 
} 
//TESTES BASICOS// 

@Test 
public void teste() { 
    System.out.println("entrou"); 
    Assert.assertTrue(true); 
} 
} 

tôi đã đặt biến JBOSS_HOME đã và cũng đã cố gắng để cấu hình nó trong hồ sơ arquillian.xml mà tôi đã đặt bên trong thư mục META-INF trên gói chương trình chính .

Đây là arquillian.xml:

<arquillian xmlns="http://jboss.org/schema/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="wildfly" default="true"> 
    <configuration> 
     <property name="jbossHome">E:\arquivos\wildfly-8.2.0.Final</property> 
    </configuration> 
</container> 

và đây là pom.xml của tôi:

<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>br.com.logtec</groupId> 
<artifactId>WebDeliveryService</artifactId> 
<packaging>war</packaging> 
<version>1.0-SNAPSHOT</version> 
<name>WebDeliveryService</name> 

<dependencyManagement> 
    <dependencies> 
     <dependency> 
      <groupId>org.jboss.arquillian</groupId> 
      <artifactId>arquillian-bom</artifactId> 
      <version>${arquilian-bom.version}</version> 
      <scope>import</scope> 
      <type>pom</type> 
     </dependency> 
    </dependencies> 
</dependencyManagement> 

<build> 
    <finalName>WebDeliveryService</finalName> 
    <plugins> 
     <plugin> 
      <artifactId>maven-compiler-plugin</artifactId> 
      <version>3.2</version> 
      <configuration> 
       <source>${maven-compiler.version}</source> 
       <target>${maven-compiler.version}</target> 
      </configuration> 
     </plugin> 

     <plugin> 
      <artifactId>maven-surefire-plugin</artifactId> 
      <version>${maven-surefire.version}</version> 

      <configuration> 
       <!-- Fork every test because it will launch a separate AS instance --> 
       <forkMode>always</forkMode> 
       <systemPropertyVariables> 
        <java.util.logging.manager>org.jboss.logmanager.LogManager</java.util.logging.manager> 
         <!-- the maven dependency plugin will have already downloaded the server on /target --> 
        <jboss.home>${jboss.home}</jboss.home> 
        <module.path>${jboss.home}</module.path> 
       </systemPropertyVariables> 
       <redirectTestOutputToFile>false</redirectTestOutputToFile> 
      </configuration> 

     </plugin> 
    </plugins> 
</build> 

<dependencies> 

    <!-- QBEasy --> 
    <dependency> 
     <groupId>br.com.boilerplatecorp</groupId> 
     <artifactId>qbeasy</artifactId> 
     <version>${br.com.boilerplatecorp.qbeasy.version}</version> 
    </dependency> 

    <!-- JUnit --> 
    <dependency> 
     <groupId>junit</groupId> 
     <artifactId>junit</artifactId> 
     <version>${junit.junit.version}</version> 
     <scope>test</scope> 
    </dependency> 

    <!-- Arquillian --> 
    <dependency> 
     <groupId>org.jboss.arquillian.junit</groupId> 
     <artifactId>arquillian-junit-container</artifactId> 
     <scope>test</scope> 
    </dependency> 

    <!-- PoDam --> 
    <dependency> 
     <groupId>uk.co.jemos.podam</groupId> 
     <artifactId>podam</artifactId> 
     <version>${uk.co.jemos.podam.podam.version}</version> 
    </dependency> 

    <!-- Model Mapper --> 
    <dependency> 
     <groupId>org.modelmapper</groupId> 
     <artifactId>modelmapper</artifactId> 
     <version>${org.modelmapper.modelmapper.version}</version> 
    </dependency> 

    <!-- Gson --> 
    <dependency> 
     <groupId>com.google.code.gson</groupId> 
     <artifactId>gson</artifactId> 
     <version>2.3.1</version> 
     <scope>test</scope> 
    </dependency> 

</dependencies> 

<profiles> 
    <profile> 
     <id>wildfly8.2-embutido</id> 

     <activation> 
      <activeByDefault>true</activeByDefault> 
     </activation> 

     <dependencies> 

      <!-- Java EE 7 --> 
      <dependency> 
       <groupId>javax</groupId> 
       <artifactId>javaee-api</artifactId> 
       <version>${javaee-api.version}</version> 
       <scope>provided</scope> 
      </dependency> 

      <!-- Arquillian Adapter --> 
      <dependency> 
       <groupId>org.wildfly</groupId> 
       <artifactId>wildfly-arquillian-container-embedded</artifactId> 
       <version>${wildfly.version}</version> 
      </dependency> 

      <dependency> 
       <groupId>org.wildfly</groupId> 
       <artifactId>wildfly-embedded</artifactId> 
       <version>${wildfly.version}</version> 
       <exclusions> 
        <exclusion> 
         <artifactId>jconsole</artifactId> 
         <groupId>sun.jdk</groupId> 
        </exclusion> 
       </exclusions> 
      </dependency> 

      <!-- Protocolo para execução de testes --> 
      <dependency> 
       <groupId>org.jboss.arquillian.protocol</groupId> 
       <artifactId>arquillian-protocol-servlet</artifactId> 
       <scope>test</scope> 
      </dependency> 

     </dependencies> 
    </profile> 
</profiles> 

<properties> 
    <!-- Bills of Materials --> 
    <arquilian-bom.version>1.1.7.Final</arquilian-bom.version> 

    <!-- Plugins -->  
    <maven-compiler.version>1.8</maven-compiler.version> 
    <maven-surefire.version>2.17</maven-surefire.version> 

    <!-- Dependencies --> 
    <javaee-api.version>7.0</javaee-api.version> 
    <br.com.boilerplatecorp.qbeasy.version>1.0</br.com.boilerplatecorp.qbeasy.version> 
    <junit.junit.version>4.12</junit.junit.version> 
    <uk.co.jemos.podam.podam.version>4.7.3.RELEASE</uk.co.jemos.podam.podam.version> 
    <wildfly.version>8.2.0.Final</wildfly.version> 
    <org.slf4j.slf4j-log4j.version>1.7.10</org.slf4j.slf4j-log4j.version> 
    <org.modelmapper.modelmapper.version>0.7.3</org.modelmapper.modelmapper.version> 

    <!-- Configuracoes --> 
    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> 
    <jboss.home>E:\arquivos\wildfly-8.2.0.Final</jboss.home> 
</properties> 

Trả lời

6

arquillian.xml phải ở trong src/kiểm tra/resources

+0

ví dụ có thể b e tìm thấy tại đây https://github.com/wildfly/wildfly-arquillian/blob/master/container-embedded/src/test/resources/arquillian.xml – ozOli

Các vấn đề liên quan