/** * Start fastload command line tool and initialize streams. * * @throws KettleException * ... */ private void startFastLoad() throws KettleException { final String command = this.createCommandLine(); this.logBasic( "About to execute: " + command ); try { this.process = Runtime.getRuntime().exec( command ); new Thread( new ConfigurableStreamLogger( getLogChannel(), this.process.getErrorStream(), LogLevel.ERROR, "ERROR" ) ).start(); new Thread( new ConfigurableStreamLogger( getLogChannel(), this.process.getInputStream(), LogLevel.DETAILED, "OUTPUT" ) ).start(); this.fastload = this.process.getOutputStream(); } catch ( Exception e ) { throw new KettleException( "Error while setup: " + command, e ); } }
@Test public void testLogDetailed() { streamLogger = new ConfigurableStreamLogger( log, is, LogLevel.DETAILED, PREFIX ); streamLogger.run(); Mockito.verify( log ).logDetailed( OUT1 ); Mockito.verify( log ).logDetailed( OUT2 ); }
@Test public void testLogMinimal() { streamLogger = new ConfigurableStreamLogger( log, is, LogLevel.MINIMAL, PREFIX ); streamLogger.run(); Mockito.verify( log ).logMinimal( OUT1 ); Mockito.verify( log ).logMinimal( OUT2 ); }
@Test public void testLogBasic() { streamLogger = new ConfigurableStreamLogger( log, is, LogLevel.BASIC, PREFIX ); streamLogger.run(); Mockito.verify( log ).logBasic( OUT1 ); Mockito.verify( log ).logBasic( OUT2 ); }
@Test public void testLogRowlevel() { streamLogger = new ConfigurableStreamLogger( log, is, LogLevel.ROWLEVEL, PREFIX ); streamLogger.run(); Mockito.verify( log ).logRowlevel( OUT1 ); Mockito.verify( log ).logRowlevel( OUT2 ); }
@Test public void testLogError() { streamLogger = new ConfigurableStreamLogger( log, is, LogLevel.ERROR, PREFIX ); streamLogger.run(); Mockito.verify( log ).logError( OUT1 ); Mockito.verify( log ).logError( OUT2 ); }
@Test public void testLogDebug() { streamLogger = new ConfigurableStreamLogger( log, is, LogLevel.DEBUG, PREFIX ); streamLogger.run(); Mockito.verify( log ).logDebug( OUT1 ); Mockito.verify( log ).logDebug( OUT2 ); }