Git Product home page Git Product logo

arquillian-extension-persistence's Introduction

Arquillian Persistence Extension

Build Status

To read complete documentation visit http://arquillian.org/arquillian-extension-persistence/

1. Overview

1.1. What Is This?

Arquillian Persistence Extension was created to help you write tests where persistence layer is involved. Inspired by great framework called Unitils, it brings a bunch of annotations to help you deal with the underlying data storage.

It comes with following features:

  • Wrapping each test in the separated transaction (with commit (default) or rollback at the end).

  • Seeding database using:

    • DBUnit with XML, XLS, YAML and JSON supported as data sets format.

    • Custom SQL scripts.

  • Comparing database state at the end of the test using given data sets (with column exclusion).

  • Eviction JPA second level cache between test method invocation, see @JpaCacheEviction.

1.2. Containers Used For Testing

  • Glassfish 3.1.2 Embedded

  • JBoss AS 7.0.2 Final (managed)

  • JBoss AS 7.1.1.Final (managed)

  • Wildfly 8.1

1.3. Verified With Following Databases

  • HSQL

  • MS SQL 2008 Express (with Microsoft JDBC Driver)

  • MySQL 5.5.24

  • PostgreSQL 9.1.4

  • Oracle 11g

  • Derby

Enough talking, let’s see it in action!

1.4. Code Example

@RunWith(Arquillian.class)
public class UserPersistenceTest
{

  @Deployment
  public static Archive<?> createDeploymentPackage()
  {
      return ShrinkWrap.create(JavaArchive.class, "test.jar")
                       .addPackage(UserAccount.class.getPackage())
                       .addPackages(true, "org.fest") // FEST Assert is not part of Arquillian
                       .addAsManifestResource(EmptyAsset.INSTANCE, "beans.xml")
                       .addAsManifestResource("test-persistence.xml", "persistence.xml");
  }

  @PersistenceContext
  EntityManager em;

  @Test
  @UsingDataSet("datasets/users.yml")
  @ShouldMatchDataSet("datasets/expected-users.yml")
  public void should_change_user_password() throws Exception
  {
      // given
      String expectedPassword = "LexLuthor";
      UserAccount user = em.find(UserAccount.class, 2L);

      // when
      user.setPassword("LexLuthor");
      em.merge(user);

      // then
      assertThat(user.getPassword()).isEqualTo(expectedPassword);
  }
}

There are just two things which are different from the standard Arquillian test - @UsingDataSet and @ShouldMatchDataSet annotations. Former seeds the database using file in YAML format, and latter verifies database state using given file.

This example is taken from integration tests written for this project, so feel free to have a closer look.

But it’s that easy! And there’s more to come!

If you have any questions or would like to file feature request or bug report (hope not!) please have a look at the ways how you can get in touch with us.

arquillian-extension-persistence's People

Contributors

alechenninger avatar arturdryomov avatar aslakknutsen avatar bartoszmajsak avatar erikv-hill-labs avatar hemanik avatar jmnarloch avatar kumm avatar lordofthejars avatar manuelaznar avatar masao-kunii avatar mgraciano avatar robertpanzer avatar sbodomerle avatar seanhussey avatar the-alchemist avatar tobiasstadler avatar vilmosnagy avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

arquillian-extension-persistence's Issues

ClassNotFoundException with Postgresql UUID datatype

Issue Overview

Running a Wildfly Swarm project to build a JaxRS API using Arquillian for automated testing.
Data layer is JPA entities.
Database is Postgresql
Making use of @UsingDataSet annotation with YAML files.

Expected Behaviour

When a datatype has an ID of type UUID, the following seed snippet will work.

some_entity:
  - id: "uuid'2aad615a-d8e1-11e2-b8ed-50e549c9b654'"
    other_attrs...
Current Behaviour

Exception thrown when it tries to seed.

Caused by: org.dbunit.dataset.datatype.TypeCastException: Unable to typecast value <uuid'2aad615a-d8e1-11e2-b8ed-50e549c9b654'> of type <java.lang.String> to uuid
	at org.dbunit.ext.postgresql.UuidType.getUUID(UuidType.java:88)
	at org.dbunit.ext.postgresql.UuidType.setSqlValue(UuidType.java:63)
	at org.dbunit.database.statement.SimplePreparedStatement.addValue(SimplePreparedStatement.java:73)
	at org.dbunit.database.statement.AutomaticPreparedBatchStatement.addValue(AutomaticPreparedBatchStatement.java:63)
	at org.dbunit.operation.AbstractBatchOperation.execute(AbstractBatchOperation.java:211)
	... 200 more
Caused by: java.lang.ClassNotFoundException: org.postgresql.util.PGobject from [Module "org.jboss.ironjacamar.jdbcadapters:main" from BootModuleLoader@7de62196 for finders [BootstrapClasspathModuleFinder, BootstrapModuleFinder(org.wildfly.swarm.bootstrap:main), ClasspathModuleFinder, ContainerModuleFinder(swarm.container:main), ApplicationModuleFinder(swarm.application:main), org.wildfly.swarm.bootstrap.modules.DynamicModuleFinder@163370c2]]
	at org.jboss.modules.ModuleClassLoader.findClass(ModuleClassLoader.java:198)
	at org.jboss.modules.ConcurrentClassLoader.performLoadClassUnchecked(ConcurrentClassLoader.java:363)
	at org.jboss.modules.ConcurrentClassLoader.performLoadClass(ConcurrentClassLoader.java:351)
	at org.jboss.modules.ConcurrentClassLoader.loadClass(ConcurrentClassLoader.java:93)
	at org.dbunit.dataset.datatype.AbstractDataType.loadClass(AbstractDataType.java:224)
	at org.dbunit.dataset.datatype.AbstractDataType.loadClass(AbstractDataType.java:213)
	at org.dbunit.ext.postgresql.UuidType.getUUID(UuidType.java:77)
	... 204 more
Steps to reproduce

Wildfly swarm project with usual datasource fractions and postgres

JPA entity using UUID datatype like:

    @Id
    @GeneratedValue
    @Column( columnDefinition = "uuid", updatable = false )
    private UUID id;

yaml seed file that specifies the ID
arquillian test that loads the seed using APE annotation

Additional Information

Have tried upgrading to the APE 2.x line, no change.
Have rules out Deployment and Shrinkwrap issues. Outputting the libs shows the Postgres classes are all there, and running a test which doesn't seed, but checks for the libs, works. See below.

The classpath issue only occurs during the APE seed stage. Is there a way to configure it to find the postgres lib?

 @Test
    public void testLibs() {
        try {
            Class.forName("org.postgresql.Driver");
            Class.forName("org.postgresql.util.PGobject");
        } catch (ClassNotFoundException e) {
            System.err.println("Where is your PostgreSQL JDBC Driver? "
                    + "Include in your library path!");
            e.printStackTrace();
        }
    }

TransactionProviderNotFoundException with arquillian-extension-persistence

When I am using arquillian-persistence-dbunit with Spring java configuration, I always get this error org.jboss.arquillian.transaction.impl.lifecycle.TransactionProviderNotFoundException.

My Test class :

@RunWith(Arquillian.class)
@Transactional(PersistanceTestConfig.TRANSACTION_NAME)
@SpringAnnotationConfiguration(classes = {ArquillianConfiguration.class})
@DataSource(PersistanceTestConfig.MY_DATASOURCE)
@UsingDataSet({"database/myDataset.yml"})
public class MyTestClass{

      @Deployment(testable = false)
      public static WebArchive createArchive(){
          //returns a webArchive
      }

      @Test
      public void myTestMethod(){
        //do something
      }
}

My Persistence SpringConfig :

public class PersistanceTestConfig {
   public static final String TRANSACTION_NAME = "transaction";
   public static final String MY_DATASOURCE = "myDatasource";

 private Properties getJPAProperties() {
    final Properties jpaProperties = new Properties();
    jpaProperties.setProperty("hibernate.hbm2ddl.auto", "create");
    jpaProperties.setProperty("hibernate.show_sql", "true");
    jpaProperties.setProperty("hibernate.format_sql", "true");
    jpaProperties.setProperty("hibernate.dialect", "org.hibernate.dialect.HSQLDialect");

    return jpaProperties;
}


    @Bean(name = MY_DATASOURCE)
    public DataSource getDataSource(){
      return new EmbeddedDatabaseBuilder().setType(EmbeddedDatabaseType.HSQL)
            .continueOnError(false).ignoreFailedDrops(true).build();
    }


@Bean
@Autowired
public LocalContainerEntityManagerFactoryBean getEntityManagerREFCS( DataSource dataSource) {
    final LocalContainerEntityManagerFactoryBean localContainerEntityManagerFactoryBean = new LocalContainerEntityManagerFactoryBean();
    localContainerEntityManagerFactoryBean.setDataSource(dataSource);
    localContainerEntityManagerFactoryBean.setJpaVendorAdapter(new HibernateJpaVendorAdapter());
    localContainerEntityManagerFactoryBean.setPackagesToScan("com.myapp.dao.beans");
    localContainerEntityManagerFactoryBean.setPersistenceUnitName("pUnitName");
    localContainerEntityManagerFactoryBean.setJpaProperties(getJPAProperties());
    return localContainerEntityManagerFactoryBean;
}        
}

You can have more insight of the problem here

No ResourceProvider found for type: class org.dbunit.database.DatabaseConnection

Hi there,

As per this example https://github.com/arquillian/arquillian-extension-persistence/blob/master/int-tests/src/test/java/org/jboss/arquillian/integration/persistence/example/DatabaseConnectionInjectionTest.java I am trying databaseconnection into one of my tests. I seem to be getting the following exception upon execution, any ideas on the cause?

I did see the comment

   // Test needs to be "persistence-extension-aware" in order to get this reference.
   // This can be achieved using any of APE annotations such as
   // @PersistenceTest, @UsingDataSet, @ShouldMatchDataSet etc.

And I do have @PersistenceTest the annotation on my test class.

Exception:

