MDXBaseComponent extends ComponentBase implements IDataComponent, IPreparedComponent { public IPentahoConnection getDatasourceConnection() { IPentahoConnection con; int[] timeouts = { 200, 500, 2000 }; for ( int element : timeouts ) { try { con = getConnection(); try { con.clearWarnings(); } catch ( Exception ex ) { } return con; } catch ( Exception ex ) { } waitFor( element ); } con = getConnection(); try { con.clearWarnings(); } catch ( Exception ex ) { } return con; }  @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 testGetDatasourceConnection() throws Exception { doReturn( conn ).when( mdxBaseComponent ).getConnection(); IPentahoConnection datasourceConnection = mdxBaseComponent.getDatasourceConnection(); assertEquals( conn, datasourceConnection ); verify( conn ).clearWarnings(); }