@Test void IngestFromResultSet_NullResultSetSourceInfo_IllegalArgumentException() { assertThrows( IllegalArgumentException.class, () -> queuedIngestClient.ingestFromResultSet(null, ingestionProperties)); }
@Override public IngestionResult ingestFromResultSet(ResultSetSourceInfo resultSetSourceInfo, IngestionProperties ingestionProperties) throws IngestionClientException, IngestionServiceException { Ensure.argIsNotNull(resultSetSourceInfo, "resultSetSourceInfo"); Ensure.argIsNotNull(ingestionProperties, "ingestionProperties"); resultSetSourceInfo.validate(); ingestionProperties.validate(); try { ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream(); new CsvRoutines().write(resultSetSourceInfo.getResultSet(), byteArrayOutputStream); byteArrayOutputStream.flush(); ByteArrayInputStream byteArrayInputStream = new ByteArrayInputStream(byteArrayOutputStream.toByteArray()); StreamSourceInfo streamSourceInfo = new StreamSourceInfo(byteArrayInputStream); return ingestFromStream(streamSourceInfo, ingestionProperties); } catch (IOException ex) { String msg = "Failed to read from ResultSet."; log.error(msg, ex); throw new IngestionClientException(msg, ex); } }
QueuedIngestClient implements IngestClient { @Override public IngestionResult ingestFromResultSet(ResultSetSourceInfo resultSetSourceInfo, IngestionProperties ingestionProperties) throws IngestionClientException, IngestionServiceException { Ensure.argIsNotNull(resultSetSourceInfo, "resultSetSourceInfo"); Ensure.argIsNotNull(ingestionProperties, "ingestionProperties"); resultSetSourceInfo.validate(); ingestionProperties.validate(); try { ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream(); new CsvRoutines().write(resultSetSourceInfo.getResultSet(), byteArrayOutputStream); byteArrayOutputStream.flush(); ByteArrayInputStream byteArrayInputStream = new ByteArrayInputStream(byteArrayOutputStream.toByteArray()); StreamSourceInfo streamSourceInfo = new StreamSourceInfo(byteArrayInputStream); return ingestFromStream(streamSourceInfo, ingestionProperties); } catch (IOException ex) { String msg = "Failed to read from ResultSet."; log.error(msg, ex); throw new IngestionClientException(msg, ex); } } }
QueuedIngestClient implements IngestClient { @Override public IngestionResult ingestFromResultSet(ResultSetSourceInfo resultSetSourceInfo, IngestionProperties ingestionProperties) throws IngestionClientException, IngestionServiceException { Ensure.argIsNotNull(resultSetSourceInfo, "resultSetSourceInfo"); Ensure.argIsNotNull(ingestionProperties, "ingestionProperties"); resultSetSourceInfo.validate(); ingestionProperties.validate(); try { ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream(); new CsvRoutines().write(resultSetSourceInfo.getResultSet(), byteArrayOutputStream); byteArrayOutputStream.flush(); ByteArrayInputStream byteArrayInputStream = new ByteArrayInputStream(byteArrayOutputStream.toByteArray()); StreamSourceInfo streamSourceInfo = new StreamSourceInfo(byteArrayInputStream); return ingestFromStream(streamSourceInfo, ingestionProperties); } catch (IOException ex) { String msg = "Failed to read from ResultSet."; log.error(msg, ex); throw new IngestionClientException(msg, ex); } } QueuedIngestClient(ConnectionStringBuilder csb);   QueuedIngestClient(ResourceManager resourceManager);   QueuedIngestClient(ResourceManager resourceManager, AzureStorageClient azureStorageClient); }
QueuedIngestClient implements IngestClient { @Override public IngestionResult ingestFromResultSet(ResultSetSourceInfo resultSetSourceInfo, IngestionProperties ingestionProperties) throws IngestionClientException, IngestionServiceException { Ensure.argIsNotNull(resultSetSourceInfo, "resultSetSourceInfo"); Ensure.argIsNotNull(ingestionProperties, "ingestionProperties"); resultSetSourceInfo.validate(); ingestionProperties.validate(); try { ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream(); new CsvRoutines().write(resultSetSourceInfo.getResultSet(), byteArrayOutputStream); byteArrayOutputStream.flush(); ByteArrayInputStream byteArrayInputStream = new ByteArrayInputStream(byteArrayOutputStream.toByteArray()); StreamSourceInfo streamSourceInfo = new StreamSourceInfo(byteArrayInputStream); return ingestFromStream(streamSourceInfo, ingestionProperties); } catch (IOException ex) { String msg = "Failed to read from ResultSet."; log.error(msg, ex); throw new IngestionClientException(msg, ex); } } QueuedIngestClient(ConnectionStringBuilder csb);   QueuedIngestClient(ResourceManager resourceManager);   QueuedIngestClient(ResourceManager resourceManager, AzureStorageClient azureStorageClient); @Override IngestionResult ingestFromBlob(BlobSourceInfo blobSourceInfo, IngestionProperties ingestionProperties); @Override IngestionResult ingestFromFile(FileSourceInfo fileSourceInfo, IngestionProperties ingestionProperties); @Override IngestionResult ingestFromStream(StreamSourceInfo streamSourceInfo, IngestionProperties ingestionProperties); @Override IngestionResult ingestFromResultSet(ResultSetSourceInfo resultSetSourceInfo, IngestionProperties ingestionProperties); @Override void close(); }
QueuedIngestClient implements IngestClient { @Override public IngestionResult ingestFromResultSet(ResultSetSourceInfo resultSetSourceInfo, IngestionProperties ingestionProperties) throws IngestionClientException, IngestionServiceException { Ensure.argIsNotNull(resultSetSourceInfo, "resultSetSourceInfo"); Ensure.argIsNotNull(ingestionProperties, "ingestionProperties"); resultSetSourceInfo.validate(); ingestionProperties.validate(); try { ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream(); new CsvRoutines().write(resultSetSourceInfo.getResultSet(), byteArrayOutputStream); byteArrayOutputStream.flush(); ByteArrayInputStream byteArrayInputStream = new ByteArrayInputStream(byteArrayOutputStream.toByteArray()); StreamSourceInfo streamSourceInfo = new StreamSourceInfo(byteArrayInputStream); return ingestFromStream(streamSourceInfo, ingestionProperties); } catch (IOException ex) { String msg = "Failed to read from ResultSet."; log.error(msg, ex); throw new IngestionClientException(msg, ex); } } QueuedIngestClient(ConnectionStringBuilder csb);   QueuedIngestClient(ResourceManager resourceManager);   QueuedIngestClient(ResourceManager resourceManager, AzureStorageClient azureStorageClient); @Override IngestionResult ingestFromBlob(BlobSourceInfo blobSourceInfo, IngestionProperties ingestionProperties); @Override IngestionResult ingestFromFile(FileSourceInfo fileSourceInfo, IngestionProperties ingestionProperties); @Override IngestionResult ingestFromStream(StreamSourceInfo streamSourceInfo, IngestionProperties ingestionProperties); @Override IngestionResult ingestFromResultSet(ResultSetSourceInfo resultSetSourceInfo, IngestionProperties ingestionProperties); @Override void close(); static final String INGEST_PREFIX; static final String EXPECTED_SERVICE_TYPE; }