View Javadoc
1   /*
2    * Copyright (c) MuleSoft, Inc.  All rights reserved.  http://www.mulesoft.com
3    * The software in this package is published under the terms of the CPAL v1.0
4    * license, a copy of which has been included with this distribution in the
5    * LICENSE.txt file.
6    */
7   package org.mule.transport.jms.integration;
8   
9   import org.mule.tck.ParameterizedConfiguration;
10  
11  import javax.jms.Connection;
12  import javax.jms.ConnectionFactory;
13  
14  /**
15   * Abstracts all the Jms Vendor specific configuration for the Jms integration test suite.
16   * An implementation of this class must be created for each Jms Vendor that gets tested.
17   *
18   * The integration tests use a fixed set of destination names since some Jms vendors require
19   * that all destinations are configured beforehand.  The queue configurations that must be
20   * made available are:
21   *
22   * - 'in' Queue
23   * - 'middle' Queue
24   * - 'middle2' Queue
25   * - 'middle3' Queue
26   * - 'out' Queue
27   * - 'broadcast' Topic
28   *
29   * Also, there will need to be a {@link javax.jms.QueueConnectionFactory}, {@link javax.jms.TopicConnectionFactory},
30   * {@link javax.jms.XAQueueConnectionFactory} and {@link javax.jms.XATopicConnectionFactory} available. These will be
31   * used to create JMS {@link javax.jms.Connection} objects using the {@link #getConnection(boolean, boolean)} method of
32   * this class.
33   *
34   * Note that this class defines a single method for {@link #getMiddleDestinationName()} but the {@link AbstractJmsFunctionalTestCase}
35   * will made available 'middle' destination references i.e. 'middle2' and 'middle3'.
36   *
37   * Fore more inforation about the JMS Integration tests see {@link AbstractJmsFunctionalTestCase}
38   */
39  public interface JmsVendorConfiguration extends ParameterizedConfiguration
40  {
41      /**
42       * Create a connection factory for the Jms profider being tested
43       * 
44       * @param topic whether to use a topic or queue connection factory, for 1.1
45       *            implementations this proerty can be ignored
46       * @param xa whether to create an XA connection factory
47       * @return a new JMS connection
48       */
49      public abstract Connection getConnection(boolean topic, boolean xa) throws Exception;
50  
51      /**
52       * Returns the {@link #getInboundDestinationName()} in the form of an endpoint URI i.e.
53       * jms://in
54       *
55       * @return the Inbound JMS endpoint
56       */
57      public String getInboundEndpoint();
58  
59       /**
60       * Returns the {@link #getOutboundDestinationName()} in the form of an endpoint URI i.e.
61       * jms://out
62        *
63       * @return the Outbound JMS endpoint
64       */
65      public String getOutboundEndpoint();
66  
67       /**
68       * Returns the {@link #getMiddleDestinationName()} in the form of an endpoint URI i.e.
69       * jms://middle
70        *
71       * @return the middle JMS endpoint
72       */
73      public String getMiddleEndpoint();
74  
75       /**
76       * Returns the {@link #getBroadcastDestinationName()} in the form of an endpoint URI i.e.
77       * jms://topic:broadcast
78        *
79       * @return the Broadcast JMS topic endpoint
80       */
81      public String getTopicBroadcastEndpoint();
82  
83      /**
84       * Returns the {@link #getDeadLetterDestinationName()} in the form of an endpoint URI i.e.
85       * jms://dlq
86        *
87       * @return the dead letter JMS endpoint
88       */
89      public String getDeadLetterEndpoint();
90  
91      /**
92       * The test inbound queue name.  For consistency this should always be 'in'. Note that you need to make
93       * sure that this queue is available in the the JMS provider being tested.
94       *
95       * @return The test inbound destination name
96       */
97      public String getInboundDestinationName();
98  
99      /**
100      * The test outbound queue name.  For consistency this should always be 'out'. Note that you need to make
101      * sure that this queue is available in the the JMS provider being tested.
102      *
103      * @return The test outbound destination name
104      */
105     public String getOutboundDestinationName();
106 
107     /**
108      * The test middle queue name.  For consistency this should always be 'middle'. This value is used to create
109      * multiple middle queues, namely, 'middle', 'middle2', 'middle3'. You need to make
110      * sure that these queues are available in the the JMS provider being tested.
111      *
112      * @return The test middle destination name
113      */
114     public String getMiddleDestinationName();
115 
116     /**
117      * The test broadcast topic name.  For consistency this should always be 'broadcast'. Note that you need to make
118      * sure that this topic is available in the the JMS provider being tested.
119      *
120      * @return The test broadcast topic name
121      */
122     public String getBroadcastDestinationName();
123 
124     /**
125      * The test dead letter queue name.  For consistency this should always be 'dlq'. Note that you need to make
126      * sure that this queue is available in the the JMS provider being tested.
127      *
128      * @return The test dead letterdestination name
129      */
130     public String getDeadLetterDestinationName();
131     
132     /**
133      * Timeout in milliseconds used when checking that a message is NOT present. This is usually 1000-2000ms.
134      * It is customizable so that slow connections i.e. over a wAN can be accounted for.
135      * 
136      * @return timeout in milliseconds used when checking that a message is NOT present
137      */
138     public long getSmallTimeout();
139 
140     /**
141      * The timeout in milliseconds used when waiting for a message to arrive. This is usually 3000-5000ms.
142      * However, it is customizable so that slow connections i.e. over a wAN can be accounted for.
143      * 
144      * @return The timeout used when waiting for a message to arrive
145      */
146     public long getTimeout();
147 
148     /**
149      * The protocol used for creating endpoints.  This is usually 'jms' but for specific messaging transports
150      * such as WebsphereMQ the protocol will be the protocol of the transport i.e. 'wmq'.
151      * @return returns the transport protocol
152      */
153     public String getProtocol();
154 
155     /**
156      * @return a ConnectionFactory implementation used for unit testing of the provider, 
157      * usually consisting of some mocked-up methods.
158      */
159     public ConnectionFactory getTestConnectionFactory();
160 }