Examples of MapAttributes


Examples of org.springframework.metadata.support.MapAttributes

    Method interfaceMethod = ITestBean.class.getMethod("getAge", (Class[]) null);

    TransactionAttribute interfaceAtt = new DefaultTransactionAttribute();
    TransactionAttribute classAtt = new DefaultTransactionAttribute();

    MapAttributes ma = new MapAttributes();
    AttributesTransactionAttributeSource atas = new AttributesTransactionAttributeSource(ma);
    ma.register(interfaceMethod, new Object[]{new Object(), "", interfaceAtt, "er"});
    ma.register(classMethod, new Object[]{new Object(), "", classAtt, "er"});
    // Target class implements ITestBean
    TransactionAttribute actual = atas.getTransactionAttribute(interfaceMethod, TestBean.class);
    assertEquals(classAtt, actual);
  }
View Full Code Here

Examples of org.springframework.metadata.support.MapAttributes

  }

  public void testRollbackRulesAreApplied() throws Exception {
    Method method = TestBean.class.getMethod("getAge", (Class[]) null);

    MapAttributes ma = new MapAttributes();
    TransactionAttribute txAtt = new RuleBasedTransactionAttribute();
    RollbackRuleAttribute rr = new RollbackRuleAttribute("java.lang.Exception");
    RollbackRuleAttribute nrr = new NoRollbackRuleAttribute("ServletException");

    AttributesTransactionAttributeSource atas = new AttributesTransactionAttributeSource(ma);

    ma.register(method, new Object[]{new Object(), "", txAtt, rr, nrr, "er"});
    TransactionAttribute actual = atas.getTransactionAttribute(method, method.getDeclaringClass());
    assertEquals(txAtt, actual);
    assertTrue(txAtt.rollbackOn(new Exception()));
    assertFalse(txAtt.rollbackOn(new ServletException()));
View Full Code Here

Examples of org.springframework.metadata.support.MapAttributes

   */
  public void testDefaultsToClassTransactionAttribute() throws Exception {
    Method method = TestBean.class.getMethod("getAge", (Class[]) null);

    TransactionAttribute txAtt = new DefaultTransactionAttribute();
    MapAttributes ma = new MapAttributes();
    AttributesTransactionAttributeSource atas = new AttributesTransactionAttributeSource(ma);
    ma.register(TestBean.class, new Object[]{new Object(), "", txAtt, "er"});
    TransactionAttribute actual = atas.getTransactionAttribute(method, null);
    assertEquals(txAtt, actual);
  }
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.