AbstractStagingHandler implements StagingHandler { public static StagingHandler getStagingHandlerImpl( final OutputStream outputStream, final IPentahoSession userSession, final StagingMode mode ) throws IOException { if ( mode.equals( StagingMode.THRU ) ) { return new ThruStagingHandler( outputStream, userSession ); } else if ( mode.equals( StagingMode.TMPFILE ) ) { return new TempFileStagingHandler( outputStream, userSession ); } else if ( mode.equals( StagingMode.MEMORY ) ) { return new MemStagingHandler( outputStream, userSession ); } else { return new ThruStagingHandler( outputStream, userSession ); } } AbstractStagingHandler( final OutputStream outputStream, final IPentahoSession userSession ); static StagingHandler getStagingHandlerImpl( final OutputStream outputStream, final IPentahoSession userSession, final StagingMode mode );  }
@Test public void getStagingHandlerImpl() throws Exception { File tmp = new File( "target/test/resource/solution/system/tmp" ); tmp.mkdirs(); MicroPlatform microPlatform = MicroPlatformFactory.create(); microPlatform.start(); try { final StagingHandler handler1 = AbstractStagingHandler.getStagingHandlerImpl( null, null, StagingMode.THRU ); assertTrue( handler1 instanceof ThruStagingHandler ); final StagingHandler handler2 = AbstractStagingHandler.getStagingHandlerImpl( null, null, StagingMode.MEMORY ); assertTrue( handler2 instanceof MemStagingHandler ); final StagingHandler handler3 = AbstractStagingHandler.getStagingHandlerImpl( null, new StandaloneSession( "test" ), StagingMode.TMPFILE ); assertTrue( handler3 instanceof TempFileStagingHandler ); } finally { microPlatform.stop(); microPlatform = null; } }