@Test public void testClose() throws Exception { ScriptableDataFactory dataFactory = spy( new ScriptableDataFactory() ); dataFactory.setQuery( QUERY_NAME, QUERY_VALUE ); dataFactory.setLanguage( LANGUAGE ); dataFactory.setShutdownScript( "test_shutdown_script" ); BSFManager interpreter = mock( BSFManager.class ); TableModel tableModel = mock( TableModel.class ); when( dataFactory.createInterpreter() ).thenReturn( interpreter ); doReturn( tableModel ).when( interpreter ).eval( LANGUAGE, "expression", 1, 1, QUERY_VALUE ); dataFactory.queryData( QUERY_NAME, null ); doReturn( null ).when( interpreter ).eval( LANGUAGE, "shutdown-script", 1, 1, "test_shutdown_script" ); dataFactory.close(); verify( interpreter ).eval( LANGUAGE, "shutdown-script", 1, 1, "test_shutdown_script" ); }
public void close() { if ( this.interpreter != null && this.shutdownScript != null ) { try { this.interpreter.eval( getLanguage(), "shutdown-script", 1, 1, getShutdownScript() ); } catch ( BSFException e ) { logger.warn( "Failed to evaluate shutdown-script", e ); } } this.dataRowWrapper = null; this.interpreter = null; }
ScriptableDataFactory extends AbstractDataFactory { public void close() { if ( this.interpreter != null && this.shutdownScript != null ) { try { this.interpreter.eval( getLanguage(), "shutdown-script", 1, 1, getShutdownScript() ); } catch ( BSFException e ) { logger.warn( "Failed to evaluate shutdown-script", e ); } } this.dataRowWrapper = null; this.interpreter = null; } }
ScriptableDataFactory extends AbstractDataFactory { public void close() { if ( this.interpreter != null && this.shutdownScript != null ) { try { this.interpreter.eval( getLanguage(), "shutdown-script", 1, 1, getShutdownScript() ); } catch ( BSFException e ) { logger.warn( "Failed to evaluate shutdown-script", e ); } } this.dataRowWrapper = null; this.interpreter = null; } ScriptableDataFactory(); }
ScriptableDataFactory extends AbstractDataFactory { public void close() { if ( this.interpreter != null && this.shutdownScript != null ) { try { this.interpreter.eval( getLanguage(), "shutdown-script", 1, 1, getShutdownScript() ); } catch ( BSFException e ) { logger.warn( "Failed to evaluate shutdown-script", e ); } } this.dataRowWrapper = null; this.interpreter = null; } ScriptableDataFactory(); String getLanguage(); void setLanguage( final String language ); void setQuery( final String name, final String value ); String getScript(); void setScript( final String script ); String getShutdownScript(); void setShutdownScript( final String shutdownScript ); String getQuery( final String name ); String[] getQueryNames(); TableModel queryData( final String query, final DataRow parameters ); ScriptableDataFactory clone(); DataFactory derive(); void close(); boolean isQueryExecutable( final String query, final DataRow parameters ); void cancelRunningQuery(); }
ScriptableDataFactory extends AbstractDataFactory { public void close() { if ( this.interpreter != null && this.shutdownScript != null ) { try { this.interpreter.eval( getLanguage(), "shutdown-script", 1, 1, getShutdownScript() ); } catch ( BSFException e ) { logger.warn( "Failed to evaluate shutdown-script", e ); } } this.dataRowWrapper = null; this.interpreter = null; } ScriptableDataFactory(); String getLanguage(); void setLanguage( final String language ); void setQuery( final String name, final String value ); String getScript(); void setScript( final String script ); String getShutdownScript(); void setShutdownScript( final String shutdownScript ); String getQuery( final String name ); String[] getQueryNames(); TableModel queryData( final String query, final DataRow parameters ); ScriptableDataFactory clone(); DataFactory derive(); void close(); boolean isQueryExecutable( final String query, final DataRow parameters ); void cancelRunningQuery();  }