Successfully cause java.lang.IllegalArgumentException
For Unhandled type uniontype<int,string>
@@ -56,6 +56,25 @@ public class JsonORCFileReaderWriterFactoryTest {
FileWriter fileWriter = factory.BuildFileWriter(tempLogFilePath, codec);
}
+ @Test(expected = IllegalArgumentException.class)
+ public void testUnionType() throws Exception {
+ PropertiesConfiguration properties = new PropertiesConfiguration();
+ properties.setProperty("secor.orc.schema.provider", DEFAULT_ORC_SCHEMA_PROVIDER);
+ properties.setProperty("secor.orc.message.schema.test-topic-union", "struct<values:uniontype<int\\,string>>");
+
+ SecorConfig config = new SecorConfig(properties);
+ JsonORCFileReaderWriterFactory factory = new JsonORCFileReaderWriterFactory(config);
+
+ LogFilePath tempLogFilePath = getTempLogFilePath("test-topic-union");
+
+ FileWriter fileWriter = factory.BuildFileWriter(tempLogFilePath, codec);
+ KeyValue written1 = new KeyValue(10001, "{\"values\":\"stringvalue\"}".getBytes());
+ KeyValue written2 = new KeyValue(10002, "{\"values\":1234}".getBytes());
+ fileWriter.write(written1);
+ fileWriter.write(written2);
+ fileWriter.close();
+ }
+
@Test
public void testMapOfStringToString() throws Exception {
PropertiesConfiguration properties = new PropertiesConfiguration();
