@@ -0,0 +1,2232 @@
+package com.pinterest.secor.io.impl;%0A%0Aimport com.google.common.io.Files;%0Aimport com.pinterest.secor.common.LogFilePath;%0Aimport com.pinterest.secor.common.SecorConfig;%0Aimport com.pinterest.secor.io.FileReader;%0Aimport com.pinterest.secor.io.FileWriter;%0Aimport com.pinterest.secor.io.KeyValue;%0Aimport org.apache.commons.configuration.PropertiesConfiguration;%0Aimport org.apache.hadoop.io.compress.CompressionCodec;%0Aimport org.apache.hadoop.io.compress.GzipCodec;%0Aimport org.junit.Before;%0Aimport org.junit.Test;%0A%0Aimport static org.junit.Assert.assertArrayEquals;%0A%0Apublic class JsonORCFileReaderWriterFactoryTest %7B%0A%0A    private JsonORCFileReaderWriterFactory factory;%0A    private SecorConfig config;%0A    private CompressionCodec codec;%0A%0A    @Before%0A    public void setUp() throws Exception %7B%0A        PropertiesConfiguration properties = new PropertiesConfiguration();%0A        properties.setProperty(%22secor.orc.schema.provider%22, %22com.pinterest.secor.util.orc.schema.DefaultORCSchemaProvider%22);%0A        properties.setProperty(%22secor.orc.message.schema.test-topic%22, %22struct%3Cfirstname:string%5C%5C,age:int%3E%22);%0A        config = new SecorConfig(properties);%0A        factory = new JsonORCFileReaderWriterFactory(config);%0A        codec = new GzipCodec();%0A    %7D%0A%0A    @Test%0A    public void testJsonORCReadWriteRoundTrip() throws Exception %7B%0A        LogFilePath tempLogFilePath = new LogFilePath(Files.createTempDir().toString(),%0A            %22test-topic%22,%0A            new String%5B%5D%7B%22part-1%22%7D,%0A            0,%0A            1,%0A            0,%0A            %22.log%22%0A        );%0A%0A        FileWriter fileWriter = factory.BuildFileWriter(tempLogFilePath, codec);%0A        KeyValue kv1 = new KeyValue(23232, %22%7B%5C%22firstname%5C%22:%5C%22Jason%5C%22,%5C%22age%5C%22:48%7D%22.getBytes());%0A        KeyValue kv2 = new KeyValue(23233, %22%7B%5C%22firstname%5C%22:%5C%22Christina%5C%22,%5C%22age%5C%22:37%7D%22.getBytes());%0A        fileWriter.write(kv1);%0A        fileWriter.write(kv2);%0A        fileWriter.close();%0A%0A        FileReader fileReader = factory.BuildFileReader(tempLogFilePath, codec);%0A        KeyValue kv3 = fileReader.next();%0A        KeyValue kv4 = fileReader.next();%0A        fileReader.close();%0A%0A        assertArrayEquals(kv1.getValue(), kv3.getValue());%0A        assertArrayEquals(kv2.getValue(), kv4.getValue());%0A    %7D%0A%7D

Test case for JsonORCFileReaderWriterFactory