java.lang.RuntimeException: Could not lookup value for field org.dbunit.database.DatabaseConnection com.biggerbear.test.UserRegistrationTest.databaseConnection
    at org.jboss.arquillian.test.impl.enricher.resource.ArquillianResourceTestEnricher.enrich(ArquillianResourceTestEnricher.java:61)
    at org.jboss.arquillian.test.impl.TestInstanceEnricher.enrich(TestInstanceEnricher.java:52)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    at java.lang.reflect.Method.invoke(Method.java:597)
    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 org.jboss.arquillian.test.impl.TestContextHandler.createTestContext(TestContextHandler.java:89)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    at java.lang.reflect.Method.invoke(Method.java:597)
    at org.jboss.arquillian.core.impl.ObserverImpl.invoke(ObserverImpl.java:94)
    at org.jboss.arquillian.core.impl.EventContextImpl.proceed(EventContextImpl.java:88)
    at org.jboss.arquillian.test.impl.TestContextHandler.createClassContext(TestContextHandler.java:75)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    at java.lang.reflect.Method.invoke(Method.java:597)
    at org.jboss.arquillian.core.impl.ObserverImpl.invoke(ObserverImpl.java:94)
    at org.jboss.arquillian.core.impl.EventContextImpl.proceed(EventContextImpl.java:88)
    at org.jboss.arquillian.test.impl.TestContextHandler.createSuiteContext(TestContextHandler.java:60)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    at java.lang.reflect.Method.invoke(Method.java:597)
    at org.jboss.arquillian.core.impl.ObserverImpl.invoke(ObserverImpl.java:94)
    at org.jboss.arquillian.core.impl.EventContextImpl.proceed(EventContextImpl.java:88)
    at org.jboss.arquillian.core.impl.ManagerImpl.fire(ManagerImpl.java:135)
    at org.jboss.arquillian.core.impl.ManagerImpl.fire(ManagerImpl.java:115)
    at org.jboss.arquillian.test.impl.EventTestRunnerAdaptor.before(EventTestRunnerAdaptor.java:95)
    at org.jboss.arquillian.junit.Arquillian$4.evaluate(Arquillian.java:222)
    at org.jboss.arquillian.junit.Arquillian.multiExecute(Arquillian.java:314)
    at org.jboss.arquillian.junit.Arquillian.access$100(Arquillian.java:46)
    at org.jboss.arquillian.junit.Arquillian$5.evaluate(Arquillian.java:240)
    at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:263)
    at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:68)
    at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:47)
    at org.junit.runners.ParentRunner$3.run(ParentRunner.java:231)
    at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:60)
    at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:229)
    at org.junit.runners.ParentRunner.access$000(ParentRunner.java:50)
    at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:222)
    at org.jboss.arquillian.junit.Arquillian$2.evaluate(Arquillian.java:185)
    at org.jboss.arquillian.junit.Arquillian.multiExecute(Arquillian.java:314)
    at org.jboss.arquillian.junit.Arquillian.access$100(Arquillian.java:46)
    at org.jboss.arquillian.junit.Arquillian$3.evaluate(Arquillian.java:199)
    at org.junit.runners.ParentRunner.run(ParentRunner.java:300)
    at org.jboss.arquillian.junit.Arquillian.run(Arquillian.java:147)
    at org.junit.runner.JUnitCore.run(JUnitCore.java:157)
    at org.junit.runner.JUnitCore.run(JUnitCore.java:136)
    at org.jboss.arquillian.junit.container.JUnitTestRunner.execute(JUnitTestRunner.java:65)
    at org.jboss.arquillian.protocol.servlet.runner.ServletTestRunner.executeTest(ServletTestRunner.java:160)
    at org.jboss.arquillian.protocol.servlet.runner.ServletTestRunner.execute(ServletTestRunner.java:126)
    at org.jboss.arquillian.protocol.servlet.runner.ServletTestRunner.doGet(ServletTestRunner.java:90)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:734)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:847)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:329)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:248)
    at org.jboss.weld.servlet.ConversationPropagationFilter.doFilter(ConversationPropagationFilter.java:62)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:280)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:248)
    at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:275)
    at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:161)
    at org.jboss.as.jpa.interceptor.WebNonTxEmCloserValve.invoke(WebNonTxEmCloserValve.java:50)
    at org.jboss.as.web.security.SecurityContextAssociationValve.invoke(SecurityContextAssociationValve.java:153)
    at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:155)
    at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
    at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
    at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:368)
    at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:877)
    at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:671)
    at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:930)
    at java.lang.Thread.run(Thread.java:680)
Caused by: java.lang.IllegalArgumentException: No ResourceProvider found for type: class org.dbunit.database.DatabaseConnection
    at org.jboss.arquillian.test.impl.enricher.resource.ArquillianResourceTestEnricher.lookup(ArquillianResourceTestEnricher.java:120)
    at org.jboss.arquillian.test.impl.enricher.resource.ArquillianResourceTestEnricher.enrich(ArquillianResourceTestEnricher.java:57)
    ... 75 more

Update to latest transaction extension

Due to arquillian/arquillian-extension-transaction#14 we can't use APE and client tests like Drone/Graphene on the same project. One need to replace transaction-extension brought by APE by latest one, like below:

 <dependency>
            <groupId>org.arquillian.universe</groupId>
            <artifactId>arquillian-persistence</artifactId>
            <type>pom</type>
            <scope>test</scope>
        </dependency>

        <dependency>
            <groupId>org.jboss.arquillian.extension</groupId>
            <artifactId>arquillian-transaction-jta</artifactId>
            <version>1.0.5</version>
            <scope>test</scope>
        </dependency>

It would be nice if APE brought latest transaction extension by default.

Flaky Postman ftest on Travis

Functional test for Postman module is failing on Travis - we have to investigate why is it happening and how to fix it. At this moment the test is ignored with the explanation. See details in this commit: b6301f8.

Running APE with Wildfly Swarm example throws an exception

Running APE with Wildfly Swarm throws an exception.

The exception is

ava.lang.IllegalStateException: No org.jboss.arquillian.container.test.spi.command.CommandService found in context

    at org.jboss.arquillian.persistence.core.container.CommandServiceProducer.createCommandService(CommandServiceProducer.java:49)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:497)
    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 org.jboss.arquillian.test.impl.TestContextHandler.createSuiteContext(TestContextHandler.java:73)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:497)
    at org.jboss.arquillian.core.impl.ObserverImpl.invoke(ObserverImpl.java:94)
    at org.jboss.arquillian.core.impl.EventContextImpl.proceed(EventContextImpl.java:88)
    at org.jboss.arquillian.core.impl.ManagerImpl.fire(ManagerImpl.java:145)
    at org.jboss.arquillian.core.impl.ManagerImpl.fire(ManagerImpl.java:116)
    at org.jboss.arquillian.test.impl.EventTestRunnerAdaptor.beforeSuite(EventTestRunnerAdaptor.java:75)
    at org.jboss.arquillian.junit.Arquillian.run(Arquillian.java:115)
    at org.junit.runner.JUnitCore.run(JUnitCore.java:137)
    at org.junit.runner.JUnitCore.run(JUnitCore.java:115)
    at org.jboss.arquillian.junit.container.JUnitTestRunner.execute(JUnitTestRunner.java:66)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:497)
    at org.wildfly.swarm.arquillian.daemon.TestRunner.executeTest(TestRunner.java:64)
    at org.wildfly.swarm.arquillian.daemon.server.Server.executeTest(Server.java:241)

And the project can be found https://github.com/lordofthejars/swarm-ape

According to stacktrace, whatI think it is happening is that Arquillian Daemon does not implement any CommandService to communicate with client side, and this is something required by APE.

Datasets are inserting to database always after any insert from test method

I have this code:

@UsingDataSet( "applications_populate.yml" )
 @Cleanup( phase = TestExecutionPhase.NONE )
    @Test()
    public void testpersistWithaApplyScriptBefore() throws Exception {



        App app = new App();
        app.setAppName("prueba");
        app.setDescription("prueba");
        app.setCreatedAt(new Date());
        app.setModifiedAt(new Date());        


        //transaction.begin();

        manager.persist(app);

        //ansaction.commit();
       // manager.clear();


    }

In this way i used the same transaction used by the extension to insert entities in my db, because if i create another transaction the ARJUNA016051: thread is already associated with a transaction! appears.
So, i was performing some test for a while and discover that everytime i execute any test that use the same transaction that APE( arquillian-persistence-extension ), the entity is persist first and the datasets after. So i'm wonder why this happen and the most importatn how can avoid it?

Greets
César

UPDATE-------------------
Here the trace from server

09:31:42,145 DEBUG [org.jboss.as.jpa] (pool-5-thread-10) pool-5-thread-10:[transaction scoped EntityManager]: created entity manager session TransactionImple < ac, BasicAction: 0:ffffac10441a:-501d5bf2:516ea394:103 status: ActionStatus.RUNNING >
09:31:42,145 TRACE [com.arjuna.ats.jta] (pool-5-thread-10) TransactionSynchronizationRegistryImple.registerInterposedSynchronization
09:31:42,145 TRACE [com.arjuna.ats.jta] (pool-5-thread-10) TransactionImple.getStatus
09:31:42,145 TRACE [com.arjuna.ats.jta] (pool-5-thread-10) TransactionSynchronizationRegistryImple.putResource
09:31:42,145 TRACE [com.arjuna.ats.jta] (pool-5-thread-10) TransactionImple.getStatus
09:31:42,161 TRACE [com.arjuna.ats.jta] (pool-5-thread-10) BaseTransaction.getStatus
09:31:42,161 TRACE [com.arjuna.ats.jta] (pool-5-thread-10) TransactionImple.getStatus
09:31:42,161 TRACE [org.jboss.as.jpa] (pool-5-thread-10) persist entityClass 'com.donde.am.entities.App' took 16ms
09:31:42,161 TRACE [com.arjuna.ats.jta] (pool-5-thread-10) BaseTransaction.getStatus
09:31:42,161 TRACE [com.arjuna.ats.jta] (pool-5-thread-10) TransactionImple.getStatus
09:31:42,161 TRACE [com.arjuna.ats.jta] (pool-5-thread-10) BaseTransaction.commit
09:31:42,161 TRACE [com.arjuna.ats.jta] (pool-5-thread-10) TransactionImple.commitAndDisassociate
09:31:42,161 TRACE [com.arjuna.ats.jta] (pool-5-thread-10) SynchronizationImple.beforeCompletion
09:31:42,161 TRACE [com.arjuna.ats.jta] (pool-5-thread-10) BaseTransaction.getStatus
09:31:42,161 TRACE [com.arjuna.ats.jta] (pool-5-thread-10) TransactionImple.getStatus
09:31:42,161 TRACE [com.arjuna.ats.jta] (pool-5-thread-10) TransactionImple.getStatus
09:31:42,161 TRACE [com.arjuna.ats.jta] (pool-5-thread-10) TransactionSynchronizationRegistryImple.getTransactionKey
09:31:42,161 TRACE [com.arjuna.ats.jta] (pool-5-thread-10) TransactionSynchronizationRegistryImple.getTransactionKey
09:31:42,161 TRACE [com.arjuna.ats.jta] (pool-5-thread-10) TransactionSynchronizationRegistryImple.getResource
09:31:42,161 TRACE [com.arjuna.ats.jta] (pool-5-thread-10) TransactionImple.getStatus
09:31:42,161 TRACE [com.arjuna.ats.jta] (pool-5-thread-10) TransactionSynchronizationRegistryImple.getTransactionKey
09:31:42,161 TRACE [com.arjuna.ats.jta] (pool-5-thread-10) TransactionSynchronizationRegistryImple.getResource
09:31:42,161 TRACE [com.arjuna.ats.jta] (pool-5-thread-10) TransactionImple.getStatus
09:31:42,161 TRACE [com.arjuna.ats.jta] (pool-5-thread-10) TransactionSynchronizationRegistryImple.putResource
09:31:42,161 TRACE [com.arjuna.ats.jta] (pool-5-thread-10) TransactionImple.getStatus
09:31:42,161 TRACE [com.arjuna.ats.jta] (pool-5-thread-10) TransactionSynchronizationRegistryImple.getResource
09:31:42,161 TRACE [com.arjuna.ats.jta] (pool-5-thread-10) TransactionImple.getStatus
09:31:42,161 TRACE [com.arjuna.ats.jta] (pool-5-thread-10) TransactionSynchronizationRegistryImple.getTransactionKey
09:31:42,161 TRACE [com.arjuna.ats.jta] (pool-5-thread-10) TransactionSynchronizationRegistryImple.getResource
09:31:42,161 TRACE [com.arjuna.ats.jta] (pool-5-thread-10) TransactionImple.getStatus
09:31:42,161 TRACE [com.arjuna.ats.jta] (pool-5-thread-10) TransactionSynchronizationRegistryImple.getResource
09:31:42,161 TRACE [com.arjuna.ats.jta] (pool-5-thread-10) TransactionImple.getStatus
09:31:42,161 TRACE [com.arjuna.ats.jta] (pool-5-thread-10) TransactionSynchronizationRegistryImple.putResource
09:31:42,161 TRACE [com.arjuna.ats.jta] (pool-5-thread-10) TransactionImple.getStatus
09:31:42,161 TRACE [com.arjuna.ats.jta] (pool-5-thread-10) BaseTransaction.getStatus
09:31:42,161 TRACE [com.arjuna.ats.jta] (pool-5-thread-10) TransactionImple.getStatus
09:31:42,161 TRACE [com.arjuna.ats.jta] (pool-5-thread-10) TransactionSynchronizationRegistryImple.registerInterposedSynchronization
09:31:42,177 TRACE [com.arjuna.ats.jta] (pool-5-thread-10) TransactionImple.getStatus
09:31:42,177 TRACE [com.arjuna.ats.jta] (pool-5-thread-10) TransactionImple.enlistResource ( LocalXAResourceImpl@13eca4e[connectionListener=140f3b0 connectionManager=1d73a72 warned=false currentXid=null] )
09:31:42,177 TRACE [com.arjuna.ats.jta] (pool-5-thread-10) TransactionImple.getStatus
09:31:42,177 TRACE [com.arjuna.ats.arjuna] (pool-5-thread-10) StateManager::StateManager( 0:0:0:0:1 )
09:31:42,177 TRACE [com.arjuna.ats.arjuna] (pool-5-thread-10) AbstractRecord::AbstractRecord (0:0:0:0:1)
09:31:42,177 TRACE [com.arjuna.ats.arjuna] (pool-5-thread-10) LastResourceRecord()
09:31:42,177 TRACE [com.arjuna.ats.arjuna] (pool-5-thread-10) RecordList::insert(RecordList: empty) : appending /StateManager/AbstractRecord/LastResourceRecord for 0:0:0:0:1
09:31:42,177 WARN  [org.hibernate.engine.jdbc.spi.SqlExceptionHelper] (pool-5-thread-10) SQL Error: 0, SQLState: 23505
09:31:42,177 ERROR [org.hibernate.engine.jdbc.spi.SqlExceptionHelper] (pool-5-thread-10) ERROR: llave duplicada viola restricción de unicidad «applications_pkey»
  Detail: Ya existe la llave (appname)=(prueba).
