i want to test my JavaEE app. I deploy it on jboss 6.4 and developed that in NetBeans 8.1
I´ve created JavaEE Client Project. At first i initialize my EjbContainer like this:
javax.ejb.embeddable.EJBContainer = = EJBContainer.createEJBContainer();
Netbeans suggest me:
Use EJBContainer from installation of GlassFishServer 4.1
I dont want use that, because i use Jboss as application server. On this link, it will be described, how can i do that:
but it does not works for me:
Failed to execute goal org.apache.maven.plugins:maven-surefire-plugin:2.7.2:test (default-test) on project APPLICATION_TEST_CLIENT: There are test failures. For more information about the errors and possible solutions, please read the following articles: [Help 1] http://ift.tt/1aCDfYM
Here is my pom.xml
<project xmlns="http://ift.tt/IH78KX" xmlns:xsi="http://ift.tt/ra1lAU"
xsi:schemaLocation="http://ift.tt/IH78KX http://ift.tt/VE5zRx">
<modelVersion>4.0.0</modelVersion>
<groupId>com.mycompany</groupId>
<artifactId>APPLICATION_TEST_CLIENT</artifactId>
<version>1.0-SNAPSHOT</version>
<packaging>app-client</packaging>
<name>VIS_APPLICATION_TEST_CLIENT</name>
<properties>
<endorsed.dir>${project.build.directory}/endorsed</endorsed.dir>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
<repositories>
<repository>
<id>jboss-public-repository-group</id>
<name>JBoss Public Maven Repository Group</name>
<url>http://ift.tt/RvTNo3;
<layout>default</layout>
<releases>
<enabled>true</enabled>
<updatePolicy>never</updatePolicy>
</releases>
<snapshots>
<enabled>true</enabled>
<updatePolicy>never</updatePolicy>
</snapshots>
</repository>
</repositories>
<dependencies>
<dependency>
<groupId>javax</groupId>
<artifactId>javaee-api</artifactId>
<version>6.0</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.8.2</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>javax</groupId>
<artifactId>javaee-web-api</artifactId>
<version>6.0</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.glassfish.extras</groupId>
<artifactId>glassfish-embedded-all</artifactId>
<version>3.1</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.jboss.ejb3.embedded</groupId>
<artifactId>jboss-ejb3-embedded-standalone</artifactId>
<version>1.0.0-alpha-4</version>
</dependency>
</dependencies>
<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>
<compilerArguments>
<endorseddirs>${endorsed.dir}</endorseddirs>
</compilerArguments>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-acr-plugin</artifactId>
<version>1.0</version>
<extensions>true</extensions>
<configuration>
<archive>
<manifest>
<mainClass>com.mycompany.application_test_client.Main</mainClass>
</manifest>
</archive>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
<version>2.1</version>
<executions>
<execution>
<phase>validate</phase>
<goals>
<goal>copy</goal>
</goals>
<configuration>
<outputDirectory>${endorsed.dir}</outputDirectory>
<silent>true</silent>
<artifactItems>
<artifactItem>
<groupId>javax</groupId>
<artifactId>javaee-endorsed-api</artifactId>
<version>6.0</version>
<type>jar</type>
</artifactItem>
</artifactItems>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>1.6</source>
<target>1.6</target>
</configuration>
</plugin>
<plugin>
<artifactId>maven-failsafe-plugin</artifactId>
<version>2.6</version>
<configuration>
<argLine>-Djboss.home=${JBOSS_HOME} -Xmx512m -XX:MaxPermSize=256m -Djava.endorsed.dirs=${JBOSS_HOME}/lib/endorsed</argLine>
</configuration>
<executions>
<execution>
<goals>
<goal>integration-test</goal>
<goal>verify</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>
and here is my Test-Constructor:
import javax.ejb.embeddable.EJBContainer;
import javax.naming.Context;
import org.junit.After;
import org.junit.AfterClass;
import org.junit.Before;
import org.junit.BeforeClass;
import org.junit.Test;
import java.io.File;
import java.util.HashMap;
import java.util.Map;
/**
*
* @author me
*/
public class NewEmptyJUnitTest {
public static EJBContainer container;
public static Context ctx;
public NewEmptyJUnitTest() {
System.setProperty("org.jboss.as.embedded.ejb3.BARREN", "true");
System.setProperty("jboss.home", "C:\\jboss-eap-6.4");
System.setProperty("jboss.home.dir", "C:\\jboss-eap-6.4");
Map<String, Object> props = new HashMap<String, Object>();
File[] ejbModules = new File[1];
ejbModules[0] = new File("C:\\Users\\me\\Documents\\NetBeansProjects");
props.put(EJBContainer.MODULES, ejbModules);
EJBContainer container = EJBContainer.createEJBContainer(props);
}
@BeforeClass
public static void setUpClass() {
//container = EJBContainer.createEJBContainer();
//ctx = container.getContext();
}
@AfterClass
public static void tearDownClass() {
container.close();
}
@Before
public void setUp() {
}
@After
public void tearDown() {
}
How can i use embedded EjbContainer in my Maven JavaEE Client Project on Netbeans/Jboss for Testing??
Aucun commentaire:
Enregistrer un commentaire