1 22 package org.jboss.test.aop.override; 23 24 import junit.framework.Test; 25 import junit.framework.TestSuite; 26 27 32 public class GenAdvisorOverrideTestCase extends OverrideTestCase 33 { 34 SubPOJOOverrideAll subControl = new SubPOJOOverrideAll(); 37 SubSubPOJOOverrideAll subSubControl = new SubSubPOJOOverrideAll(); 38 39 public GenAdvisorOverrideTestCase(String name) 40 { 41 super(name); 42 } 43 44 public static Test suite() 45 { 46 TestSuite suite = new TestSuite("OverrideTestCase"); 47 suite.addTestSuite(GenAdvisorOverrideTestCase.class); 48 return suite; 49 } 50 51 59 public void testSubSuperOnlyMetadata() throws Exception 60 { 61 System.out.println("TEST SUB SUPERONLY METADATA"); 62 MetadataInterceptor.metadata = null; 63 subPojo.superOnly(); 64 65 assertEquals("subpojo.superOnly", MetadataInterceptor.metadata); 66 } 67 68 public void testSubSubSuperOnlyMetadata() throws Exception 69 { 70 System.out.println("TEST SUB SUB SUPERONLY METADATA"); 71 MetadataInterceptor.metadata = null; 72 subSubPojo.superOnly(); 73 74 assertEquals("subsubpojo.superOnly", MetadataInterceptor.metadata); 75 } 76 77 89 public void testSubSuperOnlyChain() throws Exception 90 { 91 System.out.println("TEST SUB SUPERONLY CHAIN"); 92 93 CountingInterceptor.reset(); 94 CountingAspect.reset(); 95 subControl.superOnly(); 96 97 assertEquals(1, CountingInterceptor.interceptions); 98 assertEquals(1, CountingAspect.interceptions); 99 100 CountingInterceptor.reset(); 102 CountingAspect.reset(); 103 subPojo.superOnly(); 104 105 assertEquals(1, CountingInterceptor.interceptions); 106 assertEquals(1, CountingAspect.interceptions); 107 108 } 109 110 public void testSubSubSuperOnlyChain() throws Exception 111 { 112 System.out.println("TEST SUB SUB SUPERONLY CHAIN"); 113 CountingInterceptor.reset(); 114 CountingAspect.reset(); 115 subSubControl.superOnly(); 116 117 assertEquals(2, CountingInterceptor.interceptions); 118 assertEquals(2, CountingAspect.interceptions); 119 120 CountingInterceptor.reset(); 122 CountingAspect.reset(); 123 subSubPojo.superOnly(); 124 125 assertEquals(2, CountingInterceptor.interceptions); 126 assertEquals(2, CountingAspect.interceptions); 127 128 }} 129 | Popular Tags |