Skip to content

Commit 7c04d82

Browse files
committed
Remove default content type, so config will return default content type
1 parent 401aa5e commit 7c04d82

File tree

1 file changed

+16
-11
lines changed
  • integration-test-remote/src/test/java/io/cdap/cdap/app/etl/gcp

1 file changed

+16
-11
lines changed

integration-test-remote/src/test/java/io/cdap/cdap/app/etl/gcp/GCSTest.java

Lines changed: 16 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424
import com.google.cloud.storage.Storage;
2525
import com.google.cloud.storage.StorageOptions;
2626
import com.google.common.base.Preconditions;
27+
import com.google.common.base.Strings;
2728
import com.google.common.collect.ImmutableMap;
2829
import com.google.common.io.Files;
2930
import com.google.gson.Gson;
@@ -120,7 +121,6 @@ public class GCSTest extends DataprocETLTestBase {
120121

121122
private static Storage storage;
122123
private List<String> markedForDeleteBuckets;
123-
private static final String DEFAULT_CONTENT_TYPE = "application/octet-stream";
124124
private static final String CSV_CONTENT_TYPE = "text/csv";
125125
private static final String MULTISINK_RUNTIME_ARG = "multisink.%s";
126126

@@ -741,7 +741,7 @@ public void testGcsSourceFormats() throws Exception {
741741
ETLBatchConfig.Builder pipelineConfig = ETLBatchConfig.builder().addStage(source);
742742
for (String format : formats) {
743743
String path = String.format("%s/%s/%s", createPath(bucket, OUTPUT_BLOB_NAME), format, suffix);
744-
ETLStage sink = new ETLStage(format, createSinkPlugin(format, path, schema, DEFAULT_CONTENT_TYPE));
744+
ETLStage sink = new ETLStage(format, createSinkPlugin(format, path, schema));
745745
pipelineConfig.addStage(sink).addConnection(source.getName(), sink.getName());
746746
}
747747

@@ -873,16 +873,21 @@ private ETLStage createSourceStage(String format, String path, String regex, Sch
873873
GOOGLE_CLOUD_ARTIFACT));
874874
}
875875

876+
private ETLPlugin createSinkPlugin(String format, String path, Schema schema) {
877+
return createSinkPlugin(format, path, schema, null);
878+
}
879+
876880
private ETLPlugin createSinkPlugin(String format, String path, Schema schema, String contentType) {
877-
return new ETLPlugin(SINK_PLUGIN_NAME, BatchSink.PLUGIN_TYPE,
878-
new ImmutableMap.Builder<String, String>()
879-
.put("path", path)
880-
.put("format", format)
881-
.put("project", getProjectId())
882-
.put("referenceName", format)
883-
.put("schema", schema.toString())
884-
.put("contentType", contentType).build(),
885-
GOOGLE_CLOUD_ARTIFACT);
881+
ImmutableMap.Builder<String, String> propertyBuilder = new ImmutableMap.Builder<String, String>()
882+
.put("path", path)
883+
.put("format", format)
884+
.put("project", getProjectId())
885+
.put("referenceName", format)
886+
.put("schema", schema.toString());
887+
if (!Strings.isNullOrEmpty(contentType)) {
888+
propertyBuilder.put("contentType", contentType);
889+
}
890+
return new ETLPlugin(SINK_PLUGIN_NAME, BatchSink.PLUGIN_TYPE, propertyBuilder.build(), GOOGLE_CLOUD_ARTIFACT);
886891
}
887892

888893
private ETLPlugin createMultiSinkPlugin(String format, String path, Schema schema, String contentType,

0 commit comments

Comments
 (0)