Esempio n. 1
0
 def testApplyingASingleConditionalPointcutProgrammatically(self):
     wrappingAdvice = WrappingInterceptor()
     pointcutAdvisor = RegexpMethodPointcutAdvisor()
     pointcutAdvisor.advice = wrappingAdvice
     pointcutAdvisor.patterns = [".*do.*"]
     targetService = SampleService()
     sampleService = ProxyFactoryObject(interceptors = pointcutAdvisor)
     sampleService.target = targetService
     self.assertEquals(sampleService.doSomething(), "<Wrapped>Alright!</Wrapped>")
     self.assertEquals(sampleService.method("testdata"), "You made it! => testdata")
Esempio n. 2
0
 def testApplyingTwoConditionalPointcutsProgrammatically(self):
     beginEndAdvice = BeforeAndAfterInterceptor()
     wrappingAdvice = WrappingInterceptor()
     pointcutAdvisor = RegexpMethodPointcutAdvisor()
     pointcutAdvisor.advice = [beginEndAdvice, wrappingAdvice]
     pointcutAdvisor.patterns = [".*do.*"]
     targetService = SampleService()
     sampleService = ProxyFactoryObject(interceptors = pointcutAdvisor)
     sampleService.target = targetService
     self.assertEquals(sampleService.doSomething(), "BEFORE => <Wrapped>Alright!</Wrapped> <= AFTER")
     self.assertEquals(sampleService.method("testdata"), "You made it! => testdata")
Esempio n. 3
0
 def testApplyingASingleConditionalPointcutProgrammatically(self):
     wrappingAdvice = WrappingInterceptor()
     pointcutAdvisor = RegexpMethodPointcutAdvisor()
     pointcutAdvisor.advice = wrappingAdvice
     pointcutAdvisor.patterns = [".*do.*"]
     targetService = SampleService()
     sampleService = ProxyFactoryObject(interceptors=pointcutAdvisor)
     sampleService.target = targetService
     self.assertEquals(sampleService.doSomething(),
                       "<Wrapped>Alright!</Wrapped>")
     self.assertEquals(sampleService.method("testdata"),
                       "You made it! => testdata")
Esempio n. 4
0
 def testApplyingTwoConditionalPointcutsProgrammatically(self):
     beginEndAdvice = BeforeAndAfterInterceptor()
     wrappingAdvice = WrappingInterceptor()
     pointcutAdvisor = RegexpMethodPointcutAdvisor()
     pointcutAdvisor.advice = [beginEndAdvice, wrappingAdvice]
     pointcutAdvisor.patterns = [".*do.*"]
     targetService = SampleService()
     sampleService = ProxyFactoryObject(interceptors=pointcutAdvisor)
     sampleService.target = targetService
     self.assertEquals(sampleService.doSomething(),
                       "BEFORE => <Wrapped>Alright!</Wrapped> <= AFTER")
     self.assertEquals(sampleService.method("testdata"),
                       "You made it! => testdata")