Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

making xa tests succeed with the latest arquillian #7

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
70 changes: 25 additions & 45 deletions xa/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -15,37 +15,19 @@
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<maven.build.timestamp.format>yyyyMMdd'T'HHmmss</maven.build.timestamp.format>
<arquillian.version>1.0.0.Alpha5</arquillian.version>
</properties>

<repositories>
<repository>
<id>jboss-public-repository</id>
<name>JBoss Repository</name>
<url>http://repository.jboss.org/nexus/content/groups/public</url>
<releases>
<updatePolicy>never</updatePolicy>
</releases>
<snapshots>
<enabled>false</enabled>
</snapshots>
</repository>
</repositories>

<pluginRepositories>
<pluginRepository>
<id>jboss-public-repository</id>
<name>JBoss Repository</name>
<url>http://repository.jboss.org/nexus/content/groups/public</url>
<releases>
<updatePolicy>never</updatePolicy>
</releases>
<snapshots>
<enabled>false</enabled>
</snapshots>
</pluginRepository>
</pluginRepositories>

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

<!-- JPA 2 annotation processor -->
Expand All @@ -70,9 +52,8 @@
</dependency>

<dependency>
<groupId>org.jboss.arquillian</groupId>
<artifactId>arquillian-junit</artifactId>
<version>${arquillian.version}</version>
<groupId>org.jboss.arquillian.junit</groupId>
<artifactId>arquillian-junit-container</artifactId>
<scope>test</scope>
</dependency>

Expand Down Expand Up @@ -132,10 +113,8 @@
</plugin>

<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<!-- version 2.5 creates seperate test suites per class -->
<version>2.4.3</version>
<version>2.12</version>
<configuration>
<includes>
<include>**/*TestCase.java</include>
Expand All @@ -160,16 +139,17 @@
<dependencies>
<dependency>
<groupId>org.jboss.arquillian.container</groupId>
<artifactId>arquillian-glassfish-embedded-3</artifactId>
<version>${arquillian.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.glassfish.extras</groupId>
<artifactId>glassfish-embedded-all</artifactId>
<version>3.0.1</version>
<scope>provided</scope>
</dependency>
<artifactId>arquillian-glassfish-embedded-3.1</artifactId>
<version>1.0.0.CR3</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.glassfish.main.extras</groupId>
<artifactId>glassfish-embedded-all</artifactId>
<version>3.1.2</version>
<scope>provided</scope>
</dependency>

<!-- To use Hibernate, specify Hibernate as provider in persistence.xml -->
<dependency>
<groupId>org.hibernate</groupId>
Expand Down
7 changes: 5 additions & 2 deletions xa/src/test/java/com/acme/jpa/TwoPhaseCommitTestCase.java
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,11 @@
package com.acme.jpa;

import static org.junit.Assert.assertEquals;
import static org.junit.Assert.fail;

import javax.ejb.EJB;

import org.jboss.arquillian.api.Deployment;
import org.jboss.arquillian.container.test.api.Deployment;
import org.jboss.arquillian.junit.Arquillian;
import org.jboss.shrinkwrap.api.Archive;
import org.jboss.shrinkwrap.api.ShrinkWrap;
Expand All @@ -36,7 +37,7 @@ public static Archive<?> createDeployment()
{
return ShrinkWrap.create(WebArchive.class, "test.war")
.addPackage(Game.class.getPackage())
.addManifestResource("test-persistence.xml", "persistence.xml");
.addAsResource("test-persistence.xml", "META-INF/persistence.xml");
}

@EJB
Expand All @@ -55,6 +56,7 @@ public void should_not_modify_database_transaction_fails()
try
{
service.succeedFirstFailSecondInTx();
fail();
}
catch (Exception e)
{
Expand All @@ -72,6 +74,7 @@ public void should_modify_database_if_no_transaction() throws Exception
try
{
service.succeedFirstFailSecondWithoutTx();
fail();
}
catch (Exception e)
{
Expand Down
30 changes: 17 additions & 13 deletions xa/src/test/resources/arquillian.xml
Original file line number Diff line number Diff line change
@@ -1,17 +1,21 @@
<?xml version="1.0" encoding="UTF-8"?>
<arquillian xmlns="http://jboss.com/arquillian"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:glassfish-embedded="urn:arq:org.jboss.arquillian.container.glassfish.embedded_3">
<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">

<!-- Uncomment to have test archives exported to the file system for inspection -->
<!--
<engine>
<deploymentExportPath>target/</deploymentExportPath>
</engine>
-->
<!-- Uncomment to have test archives exported to the file system for inspection -->
<!-- <engine> <property name="deploymentExportPath">target</property> </engine> -->

<glassfish-embedded:container>
<glassfish-embedded:sunResourcesXml>src/test/resources-glassfish-embedded/sun-resources.xml</glassfish-embedded:sunResourcesXml>
</glassfish-embedded:container>
<extension qualifier="persistence">
<property name="defaultDataSource">jdbc/a</property>
</extension>

</arquillian>
<!-- Required configuration for an embedded GlassFish instance -->
<container qualifier="glassfish-embedded" default="true">
<configuration>
<property name="bindHttpPort">7070</property>
<property name="resourcesXml">src/test/resources-glassfish-embedded/glassfish-resources.xml</property>
</configuration>
</container>

</arquillian>