This is an automated email from the ASF dual-hosted git repository.
davsclaus pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/camel-spring-boot.git
The following commit(s) were added to refs/heads/master by this push:
new de22c9c CAMEL-15649 : Fixing test case error by NativePRNG
SecureRandom not available in Windows (#190)
de22c9c is described below
commit de22c9c3bfebd368a547df0284f1d77955879c47
Author: Alex Park <[email protected]>
AuthorDate: Wed Oct 7 21:59:03 2020 +1100
CAMEL-15649 : Fixing test case error by NativePRNG SecureRandom not
available in Windows (#190)
---
.../EncryptedPropertiesCustomConfigurationBeansTest.java | 14 ++++++++++++--
1 file changed, 12 insertions(+), 2 deletions(-)
diff --git
a/components-starter/camel-jasypt-starter/src/test/java/org/apache/camel/component/jasypt/springboot/EncryptedPropertiesCustomConfigurationBeansTest.java
b/components-starter/camel-jasypt-starter/src/test/java/org/apache/camel/component/jasypt/springboot/EncryptedPropertiesCustomConfigurationBeansTest.java
index 1b449c3..ddbba8f 100644
---
a/components-starter/camel-jasypt-starter/src/test/java/org/apache/camel/component/jasypt/springboot/EncryptedPropertiesCustomConfigurationBeansTest.java
+++
b/components-starter/camel-jasypt-starter/src/test/java/org/apache/camel/component/jasypt/springboot/EncryptedPropertiesCustomConfigurationBeansTest.java
@@ -62,13 +62,23 @@ public class
EncryptedPropertiesCustomConfigurationBeansTest extends EncryptedPr
@Import(Routes.class)
@AutoConfigureBefore(CamelAutoConfiguration.class)
public static class TestConfiguration {
+
+ private static String OS = System.getProperty("os.name");
+
+ private String getSecureRandomAlgorithm() {
+ String secureRandomAlgorithm = "NativePRNG";
+ if (OS != null && OS.toLowerCase().indexOf("win") != -1) {
+ secureRandomAlgorithm = "Windows-PRNG";
+ }
+ return secureRandomAlgorithm;
+ }
@Bean("customEnvironmentStringPBEConfig")
public EnvironmentStringPBEConfig environmentVariablesConfiguration() {
EnvironmentStringPBEConfig environmentStringPBEConfig = new
EnvironmentStringPBEConfig();
environmentStringPBEConfig.setAlgorithm("PBEWITHHMACSHA512ANDAES_256");
- environmentStringPBEConfig.setIvGenerator(new
RandomIvGenerator("NativePRNG"));
- environmentStringPBEConfig.setSaltGenerator(new
RandomSaltGenerator("NativePRNG"));
+ environmentStringPBEConfig.setIvGenerator(new
RandomIvGenerator(getSecureRandomAlgorithm()));
+ environmentStringPBEConfig.setSaltGenerator(new
RandomSaltGenerator(getSecureRandomAlgorithm()));
environmentStringPBEConfig.setPassword("mainpassword");
return environmentStringPBEConfig;
}