09:31:42,177 TRACE [com.arjuna.ats.jta] (pool-5-thread-10) BaseTransaction.setRollbackOnly
09:31:42,177 TRACE [com.arjuna.ats.jta] (pool-5-thread-10) TransactionImple.setRollbackOnly
09:31:42,177 TRACE [com.arjuna.ats.arjuna] (pool-5-thread-10) BasicAction::preventCommit( BasicAction: 0:ffffac10441a:-501d5bf2:516ea394:103 status: ActionStatus.RUNNING)
09:31:42,177 TRACE [com.arjuna.ats.jta] (pool-5-thread-10) BaseTransaction.getStatus
09:31:42,177 TRACE [com.arjuna.ats.jta] (pool-5-thread-10) TransactionImple.getStatus
09:31:42,177 TRACE [com.arjuna.ats.jta] (pool-5-thread-10) BaseTransaction.setRollbackOnly
09:31:42,177 TRACE [com.arjuna.ats.jta] (pool-5-thread-10) TransactionImple.setRollbackOnly
09:31:42,177 TRACE [com.arjuna.ats.arjuna] (pool-5-thread-10) BasicAction::preventCommit( BasicAction: 0:ffffac10441a:-501d5bf2:516ea394:103 status: ActionStatus.ABORT_ONLY)
09:31:42,177 WARN  [com.arjuna.ats.arjuna] (pool-5-thread-10) ARJUNA012125: TwoPhaseCoordinator.beforeCompletion - failed for SynchronizationImple< 0:ffffac10441a:-501d5bf2:516ea394:104, org.hibernate.engine.transaction.synchronization.internal.RegisteredSynchronization@9104b3 >: javax.persistence.PersistenceException: org.hibernate.exception.ConstraintViolationException: ERROR: llave duplicada viola restricción de unicidad «applications_pkey»
  Detail: Ya existe la llave (appname)=(prueba).
    at org.hibernate.ejb.AbstractEntityManagerImpl.convert(AbstractEntityManagerImpl.java:1361) [hibernate-entitymanager-4.0.1.Final.jar:4.0.1.Final]
    at org.hibernate.ejb.AbstractEntityManagerImpl.convert(AbstractEntityManagerImpl.java:1289) [hibernate-entitymanager-4.0.1.Final.jar:4.0.1.Final]
    at org.hibernate.ejb.AbstractEntityManagerImpl.convert(AbstractEntityManagerImpl.java:1295) [hibernate-entitymanager-4.0.1.Final.jar:4.0.1.Final]
    at org.hibernate.ejb.AbstractEntityManagerImpl$CallbackExceptionMapperImpl.mapManagedFlushFailure(AbstractEntityManagerImpl.java:1481) [hibernate-entitymanager-4.0.1.Final.jar:4.0.1.Final]
    at org.hibernate.engine.transaction.synchronization.internal.SynchronizationCallbackCoordinatorImpl.beforeCompletion(SynchronizationCallbackCoordinatorImpl.java:109) [hibernate-core-4.0.1.Final.jar:4.0.1.Final]
    at org.hibernate.engine.transaction.synchronization.internal.RegisteredSynchronization.beforeCompletion(RegisteredSynchronization.java:53) [hibernate-core-4.0.1.Final.jar:4.0.1.Final]
    at com.arjuna.ats.internal.jta.resources.arjunacore.SynchronizationImple.beforeCompletion(SynchronizationImple.java:76)
    at com.arjuna.ats.arjuna.coordinator.TwoPhaseCoordinator.beforeCompletion(TwoPhaseCoordinator.java:273)
    at com.arjuna.ats.arjuna.coordinator.TwoPhaseCoordinator.end(TwoPhaseCoordinator.java:93)
    at com.arjuna.ats.arjuna.AtomicAction.commit(AtomicAction.java:164)
    at com.arjuna.ats.internal.jta.transaction.arjunacore.TransactionImple.commitAndDisassociate(TransactionImple.java:1165)
    at com.arjuna.ats.internal.jta.transaction.arjunacore.BaseTransaction.commit(BaseTransaction.java:117)
    at com.arjuna.ats.jbossatx.BaseTransactionManagerDelegate.commit(BaseTransactionManagerDelegate.java:75)
    at org.jboss.tm.usertx.client.ServerVMClientUserTransaction.commit(ServerVMClientUserTransaction.java:167)
    at org.jboss.arquillian.persistence.core.transaction.TestTransactionWrapper.afterTest(TestTransactionWrapper.java:70) [arquillian-service:]
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) [rt.jar:1.7.0_09]
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) [rt.jar:1.7.0_09]
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) [rt.jar:1.7.0_09]
    at java.lang.reflect.Method.invoke(Method.java:601) [rt.jar:1.7.0_09]
    at org.jboss.arquillian.core.impl.ObserverImpl.invoke(ObserverImpl.java:90) [arquillian-service:]
    at org.jboss.arquillian.core.impl.EventContextImpl.invokeObservers(EventContextImpl.java:99) [arquillian-service:]
    at org.jboss.arquillian.core.impl.EventContextImpl.proceed(EventContextImpl.java:81) [arquillian-service:]
    at org.jboss.arquillian.test.impl.TestContextHandler.createTestContext(TestContextHandler.java:89) [arquillian-service:]
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) [rt.jar:1.7.0_09]
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) [rt.jar:1.7.0_09]
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) [rt.jar:1.7.0_09]
    at java.lang.reflect.Method.invoke(Method.java:601) [rt.jar:1.7.0_09]
    at org.jboss.arquillian.core.impl.ObserverImpl.invoke(ObserverImpl.java:90) [arquillian-service:]
    at org.jboss.arquillian.core.impl.EventContextImpl.proceed(EventContextImpl.java:88) [arquillian-service:]
    at org.jboss.arquillian.test.impl.TestContextHandler.createClassContext(TestContextHandler.java:75) [arquillian-service:]
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) [rt.jar:1.7.0_09]
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) [rt.jar:1.7.0_09]
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) [rt.jar:1.7.0_09]
    at java.lang.reflect.Method.invoke(Method.java:601) [rt.jar:1.7.0_09]
    at org.jboss.arquillian.core.impl.ObserverImpl.invoke(ObserverImpl.java:90) [arquillian-service:]
    at org.jboss.arquillian.core.impl.EventContextImpl.proceed(EventContextImpl.java:88) [arquillian-service:]
    at org.jboss.arquillian.test.impl.TestContextHandler.createSuiteContext(TestContextHandler.java:60) [arquillian-service:]
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) [rt.jar:1.7.0_09]
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) [rt.jar:1.7.0_09]
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) [rt.jar:1.7.0_09]
    at java.lang.reflect.Method.invoke(Method.java:601) [rt.jar:1.7.0_09]
    at org.jboss.arquillian.core.impl.ObserverImpl.invoke(ObserverImpl.java:90) [arquillian-service:]
    at org.jboss.arquillian.core.impl.EventContextImpl.proceed(EventContextImpl.java:88) [arquillian-service:]
    at org.jboss.arquillian.core.impl.ManagerImpl.fire(ManagerImpl.java:135) [arquillian-service:]
    at org.jboss.arquillian.core.impl.ManagerImpl.fire(ManagerImpl.java:115) [arquillian-service:]
    at org.jboss.arquillian.core.impl.EventImpl.fire(EventImpl.java:67) [arquillian-service:]
    at org.jboss.arquillian.persistence.core.lifecycle.TransactionHandler.endTransactionAfterTest(TransactionHandler.java:54) [arquillian-service:]
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) [rt.jar:1.7.0_09]
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) [rt.jar:1.7.0_09]
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) [rt.jar:1.7.0_09]
    at java.lang.reflect.Method.invoke(Method.java:601) [rt.jar:1.7.0_09]
    at org.jboss.arquillian.core.impl.ObserverImpl.invoke(ObserverImpl.java:90) [arquillian-service:]
    at org.jboss.arquillian.core.impl.EventContextImpl.invokeObservers(EventContextImpl.java:99) [arquillian-service:]
    at org.jboss.arquillian.core.impl.EventContextImpl.proceed(EventContextImpl.java:81) [arquillian-service:]
    at org.jboss.arquillian.test.impl.TestContextHandler.createTestContext(TestContextHandler.java:89) [arquillian-service:]
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) [rt.jar:1.7.0_09]
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) [rt.jar:1.7.0_09]
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) [rt.jar:1.7.0_09]
    at java.lang.reflect.Method.invoke(Method.java:601) [rt.jar:1.7.0_09]
    at org.jboss.arquillian.core.impl.ObserverImpl.invoke(ObserverImpl.java:90) [arquillian-service:]
    at org.jboss.arquillian.core.impl.EventContextImpl.proceed(EventContextImpl.java:88) [arquillian-service:]
    at org.jboss.arquillian.test.impl.TestContextHandler.createClassContext(TestContextHandler.java:75) [arquillian-service:]
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) [rt.jar:1.7.0_09]
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) [rt.jar:1.7.0_09]
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) [rt.jar:1.7.0_09]
    at java.lang.reflect.Method.invoke(Method.java:601) [rt.jar:1.7.0_09]
    at org.jboss.arquillian.core.impl.ObserverImpl.invoke(ObserverImpl.java:90) [arquillian-service:]
    at org.jboss.arquillian.core.impl.EventContextImpl.proceed(EventContextImpl.java:88) [arquillian-service:]
    at org.jboss.arquillian.test.impl.TestContextHandler.createSuiteContext(TestContextHandler.java:60) [arquillian-service:]
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) [rt.jar:1.7.0_09]
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) [rt.jar:1.7.0_09]
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) [rt.jar:1.7.0_09]
    at java.lang.reflect.Method.invoke(Method.java:601) [rt.jar:1.7.0_09]
    at org.jboss.arquillian.core.impl.ObserverImpl.invoke(ObserverImpl.java:90) [arquillian-service:]
    at org.jboss.arquillian.core.impl.EventContextImpl.proceed(EventContextImpl.java:88) [arquillian-service:]
    at org.jboss.arquillian.persistence.dbunit.DBUnitPersistenceTestLifecycleHandler.closeConnection(DBUnitPersistenceTestLifecycleHandler.java:113) [arquillian-service:]
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) [rt.jar:1.7.0_09]
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) [rt.jar:1.7.0_09]
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) [rt.jar:1.7.0_09]
    at java.lang.reflect.Method.invoke(Method.java:601) [rt.jar:1.7.0_09]
    at org.jboss.arquillian.core.impl.ObserverImpl.invoke(ObserverImpl.java:90) [arquillian-service:]
    at org.jboss.arquillian.core.impl.EventContextImpl.proceed(EventContextImpl.java:88) [arquillian-service:]
    at org.jboss.arquillian.persistence.core.lifecycle.ErrorCollectorHandler.collectErrors(ErrorCollectorHandler.java:46) [arquillian-service:]
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) [rt.jar:1.7.0_09]
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) [rt.jar:1.7.0_09]
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) [rt.jar:1.7.0_09]
    at java.lang.reflect.Method.invoke(Method.java:601) [rt.jar:1.7.0_09]
    at org.jboss.arquillian.core.impl.ObserverImpl.invoke(ObserverImpl.java:90) [arquillian-service:]
    at org.jboss.arquillian.core.impl.EventContextImpl.proceed(EventContextImpl.java:88) [arquillian-service:]
    at org.jboss.arquillian.core.impl.ManagerImpl.fire(ManagerImpl.java:135) [arquillian-service:]
    at org.jboss.arquillian.core.impl.ManagerImpl.fire(ManagerImpl.java:115) [arquillian-service:]
    at org.jboss.arquillian.core.impl.EventImpl.fire(EventImpl.java:67) [arquillian-service:]
    at org.jboss.arquillian.persistence.core.lifecycle.PersistenceTestTrigger.afterTest(PersistenceTestTrigger.java:113) [arquillian-service:]
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) [rt.jar:1.7.0_09]
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) [rt.jar:1.7.0_09]
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) [rt.jar:1.7.0_09]
    at java.lang.reflect.Method.invoke(Method.java:601) [rt.jar:1.7.0_09]
    at org.jboss.arquillian.core.impl.ObserverImpl.invoke(ObserverImpl.java:90) [arquillian-service:]
    at org.jboss.arquillian.core.impl.EventContextImpl.invokeObservers(EventContextImpl.java:99) [arquillian-service:]
    at org.jboss.arquillian.core.impl.EventContextImpl.proceed(EventContextImpl.java:81) [arquillian-service:]
    at org.jboss.arquillian.testenricher.cdi.CreationalContextDestroyer.destory(CreationalContextDestroyer.java:44) [arquillian-service:]
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) [rt.jar:1.7.0_09]
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) [rt.jar:1.7.0_09]
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) [rt.jar:1.7.0_09]
    at java.lang.reflect.Method.invoke(Method.java:601) [rt.jar:1.7.0_09]
    at org.jboss.arquillian.core.impl.ObserverImpl.invoke(ObserverImpl.java:90) [arquillian-service:]
    at org.jboss.arquillian.core.impl.EventContextImpl.proceed(EventContextImpl.java:88) [arquillian-service:]
    at org.jboss.arquillian.test.impl.TestContextHandler.createTestContext(TestContextHandler.java:89) [arquillian-service:]
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) [rt.jar:1.7.0_09]
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) [rt.jar:1.7.0_09]
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) [rt.jar:1.7.0_09]
    at java.lang.reflect.Method.invoke(Method.java:601) [rt.jar:1.7.0_09]
    at org.jboss.arquillian.core.impl.ObserverImpl.invoke(ObserverImpl.java:90) [arquillian-service:]
    at org.jboss.arquillian.core.impl.EventContextImpl.proceed(EventContextImpl.java:88) [arquillian-service:]
    at org.jboss.arquillian.test.impl.TestContextHandler.createClassContext(TestContextHandler.java:75) [arquillian-service:]
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) [rt.jar:1.7.0_09]
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) [rt.jar:1.7.0_09]
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) [rt.jar:1.7.0_09]
    at java.lang.reflect.Method.invoke(Method.java:601) [rt.jar:1.7.0_09]
    at org.jboss.arquillian.core.impl.ObserverImpl.invoke(ObserverImpl.java:90) [arquillian-service:]
    at org.jboss.arquillian.core.impl.EventContextImpl.proceed(EventContextImpl.java:88) [arquillian-service:]
    at org.jboss.arquillian.test.impl.TestContextHandler.createSuiteContext(TestContextHandler.java:60) [arquillian-service:]
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) [rt.jar:1.7.0_09]
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) [rt.jar:1.7.0_09]
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) [rt.jar:1.7.0_09]
    at java.lang.reflect.Method.invoke(Method.java:601) [rt.jar:1.7.0_09]
    at org.jboss.arquillian.core.impl.ObserverImpl.invoke(ObserverImpl.java:90) [arquillian-service:]
    at org.jboss.arquillian.core.impl.EventContextImpl.proceed(EventContextImpl.java:88) [arquillian-service:]
    at org.jboss.arquillian.core.impl.ManagerImpl.fire(ManagerImpl.java:135) [arquillian-service:]
    at org.jboss.arquillian.core.impl.ManagerImpl.fire(ManagerImpl.java:115) [arquillian-service:]
    at org.jboss.arquillian.test.impl.EventTestRunnerAdaptor.after(EventTestRunnerAdaptor.java:103) [arquillian-service:]
    at org.jboss.arquillian.junit.Arquillian$5$1.evaluate(Arquillian.java:245) [arquillian-service:]
    at org.jboss.arquillian.junit.Arquillian.multiExecute(Arquillian.java:314) [arquillian-service:]
    at org.jboss.arquillian.junit.Arquillian.access$100(Arquillian.java:46) [arquillian-service:]
    at org.jboss.arquillian.junit.Arquillian$5.evaluate(Arquillian.java:240) [arquillian-service:]
    at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:263) [arquillian-service:]
    at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:68) [arquillian-service:]
    at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:47) [arquillian-service:]
    at org.junit.runners.ParentRunner$3.run(ParentRunner.java:231) [arquillian-service:]
    at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:60) [arquillian-service:]
    at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:229) [arquillian-service:]
    at org.junit.runners.ParentRunner.access$000(ParentRunner.java:50) [arquillian-service:]
    at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:222) [arquillian-service:]
    at org.jboss.arquillian.junit.Arquillian$2.evaluate(Arquillian.java:185) [arquillian-service:]
    at org.jboss.arquillian.junit.Arquillian.multiExecute(Arquillian.java:314) [arquillian-service:]
    at org.jboss.arquillian.junit.Arquillian.access$100(Arquillian.java:46) [arquillian-service:]
    at org.jboss.arquillian.junit.Arquillian$3.evaluate(Arquillian.java:199) [arquillian-service:]
    at org.junit.runners.ParentRunner.run(ParentRunner.java:300) [arquillian-service:]
    at org.jboss.arquillian.junit.Arquillian.run(Arquillian.java:147) [arquillian-service:]
    at org.junit.runner.JUnitCore.run(JUnitCore.java:157) [arquillian-service:]
    at org.junit.runner.JUnitCore.run(JUnitCore.java:136) [arquillian-service:]
    at org.jboss.arquillian.junit.container.JUnitTestRunner.execute(JUnitTestRunner.java:65) [arquillian-service:]
    at org.jboss.arquillian.protocol.jmx.JMXTestRunner.runTestMethodInternal(JMXTestRunner.java:128) [arquillian-service:]
    at org.jboss.arquillian.protocol.jmx.JMXTestRunner.runTestMethod(JMXTestRunner.java:107) [arquillian-service:]
    at org.jboss.as.arquillian.service.ArquillianService$ExtendedJMXTestRunner.runTestMethod(ArquillianService.java:226) [arquillian-service:]
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) [rt.jar:1.7.0_09]
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) [rt.jar:1.7.0_09]
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) [rt.jar:1.7.0_09]
    at java.lang.reflect.Method.invoke(Method.java:601) [rt.jar:1.7.0_09]
    at com.sun.jmx.mbeanserver.StandardMBeanIntrospector.invokeM2(StandardMBeanIntrospector.java:111) [rt.jar:1.7.0_09]
    at com.sun.jmx.mbeanserver.StandardMBeanIntrospector.invokeM2(StandardMBeanIntrospector.java:45) [rt.jar:1.7.0_09]
    at com.sun.jmx.mbeanserver.MBeanIntrospector.invokeM(MBeanIntrospector.java:235) [rt.jar:1.7.0_09]
    at com.sun.jmx.mbeanserver.PerInterface.invoke(PerInterface.java:138) [rt.jar:1.7.0_09]
    at com.sun.jmx.mbeanserver.MBeanSupport.invoke(MBeanSupport.java:250) [rt.jar:1.7.0_09]
    at com.sun.jmx.interceptor.DefaultMBeanServerInterceptor.invoke(DefaultMBeanServerInterceptor.java:819) [rt.jar:1.7.0_09]
    at com.sun.jmx.mbeanserver.JmxMBeanServer.invoke(JmxMBeanServer.java:791) [rt.jar:1.7.0_09]
    at org.jboss.as.jmx.PluggableMBeanServerImpl$TcclMBeanServer.invoke(PluggableMBeanServerImpl.java:498)
    at org.jboss.as.jmx.PluggableMBeanServerImpl.invoke(PluggableMBeanServerImpl.java:246)
    at org.jboss.remotingjmx.protocol.v1.ServerProxy$InvokeHandler.handle(ServerProxy.java:1034)
    at org.jboss.remotingjmx.protocol.v1.ServerProxy$MessageReciever$1.run(ServerProxy.java:215)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1110) [rt.jar:1.7.0_09]
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:603) [rt.jar:1.7.0_09]
    at java.lang.Thread.run(Thread.java:722) [rt.jar:1.7.0_09]
Caused by: org.hibernate.exception.ConstraintViolationException: ERROR: llave duplicada viola restricción de unicidad «applications_pkey»
  Detail: Ya existe la llave (appname)=(prueba).
    at org.hibernate.exception.internal.SQLStateConversionDelegate.convert(SQLStateConversionDelegate.java:128) [hibernate-core-4.0.1.Final.jar:4.0.1.Final]
    at org.hibernate.exception.internal.StandardSQLExceptionConverter.convert(StandardSQLExceptionConverter.java:47) [hibernate-core-4.0.1.Final.jar:4.0.1.Final]
    at org.hibernate.engine.jdbc.spi.SqlExceptionHelper.convert(SqlExceptionHelper.java:125) [hibernate-core-4.0.1.Final.jar:4.0.1.Final]
    at org.hibernate.engine.jdbc.spi.SqlExceptionHelper.convert(SqlExceptionHelper.java:110) [hibernate-core-4.0.1.Final.jar:4.0.1.Final]
    at org.hibernate.engine.jdbc.internal.proxy.AbstractStatementProxyHandler.continueInvocation(AbstractStatementProxyHandler.java:129) [hibernate-core-4.0.1.Final.jar:4.0.1.Final]
    at org.hibernate.engine.jdbc.internal.proxy.AbstractProxyHandler.invoke(AbstractProxyHandler.java:81) [hibernate-core-4.0.1.Final.jar:4.0.1.Final]
    at $Proxy52.executeUpdate(Unknown Source)   at org.hibernate.engine.jdbc.batch.internal.NonBatchingBatch.addToBatch(NonBatchingBatch.java:56) [hibernate-core-4.0.1.Final.jar:4.0.1.Final]
    at org.hibernate.persister.entity.AbstractEntityPersister.insert(AbstractEntityPersister.java:2849) [hibernate-core-4.0.1.Final.jar:4.0.1.Final]
    at org.hibernate.persister.entity.AbstractEntityPersister.insert(AbstractEntityPersister.java:3290) [hibernate-core-4.0.1.Final.jar:4.0.1.Final]
    at org.hibernate.action.internal.EntityInsertAction.execute(EntityInsertAction.java:80) [hibernate-core-4.0.1.Final.jar:4.0.1.Final]
    at org.hibernate.engine.spi.ActionQueue.execute(ActionQueue.java:272) [hibernate-core-4.0.1.Final.jar:4.0.1.Final]
    at org.hibernate.engine.spi.ActionQueue.executeActions(ActionQueue.java:264) [hibernate-core-4.0.1.Final.jar:4.0.1.Final]
    at org.hibernate.engine.spi.ActionQueue.executeActions(ActionQueue.java:186) [hibernate-core-4.0.1.Final.jar:4.0.1.Final]
    at org.hibernate.event.internal.AbstractFlushingEventListener.performExecutions(AbstractFlushingEventListener.java:326) [hibernate-core-4.0.1.Final.jar:4.0.1.Final]
    at org.hibernate.event.internal.DefaultFlushEventListener.onFlush(DefaultFlushEventListener.java:52) [hibernate-core-4.0.1.Final.jar:4.0.1.Final]
    at org.hibernate.internal.SessionImpl.flush(SessionImpl.java:1081) [hibernate-core-4.0.1.Final.jar:4.0.1.Final]
    at org.hibernate.internal.SessionImpl.managedFlush(SessionImpl.java:315) [hibernate-core-4.0.1.Final.jar:4.0.1.Final]
    at org.hibernate.engine.transaction.synchronization.internal.SynchronizationCallbackCoordinatorImpl.beforeCompletion(SynchronizationCallbackCoordinatorImpl.java:104) [hibernate-core-4.0.1.Final.jar:4.0.1.Final]
    ... 168 more
Caused by: org.postgresql.util.PSQLException: ERROR: llave duplicada viola restricción de unicidad «applications_pkey»
  Detail: Ya existe la llave (appname)=(prueba).
    at org.postgresql.core.v3.QueryExecutorImpl.receiveErrorResponse(QueryExecutorImpl.java:2101)
    at org.postgresql.core.v3.QueryExecutorImpl.processResults(QueryExecutorImpl.java:1834)
    at org.postgresql.core.v3.QueryExecutorImpl.execute(QueryExecutorImpl.java:255)
    at org.postgresql.jdbc2.AbstractJdbc2Statement.execute(AbstractJdbc2Statement.java:510)
    at org.postgresql.jdbc2.AbstractJdbc2Statement.executeWithFlags(AbstractJdbc2Statement.java:386)
    at org.postgresql.jdbc2.AbstractJdbc2Statement.executeUpdate(AbstractJdbc2Statement.java:332)
    at org.jboss.jca.adapters.jdbc.CachedPreparedStatement.executeUpdate(CachedPreparedStatement.java:115)
    at org.jboss.jca.adapters.jdbc.WrappedPreparedStatement.executeUpdate(WrappedPreparedStatement.java:493)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) [rt.jar:1.7.0_09]
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) [rt.jar:1.7.0_09]
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) [rt.jar:1.7.0_09]
    at java.lang.reflect.Method.invoke(Method.java:601) [rt.jar:1.7.0_09]
    at org.hibernate.engine.jdbc.internal.proxy.AbstractStatementProxyHandler.continueInvocation(AbstractStatementProxyHandler.java:122) [hibernate-core-4.0.1.Final.jar:4.0.1.Final]
    ... 182 more

09:31:42,286 TRACE [com.arjuna.ats.arjuna] (pool-5-thread-10) BasicAction::preventCommit( BasicAction: 0:ffffac10441a:-501d5bf2:516ea394:103 status: ActionStatus.ABORT_ONLY)
09:31:42,286 TRACE [com.arjuna.ats.arjuna] (pool-5-thread-10) BasicAction::Abort() for action-id 0:ffffac10441a:-501d5bf2:516ea394:103
09:31:42,286 TRACE [com.arjuna.ats.arjuna] (pool-5-thread-10) BasicAction::doAbort (LastResourceRecord(XAOnePhaseResource(LocalXAResourceImpl@13eca4e[connectionListener=140f3b0 connectionManager=1d73a72 warned=false currentXid=< formatId=131077, gtrid_length=29, bqual_length=36, tx_uid=0:ffffac10441a:-501d5bf2:516ea394:103, node_name=1, branch_uid=0:ffffac10441a:-501d5bf2:516ea394:107, subordinatenodename=null, eis_name=unknown eis name >])))
09:31:42,286 TRACE [com.arjuna.ats.arjuna] (pool-5-thread-10) LastResourceRecord::topLevelAbort() for 0:0:0:0:1
09:31:42,286 TRACE [com.arjuna.ats.jta] (pool-5-thread-10) SynchronizationImple.afterCompletion
09:31:42,286 TRACE [com.arjuna.ats.jta] (pool-5-thread-10) SynchronizationImple.afterCompletion
09:31:42,286 DEBUG [org.jboss.as.jpa] (pool-5-thread-10) pool-5-thread-10:[transaction scoped EntityManager]: closing entity managersession
09:31:42,286 TRACE [com.arjuna.ats.jta] (pool-5-thread-10) BaseTransaction.getStatus
09:31:42,286 TRACE [com.arjuna.ats.jta] (pool-5-thread-10) TransactionImple.getStatus
09:31:42,286 INFO  [org.hibernate.engine.jdbc.batch.internal.AbstractBatchImpl] (pool-5-thread-10) HHH000010: On release of batch it still contained JDBC statements
09:31:42,286 TRACE [com.arjuna.ats.jta] (pool-5-thread-10) SynchronizationImple.afterCompletion
09:31:42,286 TRACE [com.arjuna.ats.arjuna] (pool-5-thread-10) BasicAction::removeChildThread () action 0:ffffac10441a:-501d5bf2:516ea394:103 removing TSThread:9
09:31:42,286 TRACE [com.arjuna.ats.arjuna] (pool-5-thread-10) BasicAction::removeChildThread () action 0:ffffac10441a:-501d5bf2:516ea394:103 removing TSThread:9 result = true
09:31:42,286 TRACE [com.arjuna.ats.arjuna] (pool-5-thread-10) TransactionReaper::remove ( BasicAction: 0:ffffac10441a:-501d5bf2:516ea394:103 status: ActionStatus.ABORTED )
09:31:42,286 ERROR [org.jboss.arquillian.protocol.jmx.JMXTestRunner] (pool-5-thread-10) Failed: com.donde.am.entities.AppTestIssue6.testpersistWithaUsingDataSet: java.lang.AssertionError: Expected exception: javax.transaction.RollbackException
    at org.junit.internal.runners.statements.ExpectException.evaluate(ExpectException.java:35) [arquillian-service:]
    at org.jboss.arquillian.junit.Arquillian$4.evaluate(Arquillian.java:226) [arquillian-service:]
    at org.jboss.arquillian.junit.Arquillian.multiExecute(Arquillian.java:314) [arquillian-service:]
    at org.jboss.arquillian.junit.Arquillian.access$100(Arquillian.java:46) [arquillian-service:]
    at org.jboss.arquillian.junit.Arquillian$5.evaluate(Arquillian.java:240) [arquillian-service:]
    at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:263) [arquillian-service:]
    at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:68) [arquillian-service:]
    at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:47) [arquillian-service:]
    at org.junit.runners.ParentRunner$3.run(ParentRunner.java:231) [arquillian-service:]
    at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:60) [arquillian-service:]
    at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:229) [arquillian-service:]
    at org.junit.runners.ParentRunner.access$000(ParentRunner.java:50) [arquillian-service:]
    at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:222) [arquillian-service:]
    at org.jboss.arquillian.junit.Arquillian$2.evaluate(Arquillian.java:185) [arquillian-service:]
    at org.jboss.arquillian.junit.Arquillian.multiExecute(Arquillian.java:314) [arquillian-service:]
    at org.jboss.arquillian.junit.Arquillian.access$100(Arquillian.java:46) [arquillian-service:]
    at org.jboss.arquillian.junit.Arquillian$3.evaluate(Arquillian.java:199) [arquillian-service:]
    at org.junit.runners.ParentRunner.run(ParentRunner.java:300) [arquillian-service:]
    at org.jboss.arquillian.junit.Arquillian.run(Arquillian.java:147) [arquillian-service:]
    at org.junit.runner.JUnitCore.run(JUnitCore.java:157) [arquillian-service:]
    at org.junit.runner.JUnitCore.run(JUnitCore.java:136) [arquillian-service:]
    at org.jboss.arquillian.junit.container.JUnitTestRunner.execute(JUnitTestRunner.java:65) [arquillian-service:]
    at org.jboss.arquillian.protocol.jmx.JMXTestRunner.runTestMethodInternal(JMXTestRunner.java:128) [arquillian-service:]
    at org.jboss.arquillian.protocol.jmx.JMXTestRunner.runTestMethod(JMXTestRunner.java:107) [arquillian-service:]
    at org.jboss.as.arquillian.service.ArquillianService$ExtendedJMXTestRunner.runTestMethod(ArquillianService.java:226) [arquillian-service:]
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) [rt.jar:1.7.0_09]
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) [rt.jar:1.7.0_09]
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) [rt.jar:1.7.0_09]
    at java.lang.reflect.Method.invoke(Method.java:601) [rt.jar:1.7.0_09]
    at com.sun.jmx.mbeanserver.StandardMBeanIntrospector.invokeM2(StandardMBeanIntrospector.java:111) [rt.jar:1.7.0_09]
    at com.sun.jmx.mbeanserver.StandardMBeanIntrospector.invokeM2(StandardMBeanIntrospector.java:45) [rt.jar:1.7.0_09]
    at com.sun.jmx.mbeanserver.MBeanIntrospector.invokeM(MBeanIntrospector.java:235) [rt.jar:1.7.0_09]
    at com.sun.jmx.mbeanserver.PerInterface.invoke(PerInterface.java:138) [rt.jar:1.7.0_09]
    at com.sun.jmx.mbeanserver.MBeanSupport.invoke(MBeanSupport.java:250) [rt.jar:1.7.0_09]
    at com.sun.jmx.interceptor.DefaultMBeanServerInterceptor.invoke(DefaultMBeanServerInterceptor.java:819) [rt.jar:1.7.0_09]
    at com.sun.jmx.mbeanserver.JmxMBeanServer.invoke(JmxMBeanServer.java:791) [rt.jar:1.7.0_09]
    at org.jboss.as.jmx.PluggableMBeanServerImpl$TcclMBeanServer.invoke(PluggableMBeanServerImpl.java:498)
    at org.jboss.as.jmx.PluggableMBeanServerImpl.invoke(PluggableMBeanServerImpl.java:246)
    at org.jboss.remotingjmx.protocol.v1.ServerProxy$InvokeHandler.handle(ServerProxy.java:1034)
    at org.jboss.remotingjmx.protocol.v1.ServerProxy$MessageReciever$1.run(ServerProxy.java:215)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1110) [rt.jar:1.7.0_09]
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:603) [rt.jar:1.7.0_09]
    at java.lang.Thread.run(Thread.java:722) [rt.jar:1.7.0_09]

The extension doesn't work with ordinary tomcat server

The extension doesn't work with ordinary tomcat server.
The reason it is failing, it is looking for the datasource name and it throws null pointer exception since the datasource name is not available in persistence.xml

Warning when using with Jacoco extension

Issue Overview

APE logs a warning about an unsupported property when the Arquillian Jacoco extension is also present.

Expected Behaviour

No warning should be logged.

Current Behaviour

This warning is logged once for every test in a class:

11:59:13,867 WARNING [org.arquillian.ape.rdbms.core.configuration.ConfigurationImporter] (default task-77) org.arquillian.ape.rdbms.core.configuration.PersistenceConfiguration@350a70d4[qualifier=persistence] does not support properties provided '[$jacocoData]. Possible values: [defaultDataSource, defaultTransactionMode, defaultDataSeedStrategy, dumpData, dumpDirectory, defaultCleanupPhase, defaultCleanupStrategy]'. Please revise your arquillian.xml. For more details you can refer to the official documentation https://docs.jboss.org/author/display/ARQ/Persistence

Steps To Reproduce

Run a test with both APE and Arquillian Jacoco present.

Additional Information

I am using APE version 2.0.0-alpha.4 and Arquillian Jacoco version 1.0.0.Alpha9.

Stores in Populator configuration setter as lambda

Currently the configuration map is created using a DSL. The problem is that when we want to populate the options present on the map to the db client then we start with a big if blocks checking if the attribute is present or not. Instead of this let's store as value a lambda expression who does this.

Configurable FlatXmlDataSetBuilder

Hi,

i'm trying to use your excelent extension and i think that ther are two issues it would be nice to have resolved:

  1. Possibility to specify 'null' values in flat xml files as described here http://www.dbunit.org/faq.html#flatxmlnull

Now i have no possibility to do something like

<sandbox_dict ID="10" version="0" dict_type="COUNTRIES" name="Countries" system_="true" some_property="[null]"/>

where [null] is placeholder for null value.

  1. and i also think that add columnSensing option would be nice as described here
    http://www.dbunit.org/faq.html#differentcolumnnumber

Best Regards
and Best Wishes in the New Year

Jarek Gilewski

How use variables to match data sets?

I know that is possible seed database with yml files and these files can have variables. But I need use yml files with variables to match the database with the annotation @ShouldMatchDataSet. So, do this is possible?

I searched in the code and maybe the "problem" is the difference between seedDatabase() and compare(@Observes CompareDBUnitData compareDataEvent) in DBUnitDataHandler.java, this make sense?

Connection closed issue

I've put together a small utility library to help our local code base unit test
our beans and such.
But for some reason when I'm using derby and hibernate, I get these errors:

checkBeanEm(ca.ubc.sis.test.arquillian.TestArquillianDerbyTest)  Time elapsed: 0.014 sec  <<< ERROR!
org.jboss.arquillian.persistence.dbunit.exception.DBUnitDataSetHandlingException: Failed while seeding database.
Caused by: org.dbunit.dataset.DataSetException: Exception while searching the dependent tables.
Caused by: org.dbunit.util.search.SearchException: java.sql.SQLException: Connection jdbc:derby:memory:testDB, UserName=SA, Apache Derby Embedded JDBC Driver is closed.
Caused by: java.sql.SQLException: Connection jdbc:derby:memory:testDB, UserName=SA, Apache Derby Embedded JDBC Driver is closed.

After a lot of poking around I came up with this fix:

diff --git a/dbunit/src/main/java/org/jboss/arquillian/persistence/dbunit/DBUnitPersistenceTestLifecycleHandler.java b/dbunit/src/main/java/org/jboss/arquillian/persistence/dbunit/DBUnitPersistenceTestLifecycleHandler.java
index 28bc80e..0223461 100644
--- a/dbunit/src/main/java/org/jboss/arquillian/persistence/dbunit/DBUnitPersistenceTestLifecycleHandler.java
+++ b/dbunit/src/main/java/org/jboss/arquillian/persistence/dbunit/DBUnitPersistenceTestLifecycleHandler.java
@@ -115,8 +117,12 @@
 
     private void createDatabaseConnection() {
 
-        if (databaseConnectionProducer.get() == null) {
-            configureDatabaseConnection();
+        try {
+            if (databaseConnectionProducer.get() == null || databaseConnectionProducer.get().getConnection().isClosed()) {
+                configureDatabaseConnection();
+            }
+        } catch (SQLException e) {
+            throw new DBUnitInitializationException("Unable to createDatabaseConnection database connection for DBUnit module.", e);
         }
     }
 

Execute scripts before test starts

I use the option to execute scripts before and after each test case with postgres (drop all tables and then create all tables with some default data, in that order).

Sometimes the script fails and the build stops. Ok, that is expected and useful.

The thing is that my database stays "dirty" because the whole script file failed to execute properly. Then when I correct it and try to run the tests again it pops up an unexpected error, which is "table x already exists" when trying to create the initial tables (it assumes the database is clean at the start)

The way I see to solve this is to allow an "init" option to execute a given script before the whole test starts (not in a given class because its order can change).

Any thoughs? Is there already an API for this?

APE 2.0 - No ShouldMatchDataset annotation in standalone mode

Hi,

I'm currently using Arquillian Persistence Extension 1 in a project, but considering updating to 2.0 to use the standalone version. Currently my REST tests are using a workaround described in https://issues.jboss.org/browse/ARQ-1077. (They are ordered with InSequence with a first in-container test method with UsingDataSet setting up the database state, a REST test and again an in-container test method with ShouldMatchDataSet checking the database state.) The new standalone version seems to solve this problem if I understand correctly.

The standalone version does, however, not provide the ShouldMatchDataset annotation. Is it planned to add this annotation to the standalone version for future releases or are there any technical issues why this wouldn't work?

Besides, is there something to consider when using the APE 2.0 standalone version? I could not get it to work when simply adding an UsingDataSet annotation to a RunAsClient test method.

Thanks a lot for your work!

API Documentation

I found this link with the API docs from the persistence module.

Is this the only resource available? Is there any features not documented in that link?

I ask this because a fast reading in the docs made the impression that the module is too simple, am I missing something or this is just impression?

test-persistence.xml jta-datasource or non-jta-datasource required

In the "Testing Java Peristence" guide it says

Alternatively, you can skip the DataSource configuration and simply include the database connection information directly in test-persistence.xml using standard database connection properties:

However if for example I create a test-peristence.xml like so

<persistence-unit name="primary">
	<provider>org.eclipse.persistence.jpa.PersistenceProvider</provider>
	<!--  <jta-data-source>jdbc/derby</jta-data-source> -->
	<properties>
		<!-- Common properties -->
		<property name="javax.persistence.jdbc.driver" value="org.apache.derby.jdbc.EmbeddedDriver" />
		<property name="javax.persistence.jdbc.url" value="jdbc:derby:memory:test-jpa;create=true" />
		<property name="javax.persistence.jdbc.user" value="APP" />
		<property name="javax.persistence.jdbc.password" value="APP" />

		<!-- EclipseLink specific properties -->
		<property name="eclipselink.target-database" value="Derby" />
		<property name="eclipselink.ddl-generation" value="drop-and-create-tables" />
		<property name="eclipselink.debug" value="ALL" />
		<property name="eclipselink.weaving" value="static" />
		<property name="eclipselink.logging.level" value="FINEST" />
		<property name="eclipselink.logging.level.sql" value="FINEST" />
		<property name="eclipselink.logging.level.cache" value="FINEST" />
	</properties>
</persistence-unit>

And then try to create a simple deployment for example

@Deployment
public static Archive<?> createDeployment() {
	return ShrinkWrap.create(WebArchive.class, "test.war")
			.addClass(User.class)
			.addAsResource("test-persistence.xml", "persistence.xml")
			.addAsWebInfResource(EmptyAsset.INSTANCE, "beans.xml");
}

I get the following stack trace

java.lang.NullPointerException
	at org.jboss.arquillian.persistence.core.configuration.PersistenceDescriptorParser.obtainDataSourceName(PersistenceDescriptorParser.java:61)
	at org.jboss.arquillian.persistence.core.configuration.PersistenceDescriptorParser.obtainDataSourceName(PersistenceDescriptorParser.java:66)
	at org.jboss.arquillian.persistence.core.deployment.PersistenceExtensionConfigurationTestArchiveEnricher.obtainDataSourceFromPersistenceXml(PersistenceExtensionConfigurationTestArchiveEnricher.java:98)
	at org.jboss.arquillian.persistence.core.deployment.PersistenceExtensionConfigurationTestArchiveEnricher.process(PersistenceExtensionConfigurationTestArchiveEnricher.java:72)
	at org.jboss.arquillian.container.test.impl.client.deployment.DeploymentGenerator.applyApplicationProcessors(DeploymentGenerator.java:223)
	at org.jboss.arquillian.container.test.impl.client.deployment.DeploymentGenerator.buildTestableDeployments(DeploymentGenerator.java:172)
	at org.jboss.arquillian.container.test.impl.client.deployment.DeploymentGenerator.createTestableDeployments(DeploymentGenerator.java:148)
	at org.jboss.arquillian.container.test.impl.client.deployment.DeploymentGenerator.generateDeployment(DeploymentGenerator.java:85)
	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:96)
	at org.jboss.arquillian.core.impl.EventContextImpl.invokeObservers(EventContextImpl.java:103)
	at org.jboss.arquillian.core.impl.EventContextImpl.proceed(EventContextImpl.java:85)
	at org.jboss.arquillian.core.impl.ManagerImpl.fire(ManagerImpl.java:143)
	at org.jboss.arquillian.core.impl.ManagerImpl.fire(ManagerImpl.java:114)
	at org.jboss.arquillian.core.impl.EventImpl.fire(EventImpl.java:67)
	at org.jboss.arquillian.container.test.impl.client.ContainerEventController.execute(ContainerEventController.java:100)
	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:96)
	at org.jboss.arquillian.core.impl.EventContextImpl.invokeObservers(EventContextImpl.java:103)
	at org.jboss.arquillian.core.impl.EventContextImpl.proceed(EventContextImpl.java:85)
	at org.jboss.arquillian.test.impl.TestContextHandler.createClassContext(TestContextHandler.java:92)
	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:96)
	at org.jboss.arquillian.core.impl.EventContextImpl.proceed(EventContextImpl.java:92)
	at org.jboss.arquillian.test.impl.TestContextHandler.createSuiteContext(TestContextHandler.java:73)
	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:96)
	at org.jboss.arquillian.core.impl.EventContextImpl.proceed(EventContextImpl.java:92)
	at org.jboss.arquillian.core.impl.ManagerImpl.fire(ManagerImpl.java:143)
	at org.jboss.arquillian.core.impl.ManagerImpl.fire(ManagerImpl.java:114)
	at org.jboss.arquillian.test.impl.EventTestRunnerAdaptor.beforeClass(EventTestRunnerAdaptor.java:87)
	at org.jboss.arquillian.junit.Arquillian$2.evaluate(Arquillian.java:202)
	at org.jboss.arquillian.junit.Arquillian.multiExecute(Arquillian.java:431)
	at org.jboss.arquillian.junit.Arquillian.access$200(Arquillian.java:55)
	at org.jboss.arquillian.junit.Arquillian$3.evaluate(Arquillian.java:219)
	at org.junit.runners.ParentRunner.run(ParentRunner.java:363)
	at org.jboss.arquillian.junit.Arquillian.run(Arquillian.java:167)
	at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:86)
	at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:459)
	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:678)
	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:382)
	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:192)

