public Object invoke(MethodInvocation aMethodInvocation) throws Throwable { return monitor(JoinPointFactory.create(aMethodInvocation)); }
public void testMethodCallInterceptor() throws Throwable { EtmManager.reset(); BasicEtmConfigurator.configure(); EtmMonitor monitor = EtmManager.getEtmMonitor(); monitor.start(); try { EtmMethodCallInterceptor interceptor = new EtmMethodCallInterceptor(monitor); interceptor.invoke(new DummyMethodInvocation()); try { interceptor.invoke(new DummyMethodInvocation()); fail("An exception should have been thrown."); } catch (Exception e) { // ignored since expected } monitor.render(new MeasurementRenderer() { public void render(Map points) { assertTrue(!points.isEmpty()); assertNotNull(points.get("FooService::doFoo")); assertNotNull(points.get("FooService::doFoo [Exception]")); } }); } finally { monitor.stop(); } }
public void afterPropertiesSet() throws Exception { ProxyFactory proxyFactory = new ProxyFactory(); proxyFactory.addAdvisor(new EtmAdvisor(new EtmMethodCallInterceptor(etmMonitor))); proxyFactory.copyFrom(this); TargetSource targetSource = createTargetSource(target); proxyFactory.setTargetSource(targetSource); proxy = proxyFactory.getProxy(); }