Examples of rollbackOn()


Examples of org.springframework.transaction.interceptor.TransactionAttribute.rollbackOn()

    RuleBasedTransactionAttribute rbta = new RuleBasedTransactionAttribute();
    rbta.getRollbackRules().add(new RollbackRuleAttribute("java.lang.Exception"));
    rbta.getRollbackRules().add(new NoRollbackRuleAttribute(IOException.class));

    assertEquals(rbta.getRollbackRules(), ((RuleBasedTransactionAttribute) actual).getRollbackRules());
    assertTrue(actual.rollbackOn(new Exception()));
    assertFalse(actual.rollbackOn(new IOException()));

    actual = atas.getTransactionAttribute(method, method.getDeclaringClass());

    rbta = new RuleBasedTransactionAttribute();
View Full Code Here

Examples of org.springframework.transaction.interceptor.TransactionAttribute.rollbackOn()

    rbta.getRollbackRules().add(new RollbackRuleAttribute("java.lang.Exception"));
    rbta.getRollbackRules().add(new NoRollbackRuleAttribute(IOException.class));

    assertEquals(rbta.getRollbackRules(), ((RuleBasedTransactionAttribute) actual).getRollbackRules());
    assertTrue(actual.rollbackOn(new Exception()));
    assertFalse(actual.rollbackOn(new IOException()));

    actual = atas.getTransactionAttribute(method, method.getDeclaringClass());

    rbta = new RuleBasedTransactionAttribute();
    rbta.getRollbackRules().add(new RollbackRuleAttribute("java.lang.Exception"));
View Full Code Here

Examples of org.springframework.transaction.interceptor.TransactionAttribute.rollbackOn()

    rbta = new RuleBasedTransactionAttribute();
    rbta.getRollbackRules().add(new RollbackRuleAttribute("java.lang.Exception"));
    rbta.getRollbackRules().add(new NoRollbackRuleAttribute(IOException.class));

    assertEquals(rbta.getRollbackRules(), ((RuleBasedTransactionAttribute) actual).getRollbackRules());
    assertTrue(actual.rollbackOn(new Exception()));
    assertFalse(actual.rollbackOn(new IOException()));
  }

  /**
   * Test that transaction attribute is inherited from class
View Full Code Here

Examples of org.springframework.transaction.interceptor.TransactionAttribute.rollbackOn()

    rbta.getRollbackRules().add(new RollbackRuleAttribute("java.lang.Exception"));
    rbta.getRollbackRules().add(new NoRollbackRuleAttribute(IOException.class));

    assertEquals(rbta.getRollbackRules(), ((RuleBasedTransactionAttribute) actual).getRollbackRules());
    assertTrue(actual.rollbackOn(new Exception()));
    assertFalse(actual.rollbackOn(new IOException()));
  }

  /**
   * Test that transaction attribute is inherited from class
   * if not specified on method.
View Full Code Here

Examples of org.springframework.transaction.interceptor.TransactionAttribute.rollbackOn()

  public void testRollbackRules() {
    TransactionInterceptor txInterceptor = (TransactionInterceptor) context.getBean("txRollbackAdvice");
    TransactionAttributeSource txAttrSource = txInterceptor.getTransactionAttributeSource();
    TransactionAttribute txAttr = txAttrSource.getTransactionAttribute(getAgeMethod,ITestBean.class);
    assertTrue("should be configured to rollback on Exception",txAttr.rollbackOn(new Exception()));

    txAttr = txAttrSource.getTransactionAttribute(setAgeMethod, ITestBean.class);
    assertFalse("should not rollback on RuntimeException",txAttr.rollbackOn(new RuntimeException()));
  }
View Full Code Here

Examples of org.springframework.transaction.interceptor.TransactionAttribute.rollbackOn()

    TransactionAttributeSource txAttrSource = txInterceptor.getTransactionAttributeSource();
    TransactionAttribute txAttr = txAttrSource.getTransactionAttribute(getAgeMethod,ITestBean.class);
    assertTrue("should be configured to rollback on Exception",txAttr.rollbackOn(new Exception()));

    txAttr = txAttrSource.getTransactionAttribute(setAgeMethod, ITestBean.class);
    assertFalse("should not rollback on RuntimeException",txAttr.rollbackOn(new RuntimeException()));
  }

  private ITestBean getTestBean() {
    return (ITestBean)context.getBean("testBean");
  }
View Full Code Here

Examples of org.springframework.transaction.interceptor.TransactionAttribute.rollbackOn()

  @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("")));
  }

  @Test
  public void testChangeRollbackRules() throws Exception {
View Full Code Here

Examples of org.springframework.transaction.interceptor.TransactionAttribute.rollbackOn()

  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("")));
  }

  @Test
  public void testChangeRollbackRules() throws Exception {
    TransactionAttributeEditor editor = new TransactionAttributeEditor();
View Full Code Here

Examples of org.springframework.transaction.interceptor.TransactionAttribute.rollbackOn()

  @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("")));
  }

  @Test
  public void testNonDefaultRollbackRules() throws Exception {
View Full Code Here

Examples of org.springframework.transaction.interceptor.TransactionAttribute.rollbackOn()

  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("")));
  }

  @Test
  public void testNonDefaultRollbackRules() throws Exception {
    TransactionAttributeEditor editor = new TransactionAttributeEditor();
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.