Example usage for org.springframework.transaction.interceptor RuleBasedTransactionAttribute getRollbackRules

List of usage examples for org.springframework.transaction.interceptor RuleBasedTransactionAttribute getRollbackRules

Introduction

In this page you can find the example usage for org.springframework.transaction.interceptor RuleBasedTransactionAttribute getRollbackRules.

Prototype

public List<RollbackRuleAttribute> getRollbackRules() 

Source Link

Document

Return the list of RollbackRuleAttribute objects (never null ).

Usage

From source file:org.springframework.batch.core.step.item.FaultTolerantStepFactoryBeanRollbackTests.java

@Test
public void testNonDefaultRollbackRules() throws Exception {
    TransactionAttributeEditor editor = new TransactionAttributeEditor();
    editor.setAsText("+RuntimeException,+SkippableException");
    RuleBasedTransactionAttribute attr = (RuleBasedTransactionAttribute) editor.getValue();
    attr.getRollbackRules().add(new RollbackRuleAttribute(Exception.class));
    assertTrue(attr.rollbackOn(new Exception("")));
    assertFalse(attr.rollbackOn(new RuntimeException("")));
    assertFalse(attr.rollbackOn(new SkippableException("")));
}