PentahoSessionStartupAuthenticationSuccessListener implements ApplicationListener, Ordered { public void onApplicationEvent( final ApplicationEvent event ) { if ( event instanceof InteractiveAuthenticationSuccessEvent ) { logger.debug( "received InteractiveAuthenticationSuccessEvent" ); logger.debug( "calling PentahoSystem.sessionStartup" ); try { IPentahoSession pentahoSession = PentahoSessionHolder.getSession(); Assert.notNull( pentahoSession, "PentahoSessionHolder doesn't have a session" ); IParameterProvider sessionParameters = new PentahoSessionParameterProvider( pentahoSession ); PentahoSystem.sessionStartup( pentahoSession, sessionParameters ); } catch ( Exception e ) { logger.error( e.getLocalizedMessage(), e ); } } } PentahoSessionStartupAuthenticationSuccessListener(); void onApplicationEvent( final ApplicationEvent event ); int getOrder(); void setOrder( int order );  }
@Test public void testOnApplicationEvent_onlyInteractiveAuthenticationSuccessEvent() { ApplicationEvent event = new InteractiveAuthenticationSuccessEvent( authentication, InteractiveAuthenticationSuccessEvent.class ); PentahoSessionStartupAuthenticationSuccessListener listener = new PentahoSessionStartupAuthenticationSuccessListener(); listener.onApplicationEvent( event ); System.out.flush(); assertNotNull( baos ); assertTrue( baos.toString().contains( "calling PentahoSystem.sessionStartup" ) ); }
@Test public void testOnApplicationEvent_AuthenticationEvent() { ApplicationEvent event = mock( ApplicationEvent.class ); PentahoSessionStartupAuthenticationSuccessListener listener = new PentahoSessionStartupAuthenticationSuccessListener(); listener.onApplicationEvent( event ); System.out.flush(); assertNotNull( baos ); assertFalse( baos.toString().contains( "calling PentahoSystem.sessionStartup" ) ); }