Java Code Examples for org.apache.camel.component.properties.PropertiesComponent#setPropertiesParser()
The following examples show how to use
org.apache.camel.component.properties.PropertiesComponent#setPropertiesParser() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: SecuringConfigTest.java From camelinaction2 with Apache License 2.0 | 6 votes |
@Override protected CamelContext createCamelContext() throws Exception { CamelContext context = super.createCamelContext(); // create the jasypt properties parser JasyptPropertiesParser jasypt = new JasyptPropertiesParser(); // and set the master password jasypt.setPassword("supersecret"); // we can avoid keeping the master password in plaintext in the application // by referencing a environment variable // export CAMEL_ENCRYPTION_PASSWORD=supersecret // jasypt.setPassword("sysenv:CAMEL_ENCRYPTION_PASSWORD"); // setup the properties component to use the production file PropertiesComponent prop = context.getComponent("properties", PropertiesComponent.class); prop.setLocation("classpath:rider-test.properties"); // and use the jasypt properties parser so we can decrypt values prop.setPropertiesParser(jasypt); return context; }
Example 2
Source File: EncryptedPropertiesPasswordInSystemPropertyTest.java From camel-cookbook-examples with Apache License 2.0 | 6 votes |
@Override public CamelContext createCamelContext() { // normally this would be set along the lines of -DjasyptMasterPassword=encryptionPassword // in a place appropriate to the runtime System.setProperty("jasyptMasterPassword", "encryptionPassword"); JasyptPropertiesParser propParser = new JasyptPropertiesParser(); propParser.setPassword("sys:jasyptMasterPassword"); PropertiesComponent propComponent = new PropertiesComponent(); propComponent.setLocation("classpath:placeholder.properties"); propComponent.setPropertiesParser(propParser); CamelContext camelContext = new DefaultCamelContext(); camelContext.addComponent("properties", propComponent); return camelContext; }
Example 3
Source File: EncryptedPropertiesTest.java From camel-cookbook-examples with Apache License 2.0 | 5 votes |
@Override public CamelContext createCamelContext() { JasyptPropertiesParser propParser = new JasyptPropertiesParser(); propParser.setPassword("encryptionPassword"); PropertiesComponent propComponent = new PropertiesComponent(); propComponent.setLocation("classpath:placeholder.properties"); propComponent.setPropertiesParser(propParser); CamelContext camelContext = new DefaultCamelContext(); camelContext.addComponent("properties", propComponent); return camelContext; }
Example 4
Source File: JasyptIntegrationTest.java From wildfly-camel with Apache License 2.0 | 5 votes |
@Test public void testPasswordDecryption() throws Exception { // create the jasypt properties parser JasyptPropertiesParser jasypt = new JasyptPropertiesParser(); // and set the master password jasypt.setPassword("secret"); // create the properties component PropertiesComponent pc = new PropertiesComponent(); pc.setLocation("classpath:password.properties"); // and use the jasypt properties parser so we can decrypt values pc.setPropertiesParser(jasypt); CamelContext camelctx = new DefaultCamelContext(); camelctx.setPropertiesComponent(pc); camelctx.addRoutes(new RouteBuilder() { @Override public void configure() throws Exception { from("direct:start").transform().simple("Hi ${body} the decrypted password is: ${properties:cool.password}"); } }); camelctx.start(); try { ProducerTemplate producer = camelctx.createProducerTemplate(); String result = producer.requestBody("direct:start", "John", String.class); Assert.assertEquals("Hi John the decrypted password is: tiger", result.trim()); } finally { camelctx.close(); } }
Example 5
Source File: CamelAutoConfiguration.java From camel-spring-boot with Apache License 2.0 | 4 votes |
@Bean(destroyMethod = "") PropertiesComponent properties(PropertiesParser parser) { PropertiesComponent pc = new PropertiesComponent(); pc.setPropertiesParser(parser); return pc; }
Example 6
Source File: AbstractEmailTest.java From syndesis with Apache License 2.0 | 4 votes |
@Bean public PropertiesComponent properties(PropertiesParser parser) { PropertiesComponent pc = new PropertiesComponent(); pc.setPropertiesParser(parser); return pc; }
Example 7
Source File: AbstractODataTest.java From syndesis with Apache License 2.0 | 4 votes |
@Bean(destroyMethod = "") public PropertiesComponent properties(PropertiesParser parser) { PropertiesComponent pc = new PropertiesComponent(); pc.setPropertiesParser(parser); return pc; }