0

I have a Data project and an EJB project created. Now I have created another Arquillian project for testing the above two with it using JUnit. I have created pom.xml file

    <?xml version="1.0" encoding="UTF-8"?>
<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/xsd/maven-4.0.0.xsd">
  <modelVersion>4.0.0</modelVersion>

  <groupId>org.arquillian.unit.test</groupId>
  <artifactId>arquillian-test</artifactId>
  <version>0.0.1-SNAPSHOT</version>
  <packaging>jar</packaging>

  <name>arquillian-test</name>
  <url>http://maven.apache.org</url>

  <properties>
    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
  </properties>
  <dependencyManagement>
    <dependencies>
      <dependency>
        <groupId>org.jboss.arquillian</groupId>
        <artifactId>arquillian-bom</artifactId>
        <version>1.1.1.Final</version>
        <scope>import</scope>
        <type>pom</type>
      </dependency>
    </dependencies>
  </dependencyManagement>
  <repositories>
    <repository>
      <id>jboss-public-repository-group</id>
      <name>JBoss Public Repository Group</name>
      <url>http://repository.jboss.org/nexus/content/groups/public/</url>
      <layout>default</layout>
      <releases>
        <enabled>true</enabled>
        <updatePolicy>never</updatePolicy>
      </releases>
      <snapshots>
        <enabled>true</enabled>
        <updatePolicy>never</updatePolicy>
      </snapshots>
    </repository>
    <repository>
      <id>jboss-deprecated</id>
      <name>JBoss Deprecated</name>
      <url>https://repository.jboss.org/nexus/content/repositories/deprecated/</url>
      <layout>default</layout>
      <releases>
        <enabled>true</enabled>
        <updatePolicy>never</updatePolicy>
      </releases>
      <snapshots>
        <enabled>false</enabled>
      </snapshots>
    </repository>
    <repository>
      <id>jboss-maven2-brew</id>
      <name>JBoss Maven 2 Brew Repository</name>
      <url>http://repository.jboss.org/maven2-brew/</url>
      <layout>default</layout>
      <releases>
        <enabled>true</enabled>
        <updatePolicy>never</updatePolicy>
      </releases>
      <snapshots>
        <enabled>false</enabled>
      </snapshots>
    </repository>
  </repositories>
  <pluginRepositories>
    <pluginRepository>
      <id>jboss-public-repository-group</id>
      <name>JBoss Public Repository Group</name>
      <url>http://repository.jboss.org/nexus/content/groups/public/</url>
      <releases>
        <enabled>true</enabled>
      </releases>
      <snapshots>
        <enabled>true</enabled>
      </snapshots>
    </pluginRepository>
  </pluginRepositories>
  <build>
    <plugins>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-compiler-plugin</artifactId>
        <version>2.3.2</version>
        <configuration>
          <source>1.6</source>
          <target>1.6</target>
        </configuration>
      </plugin>
    </plugins>
    <testResources>
      <testResource>
        <directory>FocalColectEJB/com/focalinfo/service</directory>
      </testResource>
    </testResources>
  </build>
  <dependencies>
    <dependency>
      <groupId>org.jboss.spec</groupId>
      <artifactId>jboss-javaee-6.0</artifactId>
      <version>1.0.0.Final</version>
      <type>pom</type>
      <scope>provided</scope>
    </dependency>
    <dependency>
      <groupId>junit</groupId>
      <artifactId>junit</artifactId>
      <version>4.8.1</version>
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>org.jboss.arquillian.junit</groupId>
      <artifactId>arquillian-junit-container</artifactId>
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>javax.inject</groupId>
      <artifactId>javax.inject</artifactId>
      <version>1</version>
    </dependency>
  </dependencies>
  <profiles>
    <profile>
      <id>jbossas-managed-5.1</id>
      <dependencies>
        <dependency>
          <groupId>org.jboss.arquillian.container</groupId>
          <artifactId>arquillian-jbossas-managed-5.1</artifactId>
          <version>1.0.0.CR3</version>
        </dependency>
        <dependency>
          <groupId>org.jboss.jbossas</groupId>
          <artifactId>jboss-server-manager</artifactId>
          <version>1.0.3.GA</version>
        </dependency>
        <dependency>
          <groupId>org.jboss.jbossas</groupId>
          <artifactId>jboss-as-client</artifactId>
          <version>5.1.0.GA</version>
          <type>pom</type>
        </dependency>
      </dependencies>
    </profile>
  </profiles>
</project>

How to map my ejbs in order to be able to test them in my Arquillian project?

4

1 回答 1

0

你有几个选择。

  1. 如果您的 EJB 和其他 JAR 单独部署到您的应用程序,您可以在测试用例中使用多个部署。只有一个是“可测试的”,但两者都可以部署。您可以使用 ShrinkWrap 的 maven 解析器简化对这个外部 JAR 文件的读取。
  2. 如果它们包含在 WAR 或 EAR 中,只需使用该 WAR 或 EAR 作为您的部署。
于 2013-09-01T15:11:53.220 回答