@Test public void asPassword() { assertThat(propertyAccessor.asPassword().get(BmcProperties.PASS_PHRASE), nullValue()); this.configuration.set(BmcProperties.PASS_PHRASE.getPropertyName(), "pass"); assertThat( propertyAccessor.asPassword().get(BmcProperties.PASS_PHRASE), is(new char[] {'p', 'a', 's', 's'})); this.configuration.set( BmcProperties.PASS_PHRASE.getPropertyName() + PROPERTY_OVERRIDE_SUFFIX, "ssap"); assertThat( propertyAccessor.asPassword().get(BmcProperties.PASS_PHRASE), is(new char[] {'s', 's', 'a', 'p'})); }
Accessor<char[]> asPassword() { return new Accessor<char[]>() { @Override public char[] get(BmcProperties property) { try { String overriddenPropertyName = getOverriddenPropertyName(property); char[] overriddenPassword = configuration.getPassword(overriddenPropertyName); if (overriddenPassword != null) { LOG.debug("Using key {}", overriddenPropertyName); return overriddenPassword; } char[] password = configuration.getPassword(property.getPropertyName()); String deprecatedKey = BmcConstants.Deprecated.getDeprecatedKey(property.getPropertyName()); char[] deprecatedPassword = configuration.getPassword(deprecatedKey); if (password != null && deprecatedPassword != null) { throwClash(property); } if (password != null) { LOG.debug("Using key {}", property.getPropertyName()); return password; } if (deprecatedPassword != null) { LOG.debug("Using key {}", deprecatedKey); return deprecatedPassword; } LOG.debug("No configuration found for {}", property.getPropertyName()); return null; } catch (IOException e) { throw new IllegalArgumentException("Unable to extract password", e); } } }; }
BmcPropertyAccessor { Accessor<char[]> asPassword() { return new Accessor<char[]>() { @Override public char[] get(BmcProperties property) { try { String overriddenPropertyName = getOverriddenPropertyName(property); char[] overriddenPassword = configuration.getPassword(overriddenPropertyName); if (overriddenPassword != null) { LOG.debug("Using key {}", overriddenPropertyName); return overriddenPassword; } char[] password = configuration.getPassword(property.getPropertyName()); String deprecatedKey = BmcConstants.Deprecated.getDeprecatedKey(property.getPropertyName()); char[] deprecatedPassword = configuration.getPassword(deprecatedKey); if (password != null && deprecatedPassword != null) { throwClash(property); } if (password != null) { LOG.debug("Using key {}", property.getPropertyName()); return password; } if (deprecatedPassword != null) { LOG.debug("Using key {}", deprecatedKey); return deprecatedPassword; } LOG.debug("No configuration found for {}", property.getPropertyName()); return null; } catch (IOException e) { throw new IllegalArgumentException("Unable to extract password", e); } } }; } }
BmcPropertyAccessor { Accessor<char[]> asPassword() { return new Accessor<char[]>() { @Override public char[] get(BmcProperties property) { try { String overriddenPropertyName = getOverriddenPropertyName(property); char[] overriddenPassword = configuration.getPassword(overriddenPropertyName); if (overriddenPassword != null) { LOG.debug("Using key {}", overriddenPropertyName); return overriddenPassword; } char[] password = configuration.getPassword(property.getPropertyName()); String deprecatedKey = BmcConstants.Deprecated.getDeprecatedKey(property.getPropertyName()); char[] deprecatedPassword = configuration.getPassword(deprecatedKey); if (password != null && deprecatedPassword != null) { throwClash(property); } if (password != null) { LOG.debug("Using key {}", property.getPropertyName()); return password; } if (deprecatedPassword != null) { LOG.debug("Using key {}", deprecatedKey); return deprecatedPassword; } LOG.debug("No configuration found for {}", property.getPropertyName()); return null; } catch (IOException e) { throw new IllegalArgumentException("Unable to extract password", e); } } }; }  }
BmcPropertyAccessor { Accessor<char[]> asPassword() { return new Accessor<char[]>() { @Override public char[] get(BmcProperties property) { try { String overriddenPropertyName = getOverriddenPropertyName(property); char[] overriddenPassword = configuration.getPassword(overriddenPropertyName); if (overriddenPassword != null) { LOG.debug("Using key {}", overriddenPropertyName); return overriddenPassword; } char[] password = configuration.getPassword(property.getPropertyName()); String deprecatedKey = BmcConstants.Deprecated.getDeprecatedKey(property.getPropertyName()); char[] deprecatedPassword = configuration.getPassword(deprecatedKey); if (password != null && deprecatedPassword != null) { throwClash(property); } if (password != null) { LOG.debug("Using key {}", property.getPropertyName()); return password; } if (deprecatedPassword != null) { LOG.debug("Using key {}", deprecatedKey); return deprecatedPassword; } LOG.debug("No configuration found for {}", property.getPropertyName()); return null; } catch (IOException e) { throw new IllegalArgumentException("Unable to extract password", e); } } }; }   }
BmcPropertyAccessor { Accessor<char[]> asPassword() { return new Accessor<char[]>() { @Override public char[] get(BmcProperties property) { try { String overriddenPropertyName = getOverriddenPropertyName(property); char[] overriddenPassword = configuration.getPassword(overriddenPropertyName); if (overriddenPassword != null) { LOG.debug("Using key {}", overriddenPropertyName); return overriddenPassword; } char[] password = configuration.getPassword(property.getPropertyName()); String deprecatedKey = BmcConstants.Deprecated.getDeprecatedKey(property.getPropertyName()); char[] deprecatedPassword = configuration.getPassword(deprecatedKey); if (password != null && deprecatedPassword != null) { throwClash(property); } if (password != null) { LOG.debug("Using key {}", property.getPropertyName()); return password; } if (deprecatedPassword != null) { LOG.debug("Using key {}", deprecatedKey); return deprecatedPassword; } LOG.debug("No configuration found for {}", property.getPropertyName()); return null; } catch (IOException e) { throw new IllegalArgumentException("Unable to extract password", e); } } }; }    }