@Test public void config_is_written_correctly_with_tls_for_quorum_communication_port_unification() throws IOException { ZookeeperServerConfig.Builder builder = createConfigBuilderForSingleHost(cfgFile, idFile, jksKeyStoreFile); builder.tlsForQuorumCommunication(TlsForQuorumCommunication.PORT_UNIFICATION); builder.tlsForClientServerCommunication(TlsForClientServerCommunication.Enum.PORT_UNIFICATION); Optional<TransportSecurityOptions> transportSecurityOptions = createTransportSecurityOptions(); new Configurator(builder.build()).writeConfigToDisk(transportSecurityOptions); validateConfigFilePortUnification(cfgFile, jksKeyStoreFile, transportSecurityOptions.get().getCaCertificatesFile().get().toFile()); validateThatJksKeyStoreFileExists(jksKeyStoreFile); }
void writeConfigToDisk(Optional<TransportSecurityOptions> transportSecurityOptions) { configFilePath.toFile().getParentFile().mkdirs(); try { writeZooKeeperConfigFile(zookeeperServerConfig, transportSecurityOptions); writeMyIdFile(zookeeperServerConfig); transportSecurityOptions.ifPresent(this::writeJksKeystore); } catch (IOException e) { throw new RuntimeException("Error writing zookeeper config", e); } }
Configurator { void writeConfigToDisk(Optional<TransportSecurityOptions> transportSecurityOptions) { configFilePath.toFile().getParentFile().mkdirs(); try { writeZooKeeperConfigFile(zookeeperServerConfig, transportSecurityOptions); writeMyIdFile(zookeeperServerConfig); transportSecurityOptions.ifPresent(this::writeJksKeystore); } catch (IOException e) { throw new RuntimeException("Error writing zookeeper config", e); } } }
Configurator { void writeConfigToDisk(Optional<TransportSecurityOptions> transportSecurityOptions) { configFilePath.toFile().getParentFile().mkdirs(); try { writeZooKeeperConfigFile(zookeeperServerConfig, transportSecurityOptions); writeMyIdFile(zookeeperServerConfig); transportSecurityOptions.ifPresent(this::writeJksKeystore); } catch (IOException e) { throw new RuntimeException("Error writing zookeeper config", e); } } Configurator(ZookeeperServerConfig zookeeperServerConfig); }
Configurator { void writeConfigToDisk(Optional<TransportSecurityOptions> transportSecurityOptions) { configFilePath.toFile().getParentFile().mkdirs(); try { writeZooKeeperConfigFile(zookeeperServerConfig, transportSecurityOptions); writeMyIdFile(zookeeperServerConfig); transportSecurityOptions.ifPresent(this::writeJksKeystore); } catch (IOException e) { throw new RuntimeException("Error writing zookeeper config", e); } } Configurator(ZookeeperServerConfig zookeeperServerConfig);  }
Configurator { void writeConfigToDisk(Optional<TransportSecurityOptions> transportSecurityOptions) { configFilePath.toFile().getParentFile().mkdirs(); try { writeZooKeeperConfigFile(zookeeperServerConfig, transportSecurityOptions); writeMyIdFile(zookeeperServerConfig); transportSecurityOptions.ifPresent(this::writeJksKeystore); } catch (IOException e) { throw new RuntimeException("Error writing zookeeper config", e); } } Configurator(ZookeeperServerConfig zookeeperServerConfig);   }