├── websocket
├── README.md
└── src
│ ├── test
│ ├── resources
│ │ └── mockito-extensions
│ │ │ └── org.mockito.plugins.MockMaker
│ └── java
│ │ └── blazemeter
│ │ └── jmeter
│ │ └── plugins
│ │ └── websocket
│ │ └── test
│ │ └── MqttCallBackImplTest.java
│ └── main
│ └── java
│ └── blazemeter
│ └── jmeter
│ └── plugins
│ └── websocket
│ └── sampler
│ ├── Handler.java
│ ├── Factory.java
│ └── gui
│ ├── WebSocketSendSamplerGui.java
│ └── WebSocketCollectorSamplerGui.java
├── xmpp
├── xmpp.png
├── xzibit.jpg
├── xmpp-sampler.png
├── xmpp-connection.png
├── XMPPConnection.md
├── src
│ ├── test
│ │ └── java
│ │ │ └── com
│ │ │ └── blazemeter
│ │ │ └── jmeter
│ │ │ └── xmpp
│ │ │ ├── JMeterXMPPSamplerMock.java
│ │ │ ├── JMeterXMPPConnectionTest.java
│ │ │ ├── actions
│ │ │ ├── DisconnectTest.java
│ │ │ ├── RawXMLTest.java
│ │ │ ├── SendMessageTest.java
│ │ │ └── GetBookmarksTest.java
│ │ │ ├── JMeterXMPPSamplerGuiTest.java
│ │ │ ├── XMPPConnectionMock.java
│ │ │ └── JMeterXMPPConnectionGuiTest.java
│ └── main
│ │ └── java
│ │ └── com
│ │ └── blazemeter
│ │ └── jmeter
│ │ └── xmpp
│ │ ├── actions
│ │ ├── Connect.java
│ │ ├── Disconnect.java
│ │ ├── GetBookmarks.java
│ │ ├── RawXML.java
│ │ ├── MUC.java
│ │ ├── ServiceDiscovery.java
│ │ ├── Login.java
│ │ ├── AbstractXMPPAction.java
│ │ ├── RosterAction.java
│ │ └── NoOp.java
│ │ ├── Loggers.java
│ │ └── JMeterXMPPSampler.java
└── XMPPSampler.md
├── random-csv-data-set
├── src
│ ├── test
│ │ ├── resources
│ │ │ ├── SpaceDelimiter.csv
│ │ │ ├── EmptyLastLine.csv
│ │ │ ├── text.csv
│ │ │ ├── JMeterCsvResults.csv
│ │ │ └── TabDelimiter.csv
│ │ └── java
│ │ │ └── com
│ │ │ └── blazemeter
│ │ │ └── jmeter
│ │ │ ├── TestRandomCSVActionTest.java
│ │ │ └── RandomCSVDataSetConfigGuiTest.java
│ └── main
│ │ └── java
│ │ └── com
│ │ └── blazemeter
│ │ ├── csv
│ │ ├── RandomBufferedReader.java
│ │ └── BufferedReaderExt.java
│ │ └── jmeter
│ │ └── TestRandomCSVAction.java
├── randomCSVDataSetConfig.png
└── RandomCSVDataSetConfig.md
├── parallel
├── ParallelSampler.png
├── ParallelController.png
├── src
│ ├── main
│ │ └── java
│ │ │ ├── org
│ │ │ └── apache
│ │ │ │ └── jmeter
│ │ │ │ ├── threads
│ │ │ │ └── JMeterContextServiceAccessorParallel.java
│ │ │ │ └── protocol
│ │ │ │ └── http
│ │ │ │ ├── sampler
│ │ │ │ └── HCAccessor.java
│ │ │ │ └── control
│ │ │ │ └── ThreadSafeCookieManager.java
│ │ │ └── com
│ │ │ └── blazemeter
│ │ │ └── jmeter
│ │ │ └── controller
│ │ │ ├── traverse
│ │ │ └── CustomTreeCloner.java
│ │ │ ├── ParallelListenerNotifier.java
│ │ │ ├── DummyThreadGroup.java
│ │ │ └── TestCompilerParallel.java
│ └── test
│ │ └── java
│ │ └── com
│ │ └── blazemeter
│ │ └── jmeter
│ │ ├── http
│ │ ├── ParallelHTTPSamplerMock.java
│ │ └── ParallelHTTPSamplerTest.java
│ │ └── controller
│ │ ├── ParallelControllerGuiTest.java
│ │ ├── traverse
│ │ └── CustomTreeClonerTest.java
│ │ ├── JMeterThreadParallelTest.java
│ │ └── ParallelListenerNotifierTest.java
└── Parallel.md
├── wsc
├── WeightedSwitchController.png
├── WeightedSwitchController.md
└── pom.xml
├── sense-uploader
├── BlazeMeterPlugin.png
├── blazemeter_uploader.png
├── loadosophia_uploader.png
├── src
│ ├── main
│ │ └── java
│ │ │ ├── kg
│ │ │ └── apc
│ │ │ │ └── jmeter
│ │ │ │ └── notifier
│ │ │ │ └── StatusNotifierCallback.java
│ │ │ ├── org
│ │ │ └── loadosophia
│ │ │ │ └── jmeter
│ │ │ │ └── LoadosophiaUploadResults.java
│ │ │ └── com
│ │ │ └── blazemeter
│ │ │ └── api
│ │ │ ├── BlazeMeterReport.java
│ │ │ ├── explorer
│ │ │ ├── BZAObject.java
│ │ │ ├── Master.java
│ │ │ ├── User.java
│ │ │ ├── Workspace.java
│ │ │ ├── Account.java
│ │ │ ├── Project.java
│ │ │ ├── Test.java
│ │ │ └── Session.java
│ │ │ └── http
│ │ │ └── BlazeMeterHttpUtils.java
│ └── test
│ │ └── java
│ │ ├── com
│ │ └── blazemeter
│ │ │ └── api
│ │ │ ├── BlazemeterReportTest.java
│ │ │ ├── explorer
│ │ │ ├── BZAObjectTest.java
│ │ │ ├── UserTest.java
│ │ │ ├── MasterTest.java
│ │ │ ├── ProjectTest.java
│ │ │ ├── WorkspaceTest.java
│ │ │ ├── AccountTest.java
│ │ │ ├── SessionTest.java
│ │ │ └── TestTest.java
│ │ │ ├── http
│ │ │ ├── BlazeMeterHttpUtilsEmul.java
│ │ │ └── BlazeMeterHttpUtilsTest.java
│ │ │ └── data
│ │ │ └── JSONConverterTest.java
│ │ ├── org
│ │ └── loadosophia
│ │ │ └── jmeter
│ │ │ ├── LoadosophiaAPIClientEmul.java
│ │ │ └── LoadosophiaAPIClientTest.java
│ │ └── kg
│ │ └── apc
│ │ └── jmeter
│ │ ├── reporters
│ │ ├── bzm
│ │ │ ├── BLCEmul.java
│ │ │ ├── BlazemeterUploaderTest.java
│ │ │ ├── BlazemeterUploaderGuiTest.java
│ │ │ └── BlazemeterBackendListenerClientTest.java
│ │ └── notifier
│ │ │ └── StatusNotifierCallbackTest.java
│ │ └── http
│ │ └── HttpUtilsEmul.java
├── BlazemeterPlugin.md
├── LoadosophiaUploader.md
├── BlazeMeterUploader.md
└── pom.xml
├── directory-listing
├── directoryListing.png
├── DirectoryListing.md
├── src
│ ├── test
│ │ └── java
│ │ │ └── com
│ │ │ └── blazemeter
│ │ │ └── jmeter
│ │ │ ├── DirectoryListingIteratorTest.java
│ │ │ └── DirectoryListingConfigGuiTest.java
│ └── main
│ │ └── java
│ │ └── com
│ │ └── blazemeter
│ │ └── jmeter
│ │ ├── TestDirectoryListingAction.java
│ │ └── DirectoryListingIterator.java
└── pom.xml
├── rotating-listener
├── rotatingListener.png
├── RotatingListener.md
├── src
│ ├── main
│ │ └── java
│ │ │ └── com
│ │ │ └── blazemeter
│ │ │ └── jmeter
│ │ │ └── RotatingResultCollectorGui.java
│ └── test
│ │ └── java
│ │ └── com
│ │ └── blazemeter
│ │ └── jmeter
│ │ └── RotatingResultCollectorGuiTest.java
└── pom.xml
├── .travis
└── install-maven-dependency.sh
├── pom.xml
├── .travis.yml
├── README.md
└── .gitignore
/websocket/README.md:
--------------------------------------------------------------------------------
1 | # Web Socket PLUGIN
2 | Repo for Web Socket plugin
3 |
4 |
5 |
--------------------------------------------------------------------------------
/xmpp/xmpp.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Blazemeter/jmeter-bzm-plugins/master/xmpp/xmpp.png
--------------------------------------------------------------------------------
/websocket/src/test/resources/mockito-extensions/org.mockito.plugins.MockMaker:
--------------------------------------------------------------------------------
1 | mock-maker-inline
--------------------------------------------------------------------------------
/xmpp/xzibit.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Blazemeter/jmeter-bzm-plugins/master/xmpp/xzibit.jpg
--------------------------------------------------------------------------------
/random-csv-data-set/src/test/resources/SpaceDelimiter.csv:
--------------------------------------------------------------------------------
1 | first second third
2 | 1 2 3
3 | 4 5 6
4 | 7 8 9
--------------------------------------------------------------------------------
/random-csv-data-set/src/test/resources/EmptyLastLine.csv:
--------------------------------------------------------------------------------
1 | first second third
2 | 1 2 3
3 | 4 5 6
4 | 7 8 9
5 |
--------------------------------------------------------------------------------
/xmpp/xmpp-sampler.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Blazemeter/jmeter-bzm-plugins/master/xmpp/xmpp-sampler.png
--------------------------------------------------------------------------------
/xmpp/xmpp-connection.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Blazemeter/jmeter-bzm-plugins/master/xmpp/xmpp-connection.png
--------------------------------------------------------------------------------
/parallel/ParallelSampler.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Blazemeter/jmeter-bzm-plugins/master/parallel/ParallelSampler.png
--------------------------------------------------------------------------------
/parallel/ParallelController.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Blazemeter/jmeter-bzm-plugins/master/parallel/ParallelController.png
--------------------------------------------------------------------------------
/wsc/WeightedSwitchController.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Blazemeter/jmeter-bzm-plugins/master/wsc/WeightedSwitchController.png
--------------------------------------------------------------------------------
/sense-uploader/BlazeMeterPlugin.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Blazemeter/jmeter-bzm-plugins/master/sense-uploader/BlazeMeterPlugin.png
--------------------------------------------------------------------------------
/directory-listing/directoryListing.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Blazemeter/jmeter-bzm-plugins/master/directory-listing/directoryListing.png
--------------------------------------------------------------------------------
/rotating-listener/rotatingListener.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Blazemeter/jmeter-bzm-plugins/master/rotating-listener/rotatingListener.png
--------------------------------------------------------------------------------
/sense-uploader/blazemeter_uploader.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Blazemeter/jmeter-bzm-plugins/master/sense-uploader/blazemeter_uploader.png
--------------------------------------------------------------------------------
/sense-uploader/loadosophia_uploader.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Blazemeter/jmeter-bzm-plugins/master/sense-uploader/loadosophia_uploader.png
--------------------------------------------------------------------------------
/random-csv-data-set/randomCSVDataSetConfig.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Blazemeter/jmeter-bzm-plugins/master/random-csv-data-set/randomCSVDataSetConfig.png
--------------------------------------------------------------------------------
/sense-uploader/src/main/java/kg/apc/jmeter/notifier/StatusNotifierCallback.java:
--------------------------------------------------------------------------------
1 | package kg.apc.jmeter.notifier;
2 |
3 | public interface StatusNotifierCallback {
4 |
5 | void notifyAbout(String info);
6 | }
7 |
--------------------------------------------------------------------------------
/random-csv-data-set/src/test/resources/text.csv:
--------------------------------------------------------------------------------
1 | firstname;lastname;street;city
2 | Hänsel;Mustermann;Einbahnstraße;Hamburg
3 | André;Lecompte;Rue du marché;Moÿ-de-l'Aisne
4 | Ἀλέξανδρος;Павлов;Большая Пироговская улица;Москва́
5 | בנימין;يعقوب;Street;Megapolis
--------------------------------------------------------------------------------
/.travis/install-maven-dependency.sh:
--------------------------------------------------------------------------------
1 | #/bin/bash
2 | set -ex
3 |
4 | if !(mvn dependency:get -Dartifact=$2:$3:$4); then
5 | mvn com.googlecode.maven-download-plugin:download-maven-plugin:1.4.0:wget -Ddownload.url=$1
6 | mvn install:install-file -Dfile=target/${1##*/} -DgroupId=$2 -DartifactId=$3 -Dversion=$4 -Dpackaging=jar
7 | fi
8 |
--------------------------------------------------------------------------------
/sense-uploader/BlazemeterPlugin.md:
--------------------------------------------------------------------------------
1 | # Reporters
2 | [BlazeMeter Uploader](BlazeMeterUploader.md) for uploading result to [BlazeMeter](https://a.blazemeter.com/) during the test running.
3 |
4 | [BM. Sense Uploader](LoadosophiaUploader.md) for uploading results to [BlazeMeter Sense](https://sense.blazemeter.com/?utm_source=jpgc&utm_medium=link&utm_campaign=wiki) immediately after test end.
--------------------------------------------------------------------------------
/random-csv-data-set/src/test/resources/JMeterCsvResults.csv:
--------------------------------------------------------------------------------
1 | timeStamp,elapsed,label,responseCode,responseMessage,threadName,dataType,success,bytes
2 | 1393227741256,1425,GET /ordermgmt/login - Login Page,200,OK,Thread Group 1-1,text,true,3478
3 | 1393227741257,2204,GET /ordermgmt/pre-logout,200,OK,"Thread Group 1-1{
4 | asdasdasdd
5 | fds
6 | fs
7 | sds}",text,true,19714
8 | 1393227741258,2204,GET /ordermgmt/pre-logout,200,OK,Thread Group 1-1,text,true,19714
--------------------------------------------------------------------------------
/xmpp/XMPPConnection.md:
--------------------------------------------------------------------------------
1 | # XMPP Connection Config
2 | 
3 |
4 | XMPP Connection Config item is required for any XMPP testing script. [XMPP Samplers](XMPPSampler.md) takes connection context from this element.
5 |
6 | TCP tansport is fully functional and tested with common XMPP servers, like `ejabberd`, `openfire` and `hipchat`.
7 |
8 | Please note that `BOSH` protocol option is experimental and may be not fully functional.
9 |
10 | 
--------------------------------------------------------------------------------
/rotating-listener/RotatingListener.md:
--------------------------------------------------------------------------------
1 | # Rotating JTL Listener
2 |
3 | Rotating JTL Listener is a Listener that allows writing sequence of JTL files, limited by number of samples per file.
4 |
5 | This enables recorded file to be handled by some background cleanup process,
6 | to be archived/deleted for saving disk space during soak tests and long duration/hight throughput tests.
7 |
8 | File names form sequence like `result.jtl => result.1.jtl => result.2.jtl`.
9 |
10 | 
11 |
--------------------------------------------------------------------------------
/parallel/src/main/java/org/apache/jmeter/threads/JMeterContextServiceAccessorParallel.java:
--------------------------------------------------------------------------------
1 | package org.apache.jmeter.threads;
2 |
3 | // you did not see this, ok?
4 | public class JMeterContextServiceAccessorParallel { // "Parallel" is to not clash with Debugger's class
5 | public static void decrNumberOfThreads() {
6 | JMeterContextService.decrNumberOfThreads();
7 | }
8 |
9 | public static void incrNumberOfThreads() {
10 | JMeterContextService.incrNumberOfThreads();
11 | }
12 | }
13 |
--------------------------------------------------------------------------------
/parallel/src/main/java/org/apache/jmeter/protocol/http/sampler/HCAccessor.java:
--------------------------------------------------------------------------------
1 | package org.apache.jmeter.protocol.http.sampler;
2 |
3 | import java.net.URL;
4 |
5 | // due to JMeter's closed namespaces we have to have this class to access it
6 | public class HCAccessor {
7 | public static HTTPAbstractImpl getInstance(HTTPSamplerBase sampler) {
8 | return new HTTPHC4Impl(sampler);
9 | }
10 |
11 | public static HTTPSampleResult sample(HTTPAbstractImpl impl, URL u, String method, boolean areFollowingRedirect, int depth) {
12 | return impl.sample(u, method, areFollowingRedirect, depth);
13 | }
14 | }
15 |
--------------------------------------------------------------------------------
/xmpp/src/test/java/com/blazemeter/jmeter/xmpp/JMeterXMPPSamplerMock.java:
--------------------------------------------------------------------------------
1 | package com.blazemeter.jmeter.xmpp;
2 |
3 | import org.jivesoftware.smack.SmackException;
4 | import org.jivesoftware.smack.XMPPConnection;
5 |
6 | import java.security.KeyManagementException;
7 | import java.security.NoSuchAlgorithmException;
8 |
9 | public class JMeterXMPPSamplerMock extends JMeterXMPPSampler {
10 |
11 | public XMPPConnectionMock conn = new XMPPConnectionMock();
12 |
13 | @Override
14 | public XMPPConnection getXMPPConnection() throws KeyManagementException, NoSuchAlgorithmException, SmackException {
15 | return conn;
16 | }
17 | }
18 |
--------------------------------------------------------------------------------
/xmpp/src/test/java/com/blazemeter/jmeter/xmpp/JMeterXMPPConnectionTest.java:
--------------------------------------------------------------------------------
1 | package com.blazemeter.jmeter.xmpp;
2 |
3 | import junit.framework.TestCase;
4 | import org.jivesoftware.smack.SmackException;
5 |
6 | import java.security.KeyManagementException;
7 | import java.security.NoSuchAlgorithmException;
8 |
9 | public class JMeterXMPPConnectionTest extends TestCase {
10 |
11 | public void testTestStarted() throws NoSuchAlgorithmException, KeyManagementException, SmackException, InterruptedException {
12 | JMeterXMPPConnection obj = new JMeterXMPPConnection();
13 | obj.setAddress("localhost");
14 | obj.testStarted("");
15 | obj.getConnection();
16 | obj.testEnded("");
17 | }
18 | }
--------------------------------------------------------------------------------
/xmpp/src/test/java/com/blazemeter/jmeter/xmpp/actions/DisconnectTest.java:
--------------------------------------------------------------------------------
1 | package com.blazemeter.jmeter.xmpp.actions;
2 |
3 | import com.blazemeter.jmeter.xmpp.JMeterXMPPSamplerMock;
4 | import org.apache.jmeter.samplers.SampleResult;
5 | import org.junit.Test;
6 |
7 | import javax.swing.*;
8 | import java.awt.*;
9 |
10 | public class DisconnectTest {
11 |
12 | @Test
13 | public void testPerform() throws Exception {
14 | Disconnect obj = new Disconnect();
15 | obj.perform(new JMeterXMPPSamplerMock(), new SampleResult());
16 | }
17 |
18 | @Test
19 | public void testAddUI() throws Exception {
20 | Disconnect obj = new Disconnect();
21 | obj.addUI(new JPanel(), new GridBagConstraints(), new GridBagConstraints());
22 | }
23 | }
--------------------------------------------------------------------------------
/sense-uploader/src/main/java/org/loadosophia/jmeter/LoadosophiaUploadResults.java:
--------------------------------------------------------------------------------
1 | package org.loadosophia.jmeter;
2 |
3 | public class LoadosophiaUploadResults {
4 |
5 | private String redirect = "";
6 | private int testID;
7 | private int queueID;
8 |
9 | public String getRedirectLink() {
10 | return redirect;
11 | }
12 |
13 | public void setRedirectLink(String string) {
14 | redirect = string;
15 | }
16 |
17 | public void setQueueID(int aQueueID) {
18 | queueID = aQueueID;
19 | }
20 |
21 | public void setTestID(int aTestID) {
22 | testID = aTestID;
23 | }
24 |
25 | public int getTestID() {
26 | return testID;
27 | }
28 |
29 | public int getQueueID() {
30 | return queueID;
31 | }
32 | }
33 |
--------------------------------------------------------------------------------
/pom.xml:
--------------------------------------------------------------------------------
1 |
2 |
5 | 4.0.0
6 |
7 | com.blazemeter.jmeter
8 | jmeter-bzm-plugins
9 | 0.0
10 | pom
11 |
12 |
13 |
14 | directory-listing
15 | parallel
16 | rotating-listener
17 | sense-uploader
18 | wsc
19 | xmpp
20 | websocket
21 | random-csv-data-set
22 |
23 |
--------------------------------------------------------------------------------
/sense-uploader/src/test/java/com/blazemeter/api/BlazemeterReportTest.java:
--------------------------------------------------------------------------------
1 | package com.blazemeter.api;
2 |
3 | import org.junit.Test;
4 |
5 | import static org.junit.Assert.assertEquals;
6 | import static org.junit.Assert.assertTrue;
7 |
8 | public class BlazemeterReportTest {
9 |
10 | @Test
11 | public void test() throws Exception {
12 | BlazeMeterReport report = new BlazeMeterReport();
13 |
14 | String project = "project";
15 | report.setProject(project);
16 | assertEquals(project, report.getProject());
17 |
18 | String title = "title";
19 | report.setTitle(title);
20 | assertEquals(title, report.getTitle());
21 |
22 | String token = "token";
23 | report.setToken(token);
24 | assertEquals(token, report.getToken());
25 |
26 | report.setShareTest(true);
27 | assertTrue(report.isShareTest());
28 | }
29 | }
--------------------------------------------------------------------------------
/wsc/WeightedSwitchController.md:
--------------------------------------------------------------------------------
1 | # Weighted Switch Controller
2 |
3 | This controller takes the information about child elements and offers managing relative weights for them. Relative weight means how frequently the child element will be executed during thread iterations. Please note that each thread has independent counter of iterations.
4 |
5 | Relative weights mapped to child names and it save values even if the order of the child has changed. In the case of adding a new child or rename existing child will be set the default value of the relative weight for this child. If the child element is disabled, the relative weight of this element will not be counted in the test.
6 |
7 | * `Random Choice` - on each iteration plugin will choose a random item. This check box can not guarantee that actual percent of child elements execution will equals with expected (delta in tests not more than 0.5%)
8 |
9 | 
--------------------------------------------------------------------------------
/sense-uploader/src/test/java/com/blazemeter/api/explorer/BZAObjectTest.java:
--------------------------------------------------------------------------------
1 | package com.blazemeter.api.explorer;
2 |
3 | import kg.apc.jmeter.http.HttpUtils;
4 | import kg.apc.jmeter.reporters.notifier.StatusNotifierCallbackTest;
5 |
6 | import static org.junit.Assert.*;
7 |
8 | public class BZAObjectTest {
9 |
10 | @org.junit.Test
11 | public void test() throws Exception {
12 | HttpUtils httpUtils = new HttpUtils(new StatusNotifierCallbackTest.StatusNotifierCallbackImpl(), "", "");
13 | BZAObject entity = new BZAObject(httpUtils, "id", "name");
14 | assertEquals(httpUtils, entity.getHttpUtils());
15 | assertEquals("id", entity.getId());
16 | assertEquals("name", entity.getName());
17 | entity.setHttpUtils(null);
18 | entity.setId("id1");
19 | entity.setName("name1");
20 | assertNull(entity.getHttpUtils());
21 | assertEquals("id1", entity.getId());
22 | assertEquals("name1", entity.getName());
23 | }
24 | }
--------------------------------------------------------------------------------
/.travis.yml:
--------------------------------------------------------------------------------
1 | env:
2 | global:
3 | - MAVEN_OPTS=-Dmaven.repo.local=.m2/repository
4 | - MQTT_WEBSOCKET_VERSION=1.0.1
5 |
6 | cache:
7 | directories:
8 | - .jmeter
9 | - .m2
10 |
11 | language: java
12 |
13 | jdk:
14 | - openjdk8
15 |
16 | before_install:
17 | - sudo apt-get -y update
18 | - sudo apt-get -y install python3 default-jre-headless python3-tk python3-setuptools python3-pip python3-dev libxml2-dev libxslt-dev zlib1g-dev net-tools
19 | - chmod -R +x ./.travis
20 | - "sh ./.travis/install-maven-dependency.sh https://github.com/inventit/mqtt-websocket-java/releases/download/$MQTT_WEBSOCKET_VERSION/mqtt-websocket-java-$MQTT_WEBSOCKET_VERSION.jar io.inventit.dev mqtt-websocket-java $MQTT_WEBSOCKET_VERSION"
21 |
22 | script:
23 | - "mvn -DskipTests=true clean install --batch-mode"
24 | - "mvn -Djava.awt.headless=true -Dmaven.test.redirectTestOutputToFile=true -Dcobertura.report.format=xml --fail-at-end --batch-mode cobertura:cobertura test"
25 |
26 | after_success:
27 | - bash <(curl -s https://codecov.io/bash)
28 |
--------------------------------------------------------------------------------
/parallel/src/main/java/org/apache/jmeter/protocol/http/control/ThreadSafeCookieManager.java:
--------------------------------------------------------------------------------
1 | package org.apache.jmeter.protocol.http.control;
2 |
3 | import org.apache.jmeter.testelement.property.PropertyIterator;
4 |
5 | public class ThreadSafeCookieManager extends CookieManager {
6 |
7 |
8 | public ThreadSafeCookieManager() {
9 | this(new CookieManager());
10 | }
11 |
12 | public ThreadSafeCookieManager(CookieManager manager) {
13 | PropertyIterator iter = manager.propertyIterator();
14 | while (iter.hasNext()) {
15 | setProperty(iter.next().clone());
16 | }
17 | setRunningVersion(manager.isRunningVersion());
18 | testStarted();
19 | }
20 |
21 | @Override
22 | public synchronized void add(Cookie c) {
23 | super.add(c);
24 | }
25 |
26 | @Override
27 | synchronized void removeMatchingCookies(Cookie newCookie) {
28 | super.removeMatchingCookies(newCookie);
29 | }
30 |
31 | @Override
32 | public Object clone() {
33 | return super.clone();
34 | }
35 | }
36 |
--------------------------------------------------------------------------------
/parallel/src/test/java/com/blazemeter/jmeter/http/ParallelHTTPSamplerMock.java:
--------------------------------------------------------------------------------
1 | package com.blazemeter.jmeter.http;
2 |
3 | import org.apache.jmeter.protocol.http.sampler.HTTPAbstractImpl;
4 | import org.apache.jmeter.protocol.http.sampler.HTTPSampleResult;
5 | import org.apache.jmeter.protocol.http.sampler.HTTPSamplerBase;
6 |
7 | import java.net.URL;
8 |
9 | public class ParallelHTTPSamplerMock extends ParallelHTTPSampler {
10 | public ParallelHTTPSamplerMock() {
11 | super();
12 | impl = new HCMock(this);
13 | }
14 |
15 | public class HCMock extends HTTPAbstractImpl {
16 | public HCMock(HTTPSamplerBase testElement) {
17 | super(testElement);
18 | }
19 |
20 | @Override
21 | protected HTTPSampleResult sample(URL url, String s, boolean b, int i) {
22 | HTTPSampleResult res = new HTTPSampleResult();
23 | res.setSuccessful(true);
24 | return res;
25 | }
26 |
27 | @Override
28 | public boolean interrupt() {
29 | return false;
30 | }
31 | }
32 | }
33 |
34 |
--------------------------------------------------------------------------------
/sense-uploader/src/main/java/com/blazemeter/api/BlazeMeterReport.java:
--------------------------------------------------------------------------------
1 | package com.blazemeter.api;
2 |
3 | public class BlazeMeterReport {
4 |
5 | protected boolean isShareTest;
6 | protected String project;
7 | protected String title;
8 | protected String token;
9 |
10 | public boolean isAnonymousTest() {
11 | return (token == null || token.isEmpty());
12 | }
13 |
14 | public boolean isShareTest() {
15 | return isShareTest;
16 | }
17 |
18 | public void setShareTest(boolean shareTest) {
19 | isShareTest = shareTest;
20 | }
21 |
22 | public String getProject() {
23 | return project;
24 | }
25 |
26 | public void setProject(String project) {
27 | this.project = project;
28 | }
29 |
30 | public String getTitle() {
31 | return title;
32 | }
33 |
34 | public void setTitle(String title) {
35 | this.title = title;
36 | }
37 |
38 | public String getToken() {
39 | return token;
40 | }
41 |
42 | public void setToken(String token) {
43 | this.token = token;
44 | }
45 | }
46 |
--------------------------------------------------------------------------------
/directory-listing/DirectoryListing.md:
--------------------------------------------------------------------------------
1 | # Directory Listing Config
2 |
3 | Directory listing config plugin offers capabilities list files from source directory and iterate over this list with JMeter variable. This is convenient for data-driven testing when you have, for example, 1000 files to upload into server.
4 |
5 | This plugin has following options that affect the behavior:
6 | * "Use full path" - is this flag does not selected plugin will be set sub-path from source path into destination variable;
7 | * "Random order" - shuffle listing in random order;
8 | * "Recursive listing" - meaning, that plugin will be looking for all sub-folders in source directory;
9 | * "Rewind on end of list" - if the flag is selected and an iteration loop has reached the end, the new loop will be started;
10 | * "Re-read directory on the end of list" - re-read directory before starting new iteration loop;
11 | * "Independent list per thread" - determines that listing will be shared for all threads or each thread will be having own local copy.
12 |
13 | _Default value of destination variable name is "filename"._
14 |
15 | 
16 |
--------------------------------------------------------------------------------
/random-csv-data-set/src/test/resources/TabDelimiter.csv:
--------------------------------------------------------------------------------
1 | timeStamp elapsed label responseCode responseMessage threadName dataType success failureMessage bytes sentBytes grpThreads allThreads Latency IdleTime Connect
2 | 1509464779128 131 jp@gc - Dummy Sampler 200 OK Thread Group 1-1 text true 114 0 1 1 33 0 4
3 | 1509464779260 478 jp@gc - Dummy Sampler 200 OK Thread Group 1-1 text true 114 0 1 1 27 0 2
4 | 1509464779738 175 jp@gc - Dummy Sampler 200 OK Thread Group 1-1 text true 114 0 1 1 22 0 1
5 | 1509464779913 186 jp@gc - Dummy Sampler 200 OK Thread Group 1-1 text true 114 0 1 1 25 0 5
6 | 1509464780099 87 jp@gc - Dummy Sampler 200 OK Thread Group 1-1 text true 114 0 1 1 40 0 4
7 | 1509464780186 484 jp@gc - Dummy Sampler 200 OK Thread Group 1-1 text true 114 0 1 1 19 0 5
8 | 1509464780671 480 jp@gc - Dummy Sampler 200 OK Thread Group 1-1 text true 114 0 1 1 38 0 1
9 | 1509464781152 207 jp@gc - Dummy Sampler 200 OK Thread Group 1-1 text true 114 0 1 1 29 0 1
10 | 1509464781359 102 jp@gc - Dummy Sampler 200 OK Thread Group 1-1 text true 114 0 1 1 14 0 4
11 | 1509464781461 407 jp@gc - Dummy Sampler 200 OK Thread Group 1-1 text true 114 0 1 1 26 0 5
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # Plugins for Apache JMeter by CA BlazeMeter
2 | Consolidated repository with all CA BlazeMeter's plugins for JMeter. All of the plugins are available through [Plugins Manager](https://jmeter-plugins.org/wiki/PluginsManager/).
3 |
4 | Contents:
5 | - [Directory Listing Data Source](directory-listing/DirectoryListing.md)
6 | - [HTTP/2 Protocol](http2/README.md)
7 | - [Parallel Controller](parallel/Parallel.md)
8 | - [Random CSV Data Set Config ](random-csv-data-set/RandomCSVDataSetConfig.md)
9 | - [Rotating JTL File Listener](rotating-listener/RotatingListener.md)
10 | - [Weighted Switch Controller](wsc/WeightedSwitchController.md)
11 | - [XMPP Connection](xmpp/XMPPConnection.md) and [XMPP Sampler](xmpp/XMPPSampler.md)
12 | - [BlazeMeter Uploader](sense-uploader/BlazeMeterUploader.md) and [BM.Sense Uploader](sense-uploader/LoadosophiaUploader.md)
13 |
14 | ## Support
15 |
16 | To get support on these plugins, please use regular [JMeter Plugins support forums](https://groups.google.com/forum/#!forum/jmeter-plugins)
17 |
18 | ## License
19 |
20 | The plugins are proudly contributed to community as Open Source, under [Apache 2.0 License](LICENSE).
21 |
--------------------------------------------------------------------------------
/parallel/src/test/java/com/blazemeter/jmeter/controller/ParallelControllerGuiTest.java:
--------------------------------------------------------------------------------
1 | package com.blazemeter.jmeter.controller;
2 |
3 | import kg.apc.emulators.TestJMeterUtils;
4 | import org.junit.BeforeClass;
5 | import org.junit.Test;
6 |
7 | import javax.swing.*;
8 | import java.awt.*;
9 |
10 |
11 | public class ParallelControllerGuiTest {
12 |
13 | @BeforeClass
14 | public static void setUpClass()
15 | throws Exception {
16 | TestJMeterUtils.createJmeterEnv();
17 | }
18 |
19 |
20 | @Test
21 | public void showGui() throws Exception {
22 | if (!GraphicsEnvironment.getLocalGraphicsEnvironment().isHeadlessInstance()) {
23 | ParallelControllerGui gui = new ParallelControllerGui();
24 | JDialog frame = new JDialog();
25 | frame.add(gui);
26 |
27 | frame.setPreferredSize(new Dimension(800, 600));
28 | frame.setDefaultCloseOperation(WindowConstants.HIDE_ON_CLOSE);
29 | frame.pack();
30 | frame.setVisible(true);
31 | while (frame.isVisible()) {
32 | Thread.sleep(100);
33 | }
34 | }
35 | }
36 |
37 | }
--------------------------------------------------------------------------------
/websocket/src/main/java/blazemeter/jmeter/plugins/websocket/sampler/Handler.java:
--------------------------------------------------------------------------------
1 | package blazemeter.jmeter.plugins.websocket.sampler;
2 |
3 | import java.io.IOException;
4 | import java.io.Serializable;
5 | import java.util.LinkedList;
6 | import java.util.Queue;
7 | import java.util.concurrent.TimeUnit;
8 |
9 | public abstract class Handler implements Serializable{
10 |
11 | private String encoding;
12 | protected Queue messages = new LinkedList();
13 |
14 | Handler (){}
15 |
16 | Handler (String enconding){
17 | this.encoding = encoding;
18 | }
19 |
20 | public String getContentEncoding(){
21 | return this.encoding;
22 | }
23 |
24 | public abstract void close();
25 |
26 | public abstract boolean awaitMessage(int duration, TimeUnit unit, String waitResponsePatter) throws InterruptedException;
27 |
28 | public String getMessages(){
29 | String ret = "";
30 | for (String s : messages){
31 | ret = ret + s + "\n";
32 | }
33 | messages.clear();
34 | return ret;
35 | }
36 |
37 | public abstract void initialize();
38 |
39 | public abstract boolean isConnected();
40 |
41 | public abstract void sendMessage(String message) throws IOException;
42 |
43 | }
44 |
--------------------------------------------------------------------------------
/sense-uploader/src/main/java/com/blazemeter/api/explorer/BZAObject.java:
--------------------------------------------------------------------------------
1 | package com.blazemeter.api.explorer;
2 |
3 | import kg.apc.jmeter.http.HttpUtils;
4 | import org.apache.jorphan.logging.LoggingManager;
5 | import org.apache.log.Logger;
6 |
7 | /**
8 | * Base entity for BlazeMeter explorer classes
9 | */
10 | public class BZAObject {
11 |
12 | protected static final Logger log = LoggingManager.getLoggerForClass();
13 |
14 | protected String id;
15 | protected String name;
16 | protected HttpUtils httpUtils;
17 |
18 | public BZAObject(HttpUtils httpUtils, String id, String name) {
19 | this.httpUtils = httpUtils;
20 | this.id = id;
21 | this.name = name;
22 | }
23 |
24 | public HttpUtils getHttpUtils() {
25 | return httpUtils;
26 | }
27 |
28 | public void setHttpUtils(HttpUtils httpUtils) {
29 | this.httpUtils = httpUtils;
30 | }
31 |
32 | public String getId() {
33 | return id;
34 | }
35 |
36 | public String getName() {
37 | return name;
38 | }
39 |
40 | public void setId(String id) {
41 | this.id = id;
42 | }
43 |
44 | public void setName(String name) {
45 | this.name = name;
46 | }
47 | }
48 |
--------------------------------------------------------------------------------
/xmpp/src/test/java/com/blazemeter/jmeter/xmpp/actions/RawXMLTest.java:
--------------------------------------------------------------------------------
1 | package com.blazemeter.jmeter.xmpp.actions;
2 |
3 | import com.blazemeter.jmeter.xmpp.JMeterXMPPSamplerMock;
4 | import org.apache.jmeter.samplers.Sampler;
5 | import org.junit.Before;
6 | import org.junit.Test;
7 |
8 | import javax.swing.*;
9 | import java.awt.*;
10 |
11 | import static org.junit.Assert.assertFalse;
12 |
13 | public class RawXMLTest {
14 |
15 | private RawXML obj;
16 |
17 | @Before
18 | public void setUp() throws Exception {
19 | this.obj = new RawXML();
20 | }
21 |
22 | @Test
23 | public void testGetLabel() throws Exception {
24 | assertFalse(obj.getLabel().isEmpty());
25 | }
26 |
27 | @Test
28 | public void testPerform() throws Exception {
29 | Sampler s = new JMeterXMPPSamplerMock();
30 | s.setProperty(RawXML.XML, "");
31 | }
32 |
33 | @Test
34 | public void testAddUI() throws Exception {
35 | obj.addUI(new JPanel(), new GridBagConstraints(), new GridBagConstraints());
36 | obj.setSamplerProperties(new JMeterXMPPSamplerMock());
37 | obj.setGuiFieldsFromSampler(new JMeterXMPPSamplerMock());
38 | obj.clearGui();
39 | }
40 |
41 | }
--------------------------------------------------------------------------------
/xmpp/src/main/java/com/blazemeter/jmeter/xmpp/actions/Connect.java:
--------------------------------------------------------------------------------
1 | package com.blazemeter.jmeter.xmpp.actions;
2 |
3 |
4 | import com.blazemeter.jmeter.xmpp.JMeterXMPPSampler;
5 | import org.apache.jmeter.samplers.SampleResult;
6 | import org.jivesoftware.smack.AbstractXMPPConnection;
7 |
8 | import javax.swing.*;
9 | import java.awt.*;
10 |
11 | public class Connect extends AbstractXMPPAction {
12 | @Override
13 | public String getLabel() {
14 | return "Connect to Server";
15 | }
16 |
17 | @Override
18 | public SampleResult perform(JMeterXMPPSampler sampler, SampleResult res) throws Exception {
19 | AbstractXMPPConnection conn = (AbstractXMPPConnection)sampler.getXMPPConnection();
20 | conn.connect();
21 | res.setResponseData(sampler.getXMPPConnection().getConnectionID().getBytes());
22 | return res;
23 | }
24 |
25 | @Override
26 | public void addUI(JComponent panel, GridBagConstraints labelConstraints, GridBagConstraints editConstraints) {
27 |
28 | }
29 |
30 | @Override
31 | public void clearGui() {
32 |
33 | }
34 |
35 | @Override
36 | public void setSamplerProperties(JMeterXMPPSampler sampler) {
37 |
38 | }
39 |
40 | @Override
41 | public void setGuiFieldsFromSampler(JMeterXMPPSampler sampler) {
42 |
43 | }
44 | }
45 |
--------------------------------------------------------------------------------
/sense-uploader/src/test/java/org/loadosophia/jmeter/LoadosophiaAPIClientEmul.java:
--------------------------------------------------------------------------------
1 | package org.loadosophia.jmeter;
2 |
3 | import kg.apc.jmeter.notifier.StatusNotifierCallback;
4 | import net.sf.json.JSON;
5 | import org.apache.http.client.methods.HttpRequestBase;
6 | import org.apache.jorphan.logging.LoggingManager;
7 | import org.apache.log.Logger;
8 |
9 | import java.io.IOException;
10 | import java.util.LinkedList;
11 |
12 |
13 | public class LoadosophiaAPIClientEmul extends LoadosophiaAPIClient {
14 | private static final Logger log = LoggingManager.getLoggerForClass();
15 |
16 | private LinkedList responses = new LinkedList<>();
17 |
18 | public LoadosophiaAPIClientEmul(StatusNotifierCallback aThis) {
19 | super(aThis, "http://localhost/", "TEST", COLOR_NONE, "TEST", "TEST");
20 | }
21 |
22 | public void addEmul(JSON response) {
23 | responses.add(response);
24 | }
25 |
26 | @Override
27 | public JSON query(HttpRequestBase request, int expectedCode) throws IOException {
28 | log.info("Simulating request: " + request);
29 | if (responses.size()>0) {
30 | JSON resp = responses.remove();
31 | log.info("Response: " + resp);
32 | return resp;
33 | } else {
34 | throw new IOException("No responses to emulate");
35 | }
36 | }
37 | }
38 |
--------------------------------------------------------------------------------
/sense-uploader/src/main/java/com/blazemeter/api/explorer/Master.java:
--------------------------------------------------------------------------------
1 | package com.blazemeter.api.explorer;
2 |
3 | import kg.apc.jmeter.http.HttpUtils;
4 | import net.sf.json.JSONObject;
5 |
6 | import java.io.IOException;
7 |
8 | public class Master extends BZAObject {
9 |
10 | public Master(HttpUtils httpUtils, String id, String name) {
11 | super(httpUtils, id, name);
12 | }
13 |
14 | /**
15 | * Makes a private user report public
16 | * @return public link to the report
17 | */
18 | public String makeReportPublic() throws IOException {
19 | String uri = httpUtils.getAddress() + String.format("/api/v4/masters/%s/public-token", getId());
20 | JSONObject obj = new JSONObject();
21 | obj.put("publicToken", "None");
22 | JSONObject response = httpUtils.queryObject(httpUtils.createPost(uri, obj.toString()), 201);
23 |
24 | return httpUtils.getAddress() + String.format("/app/?public-token=%s#/masters/%s/summary",
25 | extractPublicToken(response.getJSONObject("result")), getId());
26 | }
27 |
28 | private String extractPublicToken(JSONObject result) {
29 | return result.getString("publicToken");
30 | }
31 |
32 | public static Master fromJSON(HttpUtils httpUtils, JSONObject obj) {
33 | return new Master(httpUtils, obj.getString("id"), obj.getString("name"));
34 | }
35 | }
36 |
--------------------------------------------------------------------------------
/sense-uploader/src/main/java/com/blazemeter/api/explorer/User.java:
--------------------------------------------------------------------------------
1 | package com.blazemeter.api.explorer;
2 |
3 | import kg.apc.jmeter.http.HttpUtils;
4 | import net.sf.json.JSONArray;
5 | import net.sf.json.JSONObject;
6 |
7 | import java.io.IOException;
8 | import java.util.ArrayList;
9 | import java.util.List;
10 |
11 | public class User extends BZAObject {
12 |
13 |
14 | public User(HttpUtils httpUtils) {
15 | super(httpUtils, "", "");
16 | }
17 |
18 | /**
19 | * Quick check if we can access the service
20 | */
21 | public void ping() throws IOException {
22 | String uri = httpUtils.getAddress() + "/api/v4/web/version";
23 | httpUtils.query(httpUtils.createGet(uri), 200);
24 | }
25 |
26 | /**
27 | * @return list of Account for user token
28 | */
29 | public List getAccounts() throws IOException {
30 | String uri = httpUtils.getAddress()+ "/api/v4/accounts";
31 | JSONObject response = httpUtils.queryObject(httpUtils.createGet(uri), 200);
32 | return extractAccounts(response.getJSONArray("result"));
33 | }
34 |
35 | private List extractAccounts(JSONArray result) {
36 | List accounts = new ArrayList<>();
37 |
38 | for (Object obj : result) {
39 | accounts.add(Account.fromJSON(httpUtils, (JSONObject) obj));
40 | }
41 |
42 | return accounts;
43 | }
44 | }
45 |
--------------------------------------------------------------------------------
/sense-uploader/src/test/java/kg/apc/jmeter/reporters/bzm/BLCEmul.java:
--------------------------------------------------------------------------------
1 | package kg.apc.jmeter.reporters.bzm;
2 |
3 | import com.blazemeter.api.BlazeMeterAPIClient;
4 | import kg.apc.jmeter.http.HttpUtilsEmul;
5 |
6 | import java.io.IOException;
7 |
8 | public class BLCEmul extends BlazeMeterBackendListenerClient {
9 | @Override
10 | public void initiateOnline() {
11 | HttpUtilsEmul httpUtils = new HttpUtilsEmul(informer, "https://a.blazemeter.com/", "https://a.blazemeter.com/");
12 | httpUtils.addEmul("{}");
13 | httpUtils.addEmul("{\"result\": {" +
14 | "\"test\": {\"id\": 1, \"name\": \"atest\"}, " +
15 | "\"master\": {\"id\": 1, \"name\": \"atest\"}, " +
16 | "\"session\": {\"id\": 1, \"name\": \"atest\", \"userId\": \"atest\"}, " +
17 | "\"publicTokenUrl\": \"http://\", " +
18 | "\"signature\": \"sign\"" +
19 | "}}");
20 | httpUtils.addEmul("{\"result\": {" +
21 | "\"session\": {\"id\": 1, \"name\": \"atest\", \"userId\": \"atest\", \"statusCode\": \"50\"} " +
22 | "}}");
23 | httpUtils.addEmul("{}");
24 | apiClient = new BlazeMeterAPIClient(httpUtils, informer, report);
25 | apiClient.prepare();
26 | try {
27 | apiClient.startOnline();
28 | } catch (IOException e) {
29 | throw new RuntimeException("", e);
30 | }
31 | }
32 | }
33 |
--------------------------------------------------------------------------------
/websocket/src/main/java/blazemeter/jmeter/plugins/websocket/sampler/Factory.java:
--------------------------------------------------------------------------------
1 | package blazemeter.jmeter.plugins.websocket.sampler;
2 |
3 | import java.io.Serializable;
4 |
5 | import org.eclipse.jetty.websocket.client.WebSocketClient;
6 | import org.eclipse.paho.client.mqttv3.IMqttAsyncClient;
7 | import org.eclipse.paho.client.mqttv3.MqttAsyncClient;
8 | import org.eclipse.paho.client.mqttv3.MqttException;
9 | import org.eclipse.paho.client.mqttv3.persist.MemoryPersistence;
10 |
11 | import io.inventit.dev.mqtt.paho.MqttWebSocketAsyncClient;
12 |
13 | public class Factory implements Serializable{
14 |
15 | public MqttCallBackImpl getMqttHandler (IMqttAsyncClient client, String clientID, String logLevel, String encoding){
16 | return new MqttCallBackImpl(client, clientID, logLevel, encoding);
17 | }
18 |
19 | public WebSocketConnection getWebSocketHandler (WebSocketClient client, String closeConnectionPattern, String encoding){
20 | return new WebSocketConnection(client, closeConnectionPattern, encoding);
21 | }
22 |
23 | public IMqttAsyncClient getMqttAsyncClient (String protocol, String mqttUrl, String clientID, MemoryPersistence persistence) throws MqttException {
24 | if(protocol.equals("tcp"))
25 | return new MqttAsyncClient(mqttUrl, clientID, persistence);
26 | else if (protocol.equals("ws") || protocol.equals("wss"))
27 | return new MqttWebSocketAsyncClient (mqttUrl, clientID, persistence);
28 | else
29 | return null;
30 | }
31 | }
32 |
--------------------------------------------------------------------------------
/xmpp/src/main/java/com/blazemeter/jmeter/xmpp/actions/Disconnect.java:
--------------------------------------------------------------------------------
1 | package com.blazemeter.jmeter.xmpp.actions;
2 |
3 | import com.blazemeter.jmeter.xmpp.JMeterXMPPSampler;
4 | import org.apache.jmeter.samplers.SampleResult;
5 | import org.jivesoftware.smack.AbstractXMPPConnection;
6 |
7 | import javax.swing.*;
8 | import java.awt.*;
9 |
10 | public class Disconnect extends AbstractXMPPAction {
11 |
12 | @Override
13 | public String getLabel() {
14 | return "Disconnect from Server";
15 | }
16 |
17 | @Override
18 | public SampleResult perform(JMeterXMPPSampler sampler, SampleResult res) throws Exception {
19 | if (!sampler.getXMPPConnection().isConnected()) {
20 | return res;
21 | }
22 | AbstractXMPPConnection conn = (AbstractXMPPConnection)sampler.getXMPPConnection();
23 | conn.disconnect();
24 | if (sampler.getXMPPConnectionConfig() != null)
25 | sampler.getXMPPConnectionConfig().resetConnection();
26 | return res;
27 | }
28 |
29 | @Override
30 | public void addUI(JComponent panel, GridBagConstraints labelConstraints, GridBagConstraints editConstraints) {
31 | }
32 |
33 | @Override
34 | public void clearGui() {
35 |
36 | }
37 |
38 | @Override
39 | public void setSamplerProperties(JMeterXMPPSampler sampler) {
40 |
41 | }
42 |
43 | @Override
44 | public void setGuiFieldsFromSampler(JMeterXMPPSampler sampler) {
45 |
46 | }
47 | }
48 |
--------------------------------------------------------------------------------
/xmpp/src/test/java/com/blazemeter/jmeter/xmpp/actions/SendMessageTest.java:
--------------------------------------------------------------------------------
1 | package com.blazemeter.jmeter.xmpp.actions;
2 |
3 | import com.blazemeter.jmeter.xmpp.JMeterXMPPSampler;
4 | import com.blazemeter.jmeter.xmpp.JMeterXMPPSamplerMock;
5 | import com.blazemeter.jmeter.xmpp.XMPPConnectionMock;
6 | import org.apache.jmeter.samplers.SampleResult;
7 | import org.jivesoftware.smack.XMPPConnection;
8 | import org.jivesoftware.smack.packet.Message;
9 | import org.junit.Assert;
10 | import org.junit.Test;
11 |
12 |
13 | public class SendMessageTest {
14 | @Test
15 | public void perform() throws Exception {
16 | SendMessage action = new SendMessage();
17 | XMPPConnectionMock connection = new XMPPConnectionMock();
18 | action.connected(connection);
19 | Message resp = new Message();
20 | resp.setFrom("test@test.com");
21 | resp.setBody(SendMessage.RESPONSE_MARKER);
22 | action.processPacket(resp);
23 | JMeterXMPPSampler sampler = new JMeterXMPPSamplerMock();
24 | sampler.getXMPPConnection().setFromMode(XMPPConnection.FromMode.USER);
25 | sampler.setProperty(SendMessage.RECIPIENT, "test@test.com");
26 | sampler.setProperty(SendMessage.WAIT_RESPONSE, true);
27 | SampleResult res = new SampleResult();
28 | action.perform(sampler, res);
29 | Assert.assertTrue(res.getResponseDataAsString().contains(SendMessage.RESPONSE_MARKER));
30 | Assert.assertTrue(res.getSamplerData().contains("from"));
31 | }
32 |
33 | }
--------------------------------------------------------------------------------
/random-csv-data-set/src/test/java/com/blazemeter/jmeter/TestRandomCSVActionTest.java:
--------------------------------------------------------------------------------
1 | package com.blazemeter.jmeter;
2 |
3 | import kg.apc.emulators.TestJMeterUtils;
4 | import org.junit.BeforeClass;
5 | import org.junit.Test;
6 |
7 |
8 | import static org.junit.Assert.*;
9 |
10 |
11 | public class TestRandomCSVActionTest {
12 |
13 | @BeforeClass
14 | public static void setUpClass()
15 | throws Exception {
16 | TestJMeterUtils.createJmeterEnv();
17 | }
18 |
19 | @Test
20 | public void testAction() throws Exception {
21 | String path = this.getClass().getResource("/JMeterCsvResults.csv").getPath();
22 |
23 | RandomCSVDataSetConfig config = new RandomCSVDataSetConfig();
24 | config.setFilename(path);
25 | config.setFileEncoding("UTF-8");
26 | config.setDelimiter(",");
27 | // special check for skip first line. It must no skip and return all lines in file.
28 | config.setVariableNames("aaa,aaa1");
29 | config.setIgnoreFirstLine(false);
30 |
31 | RandomCSVDataSetConfigGui gui = new RandomCSVDataSetConfigGui();
32 |
33 | gui.configure(config);
34 |
35 | TestRandomCSVAction action = new TestRandomCSVAction(gui);
36 |
37 | action.actionPerformed(null);
38 | assertTrue(gui.getCheckArea().getText().startsWith("Reading CSV successfully finished, 4 records found"));
39 |
40 | config.setFilename("");
41 | gui.configure(config);
42 | action.actionPerformed(null);
43 | assertTrue(gui.getCheckArea().getText().contains("Is a directory"));
44 | }
45 | }
--------------------------------------------------------------------------------
/parallel/src/main/java/com/blazemeter/jmeter/controller/traverse/CustomTreeCloner.java:
--------------------------------------------------------------------------------
1 | package com.blazemeter.jmeter.controller.traverse;
2 |
3 | import org.apache.jmeter.protocol.http.control.CookieManager;
4 | import org.apache.jmeter.protocol.http.control.ThreadSafeCookieManager;
5 | import org.apache.jorphan.collections.HashTree;
6 | import org.apache.jorphan.collections.HashTreeTraverser;
7 | import org.apache.jorphan.collections.ListedHashTree;
8 |
9 | import java.util.LinkedList;
10 |
11 | public class CustomTreeCloner implements HashTreeTraverser {
12 |
13 | private final ListedHashTree newTree;
14 |
15 | private final LinkedList