@Test public void testDispatchHandlesAllEventTypes() throws Exception { DefaultRepositoryEventDispatcher dispatcher = new DefaultRepositoryEventDispatcher(); ListenerHandler handler = new ListenerHandler(); RepositoryListener listener = (RepositoryListener) Proxy.newProxyInstance( getClass().getClassLoader(), new Class<?>[] { RepositoryListener.class }, handler ); DefaultRepositorySystemSession session = TestUtils.newSession(); session.setRepositoryListener( listener ); for ( RepositoryEvent.EventType type : RepositoryEvent.EventType.values() ) { RepositoryEvent event = new RepositoryEvent.Builder( session, type ).build(); handler.methodName = null; dispatcher.dispatch( event ); assertNotNull( "not handled: " + type, handler.methodName ); assertEquals( "badly handled: " + type, type.name().replace( "_", "" ).toLowerCase( Locale.ENGLISH ), handler.methodName.toLowerCase( Locale.ENGLISH ) ); } }
public void dispatch( RepositoryEvent event ) { if ( !listeners.isEmpty() ) { for ( RepositoryListener listener : listeners ) { dispatch( event, listener ); } } RepositoryListener listener = event.getSession().getRepositoryListener(); if ( listener != null ) { dispatch( event, listener ); } }
DefaultRepositoryEventDispatcher implements RepositoryEventDispatcher, Service { public void dispatch( RepositoryEvent event ) { if ( !listeners.isEmpty() ) { for ( RepositoryListener listener : listeners ) { dispatch( event, listener ); } } RepositoryListener listener = event.getSession().getRepositoryListener(); if ( listener != null ) { dispatch( event, listener ); } } }
DefaultRepositoryEventDispatcher implements RepositoryEventDispatcher, Service { public void dispatch( RepositoryEvent event ) { if ( !listeners.isEmpty() ) { for ( RepositoryListener listener : listeners ) { dispatch( event, listener ); } } RepositoryListener listener = event.getSession().getRepositoryListener(); if ( listener != null ) { dispatch( event, listener ); } } DefaultRepositoryEventDispatcher(); @Inject  DefaultRepositoryEventDispatcher( Set<RepositoryListener> listeners, LoggerFactory loggerFactory ); }
DefaultRepositoryEventDispatcher implements RepositoryEventDispatcher, Service { public void dispatch( RepositoryEvent event ) { if ( !listeners.isEmpty() ) { for ( RepositoryListener listener : listeners ) { dispatch( event, listener ); } } RepositoryListener listener = event.getSession().getRepositoryListener(); if ( listener != null ) { dispatch( event, listener ); } } DefaultRepositoryEventDispatcher(); @Inject  DefaultRepositoryEventDispatcher( Set<RepositoryListener> listeners, LoggerFactory loggerFactory ); DefaultRepositoryEventDispatcher setLoggerFactory( LoggerFactory loggerFactory ); DefaultRepositoryEventDispatcher addRepositoryListener( RepositoryListener listener ); DefaultRepositoryEventDispatcher setRepositoryListeners( Collection<RepositoryListener> listeners ); void initService( ServiceLocator locator ); void dispatch( RepositoryEvent event ); }
DefaultRepositoryEventDispatcher implements RepositoryEventDispatcher, Service { public void dispatch( RepositoryEvent event ) { if ( !listeners.isEmpty() ) { for ( RepositoryListener listener : listeners ) { dispatch( event, listener ); } } RepositoryListener listener = event.getSession().getRepositoryListener(); if ( listener != null ) { dispatch( event, listener ); } } DefaultRepositoryEventDispatcher(); @Inject  DefaultRepositoryEventDispatcher( Set<RepositoryListener> listeners, LoggerFactory loggerFactory ); DefaultRepositoryEventDispatcher setLoggerFactory( LoggerFactory loggerFactory ); DefaultRepositoryEventDispatcher addRepositoryListener( RepositoryListener listener ); DefaultRepositoryEventDispatcher setRepositoryListeners( Collection<RepositoryListener> listeners ); void initService( ServiceLocator locator ); void dispatch( RepositoryEvent event );  }