RegistryCenterFactory extends Observable { public static CoordinatorRegistryCenter createCoordinatorRegistryCenter(final String connectString, final String namespace, final Optional<String> digest) { return instance.innerCreate(connectString, namespace, digest); }  static CoordinatorRegistryCenter createCoordinatorRegistryCenter(final String connectString, final String namespace, final Optional<String> digest); static RegistryCenterFactory getInstance(); void destroy();  }
@Test public void assertCreateCoordinatorRegistryCenterWithoutDigest() throws SecurityException, IllegalArgumentException, NoSuchMethodException, IllegalAccessException, InvocationTargetException { ZookeeperConfiguration zkConfig = getZookeeperConfiguration(RegistryCenterFactory.createCoordinatorRegistryCenter(ZK_CONNECTION_STRING, "namespace", Optional.<String>absent())); assertThat(zkConfig.getNamespace(), is("namespace")); assertNull(zkConfig.getDigest()); }
@Test public void assertCreateCoordinatorRegistryCenterWithDigest() throws SecurityException, IllegalArgumentException, NoSuchMethodException, IllegalAccessException, InvocationTargetException { ZookeeperConfiguration zkConfig = getZookeeperConfiguration(RegistryCenterFactory.createCoordinatorRegistryCenter(ZK_CONNECTION_STRING, "namespace", Optional.of("digest"))); assertThat(zkConfig.getNamespace(), is("namespace")); assertThat(zkConfig.getDigest(), is("digest")); }
@Test public void assertCreateCoordinatorRegistryCenterFromCache() throws SecurityException, IllegalArgumentException, NoSuchMethodException, IllegalAccessException, InvocationTargetException { RegistryCenterFactory.createCoordinatorRegistryCenter(ZK_CONNECTION_STRING, "otherNamespace", Optional.<String>absent()); ZookeeperConfiguration zkConfig = getZookeeperConfiguration(RegistryCenterFactory.createCoordinatorRegistryCenter(ZK_CONNECTION_STRING, "otherNamespace", Optional.<String>absent())); assertThat(zkConfig.getNamespace(), is("otherNamespace")); assertNull(zkConfig.getDigest()); }