use of org.apache.flink.table.descriptors.DescriptorProperties in project flink by apache.
the class FileSystemTableFactoryTest method testSourceSink.
@Test
public void testSourceSink() {
DescriptorProperties descriptor = new DescriptorProperties();
descriptor.putString(FactoryUtil.CONNECTOR.key(), "filesystem");
descriptor.putString("path", "/tmp");
descriptor.putString("format", "testcsv");
// test ignore format options
descriptor.putString("testcsv.my_option", "my_value");
DynamicTableSource source = createTableSource(SCHEMA, descriptor.asMap());
assertTrue(source instanceof FileSystemTableSource);
DynamicTableSink sink = createTableSink(SCHEMA, descriptor.asMap());
assertTrue(sink instanceof FileSystemTableSink);
}
use of org.apache.flink.table.descriptors.DescriptorProperties in project flink by apache.
the class FileSystemTableFactoryTest method testUnsupportedWatermarkTimeZone.
@Test
public void testUnsupportedWatermarkTimeZone() {
DescriptorProperties descriptor = new DescriptorProperties();
descriptor.putString(FactoryUtil.CONNECTOR.key(), "filesystem");
descriptor.putString("path", "/tmp");
descriptor.putString("format", "csv");
descriptor.putString(SINK_PARTITION_COMMIT_WATERMARK_TIME_ZONE.key(), "UTC+8");
try {
createTableSource(SCHEMA, descriptor.asMap());
} catch (ValidationException e) {
Throwable cause = e.getCause();
assertTrue(cause.toString(), cause instanceof ValidationException);
assertTrue(cause.getMessage(), cause.getMessage().contains("The supported watermark time zone is either a full name such " + "as 'America/Los_Angeles', or a custom time zone id such " + "as 'GMT-08:00', but configured time zone is 'UTC+8'."));
return;
}
fail("Should fail by ValidationException.");
}
use of org.apache.flink.table.descriptors.DescriptorProperties in project flink by apache.
the class FileSystemTableFactoryTest method testLackOptionSink.
@Test
public void testLackOptionSink() {
DescriptorProperties descriptor = new DescriptorProperties();
descriptor.putString(FactoryUtil.CONNECTOR.key(), "filesystem");
descriptor.putString("path", "/tmp");
try {
createTableSink(SCHEMA, descriptor.asMap());
} catch (ValidationException e) {
Throwable cause = e.getCause();
assertTrue(cause.toString(), cause instanceof ValidationException);
assertTrue(cause.getMessage(), cause.getMessage().contains("Missing required options are:\n\nformat"));
return;
}
fail("Should fail by ValidationException.");
}
use of org.apache.flink.table.descriptors.DescriptorProperties in project flink by apache.
the class FileSystemTableFactoryTest method testLackOptionSource.
@Test
public void testLackOptionSource() {
DescriptorProperties descriptor = new DescriptorProperties();
descriptor.putString(FactoryUtil.CONNECTOR.key(), "filesystem");
descriptor.putString("path", "/tmp");
try {
createTableSource(SCHEMA, descriptor.asMap());
} catch (ValidationException e) {
Throwable cause = e.getCause();
assertTrue(cause.toString(), cause instanceof ValidationException);
assertTrue(cause.getMessage(), cause.getMessage().contains("Missing required options are:\n\nformat"));
return;
}
fail("Should fail by ValidationException.");
}
use of org.apache.flink.table.descriptors.DescriptorProperties in project flink by apache.
the class FileSystemTableFactoryTest method testNoFormatFactoryFound.
@Test
public void testNoFormatFactoryFound() {
DescriptorProperties descriptor = new DescriptorProperties();
descriptor.putString(FactoryUtil.CONNECTOR.key(), "filesystem");
descriptor.putString("path", "/tmp");
descriptor.putString("format", "invalid");
Exception expected = new ValidationException("Could not find any format factory for identifier 'invalid' in the classpath.");
try {
createTableSource(SCHEMA, descriptor.asMap());
fail("Should fail");
} catch (Exception e) {
assertThat(e.getCause(), containsCause(expected));
}
try {
createTableSink(SCHEMA, descriptor.asMap());
fail("Should fail");
} catch (Exception e) {
assertThat(e.getCause(), containsCause(expected));
}
}
Aggregations