@Test public void testGetCheckpointTopicProperties() { Map<String, String> config = new HashMap<>(); Properties properties = new KafkaConfig(new MapConfig(config)).getCheckpointTopicProperties(); assertEquals(properties.getProperty("cleanup.policy"), "compact"); assertEquals(properties.getProperty("segment.bytes"), String.valueOf(KafkaConfig.DEFAULT_CHECKPOINT_SEGMENT_BYTES())); config.put(ApplicationConfig.APP_MODE, ApplicationConfig.ApplicationMode.BATCH.name()); properties = new KafkaConfig(new MapConfig(config)).getCheckpointTopicProperties(); assertEquals(properties.getProperty("cleanup.policy"), "compact,delete"); assertEquals(properties.getProperty("segment.bytes"), String.valueOf(KafkaConfig.DEFAULT_CHECKPOINT_SEGMENT_BYTES())); assertEquals(properties.getProperty("retention.ms"), String.valueOf(KafkaConfig.DEFAULT_RETENTION_MS_FOR_BATCH())); } }
@Test public void testGetIntermediateStreamProperties() { Map<String, String> config = new HashMap<>(); KafkaSystemFactory factory = new KafkaSystemFactory(); Map<String, Properties> properties = JavaConversions.mapAsJavaMap( factory.getIntermediateStreamProperties(new MapConfig(config))); assertTrue(properties.isEmpty()); // no properties for stream config.put("streams.test.samza.intermediate", "true"); config.put("streams.test.compression.type", "lz4"); //some random config properties = JavaConversions.mapAsJavaMap( factory.getIntermediateStreamProperties(new MapConfig(config))); assertTrue(properties.isEmpty()); config.put(ApplicationConfig.APP_MODE, ApplicationConfig.ApplicationMode.BATCH.name()); properties = JavaConversions.mapAsJavaMap( factory.getIntermediateStreamProperties(new MapConfig(config))); assertTrue(!properties.isEmpty()); Properties prop = properties.get("test"); assertEquals(prop.getProperty("retention.ms"), String.valueOf(KafkaConfig.DEFAULT_RETENTION_MS_FOR_BATCH())); assertEquals(prop.getProperty("compression.type"), "lz4"); } }