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

(-)src/core/org/apache/jmeter/resources/messages_fr.properties (+4 lines)
Lines 194-199 Link Here
194
counter_per_user=Suivre le compteur ind\u00E9pendamment pour chaque unit\u00E9 de test
194
counter_per_user=Suivre le compteur ind\u00E9pendamment pour chaque unit\u00E9 de test
195
counter_reset_per_tg_iteration=R\u00E9initialiser le compteur \u00E0 chaque it\u00E9ration du groupe d'unit\u00E9s
195
counter_reset_per_tg_iteration=R\u00E9initialiser le compteur \u00E0 chaque it\u00E9ration du groupe d'unit\u00E9s
196
countlim=Limiter le nombre d'\u00E9l\u00E9ments retourn\u00E9s \u00E0
196
countlim=Limiter le nombre d'\u00E9l\u00E9ments retourn\u00E9s \u00E0
197
create_from_template=Mod\u00E8les
197
cssjquery_attribute=Attribut
198
cssjquery_attribute=Attribut
198
cssjquery_impl=Impl\u00E9mentation CSS/JQuery\:
199
cssjquery_impl=Impl\u00E9mentation CSS/JQuery\:
199
cssjquery_render_no_text=Les donn\u00E9es de r\u00E9ponse ne sont pas du texte.
200
cssjquery_render_no_text=Les donn\u00E9es de r\u00E9ponse ne sont pas du texte.
Lines 1035-1041 Link Here
1035
tcp_sample_title=Requ\u00EAte TCP
1036
tcp_sample_title=Requ\u00EAte TCP
1036
tcp_timeout=Expiration (millisecondes) \:
1037
tcp_timeout=Expiration (millisecondes) \:
1037
teardown_on_shutdown=Ex\u00E9cuter le Groupe d'unit\u00E9s de fin m\u00EAme apr\u00E8s un arr\u00EAt manuel des Groupes d'unit\u00E9s principaux
1038
teardown_on_shutdown=Ex\u00E9cuter le Groupe d'unit\u00E9s de fin m\u00EAme apr\u00E8s un arr\u00EAt manuel des Groupes d'unit\u00E9s principaux
1039
template_choose=Choisir le mod\u00E8le
1040
template_create_from=Cr\u00E9er
1038
template_field=Canevas \:
1041
template_field=Canevas \:
1042
template_title=Cr\u00E9er \u00E0 partir du mod\u00E8le
1039
test=Test
1043
test=Test
1040
test_action_action=Action \:
1044
test_action_action=Action \:
1041
test_action_duration=Dur\u00E9e (millisecondes) \:
1045
test_action_duration=Dur\u00E9e (millisecondes) \:
(-)src/core/org/apache/jmeter/resources/messages.properties (+4 lines)
Lines 206-211 Link Here
206
counter_per_user=Track counter independently for each user
206
counter_per_user=Track counter independently for each user
207
counter_reset_per_tg_iteration=Reset counter on each Thread Group Iteration
207
counter_reset_per_tg_iteration=Reset counter on each Thread Group Iteration
208
countlim=Size limit
208
countlim=Size limit
209
create_from_template=New from templates
209
csvread_file_file_name=CSV file to get values from | *alias
210
csvread_file_file_name=CSV file to get values from | *alias
210
cut=Cut
211
cut=Cut
211
cut_paste_function=Copy and paste function string
212
cut_paste_function=Copy and paste function string
Lines 1042-1048 Link Here
1042
tcp_sample_title=TCP Sampler
1043
tcp_sample_title=TCP Sampler
1043
tcp_timeout=Timeout (milliseconds)\:
1044
tcp_timeout=Timeout (milliseconds)\:
1044
teardown_on_shutdown=Run tearDown Thread Groups after shutdown of main threads
1045
teardown_on_shutdown=Run tearDown Thread Groups after shutdown of main threads
1046
template_choose=Select Template
1047
template_create_from=Create
1045
template_field=Template\:
1048
template_field=Template\:
1049
template_title=Create from Template
1046
test=Test
1050
test=Test
1047
test_action_action=Action
1051
test_action_action=Action
1048
test_action_duration=Duration (milliseconds)
1052
test_action_duration=Duration (milliseconds)
(-)src/core/org/apache/jmeter/gui/util/JMeterMenuBar.java (+6 lines)
Lines 66-71 Link Here
66
66
67
    private JMenuItem file_load;
67
    private JMenuItem file_load;
68
68
69
    private JMenuItem create_from_template;
70
69
    private List<JComponent> file_load_recent_files;
71
    private List<JComponent> file_load_recent_files;
70
72
71
    private JMenuItem file_merge;
73
    private JMenuItem file_merge;
Lines 460-465 Link Here
460
        // is selected is ROOT, which does not allow items to be inserted.
462
        // is selected is ROOT, which does not allow items to be inserted.
461
        file_load.setEnabled(false);
463
        file_load.setEnabled(false);
