View Javadoc

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