This is an automated email from the ASF dual-hosted git repository.

acosentino pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/camel.git


The following commit(s) were added to refs/heads/main by this push:
     new e0ae4f2194f CAMEL-22230 - Camel-PQC: Support more signature and KEM 
algorithms - Add no autowired tests for Mayo and Snova (#18584)
e0ae4f2194f is described below

commit e0ae4f2194fe6a378e52d1a28781bffad1b04310
Author: Andrea Cosentino <[email protected]>
AuthorDate: Thu Jul 10 18:35:28 2025 +0200

    CAMEL-22230 - Camel-PQC: Support more signature and KEM algorithms - Add no 
autowired tests for Mayo and Snova (#18584)
    
    Signed-off-by: Andrea Cosentino <[email protected]>
---
 .../pqc/PQCSignatureMAYONoAutowiredTest.java       | 76 ++++++++++++++++++++++
 .../pqc/PQCSignatureSNOVANoAutowiredTest.java      | 76 ++++++++++++++++++++++
 2 files changed, 152 insertions(+)

diff --git 
a/components/camel-pqc/src/test/java/org/apache/camel/component/pqc/PQCSignatureMAYONoAutowiredTest.java
 
b/components/camel-pqc/src/test/java/org/apache/camel/component/pqc/PQCSignatureMAYONoAutowiredTest.java
new file mode 100644
index 00000000000..b3629a3f012
--- /dev/null
+++ 
b/components/camel-pqc/src/test/java/org/apache/camel/component/pqc/PQCSignatureMAYONoAutowiredTest.java
@@ -0,0 +1,76 @@
+/*
+ * 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.component.pqc;
+
+import java.security.NoSuchAlgorithmException;
+import java.security.Security;
+
+import org.apache.camel.EndpointInject;
+import org.apache.camel.Produce;
+import org.apache.camel.ProducerTemplate;
+import org.apache.camel.builder.RouteBuilder;
+import org.apache.camel.component.mock.MockEndpoint;
+import org.apache.camel.test.junit5.CamelTestSupport;
+import org.bouncycastle.jce.provider.BouncyCastleProvider;
+import org.bouncycastle.pqc.jcajce.provider.BouncyCastlePQCProvider;
+import org.junit.jupiter.api.BeforeAll;
+import org.junit.jupiter.api.Test;
+
+import static org.junit.jupiter.api.Assertions.assertTrue;
+
+public class PQCSignatureMAYONoAutowiredTest extends CamelTestSupport {
+
+    @EndpointInject("mock:sign")
+    protected MockEndpoint resultSign;
+
+    @EndpointInject("mock:verify")
+    protected MockEndpoint resultVerify;
+
+    @Produce("direct:sign")
+    protected ProducerTemplate templateSign;
+
+    public PQCSignatureMAYONoAutowiredTest() throws NoSuchAlgorithmException {
+    }
+
+    @Override
+    protected RouteBuilder createRouteBuilder() {
+        return new RouteBuilder() {
+            @Override
+            public void configure() {
+                
from("direct:sign").to("pqc:sign?operation=sign&signatureAlgorithm=MAYO").to("mock:sign")
+                        
.to("pqc:verify?operation=verify&signatureAlgorithm=MAYO")
+                        .to("mock:verify");
+            }
+        };
+    }
+
+    @BeforeAll
+    public static void startup() throws Exception {
+        Security.addProvider(new BouncyCastleProvider());
+        Security.addProvider(new BouncyCastlePQCProvider());
+    }
+
+    @Test
+    void testSignAndVerify() throws Exception {
+        resultSign.expectedMessageCount(1);
+        resultVerify.expectedMessageCount(1);
+        templateSign.sendBody("Hello");
+        resultSign.assertIsSatisfied();
+        resultVerify.assertIsSatisfied();
+        
assertTrue(resultVerify.getExchanges().get(0).getMessage().getHeader(PQCConstants.VERIFY,
 Boolean.class));
+    }
+}
diff --git 
a/components/camel-pqc/src/test/java/org/apache/camel/component/pqc/PQCSignatureSNOVANoAutowiredTest.java
 
b/components/camel-pqc/src/test/java/org/apache/camel/component/pqc/PQCSignatureSNOVANoAutowiredTest.java
new file mode 100644
index 00000000000..caad15e2c61
--- /dev/null
+++ 
b/components/camel-pqc/src/test/java/org/apache/camel/component/pqc/PQCSignatureSNOVANoAutowiredTest.java
@@ -0,0 +1,76 @@
+/*
+ * 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.component.pqc;
+
+import java.security.NoSuchAlgorithmException;
+import java.security.Security;
+
+import org.apache.camel.EndpointInject;
+import org.apache.camel.Produce;
+import org.apache.camel.ProducerTemplate;
+import org.apache.camel.builder.RouteBuilder;
+import org.apache.camel.component.mock.MockEndpoint;
+import org.apache.camel.test.junit5.CamelTestSupport;
+import org.bouncycastle.jce.provider.BouncyCastleProvider;
+import org.bouncycastle.pqc.jcajce.provider.BouncyCastlePQCProvider;
+import org.junit.jupiter.api.BeforeAll;
+import org.junit.jupiter.api.Test;
+
+import static org.junit.jupiter.api.Assertions.assertTrue;
+
+public class PQCSignatureSNOVANoAutowiredTest extends CamelTestSupport {
+
+    @EndpointInject("mock:sign")
+    protected MockEndpoint resultSign;
+
+    @EndpointInject("mock:verify")
+    protected MockEndpoint resultVerify;
+
+    @Produce("direct:sign")
+    protected ProducerTemplate templateSign;
+
+    public PQCSignatureSNOVANoAutowiredTest() throws NoSuchAlgorithmException {
+    }
+
+    @Override
+    protected RouteBuilder createRouteBuilder() {
+        return new RouteBuilder() {
+            @Override
+            public void configure() {
+                
from("direct:sign").to("pqc:sign?operation=sign&signatureAlgorithm=SNOVA").to("mock:sign")
+                        
.to("pqc:verify?operation=verify&signatureAlgorithm=SNOVA")
+                        .to("mock:verify");
+            }
+        };
+    }
+
+    @BeforeAll
+    public static void startup() throws Exception {
+        Security.addProvider(new BouncyCastleProvider());
+        Security.addProvider(new BouncyCastlePQCProvider());
+    }
+
+    @Test
+    void testSignAndVerify() throws Exception {
+        resultSign.expectedMessageCount(1);
+        resultVerify.expectedMessageCount(1);
+        templateSign.sendBody("Hello");
+        resultSign.assertIsSatisfied();
+        resultVerify.assertIsSatisfied();
+        
assertTrue(resultVerify.getExchanges().get(0).getMessage().getHeader(PQCConstants.VERIFY,
 Boolean.class));
+    }
+}

Reply via email to