I am writing a Spring Boot application that uses Camel to listen to an SQS queue. Route definition:
from("aws-sqs://my-s3-notification-queue" +
"?amazonSQSClient=#sqsClient" +
"&deleteAfterRead=false")
.unmarshal().json(JsonLibrary.Jackson, S3EventNotification.class)
.bean(s3NotificationHandler);
sqsClient
is defined as a @Bean
in a @Configuration
file.
When running tests, I would like to mock the SQS endpoint so that I don't actually connect to AWS. How do I do this? I've tried writing my tests like
@RunWith(CamelSpringBootRunner.class)
@SpringBootTest
@MockEndpoints
public class ApplicationTests {
@Test
public void contextLoads() {
}
}
This should work if I'm reading the docs correctly, but it still tries to connect to AWS. What am I missing?
You can use Localstack using this you can mock multiple AWS service from your local system, without connecting AWS.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With