1
1
/*
2
- * Copyright 2002-2016 the original author or authors.
2
+ * Copyright 2002-2017 the original author or authors.
3
3
*
4
4
* Licensed under the Apache License, Version 2.0 (the "License");
5
5
* you may not use this file except in compliance with the License.
@@ -55,14 +55,14 @@ public void serializable() throws Exception {
55
55
TransactionInterceptor ti = new TransactionInterceptor (ptm , tas );
56
56
57
57
ProxyFactory proxyFactory = new ProxyFactory ();
58
- proxyFactory .setInterfaces (ITestBean .class );
58
+ proxyFactory .setInterfaces (ITestBean1 .class );
59
59
proxyFactory .addAdvice (ti );
60
60
proxyFactory .setTarget (tb );
61
- ITestBean proxy = (ITestBean ) proxyFactory .getProxy ();
61
+ ITestBean1 proxy = (ITestBean1 ) proxyFactory .getProxy ();
62
62
proxy .getAge ();
63
63
assertEquals (1 , ptm .commits );
64
64
65
- ITestBean serializedProxy = (ITestBean ) SerializationTestUtils .serializeAndDeserialize (proxy );
65
+ ITestBean1 serializedProxy = (ITestBean1 ) SerializationTestUtils .serializeAndDeserialize (proxy );
66
66
serializedProxy .getAge ();
67
67
Advised advised = (Advised ) serializedProxy ;
68
68
TransactionInterceptor serializedTi = (TransactionInterceptor ) advised .getAdvisors ()[0 ].getAdvice ();
@@ -88,7 +88,7 @@ public void nullOrEmpty() throws Exception {
88
88
*/
89
89
@ Test
90
90
public void transactionAttributeDeclaredOnClassMethod () throws Exception {
91
- Method classMethod = ITestBean .class .getMethod ("getAge" );
91
+ Method classMethod = ITestBean1 .class .getMethod ("getAge" );
92
92
93
93
AnnotationTransactionAttributeSource atas = new AnnotationTransactionAttributeSource ();
94
94
TransactionAttribute actual = atas .getTransactionAttribute (classMethod , TestBean1 .class );
@@ -104,7 +104,7 @@ public void transactionAttributeDeclaredOnClassMethod() throws Exception {
104
104
*/
105
105
@ Test
106
106
public void transactionAttributeDeclaredOnCglibClassMethod () throws Exception {
107
- Method classMethod = ITestBean .class .getMethod ("getAge" );
107
+ Method classMethod = ITestBean1 .class .getMethod ("getAge" );
108
108
TestBean1 tb = new TestBean1 ();
109
109
ProxyFactory pf = new ProxyFactory (tb );
110
110
pf .setProxyTargetClass (true );
@@ -129,7 +129,7 @@ public void transactionAttributeDeclaredOnInterfaceMethodOnly() throws Exception
129
129
TransactionAttribute actual = atas .getTransactionAttribute (interfaceMethod , TestBean2 .class );
130
130
131
131
RuleBasedTransactionAttribute rbta = new RuleBasedTransactionAttribute ();
132
- assertEquals (rbta .getRollbackRules (), ((RuleBasedTransactionAttribute ) actual ).getRollbackRules ());
132
+ assertEquals (rbta .getRollbackRules (), ((RuleBasedTransactionAttribute ) actual ).getRollbackRules ());
133
133
}
134
134
135
135
/**
@@ -300,8 +300,8 @@ public void customMethodAttributeWithReadOnlyOverrideOnInterface() throws Except
300
300
301
301
@ Test
302
302
public void transactionAttributeDeclaredOnClassMethodWithEjb3 () throws Exception {
303
- Method getAgeMethod = ITestBean .class .getMethod ("getAge" );
304
- Method getNameMethod = ITestBean .class .getMethod ("getName" );
303
+ Method getAgeMethod = ITestBean1 .class .getMethod ("getAge" );
304
+ Method getNameMethod = ITestBean1 .class .getMethod ("getName" );
305
305
306
306
AnnotationTransactionAttributeSource atas = new AnnotationTransactionAttributeSource ();
307
307
TransactionAttribute getAgeAttr = atas .getTransactionAttribute (getAgeMethod , Ejb3AnnotatedBean1 .class );
@@ -312,8 +312,8 @@ public void transactionAttributeDeclaredOnClassMethodWithEjb3() throws Exception
312
312
313
313
@ Test
314
314
public void transactionAttributeDeclaredOnClassWithEjb3 () throws Exception {
315
- Method getAgeMethod = ITestBean .class .getMethod ("getAge" );
316
- Method getNameMethod = ITestBean .class .getMethod ("getName" );
315
+ Method getAgeMethod = ITestBean1 .class .getMethod ("getAge" );
316
+ Method getNameMethod = ITestBean1 .class .getMethod ("getName" );
317
317
318
318
AnnotationTransactionAttributeSource atas = new AnnotationTransactionAttributeSource ();
319
319
TransactionAttribute getAgeAttr = atas .getTransactionAttribute (getAgeMethod , Ejb3AnnotatedBean2 .class );
@@ -336,8 +336,8 @@ public void transactionAttributeDeclaredOnInterfaceWithEjb3() throws Exception {
336
336
337
337
@ Test
338
338
public void transactionAttributeDeclaredOnClassMethodWithJta () throws Exception {
339
- Method getAgeMethod = ITestBean .class .getMethod ("getAge" );
340
- Method getNameMethod = ITestBean .class .getMethod ("getName" );
339
+ Method getAgeMethod = ITestBean1 .class .getMethod ("getAge" );
340
+ Method getNameMethod = ITestBean1 .class .getMethod ("getName" );
341
341
342
342
AnnotationTransactionAttributeSource atas = new AnnotationTransactionAttributeSource ();
343
343
TransactionAttribute getAgeAttr = atas .getTransactionAttribute (getAgeMethod , JtaAnnotatedBean1 .class );
@@ -348,8 +348,8 @@ public void transactionAttributeDeclaredOnClassMethodWithJta() throws Exception
348
348
349
349
@ Test
350
350
public void transactionAttributeDeclaredOnClassWithJta () throws Exception {
351
- Method getAgeMethod = ITestBean .class .getMethod ("getAge" );
352
- Method getNameMethod = ITestBean .class .getMethod ("getName" );
351
+ Method getAgeMethod = ITestBean1 .class .getMethod ("getAge" );
352
+ Method getNameMethod = ITestBean1 .class .getMethod ("getName" );
353
353
354
354
AnnotationTransactionAttributeSource atas = new AnnotationTransactionAttributeSource ();
355
355
TransactionAttribute getAgeAttr = atas .getTransactionAttribute (getAgeMethod , JtaAnnotatedBean2 .class );
@@ -372,8 +372,8 @@ public void transactionAttributeDeclaredOnInterfaceWithJta() throws Exception {
372
372
373
373
@ Test
374
374
public void transactionAttributeDeclaredOnGroovyClass () throws Exception {
375
- Method getAgeMethod = ITestBean .class .getMethod ("getAge" );
376
- Method getNameMethod = ITestBean .class .getMethod ("getName" );
375
+ Method getAgeMethod = ITestBean1 .class .getMethod ("getAge" );
376
+ Method getNameMethod = ITestBean1 .class .getMethod ("getName" );
377
377
Method getMetaClassMethod = GroovyObject .class .getMethod ("getMetaClass" );
378
378
379
379
AnnotationTransactionAttributeSource atas = new AnnotationTransactionAttributeSource ();
@@ -385,7 +385,7 @@ public void transactionAttributeDeclaredOnGroovyClass() throws Exception {
385
385
}
386
386
387
387
388
- interface ITestBean {
388
+ interface ITestBean1 {
389
389
390
390
int getAge ();
391
391
@@ -403,6 +403,10 @@ interface ITestBean2 {
403
403
int getAge ();
404
404
405
405
void setAge (int age );
406
+ }
407
+
408
+
409
+ interface ITestBean2X extends ITestBean2 {
406
410
407
411
String getName ();
408
412
@@ -423,7 +427,7 @@ interface ITestBean3 {
423
427
}
424
428
425
429
426
- static class Empty implements ITestBean {
430
+ static class Empty implements ITestBean1 {
427
431
428
432
private String name ;
429
433
@@ -460,7 +464,7 @@ public void setAge(int age) {
460
464
461
465
462
466
@ SuppressWarnings ("serial" )
463
- static class TestBean1 implements ITestBean , Serializable {
467
+ static class TestBean1 implements ITestBean1 , Serializable {
464
468
465
469
private String name ;
466
470
@@ -497,7 +501,7 @@ public void setAge(int age) {
497
501
}
498
502
499
503
500
- static class TestBean2 implements ITestBean2 {
504
+ static class TestBean2 implements ITestBean2X {
501
505
502
506
private String name ;
503
507
@@ -635,6 +639,7 @@ public int getAge() {
635
639
@ Retention (RetentionPolicy .RUNTIME )
636
640
@ Transactional (rollbackFor = Exception .class , noRollbackFor = IOException .class )
637
641
@interface TxWithAttribute {
642
+
638
643
boolean readOnly ();
639
644
}
640
645
@@ -689,23 +694,7 @@ public int getAge() {
689
694
}
690
695
691
696
692
- interface Foo <T > {
693
-
694
- void doSomething (T theArgument );
695
- }
696
-
697
-
698
- static class MyFoo implements Foo <String > {
699
-
700
- @ Override
701
- @ Transactional
702
- public void doSomething (String theArgument ) {
703
- System .out .println (theArgument );
704
- }
705
- }
706
-
707
-
708
- static class Ejb3AnnotatedBean1 implements ITestBean {
697
+ static class Ejb3AnnotatedBean1 implements ITestBean1 {
709
698
710
699
private String name ;
711
700
@@ -736,7 +725,7 @@ public void setAge(int age) {
736
725
737
726
738
727
@ javax .ejb .TransactionAttribute (TransactionAttributeType .SUPPORTS )
739
- static class Ejb3AnnotatedBean2 implements ITestBean {
728
+ static class Ejb3AnnotatedBean2 implements ITestBean1 {
740
729
741
730
private String name ;
742
731
@@ -807,7 +796,7 @@ public void setAge(int age) {
807
796
}
808
797
809
798
810
- static class JtaAnnotatedBean1 implements ITestBean {
799
+ static class JtaAnnotatedBean1 implements ITestBean1 {
811
800
812
801
private String name ;
813
802
@@ -838,7 +827,7 @@ public void setAge(int age) {
838
827
839
828
840
829
@ javax .transaction .Transactional (javax .transaction .Transactional .TxType .SUPPORTS )
841
- static class JtaAnnotatedBean2 implements ITestBean {
830
+ static class JtaAnnotatedBean2 implements ITestBean1 {
842
831
843
832
private String name ;
844
833
@@ -910,7 +899,7 @@ public void setAge(int age) {
910
899
911
900
912
901
@ Transactional
913
- static class GroovyTestBean implements ITestBean , GroovyObject {
902
+ static class GroovyTestBean implements ITestBean1 , GroovyObject {
914
903
915
904
private String name ;
916
905
0 commit comments