SerializerConfig extends MapConfig { public static String getPredefinedSerdeFactoryName(String serdeName) { String serdeFactoryName = doGetPredefinedSerdeFactoryName(serdeName); LOGGER.info("Using default serde {} for serde name {}", serdeFactoryName, serdeName); return serdeFactoryName; } SerializerConfig(Config config); static String getPredefinedSerdeFactoryName(String serdeName); Optional<String> getSerdeFactoryClass(String name); List<String> getSerdeNames(); static final Logger LOGGER; static final String SERIALIZER_PREFIX; static final String SERDE_FACTORY_CLASS; static final String SERIALIZED_INSTANCE_SUFFIX; static final String SERDE_SERIALIZED_INSTANCE; }
@Test public void testGetPredefinedSerdeFactoryName() { assertEquals(ByteSerdeFactory.class.getName(), SerializerConfig.getPredefinedSerdeFactoryName("byte")); assertEquals(ByteBufferSerdeFactory.class.getName(), SerializerConfig.getPredefinedSerdeFactoryName("bytebuffer")); assertEquals(IntegerSerdeFactory.class.getName(), SerializerConfig.getPredefinedSerdeFactoryName("integer")); assertEquals(JsonSerdeFactory.class.getName(), SerializerConfig.getPredefinedSerdeFactoryName("json")); assertEquals(LongSerdeFactory.class.getName(), SerializerConfig.getPredefinedSerdeFactoryName("long")); assertEquals(SerializableSerdeFactory.class.getName(), SerializerConfig.getPredefinedSerdeFactoryName("serializable")); assertEquals(StringSerdeFactory.class.getName(), SerializerConfig.getPredefinedSerdeFactoryName("string")); assertEquals(DoubleSerdeFactory.class.getName(), SerializerConfig.getPredefinedSerdeFactoryName("double")); }
@Test(expected = SamzaException.class) public void testGetSerdeFactoryNameUnknown() { SerializerConfig.getPredefinedSerdeFactoryName("otherName"); }