@Test public void buildTlsVersions_TlsVersionIsValid_ValidResult() throws Exception { final String tlsVersion = TlsVersions.SSLv3 + ", \n\t" + TlsVersions.TLSv1_2; List<String> result = InputBuilderUtils.buildTlsVersions(tlsVersion); assertEquals(TlsVersions.SSLv3, result.get(0)); assertEquals(TlsVersions.TLSv1_2, result.get(1)); }
public static List<String> buildTlsVersions(String tlsVersionInput) throws Exception { if (StringUtils.isEmpty(tlsVersionInput)) { return Collections.emptyList(); } String[] tlsVersionsArray = tlsVersionInput.replaceAll("\\s+", StringUtils.EMPTY).split(","); List<String> tlsVersions = new ArrayList<>(); for (String tlsVersion : tlsVersionsArray) { if (!TlsVersions.validate(tlsVersion)) { throw new IllegalArgumentException("Illegal value of input '" + InputNames.TLS_VERSION + "'"); } tlsVersions.add(tlsVersion); } return tlsVersions; }
InputBuilderUtils { public static List<String> buildTlsVersions(String tlsVersionInput) throws Exception { if (StringUtils.isEmpty(tlsVersionInput)) { return Collections.emptyList(); } String[] tlsVersionsArray = tlsVersionInput.replaceAll("\\s+", StringUtils.EMPTY).split(","); List<String> tlsVersions = new ArrayList<>(); for (String tlsVersion : tlsVersionsArray) { if (!TlsVersions.validate(tlsVersion)) { throw new IllegalArgumentException("Illegal value of input '" + InputNames.TLS_VERSION + "'"); } tlsVersions.add(tlsVersion); } return tlsVersions; } }
InputBuilderUtils { public static List<String> buildTlsVersions(String tlsVersionInput) throws Exception { if (StringUtils.isEmpty(tlsVersionInput)) { return Collections.emptyList(); } String[] tlsVersionsArray = tlsVersionInput.replaceAll("\\s+", StringUtils.EMPTY).split(","); List<String> tlsVersions = new ArrayList<>(); for (String tlsVersion : tlsVersionsArray) { if (!TlsVersions.validate(tlsVersion)) { throw new IllegalArgumentException("Illegal value of input '" + InputNames.TLS_VERSION + "'"); } tlsVersions.add(tlsVersion); } return tlsVersions; }  }
InputBuilderUtils { public static List<String> buildTlsVersions(String tlsVersionInput) throws Exception { if (StringUtils.isEmpty(tlsVersionInput)) { return Collections.emptyList(); } String[] tlsVersionsArray = tlsVersionInput.replaceAll("\\s+", StringUtils.EMPTY).split(","); List<String> tlsVersions = new ArrayList<>(); for (String tlsVersion : tlsVersionsArray) { if (!TlsVersions.validate(tlsVersion)) { throw new IllegalArgumentException("Illegal value of input '" + InputNames.TLS_VERSION + "'"); } tlsVersions.add(tlsVersion); } return tlsVersions; }  static String buildHostname(String hostname); static Short buildPort(String port, boolean mandatory); static Map<String, Object> buildPortAndProtocol(String protocol, String port); static String buildUsername(String username, boolean mandatory); static String buildPassword(String password); static boolean buildTrustAllRoots(String trustAllRoots); static boolean buildEnableTLS(String enableTLS); static boolean buildEnableSSL(String enableSSL); static boolean buildDeleteUponRetrieval(String deleteUponRetrieval); static String buildKeystore(String keystore); static int buildTimeout(String timeout); static Map<String, String> buildDecryptionKeystore(String decryptionKeystore, String decryptionKeyAlias,
                                                              String decryptionKeystorePassword); static List<String> buildTlsVersions(String tlsVersionInput); static List<String> buildAllowedCiphers(String allowedCiphersInput); }
InputBuilderUtils { public static List<String> buildTlsVersions(String tlsVersionInput) throws Exception { if (StringUtils.isEmpty(tlsVersionInput)) { return Collections.emptyList(); } String[] tlsVersionsArray = tlsVersionInput.replaceAll("\\s+", StringUtils.EMPTY).split(","); List<String> tlsVersions = new ArrayList<>(); for (String tlsVersion : tlsVersionsArray) { if (!TlsVersions.validate(tlsVersion)) { throw new IllegalArgumentException("Illegal value of input '" + InputNames.TLS_VERSION + "'"); } tlsVersions.add(tlsVersion); } return tlsVersions; }  static String buildHostname(String hostname); static Short buildPort(String port, boolean mandatory); static Map<String, Object> buildPortAndProtocol(String protocol, String port); static String buildUsername(String username, boolean mandatory); static String buildPassword(String password); static boolean buildTrustAllRoots(String trustAllRoots); static boolean buildEnableTLS(String enableTLS); static boolean buildEnableSSL(String enableSSL); static boolean buildDeleteUponRetrieval(String deleteUponRetrieval); static String buildKeystore(String keystore); static int buildTimeout(String timeout); static Map<String, String> buildDecryptionKeystore(String decryptionKeystore, String decryptionKeyAlias,
                                                              String decryptionKeystorePassword); static List<String> buildTlsVersions(String tlsVersionInput); static List<String> buildAllowedCiphers(String allowedCiphersInput);  }