This is an automated email from the ASF dual-hosted git repository. jamesnetherton pushed a commit to branch main in repository https://gitbox.apache.org/repos/asf/camel-quarkus.git
The following commit(s) were added to refs/heads/main by this push: new 521a195fa2 Add a Jasypt test profile for FIPS 521a195fa2 is described below commit 521a195fa2495e766c106463e6698c332041624c Author: James Netherton <jamesnether...@gmail.com> AuthorDate: Thu Feb 22 14:03:49 2024 +0000 Add a Jasypt test profile for FIPS --- integration-tests/jasypt/pom.xml | 45 ++++++++++++++++++++++ .../quarkus/component/jasypt/it/JasyptFipsIT.java | 25 ++++++++++++ .../jasypt/it/JasyptFipsModeTestProfile.java | 36 +++++++++++++++++ .../component/jasypt/it/JasyptFipsTest.java | 27 +++++++++++++ .../quarkus/component/jasypt/it/JasyptTest.java | 2 + 5 files changed, 135 insertions(+) diff --git a/integration-tests/jasypt/pom.xml b/integration-tests/jasypt/pom.xml index 565aba10e7..b0299f9440 100644 --- a/integration-tests/jasypt/pom.xml +++ b/integration-tests/jasypt/pom.xml @@ -84,6 +84,11 @@ <artifactId>quarkus-test-h2</artifactId> <scope>test</scope> </dependency> + <dependency> + <groupId>org.apache.camel.quarkus</groupId> + <artifactId>camel-quarkus-integration-test-support</artifactId> + <scope>test</scope> + </dependency> </dependencies> <profiles> @@ -203,6 +208,46 @@ </plugins> </build> </profile> + <profile> + <id>fips</id> + <activation> + <property> + <name>fips</name> + </property> + </activation> + <build> + <plugins> + <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-surefire-plugin</artifactId> + <configuration> + <includes> + <include>**/JasyptFipsTest*</include> + </includes> + <systemPropertyVariables> + <quarkus.datasource.devservices.enabled>false</quarkus.datasource.devservices.enabled> + <quarkus.camel.jasypt.random-iv-generator-algorithm>PKCS11</quarkus.camel.jasypt.random-iv-generator-algorithm> + <quarkus.camel.jasypt.random-salt-generator-algorithm>PKCS11</quarkus.camel.jasypt.random-salt-generator-algorithm> + </systemPropertyVariables> + </configuration> + </plugin> + <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-failsafe-plugin</artifactId> + <configuration> + <includes> + <include>**/JasyptFipsIT*</include> + </includes> + <systemPropertyVariables> + <quarkus.datasource.devservices.enabled>false</quarkus.datasource.devservices.enabled> + <quarkus.camel.jasypt.random-iv-generator-algorithm>PKCS11</quarkus.camel.jasypt.random-iv-generator-algorithm> + <quarkus.camel.jasypt.random-salt-generator-algorithm>PKCS11</quarkus.camel.jasypt.random-salt-generator-algorithm> + </systemPropertyVariables> + </configuration> + </plugin> + </plugins> + </build> + </profile> </profiles> </project> diff --git a/integration-tests/jasypt/src/test/java/org/apache/camel/quarkus/component/jasypt/it/JasyptFipsIT.java b/integration-tests/jasypt/src/test/java/org/apache/camel/quarkus/component/jasypt/it/JasyptFipsIT.java new file mode 100644 index 0000000000..8fbd841b3c --- /dev/null +++ b/integration-tests/jasypt/src/test/java/org/apache/camel/quarkus/component/jasypt/it/JasyptFipsIT.java @@ -0,0 +1,25 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.camel.quarkus.component.jasypt.it; + +import io.quarkus.test.junit.QuarkusIntegrationTest; +import org.apache.camel.quarkus.test.EnabledIfFipsMode; + +@QuarkusIntegrationTest +@EnabledIfFipsMode +class JasyptFipsIT extends JasyptFipsTest { +} diff --git a/integration-tests/jasypt/src/test/java/org/apache/camel/quarkus/component/jasypt/it/JasyptFipsModeTestProfile.java b/integration-tests/jasypt/src/test/java/org/apache/camel/quarkus/component/jasypt/it/JasyptFipsModeTestProfile.java new file mode 100644 index 0000000000..3aa1f22571 --- /dev/null +++ b/integration-tests/jasypt/src/test/java/org/apache/camel/quarkus/component/jasypt/it/JasyptFipsModeTestProfile.java @@ -0,0 +1,36 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.camel.quarkus.component.jasypt.it; + +import java.util.Map; + +import io.quarkus.test.junit.QuarkusTestProfile; + +public class JasyptFipsModeTestProfile implements QuarkusTestProfile { + @Override + public Map<String, String> getConfigOverrides() { + return Map.of( + "quarkus.camel.jasypt.algorithm", "PBEWithHMACSHA256AndAES_256", + "quarkus.camel.jasypt.random-iv-generator-algorithm", "PKCS11", + "quarkus.camel.jasypt.random-salt-generator-algorithm", "PKCS11", + "greeting.secret", "ENC(tp3QOxMouvD3oIdTXNM0uH+BtVEMCI1ak+GBTzPZOatthRP3m+ZxAg7CF0saNTmK)", + "explicit.config.provider.secret", "ENC(tp3QOxMouvD3oIdTXNM0uH+BtVEMCI1ak+GBTzPZOatthRP3m+ZxAg7CF0saNTmK)", + "camel.component.direct.timeout", "30000", + "timer.delay.secret", "ENC(/NsF9u8xrJh/sIre0ZQtOf6DwBaVVOcQkHe3ungkmvVfUyLXgboTgunz5Rpy+C6G)", + "timer.repeatCount.secret", "ENC(J1sLt6MpTuCTROefLY3MwQXcbPEDXnReFqvNdf/mBta4fs2HuO1Jkl8YbASg2oVt)"); + } +} diff --git a/integration-tests/jasypt/src/test/java/org/apache/camel/quarkus/component/jasypt/it/JasyptFipsTest.java b/integration-tests/jasypt/src/test/java/org/apache/camel/quarkus/component/jasypt/it/JasyptFipsTest.java new file mode 100644 index 0000000000..5bf0167e9e --- /dev/null +++ b/integration-tests/jasypt/src/test/java/org/apache/camel/quarkus/component/jasypt/it/JasyptFipsTest.java @@ -0,0 +1,27 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.camel.quarkus.component.jasypt.it; + +import io.quarkus.test.junit.QuarkusTest; +import io.quarkus.test.junit.TestProfile; +import org.apache.camel.quarkus.test.EnabledIfFipsMode; + +@QuarkusTest +@TestProfile(JasyptFipsModeTestProfile.class) +@EnabledIfFipsMode +class JasyptFipsTest extends JasyptTest { +} diff --git a/integration-tests/jasypt/src/test/java/org/apache/camel/quarkus/component/jasypt/it/JasyptTest.java b/integration-tests/jasypt/src/test/java/org/apache/camel/quarkus/component/jasypt/it/JasyptTest.java index 9ce1cead39..90ed255e08 100644 --- a/integration-tests/jasypt/src/test/java/org/apache/camel/quarkus/component/jasypt/it/JasyptTest.java +++ b/integration-tests/jasypt/src/test/java/org/apache/camel/quarkus/component/jasypt/it/JasyptTest.java @@ -16,6 +16,7 @@ */ package org.apache.camel.quarkus.component.jasypt.it; +import io.quarkus.arc.DefaultBean; import io.quarkus.test.junit.QuarkusTest; import io.restassured.RestAssured; import org.junit.jupiter.api.Test; @@ -24,6 +25,7 @@ import org.junit.jupiter.params.provider.ValueSource; import static org.hamcrest.Matchers.is; +@DefaultBean @QuarkusTest class JasyptTest { @ParameterizedTest