I'm trying to use Micronaut-jms to integrate ActiveMQ Artemis into my application. Everything worked perfectly until I started writing unit tests.
The issue I'm facing is that since my test's are annotated with @MicronautTest
when I run a test the whole application boots up.
All would be fine except the application will look for ActiveMQ Artemis, and as it is embedded and has not started yet, the application will throw an error and the test will fail.
How can I ensure that the embedded ActiveMQ Artemis is available for the application?
The test itself:
@MicronautTest
class DemoControllerSpec extends Specification {
@Shared
ActiveMQServer server
void setup() {
Configuration config = new ConfigurationImpl()
config.addAcceptorConfiguration("in-vm", "vm://0")
//config.addAcceptorConfiguration("tcp", "tcp://127.0.0.1:61616")
server = new ActiveMQServerImpl(config)
server.start()
}
void 'is server active'() {
expect:
server.active
}
}