Search in sources :

Example 1 with SegmentizerModule

use of io.druid.jackson.SegmentizerModule in project druid by druid-io.

the class SegmentizerFactoryTest method testFactory.

@Test
public void testFactory() throws IOException {
    File factoryFile = Files.createTempFile("", "factory.json").toFile();
    FileOutputStream fos = new FileOutputStream(factoryFile);
    ObjectMapper mapper = new DefaultObjectMapper();
    mapper.registerModule(new SegmentizerModule());
    IndexIO indexIO = new IndexIO(mapper, new ColumnConfig() {

        @Override
        public int columnCacheSizeBytes() {
            return 777;
        }
    });
    mapper.setInjectableValues(new InjectableValues.Std().addValue(IndexIO.class, indexIO));
    mapper.writeValue(fos, new MMappedQueryableSegmentizerFactory(indexIO));
    fos.close();
    SegmentizerFactory factory = mapper.readValue(factoryFile, SegmentizerFactory.class);
    Assert.assertTrue(factory instanceof MMappedQueryableSegmentizerFactory);
}
Also used : IndexIO(io.druid.segment.IndexIO) ColumnConfig(io.druid.segment.column.ColumnConfig) FileOutputStream(java.io.FileOutputStream) SegmentizerModule(io.druid.jackson.SegmentizerModule) DefaultObjectMapper(io.druid.jackson.DefaultObjectMapper) File(java.io.File) DefaultObjectMapper(io.druid.jackson.DefaultObjectMapper) ObjectMapper(com.fasterxml.jackson.databind.ObjectMapper) Test(org.junit.Test)

Aggregations

ObjectMapper (com.fasterxml.jackson.databind.ObjectMapper)1 DefaultObjectMapper (io.druid.jackson.DefaultObjectMapper)1 SegmentizerModule (io.druid.jackson.SegmentizerModule)1 IndexIO (io.druid.segment.IndexIO)1 ColumnConfig (io.druid.segment.column.ColumnConfig)1 File (java.io.File)1 FileOutputStream (java.io.FileOutputStream)1 Test (org.junit.Test)1