MDXBaseComponent extends ComponentBase implements IDataComponent, IPreparedComponent { protected boolean prepareQuery( final String rawQuery ) { try { if ( connection == null ) { error( Messages.getInstance().getErrorString( "MDXBaseComponent.ERROR_0008_NO_CONNECTION" ) ); return false; } if ( !connection.initialized() ) { error( Messages.getInstance().getErrorString( "MDXBaseComponent.ERROR_0008_NO_CONNECTION" ) ); return false; } if ( rawQuery != null ) { preparedQuery = applyInputsToFormat( rawQuery ); } return true; } catch ( Exception e ) { error( Messages.getInstance().getErrorString( "MDXBaseComponent.ERROR_0006_EXECUTE_FAILED", getActionName() ), e ); } return false; }  @Override abstract boolean validateSystemSettings(); @Override abstract Log getLogger(); IPentahoResultSet getResultSet(); @Override void done(); void dispose(); IPentahoConnection shareConnection(); IPentahoResultSet executePrepared( final Map preparedParams ); IPentahoConnection getDatasourceConnection(); @Override boolean init(); static final String FORMATTED_CELL_VALUES; }
@Test public void testPrepareQuery() throws Exception { mdxBaseComponent.setConnection( conn ); when( conn.initialized() ).thenReturn( true ); doReturn( "yes" ).when( mdxBaseComponent ).applyInputsToFormat( anyString() ); assertTrue( mdxBaseComponent.prepareQuery( "select * from table" ) ); }