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

davsclaus pushed a commit to branch camel-4.14.x
in repository https://gitbox.apache.org/repos/asf/camel.git


The following commit(s) were added to refs/heads/camel-4.14.x by this push:
     new f31b99fda19e CAMEL-24201: camel-aws2-step-functions - listExecutions 
sets the state machine ARN
f31b99fda19e is described below

commit f31b99fda19e7a64caf466de3db2b3a3a7ad0307
Author: Andrea Cosentino <[email protected]>
AuthorDate: Mon Jul 20 22:57:01 2026 +0200

    CAMEL-24201: camel-aws2-step-functions - listExecutions sets the state 
machine ARN
    
    Backport of #24928. listExecutions now reads 
CamelAwsStepFunctionsStateMachineArn,
    which the AWS ListExecutions API requires.
    
    Closes #24951
    
    Co-authored-by: Claude Fable 5 <[email protected]>
---
 .../component/aws2/stepfunctions/StepFunctions2Producer.java   |  4 ++++
 .../aws2/stepfunctions/AmazonStepFunctionsClientMock.java      | 10 ++++++++++
 .../aws2/stepfunctions/StepFunctions2ProducerTest.java         |  3 +++
 3 files changed, 17 insertions(+)

diff --git 
a/components/camel-aws/camel-aws2-step-functions/src/main/java/org/apache/camel/component/aws2/stepfunctions/StepFunctions2Producer.java
 
b/components/camel-aws/camel-aws2-step-functions/src/main/java/org/apache/camel/component/aws2/stepfunctions/StepFunctions2Producer.java
index 0dde2746e5da..1984fecc82ad 100644
--- 
a/components/camel-aws/camel-aws2-step-functions/src/main/java/org/apache/camel/component/aws2/stepfunctions/StepFunctions2Producer.java
+++ 
b/components/camel-aws/camel-aws2-step-functions/src/main/java/org/apache/camel/component/aws2/stepfunctions/StepFunctions2Producer.java
@@ -633,6 +633,10 @@ public class StepFunctions2Producer extends 
DefaultProducer {
             }
         } else {
             ListExecutionsRequest.Builder builder = 
ListExecutionsRequest.builder();
+            if 
(ObjectHelper.isNotEmpty(exchange.getIn().getHeader(StepFunctions2Constants.STATE_MACHINE_ARN)))
 {
+                String stateMachineArn = 
exchange.getIn().getHeader(StepFunctions2Constants.STATE_MACHINE_ARN, 
String.class);
+                builder.stateMachineArn(stateMachineArn);
+            }
             if 
(ObjectHelper.isNotEmpty(exchange.getIn().getHeader(StepFunctions2Constants.EXECUTIONS_MAX_RESULTS)))
 {
                 int maxRes = 
exchange.getIn().getHeader(StepFunctions2Constants.EXECUTIONS_MAX_RESULTS, 
Integer.class);
                 builder.maxResults(maxRes);
diff --git 
a/components/camel-aws/camel-aws2-step-functions/src/test/java/org/apache/camel/component/aws2/stepfunctions/AmazonStepFunctionsClientMock.java
 
b/components/camel-aws/camel-aws2-step-functions/src/test/java/org/apache/camel/component/aws2/stepfunctions/AmazonStepFunctionsClientMock.java
index 3e07a0d8186d..ed3f27d955ad 100644
--- 
a/components/camel-aws/camel-aws2-step-functions/src/test/java/org/apache/camel/component/aws2/stepfunctions/AmazonStepFunctionsClientMock.java
+++ 
b/components/camel-aws/camel-aws2-step-functions/src/test/java/org/apache/camel/component/aws2/stepfunctions/AmazonStepFunctionsClientMock.java
@@ -25,9 +25,18 @@ import software.amazon.awssdk.services.sfn.model.*;
 
 public class AmazonStepFunctionsClientMock implements SfnClient {
 
+    private ListExecutionsRequest lastListExecutionsRequest;
+
     public AmazonStepFunctionsClientMock() {
     }
 
+    /**
+     * The last request passed to {@link #listExecutions}, so tests can assert 
how it was built.
+     */
+    public ListExecutionsRequest getLastListExecutionsRequest() {
+        return lastListExecutionsRequest;
+    }
+
     @Override
     public CreateActivityResponse createActivity(CreateActivityRequest 
createActivityRequest) {
         CreateActivityResponse.Builder result = 
CreateActivityResponse.builder();
@@ -102,6 +111,7 @@ public class AmazonStepFunctionsClientMock implements 
SfnClient {
 
     @Override
     public ListExecutionsResponse listExecutions(ListExecutionsRequest 
listExecutionsRequest) {
+        this.lastListExecutionsRequest = listExecutionsRequest;
         ListExecutionsResponse.Builder result = 
ListExecutionsResponse.builder();
         List<ExecutionListItem> executionListItems = new ArrayList<>();
         
executionListItems.add(ExecutionListItem.builder().executionArn("aws:sfn-execution::test-arn").build());
diff --git 
a/components/camel-aws/camel-aws2-step-functions/src/test/java/org/apache/camel/component/aws2/stepfunctions/StepFunctions2ProducerTest.java
 
b/components/camel-aws/camel-aws2-step-functions/src/test/java/org/apache/camel/component/aws2/stepfunctions/StepFunctions2ProducerTest.java
index 4e2872568935..7dc58171855f 100644
--- 
a/components/camel-aws/camel-aws2-step-functions/src/test/java/org/apache/camel/component/aws2/stepfunctions/StepFunctions2ProducerTest.java
+++ 
b/components/camel-aws/camel-aws2-step-functions/src/test/java/org/apache/camel/component/aws2/stepfunctions/StepFunctions2ProducerTest.java
@@ -308,6 +308,7 @@ public class StepFunctions2ProducerTest extends 
CamelTestSupport {
             @Override
             public void process(Exchange exchange) {
                 exchange.getIn().setHeader(StepFunctions2Constants.OPERATION, 
StepFunctions2Operations.listExecutions);
+                
exchange.getIn().setHeader(StepFunctions2Constants.STATE_MACHINE_ARN, 
"aws:sfn::test-state-machine");
             }
         });
 
@@ -316,6 +317,8 @@ public class StepFunctions2ProducerTest extends 
CamelTestSupport {
         ListExecutionsResponse resultGet = (ListExecutionsResponse) 
exchange.getIn().getBody();
         assertEquals(1, resultGet.executions().size());
         assertEquals("aws:sfn-execution::test-arn", 
resultGet.executions().get(0).executionArn());
+        // ListExecutions requires the state machine ARN; it must be taken 
from the header.
+        assertEquals("aws:sfn::test-state-machine", 
clientMock.getLastListExecutionsRequest().stateMachineArn());
     }
 
     @Test

Reply via email to