Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

Fix for hidden exception during test setup. #12

Closed
wants to merge 1 commit into from
Closed

Fix for hidden exception during test setup. #12

wants to merge 1 commit into from

Conversation

vilmosnagy
Copy link

Hello,

I think this bugfix is very similar to #9 .

If some exception occurs during the test-setup (for example, my datasets contain invalid data), the original exception is still hidden by an NPE. The NPE occurs during the rollback of the transaction. (I'm not totally sure, that there is any transaction.)

See one example here: https://github.com/vilmosnagy/arquillian-transaction-bug

There are 3 test-cases:

  • test_should_pass_without_dataset: in this test-case no dataset used, test passes.
  • test_should_pass_with_dataset: test uses a correct dataset, passes
  • test_should_fail_with_incorrect_dataset: test uses an incorrect dataset (one row contains an invalid column name), and NPE occurs, instead of ...

Here is the NPE's stack trace (the last lines only):

Caused by: java.lang.NullPointerException
    at org.jboss.arquillian.transaction.jta.provider.JtaTransactionProvider.rollbackTransaction(JtaTransactionProvider.java:103)
    ... 117 more

And here's the original exception, thrown by H2:

Caused by: org.dbunit.dataset.NoSuchColumnException: TEST_ENTITY.NOT_EXISTING_COLUMN -  (Non-uppercase input column: not_existing_column) in ColumnNameToIndexes cache map. Note that the map's column names are NOT case sensitive.
    at org.dbunit.dataset.AbstractTableMetaData.getColumnIndex(AbstractTableMetaData.java:117)
    at org.dbunit.operation.AbstractOperation.getOperationMetaData(AbstractOperation.java:89)
    at org.dbunit.operation.AbstractBatchOperation.execute(AbstractBatchOperation.java:143)
    at org.jboss.arquillian.persistence.dbunit.DBUnitDataHandler.seedDatabase(DBUnitDataHandler.java:167)
    at org.jboss.arquillian.persistence.dbunit.DBUnitDataHandler.prepare(DBUnitDataHandler.java:87)
    ... 191 more

I'd be happy to see the second exception, if something fails during the initialization of a test-case.

@bartoszmajsak
Copy link
Member

Thank you very much for this contribution and example proving the issue. I will make sure it will land on the develop as soon as possible. I will try to incorporate your example as part of the test suite either here or in APE.

I'm not totally sure, that there is any transaction.

In fact when you use @UsingDataSet from "Arquillian Persistence Extension" it is by convention wrapping your test in the transaction.

@bartoszmajsak bartoszmajsak self-assigned this Nov 24, 2015
@bartoszmajsak
Copy link
Member

Pushed upstream. Thank you for your contribution!

@vilmosnagy
Copy link
Author

Thanks! Do you know, when you'll release it?

@bartoszmajsak
Copy link
Member

It's on @aslakknutsen desk now, as I don't have sufficient rights to pull the trigger :) I think it's safe to assume it will happen tomorrow.

@aslakknutsen
Copy link
Member

pushed live, 1.0.3.Final

@vilmosnagy
Copy link
Author

Thanks a lot!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants