@Test void IngestFromBlob_InvalidBlobPath_IngestionClientException() { String path = "wrongURI"; BlobSourceInfo blobSourceInfo1 = new BlobSourceInfo(path); IngestionClientException ingestionClientException = assertThrows(IngestionClientException.class, () -> streamingIngestClient.ingestFromBlob(blobSourceInfo1, ingestionProperties), "Expected IngestionClientException to be thrown, but it didn't"); assertTrue(ingestionClientException.getMessage().contains("Unexpected error when ingesting a blob - Invalid blob path.")); }
@Override public IngestionResult ingestFromBlob(BlobSourceInfo blobSourceInfo, IngestionProperties ingestionProperties) throws IngestionClientException, IngestionServiceException { log.warn("Ingesting from blob using the StreamingIngestClient is not recommended, consider using the IngestClient instead."); Ensure.argIsNotNull(blobSourceInfo, "blobSourceInfo"); Ensure.argIsNotNull(ingestionProperties, "ingestionProperties"); blobSourceInfo.validate(); ingestionProperties.validate(); try { CloudBlockBlob cloudBlockBlob = new CloudBlockBlob(new URI(blobSourceInfo.getBlobPath())); return ingestFromBlob(blobSourceInfo, ingestionProperties, cloudBlockBlob); } catch (URISyntaxException | IllegalArgumentException e) { String msg = "Unexpected error when ingesting a blob - Invalid blob path."; log.error(msg, e); throw new IngestionClientException(msg, e); } catch (StorageException e) { String msg = "Unexpected Storage error when ingesting a blob."; log.error(msg, e); throw new IngestionClientException(msg, e); } }
StreamingIngestClient implements IngestClient { @Override public IngestionResult ingestFromBlob(BlobSourceInfo blobSourceInfo, IngestionProperties ingestionProperties) throws IngestionClientException, IngestionServiceException { log.warn("Ingesting from blob using the StreamingIngestClient is not recommended, consider using the IngestClient instead."); Ensure.argIsNotNull(blobSourceInfo, "blobSourceInfo"); Ensure.argIsNotNull(ingestionProperties, "ingestionProperties"); blobSourceInfo.validate(); ingestionProperties.validate(); try { CloudBlockBlob cloudBlockBlob = new CloudBlockBlob(new URI(blobSourceInfo.getBlobPath())); return ingestFromBlob(blobSourceInfo, ingestionProperties, cloudBlockBlob); } catch (URISyntaxException | IllegalArgumentException e) { String msg = "Unexpected error when ingesting a blob - Invalid blob path."; log.error(msg, e); throw new IngestionClientException(msg, e); } catch (StorageException e) { String msg = "Unexpected Storage error when ingesting a blob."; log.error(msg, e); throw new IngestionClientException(msg, e); } } }
StreamingIngestClient implements IngestClient { @Override public IngestionResult ingestFromBlob(BlobSourceInfo blobSourceInfo, IngestionProperties ingestionProperties) throws IngestionClientException, IngestionServiceException { log.warn("Ingesting from blob using the StreamingIngestClient is not recommended, consider using the IngestClient instead."); Ensure.argIsNotNull(blobSourceInfo, "blobSourceInfo"); Ensure.argIsNotNull(ingestionProperties, "ingestionProperties"); blobSourceInfo.validate(); ingestionProperties.validate(); try { CloudBlockBlob cloudBlockBlob = new CloudBlockBlob(new URI(blobSourceInfo.getBlobPath())); return ingestFromBlob(blobSourceInfo, ingestionProperties, cloudBlockBlob); } catch (URISyntaxException | IllegalArgumentException e) { String msg = "Unexpected error when ingesting a blob - Invalid blob path."; log.error(msg, e); throw new IngestionClientException(msg, e); } catch (StorageException e) { String msg = "Unexpected Storage error when ingesting a blob."; log.error(msg, e); throw new IngestionClientException(msg, e); } } StreamingIngestClient(ConnectionStringBuilder csb);   StreamingIngestClient(StreamingClient streamingClient); }
StreamingIngestClient implements IngestClient { @Override public IngestionResult ingestFromBlob(BlobSourceInfo blobSourceInfo, IngestionProperties ingestionProperties) throws IngestionClientException, IngestionServiceException { log.warn("Ingesting from blob using the StreamingIngestClient is not recommended, consider using the IngestClient instead."); Ensure.argIsNotNull(blobSourceInfo, "blobSourceInfo"); Ensure.argIsNotNull(ingestionProperties, "ingestionProperties"); blobSourceInfo.validate(); ingestionProperties.validate(); try { CloudBlockBlob cloudBlockBlob = new CloudBlockBlob(new URI(blobSourceInfo.getBlobPath())); return ingestFromBlob(blobSourceInfo, ingestionProperties, cloudBlockBlob); } catch (URISyntaxException | IllegalArgumentException e) { String msg = "Unexpected error when ingesting a blob - Invalid blob path."; log.error(msg, e); throw new IngestionClientException(msg, e); } catch (StorageException e) { String msg = "Unexpected Storage error when ingesting a blob."; log.error(msg, e); throw new IngestionClientException(msg, e); } } StreamingIngestClient(ConnectionStringBuilder csb);   StreamingIngestClient(StreamingClient streamingClient); @Override IngestionResult ingestFromFile(FileSourceInfo fileSourceInfo, IngestionProperties ingestionProperties); @Override IngestionResult ingestFromBlob(BlobSourceInfo blobSourceInfo, IngestionProperties ingestionProperties); @Override IngestionResult ingestFromResultSet(ResultSetSourceInfo resultSetSourceInfo, IngestionProperties ingestionProperties); @Override IngestionResult ingestFromStream(StreamSourceInfo streamSourceInfo, IngestionProperties ingestionProperties); @Override void close(); }
StreamingIngestClient implements IngestClient { @Override public IngestionResult ingestFromBlob(BlobSourceInfo blobSourceInfo, IngestionProperties ingestionProperties) throws IngestionClientException, IngestionServiceException { log.warn("Ingesting from blob using the StreamingIngestClient is not recommended, consider using the IngestClient instead."); Ensure.argIsNotNull(blobSourceInfo, "blobSourceInfo"); Ensure.argIsNotNull(ingestionProperties, "ingestionProperties"); blobSourceInfo.validate(); ingestionProperties.validate(); try { CloudBlockBlob cloudBlockBlob = new CloudBlockBlob(new URI(blobSourceInfo.getBlobPath())); return ingestFromBlob(blobSourceInfo, ingestionProperties, cloudBlockBlob); } catch (URISyntaxException | IllegalArgumentException e) { String msg = "Unexpected error when ingesting a blob - Invalid blob path."; log.error(msg, e); throw new IngestionClientException(msg, e); } catch (StorageException e) { String msg = "Unexpected Storage error when ingesting a blob."; log.error(msg, e); throw new IngestionClientException(msg, e); } } StreamingIngestClient(ConnectionStringBuilder csb);   StreamingIngestClient(StreamingClient streamingClient); @Override IngestionResult ingestFromFile(FileSourceInfo fileSourceInfo, IngestionProperties ingestionProperties); @Override IngestionResult ingestFromBlob(BlobSourceInfo blobSourceInfo, IngestionProperties ingestionProperties); @Override IngestionResult ingestFromResultSet(ResultSetSourceInfo resultSetSourceInfo, IngestionProperties ingestionProperties); @Override IngestionResult ingestFromStream(StreamSourceInfo streamSourceInfo, IngestionProperties ingestionProperties); @Override void close();  }