Polish AnnotationTransactionAttributeSourceTests
This commit is contained in:
parent
d7f8fa50be
commit
d9f18f7355
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright 2002-2013 the original author or authors.
|
* Copyright 2002-2015 the original author or authors.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
|
@ -18,11 +18,10 @@ package org.springframework.transaction.annotation;
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
import java.lang.annotation.ElementType;
|
|
||||||
import java.lang.annotation.Retention;
|
import java.lang.annotation.Retention;
|
||||||
import java.lang.annotation.RetentionPolicy;
|
import java.lang.annotation.RetentionPolicy;
|
||||||
import java.lang.annotation.Target;
|
|
||||||
import java.lang.reflect.Method;
|
import java.lang.reflect.Method;
|
||||||
|
|
||||||
import javax.ejb.TransactionAttributeType;
|
import javax.ejb.TransactionAttributeType;
|
||||||
|
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
|
@ -48,7 +47,7 @@ import static org.junit.Assert.*;
|
||||||
public class AnnotationTransactionAttributeSourceTests {
|
public class AnnotationTransactionAttributeSourceTests {
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testSerializable() throws Exception {
|
public void serializable() throws Exception {
|
||||||
TestBean1 tb = new TestBean1();
|
TestBean1 tb = new TestBean1();
|
||||||
CallCountingTransactionManager ptm = new CallCountingTransactionManager();
|
CallCountingTransactionManager ptm = new CallCountingTransactionManager();
|
||||||
AnnotationTransactionAttributeSource tas = new AnnotationTransactionAttributeSource();
|
AnnotationTransactionAttributeSource tas = new AnnotationTransactionAttributeSource();
|
||||||
|
@ -72,8 +71,8 @@ public class AnnotationTransactionAttributeSourceTests {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testNullOrEmpty() throws Exception {
|
public void nullOrEmpty() throws Exception {
|
||||||
Method method = Empty.class.getMethod("getAge", (Class[]) null);
|
Method method = Empty.class.getMethod("getAge");
|
||||||
|
|
||||||
AnnotationTransactionAttributeSource atas = new AnnotationTransactionAttributeSource();
|
AnnotationTransactionAttributeSource atas = new AnnotationTransactionAttributeSource();
|
||||||
assertNull(atas.getTransactionAttribute(method, null));
|
assertNull(atas.getTransactionAttribute(method, null));
|
||||||
|
@ -87,8 +86,8 @@ public class AnnotationTransactionAttributeSourceTests {
|
||||||
* but the attribute is defined on the target class.
|
* but the attribute is defined on the target class.
|
||||||
*/
|
*/
|
||||||
@Test
|
@Test
|
||||||
public void testTransactionAttributeDeclaredOnClassMethod() throws Exception {
|
public void transactionAttributeDeclaredOnClassMethod() throws Exception {
|
||||||
Method classMethod = ITestBean.class.getMethod("getAge", (Class[]) null);
|
Method classMethod = ITestBean.class.getMethod("getAge");
|
||||||
|
|
||||||
AnnotationTransactionAttributeSource atas = new AnnotationTransactionAttributeSource();
|
AnnotationTransactionAttributeSource atas = new AnnotationTransactionAttributeSource();
|
||||||
TransactionAttribute actual = atas.getTransactionAttribute(classMethod, TestBean1.class);
|
TransactionAttribute actual = atas.getTransactionAttribute(classMethod, TestBean1.class);
|
||||||
|
@ -103,8 +102,8 @@ public class AnnotationTransactionAttributeSourceTests {
|
||||||
* but the attribute is defined on the target class.
|
* but the attribute is defined on the target class.
|
||||||
*/
|
*/
|
||||||
@Test
|
@Test
|
||||||
public void testTransactionAttributeDeclaredOnCglibClassMethod() throws Exception {
|
public void transactionAttributeDeclaredOnCglibClassMethod() throws Exception {
|
||||||
Method classMethod = ITestBean.class.getMethod("getAge", (Class[]) null);
|
Method classMethod = ITestBean.class.getMethod("getAge");
|
||||||
TestBean1 tb = new TestBean1();
|
TestBean1 tb = new TestBean1();
|
||||||
ProxyFactory pf = new ProxyFactory(tb);
|
ProxyFactory pf = new ProxyFactory(tb);
|
||||||
pf.setProxyTargetClass(true);
|
pf.setProxyTargetClass(true);
|
||||||
|
@ -122,8 +121,8 @@ public class AnnotationTransactionAttributeSourceTests {
|
||||||
* Test case where attribute is on the interface method.
|
* Test case where attribute is on the interface method.
|
||||||
*/
|
*/
|
||||||
@Test
|
@Test
|
||||||
public void testTransactionAttributeDeclaredOnInterfaceMethodOnly() throws Exception {
|
public void transactionAttributeDeclaredOnInterfaceMethodOnly() throws Exception {
|
||||||
Method interfaceMethod = ITestBean2.class.getMethod("getAge", (Class[]) null);
|
Method interfaceMethod = ITestBean2.class.getMethod("getAge");
|
||||||
|
|
||||||
AnnotationTransactionAttributeSource atas = new AnnotationTransactionAttributeSource();
|
AnnotationTransactionAttributeSource atas = new AnnotationTransactionAttributeSource();
|
||||||
TransactionAttribute actual = atas.getTransactionAttribute(interfaceMethod, TestBean2.class);
|
TransactionAttribute actual = atas.getTransactionAttribute(interfaceMethod, TestBean2.class);
|
||||||
|
@ -136,9 +135,9 @@ public class AnnotationTransactionAttributeSourceTests {
|
||||||
* Test that when an attribute exists on both class and interface, class takes precedence.
|
* Test that when an attribute exists on both class and interface, class takes precedence.
|
||||||
*/
|
*/
|
||||||
@Test
|
@Test
|
||||||
public void testTransactionAttributeOnTargetClassMethodOverridesAttributeOnInterfaceMethod() throws Exception {
|
public void transactionAttributeOnTargetClassMethodOverridesAttributeOnInterfaceMethod() throws Exception {
|
||||||
Method interfaceMethod = ITestBean3.class.getMethod("getAge", (Class[]) null);
|
Method interfaceMethod = ITestBean3.class.getMethod("getAge");
|
||||||
Method interfaceMethod2 = ITestBean3.class.getMethod("getName", (Class[]) null);
|
Method interfaceMethod2 = ITestBean3.class.getMethod("getName");
|
||||||
|
|
||||||
AnnotationTransactionAttributeSource atas = new AnnotationTransactionAttributeSource();
|
AnnotationTransactionAttributeSource atas = new AnnotationTransactionAttributeSource();
|
||||||
TransactionAttribute actual = atas.getTransactionAttribute(interfaceMethod, TestBean3.class);
|
TransactionAttribute actual = atas.getTransactionAttribute(interfaceMethod, TestBean3.class);
|
||||||
|
@ -157,8 +156,8 @@ public class AnnotationTransactionAttributeSourceTests {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testRollbackRulesAreApplied() throws Exception {
|
public void rollbackRulesAreApplied() throws Exception {
|
||||||
Method method = TestBean3.class.getMethod("getAge", (Class[]) null);
|
Method method = TestBean3.class.getMethod("getAge");
|
||||||
|
|
||||||
AnnotationTransactionAttributeSource atas = new AnnotationTransactionAttributeSource();
|
AnnotationTransactionAttributeSource atas = new AnnotationTransactionAttributeSource();
|
||||||
TransactionAttribute actual = atas.getTransactionAttribute(method, TestBean3.class);
|
TransactionAttribute actual = atas.getTransactionAttribute(method, TestBean3.class);
|
||||||
|
@ -187,8 +186,8 @@ public class AnnotationTransactionAttributeSourceTests {
|
||||||
* if not specified on method.
|
* if not specified on method.
|
||||||
*/
|
*/
|
||||||
@Test
|
@Test
|
||||||
public void testDefaultsToClassTransactionAttribute() throws Exception {
|
public void defaultsToClassTransactionAttribute() throws Exception {
|
||||||
Method method = TestBean4.class.getMethod("getAge", (Class[]) null);
|
Method method = TestBean4.class.getMethod("getAge");
|
||||||
|
|
||||||
AnnotationTransactionAttributeSource atas = new AnnotationTransactionAttributeSource();
|
AnnotationTransactionAttributeSource atas = new AnnotationTransactionAttributeSource();
|
||||||
TransactionAttribute actual = atas.getTransactionAttribute(method, TestBean4.class);
|
TransactionAttribute actual = atas.getTransactionAttribute(method, TestBean4.class);
|
||||||
|
@ -200,8 +199,8 @@ public class AnnotationTransactionAttributeSourceTests {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testCustomClassAttributeDetected() throws Exception {
|
public void customClassAttributeDetected() throws Exception {
|
||||||
Method method = TestBean5.class.getMethod("getAge", (Class[]) null);
|
Method method = TestBean5.class.getMethod("getAge");
|
||||||
|
|
||||||
AnnotationTransactionAttributeSource atas = new AnnotationTransactionAttributeSource();
|
AnnotationTransactionAttributeSource atas = new AnnotationTransactionAttributeSource();
|
||||||
TransactionAttribute actual = atas.getTransactionAttribute(method, TestBean5.class);
|
TransactionAttribute actual = atas.getTransactionAttribute(method, TestBean5.class);
|
||||||
|
@ -213,8 +212,8 @@ public class AnnotationTransactionAttributeSourceTests {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testCustomMethodAttributeDetected() throws Exception {
|
public void customMethodAttributeDetected() throws Exception {
|
||||||
Method method = TestBean6.class.getMethod("getAge", (Class[]) null);
|
Method method = TestBean6.class.getMethod("getAge");
|
||||||
|
|
||||||
AnnotationTransactionAttributeSource atas = new AnnotationTransactionAttributeSource();
|
AnnotationTransactionAttributeSource atas = new AnnotationTransactionAttributeSource();
|
||||||
TransactionAttribute actual = atas.getTransactionAttribute(method, TestBean6.class);
|
TransactionAttribute actual = atas.getTransactionAttribute(method, TestBean6.class);
|
||||||
|
@ -226,8 +225,8 @@ public class AnnotationTransactionAttributeSourceTests {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testCustomClassAttributeWithReadOnlyOverrideDetected() throws Exception {
|
public void customClassAttributeWithReadOnlyOverrideDetected() throws Exception {
|
||||||
Method method = TestBean7.class.getMethod("getAge", (Class[]) null);
|
Method method = TestBean7.class.getMethod("getAge");
|
||||||
|
|
||||||
AnnotationTransactionAttributeSource atas = new AnnotationTransactionAttributeSource();
|
AnnotationTransactionAttributeSource atas = new AnnotationTransactionAttributeSource();
|
||||||
TransactionAttribute actual = atas.getTransactionAttribute(method, TestBean7.class);
|
TransactionAttribute actual = atas.getTransactionAttribute(method, TestBean7.class);
|
||||||
|
@ -241,8 +240,8 @@ public class AnnotationTransactionAttributeSourceTests {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testCustomMethodAttributeWithReadOnlyOverrideDetected() throws Exception {
|
public void customMethodAttributeWithReadOnlyOverrideDetected() throws Exception {
|
||||||
Method method = TestBean8.class.getMethod("getAge", (Class[]) null);
|
Method method = TestBean8.class.getMethod("getAge");
|
||||||
|
|
||||||
AnnotationTransactionAttributeSource atas = new AnnotationTransactionAttributeSource();
|
AnnotationTransactionAttributeSource atas = new AnnotationTransactionAttributeSource();
|
||||||
TransactionAttribute actual = atas.getTransactionAttribute(method, TestBean8.class);
|
TransactionAttribute actual = atas.getTransactionAttribute(method, TestBean8.class);
|
||||||
|
@ -257,7 +256,7 @@ public class AnnotationTransactionAttributeSourceTests {
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void customClassAttributeWithReadOnlyOverrideOnInterface() throws Exception {
|
public void customClassAttributeWithReadOnlyOverrideOnInterface() throws Exception {
|
||||||
Method method = TestInterface9.class.getMethod("getAge", (Class[]) null);
|
Method method = TestInterface9.class.getMethod("getAge");
|
||||||
|
|
||||||
Transactional annotation = AnnotationUtils.findAnnotation(method, Transactional.class);
|
Transactional annotation = AnnotationUtils.findAnnotation(method, Transactional.class);
|
||||||
assertNull("AnnotationUtils.findAnnotation should not find @Transactional for TestBean9.getAge()", annotation);
|
assertNull("AnnotationUtils.findAnnotation should not find @Transactional for TestBean9.getAge()", annotation);
|
||||||
|
@ -266,7 +265,7 @@ public class AnnotationTransactionAttributeSourceTests {
|
||||||
|
|
||||||
AnnotationTransactionAttributeSource atas = new AnnotationTransactionAttributeSource();
|
AnnotationTransactionAttributeSource atas = new AnnotationTransactionAttributeSource();
|
||||||
TransactionAttribute actual = atas.getTransactionAttribute(method, TestBean9.class);
|
TransactionAttribute actual = atas.getTransactionAttribute(method, TestBean9.class);
|
||||||
assertNotNull("Retrieved TransactionAttribute for TestBean9", actual);
|
assertNotNull("Failed to retrieve TransactionAttribute for TestBean9.getAge()", actual);
|
||||||
|
|
||||||
RuleBasedTransactionAttribute rbta = new RuleBasedTransactionAttribute();
|
RuleBasedTransactionAttribute rbta = new RuleBasedTransactionAttribute();
|
||||||
rbta.getRollbackRules().add(new RollbackRuleAttribute(Exception.class));
|
rbta.getRollbackRules().add(new RollbackRuleAttribute(Exception.class));
|
||||||
|
@ -278,7 +277,7 @@ public class AnnotationTransactionAttributeSourceTests {
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void customMethodAttributeWithReadOnlyOverrideOnInterface() throws Exception {
|
public void customMethodAttributeWithReadOnlyOverrideOnInterface() throws Exception {
|
||||||
Method method = TestInterface10.class.getMethod("getAge", (Class[]) null);
|
Method method = TestInterface10.class.getMethod("getAge");
|
||||||
|
|
||||||
Transactional annotation = AnnotationUtils.findAnnotation(method, Transactional.class);
|
Transactional annotation = AnnotationUtils.findAnnotation(method, Transactional.class);
|
||||||
assertNotNull("AnnotationUtils.findAnnotation failed to find @Transactional for TestBean10.getAge()",
|
assertNotNull("AnnotationUtils.findAnnotation failed to find @Transactional for TestBean10.getAge()",
|
||||||
|
@ -288,7 +287,7 @@ public class AnnotationTransactionAttributeSourceTests {
|
||||||
|
|
||||||
AnnotationTransactionAttributeSource atas = new AnnotationTransactionAttributeSource();
|
AnnotationTransactionAttributeSource atas = new AnnotationTransactionAttributeSource();
|
||||||
TransactionAttribute actual = atas.getTransactionAttribute(method, TestBean10.class);
|
TransactionAttribute actual = atas.getTransactionAttribute(method, TestBean10.class);
|
||||||
assertNotNull("Retrieved TransactionAttribute for TestBean10", actual);
|
assertNotNull("Failed to retrieve TransactionAttribute for TestBean10.getAge()", actual);
|
||||||
|
|
||||||
RuleBasedTransactionAttribute rbta = new RuleBasedTransactionAttribute();
|
RuleBasedTransactionAttribute rbta = new RuleBasedTransactionAttribute();
|
||||||
rbta.getRollbackRules().add(new RollbackRuleAttribute(Exception.class));
|
rbta.getRollbackRules().add(new RollbackRuleAttribute(Exception.class));
|
||||||
|
@ -299,9 +298,9 @@ public class AnnotationTransactionAttributeSourceTests {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testTransactionAttributeDeclaredOnClassMethodWithEjb3() throws Exception {
|
public void transactionAttributeDeclaredOnClassMethodWithEjb3() throws Exception {
|
||||||
Method getAgeMethod = ITestBean.class.getMethod("getAge", (Class[]) null);
|
Method getAgeMethod = ITestBean.class.getMethod("getAge");
|
||||||
Method getNameMethod = ITestBean.class.getMethod("getName", (Class[]) null);
|
Method getNameMethod = ITestBean.class.getMethod("getName");
|
||||||
|
|
||||||
AnnotationTransactionAttributeSource atas = new AnnotationTransactionAttributeSource();
|
AnnotationTransactionAttributeSource atas = new AnnotationTransactionAttributeSource();
|
||||||
TransactionAttribute getAgeAttr = atas.getTransactionAttribute(getAgeMethod, Ejb3AnnotatedBean1.class);
|
TransactionAttribute getAgeAttr = atas.getTransactionAttribute(getAgeMethod, Ejb3AnnotatedBean1.class);
|
||||||
|
@ -311,9 +310,9 @@ public class AnnotationTransactionAttributeSourceTests {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testTransactionAttributeDeclaredOnClassWithEjb3() throws Exception {
|
public void transactionAttributeDeclaredOnClassWithEjb3() throws Exception {
|
||||||
Method getAgeMethod = ITestBean.class.getMethod("getAge", (Class[]) null);
|
Method getAgeMethod = ITestBean.class.getMethod("getAge");
|
||||||
Method getNameMethod = ITestBean.class.getMethod("getName", (Class[]) null);
|
Method getNameMethod = ITestBean.class.getMethod("getName");
|
||||||
|
|
||||||
AnnotationTransactionAttributeSource atas = new AnnotationTransactionAttributeSource();
|
AnnotationTransactionAttributeSource atas = new AnnotationTransactionAttributeSource();
|
||||||
TransactionAttribute getAgeAttr = atas.getTransactionAttribute(getAgeMethod, Ejb3AnnotatedBean2.class);
|
TransactionAttribute getAgeAttr = atas.getTransactionAttribute(getAgeMethod, Ejb3AnnotatedBean2.class);
|
||||||
|
@ -323,9 +322,9 @@ public class AnnotationTransactionAttributeSourceTests {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testTransactionAttributeDeclaredOnInterfaceWithEjb3() throws Exception {
|
public void transactionAttributeDeclaredOnInterfaceWithEjb3() throws Exception {
|
||||||
Method getAgeMethod = ITestEjb.class.getMethod("getAge", (Class[]) null);
|
Method getAgeMethod = ITestEjb.class.getMethod("getAge");
|
||||||
Method getNameMethod = ITestEjb.class.getMethod("getName", (Class[]) null);
|
Method getNameMethod = ITestEjb.class.getMethod("getName");
|
||||||
|
|
||||||
AnnotationTransactionAttributeSource atas = new AnnotationTransactionAttributeSource();
|
AnnotationTransactionAttributeSource atas = new AnnotationTransactionAttributeSource();
|
||||||
TransactionAttribute getAgeAttr = atas.getTransactionAttribute(getAgeMethod, Ejb3AnnotatedBean3.class);
|
TransactionAttribute getAgeAttr = atas.getTransactionAttribute(getAgeMethod, Ejb3AnnotatedBean3.class);
|
||||||
|
@ -335,9 +334,9 @@ public class AnnotationTransactionAttributeSourceTests {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testTransactionAttributeDeclaredOnClassMethodWithJta() throws Exception {
|
public void transactionAttributeDeclaredOnClassMethodWithJta() throws Exception {
|
||||||
Method getAgeMethod = ITestBean.class.getMethod("getAge", (Class[]) null);
|
Method getAgeMethod = ITestBean.class.getMethod("getAge");
|
||||||
Method getNameMethod = ITestBean.class.getMethod("getName", (Class[]) null);
|
Method getNameMethod = ITestBean.class.getMethod("getName");
|
||||||
|
|
||||||
AnnotationTransactionAttributeSource atas = new AnnotationTransactionAttributeSource();
|
AnnotationTransactionAttributeSource atas = new AnnotationTransactionAttributeSource();
|
||||||
TransactionAttribute getAgeAttr = atas.getTransactionAttribute(getAgeMethod, JtaAnnotatedBean1.class);
|
TransactionAttribute getAgeAttr = atas.getTransactionAttribute(getAgeMethod, JtaAnnotatedBean1.class);
|
||||||
|
@ -347,9 +346,9 @@ public class AnnotationTransactionAttributeSourceTests {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testTransactionAttributeDeclaredOnClassWithJta() throws Exception {
|
public void transactionAttributeDeclaredOnClassWithJta() throws Exception {
|
||||||
Method getAgeMethod = ITestBean.class.getMethod("getAge", (Class[]) null);
|
Method getAgeMethod = ITestBean.class.getMethod("getAge");
|
||||||
Method getNameMethod = ITestBean.class.getMethod("getName", (Class[]) null);
|
Method getNameMethod = ITestBean.class.getMethod("getName");
|
||||||
|
|
||||||
AnnotationTransactionAttributeSource atas = new AnnotationTransactionAttributeSource();
|
AnnotationTransactionAttributeSource atas = new AnnotationTransactionAttributeSource();
|
||||||
TransactionAttribute getAgeAttr = atas.getTransactionAttribute(getAgeMethod, JtaAnnotatedBean2.class);
|
TransactionAttribute getAgeAttr = atas.getTransactionAttribute(getAgeMethod, JtaAnnotatedBean2.class);
|
||||||
|
@ -359,9 +358,9 @@ public class AnnotationTransactionAttributeSourceTests {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testTransactionAttributeDeclaredOnInterfaceWithJta() throws Exception {
|
public void transactionAttributeDeclaredOnInterfaceWithJta() throws Exception {
|
||||||
Method getAgeMethod = ITestEjb.class.getMethod("getAge", (Class[]) null);
|
Method getAgeMethod = ITestEjb.class.getMethod("getAge");
|
||||||
Method getNameMethod = ITestEjb.class.getMethod("getName", (Class[]) null);
|
Method getNameMethod = ITestEjb.class.getMethod("getName");
|
||||||
|
|
||||||
AnnotationTransactionAttributeSource atas = new AnnotationTransactionAttributeSource();
|
AnnotationTransactionAttributeSource atas = new AnnotationTransactionAttributeSource();
|
||||||
TransactionAttribute getAgeAttr = atas.getTransactionAttribute(getAgeMethod, JtaAnnotatedBean3.class);
|
TransactionAttribute getAgeAttr = atas.getTransactionAttribute(getAgeMethod, JtaAnnotatedBean3.class);
|
||||||
|
@ -371,7 +370,7 @@ public class AnnotationTransactionAttributeSourceTests {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public interface ITestBean {
|
interface ITestBean {
|
||||||
|
|
||||||
int getAge();
|
int getAge();
|
||||||
|
|
||||||
|
@ -383,7 +382,7 @@ public class AnnotationTransactionAttributeSourceTests {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public interface ITestBean2 {
|
interface ITestBean2 {
|
||||||
|
|
||||||
@Transactional
|
@Transactional
|
||||||
int getAge();
|
int getAge();
|
||||||
|
@ -397,7 +396,7 @@ public class AnnotationTransactionAttributeSourceTests {
|
||||||
|
|
||||||
|
|
||||||
@Transactional
|
@Transactional
|
||||||
public interface ITestBean3 {
|
interface ITestBean3 {
|
||||||
|
|
||||||
int getAge();
|
int getAge();
|
||||||
|
|
||||||
|
@ -409,7 +408,7 @@ public class AnnotationTransactionAttributeSourceTests {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public static class Empty implements ITestBean {
|
static class Empty implements ITestBean {
|
||||||
|
|
||||||
private String name;
|
private String name;
|
||||||
|
|
||||||
|
@ -446,7 +445,7 @@ public class AnnotationTransactionAttributeSourceTests {
|
||||||
|
|
||||||
|
|
||||||
@SuppressWarnings("serial")
|
@SuppressWarnings("serial")
|
||||||
public static class TestBean1 implements ITestBean, Serializable {
|
static class TestBean1 implements ITestBean, Serializable {
|
||||||
|
|
||||||
private String name;
|
private String name;
|
||||||
|
|
||||||
|
@ -483,7 +482,7 @@ public class AnnotationTransactionAttributeSourceTests {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public static class TestBean2 implements ITestBean2 {
|
static class TestBean2 implements ITestBean2 {
|
||||||
|
|
||||||
private String name;
|
private String name;
|
||||||
|
|
||||||
|
@ -519,7 +518,7 @@ public class AnnotationTransactionAttributeSourceTests {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public static class TestBean3 implements ITestBean3 {
|
static class TestBean3 implements ITestBean3 {
|
||||||
|
|
||||||
private String name;
|
private String name;
|
||||||
|
|
||||||
|
@ -558,7 +557,7 @@ public class AnnotationTransactionAttributeSourceTests {
|
||||||
|
|
||||||
|
|
||||||
@Transactional(rollbackFor=Exception.class, noRollbackFor={IOException.class})
|
@Transactional(rollbackFor=Exception.class, noRollbackFor={IOException.class})
|
||||||
public static class TestBean4 implements ITestBean3 {
|
static class TestBean4 implements ITestBean3 {
|
||||||
|
|
||||||
private String name;
|
private String name;
|
||||||
|
|
||||||
|
@ -594,15 +593,14 @@ public class AnnotationTransactionAttributeSourceTests {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@Target({ElementType.TYPE, ElementType.METHOD})
|
|
||||||
@Retention(RetentionPolicy.RUNTIME)
|
@Retention(RetentionPolicy.RUNTIME)
|
||||||
@Transactional(rollbackFor=Exception.class, noRollbackFor={IOException.class})
|
@Transactional(rollbackFor=Exception.class, noRollbackFor={IOException.class})
|
||||||
public @interface Tx {
|
@interface Tx {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@Tx
|
@Tx
|
||||||
public static class TestBean5 {
|
static class TestBean5 {
|
||||||
|
|
||||||
public int getAge() {
|
public int getAge() {
|
||||||
return 10;
|
return 10;
|
||||||
|
@ -610,7 +608,7 @@ public class AnnotationTransactionAttributeSourceTests {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public static class TestBean6 {
|
static class TestBean6 {
|
||||||
|
|
||||||
@Tx
|
@Tx
|
||||||
public int getAge() {
|
public int getAge() {
|
||||||
|
@ -619,17 +617,15 @@ public class AnnotationTransactionAttributeSourceTests {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@Target({ElementType.TYPE, ElementType.METHOD})
|
|
||||||
@Retention(RetentionPolicy.RUNTIME)
|
@Retention(RetentionPolicy.RUNTIME)
|
||||||
@Transactional(rollbackFor=Exception.class, noRollbackFor={IOException.class})
|
@Transactional(rollbackFor=Exception.class, noRollbackFor={IOException.class})
|
||||||
public @interface TxWithAttribute {
|
@interface TxWithAttribute {
|
||||||
|
|
||||||
boolean readOnly();
|
boolean readOnly();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@TxWithAttribute(readOnly=true)
|
@TxWithAttribute(readOnly=true)
|
||||||
public static class TestBean7 {
|
static class TestBean7 {
|
||||||
|
|
||||||
public int getAge() {
|
public int getAge() {
|
||||||
return 10;
|
return 10;
|
||||||
|
@ -637,7 +633,7 @@ public class AnnotationTransactionAttributeSourceTests {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public static class TestBean8 {
|
static class TestBean8 {
|
||||||
|
|
||||||
@TxWithAttribute(readOnly = true)
|
@TxWithAttribute(readOnly = true)
|
||||||
public int getAge() {
|
public int getAge() {
|
||||||
|
@ -646,12 +642,11 @@ public class AnnotationTransactionAttributeSourceTests {
|
||||||
}
|
}
|
||||||
|
|
||||||
@TxWithAttribute(readOnly = true)
|
@TxWithAttribute(readOnly = true)
|
||||||
public static interface TestInterface9 {
|
interface TestInterface9 {
|
||||||
|
int getAge();
|
||||||
public int getAge();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static class TestBean9 implements TestInterface9 {
|
static class TestBean9 implements TestInterface9 {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getAge() {
|
public int getAge() {
|
||||||
|
@ -659,13 +654,13 @@ public class AnnotationTransactionAttributeSourceTests {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static interface TestInterface10 {
|
interface TestInterface10 {
|
||||||
|
|
||||||
@TxWithAttribute(readOnly=true)
|
@TxWithAttribute(readOnly=true)
|
||||||
public int getAge();
|
int getAge();
|
||||||
}
|
}
|
||||||
|
|
||||||
public static class TestBean10 implements TestInterface10 {
|
static class TestBean10 implements TestInterface10 {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getAge() {
|
public int getAge() {
|
||||||
|
@ -674,13 +669,13 @@ public class AnnotationTransactionAttributeSourceTests {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public static interface Foo<T> {
|
interface Foo<T> {
|
||||||
|
|
||||||
void doSomething(T theArgument);
|
void doSomething(T theArgument);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public static class MyFoo implements Foo<String> {
|
static class MyFoo implements Foo<String> {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@Transactional
|
@Transactional
|
||||||
|
@ -690,7 +685,7 @@ public class AnnotationTransactionAttributeSourceTests {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public static class Ejb3AnnotatedBean1 implements ITestBean {
|
static class Ejb3AnnotatedBean1 implements ITestBean {
|
||||||
|
|
||||||
private String name;
|
private String name;
|
||||||
|
|
||||||
|
@ -721,7 +716,7 @@ public class AnnotationTransactionAttributeSourceTests {
|
||||||
|
|
||||||
|
|
||||||
@javax.ejb.TransactionAttribute(TransactionAttributeType.SUPPORTS)
|
@javax.ejb.TransactionAttribute(TransactionAttributeType.SUPPORTS)
|
||||||
public static class Ejb3AnnotatedBean2 implements ITestBean {
|
static class Ejb3AnnotatedBean2 implements ITestBean {
|
||||||
|
|
||||||
private String name;
|
private String name;
|
||||||
|
|
||||||
|
@ -751,7 +746,7 @@ public class AnnotationTransactionAttributeSourceTests {
|
||||||
|
|
||||||
|
|
||||||
@javax.ejb.TransactionAttribute(TransactionAttributeType.SUPPORTS)
|
@javax.ejb.TransactionAttribute(TransactionAttributeType.SUPPORTS)
|
||||||
public interface ITestEjb {
|
interface ITestEjb {
|
||||||
|
|
||||||
@javax.ejb.TransactionAttribute
|
@javax.ejb.TransactionAttribute
|
||||||
int getAge();
|
int getAge();
|
||||||
|
@ -764,7 +759,7 @@ public class AnnotationTransactionAttributeSourceTests {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public static class Ejb3AnnotatedBean3 implements ITestEjb {
|
static class Ejb3AnnotatedBean3 implements ITestEjb {
|
||||||
|
|
||||||
private String name;
|
private String name;
|
||||||
|
|
||||||
|
@ -792,7 +787,7 @@ public class AnnotationTransactionAttributeSourceTests {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public static class JtaAnnotatedBean1 implements ITestBean {
|
static class JtaAnnotatedBean1 implements ITestBean {
|
||||||
|
|
||||||
private String name;
|
private String name;
|
||||||
|
|
||||||
|
@ -823,7 +818,7 @@ public class AnnotationTransactionAttributeSourceTests {
|
||||||
|
|
||||||
|
|
||||||
@javax.transaction.Transactional(javax.transaction.Transactional.TxType.SUPPORTS)
|
@javax.transaction.Transactional(javax.transaction.Transactional.TxType.SUPPORTS)
|
||||||
public static class JtaAnnotatedBean2 implements ITestBean {
|
static class JtaAnnotatedBean2 implements ITestBean {
|
||||||
|
|
||||||
private String name;
|
private String name;
|
||||||
|
|
||||||
|
@ -853,7 +848,7 @@ public class AnnotationTransactionAttributeSourceTests {
|
||||||
|
|
||||||
|
|
||||||
@javax.transaction.Transactional(javax.transaction.Transactional.TxType.SUPPORTS)
|
@javax.transaction.Transactional(javax.transaction.Transactional.TxType.SUPPORTS)
|
||||||
public interface ITestJta {
|
interface ITestJta {
|
||||||
|
|
||||||
@javax.transaction.Transactional
|
@javax.transaction.Transactional
|
||||||
int getAge();
|
int getAge();
|
||||||
|
@ -866,7 +861,7 @@ public class AnnotationTransactionAttributeSourceTests {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public static class JtaAnnotatedBean3 implements ITestEjb {
|
static class JtaAnnotatedBean3 implements ITestEjb {
|
||||||
|
|
||||||
private String name;
|
private String name;
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue