use of org.apache.deltaspike.core.spi.config.ConfigFilter in project deltaspike by apache.
the class ConfigResolverTest method testConfigFilter.
@Test
public void testConfigFilter() {
ConfigFilter configFilter = new TestConfigFilter();
Assert.assertEquals("shouldGetDecrypted: value", configFilter.filterValue("somekey.encrypted", "value"));
Assert.assertEquals("**********", configFilter.filterValueForLog("somekey.password", "value"));
ConfigResolver.addConfigFilter(configFilter);
Assert.assertEquals("shouldGetDecrypted: value", ConfigResolver.getPropertyValue("testkey4.encrypted"));
Assert.assertEquals("shouldGetDecrypted: value", ConfigResolver.getProjectStageAwarePropertyValue("testkey4.encrypted"));
Assert.assertEquals("shouldGetDecrypted: value", ConfigResolver.getProjectStageAwarePropertyValue("testkey4.encrypted", null));
Assert.assertEquals("shouldGetDecrypted: value", ConfigResolver.getPropertyAwarePropertyValue("testkey4.encrypted", "dbvendor"));
Assert.assertEquals("shouldGetDecrypted: value", ConfigResolver.getPropertyAwarePropertyValue("testkey4.encrypted", "dbvendor", null));
List<String> allPropertyValues = ConfigResolver.getAllPropertyValues("testkey4.encrypted");
Assert.assertNotNull(allPropertyValues);
Assert.assertEquals(1, allPropertyValues.size());
Assert.assertEquals("shouldGetDecrypted: value", allPropertyValues.get(0));
}
Aggregations