001 /*
002 *
003 * Licensed to the Apache Software Foundation (ASF) under one
004 * or more contributor license agreements. See the NOTICE file
005 * distributed with this work for additional information
006 * regarding copyright ownership. The ASF licenses this file
007 * to you under the Apache License, Version 2.0 (the
008 * "License"); you may not use this file except in compliance
009 * with the License. You may obtain a copy of the License at
010 *
011 * http://www.apache.org/licenses/LICENSE-2.0
012 *
013 * Unless required by applicable law or agreed to in writing,
014 * software distributed under the License is distributed on an
015 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
016 * KIND, either express or implied. See the License for the
017 * specific language governing permissions and limitations
018 * under the License.
019 *
020 */
021 package org.apache.qpid.server.exchange;
022
023 import org.apache.qpid.jms.Session;
024 import org.apache.qpid.junit.extensions.util.ParsedProperties;
025
026 /**
027 * MessagingTestConfigProperties defines a set of property names and default values for specifying a messaging topology,
028 * and test parameters for running a messaging test over that topology. A Properties object holding some of these
029 * properties, superimposed onto the defaults, is used to establish test topologies and control test behaviour.
030 *
031 * <p/>A complete list of the parameters, default values and comments on their usage is provided here:
032 *
033 * <p/><table><caption>Parameters</caption>
034 * <tr><th> Parameter <th> Default <th> Comments
035 * <tr><td> messageSize <td> 0 <td> Message size in bytes. Not including any headers.
036 * <tr><td> destinationName <td> ping <td> The root name to use to generate destination names to ping.
037 * <tr><td> persistent <td> false <td> Determines whether peristent delivery is used.
038 * <tr><td> transacted <td> false <td> Determines whether messages are sent/received in transactions.
039 * <tr><td> broker <td> tcp://localhost:5672 <td> Determines the broker to connect to.
040 * <tr><td> virtualHost <td> test <td> Determines the virtual host to send all ping over.
041 * <tr><td> rate <td> 0 <td> The maximum rate (in hertz) to send messages at. 0 means no limit.
042 * <tr><td> verbose <td> false <td> The verbose flag for debugging. Prints to console on every message.
043 * <tr><td> pubsub <td> false <td> Whether to ping topics or queues. Uses p2p by default.
044 * <tr><td> username <td> guest <td> The username to access the broker with.
045 * <tr><td> password <td> guest <td> The password to access the broker with.
046 * <tr><td> selector <td> null <td> Not used. Defines a message selector to filter pings with.
047 * <tr><td> destinationCount <td> 1 <td> The number of receivers listening to the pings.
048 * <tr><td> timeout <td> 30000 <td> In milliseconds. The timeout to stop waiting for replies.
049 * <tr><td> commitBatchSize <td> 1 <td> The number of messages per transaction in transactional mode.
050 * <tr><td> uniqueDests <td> true <td> Whether each receiver only listens to one ping destination or all.
051 * <tr><td> durableDests <td> false <td> Whether or not durable destinations are used.
052 * <tr><td> ackMode <td> AUTO_ACK <td> The message acknowledgement mode. Possible values are:
053 * 0 - SESSION_TRANSACTED
054 * 1 - AUTO_ACKNOWLEDGE
055 * 2 - CLIENT_ACKNOWLEDGE
056 * 3 - DUPS_OK_ACKNOWLEDGE
057 * 257 - NO_ACKNOWLEDGE
058 * 258 - PRE_ACKNOWLEDGE
059 * <tr><td> maxPending <td> 0 <td> The maximum size in bytes, of messages sent but not yet received.
060 * Limits the volume of messages currently buffered on the client
061 * or broker. Can help scale test clients by limiting amount of buffered
062 * data to avoid out of memory errors.
063 * </table>
064 *
065 * <p><table id="crc"><caption>CRC Card</caption>
066 * <tr><th> Responsibilities <th> Collaborations
067 * <tr><td> Provide the names and defaults of all test parameters.
068 * </table>
069 */
070 public class MessagingTestConfigProperties
071 {
072 // ====================== Connection Properties ==================================
073
074 /** Holds the name of the default connection configuration. */
075 public static final String CONNECTION_NAME = "broker";
076
077 /** Holds the name of the property to get the initial context factory name from. */
078 public static final String INITIAL_CONTEXT_FACTORY_PROPNAME = "java.naming.factory.initial";
079
080 /** Defines the class to use as the initial context factory by default. */
081 public static final String INITIAL_CONTEXT_FACTORY_DEFAULT = "org.apache.qpid.jndi.PropertiesFileInitialContextFactory";
082
083 /** Holds the name of the default connection factory configuration property. */
084 public static final String CONNECTION_PROPNAME = "connectionfactory.broker";
085
086 /** Defeins the default connection configuration. */
087 public static final String CONNECTION_DEFAULT = "amqp://guest:guest@clientid/?brokerlist='vm://:1'";
088
089 /** Holds the name of the property to get the test broker url from. */
090 public static final String BROKER_PROPNAME = "qpid.test.broker";
091
092 /** Holds the default broker url for the test. */
093 public static final String BROKER_DEFAULT = "vm://:1";
094
095 /** Holds the name of the property to get the test broker virtual path. */
096 public static final String VIRTUAL_HOST_PROPNAME = "virtualHost";
097
098 /** Holds the default virtual path for the test. */
099 public static final String VIRTUAL_HOST_DEFAULT = "";
100
101 /** Holds the name of the property to get the broker access username from. */
102 public static final String USERNAME_PROPNAME = "username";
103
104 /** Holds the default broker log on username. */
105 public static final String USERNAME_DEFAULT = "guest";
106
107 /** Holds the name of the property to get the broker access password from. */
108 public static final String PASSWORD_PROPNAME = "password";
109
110 /** Holds the default broker log on password. */
111 public static final String PASSWORD_DEFAULT = "guest";
112
113 // ====================== Messaging Topology Properties ==========================
114
115 /** Holds the name of the property to get the bind publisher procuder flag from. */
116 public static final String PUBLISHER_PRODUCER_BIND_PROPNAME = "publisherProducerBind";
117
118 /** Holds the default value of the publisher producer flag. */
119 public static final boolean PUBLISHER_PRODUCER_BIND_DEFAULT = true;
120
121 /** Holds the name of the property to get the bind publisher procuder flag from. */
122 public static final String PUBLISHER_CONSUMER_BIND_PROPNAME = "publisherConsumerBind";
123
124 /** Holds the default value of the publisher consumer flag. */
125 public static final boolean PUBLISHER_CONSUMER_BIND_DEFAULT = false;
126
127 /** Holds the name of the property to get the bind receiver procuder flag from. */
128 public static final String RECEIVER_PRODUCER_BIND_PROPNAME = "receiverProducerBind";
129
130 /** Holds the default value of the receiver producer flag. */
131 public static final boolean RECEIVER_PRODUCER_BIND_DEFAULT = false;
132
133 /** Holds the name of the property to get the bind receiver procuder flag from. */
134 public static final String RECEIVER_CONSUMER_BIND_PROPNAME = "receiverConsumerBind";
135
136 /** Holds the default value of the receiver consumer flag. */
137 public static final boolean RECEIVER_CONSUMER_BIND_DEFAULT = true;
138
139 /** Holds the name of the property to get the destination name root from. */
140 public static final String SEND_DESTINATION_NAME_ROOT_PROPNAME = "sendDestinationRoot";
141
142 /** Holds the root of the name of the default destination to send to. */
143 public static final String SEND_DESTINATION_NAME_ROOT_DEFAULT = "sendTo";
144
145 /** Holds the name of the property to get the destination name root from. */
146 public static final String RECEIVE_DESTINATION_NAME_ROOT_PROPNAME = "receiveDestinationRoot";
147
148 /** Holds the root of the name of the default destination to send to. */
149 public static final String RECEIVE_DESTINATION_NAME_ROOT_DEFAULT = "receiveFrom";
150
151 /** Holds the name of the proeprty to get the destination count from. */
152 public static final String DESTINATION_COUNT_PROPNAME = "destinationCount";
153
154 /** Defines the default number of destinations to ping. */
155 public static final int DESTINATION_COUNT_DEFAULT = 1;
156
157 /** Holds the name of the property to get the p2p or pub/sub messaging mode from. */
158 public static final String PUBSUB_PROPNAME = "pubsub";
159
160 /** Holds the pub/sub mode default, true means ping a topic, false means ping a queue. */
161 public static final boolean PUBSUB_DEFAULT = false;
162
163 // ====================== JMS Options and Flags =================================
164
165 /** Holds the name of the property to get the test delivery mode from. */
166 public static final String PERSISTENT_MODE_PROPNAME = "persistent";
167
168 /** Holds the message delivery mode to use for the test. */
169 public static final boolean PERSISTENT_MODE_DEFAULT = false;
170
171 /** Holds the name of the property to get the test transactional mode from. */
172 public static final String TRANSACTED_PROPNAME = "transacted";
173
174 /** Holds the transactional mode to use for the test. */
175 public static final boolean TRANSACTED_DEFAULT = false;
176
177 /** Holds the name of the property to set the no local flag from. */
178 public static final String NO_LOCAL_PROPNAME = "noLocal";
179
180 /** Defines the default value of the no local flag to use when consuming messages. */
181 public static final boolean NO_LOCAL_DEFAULT = false;
182
183 /** Holds the name of the property to get the message acknowledgement mode from. */
184 public static final String ACK_MODE_PROPNAME = "ackMode";
185
186 /** Defines the default message acknowledgement mode. */
187 public static final int ACK_MODE_DEFAULT = Session.AUTO_ACKNOWLEDGE;
188
189 /** Holds the name of the property to get the durable subscriptions flag from, when doing pub/sub messaging. */
190 public static final String DURABLE_SUBSCRIPTION_PROPNAME = "durableSubscription";
191
192 /** Defines the default value of the durable subscriptions flag. */
193 public static final boolean DURABLE_SUBSCRIPTION_DEFAULT = false;
194
195 // ====================== Qpid Options and Flags ================================
196
197 /** Holds the name of the property to set the exclusive flag from. */
198 public static final String EXCLUSIVE_PROPNAME = "exclusive";
199
200 /** Defines the default value of the exclusive flag to use when consuming messages. */
201 public static final boolean EXCLUSIVE_DEFAULT = false;
202
203 /** Holds the name of the property to set the immediate flag from. */
204 public static final String IMMEDIATE_PROPNAME = "immediate";
205
206 /** Defines the default value of the immediate flag to use when sending messages. */
207 public static final boolean IMMEDIATE_DEFAULT = false;
208
209 /** Holds the name of the property to set the mandatory flag from. */
210 public static final String MANDATORY_PROPNAME = "mandatory";
211
212 /** Defines the default value of the mandatory flag to use when sending messages. */
213 public static final boolean MANDATORY_DEFAULT = false;
214
215 /** Holds the name of the property to get the durable destinations flag from. */
216 public static final String DURABLE_DESTS_PROPNAME = "durableDests";
217
218 /** Default value for the durable destinations flag. */
219 public static final boolean DURABLE_DESTS_DEFAULT = false;
220
221 /** Holds the name of the proeprty to set the prefetch size from. */
222 public static final String PREFECTH_PROPNAME = "prefetch";
223
224 /** Defines the default prefetch size to use when consuming messages. */
225 public static final int PREFETCH_DEFAULT = 100;
226
227 // ====================== Common Test Parameters ================================
228
229 /** Holds the name of the property to get the test message size from. */
230 public static final String MESSAGE_SIZE_PROPNAME = "messageSize";
231
232 /** Used to set up a default message size. */
233 public static final int MESSAGE_SIZE_DEAFULT = 0;
234
235 /** Holds the name of the property to get the message rate from. */
236 public static final String RATE_PROPNAME = "rate";
237
238 /** Defines the default rate (in pings per second) to send pings at. 0 means as fast as possible, no restriction. */
239 public static final int RATE_DEFAULT = 0;
240
241 /** Holds the name of the proeprty to get the. */
242 public static final String SELECTOR_PROPNAME = "selector";
243
244 /** Holds the default message selector. */
245 public static final String SELECTOR_DEFAULT = "";
246
247 /** Holds the name of the property to get the waiting timeout for response messages. */
248 public static final String TIMEOUT_PROPNAME = "timeout";
249
250 /** Default time to wait before assuming that a ping has timed out. */
251 public static final long TIMEOUT_DEFAULT = 30000;
252
253 /** Holds the name of the property to get the commit batch size from. */
254 public static final String TX_BATCH_SIZE_PROPNAME = "commitBatchSize";
255
256 /** Defines the default number of pings to send in each transaction when running transactionally. */
257 public static final int TX_BATCH_SIZE_DEFAULT = 1;
258
259 /** Holds the name of the property to set the maximum amount of pending message data for a producer to hold. */
260 public static final String MAX_PENDING_PROPNAME = "maxPending";
261
262 /** Defines the default maximum quantity of pending message data to allow producers to hold. */
263 public static final int MAX_PENDING_DEFAULT = 0;
264
265 /** Holds the name of the property to get the verbose mode proeprty from. */
266 public static final String VERBOSE_PROPNAME = "verbose";
267
268 /** Holds the default verbose mode. */
269 public static final boolean VERBOSE_DEFAULT = false;
270
271 /** Holds the default configuration properties. */
272 public static ParsedProperties defaults = new ParsedProperties();
273
274 static
275 {
276 defaults.setPropertyIfNull(INITIAL_CONTEXT_FACTORY_PROPNAME, INITIAL_CONTEXT_FACTORY_DEFAULT);
277 defaults.setPropertyIfNull(CONNECTION_PROPNAME, CONNECTION_DEFAULT);
278 defaults.setPropertyIfNull(MESSAGE_SIZE_PROPNAME, MESSAGE_SIZE_DEAFULT);
279 defaults.setPropertyIfNull(PUBLISHER_PRODUCER_BIND_PROPNAME, PUBLISHER_PRODUCER_BIND_DEFAULT);
280 defaults.setPropertyIfNull(PUBLISHER_CONSUMER_BIND_PROPNAME, PUBLISHER_CONSUMER_BIND_DEFAULT);
281 defaults.setPropertyIfNull(RECEIVER_PRODUCER_BIND_PROPNAME, RECEIVER_PRODUCER_BIND_DEFAULT);
282 defaults.setPropertyIfNull(RECEIVER_CONSUMER_BIND_PROPNAME, RECEIVER_CONSUMER_BIND_DEFAULT);
283 defaults.setPropertyIfNull(SEND_DESTINATION_NAME_ROOT_PROPNAME, SEND_DESTINATION_NAME_ROOT_DEFAULT);
284 defaults.setPropertyIfNull(RECEIVE_DESTINATION_NAME_ROOT_PROPNAME, RECEIVE_DESTINATION_NAME_ROOT_DEFAULT);
285 defaults.setPropertyIfNull(PERSISTENT_MODE_PROPNAME, PERSISTENT_MODE_DEFAULT);
286 defaults.setPropertyIfNull(TRANSACTED_PROPNAME, TRANSACTED_DEFAULT);
287 defaults.setPropertyIfNull(BROKER_PROPNAME, BROKER_DEFAULT);
288 defaults.setPropertyIfNull(VIRTUAL_HOST_PROPNAME, VIRTUAL_HOST_DEFAULT);
289 defaults.setPropertyIfNull(RATE_PROPNAME, RATE_DEFAULT);
290 defaults.setPropertyIfNull(VERBOSE_PROPNAME, VERBOSE_DEFAULT);
291 defaults.setPropertyIfNull(PUBSUB_PROPNAME, PUBSUB_DEFAULT);
292 defaults.setPropertyIfNull(USERNAME_PROPNAME, USERNAME_DEFAULT);
293 defaults.setPropertyIfNull(PASSWORD_PROPNAME, PASSWORD_DEFAULT);
294 defaults.setPropertyIfNull(SELECTOR_PROPNAME, SELECTOR_DEFAULT);
295 defaults.setPropertyIfNull(DESTINATION_COUNT_PROPNAME, DESTINATION_COUNT_DEFAULT);
296 defaults.setPropertyIfNull(TIMEOUT_PROPNAME, TIMEOUT_DEFAULT);
297 defaults.setPropertyIfNull(TX_BATCH_SIZE_PROPNAME, TX_BATCH_SIZE_DEFAULT);
298 defaults.setPropertyIfNull(DURABLE_DESTS_PROPNAME, DURABLE_DESTS_DEFAULT);
299 defaults.setPropertyIfNull(ACK_MODE_PROPNAME, ACK_MODE_DEFAULT);
300 defaults.setPropertyIfNull(DURABLE_SUBSCRIPTION_PROPNAME, DURABLE_SUBSCRIPTION_DEFAULT);
301 defaults.setPropertyIfNull(MAX_PENDING_PROPNAME, MAX_PENDING_DEFAULT);
302 defaults.setPropertyIfNull(PREFECTH_PROPNAME, PREFETCH_DEFAULT);
303 defaults.setPropertyIfNull(NO_LOCAL_PROPNAME, NO_LOCAL_DEFAULT);
304 defaults.setPropertyIfNull(EXCLUSIVE_PROPNAME, EXCLUSIVE_DEFAULT);
305 defaults.setPropertyIfNull(IMMEDIATE_PROPNAME, IMMEDIATE_DEFAULT);
306 defaults.setPropertyIfNull(MANDATORY_PROPNAME, MANDATORY_DEFAULT);
307 }
308 }
|