@SuppressWarnings( "unchecked" ) @Test public void testHandlerCallOnException() throws Throwable { when( metaStore.getName() ).thenThrow( KettleRepositoryLostException.class ); Method method = IMetaStore.class.getMethod( "getName" ); metaStoresessionTimeoutHandler.invoke( mock( Proxy.class ), method, new Object[0] ); verify( sessionTimeoutHandler ).handle( any(), any(), any(), any() ); }
@Override public Object invoke( Object proxy, Method method, Object[] args ) throws Throwable { try { return method.invoke( metaStore, args ); } catch ( InvocationTargetException ex ) { return sessionTimeoutHandler.handle( metaStore, ex.getCause(), method, args ); } }
MetaStoreSessionTimeoutHandler implements InvocationHandler { @Override public Object invoke( Object proxy, Method method, Object[] args ) throws Throwable { try { return method.invoke( metaStore, args ); } catch ( InvocationTargetException ex ) { return sessionTimeoutHandler.handle( metaStore, ex.getCause(), method, args ); } } }
MetaStoreSessionTimeoutHandler implements InvocationHandler { @Override public Object invoke( Object proxy, Method method, Object[] args ) throws Throwable { try { return method.invoke( metaStore, args ); } catch ( InvocationTargetException ex ) { return sessionTimeoutHandler.handle( metaStore, ex.getCause(), method, args ); } } MetaStoreSessionTimeoutHandler( IMetaStore metaStore, SessionTimeoutHandler sessionTimeoutHandler ); }
MetaStoreSessionTimeoutHandler implements InvocationHandler { @Override public Object invoke( Object proxy, Method method, Object[] args ) throws Throwable { try { return method.invoke( metaStore, args ); } catch ( InvocationTargetException ex ) { return sessionTimeoutHandler.handle( metaStore, ex.getCause(), method, args ); } } MetaStoreSessionTimeoutHandler( IMetaStore metaStore, SessionTimeoutHandler sessionTimeoutHandler ); @Override Object invoke( Object proxy, Method method, Object[] args ); }
MetaStoreSessionTimeoutHandler implements InvocationHandler { @Override public Object invoke( Object proxy, Method method, Object[] args ) throws Throwable { try { return method.invoke( metaStore, args ); } catch ( InvocationTargetException ex ) { return sessionTimeoutHandler.handle( metaStore, ex.getCause(), method, args ); } } MetaStoreSessionTimeoutHandler( IMetaStore metaStore, SessionTimeoutHandler sessionTimeoutHandler ); @Override Object invoke( Object proxy, Method method, Object[] args );  }