Arquillian & jBoss 7.1.1: Test failed
big-gremlin Dec 9, 2012 11:15 AMhey
ich have some problems with my configuration.
I have two projects... the mainprojekt and a arquillian-test-project. In the arquillian-project there are only the tests for the main-project.
pom.xml
<?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>de.java.arquillian</groupId>
<artifactId>arquillian-swt</artifactId>
<version>0.0.1-SNAPSHOT</version>
<name>Arquillian-Projekt</name>
<properties>
<arquillian.version>1.0.3.Final</arquillian.version>
</properties>
<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>
</build>
<dependencyManagement>
<dependencies>
<dependency>
<groupId>org.jboss.arquillian</groupId>
<artifactId>arquillian-bom</artifactId>
<version>${arquillian.version}</version>
<scope>import</scope>
<type>pom</type>
</dependency>
</dependencies>
</dependencyManagement>
<repositories>
<repository>
<id>jboss-public-repository</id>
<name>JBoss Repository</name>
<url>https://repository.jboss.org/nexus/content/groups/public</url>
<releases>
<updatePolicy>never</updatePolicy>
</releases>
<snapshots>
<updatePolicy>daily</updatePolicy>
</snapshots>
</repository>
<repository>
<id>jboss-deprecated-repository-group</id>
<name>JBoss Deprecated Maven Repository Group</name>
<url>https://repository.jboss.org/nexus/content/repositories/deprecated/</url>
<releases>
<enabled>true</enabled>
<updatePolicy>never</updatePolicy>
</releases>
<snapshots>
<enabled>true</enabled>
<updatePolicy>never</updatePolicy>
</snapshots>
</repository>
</repositories>
<dependencies>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.8.2</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.jboss.arquillian.junit</groupId>
<artifactId>arquillian-junit-container</artifactId>
<scope>test</scope>
</dependency>
</dependencies>
<profiles>
<profile>
<id>jbossas-remote-7</id>
<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>org.jboss.as</groupId>
<artifactId>jboss-as-arquillian-container-remote</artifactId>
<version>7.1.1.Final</version>
</dependency>
</dependencies>
</profile>
</profiles>
</project>
src/test/resources/arquillian.xml
<?xml version="1.0" encoding="UTF-8"?> <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"> <engine> <property name="deploymentExportPath">target</property> </engine> <container qualifier="jbossas-remote-7" default="true"> <configuration> <property name="providerUrl">jnp://localhost:80</property> </configuration> </container> </arquillian>
src/main/resources/META-INF/persistence.xml
<persistence xmlns="http://java.sun.com/xml/ns/persistence" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/persistence http://java.sun.com/xml/ns/persistence/persistence_2_0.xsd" version="2.0"> <persistence-unit name="BankUnit" transaction-type="JTA"> <provider>org.hibernate.ejb.HibernatePersistence</provider> <!-- Datenquelle ist PostGres --> <jta-data-source>java:jboss/datasources/PostgresDS</jta-data-source> <properties> <!-- Konfiguration für den PostGreSQL-Dialekt --> <property name="hibernate.dialect" value="org.hibernate.dialect.PostgreSQLDialect"/> <!-- Sicherheitseinstellungen --> <property name="hibernate.hbm2ddl.auto" value="update"/> <property name="hibernate.show_sql" value="false"/> <property name="hibernate.format_sql" value="false"/> <property name="hibernate.use_sql_comments" value="false"/> <property name="hibernate.archive.autodetection" value="class"/> </properties> </persistence-unit> </persistence>
(this is the same one like in the mainproject)
-------------------------------------------------------------------------------------
i've written a small class to test in my mainproject...
public class Greeter {
public void greet(PrintStream to, String name) {
to.println(createGreeting(name));
}
public String createGreeting(String name) {
return "Hello, " + name + "!";
}
}
...and a small test in the arquillian-project
@RunWith(Arquillian.class)
public class GreeterTest {
@Deployment
public static JavaArchive createDeployment() {
return ShrinkWrap.create(JavaArchive.class, "test.jar")
.addClass(Greeter.class)
.addAsManifestResource(EmptyAsset.INSTANCE, "beans.xml");
}
@Inject
Greeter greeter;
@Test
public void should_create_greeting() {
Assert.assertEquals("Hello, Earthling!",
greeter.createGreeting("Earthling"));
greeter.greet(System.out, "Earthling");
}
}
If the server runs and i start the test, the tests ends without failures.
Now i want to make a little test for the crud-methods of my project:
@RunWith(Arquillian.class)
public class CrudTest {
@Deployment
public static Archive<?> createDeployment() {
return ShrinkWrap.create(WebArchive.class, "test.war")
.addClasses(Bank.class, BankCRUD.class)
.addAsManifestResource(EmptyAsset.INSTANCE, "beans.xml")
.addAsManifestResource("META-INF/persistence.xml",
ArchivePaths.create("persistence.xml"))
.addAsManifestResource(EmptyAsset.INSTANCE,
ArchivePaths.create("ejb-jar.xml"));
}
@Inject
BankCRUD bankCrud;
@Test
public void testSave() throws Exception {
Bank bank = new Bank();
bank.setName("Testbank");
bank.setSortCode(12345);
bankCrud.save(bank);
Bank pBank = bankCrud.loadInstance(bank.getId());
assertNotNull(pBank);
}
}
(Bank is an entity, BankCRUD is a stateful-class with CRUD-methods & the EntityManager-Instance)
Now, if i start the test, it ends with the following failure:
org.jboss.arquillian.container.spi.client.container.DeploymentException: Could not deploy to container: {"JBAS014671: Failed services" => {"jboss.deployment.unit.\"test.war\".POST_MODULE" => "org.jboss.msc.service.StartException in service jboss.deployment.unit.\"crudTest.war\".POST_MODULE: Failed to process phase POST_MODULE of deployment \"crudTest.war\""}}
at org.jboss.as.arquillian.container.ArchiveDeployer.deploy(ArchiveDeployer.java:74)
at org.jboss.as.arquillian.container.CommonDeployableContainer.deploy(CommonDeployableContainer.java:148)
at org.jboss.arquillian.container.impl.client.container.ContainerDeployController$3.call(ContainerDeployController.java:161)
at org.jboss.arquillian.container.impl.client.container.ContainerDeployController$3.call(ContainerDeployController.java:128)
at org.jboss.arquillian.container.impl.client.container.ContainerDeployController.executeOperation(ContainerDeployController.java:271)
at org.jboss.arquillian.container.impl.client.container.ContainerDeployController.deploy(ContainerDeployController.java:127)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at org.jboss.arquillian.core.impl.ObserverImpl.invoke(ObserverImpl.java:94)
at org.jboss.arquillian.core.impl.EventContextImpl.invokeObservers(EventContextImpl.java:99)
at org.jboss.arquillian.core.impl.EventContextImpl.proceed(EventContextImpl.java:81)
at ...
can somebody check my configuration, pls?
i'm very frustrated