Package org.apache.activemq.junit
Class AbstractActiveMQClientResource
- java.lang.Object
-
- org.junit.rules.ExternalResource
-
- org.apache.activemq.junit.AbstractActiveMQClientResource
-
- All Implemented Interfaces:
org.junit.rules.TestRule
- Direct Known Subclasses:
AbstractActiveMQConsumerResource,AbstractActiveMQProducerResource
public abstract class AbstractActiveMQClientResource extends org.junit.rules.ExternalResource
-
-
Constructor Summary
Constructors Constructor Description AbstractActiveMQClientResource(String destinationName, URI brokerURI)AbstractActiveMQClientResource(String destinationName, URI brokerURI, String userName, String password)AbstractActiveMQClientResource(String destinationName, org.apache.activemq.ActiveMQConnectionFactory connectionFactory)AbstractActiveMQClientResource(String destinationName, EmbeddedActiveMQBroker embeddedActiveMQBroker)AbstractActiveMQClientResource(URI brokerURI)AbstractActiveMQClientResource(URI brokerURI, String userName, String password)AbstractActiveMQClientResource(org.apache.activemq.ActiveMQConnectionFactory connectionFactory)AbstractActiveMQClientResource(EmbeddedActiveMQBroker embeddedActiveMQBroker)
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description protected voidafter()Stop the Clientprotected voidbefore()Start the Clientjavax.jms.BytesMessagecreateBytesMessage()protected abstract voidcreateClient()protected org.apache.activemq.command.ActiveMQDestinationcreateDestination(String destinationName)javax.jms.MapMessagecreateMapMessage()javax.jms.BytesMessagecreateMessage(byte[] body)javax.jms.BytesMessagecreateMessage(byte[] body, Map<String,Object> properties)javax.jms.ObjectMessagecreateMessage(Serializable body)javax.jms.ObjectMessagecreateMessage(Serializable body, Map<String,Object> properties)javax.jms.TextMessagecreateMessage(String body)javax.jms.TextMessagecreateMessage(String body, Map<String,Object> properties)javax.jms.MapMessagecreateMessage(Map<String,Object> body)javax.jms.MapMessagecreateMessage(Map<String,Object> body, Map<String,Object> properties)javax.jms.ObjectMessagecreateObjectMessage()javax.jms.StreamMessagecreateStreamMessage()javax.jms.TextMessagecreateTextMessage()StringgetBrokerURL()StringgetClientId()StringgetDestinationName()abstract bytegetDestinationType()static voidsetMessageProperties(javax.jms.Message message, Map<String,Object> properties)voidstart()voidstop()
-
-
-
Constructor Detail
-
AbstractActiveMQClientResource
public AbstractActiveMQClientResource(org.apache.activemq.ActiveMQConnectionFactory connectionFactory)
-
AbstractActiveMQClientResource
public AbstractActiveMQClientResource(URI brokerURI)
-
AbstractActiveMQClientResource
public AbstractActiveMQClientResource(EmbeddedActiveMQBroker embeddedActiveMQBroker)
-
AbstractActiveMQClientResource
public AbstractActiveMQClientResource(URI brokerURI, String userName, String password)
-
AbstractActiveMQClientResource
public AbstractActiveMQClientResource(String destinationName, org.apache.activemq.ActiveMQConnectionFactory connectionFactory)
-
AbstractActiveMQClientResource
public AbstractActiveMQClientResource(String destinationName, URI brokerURI)
-
AbstractActiveMQClientResource
public AbstractActiveMQClientResource(String destinationName, EmbeddedActiveMQBroker embeddedActiveMQBroker)
-
-
Method Detail
-
setMessageProperties
public static void setMessageProperties(javax.jms.Message message, Map<String,Object> properties) throws javax.jms.JMSException- Throws:
javax.jms.JMSException
-
getClientId
public String getClientId()
-
getDestinationName
public String getDestinationName()
-
getDestinationType
public abstract byte getDestinationType()
-
createClient
protected abstract void createClient() throws javax.jms.JMSException- Throws:
javax.jms.JMSException
-
before
protected void before() throws ThrowableStart the Client Invoked by JUnit to setup the resource- Overrides:
beforein classorg.junit.rules.ExternalResource- Throws:
Throwable
-
after
protected void after()
Stop the Client Invoked by JUnit to tear down the resource- Overrides:
afterin classorg.junit.rules.ExternalResource
-
start
public void start()
-
stop
public void stop()
-
getBrokerURL
public String getBrokerURL()
-
createDestination
protected org.apache.activemq.command.ActiveMQDestination createDestination(String destinationName)
-
createBytesMessage
public javax.jms.BytesMessage createBytesMessage() throws javax.jms.JMSException- Throws:
javax.jms.JMSException
-
createTextMessage
public javax.jms.TextMessage createTextMessage() throws javax.jms.JMSException- Throws:
javax.jms.JMSException
-
createMapMessage
public javax.jms.MapMessage createMapMessage() throws javax.jms.JMSException- Throws:
javax.jms.JMSException
-
createObjectMessage
public javax.jms.ObjectMessage createObjectMessage() throws javax.jms.JMSException- Throws:
javax.jms.JMSException
-
createStreamMessage
public javax.jms.StreamMessage createStreamMessage() throws javax.jms.JMSException- Throws:
javax.jms.JMSException
-
createMessage
public javax.jms.BytesMessage createMessage(byte[] body) throws javax.jms.JMSException- Throws:
javax.jms.JMSException
-
createMessage
public javax.jms.TextMessage createMessage(String body) throws javax.jms.JMSException
- Throws:
javax.jms.JMSException
-
createMessage
public javax.jms.MapMessage createMessage(Map<String,Object> body) throws javax.jms.JMSException
- Throws:
javax.jms.JMSException
-
createMessage
public javax.jms.ObjectMessage createMessage(Serializable body) throws javax.jms.JMSException
- Throws:
javax.jms.JMSException
-
createMessage
public javax.jms.BytesMessage createMessage(byte[] body, Map<String,Object> properties) throws javax.jms.JMSException- Throws:
javax.jms.JMSException
-
createMessage
public javax.jms.TextMessage createMessage(String body, Map<String,Object> properties) throws javax.jms.JMSException
- Throws:
javax.jms.JMSException
-
createMessage
public javax.jms.MapMessage createMessage(Map<String,Object> body, Map<String,Object> properties) throws javax.jms.JMSException
- Throws:
javax.jms.JMSException
-
createMessage
public javax.jms.ObjectMessage createMessage(Serializable body, Map<String,Object> properties) throws javax.jms.JMSException
- Throws:
javax.jms.JMSException
-
-