This is an automated email from the ASF dual-hosted git repository.
davsclaus pushed a commit to branch camel-4.18.x
in repository https://gitbox.apache.org/repos/asf/camel.git
The following commit(s) were added to refs/heads/camel-4.18.x by this push:
new d2778f9560d6 CAMEL-24201: camel-aws2-step-functions - listExecutions
sets the state machine ARN
d2778f9560d6 is described below
commit d2778f9560d6025393d0d65d0fd6cc3342bc7c43
Author: Andrea Cosentino <[email protected]>
AuthorDate: Mon Jul 20 22:56:51 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 #24950
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 d9194ee7e561..3442f855efa3 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