View | Details | Raw Unified | Return to bug 55589
Collapse All | Expand All

(-)src/core/org/apache/jmeter/resources/messages_fr.properties (+5 lines)
Lines 445-450 Link Here
445
jms_msg_content=Contenu
445
jms_msg_content=Contenu
446
jms_object_message=Message Object
446
jms_object_message=Message Object
447
jms_point_to_point=Requ\u00EAte JMS Point-\u00E0-point
447
jms_point_to_point=Requ\u00EAte JMS Point-\u00E0-point
448
jms_properties=Propri\u00E9t\u00E9s JMS
449
jms_properties_title=Propri\u00E9t\u00E9s JMS
450
jms_properties_type=Classe de la Valeur
451
jms_properties_name=Nom
452
jms_properties_value=Valeur
448
jms_props=Propri\u00E9t\u00E9s JMS
453
jms_props=Propri\u00E9t\u00E9s JMS
449
jms_provider_url=URL du fournisseur
454
jms_provider_url=URL du fournisseur
450
jms_publisher=Requ\u00EAte JMS Publication
455
jms_publisher=Requ\u00EAte JMS Publication
(-)src/core/org/apache/jmeter/resources/messages.properties (+5 lines)
Lines 451-456 Link Here
451
jms_msg_content=Content
451
jms_msg_content=Content
452
jms_object_message=Object Message
452
jms_object_message=Object Message
453
jms_point_to_point=JMS Point-to-Point
453
jms_point_to_point=JMS Point-to-Point
454
jms_properties=JMS Properties
455
jms_properties_title=JMS Properties
456
jms_properties_name=Name
457
jms_properties_type=Class of value
458
jms_properties_value=Value
454
jms_props=JMS Properties
459
jms_props=JMS Properties
455
jms_provider_url=Provider URL
460
jms_provider_url=Provider URL
456
jms_publisher=JMS Publisher
461
jms_publisher=JMS Publisher
(-)src/protocol/jms/org/apache/jmeter/protocol/jms/control/gui/JMSPublisherGui.java (-6 / +5 lines)
Lines 28-40 Link Here
28
import javax.swing.event.ChangeEvent;
28
import javax.swing.event.ChangeEvent;
29
import javax.swing.event.ChangeListener;
29
import javax.swing.event.ChangeListener;
30
30
31
import org.apache.jmeter.config.Arguments;
32
import org.apache.jmeter.config.gui.ArgumentsPanel;
33
import org.apache.jmeter.gui.util.FilePanel;
31
import org.apache.jmeter.gui.util.FilePanel;
34
import org.apache.jmeter.gui.util.JLabeledRadioI18N;
32
import org.apache.jmeter.gui.util.JLabeledRadioI18N;
35
import org.apache.jmeter.gui.util.JSyntaxTextArea;
33
import org.apache.jmeter.gui.util.JSyntaxTextArea;
36
import org.apache.jmeter.gui.util.JTextScrollPane;
34
import org.apache.jmeter.gui.util.JTextScrollPane;
37
import org.apache.jmeter.gui.util.VerticalPanel;
35
import org.apache.jmeter.gui.util.VerticalPanel;
36
import org.apache.jmeter.protocol.jms.sampler.JMSProperties;
38
import org.apache.jmeter.protocol.jms.sampler.PublisherSampler;
37
import org.apache.jmeter.protocol.jms.sampler.PublisherSampler;
39
import org.apache.jmeter.samplers.gui.AbstractSamplerGui;
38
import org.apache.jmeter.samplers.gui.AbstractSamplerGui;
40
import org.apache.jmeter.testelement.TestElement;
39
import org.apache.jmeter.testelement.TestElement;
Lines 118-124 Link Here
118
    private final JLabeledRadioI18N destSetup =
117
    private final JLabeledRadioI18N destSetup =
119
        new JLabeledRadioI18N("jms_dest_setup", DEST_SETUP_ITEMS, DEST_SETUP_STATIC); // $NON-NLS-1$
118
        new JLabeledRadioI18N("jms_dest_setup", DEST_SETUP_ITEMS, DEST_SETUP_STATIC); // $NON-NLS-1$
120
119
121
    private ArgumentsPanel jmsPropertiesPanel;
120
    private JMSPropertiesPanel jmsPropertiesPanel;
122
121
123
    public JMSPublisherGui() {
122
    public JMSPublisherGui() {
124
        init();
123
        init();
Lines 177-183 Link Here
177
      sampler.setUseAuth(useAuth.isSelected());
176
      sampler.setUseAuth(useAuth.isSelected());
178
      sampler.setUseNonPersistentDelivery(useNonPersistentDelivery.isSelected());
177
      sampler.setUseNonPersistentDelivery(useNonPersistentDelivery.isSelected());
179
     
178
     
180
      Arguments args = (Arguments) jmsPropertiesPanel.createTestElement();
179
      JMSProperties args = (JMSProperties) jmsPropertiesPanel.createTestElement();
181
      sampler.setJMSProperties(args);
180
      sampler.setJMSProperties(args);
182
    }
181
    }
183
182
Lines 201-207 Link Here
201
        mainPanel.add(createAuthPane());
200
        mainPanel.add(createAuthPane());
202
        mainPanel.add(iterations);
201
        mainPanel.add(iterations);
203
202
204
        jmsPropertiesPanel = new ArgumentsPanel(JMeterUtils.getResString("jms_props")); //$NON-NLS-1$
203
        jmsPropertiesPanel = new JMSPropertiesPanel(); //$NON-NLS-1$
205
        mainPanel.add(jmsPropertiesPanel);
204
        mainPanel.add(jmsPropertiesPanel);
206
205
207
        configChoice.setLayout(new BoxLayout(configChoice, BoxLayout.X_AXIS));
206
        configChoice.setLayout(new BoxLayout(configChoice, BoxLayout.X_AXIS));
Lines 245-251 Link Here
245
        jmsPwd.setEnabled(false);
244
        jmsPwd.setEnabled(false);
246
        destSetup.setText(DEST_SETUP_STATIC);
245
        destSetup.setText(DEST_SETUP_STATIC);
247
        useNonPersistentDelivery.setSelected(false);
246
        useNonPersistentDelivery.setSelected(false);
248
        jmsPropertiesPanel.clear();
247
        jmsPropertiesPanel.clearGui();
249
    }
248
    }
250
249
251
    /**
250
    /**
(-)src/protocol/jms/org/apache/jmeter/protocol/jms/control/gui/JMSSamplerGui.java (-4 / +5 lines)
Lines 33-38 Link Here
33
import org.apache.jmeter.gui.util.HorizontalPanel;
33
import org.apache.jmeter.gui.util.HorizontalPanel;
34
import org.apache.jmeter.gui.util.JSyntaxTextArea;
34
import org.apache.jmeter.gui.util.JSyntaxTextArea;
35
import org.apache.jmeter.gui.util.JTextScrollPane;
35
import org.apache.jmeter.gui.util.JTextScrollPane;
36
import org.apache.jmeter.protocol.jms.sampler.JMSProperties;
36
import org.apache.jmeter.protocol.jms.sampler.JMSSampler;
37
import org.apache.jmeter.protocol.jms.sampler.JMSSampler;
37
import org.apache.jmeter.samplers.gui.AbstractSamplerGui;
38
import org.apache.jmeter.samplers.gui.AbstractSamplerGui;
38
import org.apache.jmeter.testelement.TestElement;
39
import org.apache.jmeter.testelement.TestElement;
Lines 72-78 Link Here
72
73
73
    private JLabeledChoice oneWay = new JLabeledChoice(JMeterUtils.getResString("jms_communication_style"), labels); //$NON-NLS-1$
74
    private JLabeledChoice oneWay = new JLabeledChoice(JMeterUtils.getResString("jms_communication_style"), labels); //$NON-NLS-1$
74
75
75
    private ArgumentsPanel jmsPropertiesPanel;
76
    private JMSPropertiesPanel jmsPropertiesPanel;
76
77
77
    private ArgumentsPanel jndiPropertiesPanel;
78
    private ArgumentsPanel jndiPropertiesPanel;
78
79
Lines 101-107 Link Here
101
        messageContent.setInitialText(""); // $NON-NLS-1$
102
        messageContent.setInitialText(""); // $NON-NLS-1$
102
        initialContextFactory.setText(""); // $NON-NLS-1$
103
        initialContextFactory.setText(""); // $NON-NLS-1$
103
        providerUrl.setText(""); // $NON-NLS-1$
104
        providerUrl.setText(""); // $NON-NLS-1$
104
        jmsPropertiesPanel.clear();
105
        jmsPropertiesPanel.clearGui();
105
        jndiPropertiesPanel.clear();
106
        jndiPropertiesPanel.clear();
106
    }
107
    }
107
108
Lines 133-139 Link Here
133
        Arguments jndiArgs = (Arguments) jndiPropertiesPanel.createTestElement();
134
        Arguments jndiArgs = (Arguments) jndiPropertiesPanel.createTestElement();
134
        element.setJNDIProperties(jndiArgs);
135
        element.setJNDIProperties(jndiArgs);
135
136
136
        Arguments args = (Arguments) jmsPropertiesPanel.createTestElement();
137
        JMSProperties args = (JMSProperties) jmsPropertiesPanel.createTestElement();
137
        element.setJMSProperties(args);
138
        element.setJMSProperties(args);
138
139
139
    }
140
    }
Lines 250-256 Link Here
250
        messageContent.setPreferredSize(pref);
251
        messageContent.setPreferredSize(pref);
251
        messagePanel.add(messageContentPanel, BorderLayout.CENTER);
252
        messagePanel.add(messageContentPanel, BorderLayout.CENTER);
252
253
253
        jmsPropertiesPanel = new ArgumentsPanel(JMeterUtils.getResString("jms_props")); //$NON-NLS-1$
254
        jmsPropertiesPanel = new JMSPropertiesPanel(); //$NON-NLS-1$
254
        messagePanel.add(jmsPropertiesPanel, BorderLayout.SOUTH);
255
        messagePanel.add(jmsPropertiesPanel, BorderLayout.SOUTH);
255
256
256
        Box mainPanel = Box.createVerticalBox();
257
        Box mainPanel = Box.createVerticalBox();
(-)src/protocol/jms/org/apache/jmeter/protocol/jms/control/gui/JMSPropertiesPanel.java (+369 lines)
Line 0 Link Here
1
/*
2
 * Licensed to the Apache Software Foundation (ASF) under one or more
3
 * contributor license agreements.  See the NOTICE file distributed with
4
 * this work for additional information regarding copyright ownership.
5
 * The ASF licenses this file to You under the Apache License, Version 2.0
6
 * (the "License"); you may not use this file except in compliance with
7
 * the License.  You may obtain a copy of the License at
8
 *
9
 *   http://www.apache.org/licenses/LICENSE-2.0
10
 *
11
 * Unless required by applicable law or agreed to in writing, software
12
 * distributed under the License is distributed on an "AS IS" BASIS,
13
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
 * See the License for the specific language governing permissions and
15
 * limitations under the License.
16
 *
17
 */
18
19
package org.apache.jmeter.protocol.jms.control.gui;
20
21
import java.awt.BorderLayout;
22
import java.awt.Dimension;
23
import java.awt.event.ActionEvent;
24
import java.awt.event.ActionListener;
25
26
import javax.swing.BorderFactory;
27
import javax.swing.DefaultCellEditor;
28
import javax.swing.JButton;
29
import javax.swing.JComboBox;
30
import javax.swing.JPanel;
31
import javax.swing.JScrollPane;
32
import javax.swing.JTable;
33
import javax.swing.ListSelectionModel;
34
import javax.swing.table.AbstractTableModel;
35
import javax.swing.table.TableCellEditor;
36
import javax.swing.table.TableColumn;
37
38
import org.apache.jmeter.config.gui.AbstractConfigGui;
39
import org.apache.jmeter.gui.util.HeaderAsPropertyRenderer;
40
import org.apache.jmeter.protocol.jms.sampler.JMSProperties;
41
import org.apache.jmeter.protocol.jms.sampler.JMSProperty;
42
import org.apache.jmeter.testelement.TestElement;
43
import org.apache.jmeter.util.JMeterUtils;
44
import org.apache.jorphan.gui.GuiUtils;
45
import org.apache.jorphan.logging.LoggingManager;
46
import org.apache.log.Logger;
47
48
/**
49
 * Handles input for Jms Properties
50
 * @since 2.10.1
51
 */
52
public class JMSPropertiesPanel extends AbstractConfigGui implements ActionListener {
53
54
    private static final long serialVersionUID = -2893899384410289131L;
55
56
    private static final Logger log = LoggingManager.getLoggerForClass();
57
58
    private static final String ADD_COMMAND = "Add"; //$NON-NLS-1$
59
60
    private static final String DELETE_COMMAND = "Delete"; //$NON-NLS-1$
61
62
    private static final int COL_NAME = 0;
63
    private static final int COL_VALUE = 1;
64
    private static final int COL_TYPE = 2;
65
66
    private InnerTableModel tableModel;
67
68
    private JTable jmsPropertiesTable;
69
70
    private JButton addButton;
71
72
    private JButton deleteButton;
73
74
75
    /**
76
     * Default Constructor.
77
     */
78
    public JMSPropertiesPanel() {
79
        tableModel = new InnerTableModel();
80
        init();
81
    }
82
83
    @Override
84
    public TestElement createTestElement() {
85
        JMSProperties jmsProperties = tableModel.jmsProperties;
86
        configureTestElement(jmsProperties);
87
        return (TestElement) jmsProperties.clone();
88
    }
89
90
    /**
91
     * Modifies a given TestElement to mirror the data in the gui components.
92
     *
93
     * @see org.apache.jmeter.gui.JMeterGUIComponent#modifyTestElement(TestElement)
94
     */
95
    @Override
96
    public void modifyTestElement(TestElement el) {
97
        GuiUtils.stopTableEditing(jmsPropertiesTable);
98
        JMSProperties jmsProperties = (JMSProperties) el;
99
        jmsProperties.clear();
100
        jmsProperties.addTestElement((TestElement) tableModel.jmsProperties.clone());
101
        configureTestElement(el);
102
    }
103
104
    /**
105
     * Clear GUI
106
     */
107
    @Override
108
    public void clearGui() {
109
        super.clearGui();
110
111
        tableModel.clearData();
112
        deleteButton.setEnabled(false);
113
    }
114
115
    /**
116
     * Configures GUI from el
117
     * @param el {@link TestElement}
118
     */
119
    @Override
120
    public void configure(TestElement el) {
121
        super.configure(el);
122
        tableModel.jmsProperties.clear();
123
        tableModel.jmsProperties.addTestElement((JMSProperties) el.clone());
124
        if (tableModel.getRowCount() != 0) {
125
            deleteButton.setEnabled(true);
126
        }
127
    }
128
129
    @Override
130
    public String getLabelResource() {
131
        return "jms_properties_title"; //$NON-NLS-1$
132
    }
133
134
    /**
135
     * Shows the main properties panel for this object.
136
     */
137
    private void init() {// called from ctor, so must not be overridable
138
        setLayout(new BorderLayout());
139
        setBorder(makeBorder());
140
        add(createPropertiesPanel(), BorderLayout.CENTER);
141
    }
142
143
    @Override
144
    public void actionPerformed(ActionEvent e) {
145
        String action = e.getActionCommand();
146
147
        if (action.equals(DELETE_COMMAND)) {
148
            if (tableModel.getRowCount() > 0) {
149
                // If a table cell is being edited, we must cancel the editing
150
                // before deleting the row.
151
                if (jmsPropertiesTable.isEditing()) {
152
                    TableCellEditor cellEditor = jmsPropertiesTable.getCellEditor(jmsPropertiesTable.getEditingRow(), jmsPropertiesTable
153
                            .getEditingColumn());
154
                    cellEditor.cancelCellEditing();
155
                }
156
157
                int rowSelected = jmsPropertiesTable.getSelectedRow();
158
159
                if (rowSelected != -1) {
160
                    tableModel.removeRow(rowSelected);
161
                    tableModel.fireTableDataChanged();
162
163
                    // Disable the DELETE and SAVE buttons if no rows remaining
164
                    // after delete.
165
                    if (tableModel.getRowCount() == 0) {
166
                        deleteButton.setEnabled(false);
167
                    }
168
169
                    // Table still contains one or more rows, so highlight
170
                    // (select) the appropriate one.
171
                    else {
172
                        int rowToSelect = rowSelected;
173
174
                        if (rowSelected >= tableModel.getRowCount()) {
175
                            rowToSelect = rowSelected - 1;
176
                        }
177
178
                        jmsPropertiesTable.setRowSelectionInterval(rowToSelect, rowToSelect);
179
                    }
180
                }
181
            }
182
        } else if (action.equals(ADD_COMMAND)) {
183
            // If a table cell is being edited, we should accept the current
184
            // value and stop the editing before adding a new row.
185
            GuiUtils.stopTableEditing(jmsPropertiesTable);
186
187
            tableModel.addNewRow();
188
            tableModel.fireTableDataChanged();
189
190
            // Enable the DELETE and SAVE buttons if they are currently
191
            // disabled.
192
            if (!deleteButton.isEnabled()) {
193
                deleteButton.setEnabled(true);
194
            }
195
196
            // Highlight (select) the appropriate row.
197
            int rowToSelect = tableModel.getRowCount() - 1;
198
            jmsPropertiesTable.setRowSelectionInterval(rowToSelect, rowToSelect);
199
        } 
200
    }
201
202
    public JPanel createPropertiesPanel() {
203
        // create the JTable that holds JMSProperty per row
204
        jmsPropertiesTable = new JTable(tableModel);
205
        jmsPropertiesTable.getTableHeader().setDefaultRenderer(new HeaderAsPropertyRenderer());
206
        jmsPropertiesTable.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
207
        jmsPropertiesTable.setPreferredScrollableViewportSize(new Dimension(100, 70));
208
209
        
210
        TableColumn mechanismColumn = jmsPropertiesTable.getColumnModel().getColumn(COL_TYPE);
211
        mechanismColumn.setCellEditor(new TypeCellEditor());
212
213
        JPanel panel = new JPanel(new BorderLayout(0, 5));
214
        panel.setBorder(BorderFactory.createTitledBorder(BorderFactory.createEtchedBorder(),
215
                JMeterUtils.getResString("jms_props"))); //$NON-NLS-1$
216
        panel.add(new JScrollPane(jmsPropertiesTable));
217
        panel.add(createButtonPanel(), BorderLayout.SOUTH);
218
        return panel;
219
    }
220
221
    private JButton createButton(String resName, char mnemonic, String command, boolean enabled) {
222
        JButton button = new JButton(JMeterUtils.getResString(resName));
223
        button.setMnemonic(mnemonic);
224
        button.setActionCommand(command);
225
        button.setEnabled(enabled);
226
        button.addActionListener(this);
227
        return button;
228
    }
229
230
    private JPanel createButtonPanel() {
231
        boolean tableEmpty = (tableModel.getRowCount() == 0);
232
233
        addButton = createButton("add", 'A', ADD_COMMAND, true); //$NON-NLS-1$
234
        deleteButton = createButton("delete", 'D', DELETE_COMMAND, !tableEmpty); //$NON-NLS-1$
235
       
236
        // Button Panel
237
        JPanel buttonPanel = new JPanel();
238
        buttonPanel.add(addButton);
239
        buttonPanel.add(deleteButton);
240
        return buttonPanel;
241
    }
242
243
    private static class InnerTableModel extends AbstractTableModel {
244
        private static final long serialVersionUID = 4638155137475747946L;
245
        final JMSProperties jmsProperties;
246
247
        public InnerTableModel() {
248
            jmsProperties = new JMSProperties();
249
        }
250
251
        public void addNewRow() {
252
            jmsProperties.addJmsProperty(new JMSProperty("","",String.class.getName()));
253
        }
254
255
        public void clearData() {
256
            jmsProperties.clear();
257
            fireTableDataChanged();
258
        }
259
260
        public void removeRow(int row) {
261
            jmsProperties.removeJmsProperty(row);
262
        }
263
264
        @Override
265
        public boolean isCellEditable(int row, int column) {
266
            // all table cells are editable
267
            return true;
268
        }
269
270
        @Override
271
        public Class<?> getColumnClass(int column) {
272
            return getValueAt(0, column).getClass();
273
        }
274
275
        /**
276
         * Required by table model interface.
277
         */
278
        @Override
279
        public int getRowCount() {
280
            return jmsProperties.getJmsPropertyCount();
281
        }
282
283
        /**
284
         * Required by table model interface.
285
         */
286
        @Override
287
        public int getColumnCount() {
288
            return 3;
289
        }
290
291
        /**
292
         * Required by table model interface.
293
         */
294
        @Override
295
        public String getColumnName(int column) {
296
            switch(column) {
297
                case COL_NAME:
298
                    return "name";
299
                case COL_VALUE:
300
                    return "value";
301
                case COL_TYPE:
302
                    return "jms_properties_type";
303
                default:
304
                    return null;
305
            }
306
        }
307
308
        /**
309
         * Required by table model interface.
310
         */
311
        @Override
312
        public Object getValueAt(int row, int column) {
313
            JMSProperty property = jmsProperties.getJmsProperty(row);
314
315
            switch (column){
316
                case COL_NAME:
317
                    return property.getName();
318
                case COL_VALUE:
319
                    return property.getValue();
320
                case COL_TYPE:
321
                    return property.getType();
322
                default:
323
                    return null;
324
            }
325
        }
326
327
        @Override
328
        public void setValueAt(Object value, int row, int column) {
329
            JMSProperty property = jmsProperties.getJmsProperty(row);
330
            if(log.isDebugEnabled()) {
331
                log.debug("Setting jms property value: " + value);
332
            }
333
            switch (column){
334
                case COL_NAME:
335
                    property.setName((String)value);
336
                    break;
337
                case COL_VALUE:
338
                    property.setValue((String) value);
339
                    break;
340
                case COL_TYPE:
341
                    property.setType((String) value);
342
                    break;
343
                default:
344
                    break;
345
            }
346
        }
347
    }
348
    
349
    private static class TypeCellEditor extends DefaultCellEditor {
350
351
        /**
352
         * 
353
         */
354
        private static final long serialVersionUID = 1L;
355
356
        public TypeCellEditor() {
357
            super(new JComboBox(new Object[]{
358
                    Boolean.class.getName(),
359
                    Byte.class.getName(),
360
                    Short.class.getName(),
361
                    Integer.class.getName(),
362
                    Long.class.getName(),
363
                    Float.class.getName(),
364
                    Double.class.getName(),
365
                    String.class.getName()
366
            }));
367
        }
368
    }
369
}
(-)src/protocol/jms/org/apache/jmeter/protocol/jms/sampler/PublisherSampler.java (-24 / +24 lines)
Lines 165-188 Link Here
165
        int loop = getIterationCount();
165
        int loop = getIterationCount();
166
        result.sampleStart();
166
        result.sampleStart();
167
        String type = getMessageChoice();
167
        String type = getMessageChoice();
168
        
168
        try {
169
        try {
170
            Map<String, Object> msgProperties = getJMSProperties().getJmsPropertysAsMap();
169
            for (int idx = 0; idx < loop; idx++) {
171
            for (int idx = 0; idx < loop; idx++) {
170
                if (JMSPublisherGui.TEXT_MSG_RSC.equals(type)){
172
                if (JMSPublisherGui.TEXT_MSG_RSC.equals(type)){
171
                    String tmsg = getMessageContent();
173
                    String tmsg = getMessageContent();
172
                    Message msg = publisher.publish(tmsg, getDestination(), getJMSProperties().getArgumentsAsMap());
174
                    Message msg = publisher.publish(tmsg, getDestination(), msgProperties);
173
                    buffer.append(tmsg);
175
                    buffer.append(tmsg);
174
                    Utils.messageProperties(propBuffer, msg);
176
                    Utils.messageProperties(propBuffer, msg);
175
                } else if (JMSPublisherGui.MAP_MSG_RSC.equals(type)){
177
                } else if (JMSPublisherGui.MAP_MSG_RSC.equals(type)){
176
                    Map<String, Object> m = getMapContent();
178
                    Map<String, Object> m = getMapContent();
177
                    Message msg = publisher.publish(m, getDestination(), getJMSProperties().getArgumentsAsMap());
179
                    Message msg = publisher.publish(m, getDestination(), msgProperties);
178
                    Utils.messageProperties(propBuffer, msg);
180
                    Utils.messageProperties(propBuffer, msg);
179
                } else if (JMSPublisherGui.OBJECT_MSG_RSC.equals(type)){
181
                } else if (JMSPublisherGui.OBJECT_MSG_RSC.equals(type)){
180
                    Serializable omsg = getObjectContent();
182
                    Serializable omsg = getObjectContent();
181
                    Message msg = publisher.publish(omsg, getDestination(), getJMSProperties().getArgumentsAsMap());
183
                    Message msg = publisher.publish(omsg, getDestination(), msgProperties);
182
                    Utils.messageProperties(propBuffer, msg);
184
                    Utils.messageProperties(propBuffer, msg);
183
                } else if (JMSPublisherGui.BYTES_MSG_RSC.equals(type)){
185
                } else if (JMSPublisherGui.BYTES_MSG_RSC.equals(type)){
184
                    byte[] bmsg = getBytesContent();
186
                    byte[] bmsg = getBytesContent();
185
                    Message msg = publisher.publish(bmsg, getDestination(), getJMSProperties().getArgumentsAsMap());
187
                    Message msg = publisher.publish(bmsg, getDestination(), msgProperties);
186
                    Utils.messageProperties(propBuffer, msg);
188
                    Utils.messageProperties(propBuffer, msg);
187
                } else {
189
                } else {
188
                    throw new JMSException(type+ " is not recognised");                    
190
                    throw new JMSException(type+ " is not recognised");                    
Lines 202-208 Link Here
202
        return result;
204
        return result;
203
    }
205
    }
204
206
205
206
    private Map<String, Object> getMapContent() throws ClassNotFoundException, SecurityException, NoSuchMethodException, IllegalArgumentException, IllegalAccessException, InvocationTargetException {
207
    private Map<String, Object> getMapContent() throws ClassNotFoundException, SecurityException, NoSuchMethodException, IllegalArgumentException, IllegalAccessException, InvocationTargetException {
207
        Map<String,Object> m = new HashMap<String,Object>();
208
        Map<String,Object> m = new HashMap<String,Object>();
208
        String text = getMessageContent();
209
        String text = getMessageContent();
Lines 502-532 Link Here
502
    public boolean getUseNonPersistentDelivery() {
503
    public boolean getUseNonPersistentDelivery() {
503
        return getPropertyAsBoolean(NON_PERSISTENT_DELIVERY, false);
504
        return getPropertyAsBoolean(NON_PERSISTENT_DELIVERY, false);
504
    }
505
    }
505
    
506
    public void setArguments(Arguments args) {
507
        setProperty(new TestElementProperty(JMS_PROPERTIES, args));
508
    }
509
    
510
    public Arguments getArguments(String name) {
511
        return (Arguments) getProperty(name).getObjectValue();
512
    }
513
506
514
    /** 
507
    /** 
515
     * @return Arguments JMS Properties
508
     * @return {@link JMSProperties} JMS Properties
516
     */
509
     */
517
    public Arguments getJMSProperties() {
510
    public JMSProperties getJMSProperties() {
518
        Arguments arguments = getArguments(JMS_PROPERTIES);
511
        Object o = getProperty(JMS_PROPERTIES).getObjectValue();
519
        if(arguments == null) {
512
        JMSProperties jmsProperties = null;
520
            arguments = new Arguments();
513
        // Backward compatibility with versions <= 2.10
521
            setArguments(arguments);
514
        if(o instanceof Arguments) {
515
            jmsProperties = Utils.convertArgumentsToJmsProperties((Arguments)o);
516
        } else {
517
            jmsProperties = (JMSProperties) o;
518
        }
519
        if(jmsProperties == null) {
520
            jmsProperties = new JMSProperties();
521
            setJMSProperties(jmsProperties);
522
        }
522
        }
523
        return arguments;
523
        return jmsProperties;
524
    }
524
    }
525
525
    
526
    /**
526
    /**
527
     * @param args Arguments JMS Properties
527
     * @param jmsProperties JMS Properties
528
     */
528
     */
529
    public void setJMSProperties(Arguments args) {
529
    public void setJMSProperties(JMSProperties jmsProperties) {
530
        setProperty(new TestElementProperty(JMS_PROPERTIES, args));
530
        setProperty(new TestElementProperty(JMS_PROPERTIES, jmsProperties));
531
    }
531
    }
532
}
532
}
(-)src/protocol/jms/org/apache/jmeter/protocol/jms/sampler/JMSProperty.java (+171 lines)
Line 0 Link Here
1
/*
2
 * Licensed to the Apache Software Foundation (ASF) under one or more
3
 * contributor license agreements.  See the NOTICE file distributed with
4
 * this work for additional information regarding copyright ownership.
5
 * The ASF licenses this file to You under the Apache License, Version 2.0
6
 * (the "License"); you may not use this file except in compliance with
7
 * the License.  You may obtain a copy of the License at
8
 *
9
 *   http://www.apache.org/licenses/LICENSE-2.0
10
 *
11
 * Unless required by applicable law or agreed to in writing, software
12
 * distributed under the License is distributed on an "AS IS" BASIS,
13
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
 * See the License for the specific language governing permissions and
15
 * limitations under the License.
16
 *
17
 */
18
19
package org.apache.jmeter.protocol.jms.sampler;
20
21
import java.io.Serializable;
22
23
import org.apache.jmeter.testelement.AbstractTestElement;
24
import org.apache.jmeter.testelement.property.StringProperty;
25
26
/**
27
 * JMS Property with type
28
 * @since 2.10.1
29
 */
30
public class JMSProperty extends AbstractTestElement implements Serializable {
31
32
33
    /**
34
     * 
35
     */
36
    private static final long serialVersionUID = 6371090992800805753L;
37
38
    /** Name used to store the JmsProperty's name. */
39
    public static final String PROP_NAME = "JMSProperty.name"; // $NON-NLS-1$
40
41
    /** Name used to store the JmsProperty's value. */
42
    public static final String PROP_VALUE = "JMSProperty.value"; // $NON-NLS-1$
43
44
    /** Name used to store the JmsProperty's description. */
45
    public static final String PROP_TYPE = "JMSProperty.type"; // $NON-NLS-1$
46
47
    private static final String DFLT_TYPE = String.class.getName();
48
49
    /**
50
     * Create a new JmsProperty without a name, value, or metadata.
51
     */
52
    public JMSProperty() {
53
    }
54
55
    /**
56
     * Create a new JmsProperty with the specified name and value, and String type.
57
     *
58
     * @param name
59
     *            the prop name
60
     * @param value
61
     *            the prop value
62
     */
63
    public JMSProperty(String name, String value) {
64
        this(name, value, DFLT_TYPE);
65
    }
66
67
    /**
68
     * Create a new JmsProperty with the specified name and value, and String type.
69
     *
70
     * @param name
71
     *            the prop name
72
     * @param value
73
     *            the prop value
74
     * @param type
75
     *            the type type
76
     */
77
    public JMSProperty(String name, String value, String type) {
78
        setProperty(new StringProperty(PROP_NAME, name));
79
        setProperty(new StringProperty(PROP_VALUE, value));
80
        setProperty(new StringProperty(PROP_TYPE, type));
81
    }
82
    
83
    /**
84
     * Set the name of the JmsProperty.
85
     *
86
     * @param newName
87
     *            the new name
88
     */
89
    @Override
90
    public void setName(String newName) {
91
        setProperty(new StringProperty(PROP_NAME, newName));
92
    }
93
94
    /**
95
     * Get the name of the JmsProperty.
96
     *
97
     * @return the attribute's name
98
     */
99
    @Override
100
    public String getName() {
101
        return getPropertyAsString(PROP_NAME);
102
    }
103
104
    /**
105
     * Sets the value of the JmsProperty.
106
     *
107
     * @param newValue
108
     *            the new value
109
     */
110
    public void setValue(String newValue) {
111
        setProperty(new StringProperty(PROP_VALUE, newValue));
112
    }
113
114
    /**
115
     * Gets the value of the JmsProperty object.
116
     *
117
     * @return the attribute's value
118
     */
119
    public String getValue() {
120
        return getPropertyAsString(PROP_VALUE);
121
    }
122
    
123
    /**
124
     * Sets the Meta Data attribute of the JmsProperty.
125
     *
126
     * @param newMetaData
127
     *            the new metadata
128
     */
129
    public void setType(String type) {
130
        setProperty(new StringProperty(PROP_TYPE, type));
131
    }
132
133
    /**
134
     * Gets the Meta Data attribute of the JmsProperty.
135
     *
136
     * @return the MetaData value
137
     */
138
    public String getType() {
139
        return getPropertyAsString(PROP_TYPE);
140
    }
141
142
    @Override
143
    public String toString() {
144
        return getName() + "," + getValue()+","+getType();
145
    }
146
147
    public Object getValueAsObject() {
148
        String type = getType();
149
        String value = getValue();
150
        
151
        if(type.equals(Boolean.class.getName())) {
152
            return Boolean.valueOf(value);
153
        } else if(type.equals(Byte.class.getName())) {
154
            return Byte.valueOf(value);
155
        } else if(type.equals(Short.class.getName())) {
156
            return Short.valueOf(value);
157
        } else if(type.equals(Integer.class.getName())) {
158
            return Integer.valueOf(value);
159
        } else if(type.equals(Long.class.getName())) {
160
            return Long.valueOf(value);
161
        } else if(type.equals(Float.class.getName())) {
162
            return Float.valueOf(value);
163
        } else if(type.equals(Double.class.getName())) {
164
            return Double.valueOf(value);
165
        } else if(type.equals(String.class.getName())) {
166
            return value;
167
        } else {
168
            return null;
169
        }
170
    }
171
}
(-)src/protocol/jms/org/apache/jmeter/protocol/jms/sampler/JMSProperties.java (+268 lines)
Line 0 Link Here
1
/*
2
 * Licensed to the Apache Software Foundation (ASF) under one or more
3
 * contributor license agreements.  See the NOTICE file distributed with
4
 * this work for additional information regarding copyright ownership.
5
 * The ASF licenses this file to You under the Apache License, Version 2.0
6
 * (the "License"); you may not use this file except in compliance with
7
 * the License.  You may obtain a copy of the License at
8
 *
9
 *   http://www.apache.org/licenses/LICENSE-2.0
10
 *
11
 * Unless required by applicable law or agreed to in writing, software
12
 * distributed under the License is distributed on an "AS IS" BASIS,
13
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
 * See the License for the specific language governing permissions and
15
 * limitations under the License.
16
 *
17
 */
18
19
package org.apache.jmeter.protocol.jms.sampler;
20
21
import java.io.Serializable;
22
import java.util.ArrayList;
23
import java.util.LinkedHashMap;
24
import java.util.List;
25
import java.util.Map;
26
27
import org.apache.jmeter.config.ConfigElement;
28
import org.apache.jmeter.config.ConfigTestElement;
29
import org.apache.jmeter.testelement.TestElement;
30
import org.apache.jmeter.testelement.property.CollectionProperty;
31
import org.apache.jmeter.testelement.property.PropertyIterator;
32
import org.apache.jmeter.testelement.property.TestElementProperty;
33
34
/**
35
 * A set of JMSProperty objects.
36
 * @since 2.10.1
37
 */
38
public class JMSProperties extends ConfigTestElement implements Serializable {
39
40
    /**
41
     * 
42
     */
43
    private static final long serialVersionUID = -2896138201054314563L;
44
    /** The name of the property used to store the JmsProperties. */
45
    public static final String JMS_PROPERTIES = "JMSProperties.properties"; //$NON-NLS-1$
46
47
    /**
48
     * Create a new JmsPropertys object with no JmsProperties
49
     */
50
    public JMSProperties() {
51
        setProperty(new CollectionProperty(JMS_PROPERTIES, new ArrayList<JMSProperty>()));
52
    }
53
54
    /**
55
     * Get the JmsPropertiess.
56
     *
57
     * @return the JmsProperties
58
     */
59
    public CollectionProperty getProperties() {
60
        return (CollectionProperty) getProperty(JMS_PROPERTIES);
61
    }
62
63
    /**
64
     * Clear the JmsProperties.
65
     */
66
    @Override
67
    public void clear() {
68
        super.clear();
69
        setProperty(new CollectionProperty(JMS_PROPERTIES, new ArrayList<JMSProperty>()));
70
    }
71
72
    /**
73
     * Set the list of JmsProperties. Any existing JmsProperties will be lost.
74
     *
75
     * @param jmsProperties
76
     *            the new JmsProperties
77
     */
78
    public void setProperties(List<JMSProperty> jmsProperties) {
79
        setProperty(new CollectionProperty(JMS_PROPERTIES, jmsProperties));
80
    }
81
82
    /**
83
     * Get the JmsProperties as a Map. Each JMSProperty name is used as the key, and
84
     * its value as the value.
85
     *
86
     * @return a new Map with String keys and values containing the JmsProperties
87
     */
88
    public Map<String, Object> getJmsPropertysAsMap() {
89
        PropertyIterator iter = getProperties().iterator();
90
        Map<String, Object> argMap = new LinkedHashMap<String, Object>();
91
        while (iter.hasNext()) {
92
            JMSProperty arg = (JMSProperty) iter.next().getObjectValue();
93
            // Because CollectionProperty.mergeIn will not prevent adding two
94
            // properties of the same name, we need to select the first value so
95
            // that this element's values prevail over defaults provided by
96
            // configuration
97
            // elements:
98
            if (!argMap.containsKey(arg.getName())) {
99
                argMap.put(arg.getName(), arg.getValueAsObject());
100
            }
101
        }
102
        return argMap;
103
    }
104
105
    /**
106
     * Add a new JMSProperty with the given name and value.
107
     *
108
     * @param name
109
     *            the name of the JMSProperty
110
     * @param value
111
     *            the value of the JMSProperty
112
     */
113
    public void addJmsProperty(String name, String value) {
114
        addJmsProperty(new JMSProperty(name, value));
115
    }
116
117
    /**
118
     * Add a new argument.
119
     *
120
     * @param arg
121
     *            the new argument
122
     */
123
    public void addJmsProperty(JMSProperty arg) {
124
        TestElementProperty newArg = new TestElementProperty(arg.getName(), arg);
125
        if (isRunningVersion()) {
126
            this.setTemporary(newArg);
127
        }
128
        getProperties().addItem(newArg);
129
    }
130
131
    /**
132
     * Add a new argument with the given name, value, and metadata.
133
     *
134
     * @param name
135
     *            the name of the argument
136
     * @param value
137
     *            the value of the argument
138
     * @param metadata
139
     *            the metadata for the argument
140
     */
141
    public void addJmsProperty(String name, String value, String type) {
142
        addJmsProperty(new JMSProperty(name, value, type));
143
    }
144
145
    /**
146
     * Get a PropertyIterator of the JmsProperties.
147
     *
148
     * @return an iteration of the JmsProperties
149
     */
150
    public PropertyIterator iterator() {
151
        return getProperties().iterator();
152
    }
153
154
    /**
155
     * Create a string representation of the JmsProperties.
156
     *
157
     * @return the string representation of the JmsProperties
158
     */
159
    @Override
160
    public String toString() {
161
        StringBuilder str = new StringBuilder();
162
        PropertyIterator iter = getProperties().iterator();
163
        while (iter.hasNext()) {
164
            JMSProperty arg = (JMSProperty) iter.next().getObjectValue();
165
            str.append(arg.toString());
166
            if (iter.hasNext()) {
167
                str.append(","); //$NON-NLS-1$
168
            }
169
        }
170
        return str.toString();
171
    }
172
173
    /**
174
     * Remove the specified argument from the list.
175
     *
176
     * @param row
177
     *            the index of the argument to remove
178
     */
179
    public void removeJmsProperty(int row) {
180
        if (row < getProperties().size()) {
181
            getProperties().remove(row);
182
        }
183
    }
184
185
    /**
186
     * Remove the specified argument from the list.
187
     *
188
     * @param arg
189
     *            the argument to remove
190
     */
191
    public void removeJmsProperty(JMSProperty arg) {
192
        PropertyIterator iter = getProperties().iterator();
193
        while (iter.hasNext()) {
194
            JMSProperty item = (JMSProperty) iter.next().getObjectValue();
195
            if (arg.equals(item)) {
196
                iter.remove();
197
            }
198
        }
199
    }
200
201
    /**
202
     * Remove the argument with the specified name.
203
     *
204
     * @param argName
205
     *            the name of the argument to remove
206
     */
207
    public void removeJmsProperty(String argName) {
208
        PropertyIterator iter = getProperties().iterator();
209
        while (iter.hasNext()) {
210
            JMSProperty arg = (JMSProperty) iter.next().getObjectValue();
211
            if (arg.getName().equals(argName)) {
212
                iter.remove();
213
            }
214
        }
215
    }
216
217
    /**
218
     * Remove all JmsProperties from the list.
219
     */
220
    public void removeAllJmsPropertys() {
221
        getProperties().clear();
222
    }
223
224
    /**
225
     * Get the number of JmsProperties in the list.
226
     *
227
     * @return the number of JmsProperties
228
     */
229
    public int getJmsPropertyCount() {
230
        return getProperties().size();
231
    }
232
233
    /**
234
     * Get a single JMSProperty.
235
     *
236
     * @param row
237
     *            the index of the JMSProperty to return.
238
     * @return the JMSProperty at the specified index, or null if no JMSProperty
239
     *         exists at that index.
240
     */
241
    public JMSProperty getJmsProperty(int row) {
242
        JMSProperty argument = null;
243
244
        if (row < getProperties().size()) {
245
            argument = (JMSProperty) getProperties().get(row).getObjectValue();
246
        }
247
248
        return argument;
249
    }
250
251
    /* (non-Javadoc)
252
     * @see org.apache.jmeter.config.ConfigTestElement#addTestElement(org.apache.jmeter.testelement.TestElement)
253
     */
254
    @Override
255
    public void addTestElement(TestElement parm1) {
256
        // TODO Auto-generated method stub
257
        super.addTestElement(parm1);
258
    }
259
260
    /* (non-Javadoc)
261
     * @see org.apache.jmeter.config.ConfigTestElement#addConfigElement(org.apache.jmeter.config.ConfigElement)
262
     */
263
    @Override
264
    public void addConfigElement(ConfigElement config) {
265
        // TODO Auto-generated method stub
266
        super.addConfigElement(config);
267
    }
268
}
(-)src/protocol/jms/org/apache/jmeter/protocol/jms/sampler/JMSSampler.java (-7 / +24 lines)
Lines 185-200 Link Here
185
    }
185
    }
186
186
187
    private void addJMSProperties(TextMessage msg) throws JMSException {
187
    private void addJMSProperties(TextMessage msg) throws JMSException {
188
        Map<String, String> map = getArguments(JMSSampler.JMS_PROPERTIES).getArgumentsAsMap();
188
        Utils.addJMSProperties(msg, getJMSProperties().getJmsPropertysAsMap());
189
        Utils.addJMSProperties(msg, map);
190
    }
189
    }
191
190
192
    public Arguments getJMSProperties() {
191
    /** 
193
        return getArguments(JMSSampler.JMS_PROPERTIES);
192
     * @return {@link JMSProperties} JMS Properties
193
     */
194
    public JMSProperties getJMSProperties() {
195
        Object o = getProperty(JMS_PROPERTIES).getObjectValue();
196
        JMSProperties jmsProperties = null;
197
        // Backward compatibility with versions <= 2.10
198
        if(o instanceof Arguments) {
199
            jmsProperties = Utils.convertArgumentsToJmsProperties((Arguments)o);
200
        } else {
201
            jmsProperties = (JMSProperties) o;
202
        }
203
        if(jmsProperties == null) {
204
            jmsProperties = new JMSProperties();
205
            setJMSProperties(jmsProperties);
206
        }
207
        return jmsProperties;
194
    }
208
    }
195
209
    
196
    public void setJMSProperties(Arguments args) {
210
    /**
197
        setProperty(new TestElementProperty(JMSSampler.JMS_PROPERTIES, args));
211
     * @param jmsProperties JMS Properties
212
     */
213
    public void setJMSProperties(JMSProperties jmsProperties) {
214
        setProperty(new TestElementProperty(JMS_PROPERTIES, jmsProperties));
198
    }
215
    }
199
216
200
    public Arguments getJNDIProperties() {
217
    public Arguments getJNDIProperties() {
(-)src/protocol/jms/org/apache/jmeter/protocol/jms/client/Publisher.java (-5 / +5 lines)
Lines 157-163 Link Here
157
        return publish(text, destinationName, null);
157
        return publish(text, destinationName, null);
158
    }
158
    }
159
    
159
    
160
    public Message publish(String text, String destinationName, Map<String, String> properties)
160
    public Message publish(String text, String destinationName, Map<String, Object> properties)
161
            throws JMSException, NamingException {
161
            throws JMSException, NamingException {
162
        TextMessage msg = session.createTextMessage(text);
162
        TextMessage msg = session.createTextMessage(text);
163
        return setPropertiesAndSend(destinationName, properties, msg);
163
        return setPropertiesAndSend(destinationName, properties, msg);
Lines 173-185 Link Here
173
        return publish(contents, destinationName, null);
173
        return publish(contents, destinationName, null);
174
    }
174
    }
175
    
175
    
176
    public Message publish(Serializable contents, String destinationName, Map<String, String> properties)
176
    public Message publish(Serializable contents, String destinationName, Map<String, Object> properties)
177
            throws JMSException, NamingException {
177
            throws JMSException, NamingException {
178
        ObjectMessage msg = session.createObjectMessage(contents);
178
        ObjectMessage msg = session.createObjectMessage(contents);
179
        return setPropertiesAndSend(destinationName, properties, msg);
179
        return setPropertiesAndSend(destinationName, properties, msg);
180
    }
180
    }
181
    
181
    
182
    public Message publish(byte[] bytes, String destinationName, Map<String, String> properties)
182
    public Message publish(byte[] bytes, String destinationName, Map<String, Object> properties)
183
            throws JMSException, NamingException {
183
            throws JMSException, NamingException {
184
        BytesMessage msg = session.createBytesMessage();
184
        BytesMessage msg = session.createBytesMessage();
185
        msg.writeBytes(bytes);
185
        msg.writeBytes(bytes);
Lines 196-202 Link Here
196
        return publish(map, destinationName, null);
196
        return publish(map, destinationName, null);
197
    }
197
    }
198
    
198
    
199
    public MapMessage publish(Map<String, Object> map, String destinationName, Map<String, String> properties)
199
    public MapMessage publish(Map<String, Object> map, String destinationName, Map<String, Object> properties)
200
            throws JMSException, NamingException {
200
            throws JMSException, NamingException {
201
        MapMessage msg = session.createMapMessage();
201
        MapMessage msg = session.createMapMessage();
202
        for (Entry<String, Object> me : map.entrySet()) {
202
        for (Entry<String, Object> me : map.entrySet()) {
Lines 214-220 Link Here
214
     * @throws NamingException
214
     * @throws NamingException
215
     */
215
     */
216
    private Message setPropertiesAndSend(String destinationName,
216
    private Message setPropertiesAndSend(String destinationName,
217
            Map<String, String> properties, Message msg)
217
            Map<String, Object> properties, Message msg)
218
            throws JMSException, NamingException {
218
            throws JMSException, NamingException {
219
        Utils.addJMSProperties(msg, properties);
219
        Utils.addJMSProperties(msg, properties);
220
        if (staticDest || destinationName == null) {
220
        if (staticDest || destinationName == null) {
(-)src/protocol/jms/org/apache/jmeter/protocol/jms/Utils.java (-5 / +23 lines)
Lines 31-36 Link Here
31
import javax.naming.Context;
31
import javax.naming.Context;
32
import javax.naming.NamingException;
32
import javax.naming.NamingException;
33
33
34
import org.apache.jmeter.config.Arguments;
35
import org.apache.jmeter.protocol.jms.sampler.JMSProperties;
34
import org.apache.jorphan.logging.LoggingManager;
36
import org.apache.jorphan.logging.LoggingManager;
35
import org.apache.log.Logger;
37
import org.apache.log.Logger;
36
38
Lines 171-193 Link Here
171
     * @param map Map<String, String>
173
     * @param map Map<String, String>
172
     * @throws JMSException
174
     * @throws JMSException
173
     */
175
     */
174
    public static void addJMSProperties(Message msg, Map<String, String> map) throws JMSException {
176
    public static void addJMSProperties(Message msg, Map<String, Object> map) throws JMSException {
175
        if(map == null) {
177
        if(map == null) {
176
            return;
178
            return;
177
        }
179
        }
178
        for (Map.Entry<String, String> me : map.entrySet()) {
180
        for (Map.Entry<String, Object> me : map.entrySet()) {
179
            String name = me.getKey();
181
            String name = me.getKey();
180
            String value = me.getValue();
182
            Object value = me.getValue();
181
            if (log.isDebugEnabled()) {
183
            if (log.isDebugEnabled()) {
182
                log.debug("Adding property [" + name + "=" + value + "]");
184
                log.debug("Adding property [" + name + "=" + value + "]");
183
            }
185
            }
184
186
185
            // WebsphereMQ does not allow corr. id. to be set using setStringProperty()
187
            // WebsphereMQ does not allow corr. id. to be set using setStringProperty()
186
            if("JMSCorrelationID".equalsIgnoreCase(name)) { // $NON-NLS-1$
188
            if("JMSCorrelationID".equalsIgnoreCase(name)) { // $NON-NLS-1$
187
                msg.setJMSCorrelationID(value);
189
                msg.setJMSCorrelationID((String)value);
188
            } else {
190
            } else {
189
                msg.setStringProperty(name, value);
191
                msg.setObjectProperty(name, value);
190
            }
192
            }
191
        }
193
        }
192
    }
194
    }
195
196
197
    /**
198
     * Converts {@link Arguments} to {@link JmsProperties} defaulting to String type
199
     * Used to convert version <= 2.10 test plans
200
     * @param args {@link Arguments}
201
     * @return jmsProperties {@link JmsProperties}
202
     */
203
    public static final JMSProperties convertArgumentsToJmsProperties(Arguments args) {
204
        JMSProperties jmsProperties = new JMSProperties();
205
        Map<String,String>  map = args.getArgumentsAsMap();
206
        for (Map.Entry<String, String> entry : map.entrySet()) {
207
            jmsProperties.addJmsProperty(entry.getKey(), entry.getValue());
208
        }
209
        return jmsProperties;
210
    }
193
}
211
}
(-)bin/saveservice.properties (+2 lines)
Lines 167-172 Link Here
167
JDBCSampler=org.apache.jmeter.protocol.jdbc.sampler.JDBCSampler
167
JDBCSampler=org.apache.jmeter.protocol.jdbc.sampler.JDBCSampler
168
# Renamed to JMSSamplerGui; keep original entry for backwards compatibility
168
# Renamed to JMSSamplerGui; keep original entry for backwards compatibility
169
JMSConfigGui=org.apache.jmeter.protocol.jms.control.gui.JMSConfigGui
169
JMSConfigGui=org.apache.jmeter.protocol.jms.control.gui.JMSConfigGui
170
JMSProperties=org.apache.jmeter.protocol.jms.sampler.JMSProperties
171
JMSProperty=org.apache.jmeter.protocol.jms.sampler.JMSProperty
170
JMSPublisherGui=org.apache.jmeter.protocol.jms.control.gui.JMSPublisherGui
172
JMSPublisherGui=org.apache.jmeter.protocol.jms.control.gui.JMSPublisherGui
171
JMSSampler=org.apache.jmeter.protocol.jms.sampler.JMSSampler
173
JMSSampler=org.apache.jmeter.protocol.jms.sampler.JMSSampler
172
JMSSamplerGui=org.apache.jmeter.protocol.jms.control.gui.JMSSamplerGui
174
JMSSamplerGui=org.apache.jmeter.protocol.jms.control.gui.JMSSamplerGui

Return to bug 55589