use of org.apache.beam.sdk.transforms.display.DisplayData in project beam by apache.
the class TFRecordIOTest method testWriteDisplayData.
@Test
public void testWriteDisplayData() {
// TODO: Java core test failing on windows, https://issues.apache.org/jira/browse/BEAM-10739
assumeFalse(SystemUtils.IS_OS_WINDOWS);
TFRecordIO.Write write = TFRecordIO.write().to("/foo").withSuffix("bar").withShardNameTemplate("-SS-of-NN-").withNumShards(100).withCompression(GZIP);
DisplayData displayData = DisplayData.from(write);
assertThat(displayData, hasDisplayItem("filePrefix", "/foo"));
assertThat(displayData, hasDisplayItem("fileSuffix", "bar"));
assertThat(displayData, hasDisplayItem("shardNameTemplate", "-SS-of-NN-"));
assertThat(displayData, hasDisplayItem("numShards", 100));
assertThat(displayData, hasDisplayItem("compressionType", GZIP.toString()));
}
use of org.apache.beam.sdk.transforms.display.DisplayData in project beam by apache.
the class GenerateSequenceTest method testBoundedDisplayData.
@Test
public void testBoundedDisplayData() {
PTransform<?, ?> input = GenerateSequence.from(0).to(1234);
DisplayData displayData = DisplayData.from(input);
assertThat(displayData, hasDisplayItem("from", 0));
assertThat(displayData, hasDisplayItem("to", 1234));
}
use of org.apache.beam.sdk.transforms.display.DisplayData in project beam by apache.
the class KafkaIOTest method testSinkDisplayData.
@Test
public void testSinkDisplayData() {
try (MockProducerWrapper producerWrapper = new MockProducerWrapper()) {
KafkaIO.Write<Integer, Long> write = KafkaIO.<Integer, Long>write().withBootstrapServers("myServerA:9092,myServerB:9092").withTopic("myTopic").withValueSerializer(LongSerializer.class).withProducerFactoryFn(new ProducerFactoryFn(producerWrapper.producerKey)).withProducerConfigUpdates(ImmutableMap.of("retry.backoff.ms", 100));
DisplayData displayData = DisplayData.from(write);
assertThat(displayData, hasDisplayItem("topic", "myTopic"));
assertThat(displayData, hasDisplayItem("bootstrap.servers", "myServerA:9092,myServerB:9092"));
assertThat(displayData, hasDisplayItem("retries", 3));
assertThat(displayData, hasDisplayItem("retry.backoff.ms", 100));
}
}
use of org.apache.beam.sdk.transforms.display.DisplayData in project beam by apache.
the class KafkaIOTest method testSourceDisplayData.
@Test
public void testSourceDisplayData() {
KafkaIO.Read<Integer, Long> read = mkKafkaReadTransform(10, null);
DisplayData displayData = DisplayData.from(read);
assertThat(displayData, hasDisplayItem("topics", "topic_a,topic_b"));
assertThat(displayData, hasDisplayItem("enable.auto.commit", false));
assertThat(displayData, hasDisplayItem("bootstrap.servers", "myServer1:9092,myServer2:9092"));
assertThat(displayData, hasDisplayItem("auto.offset.reset", "latest"));
assertThat(displayData, hasDisplayItem("receive.buffer.bytes", 524288));
}
use of org.apache.beam.sdk.transforms.display.DisplayData in project beam by apache.
the class CalendarWindowsTest method testDisplayData.
@Test
public void testDisplayData() {
DateTimeZone timeZone = DateTimeZone.forID("America/Los_Angeles");
Instant jan1 = new DateTime(1990, 1, 1, 0, 0, timeZone).toInstant();
CalendarWindows.DaysWindows daysWindow = CalendarWindows.days(5).withStartingDay(1990, 1, 1).withTimeZone(timeZone);
DisplayData daysDisplayData = DisplayData.from(daysWindow);
assertThat(daysDisplayData, hasDisplayItem("numDays", 5));
assertThat(daysDisplayData, hasDisplayItem("startDate", jan1));
CalendarWindows.MonthsWindows monthsWindow = CalendarWindows.months(2).withStartingMonth(1990, 1).withTimeZone(timeZone);
DisplayData monthsDisplayData = DisplayData.from(monthsWindow);
assertThat(monthsDisplayData, hasDisplayItem("numMonths", 2));
assertThat(monthsDisplayData, hasDisplayItem("startDate", jan1));
CalendarWindows.YearsWindows yearsWindow = CalendarWindows.years(4).withStartingYear(1990).withTimeZone(timeZone);
DisplayData yearsDisplayData = DisplayData.from(yearsWindow);
assertThat(yearsDisplayData, hasDisplayItem("numYears", 4));
assertThat(yearsDisplayData, hasDisplayItem("startDate", jan1));
}
Aggregations