@Test public void testNoRowsException() throws Exception { this.connectorManager.setRows(0); DataTierTupleSource info = helpSetup(3); while (true) { try { assertNull(info.nextTuple()); break; } catch (BlockedException e) { Thread.sleep(50); } } }
@Test public void testAsynch() throws Exception { this.connectorManager.dataNotAvailable = 10; this.serial = true; this.connectorManager.setRows(0); DataTierTupleSource info = helpSetup(3); boolean blocked = false; while (true) { try { assertNull(info.nextTuple()); break; } catch (BlockedException e) { blocked = true; try { info.nextTuple(); } catch (BlockedException be) { fail(); } Thread.sleep(50); } } assertTrue(blocked); }
@Test public void testAsynchStrict() throws Exception { this.connectorManager.dataNotAvailable = 1000; this.serial = true; this.connectorManager.strict = true; this.connectorManager.setRows(0); DataTierTupleSource info = helpSetup(3); boolean blocked = false; while (true) { try { assertNull(info.nextTuple()); break; } catch (BlockedException e) { blocked = true; try { info.nextTuple(); fail(); } catch (BlockedException be) { //we won't bother to wait the full second } break; } } assertTrue(blocked); }
@Test public void testPartialResults() throws Exception { DataTierTupleSource info = helpSetup(1); connectorManager.throwExceptionOnExecute = true; for (int i = 0; i < 10; i++) { try { assertNull(info.nextTuple()); SourceWarning warning = (SourceWarning) context.getAndClearWarnings().get(0); assertTrue(warning.isPartialResultsError()); return; } catch (BlockedException e) { Thread.sleep(50); } } fail(); }
@Test public void testDataTierTupleSourceWarnings() throws Exception { DataTierTupleSource info = helpSetup(1); connectorManager.addWarning = true; assertEquals(10, pullTuples(info, 10)); assertNotNull(workItem.getConnectorRequest(info.getAtomicRequestMessage().getAtomicRequestID())); assertNull(info.nextTuple()); List<Exception> warnings = context.getAndClearWarnings(); assertEquals(1, warnings.size()); SourceWarning warning = (SourceWarning) warnings.get(0); assertFalse(warning.isPartialResultsError()); info.closeSource(); assertNull(workItem.getConnectorRequest(info.getAtomicRequestMessage().getAtomicRequestID())); }
@Test public void testDataTierTupleSource() throws Exception { DataTierTupleSource info = helpSetup(1); assertEquals(10, pullTuples(info, 10)); assertNotNull(workItem.getConnectorRequest(info.getAtomicRequestMessage().getAtomicRequestID())); assertNull(info.nextTuple()); info.closeSource(); assertNull(workItem.getConnectorRequest(info.getAtomicRequestMessage().getAtomicRequestID())); }
@Test public void testDataTierTupleSourceLimit() throws Exception { limit = 1; DataTierTupleSource info = helpSetup(1); assertEquals(1, pullTuples(info, 1)); assertNotNull(workItem.getConnectorRequest(info.getAtomicRequestMessage().getAtomicRequestID())); assertNull(info.nextTuple()); info.closeSource(); assertNull(workItem.getConnectorRequest(info.getAtomicRequestMessage().getAtomicRequestID())); }