Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -667,7 +667,7 @@ public Bound<T> withoutValidation() {
*/
public Bound<T> withHeader(@Nullable String header) {
return new Bound<>(name, filenamePrefix, filenameSuffix, header, footer, coder, numShards,
shardTemplate, false, writableByteChannelFactory);
shardTemplate, validate, writableByteChannelFactory);
}

/**
Expand All @@ -682,7 +682,7 @@ public Bound<T> withHeader(@Nullable String header) {
*/
public Bound<T> withFooter(@Nullable String footer) {
return new Bound<>(name, filenamePrefix, filenameSuffix, header, footer, coder, numShards,
shardTemplate, false, writableByteChannelFactory);
shardTemplate, validate, writableByteChannelFactory);
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@
import static org.hamcrest.Matchers.greaterThan;
import static org.hamcrest.Matchers.hasItem;
import static org.hamcrest.Matchers.hasSize;
import static org.hamcrest.Matchers.not;
import static org.hamcrest.Matchers.startsWith;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
Expand Down Expand Up @@ -556,6 +557,30 @@ public void testWriteDisplayData() {
assertThat(displayData, hasDisplayItem("writableByteChannelFactory", "UNCOMPRESSED"));
}

@Test
public void testWriteDisplayDataValidateThenHeader() {
TextIO.Write.Bound<?> write = TextIO.Write
.to("foo")
.withHeader("myHeader");

DisplayData displayData = DisplayData.from(write);

assertThat(displayData, hasDisplayItem("fileHeader", "myHeader"));
assertThat(displayData, not(hasDisplayItem("validation", false)));
}

@Test
public void testWriteDisplayDataValidateThenFooter() {
TextIO.Write.Bound<?> write = TextIO.Write
.to("foo")
.withFooter("myFooter");

DisplayData displayData = DisplayData.from(write);

assertThat(displayData, hasDisplayItem("fileFooter", "myFooter"));
assertThat(displayData, not(hasDisplayItem("validation", false)));
}

@Test
@Category(RunnableOnService.class)
@Ignore("[BEAM-436] DirectRunner RunnableOnService tempLocation configuration insufficient")
Expand Down