462
464
465
        create_from_template = makeMenuItemRes("create_from_template", 'T', ActionNames.CREATE_FROM_TEMPLATE); //$NON-NLS-1$
466
        create_from_template.setEnabled(true);
467
463
        file_close = makeMenuItemRes("menu_close", 'C', ActionNames.CLOSE, KeyStrokes.CLOSE); //$NON-NLS-1$
468
        file_close = makeMenuItemRes("menu_close", 'C', ActionNames.CLOSE, KeyStrokes.CLOSE); //$NON-NLS-1$
464
469
465
        file_exit = makeMenuItemRes("exit", 'X', ActionNames.EXIT, KeyStrokes.EXIT); //$NON-NLS-1$
470
        file_exit = makeMenuItemRes("exit", 'X', ActionNames.EXIT, KeyStrokes.EXIT); //$NON-NLS-1$
Lines 473-478 Link Here
473
478
474
        fileMenu.add(file_close);
479
        fileMenu.add(file_close);
475
        fileMenu.add(file_load);
480
        fileMenu.add(file_load);
481
        fileMenu.add(create_from_template);
476
        fileMenu.add(file_merge);
482
        fileMenu.add(file_merge);
477
        fileMenu.addSeparator();
483
        fileMenu.addSeparator();
478
        fileMenu.add(file_save);
484
        fileMenu.add(file_save);
(-)src/core/org/apache/jmeter/gui/action/ActionNames.java (+1 lines)
Lines 62-67 Link Here
62
    public static final String MERGE            = "merge"; // $NON-NLS-1$
62
    public static final String MERGE            = "merge"; // $NON-NLS-1$
63
    public static final String OPEN             = "open"; // $NON-NLS-1$
63
    public static final String OPEN             = "open"; // $NON-NLS-1$
64
    public static final String OPEN_RECENT      = "open_recent"; // $NON-NLS-1$
64
    public static final String OPEN_RECENT      = "open_recent"; // $NON-NLS-1$
65
    public static final String CREATE_FROM_TEMPLATE      = "create_from_template"; // $NON-NLS-1$
65
    public static final String PASTE            = "Paste"; // $NON-NLS-1$
66
    public static final String PASTE            = "Paste"; // $NON-NLS-1$
66
    public static final String REMOTE_EXIT      = "remote_exit"; // $NON-NLS-1$
67
    public static final String REMOTE_EXIT      = "remote_exit"; // $NON-NLS-1$
67
    public static final String REMOTE_EXIT_ALL  = "remote_exit_all"; // $NON-NLS-1$
68
    public static final String REMOTE_EXIT_ALL  = "remote_exit_all"; // $NON-NLS-1$
(-)src/core/org/apache/jmeter/gui/action/SelectTemplateDialog.java (+222 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.gui.action;
20
21
import java.awt.BorderLayout;
22
import java.awt.Dimension;
23
import java.awt.FlowLayout;
24
import java.awt.GridLayout;
25
import java.awt.event.ActionEvent;
26
import java.awt.event.ActionListener;
27
import java.io.BufferedInputStream;
28
import java.io.BufferedOutputStream;
29
import java.io.File;
30
import java.io.FileInputStream;
31
import java.io.FileOutputStream;
32
import java.io.InputStream;
33
import java.io.OutputStream;
34
import java.util.Arrays;
35
import java.util.Comparator;
36
import java.util.Set;
37
38
import javax.swing.AbstractAction;
39
import javax.swing.Action;
40
import javax.swing.ActionMap;
41
import javax.swing.InputMap;
42
import javax.swing.JButton;
43
import javax.swing.JComponent;
44
import javax.swing.JDialog;
45
import javax.swing.JFrame;
46
import javax.swing.JPanel;
47
import javax.swing.JRootPane;
48
import javax.swing.JScrollPane;
49
import javax.swing.event.ChangeEvent;
50
import javax.swing.event.ChangeListener;
51
52
import org.apache.commons.io.IOUtils;
53
import org.apache.jmeter.gui.action.template.Template;
54
import org.apache.jmeter.gui.action.template.TemplateManager;
55
import org.apache.jmeter.swing.HtmlPane;
56
import org.apache.jmeter.util.JMeterUtils;
57
import org.apache.jorphan.gui.ComponentUtil;
58
import org.apache.jorphan.gui.JLabeledChoice;
59
import org.apache.jorphan.logging.LoggingManager;
60
import org.apache.jorphan.util.JOrphanUtils;
61
import org.apache.log.Logger;
62
63
/**
64
 * Dialog used for Templates selection
65
 * @since 2.10
66
 */
67
public class SelectTemplateDialog extends JDialog implements ChangeListener, ActionListener {
68
    /**
69
     *
70
     */
71
    private static final long serialVersionUID = -4436834972710248247L;
72
73
    private static final Logger log = LoggingManager.getLoggerForClass();
74
75
    private JLabeledChoice templateList;
76
77
    private HtmlPane helpDoc = new HtmlPane();
78
79
    private JButton createFromTemplateButton;
80
81
    private JButton cancelButton;
82
    
83
    private JScrollPane scroller = new JScrollPane(helpDoc);
84
85
    public SelectTemplateDialog() {
86
        super((JFrame) null, JMeterUtils.getResString("template_title"), true); //$NON-NLS-1$
87
        init();
88
    }
89
90
    @Override
91
    protected JRootPane createRootPane() {
92
        JRootPane rootPane = new JRootPane();
93
        // Hide Window on ESC
94
        Action escapeAction = new AbstractAction("ESCAPE") { //$NON-NLS-1$
95
            /**
96
             *
97
             */
98
            private static final long serialVersionUID = -6543764044868772971L;
99
100
            @Override
101
            public void actionPerformed(ActionEvent actionEvent) {
102
                setVisible(false);
103
            }
104
        };
105
        // Do search on Enter
106
        Action enterAction = new AbstractAction("ENTER") { //$NON-NLS-1$
107
            /**
108
             *
109
             */
110
            private static final long serialVersionUID = -3661361497864527363L;
111
112
            @Override
113
            public void actionPerformed(ActionEvent actionEvent) {
114
                doOpen(actionEvent);
115
            }
116
        };
117
        ActionMap actionMap = rootPane.getActionMap();
118
        actionMap.put(escapeAction.getValue(Action.NAME), escapeAction);
119
        actionMap.put(enterAction.getValue(Action.NAME), enterAction);
120
        InputMap inputMap = rootPane.getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW);
121
        inputMap.put(KeyStrokes.ESC, escapeAction.getValue(Action.NAME));
122
        inputMap.put(KeyStrokes.ENTER, enterAction.getValue(Action.NAME));
123
124
        return rootPane;
125
    }
126
127
    private void init() {
128
        initializeTemplateList();
129
        this.getContentPane().setLayout(new BorderLayout(10, 10));
130
        JPanel comboPanel = new JPanel(new FlowLayout(FlowLayout.CENTER));
131
        comboPanel.add(templateList);
132
        this.getContentPane().add(comboPanel, BorderLayout.NORTH);
133
        helpDoc.setContentType("text/html"); //$NON-NLS-1$
134
        helpDoc.setEditable(false);
135
        fillDescription();
136
        JPanel jPanel = new JPanel(new GridLayout(1,1));
137
        scroller.setPreferredSize(new Dimension(300, 400));
138
        jPanel.setPreferredSize(new Dimension(310, 410));
139
        jPanel.add(scroller);
140
        this.getContentPane().add(jPanel, BorderLayout.CENTER);
141
142
        JPanel buttonsPanel = new JPanel(new FlowLayout(FlowLayout.CENTER));
143
144
        createFromTemplateButton = new JButton(JMeterUtils.getResString("template_create_from")); //$NON-NLS-1$
145
        createFromTemplateButton.addActionListener(this);
146
147
        cancelButton = new JButton(JMeterUtils.getResString("cancel")); //$NON-NLS-1$
148
        cancelButton.addActionListener(this);
149
        buttonsPanel.add(createFromTemplateButton);
150
        buttonsPanel.add(cancelButton);
151
        this.getContentPane().add(buttonsPanel, BorderLayout.SOUTH);
152
153
        this.pack();
154
        ComponentUtil.centerComponentInWindow(this);
155
    }
156
    
157
    private void initializeTemplateList() {
158
        Set<String> templatesAsSet = TemplateManager.getInstance().getTemplateNames();
159
        String[] templateNames =  templatesAsSet.toArray(new String[templatesAsSet.size()]);
160
        Arrays.sort(templateNames, new Comparator<String>() {
161
            @Override
162
            public int compare(String o1, String o2) {
163
                return o1.compareToIgnoreCase(o2);
164
            }
165
        });
166
        templateList = new JLabeledChoice(JMeterUtils.getResString("template_choose"), templateNames); //$NON-NLS-1$
167
        templateList.addChangeListener(this);
168
    }
169
170
    /**
171
     * Do search
172
     * @param e {@link ActionEvent}
173
     */
174
    @Override
175
    public void actionPerformed(ActionEvent e) {
176
        if(e.getSource()==cancelButton) {
177
            this.setVisible(false);
178
            return;
179
        }
180
        doOpen(e);
181
    }
182
    
183
    @Override
184
    public void stateChanged(ChangeEvent event) {
185
        fillDescription();
186
    }
187
188
    /**
189
     * 
190
     */
191
    protected void fillDescription() {
192
        String selectedTemplate = templateList.getText();
193
        Template template = TemplateManager.getInstance().getTemplateByName(selectedTemplate);
194
        helpDoc.setText(template.getDescription());
195
    }
196
197
    /**
198
     * @param e {@link ActionEvent}
199
     */
200
    private void doOpen(ActionEvent e) {
201
        InputStream inputStream = null;
202
        OutputStream outputStream = null;
203
        try {
204
            String selectedTemplate = templateList.getText();
205
            Template template = TemplateManager.getInstance().getTemplateByName(selectedTemplate);   
206
            File fileToCopy = new File(JMeterUtils.getJMeterHome(), template.getFileName());
207
            File targetFile = new File( System.getProperty("user.dir"), 
208
                    template.getFileName().substring(template.getFileName().lastIndexOf("/")));
209
            inputStream = new BufferedInputStream(new FileInputStream(fileToCopy));
210
            outputStream = new BufferedOutputStream(new FileOutputStream(targetFile));
211
            IOUtils.copy(inputStream, outputStream);
212
            outputStream.close();
213
            Load.loadProjectFile(e, targetFile, false); 
214
            this.setVisible(false);
215
        } catch (Exception e1) {
216
            throw new Error(e1);
217
        } finally {
218
            JOrphanUtils.closeQuietly(inputStream);
219
            JOrphanUtils.closeQuietly(outputStream);
220
        }
221
    }
222
}
(-)src/core/org/apache/jmeter/gui/action/template/Template.java (+65 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.gui.action.template;
20
21
/**
22
 * Template Bean
23
 * @since 2.10
24
 */
25
public class Template {
26
    private String name;
27
    private String fileName;
28
    private String description;
29
    /**
30
     * @return the name
31
     */
32
    public String getName() {
33
        return name;
34
    }
35
    /**
36
     * @param name the name to set
37
     */
38
    public void setName(String name) {
39
        this.name = name;
40
    }
41
    /**
42
     * @return the relativeFileName
43
     */
44
    public String getFileName() {
45
        return fileName;
46
    }
47
    /**
48
     * @param relativeFileName the relativeFileName to set
49
     */
50
    public void setFileName(String relativeFileName) {
51
        fileName = relativeFileName;
52
    }
53
    /**
54
     * @return the description
55
     */
56
    public String getDescription() {
57
        return description;
58
    }
59
    /**
60
     * @param description the description to set
61
     */
62
    public void setDescription(String description) {
63
        this.description = description;
64
    }
65
}
(-)src/core/org/apache/jmeter/gui/action/template/TemplateManager.java (+140 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.gui.action.template;
20
21
import java.io.BufferedInputStream;
22
import java.io.File;
23
import java.io.FileInputStream;
24
import java.io.FileNotFoundException;
25
import java.io.IOException;
26
import java.io.InputStream;
27
import java.util.HashMap;
28
import java.util.Map;
29
import java.util.Set;
30
31
import org.apache.commons.lang3.StringUtils;
32
import org.apache.jmeter.util.JMeterUtils;
33
import org.apache.jorphan.logging.LoggingManager;
34
import org.apache.jorphan.util.JOrphanUtils;
35
import org.apache.log.Logger;
36
37
import com.thoughtworks.xstream.XStream;
38
import com.thoughtworks.xstream.io.xml.DomDriver;
39
40
/**
41
 * Manages Test Plan templates
42
 * @since 2.10
43
 */
44
public class TemplateManager {
45
    private class Templates {
46
        private Map<String, Template> templates = new HashMap<String, Template>();
47
    }
48
    private static final String TEMPLATE_FILES = JMeterUtils.getPropDefault("template.files", // $NON-NLS-1$
49
            "/bin/templates/templates.xml");
50
51
    private static final Logger log = LoggingManager.getLoggerForClass();
52
    
53
    private static final TemplateManager SINGLETON = new TemplateManager();
54
    
55
    private Map<String, Template> templates = new HashMap<String, Template>();
56
57
    private XStream xstream = initXStream();
58
59
    /**
60
     * 
61
     * @return
62
     */
63
    public static final TemplateManager getInstance() {
64
        return SINGLETON;
65
    }
66
    
67
    private TemplateManager()  {
68
        try {
69
            templates = readTemplates();            
70
        } catch(IOException e) {
71
            log.error("Error loading templates from files referenced in templates.files property:"+
72
                    TEMPLATE_FILES, e);
73
        }
74
    }
75
    
76
    private XStream initXStream() {
77
        XStream xstream = new XStream(new DomDriver());
78
        xstream.alias("template", Template.class);
79
        xstream.alias("templates", Templates.class);
80
        
81
        // templates i
82
        xstream.addImplicitMap(Templates.class, 
83
                // field TemplateManager#templates 
84
                "templates", // $NON-NLS-1$
85
                Template.class,     
86
                // field Template#name 
87
                "name" // $NON-NLS-1$
88
                );
89
                
90
        return xstream;
91
    }
92
93
    public void addTemplate(Template template) {
94
        templates.put(template.getName(), template);
95
    }
96
97
    /**
98
     * @return Set<String> the templates names
99
     */
100
    public Set<String> getTemplateNames() {
101
        return templates.keySet();
102
    }
103
104
105
    private Map<String, Template> readTemplates() throws FileNotFoundException {
106
        Map<String, Template> templates = new HashMap<String, Template>();
107
       
108
        String[] templateFiles = TEMPLATE_FILES.split(",");
109
        for (int i = 0; i < templateFiles.length; i++) {
110
            if(!StringUtils.isEmpty(templateFiles[i])) {
111
                InputStream inputStream = null;
112
                File f = new File(JMeterUtils.getJMeterHome(),
113
                        templateFiles[i]); 
114
                try {
115
                    if(f.exists() && f.canRead()) {
116
                        log.info("Reading templates from:"+f.getAbsolutePath());
117
                        inputStream = new BufferedInputStream(new FileInputStream(f)); 
118
                                
119
                        templates.putAll(((Templates) xstream.fromXML(inputStream)).templates);
120
                    } else {
121
                        log.warn("Ignoring template file:'"+f.getAbsolutePath()+"' as it does not exist or is not readable");
122
                    }
123
                } catch(Exception ex) {                    
124
                    log.warn("Ignoring template file:'"+f.getAbsolutePath()+"', an error occured parsing the file", ex);
125
                } finally {
126
                    JOrphanUtils.closeQuietly(inputStream);
127
                } 
128
            }
129
        }
130
        return templates;
131
    }
132
133
    /**
134
     * @param selectedTemplate Template name
135
     * @return {@link Template}
136
     */
137
    public Template getTemplateByName(String selectedTemplate) {
138
        return templates.get(selectedTemplate);
139
    }
140
}
(-)src/core/org/apache/jmeter/gui/action/TemplateCommand.java (+54 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.gui.action;
20
21
import java.awt.event.ActionEvent;
22
import java.util.HashSet;
23
import java.util.Set;
24
25
/**
26
 * Open Templates 
27
 * @since 2.10
28
 */
29
public class TemplateCommand extends AbstractAction {
30
31
    private static final Set<String> commands = new HashSet<String>();
32
33
    static {
34
        commands.add(ActionNames.CREATE_FROM_TEMPLATE);
35
    }
36
37
    private SelectTemplateDialog dialog = new SelectTemplateDialog();
38
    /**
39
     * @see Command#doAction(ActionEvent)
40
     */
41
    @Override
42
    public void doAction(ActionEvent e) {
43
        dialog.setVisible(true);
44
    }
45
46
47
    /**
48
     * @see Command#getActionNames()
49
     */
50
    @Override
51
    public Set<String> getActionNames() {
52
        return commands;
53
    }
54
}
(-)bin/jmeter.properties (-1 / +5 lines)
Lines 935-938 Link Here
935
935
936
# Should JMeter automatically load additional system properties?
936
# Should JMeter automatically load additional system properties?
937
# File name to look for (comment to disable)
937
# File name to look for (comment to disable)
938
system.properties=system.properties
938
system.properties=system.properties
939
940
# Comma separated list of files that contain reference to templates and their description
941
# Path must be relative to jmeter root folder
942
#template.files=/bin/templates/templates.xml
(-)bin/templates/jdbc.jmx (+93 lines)
Line 0 Link Here
1
<?xml version="1.0" encoding="UTF-8"?>
2
<jmeterTestPlan version="1.2" properties="2.5" jmeter="2.10-SNAPSHOT.20130609">
3
  <hashTree>
4
    <TestPlan guiclass="TestPlanGui" testclass="TestPlan" testname="Test Plan" enabled="true">
5
      <stringProp name="TestPlan.comments"></stringProp>
6
      <boolProp name="TestPlan.functional_mode">false</boolProp>
7
      <boolProp name="TestPlan.serialize_threadgroups">false</boolProp>
8
      <elementProp name="TestPlan.user_defined_variables" elementType="Arguments" guiclass="ArgumentsPanel" testclass="Arguments" testname="User Defined Variables" enabled="true">
9
        <collectionProp name="Arguments.arguments"/>
10
      </elementProp>
11
      <stringProp name="TestPlan.user_define_classpath"></stringProp>
12
    </TestPlan>
13
    <hashTree>
14
      <JDBCDataSource guiclass="TestBeanGUI" testclass="JDBCDataSource" testname="JDBC Connection Configuration" enabled="true">
15
        <boolProp name="autocommit">true</boolProp>
16
        <stringProp name="checkQuery">Select 1</stringProp>
17
        <stringProp name="connectionAge">5000</stringProp>
18
        <stringProp name="dataSource">jdbcConfig</stringProp>
19
        <stringProp name="dbUrl">jdbc:postgresql://hostname:port/dbname</stringProp>
20
        <stringProp name="driver">org.postgresql.Driver</stringProp>
21
        <boolProp name="keepAlive">true</boolProp>
22
        <stringProp name="password">password</stringProp>
23
        <stringProp name="poolMax">10</stringProp>
24
        <stringProp name="timeout">10000</stringProp>
25
        <stringProp name="transactionIsolation">DEFAULT</stringProp>
26
        <stringProp name="trimInterval">60000</stringProp>
27
        <stringProp name="username">username</stringProp>
28
      </JDBCDataSource>
29
      <hashTree/>
30
      <ThreadGroup guiclass="ThreadGroupGui" testclass="ThreadGroup" testname="Thread Group" enabled="true">
31
        <stringProp name="ThreadGroup.on_sample_error">continue</stringProp>
32
        <elementProp name="ThreadGroup.main_controller" elementType="LoopController" guiclass="LoopControlPanel" testclass="LoopController" testname="Loop Controller" enabled="true">
33
          <boolProp name="LoopController.continue_forever">false</boolProp>
34
          <stringProp name="LoopController.loops">1</stringProp>
35
        </elementProp>
36
        <stringProp name="ThreadGroup.num_threads">1</stringProp>
37
        <stringProp name="ThreadGroup.ramp_time">1</stringProp>
38
        <longProp name="ThreadGroup.start_time">1370729701000</longProp>
39
        <longProp name="ThreadGroup.end_time">1370729701000</longProp>
40
        <boolProp name="ThreadGroup.scheduler">false</boolProp>
41
        <stringProp name="ThreadGroup.duration"></stringProp>
42
        <stringProp name="ThreadGroup.delay"></stringProp>
43
      </ThreadGroup>
44
      <hashTree>
45
        <JDBCSampler guiclass="TestBeanGUI" testclass="JDBCSampler" testname="JDBC Request" enabled="true">
46
          <stringProp name="dataSource">jdbcConfig</stringProp>
47
          <stringProp name="query">select column1 from table</stringProp>
48
          <stringProp name="queryArguments"></stringProp>
49
          <stringProp name="queryArgumentsTypes"></stringProp>
50
          <stringProp name="queryType">Select Statement</stringProp>
51
          <stringProp name="resultVariable"></stringProp>
52
          <stringProp name="variableNames">col1</stringProp>
53
        </JDBCSampler>
54
        <hashTree/>
55
      </hashTree>
56
      <ResultCollector guiclass="ViewResultsFullVisualizer" testclass="ResultCollector" testname="View Results Tree" enabled="true">
57
        <boolProp name="ResultCollector.error_logging">false</boolProp>
58
        <objProp>
59
          <name>saveConfig</name>
60
          <value class="SampleSaveConfiguration">
61
            <time>true</time>
62
            <latency>true</latency>
63
            <timestamp>true</timestamp>
64
            <success>true</success>
65
            <label>true</label>
66
            <code>true</code>
67
            <message>true</message>
68
            <threadName>true</threadName>
69
            <dataType>false</dataType>
70
            <encoding>false</encoding>
71
            <assertions>true</assertions>
72
            <subresults>false</subresults>
73
            <responseData>false</responseData>
74
            <samplerData>false</samplerData>
75
            <xml>false</xml>
76
            <fieldNames>true</fieldNames>
77
            <responseHeaders>false</responseHeaders>
78
            <requestHeaders>false</requestHeaders>
79
            <responseDataOnError>true</responseDataOnError>
80
            <saveAssertionResultsFailureMessage>true</saveAssertionResultsFailureMessage>
81
            <assertionsResultsToSave>0</assertionsResultsToSave>
82
            <bytes>true</bytes>
83
            <hostname>true</hostname>
84
            <threadCounts>true</threadCounts>
85
            <sampleCount>true</sampleCount>
86
          </value>
87
        </objProp>
88
        <stringProp name="filename"></stringProp>
89
      </ResultCollector>
90
      <hashTree/>
91
    </hashTree>
92
  </hashTree>
93
</jmeterTestPlan>
(-)bin/templates/recording.jmx (+158 lines)
Line 0 Link Here
1
<?xml version="1.0" encoding="UTF-8"?>
2
<jmeterTestPlan version="1.2" properties="2.5" jmeter="2.10-SNAPSHOT.20130608">
3
  <hashTree>
4
    <TestPlan guiclass="TestPlanGui" testclass="TestPlan" testname="Test Plan" enabled="true">
5
      <stringProp name="TestPlan.comments"></stringProp>
6
      <boolProp name="TestPlan.functional_mode">false</boolProp>
7
      <boolProp name="TestPlan.serialize_threadgroups">false</boolProp>
8
      <elementProp name="TestPlan.user_defined_variables" elementType="Arguments" guiclass="ArgumentsPanel" testclass="Arguments" testname="User Defined Variables" enabled="true">
9
        <collectionProp name="Arguments.arguments"/>
10
      </elementProp>
11
      <stringProp name="TestPlan.user_define_classpath"></stringProp>
12
    </TestPlan>
13
    <hashTree>
14
      <Arguments guiclass="ArgumentsPanel" testclass="Arguments" testname="User Defined Variables" enabled="true">
15
        <collectionProp name="Arguments.arguments"/>
16
      </Arguments>
17
      <hashTree/>
18
      <ConfigTestElement guiclass="HttpDefaultsGui" testclass="ConfigTestElement" testname="HTTP Request Defaults" enabled="true">
19
        <elementProp name="HTTPsampler.Arguments" elementType="Arguments" guiclass="HTTPArgumentsPanel" testclass="Arguments" testname="User Defined Variables" enabled="true">
20
          <collectionProp name="Arguments.arguments"/>
21
        </elementProp>
22
        <stringProp name="HTTPSampler.domain"></stringProp>
23
        <stringProp name="HTTPSampler.port"></stringProp>
24
        <stringProp name="HTTPSampler.connect_timeout"></stringProp>
25
        <stringProp name="HTTPSampler.response_timeout"></stringProp>
26
        <stringProp name="HTTPSampler.protocol"></stringProp>
27
        <stringProp name="HTTPSampler.contentEncoding"></stringProp>
28
        <stringProp name="HTTPSampler.path"></stringProp>
29
        <stringProp name="HTTPSampler.concurrentPool">4</stringProp>
30
      </ConfigTestElement>
31
      <hashTree/>
32
      <CookieManager guiclass="CookiePanel" testclass="CookieManager" testname="HTTP Cookie Manager" enabled="true">
33
        <collectionProp name="CookieManager.cookies"/>
34
        <boolProp name="CookieManager.clearEachIteration">true</boolProp>
35
      </CookieManager>
36
      <hashTree/>
37
      <ThreadGroup guiclass="ThreadGroupGui" testclass="ThreadGroup" testname="Thread Group" enabled="true">
38
        <stringProp name="ThreadGroup.on_sample_error">continue</stringProp>
39
        <elementProp name="ThreadGroup.main_controller" elementType="LoopController" guiclass="LoopControlPanel" testclass="LoopController" testname="Loop Controller" enabled="true">
40
          <boolProp name="LoopController.continue_forever">false</boolProp>
41
          <stringProp name="LoopController.loops">1</stringProp>
42
        </elementProp>
43
        <stringProp name="ThreadGroup.num_threads">1</stringProp>
44
        <stringProp name="ThreadGroup.ramp_time">1</stringProp>
45
        <longProp name="ThreadGroup.start_time">1370726934000</longProp>
46
        <longProp name="ThreadGroup.end_time">1370726934000</longProp>
47
        <boolProp name="ThreadGroup.scheduler">false</boolProp>
48
        <stringProp name="ThreadGroup.duration"></stringProp>
49
        <stringProp name="ThreadGroup.delay"></stringProp>
50
      </ThreadGroup>
51
      <hashTree>
52
        <RecordingController guiclass="RecordController" testclass="RecordingController" testname="Recording Controller" enabled="true"/>
53
        <hashTree/>
54
      </hashTree>
55
      <ResultCollector guiclass="ViewResultsFullVisualizer" testclass="ResultCollector" testname="View Results Tree" enabled="true">
56
        <boolProp name="ResultCollector.error_logging">false</boolProp>
57
        <objProp>
58
          <name>saveConfig</name>
59
          <value class="SampleSaveConfiguration">
60
            <time>true</time>
61
            <latency>true</latency>
62
            <timestamp>true</timestamp>
63
            <success>true</success>
64
            <label>true</label>
65
            <code>true</code>
66
            <message>true</message>
67
            <threadName>true</threadName>
68
            <dataType>false</dataType>
69
            <encoding>false</encoding>
70
            <assertions>true</assertions>
71
            <subresults>false</subresults>
72
            <responseData>false</responseData>
73
            <samplerData>false</samplerData>
74
            <xml>false</xml>
75
            <fieldNames>true</fieldNames>
76
            <responseHeaders>false</responseHeaders>
77
            <requestHeaders>false</requestHeaders>
78
            <responseDataOnError>true</responseDataOnError>
79
            <saveAssertionResultsFailureMessage>true</saveAssertionResultsFailureMessage>
80
            <assertionsResultsToSave>0</assertionsResultsToSave>
81
            <bytes>true</bytes>
82
            <hostname>true</hostname>
83
            <threadCounts>true</threadCounts>
84
            <sampleCount>true</sampleCount>
85
          </value>
86
        </objProp>
87
        <stringProp name="filename"></stringProp>
88
      </ResultCollector>
89
      <hashTree/>
90
    </hashTree>
91
    <WorkBench guiclass="WorkBenchGui" testclass="WorkBench" testname="WorkBench" enabled="true">
92
      <boolProp name="WorkBench.save">true</boolProp>
93
    </WorkBench>
94
    <hashTree>
95
      <ProxyControl guiclass="ProxyControlGui" testclass="ProxyControl" testname="HTTP Proxy Server" enabled="true">
96
        <stringProp name="ProxyControlGui.port">8888</stringProp>
97
        <collectionProp name="ProxyControlGui.exclude_list">
98
          <stringProp name="-835639533">.*\.jpg</stringProp>
99
          <stringProp name="1358517207">.*\.js</stringProp>
100
          <stringProp name="-835633829">.*\.png</stringProp>
101
          <stringProp name="-835642634">.*\.gif</stringProp>
102
          <stringProp name="-835647305">.*\.bmp</stringProp>
103
          <stringProp name="-835630668">.*\.swf</stringProp>
104
          <stringProp name="-835646155">.*\.css</stringProp>
105
        </collectionProp>
106
        <collectionProp name="ProxyControlGui.include_list"/>
107
        <boolProp name="ProxyControlGui.capture_http_headers">true</boolProp>
108
        <intProp name="ProxyControlGui.grouping_mode">4</intProp>
109
        <boolProp name="ProxyControlGui.add_assertion">false</boolProp>
110
        <stringProp name="ProxyControlGui.sampler_type_name"></stringProp>
111
        <boolProp name="ProxyControlGui.sampler_redirect_automatically">false</boolProp>
112
        <boolProp name="ProxyControlGui.sampler_follow_redirects">true</boolProp>
113
        <boolProp name="ProxyControlGui.use_keepalive">true</boolProp>
114
        <boolProp name="ProxyControlGui.sampler_download_images">false</boolProp>
115
        <boolProp name="ProxyControlGui.regex_match">true</boolProp>
116
        <stringProp name="ProxyControlGui.content_type_include"></stringProp>
117
        <stringProp name="ProxyControlGui.content_type_exclude"></stringProp>
118
      </ProxyControl>
119
      <hashTree>
120
        <ResultCollector guiclass="ViewResultsFullVisualizer" testclass="ResultCollector" testname="View Results Tree" enabled="true">
121
          <boolProp name="ResultCollector.error_logging">false</boolProp>
122
          <objProp>
123
            <name>saveConfig</name>
124
            <value class="SampleSaveConfiguration">
125
              <time>true</time>
126
              <latency>true</latency>
127
              <timestamp>true</timestamp>
128
              <success>true</success>
129
              <label>true</label>
130
              <code>true</code>
131
              <message>true</message>
132
              <threadName>true</threadName>
133
              <dataType>false</dataType>
134
              <encoding>false</encoding>
135
              <assertions>true</assertions>
136
              <subresults>false</subresults>
137
              <responseData>false</responseData>
138
              <samplerData>false</samplerData>
139
              <xml>false</xml>
140
              <fieldNames>true</fieldNames>
141
              <responseHeaders>false</responseHeaders>
142
              <requestHeaders>false</requestHeaders>
143
              <responseDataOnError>true</responseDataOnError>
144
              <saveAssertionResultsFailureMessage>true</saveAssertionResultsFailureMessage>
145
              <assertionsResultsToSave>0</assertionsResultsToSave>
146
              <bytes>true</bytes>
147
              <hostname>true</hostname>
148
              <threadCounts>true</threadCounts>
149
              <sampleCount>true</sampleCount>
150
            </value>
151
          </objProp>
152
          <stringProp name="filename"></stringProp>
153
        </ResultCollector>
154
        <hashTree/>
155
      </hashTree>
156
    </hashTree>
157
  </hashTree>
158
</jmeterTestPlan>
(-)bin/templates/templates.xml (+53 lines)
Line 0 Link Here
1
<templates>
2
    <template>
3
        <name>Recording</name>
4
        <fileName>/bin/templates/recording.jmx</fileName>
5
        <description><![CDATA[
6
        <h1>Template showing how to record</h1>
7
        <h2>JMeter Configuration</h2>
8
        <p>
9
            <ul>
10
                <li>JMeter Server Proxy port is set to 8888, you may want to change
11
                
12
            </ul>
13
        </p>
14
        <h2>Browser Configuration</h2>
15
        <p>Configure your browser so that is uses the JMeter proxy, set:
16
            <ul>
17
                <li>the host of the machine that runs JMeter</li>
18
                <li>the port you setup in JMeter Server Proxy</li>
19
            </ul>
20
        </p>
21
        <h2>Useful links</h2>
22
        <p>
23
            <ul>
24
                <li><a href="http://jmeter.apache.org/usermanual/jmeter_proxy_step_by_step.pdf" >http://jmeter.apache.org/usermanual/jmeter_proxy_step_by_step.pdf</a></li>
25
                <li><a href="http://jmeter.apache.org/usermanual/component_reference.html#HTTP_Proxy_Server" >http://jmeter.apache.org/usermanual/component_reference.html#HTTP_Proxy_Server</a></li>
26
            </ul>
27
        </p>
28
        
29
        ]]></description>
30
    </template>
31
    <template>
32
        <name>JDBC Load Test</name>
33
        <fileName>/bin/templates/jdbc.jmx</fileName>
34
        <description>
35
        <![CDATA[<h1>Template showing how to Load Test an SQL query on Database</h1>
36
        <h2>JMeter Configuration</h2>
37
        <p>
38
            <ul>
39
                <li>Add the database driver to jmeter/lib folder</li>
40
                <li>Configure the host, port, username and password in JDBC Configuration</li>
41
                <li>Modify the SQL query to match your query</li>
42
            </ul>
43
        </p>
44
        <h2>Useful links</h2>
45
        <p>
46
            <ul>
47
                <li><a href="http://jmeter.apache.org/usermanual/build-db-test-plan.html" >http://jmeter.apache.org/usermanual/build-db-test-plan.html</a></li>
48
            </ul>
49
        </p>
50
        
51
        ]]></description>
52
    </template>
53
</templates>

Return to bug 55085