jeudi 27 septembre 2018

Spring Boot 2.0 Integration Test for JmsTemplate

I have a very simple MessageHandler class that thanks to Spring Boot works at runtime with just the following lines of code and config:

msg handler

@Component
public class MessageHandler {

    @JmsListener(destination = "${solace.jms.queueName}")
    public void processMsg(Message msg) {
        MessageHeaders hdrs = msg.getHeaders();
        etc...

main class

@SpringBootApplication
public class Application implements CommandLineRunner {

public static void main(String[] args) {
    SpringApplication.run(Application.class, args);
}

config

solace.jms.client-name=eeeee
solace.jms.client-password=dddd
solace.jms.client-username=ccccc
solace.jms.msg-vpn=bbbb
solace.jms.host=smf://aaaaa.xx.yy.com:8000
solace.jms.queueName=ffffff

What I'm looking for now is how to test this at compile time. Specific questions I have are how to Autowire the JmsTemplate as a mocked instance and what configuration values I should use in the test app properties.

Thanks

Aucun commentaire:

Enregistrer un commentaire