[arquillian-issues] [JBoss JIRA] (ARQ-1782) @UsingDataSet/@ShouldMatchDataSet always makes test succeed

Nicklas Karlsson (JIRA) issues at jboss.org
Tue May 27 05:49:58 EDT 2014


    [ https://issues.jboss.org/browse/ARQ-1782?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12970714#comment-12970714 ] 

Nicklas Karlsson commented on ARQ-1782:
---------------------------------------

Perhaps related to ARQ-1758, downgrading to arq 1.1.3 made the seeding-file-validation error visible.

The em/transaction strangeness still remains, though.

> @UsingDataSet/@ShouldMatchDataSet always makes test succeed
> -----------------------------------------------------------
>
>                 Key: ARQ-1782
>                 URL: https://issues.jboss.org/browse/ARQ-1782
>             Project: Arquillian
>          Issue Type: Bug
>      Security Level: Public(Everyone can see) 
>          Components: Extension - Persistence
>    Affects Versions: persistence_1.0.0.Alpha7
>         Environment: WildFly 8 CR 2
>            Reporter: Nicklas Karlsson
>            Assignee: Bartosz Majsak
>
> {code: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>fi.affecto.marela</groupId>
> 	<artifactId>arq-concept</artifactId>
> 	<version>1.0.0-SNAPSHOT</version>
> 	<packaging>jar</packaging>
> 	<properties>
> 		<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
> 		<browser>chrome</browser>
> 	</properties>
> 	<dependencyManagement>
> 		<dependencies>
> 			<dependency>
> 				<groupId>org.jboss.arquillian</groupId>
> 				<artifactId>arquillian-bom</artifactId>
> 				<version>1.1.4.Final</version>
> 				<scope>import</scope>
> 				<type>pom</type>
> 			</dependency>
> 			<dependency>
> 				<groupId>org.jboss.arquillian.extension</groupId>
> 				<artifactId>arquillian-drone-bom</artifactId>
> 				<version>1.3.0.Final</version>
> 				<type>pom</type>
> 				<scope>import</scope>
> 			</dependency>
> 			<dependency>
> 				<groupId>org.jboss.arquillian.selenium</groupId>
> 				<artifactId>selenium-bom</artifactId>
> 				<version>2.41.0</version>
> 				<type>pom</type>
> 				<scope>import</scope>
> 			</dependency>
> 		</dependencies>
> 	</dependencyManagement>
> 	<dependencies>
> 		<dependency>
> 			<groupId>junit</groupId>
> 			<artifactId>junit</artifactId>
> 			<version>4.11</version>
> 			<scope>test</scope>
> 		</dependency>
> 		<dependency>
> 			<groupId>org.jboss.arquillian.junit</groupId>
> 			<artifactId>arquillian-junit-container</artifactId>
> 			<scope>test</scope>
> 		</dependency>
> 		<dependency>
> 			<groupId>org.hibernate</groupId>
> 			<artifactId>hibernate-jpamodelgen</artifactId>
> 			<version>4.3.5.Final</version>
> 			<scope>provided</scope>
> 		</dependency>
> 		<dependency>
> 			<groupId>org.jboss.arquillian.graphene</groupId>
> 			<artifactId>graphene-webdriver</artifactId>
> 			<version>2.0.2.Final</version>
> 			<type>pom</type>
> 			<scope>test</scope>
> 		</dependency>
> 		<dependency>
> 			<groupId>org.jboss.arquillian.extension</groupId>
> 			<artifactId>arquillian-persistence-core</artifactId>
> 			<version>1.0.0.Alpha7</version>
> 		</dependency>
> 		<dependency>
> 			<groupId>org.jboss.arquillian.extension</groupId>
> 			<artifactId>arquillian-persistence-dbunit</artifactId>
> 			<version>1.0.0.Alpha7</version>
> 		</dependency>
> 	</dependencies>
> 	<profiles>
> 		<profile>
> 			<id>arq-wildfly</id>
> 			<dependencies>
> 				<dependency>
> 					<groupId>org.jboss.spec</groupId>
> 					<artifactId>jboss-javaee-7.0</artifactId>
> 					<version>1.0.0.Final</version>
> 					<type>pom</type>
> 					<scope>provided</scope>
> 				</dependency>
> 				<dependency>
> 					<groupId>org.wildfly</groupId>
> 					<artifactId>wildfly-arquillian-container-remote</artifactId>
> 					<version>8.1.0.CR2</version>
> 					<scope>test</scope>
> 				</dependency>
> 				<dependency>
> 					<groupId>org.jboss.arquillian.protocol</groupId>
> 					<artifactId>arquillian-protocol-servlet</artifactId>
> 					<scope>test</scope>
> 				</dependency>
> 			</dependencies>
> 		</profile>
> 	</profiles>
> 	<build>
> 		<plugins>
> 			<plugin>
> 				<artifactId>maven-compiler-plugin</artifactId>
> 				<version>2.3.2</version>
> 				<configuration>
> 					<source>1.7</source>
> 					<target>1.7</target>
> 				</configuration>
> 			</plugin>
> 		</plugins>
> 		<testResources>
> 			<testResource>
> 				<directory>src/test/resources</directory>
> 				<filtering>true</filtering>
> 			</testResource>
> 		</testResources>
> 	</build>
> </project>
> {code}
> {code:java}
> package fi.affecto.marela.test;
> import javax.inject.Inject;
> import javax.persistence.EntityManager;
> import javax.persistence.PersistenceContext;
> import javax.transaction.UserTransaction;
> import org.jboss.arquillian.container.test.api.Deployment;
> import org.jboss.arquillian.junit.Arquillian;
> import org.jboss.arquillian.persistence.ShouldMatchDataSet;
> import org.jboss.arquillian.persistence.UsingDataSet;
> import org.jboss.arquillian.transaction.api.annotation.Transactional;
> import org.jboss.shrinkwrap.api.Archive;
> import org.jboss.shrinkwrap.api.ShrinkWrap;
> import org.jboss.shrinkwrap.api.asset.EmptyAsset;
> import org.jboss.shrinkwrap.api.spec.WebArchive;
> import org.junit.Assert;
> import org.junit.Test;
> import org.junit.runner.RunWith;
> import fi.affecto.marela.jpa.Game;
> @RunWith(Arquillian.class)
> public class PersistenceExtensionTest
> {
>    @Deployment
>    public static Archive<?> createDeployment()
>    {
>       return ShrinkWrap.create(WebArchive.class, "test.war").addPackage(Game.class.getPackage())
>          .addAsResource("persistence.xml", "META-INF/persistence.xml")
>          .addAsWebInfResource(EmptyAsset.INSTANCE, "beans.xml");      
>    }
>    @PersistenceContext
>    EntityManager em;
>    @Inject
>    UserTransaction utx;
>    @Test
>    public void testA() throws Exception
>    {
>       Assert.assertNotNull(em);
>       utx.begin();
> //      em.joinTransaction();
>       Game g = new Game();
>       g.setId(666L);
>       g.setTitle("x");
>       Assert.assertFalse(em.contains(g));
>       g = em.merge(g);
>       Assert.assertTrue(em.contains(g));
>       utx.rollback();
>    }
>    
>    @Test
>    @Transactional
>    public void testB() throws Exception
>    {
>       Assert.assertNotNull(em);
>       Game g = new Game();
>       g.setId(666L);
>       g.setTitle("x");
>       Assert.assertFalse(em.contains(g));
>       g = em.merge(g);
>       Assert.assertTrue(em.contains(g));
>    }
>    @Test
> //   @UsingDataSet("games.yml")
> //   @ShouldMatchDataSet("games-check.yml")
>    @Transactional
>    public void testC() throws Exception
>    {
>       Assert.assertTrue(false);
>    }
> }
> {code}
> testC succeeds if the annotations are uncommented.
> Furthermore, there is something strange with the em/transactions, the persistence works even if the em doesn't join the transaction and the em complains of a detached instance if merge() is switched for persist()



--
This message was sent by Atlassian JIRA
(v6.2.3#6260)


More information about the arquillian-issues mailing list