Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

jbossHome 'null' must exists

I am getting jbossHome 'null' must exists error while trying to run unit tests. I created a simple test class just to configure arquillian:

@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);
}
}

I had set the JBOSS_HOME variable already and also tried to configure it on arquillian.xml file that I've put inside META-INF folder on main program package.

This is the 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>

and this is my pom.xml:

<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>

like image 865
Marcos J.C Kichel Avatar asked Mar 01 '15 18:03

Marcos J.C Kichel


1 Answers

arquillian.xml should be in src/test/resources

like image 73
Aslak Knutsen Avatar answered Oct 18 '22 20:10

Aslak Knutsen