@Test
public void test() throws Exception {
Assert.assertTrue(expectedGlobalConfig.length > 0);
ConfigurationsUtils.writeGlobalConfigToZookeeper(expectedGlobalConfig, zookeeperUrl);
byte[] actualGlobalConfigBytes = ConfigurationsUtils.readGlobalConfigBytesFromZookeeper(client);
Assert.assertTrue(Arrays.equals(expectedGlobalConfig, actualGlobalConfigBytes));
Assert.assertTrue(expectedSensorParserConfigMap.size() > 0);
String testSensorType = "yaf";
byte[] expectedSensorParserConfigBytes = expectedSensorParserConfigMap.get(testSensorType);
ConfigurationsUtils.writeSensorParserConfigToZookeeper(testSensorType, expectedSensorParserConfigBytes, zookeeperUrl);
byte[] actualSensorParserConfigBytes = ConfigurationsUtils.readSensorParserConfigBytesFromZookeeper(testSensorType, client);
Assert.assertTrue(Arrays.equals(expectedSensorParserConfigBytes, actualSensorParserConfigBytes));
Assert.assertTrue(expectedSensorEnrichmentConfigMap.size() > 0);
byte[] expectedSensorEnrichmentConfigBytes = expectedSensorEnrichmentConfigMap.get(testSensorType);
ConfigurationsUtils.writeSensorEnrichmentConfigToZookeeper(testSensorType, expectedSensorEnrichmentConfigBytes, zookeeperUrl);
byte[] actualSensorEnrichmentConfigBytes = ConfigurationsUtils.readSensorEnrichmentConfigBytesFromZookeeper(testSensorType, client);
Assert.assertTrue(Arrays.equals(expectedSensorEnrichmentConfigBytes, actualSensorEnrichmentConfigBytes));
String name = "testConfig";
Map<String, Object> testConfig = new HashMap<>();
testConfig.put("stringField", "value");
testConfig.put("intField", 1);
testConfig.put("doubleField", 1.1);
ConfigurationsUtils.writeConfigToZookeeper(name, testConfig, zookeeperUrl);
byte[] readConfigBytes = ConfigurationsUtils.readConfigBytesFromZookeeper(name, client);
Assert.assertTrue(Arrays.equals(JSONUtils.INSTANCE.toJSONPretty(testConfig), readConfigBytes));
}