summaryrefslogtreecommitdiff
path: root/java/tools/src/main/java/org/apache/qpid/tools/TestParams.java
blob: 89d6462a39f235df938d22369f83a7aa0fff3dcc (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
/*
 *
 * Licensed to the Apache Software Foundation (ASF) under one
 * or more contributor license agreements.  See the NOTICE file
 * distributed with this work for additional information
 * regarding copyright ownership.  The ASF licenses this file
 * to you under the Apache License, Version 2.0 (the
 * "License"); you may not use this file except in compliance
 * with the License.  You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing,
 * software distributed under the License is distributed on an
 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
 * KIND, either express or implied.  See the License for the
 * specific language governing permissions and limitations
 * under the License.
 *
 */
package org.apache.qpid.tools;

import javax.jms.Session;

public class TestParams
{
    /*
     * By default the connection URL is used. 
     * This allows a user to easily specify a fully fledged URL any given property.
     * Ex. SSL parameters
     *  
     * By providing a host & port allows a user to simply override the URL.
     * This allows to create multiple clients in test scripts easily,
     * without having to deal with the long URL format. 
     */
    private String url = "amqp://guest:guest@clientid/testpath?brokerlist='tcp://localhost:5672'";
    
    private String host = "";
    
    private int port = -1;

    private String address = "queue; {create : always}";

    private int msg_size = 1024;

    private int msg_type = 1;   // not used yet

    private boolean cacheMessage = false;

    private boolean disableMessageID = false;

    private boolean disableTimestamp = false;

    private boolean durable = false;

    private boolean transacted = false;

    private int transaction_size = 1000;

    private int ack_mode = Session.AUTO_ACKNOWLEDGE;

    private int msg_count = 10;

    private int warmup_count = 1;
    
    private boolean random_msg_size = false;

    public TestParams()
    {
     
        url = System.getProperty("url",url);
        host = System.getProperty("host","");
        port = Integer.getInteger("port", -1);
        address = System.getProperty("address","queue");

        msg_size  = Integer.getInteger("msg_size", 1024);
        msg_type = Integer.getInteger("msg_type",1);
        cacheMessage = Boolean.getBoolean("cache_msg");
        disableMessageID = Boolean.getBoolean("disableMessageID");
        disableTimestamp = Boolean.getBoolean("disableTimestamp");
        durable = Boolean.getBoolean("durable");
        transacted = Boolean.getBoolean("transacted");
        transaction_size = Integer.getInteger("trans_size",1000);
        ack_mode = Integer.getInteger("ack_mode",Session.AUTO_ACKNOWLEDGE);
        msg_count = Integer.getInteger("msg_count",msg_count);
        warmup_count = Integer.getInteger("warmup_count",warmup_count);
        random_msg_size = Boolean.getBoolean("random_msg_size");
    }

    public String getUrl()
    {
        return url;
    }

    public String getHost()
    {
        return host;
    }

    public int getPort()
    {
        return port;
    }

    public String getAddress()
    {
        return address;
    }

    public int getAckMode()
    {
        return ack_mode;
    }

    public int getMsgCount()
    {
        return msg_count;
    }

    public int getMsgSize()
    {
        return msg_size;
    }

    public int getMsgType()
    {
        return msg_type;
    }

    public boolean isDurable()
    {
        return durable;
    }

    public boolean isTransacted()
    {
        return transacted;
    }

    public int getTransactionSize()
    {
        return transaction_size;
    }

    public int getWarmupCount()
    {
        return warmup_count;
    }

    public boolean isCacheMessage()
    {
        return cacheMessage;
    }

    public boolean isDisableMessageID()
    {
        return disableMessageID;
    }

    public boolean isDisableTimestamp()
    {
        return disableTimestamp;
    }
    
    public boolean isRandomMsgSize()
    {
        return random_msg_size;
    }

}