Class ActiveMQProducerExtension

  • All Implemented Interfaces:
    ActiveMQProducerOperations, org.junit.jupiter.api.extension.AfterAllCallback, org.junit.jupiter.api.extension.BeforeAllCallback, org.junit.jupiter.api.extension.Extension

    public class ActiveMQProducerExtension
    extends Object
    implements org.junit.jupiter.api.extension.BeforeAllCallback, org.junit.jupiter.api.extension.AfterAllCallback, ActiveMQProducerOperations
    A JUnit Extension that embeds an ActiveMQ Artemis ClientProducer bound to a specific address into a test.

    This JUnit Extension is designed to simplify using ActiveMQ Artemis clients in unit tests. Adding the extension to a test will startup a ClientProducer, which can then be used to feed messages to the bound address on an ActiveMQ Artemis server.

    
     public class SimpleTest {
         @RegisterExtension
         private ActiveMQProducerExtension producer = new ActiveMQProducerExtension( "vm://0", "test.queue");
    
         @Test
         public void testSomething() throws Exception {
             // Use the embedded ClientProducer here
             producer.sendMessage( "String Body" );
         }
     }
     
    • Constructor Detail

      • ActiveMQProducerExtension

        protected ActiveMQProducerExtension​(String url,
                                            String username,
                                            String password)
      • ActiveMQProducerExtension

        protected ActiveMQProducerExtension​(String url)
      • ActiveMQProducerExtension

        protected ActiveMQProducerExtension​(org.apache.activemq.artemis.api.core.client.ServerLocator serverLocator,
                                            String username,
                                            String password)
      • ActiveMQProducerExtension

        protected ActiveMQProducerExtension​(org.apache.activemq.artemis.api.core.client.ServerLocator serverLocator)
      • ActiveMQProducerExtension

        public ActiveMQProducerExtension​(String url,
                                         String address,
                                         String username,
                                         String password)
      • ActiveMQProducerExtension

        public ActiveMQProducerExtension​(String url,
                                         String address)
      • ActiveMQProducerExtension

        public ActiveMQProducerExtension​(String url,
                                         SimpleString address)
      • ActiveMQProducerExtension

        public ActiveMQProducerExtension​(org.apache.activemq.artemis.api.core.client.ServerLocator serverLocator,
                                         String address,
                                         String username,
                                         String password)
      • ActiveMQProducerExtension

        public ActiveMQProducerExtension​(org.apache.activemq.artemis.api.core.client.ServerLocator serverLocator,
                                         String address)
      • ActiveMQProducerExtension

        public ActiveMQProducerExtension​(org.apache.activemq.artemis.api.core.client.ServerLocator serverLocator,
                                         SimpleString address,
                                         String username,
                                         String password)
      • ActiveMQProducerExtension

        public ActiveMQProducerExtension​(org.apache.activemq.artemis.api.core.client.ServerLocator serverLocator,
                                         SimpleString address)