Examples of DebugInterceptor


Examples of org.apache.camel.processor.interceptor.DebugInterceptor

        debugger = main.getDebugger();
        // END SNIPPET: example

        assertNotNull("should have a debugger!", debugger);

        DebugInterceptor f1 = assertHasInterceptor("f1");
        DebugInterceptor o1 = assertHasInterceptor("o1");
        DebugInterceptor o2 = assertHasInterceptor("o2");

        // now lets get the routes
        List<RouteType> routes = main.getRouteDefinitions();
        assertEquals("Number of routes", 1, routes.size());
View Full Code Here

Examples of org.apache.camel.processor.interceptor.DebugInterceptor

            main.stop();
        }
    }

    protected DebugInterceptor assertHasInterceptor(String id) {
        DebugInterceptor interceptor = debugger.getInterceptor(id);
        assertNotNull("Should have an interceptor for id: " + id, interceptor);
        return interceptor;
    }
View Full Code Here

Examples of org.apache.camel.processor.interceptor.DebugInterceptor

        debugger = main.getDebugger();
        // END SNIPPET: example

        assertNotNull("should have a debugger!", debugger);

        DebugInterceptor f1 = assertHasInterceptor("f1");
        DebugInterceptor o1 = assertHasInterceptor("o1");
        DebugInterceptor o2 = assertHasInterceptor("o2");

        // now lets get the routes
        List<RouteDefinition> routes = main.getRouteDefinitions();
        assertEquals("Number of routes", 1, routes.size());
View Full Code Here

Examples of org.apache.camel.processor.interceptor.DebugInterceptor

            main.stop();
        }
    }

    protected DebugInterceptor assertHasInterceptor(String id) {
        DebugInterceptor interceptor = debugger.getInterceptor(id);
        assertNotNull("Should have an interceptor for id: " + id, interceptor);
        return interceptor;
    }
View Full Code Here

Examples of org.springframework.aop.interceptor.DebugInterceptor

    assertEquals("foo", olup.testMethod());
    assertInterceptorCount(2);
  }

  private void assertInterceptorCount(int count) {
    DebugInterceptor interceptor = getInterceptor();
    assertEquals("Interceptor count is incorrect", count, interceptor.getCount());
  }
View Full Code Here

Examples of org.springframework.aop.interceptor.DebugInterceptor

    DebugInterceptor interceptor = getInterceptor();
    assertEquals("Interceptor count is incorrect", count, interceptor.getCount());
  }

  private void resetInterceptor() {
    DebugInterceptor interceptor = getInterceptor();
    interceptor.resetCount();
  }
View Full Code Here

Examples of org.springframework.aop.interceptor.DebugInterceptor

    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

Examples of org.springframework.aop.interceptor.DebugInterceptor

  }

  public void testProxyIsBoundBeforeTargetSourceInvoked() {
    final TestBean target = new TestBean();
    ProxyFactory pf = new ProxyFactory(target);
    pf.addAdvice(new DebugInterceptor());
    pf.setExposeProxy(true);
    final ITestBean proxy = (ITestBean) createProxy(pf);
    Advised config = (Advised) proxy;
    // This class just checks proxy is bound before getTarget() call
    config.setTargetSource(new TargetSource() {
View Full Code Here

Examples of org.springframework.aop.interceptor.DebugInterceptor

    }
    catch (ClassCastException ex) {
    }
   
    // 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

Examples of org.springframework.aop.interceptor.DebugInterceptor

  }

  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
TOP
Copyright © 2018 www.massapi.com. 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.