@Test void generateName() { QueuedIngestClient ingestClient = new QueuedIngestClient(resourceManagerMock, azureStorageClientMock); class Holder { private String name; } final Holder holder = new Holder(); holder.name = "fileName"; BiFunction<IngestionProperties.DATA_FORMAT, CompressionType, String> genName = (IngestionProperties.DATA_FORMAT format, CompressionType compression) -> { boolean shouldCompress = AzureStorageClient.shouldCompress(compression, format.name()); return ingestClient.genBlobName( holder.name, "db1", "t1", format.name(), shouldCompress ? CompressionType.gz : compression); }; String csvNoCompression = genName.apply(DATA_FORMAT.csv, null); assert(csvNoCompression.endsWith("fileName.csv.gz")); String csvCompression = genName.apply(DATA_FORMAT.csv, CompressionType.zip); assert(csvCompression.endsWith("fileName.csv.zip")); String parquet = genName.apply(DATA_FORMAT.parquet, null); assert(parquet.endsWith("fileName.parquet")); String avroLocalFileName = "avi.avro"; String avroLocalCompressFileName = "avi.avro.gz"; CompressionType compressionTypeRes = AzureStorageClient.getCompression(avroLocalFileName); CompressionType compressionTypeRes2 = AzureStorageClient.getCompression(avroLocalCompressFileName); holder.name = avroLocalFileName; String avroName = genName.apply(DATA_FORMAT.avro, compressionTypeRes); assert(avroName.endsWith("avi.avro.avro.gz")); holder.name = avroLocalCompressFileName; String avroNameCompression = genName.apply(DATA_FORMAT.avro, compressionTypeRes2); assert(avroNameCompression.endsWith("avi.avro.gz.avro.gz")); }
String genBlobName(String fileName, String databaseName, String tableName, String dataFormat, CompressionType compressionType) { return String.format("%s__%s__%s__%s%s%s", databaseName, tableName, UUID.randomUUID().toString(), fileName, dataFormat == null ? "" : "." + dataFormat, compressionType == null ? "" : "." + compressionType); }
QueuedIngestClient implements IngestClient { String genBlobName(String fileName, String databaseName, String tableName, String dataFormat, CompressionType compressionType) { return String.format("%s__%s__%s__%s%s%s", databaseName, tableName, UUID.randomUUID().toString(), fileName, dataFormat == null ? "" : "." + dataFormat, compressionType == null ? "" : "." + compressionType); } }
QueuedIngestClient implements IngestClient { String genBlobName(String fileName, String databaseName, String tableName, String dataFormat, CompressionType compressionType) { return String.format("%s__%s__%s__%s%s%s", databaseName, tableName, UUID.randomUUID().toString(), fileName, dataFormat == null ? "" : "." + dataFormat, compressionType == null ? "" : "." + compressionType); } QueuedIngestClient(ConnectionStringBuilder csb);   QueuedIngestClient(ResourceManager resourceManager);   QueuedIngestClient(ResourceManager resourceManager, AzureStorageClient azureStorageClient); }
QueuedIngestClient implements IngestClient { String genBlobName(String fileName, String databaseName, String tableName, String dataFormat, CompressionType compressionType) { return String.format("%s__%s__%s__%s%s%s", databaseName, tableName, UUID.randomUUID().toString(), fileName, dataFormat == null ? "" : "." + dataFormat, compressionType == null ? "" : "." + compressionType); } 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 { String genBlobName(String fileName, String databaseName, String tableName, String dataFormat, CompressionType compressionType) { return String.format("%s__%s__%s__%s%s%s", databaseName, tableName, UUID.randomUUID().toString(), fileName, dataFormat == null ? "" : "." + dataFormat, compressionType == null ? "" : "." + compressionType); } 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; }