If I then create a datasource in Weblogic and specify it in the jta-data-source I don't get this issue.

Unable to clean database due to Foreign Key Constraint Violation

Hi, I'm having a problem with I suppose is with this extension, not the underlying DBUnit infrastructure. When the extension tries to clean the database after a test method, it fails to clean the database due to a foreign key constraint violation. The test method is as follows:

@test
@ShouldMatchDataSet("datasets/users-company.xml")
public void saveClientWithCompany(){
Client s = new Client();
s.setLogin("solicitante1");
s.setEmail("[email protected]");
s.setNome("paulo");
s.setSenha("123456");
s.setDepartamento("dep");
Company e = new Company();
e.setNome("empresa");
Set set = new HashSet();
set.add(s);
e.setListClient(set);
s.setCompany(e);
solMgt.saveClient(s);
}

As you can see, there is a ManyToOne relation between Client and Company, and there is a constraint in this relationship.
I tried to use @ApplyScriptBefore to deactivate the constraint check, but with no success. Apparently, the extension does not run the script, since if I run the command by hand it works as it should.

@CreateSchema cannot execute SQL statements with multiple lines

Hi there,

I have a file that I want to use with @CreateSchema, the file has statements like this:

CREATE TABLE Estado
(
    ID INTEGER NOT NULL,
    nombre VARCHAR(50) NOT NULL,
    PRIMARY KEY (ID)
) ;

However, I got this exception:

org.jboss.arquillian.persistence.dbunit.exception.DBUnitDataSetHandlingException: Unable to execute line: CREATE TABLE Estado

As you can see, there is a problem parsing the statement.

I think the SQL_DELIMITER used in org.jboss.arquillian.persistence.core.data.script.ScriptExecutor class causes the problem:

private static final String SQL_DELIMITER = "(;)|(;(\r)?\n)|((\r)?(\n))";

If I modify the statement to fit in a single line, it works, but is awkward to read and edit the file when the statements are large, for example, when tables have a lot of columns.

CREATE TABLE Estado(ID INTEGER NOT NULL, nombre VARCHAR(50) NOT NULL, PRIMARY KEY (ID)) ;

Can you help me out? Thanks!

Updating from Arquillian Persistence Extension 1 to 2

First: thanks for your work!

Currently I'm using Arquillian Persistence Extension 1 in a project of mine, but I'm thinking about updating to APE 2.
Are there any important things, that need to be done when updating to APE 2, or is it enough to simply update the maven dependencies to version 2.0.0?

@UsingDataSet with dataSource parameter

While preparing multiple data-sources per test-method, it would be really nice to be able to set the data-source at the @UsingDataSet annotation, Currently, this is not possible.

Kind Regards,
Christian

Extension keeps managed entities when calling @EJB

I am not familiarized with the specifics of the J2EE implementation. But the test below fails when used in conjunction with this arquillian extension (part of the code apparently non relevant is ommited):

...

@EJB
ProblemReader problemReader;

...

@Test
    public void testEntityNotInPersistenceContext() throws PermissionDeniedException {

        UserSessionData user = ProblemTestHelper
                .createTestUser( 1, PermissionsWrite.ADD_NEW_PROBLEM );

        ProblemEntity problem = new ProblemEntity();
        problem.setTitle( "test" );

        problemCreator.createProblem( problem, user );

        ProblemEntity firstProblem = problemReader.getProblemByPrimaryKey( 1 );
        Assert.assertEquals( "test", firstProblem.getTitle() );

        firstProblem.setTitle( "newtitle" );

        ProblemEntity secondProblem = problemReader.getProblemByPrimaryKey( 1 );
        Assert.assertEquals( "test", secondProblem.getTitle() );
    }

...

I suppose secondProblem.getTitle() should be "test" but it is actually receiving "newtest". It only happens if I use the following annotations in the class level:

@ApplyScriptBefore( "create-schema.sql" )
@ApplyScriptAfter( "drop-schema.sql" )

That eventually enables the extension. When I remove those the test is completed successfully.

hbm2ddl.auto = validate is not validating tables created when using plain SQL and @CreateSchema

When using @CreateSchema and hbm2ddl.auto = validate the CREATE TABLE statement does not work.
It throws:

19:11:38,106 INFO  [java.sql.DatabaseMetaData] (MSC service thread 1-7) HHH000262: Table not found: table_name
19:11:38,108 ERROR [org.jboss.msc.service.fail] (MSC service thread 1-7) MSC00001: Failed to start service jboss.persistenceunit."44fdf497-81e8-42cf-b964-0e5dc9347ffe.war#PersistenceUnit": org.jboss.msc.service.StartException in service jboss.persistenceunit."44fdf497-81e8-42cf-b964-0e5dc9347ffe.war#PersistenceUnit": Failed to start service
    at org.jboss.msc.service.ServiceControllerImpl$StartTask.run(ServiceControllerImpl.java:1767) [jboss-msc-1.0.2.GA.jar:1.0.2.GA]
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1110) [rt.jar:1.7.0_11]
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:603) [rt.jar:1.7.0_11]
    at java.lang.Thread.run(Thread.java:722) [rt.jar:1.7.0_11]
Caused by: javax.persistence.PersistenceException: [PersistenceUnit: PersistenceUnit] Unable to build EntityManagerFactory
    at org.hibernate.ejb.Ejb3Configuration.buildEntityManagerFactory(Ejb3Configuration.java:914)
    at org.hibernate.ejb.Ejb3Configuration.buildEntityManagerFactory(Ejb3Configuration.java:889)
    at org.hibernate.ejb.HibernatePersistence.createContainerEntityManagerFactory(HibernatePersistence.java:73)
    at org.jboss.as.jpa.service.PersistenceUnitServiceImpl.createContainerEntityManagerFactory(PersistenceUnitServiceImpl.java:162)
    at org.jboss.as.jpa.service.PersistenceUnitServiceImpl.start(PersistenceUnitServiceImpl.java:85)
    at org.jboss.msc.service.ServiceControllerImpl$StartTask.startService(ServiceControllerImpl.java:1811) [jboss-msc-1.0.2.GA.jar:1.0.2.GA]
    at org.jboss.msc.service.ServiceControllerImpl$StartTask.run(ServiceControllerImpl.java:1746) [jboss-msc-1.0.2.GA.jar:1.0.2.GA]
    ... 3 more
Caused by: org.hibernate.HibernateException: Missing table: table_name
    at org.hibernate.cfg.Configuration.validateSchema(Configuration.java:1265)
    at org.hibernate.tool.hbm2ddl.SchemaValidator.validate(SchemaValidator.java:155)
    at org.hibernate.internal.SessionFactoryImpl.<init>(SessionFactoryImpl.java:460)
    at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1737)
    at org.hibernate.ejb.EntityManagerFactoryImpl.<init>(EntityManagerFactoryImpl.java:84)
    at org.hibernate.ejb.Ejb3Configuration.buildEntityManagerFactory(Ejb3Configuration.java:904)
    ... 9 more

Using JBoss AS 7.1.1.Final (managed).
I suppose this could be a bug with the persistence-api, am I right?

Possibility to replace any placeholder in a dataset with custom code

According to the DBUnit-FAQ, it is possible to replace any placeholder ini a datafile (XML, JSON) with a value produced by custom code:

http://www.dbunit.org/faq.html#systemTimeInTest

I have used this possibility to work with non static data like dates or surrogate keys in the tests. It would be great to have this kind of functionality in the persistence extension. If it is not to hard to integrate or if I get the pointer how and where to do it, I like to help or implement this feature.

Regards,

Cyrill

Support for regex expression in expected datasets

example:

expected-users-regex.yml

useraccount:
  - id: "regex:\\d+"
    firstname: regex:^Jo.* #John
    lastname: regex:.*ith$ #Smith
    username: regex:.oovd. #doovde
    password: password
    openDate: regex:^(?:[0-9]{2})?[0-9]{2}-[0-3]?[0-9]-[0-3]?[0-9]$

the test:

    @Test
    @ShouldMatchDataSet("expected-users-regex.yml")
    public void should_verify_database_content_using_regex_in_expected_dataset() {
          UserAccount ua = new UserAccount();
          ua.setFirstName("John");
          ua.setUserName("doovde");
          ua.setOpenDate(newDate()); 
          entityManager.persist(ua);
    }

The main motivation is to deal with dynamic data in datasets. Here in the example is the Id which is generated by JPA and openDate.

Although it helps in some cases in most of the cases we have 'controlled' static data in datasets so I think if we add this feature it should come disabled.

What do you think?

FlywayOptions has copy/paste error for table setting

Hi

Great that flyway is now part of this extensions. My first tests revealed this bug:

arquillian-extension-persistence/arquillian-ape-sql/standalone/flyway/src/main/java/org/arquillian/ape/rdbms/flyway/FlywayOptions.java

has a copy/paste error on line 151:

        if (this.options.containsKey(TABLE)) {
            flyway.setTable((String) this.options.get(SCHEMAS));
        }

Kind regards,
Michael

NPE when committing the transaction

We changed from ALPHA-5 to the latest SNAPSHOT. The main reason was to have the orderBy functionality in the @ShouldMatchDataSet. We need the ordering by Primary Key with data type ordering and not the string value. The Primary Key is generated by a Sequence (Oracle) and starts with 1'000'000. Below this value, the test data takes place. The test are run with the embedded Glassfish

After switching to the SNAPSHOT, the IT-Tests fail because the transactions can not be commited anymore.

