Package org.springframework.transaction.interceptor

Examples of org.springframework.transaction.interceptor.TransactionAttributeEditor


    assertThat(e.getCause(), instanceOf(IllegalArgumentException.class));
  }

  @Test
  public void testOverrideWithoutChangingRollbackRules() throws Exception {
    TransactionAttributeEditor editor = new TransactionAttributeEditor();
    editor.setAsText("-RuntimeException");
    TransactionAttribute attr = (TransactionAttribute) editor.getValue();
    assertTrue(attr.rollbackOn(new RuntimeException("")));
    assertFalse(attr.rollbackOn(new Exception("")));
  }
View Full Code Here


    assertFalse(attr.rollbackOn(new Exception("")));
  }

  @Test
  public void testChangeRollbackRules() throws Exception {
    TransactionAttributeEditor editor = new TransactionAttributeEditor();
    editor.setAsText("+RuntimeException");
    TransactionAttribute attr = (TransactionAttribute) editor.getValue();
    assertFalse(attr.rollbackOn(new RuntimeException("")));
    assertFalse(attr.rollbackOn(new Exception("")));
  }
View Full Code Here

    assertFalse(attr.rollbackOn(new Exception("")));
  }

  @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("")));
  }
View Full Code Here

TOP

Related Classes of org.springframework.transaction.interceptor.TransactionAttributeEditor

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.