@Test void createKeyStoreOptions_keyStoreTypeMissing_useDefault() throws URISyntaxException { Properties configuration = getValidConfiguration(); configuration.setProperty("keyStoreType", ""); KeyStoreHelper.KeyStoreOptions keyStoreOptions = Config.createKeyStoreOptions(configuration); assertEquals(KeyStoreType.getDefaultType(), keyStoreOptions.getKeyStoreType()); }
static KeyStoreOptions createKeyStoreOptions(final Properties properties) { val keyStorePath = getProperty(properties, "keyStorePath"); val keyStorePass = getProperty(properties, "keyStorePass"); val keyPass = getProperty(properties, "keyPass"); val trustStorePath = getProperty(properties, "trustStorePath"); val trustStorePass = getProperty(properties, "trustStorePass"); val keyAlias = properties.getProperty("keyAlias", null); val spiffeSocketPath = properties.getProperty("spiffeSocketPath", null); val keyStoreTypeProp = properties.getProperty("keyStoreType", null); KeyStoreType keyStoreType; if (StringUtils.isNotBlank(keyStoreTypeProp)) { keyStoreType = KeyStoreType.parse(keyStoreTypeProp); } else { keyStoreType = KeyStoreType.getDefaultType(); } return KeyStoreOptions.builder() .keyStorePath(Paths.get(keyStorePath)) .keyStorePass(keyStorePass) .keyPass(keyPass) .trustStorePath(Paths.get(trustStorePath)) .trustStorePass(trustStorePass) .keyAlias(keyAlias) .spiffeSocketPath(spiffeSocketPath) .keyStoreType(keyStoreType) .build(); }
Config { static KeyStoreOptions createKeyStoreOptions(final Properties properties) { val keyStorePath = getProperty(properties, "keyStorePath"); val keyStorePass = getProperty(properties, "keyStorePass"); val keyPass = getProperty(properties, "keyPass"); val trustStorePath = getProperty(properties, "trustStorePath"); val trustStorePass = getProperty(properties, "trustStorePass"); val keyAlias = properties.getProperty("keyAlias", null); val spiffeSocketPath = properties.getProperty("spiffeSocketPath", null); val keyStoreTypeProp = properties.getProperty("keyStoreType", null); KeyStoreType keyStoreType; if (StringUtils.isNotBlank(keyStoreTypeProp)) { keyStoreType = KeyStoreType.parse(keyStoreTypeProp); } else { keyStoreType = KeyStoreType.getDefaultType(); } return KeyStoreOptions.builder() .keyStorePath(Paths.get(keyStorePath)) .keyStorePass(keyStorePass) .keyPass(keyPass) .trustStorePath(Paths.get(trustStorePath)) .trustStorePass(trustStorePass) .keyAlias(keyAlias) .spiffeSocketPath(spiffeSocketPath) .keyStoreType(keyStoreType) .build(); } }
Config { static KeyStoreOptions createKeyStoreOptions(final Properties properties) { val keyStorePath = getProperty(properties, "keyStorePath"); val keyStorePass = getProperty(properties, "keyStorePass"); val keyPass = getProperty(properties, "keyPass"); val trustStorePath = getProperty(properties, "trustStorePath"); val trustStorePass = getProperty(properties, "trustStorePass"); val keyAlias = properties.getProperty("keyAlias", null); val spiffeSocketPath = properties.getProperty("spiffeSocketPath", null); val keyStoreTypeProp = properties.getProperty("keyStoreType", null); KeyStoreType keyStoreType; if (StringUtils.isNotBlank(keyStoreTypeProp)) { keyStoreType = KeyStoreType.parse(keyStoreTypeProp); } else { keyStoreType = KeyStoreType.getDefaultType(); } return KeyStoreOptions.builder() .keyStorePath(Paths.get(keyStorePath)) .keyStorePass(keyStorePass) .keyPass(keyPass) .trustStorePath(Paths.get(trustStorePath)) .trustStorePass(trustStorePass) .keyAlias(keyAlias) .spiffeSocketPath(spiffeSocketPath) .keyStoreType(keyStoreType) .build(); } private  Config(); }
Config { static KeyStoreOptions createKeyStoreOptions(final Properties properties) { val keyStorePath = getProperty(properties, "keyStorePath"); val keyStorePass = getProperty(properties, "keyStorePass"); val keyPass = getProperty(properties, "keyPass"); val trustStorePath = getProperty(properties, "trustStorePath"); val trustStorePass = getProperty(properties, "trustStorePass"); val keyAlias = properties.getProperty("keyAlias", null); val spiffeSocketPath = properties.getProperty("spiffeSocketPath", null); val keyStoreTypeProp = properties.getProperty("keyStoreType", null); KeyStoreType keyStoreType; if (StringUtils.isNotBlank(keyStoreTypeProp)) { keyStoreType = KeyStoreType.parse(keyStoreTypeProp); } else { keyStoreType = KeyStoreType.getDefaultType(); } return KeyStoreOptions.builder() .keyStorePath(Paths.get(keyStorePath)) .keyStorePass(keyStorePass) .keyPass(keyPass) .trustStorePath(Paths.get(trustStorePath)) .trustStorePass(trustStorePass) .keyAlias(keyAlias) .spiffeSocketPath(spiffeSocketPath) .keyStoreType(keyStoreType) .build(); } private  Config();  }
Config { static KeyStoreOptions createKeyStoreOptions(final Properties properties) { val keyStorePath = getProperty(properties, "keyStorePath"); val keyStorePass = getProperty(properties, "keyStorePass"); val keyPass = getProperty(properties, "keyPass"); val trustStorePath = getProperty(properties, "trustStorePath"); val trustStorePass = getProperty(properties, "trustStorePass"); val keyAlias = properties.getProperty("keyAlias", null); val spiffeSocketPath = properties.getProperty("spiffeSocketPath", null); val keyStoreTypeProp = properties.getProperty("keyStoreType", null); KeyStoreType keyStoreType; if (StringUtils.isNotBlank(keyStoreTypeProp)) { keyStoreType = KeyStoreType.parse(keyStoreTypeProp); } else { keyStoreType = KeyStoreType.getDefaultType(); } return KeyStoreOptions.builder() .keyStorePath(Paths.get(keyStorePath)) .keyStorePass(keyStorePass) .keyPass(keyPass) .trustStorePath(Paths.get(trustStorePath)) .trustStorePass(trustStorePass) .keyAlias(keyAlias) .spiffeSocketPath(spiffeSocketPath) .keyStoreType(keyStoreType) .build(); } private  Config();   }