Skip to content

Instantly share code, notes, and snippets.

@PiotrNowicki
Created October 6, 2012 23:32
Show Gist options
  • Save PiotrNowicki/3846509 to your computer and use it in GitHub Desktop.
Save PiotrNowicki/3846509 to your computer and use it in GitHub Desktop.
Arquillian persistence problem
@Test
public void dataIsPopulated() {
// given populated cache
// when
List<Question> questions = cut.getQuestions();
// then
assertThat(questions.size()).isEqualTo(3);
}
@Test
//@Transactional(TransactionMode.ROLLBACK)
public void updateGeneratesEvent() throws NotSupportedException, SystemException {
utx.begin();
// given
Question question = cut.getQuestions().get(0);
// when
question.setSummary("My test summary");
cut.updateQuestion(question);
// then
Question actual = cut.getQuestionById(question.getId());
assertThat(actual.getSummary()).isEqualTo("My test summary");
utx.rollback();
}
@PiotrNowicki
Copy link
Author

Works like a charm mate! I put @Cleanup(phase = TestExecutionPhase.NONE) at the class level and @Transactional(TransactionMode.ROLLBACK) for each transactional method that should be rolled-back.

Thanks once again - I'll look forward to watching JTA module arriving :-)

BTW: great job with this APE :-)

@bartoszmajsak
Copy link

JTA module is already there, just hidden in APE internals hehe. Having kinda headache with it currently :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment