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

(-)bin/jmeter.properties (+8 lines)
Lines 1320-1322 Link Here
1320
# Switch that allows using Local documentation opened in JMeter GUI
1320
# Switch that allows using Local documentation opened in JMeter GUI
1321
# By default we use Online documentation opened in Browser
1321
# By default we use Online documentation opened in Browser
1322
#help.local=false
1322
#help.local=false
1323
1324
#---------------------------------------------------------------------------
1325
# Documentation generation
1326
#---------------------------------------------------------------------------
1327
1328
# Path to XSL file used to generate Schematic View of Test Plan
1329
# When empty, JMeter will use the embedded one in src/core/org/apache/jmeter/gui/action/schematic.xsl
1330
#docgeneration.schematic_xsl=
(-)build.xml (+1 lines)
Lines 1149-1154 Link Here
1149
        <exclude name="*eucJP*"/>
1149
        <exclude name="*eucJP*"/>
1150
      </fileset>
1150
      </fileset>
1151
      <fileset dir="${src.core}" includes="**/*.xml" />
1151
      <fileset dir="${src.core}" includes="**/*.xml" />
1152
      <fileset dir="${src.core}" includes="**/*.xsl" />
1152
      <fileset dir="${src.core}" includes="**/*.dtd" />
1153
      <fileset dir="${src.core}" includes="**/*.dtd" />
1153
      <!-- This file is used by the jmeter -h option -->
1154
      <!-- This file is used by the jmeter -h option -->
1154
      <fileset dir="${src.core}" includes="org/apache/jmeter/help.txt"/>
1155
      <fileset dir="${src.core}" includes="org/apache/jmeter/help.txt"/>
(-)src/core/org/apache/jmeter/gui/action/ActionNames.java (+1 lines)
Lines 117-122 Link Here
117
    public static final String ZOOM_IN          = "zoom_in"; //$NON-NLS-1$
117
    public static final String ZOOM_IN          = "zoom_in"; //$NON-NLS-1$
118
    public static final String ZOOM_OUT         = "zoom_out"; //$NON-NLS-1$
118
    public static final String ZOOM_OUT         = "zoom_out"; //$NON-NLS-1$
119
    public static final String PARSE_CURL       = "parse_curl"; ////$NON-NLS-1$
119
    public static final String PARSE_CURL       = "parse_curl"; ////$NON-NLS-1$
120
    public static final String SCHEMATIC_VIEW   = "schematic_view";
120
121
121
    // Prevent instantiation
122
    // Prevent instantiation
122
    private ActionNames() {}
123
    private ActionNames() {}
(-)src/core/org/apache/jmeter/gui/action/SchematicView.java (+172 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.awt.event.KeyEvent;
23
import java.io.File;
24
import java.text.MessageFormat;
25
import java.util.HashSet;
26
import java.util.Set;
27
28
import javax.swing.JFileChooser;
29
import javax.swing.JMenu;
30
import javax.swing.JMenuItem;
31
import javax.swing.JOptionPane;
32
import javax.swing.MenuElement;
33
import javax.xml.transform.Source;
34
import javax.xml.transform.Transformer;
35
import javax.xml.transform.TransformerFactory;
36
import javax.xml.transform.stream.StreamResult;
37
import javax.xml.transform.stream.StreamSource;
38
39
import org.apache.jmeter.gui.GuiPackage;
40
import org.apache.jmeter.gui.plugin.MenuCreator;
41
import org.apache.jmeter.gui.tree.JMeterTreeNode;
42
import org.apache.jmeter.util.JMeterUtils;
43
import org.apache.jorphan.collections.HashTree;
44
import org.slf4j.Logger;
45
import org.slf4j.LoggerFactory;
46
47
/**
48
 * Schematic view of Test Plan
49
 * @since 5.1
50
 */
51
public class SchematicView extends AbstractAction implements MenuCreator {
52
    private static final Logger log = LoggerFactory.getLogger(SchematicView.class);
53
    private static final String DEFAULT_XSL_FILE = 
54
            JMeterUtils.getProperty("docgeneration.schematic_xsl"); //$NON-NLS-1$
55
56
    private static final MessageFormat GENERATION_SUCCESS_MSG = new MessageFormat(JMeterUtils.getResString("schematic_view_generation_ok"));
57
    
58
    @FunctionalInterface
59
    public interface SchematicViewGenerator {
60
        void generate(HashTree testPlan, File testPlanFile, File outputFile) throws Exception;
61
    }
62
    
63
    private static final class XslSchematicViewGenerator implements SchematicViewGenerator {
64
        @Override
65
        public void generate(HashTree testPlan, File testPlanFile, File outputFile) 
66
                throws Exception {
67
            TransformerFactory factory = TransformerFactory.newInstance(
68
                    "net.sf.saxon.BasicTransformerFactory", Thread.currentThread().getContextClassLoader());
69
            Source xslt = null;
70
            if(DEFAULT_XSL_FILE != null) {
71
                log.info("Will use file {} for Schematic View generation", DEFAULT_XSL_FILE);
72
                xslt = new StreamSource(new File(DEFAULT_XSL_FILE));
73
            } else {
74
                xslt = new StreamSource(SchematicView.class.getResourceAsStream("/org/apache/jmeter/gui/action/schematic.xsl"));
75
            }
76
            Transformer transformer = factory.newTransformer(xslt);
77
            Source text = new StreamSource(testPlanFile);
78
            transformer.transform(text, new StreamResult(outputFile));
79
        }
80
        
81
    }
82
        
83
    private static final Set<String> commands = new HashSet<>();
84
85
    static {
86
        commands.add(ActionNames.SCHEMATIC_VIEW);
87
    }
88
89
    public SchematicView() {
90
        super();
91
    }
92
93
    /**
94
     * @see Command#doAction(ActionEvent)
95
     */
96
    @Override
97
    public void doAction(ActionEvent e) {
98
        try {
99
            String updateFile = GuiPackage.getInstance().getTestPlanFile();
100
            if(updateFile != null) {
101
                ActionRouter.getInstance().doActionNow(new ActionEvent(e.getSource(), e.getID(), ActionNames.CHECK_DIRTY));
102
                JFileChooser jFileChooser = new JFileChooser();
103
                jFileChooser.setDialogTitle(JMeterUtils.getResString("schematic_view_outputfile"));
104
                jFileChooser.setCurrentDirectory(new File(updateFile).getParentFile());
105
                jFileChooser.setSelectedFile(new File(updateFile+".html"));
106
                int retVal = jFileChooser.showSaveDialog(GuiPackage.getInstance().getMainFrame());
107
                if (retVal == JFileChooser.APPROVE_OPTION) {
108
                    File outputFile = jFileChooser.getSelectedFile();
109
                    if(outputFile.exists()) {
110
                        int response = JOptionPane.showConfirmDialog(GuiPackage.getInstance().getMainFrame(),
111
                                JMeterUtils.getResString("save_overwrite_existing_file"), // $NON-NLS-1$
112
                                JMeterUtils.getResString("save?"),  // $NON-NLS-1$
113
                                JOptionPane.YES_NO_OPTION,
114
                                JOptionPane.QUESTION_MESSAGE);
115
                        if (response == JOptionPane.CLOSED_OPTION || response == JOptionPane.NO_OPTION) {
116
                            return; // Do not save, user does not want to overwrite
117
                        }
118
                    }
119
                    new XslSchematicViewGenerator().generate(GuiPackage.getInstance().getCurrentSubTree(), 
120
                            new File(updateFile), outputFile);
121
                    JMeterUtils.reportInfoToUser(
122
                            GENERATION_SUCCESS_MSG.format(new Object[]{outputFile.getAbsolutePath()}),
123
                            JMeterUtils.getResString("schematic_view_info"));
124
                }
125
            } else {
126
                JMeterUtils.reportInfoToUser(JMeterUtils.getResString("schematic_view_no_plan"), JMeterUtils.getResString("schematic_view_info"));
127
            }
128
        } catch (Exception ex) {
129
            JMeterUtils.reportErrorToUser(JMeterUtils.getResString("schematic_view_errors"), ex);
130
        }
131
    }
132
133
134
    /**
135
     * @see Command#getActionNames()
136
     */
137
    @Override
138
    public Set<String> getActionNames() {
139
        return commands;
140
    }
141
142
    @Override
143
    public JMenuItem[] getMenuItemsAtLocation(MENU_LOCATION location) {
144
        if(location == MENU_LOCATION.TOOLS) {
145
            
146
            JMenuItem menuItemIC = new JMenuItem(
147
                    JMeterUtils.getResString("schematic_view_menu"), KeyEvent.VK_UNDEFINED);
148
            menuItemIC.setName(ActionNames.SCHEMATIC_VIEW);
149
            menuItemIC.setActionCommand(ActionNames.SCHEMATIC_VIEW);
150
            menuItemIC.setAccelerator(null);
151
            menuItemIC.addActionListener(ActionRouter.getInstance());
152
153
            return new JMenuItem[]{menuItemIC};
154
        }
155
        return new JMenuItem[0];
156
    }
157
158
    @Override
159
    public JMenu[] getTopLevelMenus() {
160
        return new JMenu[0];
161
    }
162
163
    @Override
164
    public boolean localeChanged(MenuElement menu) {
165
        return false;
166
    }
167
168
    @Override
169
    public void localeChanged() {
170
        // NOOP
171
    }
172
}
(-)src/core/org/apache/jmeter/gui/action/schematic.xsl (+689 lines)
Line 0 Link Here
1
<?xml version="1.0" encoding="UTF-8"?>
2
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
3
    xmlns:jmeter="http://jmeter.apache.org/"
4
>
5
6
<xsl:strip-space elements="*"/>
7
<!--
8
   Licensed to the Apache Software Foundation (ASF) under one or more
9
   contributor license agreements.  See the NOTICE file distributed with
10
   this work for additional information regarding copyright ownership.
11
   The ASF licenses this file to You under the Apache License, Version 2.0
12
   (the "License"); you may not use this file except in compliance with
13
   the License.  You may obtain a copy of the License at
14
 
15
       http://www.apache.org/licenses/LICENSE-2.0
16
 
17
   Unless required by applicable law or agreed to in writing, software
18
   distributed under the License is distributed on an "AS IS" BASIS,
19
   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
20
   See the License for the specific language governing permissions and
21
   limitations under the License.
22
-->
23
24
<!--
25
    Stylesheet to display details of a JMX test plan for HTTP
26
-->
27
<xsl:template match="jmeterTestPlan">
28
  <html>
29
  <title>Schematic view of Test Plan</title>
30
  <head>
31
  <style>
32
ul.tree, ul.tree ul {
33
    list-style-type: none;
34
    background: url('data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAAKAQMAAABPHKYJAAAAA1BMVEWIiIhYZW6zAAAACXBIWXMAAAsTAAALEwEAmpwYAAAAB3RJTUUH1ggGExMZBky19AAAAAtJREFUCNdjYMAEAAAUAAHlhrBKAAAAAElFTkSuQmCC') repeat-y;
35
    margin: 0;
36
    padding: 0;
37
}
38
ul.tree ul {
39
    margin-left: 10px;
40
}
41
ul.tree li {
42
    margin: 0;
43
    padding: 0 12px;
44
    line-height: 20px;
45
    background:  url('data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAgAAAAUAQMAAACK1e4oAAAABlBMVEUAAwCIiIgd2JB2AAAAAXRSTlMAQObYZgAAAAlwSFlzAAALEwAACxMBAJqcGAAAAAd0SU1FB9YIBhQIJYVaFGwAAAARSURBVAjXY2hgQIf/GTDFGgDSkwqATqpCHAAAAABJRU5ErkJggg==') no-repeat;
46
    color: #369;
47
}
48
ul.tree li:last-child { 
49
    background: #fff url('data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAgAAAAUAQMAAACK1e4oAAAABlBMVEUAAwCIiIgd2JB2AAAAAXRSTlMAQObYZgAAAAlwSFlzAAALEwAACxMBAJqcGAAAAAd0SU1FB9YIBhQIIhs+gc8AAAAQSURBVAjXY2hgQIf/GbAAAKCTBYBUjWvCAAAAAElFTkSuQmCC') no-repeat; 
50
}
51
</style>
52
</head>
53
<body>
54
    <xsl:apply-templates/>
55
</body>
56
</html>
57
</xsl:template>
58
59
<!-- Remove empty nodes -->
60
<xsl:template match="hashTree[count(child::*) = 0]">
61
</xsl:template>
62
63
<xsl:template match="jmeterTestPlan/hashTree[1]">
64
    <ul class="tree" id="tree">
65
        <xsl:apply-templates/>
66
    </ul>
67
</xsl:template>
68
69
<xsl:template match="hashTree">
70
  <li><ul><xsl:apply-templates /></ul></li>
71
</xsl:template>
72
73
<xsl:template match="TestPlan">
74
    <li>
75
    <xsl:call-template name="header"/>
76
    (globalVars:[<xsl:for-each select='elementProp/collectionProp/elementProp'>
77
        "<xsl:value-of select='stringProp[@name="Argument.name"]'/>"
78
        <xsl:value-of select='stringProp[@name="Argument.metadata"]'/>
79
        "<xsl:value-of select='stringProp[@name="Argument.value"]'/>"
80
        <xsl:if test="position() != last()">,</xsl:if>
81
    </xsl:for-each>], 
82
    executeTearDownThreadsOnShutdown: <xsl:value-of select='boolProp[@name="TestPlan.tearDown_on_shutdown"]'/>)
83
    <xsl:call-template name="comment"/>
84
    </li>
85
</xsl:template>
86
87
<xsl:template match="Arguments">
88
    <li>
89
    <xsl:call-template name="header"/>
90
    ([<xsl:for-each select='collectionProp/elementProp'>
91
        "<xsl:value-of select='stringProp[@name="Argument.name"]'/>"
92
        <xsl:value-of select='stringProp[@name="Argument.metadata"]'/>
93
        "<xsl:value-of select='stringProp[@name="Argument.value"]'/>"
94
        <xsl:if test="position() != last()">,</xsl:if>
95
    </xsl:for-each>])
96
    <xsl:call-template name="comment"/>
97
    </li>
98
</xsl:template>
99
100
<xsl:template match="ThreadGroup|SetupThreadGroup|PostThreadGroup">
101
<li>
102
    <xsl:call-template name="header"/>
103
    (
104
    threads: "<xsl:value-of select='stringProp[@name="ThreadGroup.num_threads"]'/>",
105
    loops: "<xsl:value-of select='elementProp/*[@name="LoopController.loops"]'/>",
106
    ramp-up: "<xsl:value-of select='stringProp[@name="ThreadGroup.ramp_time"]'/>"
107
    )
108
    <xsl:call-template name="comment"/>
109
</li>
110
</xsl:template>
111
112
<xsl:template match="CSVDataSet">
113
<li>
114
    <xsl:call-template name="header"/>
115
    (file: "<xsl:value-of select='stringProp[@name="filename"]'/>", 
116
    vars:"<xsl:value-of select='stringProp[@name="variableNames"]'/>",
117
    sharing:"<xsl:value-of select='stringProp[@name="shareMode"]'/>",
118
    recycleOnEof:<xsl:value-of select='boolProp[@name="recycle"]'/>,
119
    stopThreadOnEof:<xsl:value-of select='boolProp[@name="stopThread"]'/>
120
    )
121
    <xsl:call-template name="comment"/>
122
    <br/>
123
</li>
124
</xsl:template>
125
126
<xsl:template match="ThroughputController">
127
<li>
128
    <xsl:call-template name="header"/>
129
    (pct: "<xsl:value-of select='stringProp[@name="ThroughputController.percentThroughput"]'/>%")
130
    <xsl:call-template name="comment"/>
131
    <br/>
132
</li>
133
</xsl:template>
134
135
<xsl:template match="IfController">
136
<li>
137
    <xsl:call-template name="header"/>
138
    (condition: "<xsl:value-of select='stringProp[@name="IfController.condition"]'/>")
139
    <xsl:call-template name="comment"/>
140
</li>
141
</xsl:template>
142
143
<xsl:template match="HTTPSamplerProxy">
144
<li>
145
    <xsl:call-template name="header"/>
146
    (method: "<xsl:value-of select='stringProp[@name="HTTPSampler.method"]'/>",
147
    url: "
148
    <xsl:value-of select='stringProp[@name="HTTPSampler.protocol"]'/>
149
    <xsl:text>://</xsl:text>
150
    <xsl:value-of select='stringProp[@name="HTTPSampler.domain"]'/>
151
    <xsl:text>:</xsl:text>
152
    <xsl:value-of select='stringProp[@name="HTTPSampler.port"]'/>
153
    <xsl:text>/</xsl:text>
154
    <xsl:value-of select='stringProp[@name="HTTPSampler.path"]'/>",
155
    <xsl:choose>
156
        <xsl:when test='boolProp[@name="HTTPSampler.postBodyRaw"] = "true"'>
157
            body: "<xsl:value-of select='elementProp/collectionProp/elementProp[@elementType="HTTPArgument"][1]/stringProp[@name="Argument.value"]'/>"
158
        </xsl:when>
159
        <xsl:otherwise>
160
            body: [
161
            <xsl:for-each select='elementProp[@name="HTTPsampler.Arguments"]/collectionProp/elementProp'>
162
              "<xsl:value-of select='stringProp[@name="Argument.name"]'/>"=
163
              "<xsl:value-of select='stringProp[@name="Argument.value"]'/>"
164
              <xsl:if test="position() != last()">,</xsl:if>
165
           </xsl:for-each>
166
           ]
167
        </xsl:otherwise>
168
    </xsl:choose>,
169
    upload-files: [
170
        <xsl:for-each select='elementProp[@name="HTTPsampler.Files"]/collectionProp/elementProp'>
171
            {param="<xsl:value-of select='stringProp[@name="File.paramname"]'/>",
172
            path="<xsl:value-of select='stringProp[@name="File.path"]'/>",
173
            mime-type="<xsl:value-of select='stringProp[@name="File.mimetype"]'/>"}
174
            <xsl:if test="position() != last()">,</xsl:if>
175
        </xsl:for-each>
176
    ]
177
    )
178
    <xsl:call-template name="comment"/>
179
</li>
180
</xsl:template>
181
182
<xsl:template match="CacheManager">
183
<li>
184
    <xsl:call-template name="header"/>
185
    (clearOnEachIteration: <xsl:value-of select='boolProp[@name="clearEachIteration"]'/>,
186
    useCacheControlAndExpires: <xsl:value-of select='boolProp[@name="useExpires"]'/>,
187
    maxSize: <xsl:value-of select='intProp[@name="maxSize"]'/>
188
    )
189
    <xsl:call-template name="comment"/>
190
    <xsl:call-template name="comment"/>
191
</li>
192
</xsl:template>
193
<xsl:template match="ConfigTestElement[@guiclass='HttpDefaultsGui']">
194
<li>
195
    <xsl:call-template name="header"/>
196
    (protocol: "<xsl:value-of select='stringProp[@name="HTTPSampler.protocol"]'/>",
197
    domain: "<xsl:value-of select='stringProp[@name="HTTPSampler.domain"]'/>",
198
    port: "<xsl:value-of select='stringProp[@name="HTTPSampler.port"]'/>",
199
    path: "<xsl:value-of select='stringProp[@name="HTTPSampler.path"]'/>",
200
    connectTimeout: "<xsl:value-of select='stringProp[@name="HTTPSampler.connect_timeout"]'/>"ms,
201
    responseTimeout: "<xsl:value-of select='stringProp[@name="HTTPSampler.response_timeout"]'/>"ms
202
    )
203
    <xsl:call-template name="comment"/>
204
</li>
205
</xsl:template>
206
207
<xsl:template match="ResultCollector">
208
<li>
209
    <xsl:call-template name="header"/>
210
    <xsl:if test='stringProp[@name="filename"]!=""'>
211
        (filename: "<xsl:value-of select='stringProp[@name="filename"]'/>",
212
        xml: <xsl:value-of select='objProp/value/xml'/>,
213
        errorsOnly: <xsl:value-of select='boolProp[@name="ResultCollector.error_logging"]'/>,
214
        successOnly: <xsl:value-of select='boolProp[@name="ResultCollector.success_only_logging"]'/>)
215
    </xsl:if>
216
    <xsl:call-template name="comment"/>
217
</li>
218
</xsl:template>
219
220
<xsl:template match="ResponseAssertion">
221
<li>
222
    <xsl:call-template name="header"/>
223
    <b> that (<xsl:value-of select='substring(stringProp[@name="Assertion.test_field"], 11)'/>)</b>
224
    <b>
225
    <xsl:choose>
226
        <xsl:when test='intProp[@name="Assertion.test_type"] = 1'>
227
            matches
228
        </xsl:when>
229
        <xsl:when test='intProp[@name="Assertion.test_type"] = 2'>
230
            contains
231
        </xsl:when>
232
        <xsl:when test='intProp[@name="Assertion.test_type"] = 5'>
233
            does not match
234
        </xsl:when>
235
        <xsl:when test='intProp[@name="Assertion.test_type"] = 6'>
236
            does not contain
237
        </xsl:when>
238
        <xsl:when test='intProp[@name="Assertion.test_type"] = 8'>
239
            is equal to
240
        </xsl:when>
241
        <xsl:when test='intProp[@name="Assertion.test_type"] = 12'>
242
            is not equal to
243
        </xsl:when>
244
        <xsl:when test='intProp[@name="Assertion.test_type"] = 16'>
245
            contains 
246
        </xsl:when>
247
        <xsl:when test='intProp[@name="Assertion.test_type"] = 20'>
248
            does not contain as substring
249
        </xsl:when>
250
        <xsl:when test='intProp[@name="Assertion.test_type"] = 37'>
251
            does not matches one of
252
        </xsl:when>
253
        <xsl:when test='intProp[@name="Assertion.test_type"] = 38'>
254
            does not contain one of
255
        </xsl:when>
256
        <xsl:when test='intProp[@name="Assertion.test_type"] = 44'>
257
            is not equal to one of
258
        </xsl:when>
259
        <xsl:when test='intProp[@name="Assertion.test_type"] = 48'>
260
            contains one of
261
        </xsl:when>
262
        <xsl:when test='intProp[@name="Assertion.test_type"] = 52'>
263
            does not contain as substring one of
264
        </xsl:when>
265
    </xsl:choose>
266
    </b>
267
    [
268
    <xsl:for-each select='collectionProp[@name="Asserion.test_strings"]/stringProp'>
269
      "<xsl:value-of select='.'/>"
270
      <xsl:if test="position() != last()">,</xsl:if>
271
   </xsl:for-each>
272
    ])
273
    <xsl:call-template name="comment"/>
274
</li>
275
</xsl:template>
276
277
<xsl:template match="TestAction">
278
<li>
279
    <xsl:call-template name="header"/>
280
    <b>
281
    <xsl:choose>
282
        <xsl:when test='intProp[@name="ActionProcessor.action"] = 0'>
283
            stop 
284
        </xsl:when>
285
        <xsl:when test='intProp[@name="ActionProcessor.action"] = 1'>
286
            pause for <xsl:value-of select='stringProp[@name="ActionProcessor.duration"]'/>ms
287
        </xsl:when>
288
        <xsl:when test='intProp[@name="ActionProcessor.action"] = 2'>
289
            stop now
290
        </xsl:when>
291
        <xsl:when test='intProp[@name="ActionProcessor.action"] = 3'>
292
            go to next iteration of thread loop
293
        </xsl:when>
294
        <xsl:when test='intProp[@name="ActionProcessor.action"] = 4'>
295
            go to next iteration of current loop
296
        </xsl:when>
297
        <xsl:when test='intProp[@name="ActionProcessor.action"] = 5'>
298
            break current loop
299
        </xsl:when>
300
    </xsl:choose>
301
    <xsl:choose>
302
        <xsl:when test='intProp[@name="ActionProcessor.target"] = 0'>
303
            current thread
304
        </xsl:when>
305
        <xsl:when test='intProp[@name="ActionProcessor.target"] = 2'>
306
            test
307
        </xsl:when>
308
    </xsl:choose>
309
    </b>
310
    <xsl:call-template name="comment"/>
311
</li>
312
</xsl:template>
313
314
<xsl:template match="ResultAction">
315
<li>
316
    <xsl:call-template name="header"/>
317
    <b>
318
    <xsl:choose>
319
        <xsl:when test='intProp[@name="OnError.action"] = 0'>
320
            continue 
321
        </xsl:when>
322
        <xsl:when test='intProp[@name="OnError.action"] = 1'>
323
            stop thread now
324
        </xsl:when>
325
        <xsl:when test='intProp[@name="OnError.action"] = 2'>
326
            shutdown test
327
        </xsl:when>
328
        <xsl:when test='intProp[@name="OnError.action"] = 3'>
329
            stop test now
330
        </xsl:when>
331
        <xsl:when test='intProp[@name="OnError.action"] = 4'>
332
            go to next iteration of thread loop
333
        </xsl:when>
334
        <xsl:when test='intProp[@name="OnError.action"] = 5'>
335
            go to next iteration of current loop
336
        </xsl:when>
337
        <xsl:when test='intProp[@name="OnError.action"] = 6'>
338
            break current loop
339
        </xsl:when>
340
    </xsl:choose>
341
    </b>
342
    <xsl:call-template name="comment"/>
343
</li>
344
</xsl:template>
345
346
<xsl:template match="UserParameters">
347
<li>
348
    <xsl:call-template name="header"/>
349
    (names=[
350
   <xsl:for-each select='collectionProp[@name="UserParameters.names"]/stringProp'>
351
        "<xsl:value-of select='.'/>"
352
         <xsl:if test="position() != last()">,</xsl:if>
353
   </xsl:for-each>],values=[
354
   <xsl:for-each select='collectionProp[@name="UserParameters.thread_values"]/collectionProp/stringProp'>
355
        "<xsl:value-of select='.'/>"
356
         <xsl:if test="position() != last()">,</xsl:if>
357
   </xsl:for-each>]
358
    )
359
    <xsl:call-template name="comment"/>
360
</li>
361
</xsl:template>
362
363
<xsl:template match="ModuleController">
364
<li>
365
    <xsl:call-template name="header"/>
366
    (
367
    <xsl:for-each select='collectionProp/stringProp'>
368
        <xsl:if test="position()!=1 and position() != last()">
369
            <xsl:value-of select='.'/> 
370
        </xsl:if>
371
        <xsl:if test="position() = last()">
372
            <a><xsl:attribute name="href">#<xsl:value-of select='.'/></xsl:attribute><xsl:value-of select='.'/></a>
373
        </xsl:if>
374
        <xsl:if test="position()!=1 and position() != last()">
375
            &gt;
376
        </xsl:if>
377
   </xsl:for-each>
378
    )
379
    <xsl:call-template name="comment"/>
380
</li>
381
</xsl:template>
382
383
<xsl:template match="CookieManager">
384
<li>
385
    <xsl:call-template name="header"/>
386
    (clearOnEachIteration: <xsl:value-of select='boolProp[@name="CookieManager.clearEachIteration"]'/>,
387
    policy: "<xsl:value-of select='stringProp[@name="CookieManager.policy"]'/>",
388
    cookies: [
389
    <xsl:for-each select='collectionProp[@name="CookieManager.cookies"]/elementProp[@elementType="Cookie"]'>
390
      { name:"<xsl:value-of select='@name'/>", 
391
      value:"<xsl:value-of select='stringProp[@name="Cookie.value"]'/>", 
392
      domain:"<xsl:value-of select='stringProp[@name="Cookie.domain"]'/>",
393
      path:"<xsl:value-of select='stringProp[@name="Cookie.path"]'/>",
394
      secure:<xsl:value-of select='boolProp[@name="Cookie.secury"]'/>}
395
      <xsl:if test="position() != last()">,</xsl:if>
396
   </xsl:for-each>])
397
   <xsl:call-template name="comment"/>
398
</li>
399
</xsl:template>
400
401
<xsl:template match="HeaderManager">
402
<li>
403
    <xsl:call-template name="header"/>
404
    (headers:[
405
    <xsl:for-each select='collectionProp[@name="HeaderManager.headers"]/elementProp'>
406
        {"<xsl:value-of select='stringProp[@name="Header.name"]'/>"=
407
        "<xsl:value-of select='stringProp[@name="Header.value"]'/>"
408
        <xsl:if test="position() != last()">,</xsl:if>
409
    </xsl:for-each>])
410
    <xsl:call-template name="comment"/>
411
</li>
412
</xsl:template>
413
414
<xsl:function name="jmeter:showScope">
415
    <xsl:param name="scope"/>
416
    <xsl:choose>
417
        <xsl:when test="$scope = 'true'">
418
            using response headers
419
        </xsl:when>
420
        <xsl:when test="$scope = 'false'">
421
            using response body
422
        </xsl:when>
423
        <xsl:when test="$scope = 'request_headers'">
424
            using request headers
425
        </xsl:when>
426
        <xsl:when test="$scope = 'unescaped'">
427
            using response body unescaped
428
        </xsl:when>
429
        <xsl:when test="$scope = 'URL'">
430
            using URL
431
        </xsl:when>
432
        <xsl:when test="$scope = 'code'">
433
            using response code
434
        </xsl:when>
435
        <xsl:when test="$scope = 'message'">
436
            using response message
437
        </xsl:when>
438
    </xsl:choose>
439
</xsl:function>
440
  
441
<xsl:template match="XPath2Extractor">
442
<li>
443
    <xsl:call-template name="header"/>
444
    <b>using response body</b>
445
    (exportedVar: "<xsl:value-of select='stringProp[@name="XPathExtractor2.refname"]'/>",
446
    xpathQuery: "<xsl:value-of select='stringProp[@name="XPathExtractor2.xpathQuery"]'/>",
447
    fragment: "<xsl:value-of select='stringProp[@name="XPathExtractor2.fragment"]'/>",
448
    default: "<xsl:value-of select='stringProp[@name="XPathExtractor2.default"]'/>",
449
    matchNr: "<xsl:value-of select='stringProp[@name="XPathExtractor2.matchNumber"]'/>")
450
    <xsl:call-template name="comment"/>
451
</li>
452
</xsl:template>
453
454
<xsl:template match="XPathExtractor">
455
<li>
456
    <xsl:call-template name="header"/>
457
    <b>using response body</b>
458
    (exportedVar: "<xsl:value-of select='stringProp[@name="XPathExtractor.refname"]'/>",
459
    xpathQuery: "<xsl:value-of select='stringProp[@name="XPathExtractor.xpathQuery"]'/>",
460
    fragment: "<xsl:value-of select='stringProp[@name="XPathExtractor.fragment"]'/>",
461
    default: "<xsl:value-of select='stringProp[@name="XPathExtractor.default"]'/>",
462
    matchNr: "<xsl:value-of select='stringProp[@name="XPathExtractor.matchNumber"]'/>")
463
    <xsl:call-template name="comment"/>
464
</li>
465
</xsl:template>
466
467
<xsl:template match="HtmlExtractor">
468
<li>
469
    <xsl:call-template name="header"/>
470
    <b>using response body</b>
471
    (exportedVar: "<xsl:value-of select='stringProp[@name="HtmlExtractor.refname"]'/>",
472
    selector: "<xsl:value-of select='stringProp[@name="HtmlExtractor.expr"]'/>",
473
    attribute: "<xsl:value-of select='stringProp[@name="HtmlExtractor.attribute"]'/>",
474
    default: "<xsl:value-of select='stringProp[@name="HtmlExtractor.default"]'/>",
475
    matchNr: "<xsl:value-of select='stringProp[@name="HtmlExtractor.match_number"]'/>")
476
    <xsl:call-template name="comment"/>
477
</li>
478
</xsl:template>
479
480
<xsl:template match="JSONPostProcessor">
481
<li>
482
    <xsl:call-template name="header"/>
483
    <b>using response body</b>
484
    (exportedVar: "<xsl:value-of select='stringProp[@name="JSONPostProcessor.referenceNames"]'/>",
485
    jsonPaths: "<xsl:value-of select='stringProp[@name="JSONPostProcessor.jsonPathExprs"]'/>",
486
    default: "<xsl:value-of select='stringProp[@name="JSONPostProcessor.defaultValues"]'/>",
487
    matchNr: "<xsl:value-of select='stringProp[@name="JSONPostProcessor.match_numbers"]'/>")
488
    <xsl:call-template name="comment"/>
489
</li>
490
</xsl:template>
491
492
<xsl:template match="BoundaryExtractor">
493
<li>
494
    <xsl:call-template name="header"/>
495
    <b><xsl:value-of select='jmeter:showScope(stringProp[@name="BoundaryExtractor.useHeaders"])'/></b>
496
    (exportedVar: "<xsl:value-of select='stringProp[@name="BoundaryExtractor.refname"]'/>",
497
    lboundary: "<xsl:value-of select='stringProp[@name="BoundaryExtractor.lboundary"]'/>",
498
    rboundary: "<xsl:value-of select='stringProp[@name="BoundaryExtractor.rboundary"]'/>",
499
    default: "<xsl:value-of select='stringProp[@name="BoundaryExtractor.default"]'/>",
500
    matchNr: "<xsl:value-of select='stringProp[@name="BoundaryExtractor.match_number"]'/>")
501
    <xsl:call-template name="comment"/>
502
</li>
503
</xsl:template>
504
505
<xsl:template match="RegexExtractor">
506
<li>
507
    <xsl:call-template name="header"/>
508
    <b><xsl:value-of select='jmeter:showScope(stringProp[@name="RegexExtractor.useHeaders"])'/></b>
509
    (exportedVar: "<xsl:value-of select='stringProp[@name="RegexExtractor.refname"]'/>"
510
    regex: "<xsl:value-of select='stringProp[@name="BoundaryExtractor.regex"]'/>",
511
    template: "<xsl:value-of select='stringProp[@name="BoundaryExtractor.template"]'/>",
512
    default: "<xsl:value-of select='stringProp[@name="BoundaryExtractor.default"]'/>",
513
    matchNr: "<xsl:value-of select='stringProp[@name="BoundaryExtractor.match_number"]'/>")
514
    <xsl:call-template name="comment"/>
515
</li>
516
</xsl:template>
517
518
<xsl:template match="ConstantTimer">
519
<li>
520
    <xsl:call-template name="header"/>
521
    (const:<xsl:value-of select='stringProp[@name="ConstantTimer.delay"]'/>ms)
522
    <xsl:call-template name="comment"/>
523
</li>
524
</xsl:template>
525
526
<xsl:template match="UniformRandomTimer|GaussianRandomTimer|PoissonRandomTimer">
527
<li>
528
    <xsl:call-template name="header"/>
529
    (const:<xsl:value-of select='stringProp[@name="ConstantTimer.delay"]'/>ms, 
530
    variation:<xsl:value-of select='stringProp[@name="RandomTimer.range"]'/>ms)
531
    <xsl:call-template name="comment"/>
532
</li>
533
</xsl:template>
534
535
<xsl:template match="*">
536
<li>
537
    <xsl:call-template name="header"/>
538
    <xsl:call-template name="comment"/>
539
</li>
540
</xsl:template>
541
542
<xsl:template name="comment">
543
    <xsl:if test='stringProp/@name="TestPlan.comments"'>
544
         <br/>
545
         &#160;&#160;&#160;Comments: <i style="color:green">
546
          <xsl:value-of select='stringProp[@name="TestPlan.comments"]'/>
547
        </i>
548
    </xsl:if>
549
</xsl:template>
550
551
<xsl:template name="header">
552
    <xsl:choose>
553
        <xsl:when test="name() = 'GenericController'">
554
            <a> 
555
            <xsl:attribute name="id">
556
                <xsl:value-of select="@testname"/>
557
            </xsl:attribute>
558
            <b>container</b></a> 
559
        </xsl:when>
560
        <xsl:when test="name() = 'HTTPSamplerProxy'">
561
            <b>http request</b> 
562
        </xsl:when>
563
        <xsl:when test="name() = 'SetupThreadGroup'">
564
            <b>run before</b> 
565
        </xsl:when>
566
        <xsl:when test="name() = 'ThreadGroup'">
567
            <b>run</b> 
568
        </xsl:when>
569
        <xsl:when test="name() = 'PostThreadGroup'">
570
            <b>run after</b> 
571
        </xsl:when>
572
        <xsl:when test="name() = 'TestFragmentController'">
573
            <b>declare reusable Elements</b> 
574
        </xsl:when>
575
        <xsl:when test="name() = 'ResponseAssertion'">
576
            <b>assert as</b> 
577
        </xsl:when>
578
        <xsl:when test="name() = 'TransactionController'">
579
            <a>
580
            <xsl:attribute name="id">
581
                <xsl:value-of select="@testname"/>
582
            </xsl:attribute>
583
            <b>transaction</b></a> 
584
        </xsl:when>
585
        <xsl:when test="name() = 'ModuleController'">
586
            <b>reuse controller</b> 
587
        </xsl:when>
588
        <xsl:when test="name() = 'UserParameters'">
589
            <b>set variables for thread</b> 
590
        </xsl:when>
591
        <xsl:when test="name() = 'RandomController'">
592
            <a>
593
            <xsl:attribute name="id">
594
                <xsl:value-of select="@testname"/>
595
            </xsl:attribute>
596
            <b>randomly run children</b></a> 
597
        </xsl:when>
598
        <xsl:when test="name() = 'ThroughputController'">
599
            <a>
600
            <xsl:attribute name="id">
601
                <xsl:value-of select="@testname"/>
602
            </xsl:attribute>
603
            <b>run at percentage</b></a> 
604
        </xsl:when>
605
        <xsl:when test="name() = 'IfController'">
606
            <a>
607
            <xsl:attribute name="id">
608
                <xsl:value-of select="@testname"/>
609
            </xsl:attribute>
610
            <b>if</b></a> 
611
        </xsl:when>
612
        <xsl:when test="name() = 'ResultCollector'">
613
            <b>write samples</b> 
614
        </xsl:when>
615
        <xsl:when test="name() = 'ConstantTimer'">
616
            <b>think-time Constant</b> 
617
        </xsl:when>
618
        <xsl:when test="name() = 'UniformRandomTimer'
619
            or name() = 'GaussianRandomTimer'
620
            or name() = 'PoissonRandomTimer'">
621
            <b>think-time <xsl:value-of select="substring-before(name(),'RandomTimer')" /></b> 
622
        </xsl:when>
623
        <xsl:when test="name() = 'JSR223Sampler'">
624
            <b>jsr223 sampler</b> 
625
        </xsl:when>
626
        <xsl:when test="name() = 'JSR223PreProcessor'">
627
            <b>jsr223 pre-process</b> 
628
        </xsl:when>
629
        <xsl:when test="name() = 'JSR223PostProcessor'">
630
            <b>jsr223 post-process</b> 
631
        </xsl:when>
632
        <xsl:when test="name() = 'CSVDataSet'">
633
            <b>read csv into vars</b> 
634
        </xsl:when>
635
        <xsl:when test="name() = 'HeaderManager'">
636
            <b>add headers</b> 
637
        </xsl:when>
638
        <xsl:when test="name() = 'CookieManager'">
639
            <b>handle cookies</b> 
640
        </xsl:when>
641
        <xsl:when test="name() = 'Arguments'">
642
            <b>globalVars</b> 
643
        </xsl:when>
644
        <xsl:when test="name() = 'TestAction'">
645
            <b>flow control</b> 
646
        </xsl:when>
647
        <xsl:when test="name() = 'ResultAction'">
648
            <b>action after sampler error </b> 
649
        </xsl:when>
650
        <xsl:when test="name() = 'ConfigTestElement' and @guiclass = 'HttpDefaultsGui'">
651
            <b>http defaults</b> 
652
        </xsl:when>
653
        <xsl:when test="name() = 'CacheManager'">
654
            <b>simulate browser cache</b> 
655
        </xsl:when>
656
        <xsl:when test="name() = 'RegexExtractor'">
657
            <b>extract-regexp </b> 
658
        </xsl:when>
659
        <xsl:when test="name() = 'BoundaryExtractor'">
660
            <b>extract-boundary </b>
661
        </xsl:when>
662
        <xsl:when test="name() = 'HtmlExtractor'">
663
            <b>extract-css-selector </b>
664
        </xsl:when>
665
        <xsl:when test="name() = 'XPathExtractor'">
666
            <b>extract-xpath </b>
667
        </xsl:when>
668
        <xsl:when test="name() = 'XPath2Extractor'">
669
            <b>extract-xpath2 </b>
670
        </xsl:when>
671
        <xsl:when test="name() = 'JSONPostProcessor'">
672
            <b>extract-jsonpath </b>
673
        </xsl:when>
674
        <xsl:when test="name() = 'TestPlan'">
675
            <b>load test </b>
676
        </xsl:when>
677
        <xsl:otherwise>
678
             <b><xsl:value-of select="name()"/></b> 
679
        </xsl:otherwise>
680
    </xsl:choose>
681
    "<xsl:value-of select="@testname"/>" <xsl:call-template name="disabledElement"/>
682
</xsl:template>
683
684
<xsl:template name="disabledElement">
685
    <xsl:if test="@enabled = 'false'">
686
        <del>(disabled)</del>&#160;
687
    </xsl:if>
688
</xsl:template>
689
</xsl:stylesheet>
(-)src/core/org/apache/jmeter/resources/messages.properties (+6 lines)
Lines 1039-1044 Link Here
1039
sbind=Single bind/unbind
1039
sbind=Single bind/unbind
1040
scheduler=Scheduler
1040
scheduler=Scheduler
1041
scheduler_configuration=Scheduler Configuration
1041
scheduler_configuration=Scheduler Configuration
1042
schematic_view_errors=Error on generation of schematic view
1043
schematic_view_generation_ok=Successful generation of schematic view in {0}
1044
schematic_view_info=Information
1045
schematic_view_menu=Generate Schematic View (alpha)
1046
schematic_view_no_plan=No plan opened
1047
schematic_view_outputfile=Save output file to ?
1042
scope=Scope
1048
scope=Scope
1043
search=Search
1049
search=Search
1044
search_base=Search base
1050
search_base=Search base
(-)src/core/org/apache/jmeter/resources/messages_fr.properties (+6 lines)
Lines 1028-1033 Link Here
1028
sbind=Simple connexion/déconnexion
1028
sbind=Simple connexion/déconnexion
1029
scheduler=Programmateur de démarrage
1029
scheduler=Programmateur de démarrage
1030
scheduler_configuration=Configuration du programmateur
1030
scheduler_configuration=Configuration du programmateur
1031
schematic_view_errors=Erreur lors de la génération de la vue schématique
1032
schematic_view_generation_ok=Génération réussie de la vue schématique dans {0}.
1033
schematic_view_info=Information
1034
schematic_view_menu=Générer une vue schématique (alpha)
1035
schematic_view_no_plan=Pas de plan ouvert
1036
schematic_view_outputfile=Enregistrer le fichier de sortie dans ?
1031
scope=Portée
1037
scope=Portée
1032
search=Rechercher\:
1038
search=Rechercher\:
1033
search_base=Base de recherche
1039
search_base=Base de recherche
(-)src/core/org/apache/jmeter/util/JMeterUtils.java (+23 lines)
Lines 898-903 Link Here
898
            log.warn("reportErrorToUser(\"{}\") caused", errorMsg, e);
898
            log.warn("reportErrorToUser(\"{}\") caused", errorMsg, e);
899
        }
899
        }
900
    }
900
    }
901
    
902
    /**
903
     * Report an information through a dialog box in GUI mode 
904
     *
905
     * @param msg - the information message.
906
     * @param titleMsg - title string
907
     */
908
    public static void reportInfoToUser(String msg, String titleMsg) {
909
        GuiPackage instance = GuiPackage.getInstance();
910
        if (instance == null) {
911
            log.info(msg);
912
            System.out.println(msg); // NOSONAR intentional
913
            return; // Done
914
        }
915
        try {
916
            JOptionPane.showMessageDialog(instance.getMainFrame(),
917
                    formatMessage(msg),
918
                    titleMsg,
919
                    JOptionPane.INFORMATION_MESSAGE);
920
        } catch (HeadlessException e) {
921
            log.warn("reportInfoToUser(\"{}\") caused", msg, e);
922
        }
923
    }
901
924
902
    private static JScrollPane formatMessage(String errorMsg) {
925
    private static JScrollPane formatMessage(String errorMsg) {
903
        JTextArea ta = new JTextArea(10, 50);
926
        JTextArea ta = new JTextArea(10, 50);
(-)xdocs/usermanual/properties_reference.xml (+10 lines)
Lines 1910-1915 Link Here
1910
    Defaults to: <code>100</code></property>
1910
    Defaults to: <code>100</code></property>
1911
</properties>
1911
</properties>
1912
</section>
1912
</section>
1913
1914
<section name="&sect-num;.45 Documentation generation" anchor="docgeneration">
1915
<description>Advanced properties for documentation generation</description>
1916
<properties>
1917
    <property name="docgeneration.schematic_xsl">
1918
    Path to XSL file used to generate Schematic View of Test Plan.<br/>
1919
    When empty, JMeter will use the embedded one in src/core/org/apache/jmeter/gui/action/schematic.xsl<br/>
1920
    No default value</property>
1921
</properties>
1922
</section>
1913
<!-- 
1923
<!-- 
1914
<section name="&sect-num;.10 Reports" anchor="Reports">
1924
<section name="&sect-num;.10 Reports" anchor="Reports">
1915
<description>
1925
<description>

Return to bug 63101