Arquillian: Wildfly embedded?

前端 未结 4 1571
南笙
南笙 2020-12-17 17:22

Until now I had my integration tests running with Arquillian and an embedded Glassfish 4.x. As I suffer from bug ARQ-1458, I tried migrating to Wildfly 8.0.0.Beta1.

相关标签:
4条回答
  • 2020-12-17 17:34

    Well, I guess that it works differently w/ Wildfly than with Glassfish:

    https://community.jboss.org/thread/236562

    :(

    Edit: Docker adds another perspective on this issue. I could easily manage the external container using Docker and Maven while still using Arquillian. Did not test it yet, but if someone stumbles upon this...

    0 讨论(0)
  • 2020-12-17 17:45

    Look at this nice article written by Dan Allen.

    To be short: generally do not use an embedded container (glassfish with EclipseLink particularly). Standalone server gives us more accurate test results.

    Also I prefer remote adapters due to speed of development (none server startup with every test launch, just start it manually once). If you want the container to start automatically like with embedded, then switch to a managed container.

    Hope it helps.

    0 讨论(0)
  • 2020-12-17 17:46

    One should set environment variable JBOSS_HOME to path to jBoss installation. Otherwise, a tag property should be added to arquillian.xml inside a container tag.

    <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="jboss" default="true">
        <configuration>
            <property name="jbossHome">/path/to/jboss/as</property>
        </configuration>
    </container>
    

    from example application jboss-javaee6-webapp

    0 讨论(0)
  • 2020-12-17 17:52

    use systemPropertyVariables

    <profile>
    <id>INTEGRATION_TESTS</id>
    <dependencies>
        <dependency>
            <groupId>org.wildfly</groupId>
            <artifactId>wildfly-arquillian-container-embedded</artifactId>
            <version>8.2.0.Final</version>
        </dependency>
        <!-- this is the wildfly emb.container - BUT eventually it is not a fully blown emb.container-->
        <dependency>
            <groupId>org.wildfly</groupId>
            <artifactId>wildfly-embedded</artifactId>
            <version>8.2.0.Final</version>
        </dependency>
    
        <dependency>
            <groupId>com.oracle</groupId>
            <artifactId>ojdbc6</artifactId>
            <version>11.2.0.3</version>
        </dependency>
    </dependencies>
    <build>
        <plugins>
            <plugin>
                <artifactId>maven-dependency-plugin</artifactId>
                <executions>
                    <execution>
                        <id>unpack</id>
                        <phase>process-test-classes</phase>
                        <goals>
                            <goal>unpack</goal>
                        </goals>
                        <configuration>
                            <artifactItems>
                                <artifactItem>
                                    <groupId>org.wildfly</groupId>
                                    <artifactId>wildfly-dist</artifactId>
                                    <version>8.2.0.Final</version>
                                    <type>zip</type>
                                    <overWrite>false</overWrite>
                                    <outputDirectory>target</outputDirectory>
                                </artifactItem>
                            </artifactItems>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
    
            <plugin>
                <groupId>org.wildfly.plugins</groupId>
                <artifactId>wildfly-maven-plugin</artifactId>
                <version>1.0.2.Final</version>
                <executions>
                    <execution>
                        <phase>prepare-package</phase>
                        <goals>
                            <goal>start</goal>
                        </goals>
                    </execution>
                    <execution>
                        <id>jdbc</id>
                        <phase>package</phase>
                        <goals>
                            <goal>deploy-artifact</goal>
                        </goals>
                        <configuration>
                            <groupId>com.oracle</groupId>
                            <artifactId>ojdbc6</artifactId>
                            <name>ojdbc6.jar</name>
                        </configuration>
                    </execution>
                    <execution>
                        <id>datasource</id>
                        <phase>package</phase>
                        <goals>
                            <goal>add-resource</goal>
                        </goals>
                        <configuration>
                            <address>subsystem=datasources,data-source=tests</address>
                            <resources>
                                <resource>
                                    <properties>
                                        <connection-url>jdbc:oracle:thin:@***:1521:xe</connection-url>
                                        <jndi-name>java:jboss/datasources/tests</jndi-name>
                                        <enabled>true</enabled>
                                        <enable>true</enable>
                                        <user-name>***</user-name>
                                        <password>***</password>
                                        <driver-name>ojdbc6.jar</driver-name>
                                        <use-ccm>false</use-ccm>
                                    </properties>
                                </resource>
                            </resources>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
    
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-failsafe-plugin</artifactId>
                <version>2.17</version>
                <configuration>
                    <systemPropertyVariables>
                        <java.util.logging.manager>org.jboss.logmanager.LogManager</java.util.logging.manager>
                        <jboss.home>${project.basedir}/target/wildfly-8.2.0.Final</jboss.home>
                        <module.path>${project.basedir}/target/wildfly-8.2.0.Final/modules</module.path>
                    </systemPropertyVariables>
                </configuration>
                <executions>
                    <execution>
                        <id>integration-test</id>
                        <goals>
                            <goal>integration-test</goal>
                        </goals>
                    </execution>
                    <execution>
                        <id>verify</id>
                        <goals>
                            <goal>verify</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
    
    
        </plugins>
    
    </build>
    

    0 讨论(0)
提交回复
热议问题