/**
* this test is an integration test (use of a spring context)
*
* It begins with a Jndi instanciation and then try to load a spring context depending on jndi properties.
*
* The goal of this test is to validate that we can read jndi encoded properties from spring
*/
@Test
public void process_properties_should_decode_all_encrypted_props() throws Exception {
//Jndi setup
//Set fictive jndi properties (some of them are encoded)
SimpleNamingContextBuilder.emptyActivatedContextBuilder();
InitialContext initialContext = new InitialContext();
initialContext.bind("jndi.prop1", "ENC(VLCeFXg9nPrx7Bmsbcb0h3v5ivRinKQ4)");
initialContext.bind("jndi.prop2", "testjndiValue2");
//when
ClassPathXmlApplicationContext context = new ClassPathXmlApplicationContext("classpath:/com/francetelecom/clara/cloud/commons/jasypt/jndiPropsDecoding.xml"){
@Override
protected ConfigurableEnvironment createEnvironment() {
return new StandardServletEnvironment();
}
};
//Then
TestBean bean = context.getBean(TestBean.class);
assertEquals("testjndivalue",bean.getSampleProp1());
assertEquals("testjndiValue2",bean.getSampleProp2());
assertEquals("testlocalvalue",bean.getSampleProp3());
assertEquals("testlocalvalue2",bean.getSampleProp4());
}
EncryptablePropertySourcesPlaceholderConfigurerTest.java 文件源码
java
阅读 16
收藏 0
点赞 0
评论 0
项目:elpaaso-core
作者:
评论列表
文章目录