ConfigUtils { public static ConfigDefinitionKey createConfigDefinitionKeyFromZKString(String nodeName) { final String name; final String namespace; String tempName = ConfigUtils.getNameFromSerializedString(nodeName); Tuple2<String, String> tuple = ConfigUtils.getNameAndNamespaceFromString(tempName); name = tuple.first; namespace = tuple.second; return new ConfigDefinitionKey(name, namespace); }  static String getMd5(ConfigPayload payload); static String getMd5(String input); static String getMd5(Utf8Array input); static String getMd5(byte[] input); static String stripSpaces(String str); static String getDefMd5(List<String> lines); static String getDefNamespace(Reader in); static Tuple2<String, String> getNameAndNamespaceFromString(String nameDotNamespace); static ConfigDefinitionKey createConfigDefinitionKeyFromZKString(String nodeName); static ConfigDefinitionKey createConfigDefinitionKeyFromDefFile(File file); static String escapeConfigFormatValue(String input); static String getDefMd5FromRequest(String defMd5, List<String> defContent); static String getCanonicalHostName(); static String getEnvValue(String defaultValue, String... envVars); static boolean isGenerationNewer(long newGen, long oldGen);  }
@Test public void testCreateConfigDefinitionKeyFromZKString() { ConfigDefinitionKey def1 = ConfigUtils.createConfigDefinitionKeyFromZKString("bar.foo,1"); assertThat(def1.getName(), is("foo")); assertThat(def1.getNamespace(), is("bar")); ConfigDefinitionKey def2 = ConfigUtils.createConfigDefinitionKeyFromZKString("bar.foo,"); assertThat(def2.getName(), is("foo")); assertThat(def2.getNamespace(), is("bar")); ConfigDefinitionKey def3 = ConfigUtils.createConfigDefinitionKeyFromZKString("bar.foo"); assertThat(def3.getName(), is("foo")); assertThat(def3.getNamespace(), is("bar")); }