private Map<String, Serde> validateAndGetDeserializedSerdes(Config jobConfig, int numSerdes) { Config serializers = jobConfig.subset("serializers.registry.", true); // make sure that the serializers deserialize correctly SerializableSerde<Serde> serializableSerde = new SerializableSerde<>(); assertEquals(numSerdes, serializers.size()); return serializers.entrySet().stream().collect(Collectors.toMap( e -> e.getKey().replace(SerializerConfig.SERIALIZED_INSTANCE_SUFFIX(), ""), e -> serializableSerde.fromBytes(Base64.getDecoder().decode(e.getValue().getBytes())) )); }
@Test public void testMinimal() { Config jobConfig = createJobConfig(); Assert.assertEquals(2, jobConfig.size()); Map<String, String> tableConfig = createTableDescriptor().toConfig(jobConfig); Assert.assertNotNull(tableConfig); Assert.assertEquals(1, tableConfig.size()); }
@Test public void testComputeSamzaConfigs() { Map<String, String> configs = SamzaSqlTestConfig.fetchStaticConfigsWithFactories(10); String sql1 = "Insert into testavro.outputTopic(id,long_value) select id, MyTest(id) as long_value from testavro.SIMPLE1"; configs.put(SamzaSqlApplicationConfig.CFG_SQL_STMT, sql1); configs.put(SamzaSqlApplicationRunner.RUNNER_CONFIG, SamzaSqlApplicationRunner.class.getName()); MapConfig samzaConfig = new MapConfig(configs); Config newConfigs = SamzaSqlApplicationRunner.computeSamzaConfigs(true, samzaConfig); Assert.assertEquals(newConfigs.get(SamzaSqlApplicationRunner.RUNNER_CONFIG), LocalApplicationRunner.class.getName()); // Check whether five new configs added. Assert.assertEquals(newConfigs.size(), configs.size() + 5); newConfigs = SamzaSqlApplicationRunner.computeSamzaConfigs(false, samzaConfig); Assert.assertEquals(newConfigs.get(SamzaSqlApplicationRunner.RUNNER_CONFIG), RemoteApplicationRunner.class.getName()); // Check whether five new configs added. Assert.assertEquals(newConfigs.size(), configs.size() + 5); } }