java.lang.RuntimeException: Unable to commit the transaction.
at org.jboss.arquillian.transaction.jta.provider.JtaTransactionProvider.commitTransaction(JtaTransactionProvider.java:79)
at org.jboss.arquillian.transaction.impl.lifecycle.TransactionHandler.endTransactionAfterTest(TransactionHandler.java:111)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at org.jboss.arquillian.core.impl.ObserverImpl.invoke(ObserverImpl.java:90)
at org.jboss.arquillian.core.impl.EventContextImpl.invokeObservers(EventContextImpl.java:99)
at org.jboss.arquillian.core.impl.EventContextImpl.proceed(EventContextImpl.java:81)
at org.jboss.arquillian.testenricher.cdi.CreationalContextDestroyer.destory(CreationalContextDestroyer.java:44)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at org.jboss.arquillian.core.impl.ObserverImpl.invoke(ObserverImpl.java:90)
at org.jboss.arquillian.core.impl.EventContextImpl.proceed(EventContextImpl.java:88)
at org.jboss.arquillian.test.impl.TestContextHandler.createTestContext(TestContextHandler.java:89)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at org.jboss.arquillian.core.impl.ObserverImpl.invoke(ObserverImpl.java:90)
at org.jboss.arquillian.core.impl.EventContextImpl.proceed(EventContextImpl.java:88)
at org.jboss.arquillian.test.impl.TestContextHandler.createClassContext(TestContextHandler.java:75)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at org.jboss.arquillian.core.impl.ObserverImpl.invoke(ObserverImpl.java:90)
at org.jboss.arquillian.core.impl.EventContextImpl.proceed(EventContextImpl.java:88)
at org.jboss.arquillian.test.impl.TestContextHandler.createSuiteContext(TestContextHandler.java:60)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at org.jboss.arquillian.core.impl.ObserverImpl.invoke(ObserverImpl.java:90)
at org.jboss.arquillian.core.impl.EventContextImpl.proceed(EventContextImpl.java:88)
at org.jboss.arquillian.core.impl.ManagerImpl.fire(ManagerImpl.java:135)
at org.jboss.arquillian.core.impl.ManagerImpl.fire(ManagerImpl.java:115)
at org.jboss.arquillian.test.impl.EventTestRunnerAdaptor.after(EventTestRunnerAdaptor.java:103)
at org.jboss.arquillian.junit.Arquillian$5$1.evaluate(Arquillian.java:245)
at org.jboss.arquillian.junit.Arquillian.multiExecute(Arquillian.java:314)
at org.jboss.arquillian.junit.Arquillian.access$100(Arquillian.java:46)
at org.jboss.arquillian.junit.Arquillian$5.evaluate(Arquillian.java:240)
at org.junit.runners.BlockJUnit4ClassRunner.runNotIgnored(BlockJUnit4ClassRunner.java:79)
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:71)
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:49)
at org.junit.runners.ParentRunner$3.run(ParentRunner.java:193)
at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:52)
at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:191)
at org.junit.runners.ParentRunner.access$000(ParentRunner.java:42)
at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:184)
at org.jboss.arquillian.junit.Arquillian$2.evaluate(Arquillian.java:185)
at org.jboss.arquillian.junit.Arquillian.multiExecute(Arquillian.java:314)
at org.jboss.arquillian.junit.Arquillian.access$100(Arquillian.java:46)
at org.jboss.arquillian.junit.Arquillian$3.evaluate(Arquillian.java:199)
at org.junit.runners.ParentRunner.run(ParentRunner.java:236)
at org.jboss.arquillian.junit.Arquillian.run(Arquillian.java:147)
at org.junit.runner.JUnitCore.run(JUnitCore.java:157)
at org.junit.runner.JUnitCore.run(JUnitCore.java:136)
at org.jboss.arquillian.junit.container.JUnitTestRunner.execute(JUnitTestRunner.java:65)
at org.jboss.arquillian.protocol.servlet.runner.ServletTestRunner.executeTest(ServletTestRunner.java:160)
at org.jboss.arquillian.protocol.servlet.runner.ServletTestRunner.execute(ServletTestRunner.java:126)
at org.jboss.arquillian.protocol.servlet.runner.ServletTestRunner.doGet(ServletTestRunner.java:90)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:668)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:770)
at org.apache.catalina.core.StandardWrapper.service(StandardWrapper.java:1542)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:281)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:175)
at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:655)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:595)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:161)
at org.apache.catalina.connector.CoyoteAdapter.doService(CoyoteAdapter.java:331)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:231)
at com.sun.enterprise.v3.services.impl.ContainerMapper$AdapterCallable.call(ContainerMapper.java:317)
at com.sun.enterprise.v3.services.impl.ContainerMapper.service(ContainerMapper.java:195)
at com.sun.grizzly.http.ProcessorTask.invokeAdapter(ProcessorTask.java:849)
at com.sun.grizzly.http.ProcessorTask.doProcess(ProcessorTask.java:746)
at com.sun.grizzly.http.ProcessorTask.process(ProcessorTask.java:1045)
at com.sun.grizzly.http.DefaultProtocolFilter.execute(DefaultProtocolFilter.java:228)
at com.sun.grizzly.DefaultProtocolChain.executeProtocolFilter(DefaultProtocolChain.java:137)
at com.sun.grizzly.DefaultProtocolChain.execute(DefaultProtocolChain.java:104)
at com.sun.grizzly.DefaultProtocolChain.execute(DefaultProtocolChain.java:90)
at com.sun.grizzly.http.HttpProtocolChain.execute(HttpProtocolChain.java:79)
at com.sun.grizzly.ProtocolChainContextTask.doCall(ProtocolChainContextTask.java:54)
at com.sun.grizzly.SelectionKeyContextTask.call(SelectionKeyContextTask.java:59)
at com.sun.grizzly.ContextTask.run(ContextTask.java:71)
at com.sun.grizzly.util.AbstractThreadPool$Worker.doWork(AbstractThreadPool.java:532)
at com.sun.grizzly.util.AbstractThreadPool$Worker.run(AbstractThreadPool.java:513)
at java.lang.Thread.run(Thread.java:662)
Caused by: java.lang.NullPointerException
at org.jboss.arquillian.transaction.jta.provider.JtaTransactionProvider.isTransactionMarkedToRollback(JtaTransactionProvider.java:137)
at org.jboss.arquillian.transaction.jta.provider.JtaTransactionProvider.commitTransaction(JtaTransactionProvider.java:73)
... 89 more

Unit test fails under Windows

The should_insert_special_entities_with_custom_end_line unit fails under windows because the embedded
"\n" doesn't match the, converted by checkout, value in the test data

diff --git a/core/src/test/java/org/jboss/arquillian/persistence/script/ScriptExecutorTest.java b/core/src/test/java/org/jboss/arquillian/persistence/script/ScriptExecutorTest.java
index f1bf7dd..a34c07e 100644
--- a/core/src/test/java/org/jboss/arquillian/persistence/script/ScriptExecutorTest.java
+++ b/core/src/test/java/org/jboss/arquillian/persistence/script/ScriptExecutorTest.java
@@ -271,7 +272,7 @@
         verify(connection.createStatement(), times(1)).execute(statementsCaptor.capture());
         assertThat(statementsCaptor.getAllValues()).containsSequence(
             "insert into useraccount (id, firstname, lastname, username, password)" +
-                " values (1, 'John', 'Smith & Company', 'doovde;;', '&amp;test&copy;')\nGO"
+                " values (1, 'John', 'Smith & Company', 'doovde;;', '&amp;test&copy;')" + System.lineSeparator() + "GO"
         );
     }

Class-level @Transactional is ignored if method has @ShouldMatchDataSet

Issue Overview

In arquillian.xml, I have the default transaction mode set to DISABLED. In a test class, I put @Transactional(TransactionMode.COMMIT) at the class level. I put @ShouldMatchDataSet on one method within that class, without defining @Transactional at the method level.

Expected Behaviour

The method should inherit the class level setting.

Current Behaviour

The method inherts the default setting from arquillian.xml.

Additional Information

The method correctly inherits the class level setting if @ShouldMatchDataSet is removed. Specifying @Transactional(TransactionMode.COMMIT) on the method level works correctly.

Next alpha release?

Hi,

I have been wondering if and when your next alpha release will be. There is one specific code change in the master branch that would solve a problem:

Newer version of snakeyaml removed support for "Value Key Language-Independent Type" in yaml, see (Thinkofname/snakeyaml#192). Your most recent version still somehow depends on that, meaning that it throws a NoSuchFieldError when working with a newer version of snakeyaml from the container. As I can see in your code, you already removed the reference to the VALUE field from your codebase on the master branch.

Exception details:
ava.lang.NoSuchFieldError: VALUE
at org.jboss.arquillian.persistence.dbunit.dataset.yaml.YamlDataSetProducer$1.addImplicitResolvers(YamlDataSetProducer.java:116)

Thanks

@OneToMany relationship returns empty

Issue Overview

Relationship mapped with @OneToMany always returning an empty list.

I made some changes on Arquillian Persistence Tutorial adding consoles attribute on Game.java as you can see below:

public class Game implements Serializable {

    @OneToMany(fetch = FetchType.EAGER, mappedBy = "game")
    private List<Console> consoles;
    
    // getters and setters

    public List<Console> getConsoles() {
        return consoles;
    }

    public void setConsoles(List<Console> consoles) {
        this.consoles = consoles;
    }
}

And creating a new class called Console.java

package org.arquillian.example;

import javax.persistence*;
import javax.validation.constraints.*;

@Entity
public class Console {

    @Id
    @GeneratedValue
    private Long id;
    @NotNull
    @Size(min = 3, max = 50)
    private String name;
    @ManyToOne(fetch = FetchType.EAGER)
    @JoinColumn(name = "game_id")
    private Game game;

    // getters and setters
}
Expected Behaviour

On GamePersistenceTest.java class, I updated the method insertData() to look like this:

private static final String[] CONSOLES = { "PS4", "XBOX360" };

private void insertData() throws Exception {
    utx.begin();
    em.joinTransaction();
    System.out.println("Inserting records...");
    for (String title : GAME_TITLES) {
        Game game = new Game(title);
        em.persist(game);
        for (String consoleName : CONSOLES) {
            Console console = new Console();
            console.setGame(game);
            console.setName(consoleName);
            em.persist(console);
        }
    }

    utx.commit();
    // reset the persistence context (cache)
    em.clear();
}

But, when I get the Game from the database it is always returning me an empty list

@Test
public void shouldFindAllGamesUsingJpqlQuery() throws Exception {
    // given
    String fetchingAllGamesInJpql = "select g from Game g order by g.id";

    // when
    System.out.println("Selecting (using JPQL)...");
    List<Game> games = em.createQuery(fetchingAllGamesInJpql, Game.class).getResultList();

    // then
    System.out.println("Found " + games.size() + " games (using JPQL):");

    for (Game game : games) {
        System.out.println(game);
        System.out.println("Consoles: " + game.getConsoles().size());
        for (Console console : game.getConsoles()) {
            System.out.println(console);
        }
        System.out.println("*********");
    }

    assertContainsAllGames(games);
}

And when I try get the consoles on Console table on database, I can retrieve all of them associated with a Game.

@Test
public void shouldFindAllConsolesWithGamesWithJPQL() throws Exception {
    String sql = "SELECT c FROM Console c ORDER by c.id";
    List<Console> consoles = em.createQuery(sql, Console.class).getResultList();
    System.out.println("Found " + consoles.size() + " consoles (JPQL)");
    for (Console console : consoles) {
        System.out.println(console);
    }
}
Current Behaviour

When I get a Game from the database it is always returning me an empty list.

Additional Information

All changes was made over Arquillian Persistence Tutorial
I'm running GamePersistenceTest.java as a JUnit Test on Eclipse IDE Version: Oxygen.2 (4.7.2)

I'm facing this problem on a personal project when running on a JUnit environment, but if I publish it on my local WebLogicServer I do not have this problem and the list returns with the expected result.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.