/** * @see RowSet#putRowWait(RowMetaInterface, Object[], long, TimeUnit) */ public boolean putRowWait( RowMetaInterface rowMeta, Object[] rowData, long time, TimeUnit tu ) { return rowSet.putRowWait( rowMeta, rowData, time, tu ); }
/** * Puts a row on to the underlying row set, optionally blocking until the row can be successfully put. * * @return true if the row was successfully added to the rowset and false if this buffer was full. If {@code block} is * true this will always return true. * @see RowSet#putRow(RowMetaInterface, Object[]) */ public boolean putRow( RowMetaInterface rowMeta, Object[] row, boolean block ) { if ( block ) { boolean added = false; while ( !added ) { added = rowSet.putRowWait( rowMeta, row, Long.MAX_VALUE, TimeUnit.DAYS ); } return true; } return rowSet.putRow( rowMeta, row ); }
@Test public void testPutRowWait() throws Exception { rowProducer.putRowWait( rowMeta, rowData, 1, TimeUnit.MILLISECONDS ); verify( rowSet, times( 1 ) ).putRowWait( rowMeta, rowData, 1, TimeUnit.MILLISECONDS ); }
@Test public void testPutRow2Arg() throws Exception { when( rowSet.putRowWait( any( RowMetaInterface.class ), any( Object[].class ), anyLong(), any( TimeUnit.class ) ) ) .thenReturn( true ); rowProducer.putRow( rowMeta, rowData ); verify( rowSet, times( 1 ) ).putRowWait( rowMeta, rowData, Long.MAX_VALUE, TimeUnit.DAYS ); assertTrue( rowProducer.putRow( rowMeta, rowData, true ) ); }
@Test public void testPutRow3Arg() throws Exception { when( rowSet.putRowWait( any( RowMetaInterface.class ), any( Object[].class ), anyLong(), any( TimeUnit.class ) ) ) .thenReturn( true ); rowProducer.putRow( rowMeta, rowData, false ); verify( rowSet, times( 1 ) ).putRow( rowMeta, rowData ); }