1 22 package org.jboss.test.aop.basic; 23 24 25 28 public class CallerTypedefCaller 29 { 30 31 public void call() 32 { 33 System.out.println("intercept class constructor"); 34 CallerInterceptor.called = false; 35 CallerTypedefPOJO pojo = new CallerTypedefPOJO(); 36 if (!CallerInterceptor.called) throw new RuntimeException ("Did not intercept CallerTypedefPOJO constructor"); 37 CallerInterceptor.called = false; 38 39 System.out.println("intercept class field read"); 40 int i = pojo.field1; 41 if (!CallerInterceptor.called) throw new RuntimeException ("Did not intercept CallerTypedefPOJO.field1 read " + i); 42 CallerInterceptor.called = false; 43 44 System.out.println("intercept class field write"); 45 pojo.field1 = 1; 46 if (!CallerInterceptor.called) throw new RuntimeException ("Did not intercept CallerTypedefPOJO.field1 write"); 47 CallerInterceptor.called = false; 48 49 System.out.println("intercept class field read"); 50 i = pojo.field2; 51 if (!CallerInterceptor.called) throw new RuntimeException ("Did not intercept CallerTypedefPOJO.field2 read"); 52 CallerInterceptor.called = false; 53 54 System.out.println("intercept class field write"); 55 pojo.field2 = 1; 56 if (!CallerInterceptor.called) throw new RuntimeException ("Did not intercept CallerTypedefPOJO.field1 write"); 57 CallerInterceptor.called = false; 58 59 System.out.println("intercept class method Caller"); 60 pojo.method(); 61 if (!CallerInterceptor.called) throw new RuntimeException ("Did not intercept CallerTypedefPOJO.method() execution"); 62 CallerInterceptor.called = false; 63 64 System.out.println("intercept instanceof constructor"); 65 CallerTypedefPOJO2 pojo2 = new CallerTypedefPOJO2(); 66 if (!CallerInterceptor.called) throw new RuntimeException ("Did not intercept CallerTypedefPOJO2 constructor"); 67 CallerInterceptor.called = false; 68 69 System.out.println("intercept instanceof field read"); 70 i = pojo2.field1; 71 if (!CallerInterceptor.called) throw new RuntimeException ("Did not intercept CallerTypedefPOJO2.field1 read"); 72 CallerInterceptor.called = false; 73 74 System.out.println("intercept instanceof field write"); 75 pojo2.field1 = 1; 76 if (!CallerInterceptor.called) throw new RuntimeException ("Did not intercept CallerTypedefPOJO2.field1 write"); 77 CallerInterceptor.called = false; 78 79 System.out.println("intercept instanceof field read"); 80 i = pojo2.field2; 81 if (!CallerInterceptor.called) throw new RuntimeException ("Did not intercept CallerTypedefPOJO2.field2 read"); 82 CallerInterceptor.called = false; 83 84 System.out.println("intercept instanceof field write"); 85 pojo2.field2 = 1; 86 if (!CallerInterceptor.called) throw new RuntimeException ("Did not intercept CallerTypedefPOJO2.field1 write"); 87 CallerInterceptor.called = false; 88 89 System.out.println("intercept instanceof method Caller"); 90 pojo2.method(); 91 if (!CallerInterceptor.called) throw new RuntimeException ("Did not intercept CallerTypedefPOJO2 method execution"); 92 CallerInterceptor.called = false; 93 94 System.out.println("intercept annotation constructor"); 95 CallerTypedefPOJO3 pojo3 = new CallerTypedefPOJO3(); 96 if (!CallerInterceptor.called) throw new RuntimeException ("Did not intercept CallerTypedefPOJO3 constructor"); 97 CallerInterceptor.called = false; 98 99 System.out.println("intercept annotation field read"); 100 i = pojo3.field1; 101 if (!CallerInterceptor.called) throw new RuntimeException ("Did not intercept CallerTypedefPOJO3.field1 read"); 102 CallerInterceptor.called = false; 103 104 System.out.println("intercept annotation field write"); 105 pojo3.field1 = 1; 106 if (!CallerInterceptor.called) throw new RuntimeException ("Did not intercept CallerTypedefPOJO3.field1 write"); 107 CallerInterceptor.called = false; 108 109 System.out.println("intercept annotation field read"); 110 i = pojo3.field2; 111 if (!CallerInterceptor.called) throw new RuntimeException ("Did not intercept CallerTypedefPOJO3.field2 read"); 112 CallerInterceptor.called = false; 113 114 System.out.println("intercept annotation field write"); 115 pojo3.field2 = 1; 116 if (!CallerInterceptor.called) throw new RuntimeException ("Did not intercept CallerTypedefPOJO3.field2 write"); 117 CallerInterceptor.called = false; 118 119 System.out.println("intercept annotation method Caller"); 120 pojo3.method(); 121 if (!CallerInterceptor.called) throw new RuntimeException ("Did not intercept CallerTypedefPOJO3 method execution"); 122 123 } 124 } 125 | Popular Tags |