Package org.springframework.aop.interceptor

Examples of org.springframework.aop.interceptor.DebugInterceptor


    assertThat("Should no longer implement TimeStamped",
        factory.getBean("test2"), not(instanceOf(TimeStamped.class)));

    // Now check non-effect of removing interceptor that isn't there
    config.removeAdvice(new DebugInterceptor());
    assertTrue(config.getAdvisors().length == oldCount);

    ITestBean it = (ITestBean) ts;
    DebugInterceptor debugInterceptor = new DebugInterceptor();
    config.addAdvice(0, debugInterceptor);
    it.getSpouse();
    // Won't affect existing reference
    assertTrue(debugInterceptor.getCount() == 0);
    it = (ITestBean) factory.getBean("test2");
    it.getSpouse();
    assertEquals(1, debugInterceptor.getCount());
    config.removeAdvice(debugInterceptor);
    it.getSpouse();

    // Still invoked wiht old reference
    assertEquals(2, debugInterceptor.getCount());

    // not invoked with new object
    it = (ITestBean) factory.getBean("test2");
    it.getSpouse();
    assertEquals(2, debugInterceptor.getCount());

    // Our own timestamped reference should still work
    assertEquals(time, ts.getTimeStamp());
  }
View Full Code Here


  @Test
  public void testDetectsInterfaces() throws Exception {
    ProxyFactoryBean fb = new ProxyFactoryBean();
    fb.setTarget(new TestBean());
    fb.addAdvice(new DebugInterceptor());
    fb.setBeanFactory(new DefaultListableBeanFactory());
    ITestBean proxy = (ITestBean) fb.getObject();
    assertTrue(AopUtils.isJdkDynamicProxy(proxy));
  }
View Full Code Here

    assertFalse("Should no longer implement TimeStamped",
        config.getProxy() instanceof TimeStamped);

    // Now check non-effect of removing interceptor that isn't there
    config.removeAdvice(new DebugInterceptor());

    assertTrue(config.getAdvisors().length == oldCount);

    ITestBean it = (ITestBean) ts;
    DebugInterceptor debugInterceptor = new DebugInterceptor();
    config.addAdvice(0, debugInterceptor);
    it.getSpouse();
    assertEquals(1, debugInterceptor.getCount());
    config.removeAdvice(debugInterceptor);
    it.getSpouse();
    // not invoked again
    assertTrue(debugInterceptor.getCount() == 1);
  }
View Full Code Here

TOP

Related Classes of org.springframework.aop.interceptor.DebugInterceptor

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.