This is an automated email from the ASF dual-hosted git repository. pmouawad pushed a commit to branch remove_mongodb in repository https://gitbox.apache.org/repos/asf/jmeter.git
commit 8312da07def15eacdb63944a037376eb22948a94 Author: pmouawad <[email protected]> AuthorDate: Fri Oct 4 23:48:50 2019 +0200 Remove mongodb releated elements TestSaveService is still failing --- bin/jmeter.properties | 9 +- bin/saveservice.properties | 9 +- bin/templates/mongodb.jmx | 194 ----------- bin/templates/templates.xml | 23 -- checksum.xml | 1 - gradle.properties | 1 - lib/aareadme.txt | 5 - settings.gradle.kts | 1 - src/bom/build.gradle.kts | 1 - .../java/org/apache/jmeter/save/SaveService.java | 6 +- src/dist/build.gradle.kts | 1 - src/protocol/build.gradle.kts | 9 - .../protocol/mongodb/config/MongoDBHolder.java | 56 --- .../mongodb/config/MongoSourceElement.java | 376 --------------------- .../mongodb/config/MongoSourceElementBeanInfo.java | 118 ------- .../protocol/mongodb/mongo/EvalResultHandler.java | 67 ---- .../jmeter/protocol/mongodb/mongo/MongoDB.java | 75 ---- .../jmeter/protocol/mongodb/mongo/MongoUtils.java | 51 --- .../mongodb/sampler/MongoScriptRunner.java | 69 ---- .../mongodb/sampler/MongoScriptSampler.java | 144 -------- .../sampler/MongoScriptSamplerBeanInfo.java | 74 ---- .../config/MongoSourceElementResources.properties | 55 --- .../MongoSourceElementResources_fr.properties | 55 --- .../sampler/MongoScriptSamplerResources.properties | 27 -- .../MongoScriptSamplerResources_fr.properties | 27 -- .../resources/ResourceKeyUsageTestMongodb.java | 23 -- xdocs/usermanual/component_reference.xml | 122 ------- xdocs/usermanual/properties_reference.xml | 6 +- 28 files changed, 17 insertions(+), 1588 deletions(-) diff --git a/bin/jmeter.properties b/bin/jmeter.properties index f5753f4..8d94c4f 100644 --- a/bin/jmeter.properties +++ b/bin/jmeter.properties @@ -192,12 +192,11 @@ #Components to not display in JMeter GUI (GUI class name or static label) # These elements are deprecated and will be removed in next version: -# MongoDB Script, MongoDB Source Config, Monitor Results +# Monitor Results # BSF Elements -not_in_menu=org.apache.jmeter.protocol.mongodb.sampler.MongoScriptSampler,org.apache.jmeter.protocol.mongodb.config.MongoSourceElement,\ - org.apache.jmeter.timers.BSFTimer,org.apache.jmeter.modifiers.BSFPreProcessor,org.apache.jmeter.extractor.BSFPostProcessor,org.apache.jmeter.assertions.BSFAssertion,\ - org.apache.jmeter.visualizers.BSFListener,org.apache.jmeter.protocol.java.sampler.BSFSampler,\ - org.apache.jmeter.protocol.http.control.gui.SoapSamplerGui +not_in_menu=org.apache.jmeter.timers.BSFTimer,org.apache.jmeter.modifiers.BSFPreProcessor,\ + org.apache.jmeter.extractor.BSFPostProcessor,org.apache.jmeter.assertions.BSFAssertion,\ + org.apache.jmeter.visualizers.BSFListener,org.apache.jmeter.protocol.java.sampler.BSFSampler # Number of items in undo history # Feature is disabled by default (0) due to known and not fixed bugs: diff --git a/bin/saveservice.properties b/bin/saveservice.properties index 4f861db..558e7e0 100644 --- a/bin/saveservice.properties +++ b/bin/saveservice.properties @@ -240,10 +240,13 @@ MD5HexAssertion=org.apache.jmeter.assertions.MD5HexAssertion MD5HexAssertionGUI=org.apache.jmeter.assertions.gui.MD5HexAssertionGUI ModuleController=org.apache.jmeter.control.ModuleController ModuleControllerGui=org.apache.jmeter.control.gui.ModuleControllerGui + +# removed in 5.2 MongoScriptSampler=org.apache.jmeter.protocol.mongodb.sampler.MongoScriptSampler +# removed in 5.2 MongoSourceElement=org.apache.jmeter.protocol.mongodb.config.MongoSourceElement -# removed in 3.2, class was deleted in r +# removed in 3.2 MonitorHealthVisualizer=org.apache.jmeter.visualizers.MonitorHealthVisualizer NamePanel=org.apache.jmeter.gui.NamePanel @@ -302,9 +305,9 @@ SMIMEAssertionGui=org.apache.jmeter.assertions.gui.SMIMEAssertionGui SmtpSampler=org.apache.jmeter.protocol.smtp.sampler.SmtpSampler SmtpSamplerGui=org.apache.jmeter.protocol.smtp.sampler.gui.SmtpSamplerGui -# removed in 3.2, class was deleted in r +# removed in 3.2, class was deleted in 3.2 SoapSampler=org.apache.jmeter.protocol.http.sampler.SoapSampler -# removed in 3.2, class was deleted in r +# removed in 3.2, class was deleted in 3.2 SoapSamplerGui=org.apache.jmeter.protocol.http.control.gui.SoapSamplerGui # removed in 3.1, class was deleted in r1763837 diff --git a/bin/templates/mongodb.jmx b/bin/templates/mongodb.jmx deleted file mode 100644 index bc52858..0000000 --- a/bin/templates/mongodb.jmx +++ /dev/null @@ -1,194 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<jmeterTestPlan version="1.2" properties="2.5" jmeter="2.10-SNAPSHOT.20130714"> - <hashTree> - <TestPlan guiclass="TestPlanGui" testclass="TestPlan" testname="MongoDB Test Plan" enabled="true"> - <stringProp name="TestPlan.comments">Shows how to setup a MongoDB Test</stringProp> - <boolProp name="TestPlan.functional_mode">false</boolProp> - <boolProp name="TestPlan.serialize_threadgroups">false</boolProp> - <elementProp name="TestPlan.user_defined_variables" elementType="Arguments" guiclass="ArgumentsPanel" testclass="Arguments" testname="User Defined Variables" enabled="true"> - <collectionProp name="Arguments.arguments"/> - </elementProp> - <stringProp name="TestPlan.user_define_classpath"></stringProp> - </TestPlan> - <hashTree> - <MongoSourceElement guiclass="TestBeanGUI" testclass="MongoSourceElement" testname="MongoDB Source Config" enabled="true"> - <stringProp name="connection">127.0.0.1</stringProp> - <stringProp name="source">db</stringProp> - <boolProp name="autoConnectRetry">false</boolProp> - <intProp name="connectionsPerHost">50</intProp> - <intProp name="connectTimeout">0</intProp> - <longProp name="maxAutoConnectRetryTime">0</longProp> - <intProp name="maxWaitTime">120000</intProp> - <intProp name="socketTimeout">0</intProp> - <boolProp name="socketKeepAlive">false</boolProp> - <intProp name="threadsAllowedToBlockForConnectionMultiplier">5</intProp> - <boolProp name="safe">false</boolProp> - <boolProp name="fsync">false</boolProp> - <boolProp name="waitForJournaling">false</boolProp> - <intProp name="writeOperationNumberOfServers">0</intProp> - <intProp name="writeOperationTimeout">0</intProp> - <boolProp name="continueOnInsertError">false</boolProp> - <stringProp name="TestPlan.comments">Configures connection to MongoDB</stringProp> - </MongoSourceElement> - <hashTree/> - <ThreadGroup guiclass="ThreadGroupGui" testclass="ThreadGroup" testname="Thread Group" enabled="true"> - <stringProp name="ThreadGroup.on_sample_error">continue</stringProp> - <elementProp name="ThreadGroup.main_controller" elementType="LoopController" guiclass="LoopControlPanel" testclass="LoopController" testname="Loop Controller" enabled="true"> - <boolProp name="LoopController.continue_forever">false</boolProp> - <intProp name="LoopController.loops">-1</intProp> - </elementProp> - <stringProp name="ThreadGroup.num_threads">1</stringProp> - <stringProp name="ThreadGroup.ramp_time">30</stringProp> - <longProp name="ThreadGroup.start_time">1367357168000</longProp> - <longProp name="ThreadGroup.end_time">1367357168000</longProp> - <boolProp name="ThreadGroup.scheduler">false</boolProp> - <stringProp name="ThreadGroup.duration">300</stringProp> - <stringProp name="ThreadGroup.delay">10</stringProp> - </ThreadGroup> - <hashTree> - <JSR223Sampler guiclass="TestBeanGUI" testclass="JSR223Sampler" testname="Insert into testCollection" enabled="true"> - <stringProp name="scriptLanguage">groovy</stringProp> - <stringProp name="parameters"></stringProp> - <stringProp name="filename"></stringProp> - <stringProp name="cacheKey">insert1</stringProp> - <stringProp name="script">import com.mongodb.DB; -import org.apache.jmeter.protocol.mongodb.config.MongoDBHolder; -import com.mongodb.WriteResult; -import com.mongodb.BasicDBObject; -import com.mongodb.DBCollection; -import com.mongodb.WriteConcern; -import com.mongodb.WriteResult; - -// Get DB -com.mongodb.DB db = org.apache.jmeter.protocol.mongodb.config.MongoDBHolder.getDBFromSource("db", "test"); - -// Get collection to insert -DBCollection coll = db.getCollection("testCollection"); -BasicDBObject doc = new BasicDBObject("name", "MongoDB"). - append("type", "database"). - append("count", 1). - append("info", new BasicDBObject("x", 203).append("y", 102)); - -// Insert object -WriteResult wr = coll.insert(doc, WriteConcern.ACKNOWLEDGED); - -// Set response data -SampleResult.setResponseData(""+wr.toString(),"UTF-8");</stringProp> - </JSR223Sampler> - <hashTree> - <ResponseAssertion guiclass="AssertionGui" testclass="ResponseAssertion" testname="Response Assertion" enabled="true"> - <collectionProp name="Asserion.test_strings"> - <stringProp name="-1358912096">"err" : null</stringProp> - </collectionProp> - <stringProp name="Assertion.test_field">Assertion.response_data</stringProp> - <boolProp name="Assertion.assume_success">false</boolProp> - <intProp name="Assertion.test_type">2</intProp> - </ResponseAssertion> - <hashTree/> - </hashTree> - <JSR223Sampler guiclass="TestBeanGUI" testclass="JSR223Sampler" testname="Count from testCollection" enabled="true"> - <stringProp name="scriptLanguage">groovy</stringProp> - <stringProp name="parameters"></stringProp> - <stringProp name="filename"></stringProp> - <stringProp name="cacheKey">count1</stringProp> - <stringProp name="script">import com.mongodb.DB; -import org.apache.jmeter.protocol.mongodb.config.MongoDBHolder; -import com.mongodb.BasicDBObject; -import com.mongodb.DBObject; -import com.mongodb.DBCollection; - -DB db = MongoDBHolder.getDBFromSource("db", "test"); - -DBCollection coll = db.getCollection("testCollection"); -int size = coll.count(); -SampleResult.setResponseData(""+size,"UTF-8");</stringProp> - </JSR223Sampler> - <hashTree> - <ResponseAssertion guiclass="AssertionGui" testclass="ResponseAssertion" testname="Response Assertion" enabled="true"> - <collectionProp name="Asserion.test_strings"> - <stringProp name="91555">\d+</stringProp> - </collectionProp> - <stringProp name="Assertion.test_field">Assertion.response_data</stringProp> - <boolProp name="Assertion.assume_success">false</boolProp> - <intProp name="Assertion.test_type">1</intProp> - </ResponseAssertion> - <hashTree/> - </hashTree> - </hashTree> - <ResultCollector guiclass="ViewResultsFullVisualizer" testclass="ResultCollector" testname="View Results Tree" enabled="false"> - <boolProp name="ResultCollector.error_logging">false</boolProp> - <objProp> - <name>saveConfig</name> - <value class="SampleSaveConfiguration"> - <time>true</time> - <latency>true</latency> - <timestamp>true</timestamp> - <success>true</success> - <label>true</label> - <code>true</code> - <message>true</message> - <threadName>true</threadName> - <dataType>false</dataType> - <encoding>false</encoding> - <assertions>true</assertions> - <subresults>false</subresults> - <responseData>false</responseData> - <samplerData>false</samplerData> - <xml>false</xml> - <fieldNames>true</fieldNames> - <responseHeaders>false</responseHeaders> - <requestHeaders>false</requestHeaders> - <responseDataOnError>true</responseDataOnError> - <saveAssertionResultsFailureMessage>true</saveAssertionResultsFailureMessage> - <assertionsResultsToSave>0</assertionsResultsToSave> - <bytes>true</bytes> - <hostname>true</hostname> - <threadCounts>true</threadCounts> - <sampleCount>true</sampleCount> - </value> - </objProp> - <stringProp name="filename"></stringProp> - <stringProp name="TestPlan.comments">Remove for Load Test</stringProp> - </ResultCollector> - <hashTree/> - <ResultCollector guiclass="StatVisualizer" testclass="ResultCollector" testname="Aggregate Report" enabled="true"> - <boolProp name="ResultCollector.error_logging">false</boolProp> - <objProp> - <name>saveConfig</name> - <value class="SampleSaveConfiguration"> - <time>true</time> - <latency>true</latency> - <timestamp>true</timestamp> - <success>true</success> - <label>true</label> - <code>true</code> - <message>true</message> - <threadName>true</threadName> - <dataType>false</dataType> - <encoding>false</encoding> - <assertions>true</assertions> - <subresults>false</subresults> - <responseData>false</responseData> - <samplerData>false</samplerData> - <xml>false</xml> - <fieldNames>true</fieldNames> - <responseHeaders>false</responseHeaders> - <requestHeaders>false</requestHeaders> - <responseDataOnError>true</responseDataOnError> - <saveAssertionResultsFailureMessage>true</saveAssertionResultsFailureMessage> - <assertionsResultsToSave>0</assertionsResultsToSave> - <bytes>true</bytes> - <hostname>true</hostname> - <threadCounts>true</threadCounts> - <sampleCount>true</sampleCount> - </value> - </objProp> - <stringProp name="filename"></stringProp> - <stringProp name="TestPlan.comments">Remove for Load Test</stringProp> - </ResultCollector> - <hashTree/> - <Summariser guiclass="SummariserGui" testclass="Summariser" testname="Generate Summary Results" enabled="true"/> - <hashTree/> - </hashTree> - </hashTree> -</jmeterTestPlan> diff --git a/bin/templates/templates.xml b/bin/templates/templates.xml index 8767286..daaf9e9 100644 --- a/bin/templates/templates.xml +++ b/bin/templates/templates.xml @@ -120,29 +120,6 @@ ]]></description> </template> <template isTestPlan="true"> - <name>MongoDB Load Test</name> - <fileName>mongodb.jmx</fileName> - <description> - <![CDATA[<h1>Template showing how to Load Test MongoDB code using MongoDB Java Driver</h1> - <h2>JMeter Configuration</h2> - <ul> - <li>Configure the <b>Server address list</b>, and tune <b>MongoDB options</b> in MongoDB Source Config</li> - <li>Modify the JSR223 samples (<b>Insert into testCollection</b> and <b>Count from testCollection</b>) to match your needs</li> - </ul> - <h2>Mongo Java Driver</h2> - <p> - MongoDB Source Config configures the connection to MongoDB for you and stores in <b>MongoDB Source</b> the configuration.<br/> - You can then access it in any Scripting element using:<br/> - <i>com.mongodb.DB db = org.apache.jmeter.protocol.mongodb.config.MongoDBHolder.getDBFromSource("db", "test");<i> - </p> - <h2>Useful links</h2> - <ul> - <li><a href="http://docs.mongodb.org/ecosystem/tutorial/getting-started-with-java-driver/#getting-started-with-java-driver" >Getting Started with Java Driver (<i>Making a connection</i> part is already done by MongoDB Source Config)</a></li> - <li><a href="http://jmeter.apache.org/usermanual/component_reference.html#MongoDB_Source_Config" >http://jmeter.apache.org/usermanual/component_reference.html#MongoDB_Source_Config</a></li> - </ul> - ]]></description> - </template> - <template isTestPlan="true"> <name>Building a Web Test Plan</name> <fileName>/bin/templates/build-web-test-plan.jmx</fileName> <description><![CDATA[ diff --git a/checksum.xml b/checksum.xml index 65ca9a2..0aea692 100644 --- a/checksum.xml +++ b/checksum.xml @@ -117,7 +117,6 @@ <trusted-key id='85911f425ec61b51' group='org.junit.jupiter' /> <trusted-key id='85911f425ec61b51' group='org.junit.platform' /> <trusted-key id='85911f425ec61b51' group='org.junit.vintage' /> - <trusted-key id='82216a03caa86c78' group='org.mongodb' /> <trusted-key id='3f36885c24df4b75' group='org.mozilla' /> <trusted-key id='7ad289796be2ffe2' group='org.neo4j.driver' /> <trusted-key id='7c7d8456294423ba' group='org.objenesis' /> diff --git a/gradle.properties b/gradle.properties index 2107116..a8df190 100644 --- a/gradle.properties +++ b/gradle.properties @@ -84,7 +84,6 @@ junit5.version=5.5.1 log4j.version=2.12.1 mail.version=1.5.0-b01 mina-core.version=2.0.19 -mongo-java-driver.version=2.11.3 neo4j-java-driver.version=1.7.5 objenesis.version=2.6 oro.version=2.0.8 diff --git a/lib/aareadme.txt b/lib/aareadme.txt index 0235b29..31cd81d 100644 --- a/lib/aareadme.txt +++ b/lib/aareadme.txt @@ -222,11 +222,6 @@ http://hc.apache.org/ - httpclient 4 implementation for HTTP sampler - httpasyncclient implementation for InfluxDB Backend Listener Client -mongo-java-driver 2.11.3 ------------------------- -http://www.mongodb.org/ -- MongoDB sampler - oro-2.0.8 --------- http://jakarta.apache.org/site/downloads/downloads_oro.cgi diff --git a/settings.gradle.kts b/settings.gradle.kts index 9b65857..ac19068 100644 --- a/settings.gradle.kts +++ b/settings.gradle.kts @@ -42,7 +42,6 @@ include( "src:protocol:junit-sample", "src:protocol:ldap", "src:protocol:mail", - "src:protocol:mongodb", "src:protocol:native", "src:protocol:tcp", "src:release", diff --git a/src/bom/build.gradle.kts b/src/bom/build.gradle.kts index cdcec48..681a548 100644 --- a/src/bom/build.gradle.kts +++ b/src/bom/build.gradle.kts @@ -134,7 +134,6 @@ dependencies { apiv("org.jodd:jodd-log", "jodd") apiv("org.jodd:jodd-props", "jodd") apiv("org.jsoup:jsoup") - apiv("org.mongodb:mongo-java-driver") apiv("org.mozilla:rhino") apiv("org.neo4j.driver:neo4j-java-driver") apiv("org.objenesis:objenesis") diff --git a/src/core/src/main/java/org/apache/jmeter/save/SaveService.java b/src/core/src/main/java/org/apache/jmeter/save/SaveService.java index 25d6354..855f372 100644 --- a/src/core/src/main/java/org/apache/jmeter/save/SaveService.java +++ b/src/core/src/main/java/org/apache/jmeter/save/SaveService.java @@ -156,7 +156,7 @@ public class SaveService { private static String fileVersion = ""; // computed from saveservice.properties file// $NON-NLS-1$ // Must match the sha1 checksum of the file saveservice.properties (without newline character), // used to ensure saveservice.properties and SaveService are updated simultaneously - static final String FILEVERSION = "6fd03656cf4997fe6b0af17fa8dc8469e563c93a"; // Expected value $NON-NLS-1$ + static final String FILEVERSION = "9756ae2eaf1834b0d5c400c0b6ecae997569697e"; // Expected value $NON-NLS-1$ private static String fileEncoding = ""; // read from properties file// $NON-NLS-1$ @@ -386,8 +386,8 @@ public class SaveService { try { Class.forName(name, false, classLoader); } catch (ClassNotFoundException e) { - log.error("Unexpected entry in saveservice.properties; class does not exist and is not upgraded: {}", name); - missingClasses.add(name); + log.error("Unexpected entry in saveservice.properties; class does not exist and is not upgraded: {}", name); + missingClasses.add(name); } } } diff --git a/src/dist/build.gradle.kts b/src/dist/build.gradle.kts index cb1e6a3..233d6c7 100644 --- a/src/dist/build.gradle.kts +++ b/src/dist/build.gradle.kts @@ -46,7 +46,6 @@ var jars = arrayOf( ":src:protocol:junit", ":src:protocol:ldap", ":src:protocol:mail", - ":src:protocol:mongodb", ":src:protocol:native", ":src:protocol:tcp") diff --git a/src/protocol/build.gradle.kts b/src/protocol/build.gradle.kts index 959d26d..2ab473e 100644 --- a/src/protocol/build.gradle.kts +++ b/src/protocol/build.gradle.kts @@ -178,15 +178,6 @@ project("mail") { } } -project("mongodb") { - dependencies { - api("org.mongodb:mongo-java-driver:2.11.3") - implementation("org.apache.commons:commons-lang3") { - because("StringUtils") - } - } -} - project("native") { dependencies { implementation("org.apache.commons:commons-lang3") { diff --git a/src/protocol/mongodb/src/main/java/org/apache/jmeter/protocol/mongodb/config/MongoDBHolder.java b/src/protocol/mongodb/src/main/java/org/apache/jmeter/protocol/mongodb/config/MongoDBHolder.java deleted file mode 100644 index 11f7e9d..0000000 --- a/src/protocol/mongodb/src/main/java/org/apache/jmeter/protocol/mongodb/config/MongoDBHolder.java +++ /dev/null @@ -1,56 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - */ - -package org.apache.jmeter.protocol.mongodb.config; - -import org.apache.jmeter.protocol.mongodb.mongo.MongoDB; -import org.apache.jmeter.threads.JMeterContextService; - -import com.mongodb.DB; - -/** - * Public API to access MongoDB {@link DB} object created by {@link MongoSourceElement} - */ -public final class MongoDBHolder { - - /** - * Get access to MongoDB object - * @param varName String MongoDB source - * @param dbName Mongo DB database name - * @return {@link DB} - */ - public static DB getDBFromSource(String varName, String dbName) { - return getDBFromSource(varName, dbName, null, null); - } - - /** - * Get access to MongoDB object - * @param varName String MongoDB source - * @param dbName Mongo DB database name - * @param login name to use for login - * @param password password to use for login - * @return {@link DB} - */ - public static DB getDBFromSource(String varName, String dbName, String login, String password) { - MongoDB mongodb = (MongoDB) JMeterContextService.getContext().getVariables().getObject(varName); - if(mongodb==null) { - throw new IllegalStateException("You didn't define variable:"+varName +" using MongoDB Source Config (property:MongoDB Source)"); - } - return mongodb.getDB(dbName, login, password); - } -} diff --git a/src/protocol/mongodb/src/main/java/org/apache/jmeter/protocol/mongodb/config/MongoSourceElement.java b/src/protocol/mongodb/src/main/java/org/apache/jmeter/protocol/mongodb/config/MongoSourceElement.java deleted file mode 100644 index 3b0d334..0000000 --- a/src/protocol/mongodb/src/main/java/org/apache/jmeter/protocol/mongodb/config/MongoSourceElement.java +++ /dev/null @@ -1,376 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - */ - -package org.apache.jmeter.protocol.mongodb.config; - -import java.net.UnknownHostException; - -import org.apache.jmeter.config.ConfigElement; -import org.apache.jmeter.config.ConfigTestElement; -import org.apache.jmeter.protocol.mongodb.mongo.MongoDB; -import org.apache.jmeter.protocol.mongodb.mongo.MongoUtils; -import org.apache.jmeter.testbeans.TestBean; -import org.apache.jmeter.testelement.TestStateListener; -import org.apache.jmeter.threads.JMeterContextService; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -import com.mongodb.MongoClientOptions; -import com.mongodb.WriteConcern; - -/** - */ -public class MongoSourceElement - extends ConfigTestElement - implements TestStateListener, TestBean { - - /** - * - */ - private static final long serialVersionUID = 2100L; - - private static final Logger log = LoggerFactory.getLogger(MongoSourceElement.class); - - private String connection; - private String source; - private boolean autoConnectRetry; - private int connectionsPerHost; - private int connectTimeout; - private long maxAutoConnectRetryTime; - private int maxWaitTime; - private int socketTimeout; - private boolean socketKeepAlive; - private int threadsAllowedToBlockForConnectionMultiplier; - private boolean fsync; - private boolean safe; - private boolean waitForJournaling; - private int writeOperationNumberOfServers; - private int writeOperationTimeout; - private boolean continueOnInsertError; - - public String getTitle() { - return this.getName(); - } - - public String getConnection() { - return connection; - } - - public void setConnection(String connection) { - this.connection = connection; - } - - public String getSource() { - return source; - } - - public void setSource(String source) { - this.source = source; - } - - public static MongoDB getMongoDB(String source) { - - Object mongoSource = JMeterContextService.getContext().getVariables().getObject(source); - - if(mongoSource == null) { - throw new IllegalStateException("mongoSource is null"); - } else { - if(mongoSource instanceof MongoDB) { - return (MongoDB)mongoSource; - } else { - throw new IllegalStateException("Variable:"+ source +" is not a MongoDB instance, class:"+mongoSource.getClass()); - } - } - } - - @Override - public void addConfigElement(ConfigElement configElement) { - } - - @Override - public boolean expectsModification() { - return false; - } - - @Override - public void testStarted() { - if(log.isDebugEnabled()) { - log.debug(getTitle() + " testStarted"); - } - - MongoClientOptions.Builder builder = MongoClientOptions.builder() - .autoConnectRetry(getAutoConnectRetry()) - .connectTimeout(getConnectTimeout()) - .connectionsPerHost(getConnectionsPerHost()) - .maxAutoConnectRetryTime(getMaxAutoConnectRetryTime()) - .maxWaitTime(getMaxWaitTime()) - .socketKeepAlive(getSocketKeepAlive()) - .socketTimeout(getSocketTimeout()) - .threadsAllowedToBlockForConnectionMultiplier( - getThreadsAllowedToBlockForConnectionMultiplier()); - - if(getSafe()) { - builder.writeConcern(WriteConcern.SAFE); - } else { - builder.writeConcern(new WriteConcern( - getWriteOperationNumberOfServers(), - getWriteOperationTimeout(), - getFsync(), - getWaitForJournaling(), - getContinueOnInsertError() - )); - } - MongoClientOptions mongoOptions = builder.build(); - - if(log.isDebugEnabled()) { - log.debug("options : " + mongoOptions.toString()); - } - - if(getThreadContext().getVariables().getObject(getSource()) != null) { - if(log.isWarnEnabled()) { - log.warn(getSource() + " has already been defined."); - } - } - else { - if(log.isDebugEnabled()) { - log.debug(getSource() + " is being defined."); - } - try { - getThreadContext().getVariables().putObject( - getSource(), new MongoDB(MongoUtils.toServerAddresses(getConnection()), mongoOptions)); - } catch (UnknownHostException e) { - throw new IllegalStateException(e); - } - } - } - - @Override - public void testStarted(String s) { - testStarted(); - } - - @Override - public void testEnded() { - if(log.isDebugEnabled()) { - log.debug(getTitle() + " testEnded"); - } - ((MongoDB)getThreadContext().getVariables().getObject(getSource())).clear(); - } - - @Override - public void testEnded(String s) { - testEnded(); - } - - /** - * @return the autoConnectRetry - */ - public boolean getAutoConnectRetry() { - return autoConnectRetry; - } - - /** - * @param autoConnectRetry the autoConnectRetry to set - */ - public void setAutoConnectRetry(boolean autoConnectRetry) { - this.autoConnectRetry = autoConnectRetry; - } - - /** - * @return the connectionsPerHost - */ - public int getConnectionsPerHost() { - return connectionsPerHost; - } - - /** - * @param connectionsPerHost the connectionsPerHost to set - */ - public void setConnectionsPerHost(int connectionsPerHost) { - this.connectionsPerHost = connectionsPerHost; - } - - /** - * @return the connectTimeout - */ - public int getConnectTimeout() { - return connectTimeout; - } - - /** - * @param connectTimeout the connectTimeout to set - */ - public void setConnectTimeout(int connectTimeout) { - this.connectTimeout = connectTimeout; - } - - /** - * @return the maxAutoConnectRetryTime - */ - public long getMaxAutoConnectRetryTime() { - return maxAutoConnectRetryTime; - } - - /** - * @param maxAutoConnectRetryTime the maxAutoConnectRetryTime to set - */ - public void setMaxAutoConnectRetryTime(long maxAutoConnectRetryTime) { - this.maxAutoConnectRetryTime = maxAutoConnectRetryTime; - } - - /** - * @return the maxWaitTime - */ - public int getMaxWaitTime() { - return maxWaitTime; - } - - /** - * @param maxWaitTime the maxWaitTime to set - */ - public void setMaxWaitTime(int maxWaitTime) { - this.maxWaitTime = maxWaitTime; - } - - /** - * @return the socketTimeout - */ - public int getSocketTimeout() { - return socketTimeout; - } - - /** - * @param socketTimeout the socketTimeout to set - */ - public void setSocketTimeout(int socketTimeout) { - this.socketTimeout = socketTimeout; - } - - /** - * @return the socketKeepAlive - */ - public boolean getSocketKeepAlive() { - return socketKeepAlive; - } - - /** - * @param socketKeepAlive the socketKeepAlive to set - */ - public void setSocketKeepAlive(boolean socketKeepAlive) { - this.socketKeepAlive = socketKeepAlive; - } - - /** - * @return the threadsAllowedToBlockForConnectionMultiplier - */ - public int getThreadsAllowedToBlockForConnectionMultiplier() { - return threadsAllowedToBlockForConnectionMultiplier; - } - - /** - * @param threadsAllowedToBlockForConnectionMultiplier the threadsAllowedToBlockForConnectionMultiplier to set - */ - public void setThreadsAllowedToBlockForConnectionMultiplier( - int threadsAllowedToBlockForConnectionMultiplier) { - this.threadsAllowedToBlockForConnectionMultiplier = threadsAllowedToBlockForConnectionMultiplier; - } - - /** - * @return the fsync - */ - public boolean getFsync() { - return fsync; - } - - /** - * @param fsync the fsync to set - */ - public void setFsync(boolean fsync) { - this.fsync = fsync; - } - - /** - * @return the safe - */ - public boolean getSafe() { - return safe; - } - - /** - * @param safe the safe to set - */ - public void setSafe(boolean safe) { - this.safe = safe; - } - - /** - * @return the waitForJournaling - */ - public boolean getWaitForJournaling() { - return waitForJournaling; - } - - /** - * @param waitForJournaling the waitForJournaling to set - */ - public void setWaitForJournaling(boolean waitForJournaling) { - this.waitForJournaling = waitForJournaling; - } - - /** - * @return the writeOperationNumberOfServers - */ - public int getWriteOperationNumberOfServers() { - return writeOperationNumberOfServers; - } - - /** - * @param writeOperationNumberOfServers the writeOperationNumberOfServers to set - */ - public void setWriteOperationNumberOfServers(int writeOperationNumberOfServers) { - this.writeOperationNumberOfServers = writeOperationNumberOfServers; - } - - /** - * @return the writeOperationTimeout - */ - public int getWriteOperationTimeout() { - return writeOperationTimeout; - } - - /** - * @param writeOperationTimeout the writeOperationTimeout to set - */ - public void setWriteOperationTimeout(int writeOperationTimeout) { - this.writeOperationTimeout = writeOperationTimeout; - } - - /** - * @return the continueOnInsertError - */ - public boolean getContinueOnInsertError() { - return continueOnInsertError; - } - - /** - * @param continueOnInsertError the continueOnInsertError to set - */ - public void setContinueOnInsertError(boolean continueOnInsertError) { - this.continueOnInsertError = continueOnInsertError; - } -} diff --git a/src/protocol/mongodb/src/main/java/org/apache/jmeter/protocol/mongodb/config/MongoSourceElementBeanInfo.java b/src/protocol/mongodb/src/main/java/org/apache/jmeter/protocol/mongodb/config/MongoSourceElementBeanInfo.java deleted file mode 100644 index 7c01d03..0000000 --- a/src/protocol/mongodb/src/main/java/org/apache/jmeter/protocol/mongodb/config/MongoSourceElementBeanInfo.java +++ /dev/null @@ -1,118 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - */ - -package org.apache.jmeter.protocol.mongodb.config; - -import java.beans.PropertyDescriptor; - -import org.apache.jmeter.testbeans.BeanInfoSupport; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -public class MongoSourceElementBeanInfo - extends BeanInfoSupport { - - private static final Logger log = LoggerFactory.getLogger(MongoSourceElementBeanInfo.class); - - public MongoSourceElementBeanInfo() { - super(MongoSourceElement.class); - - //http://api.mongodb.org/java/2.7.2/com/mongodb/Mongo.html - createPropertyGroup("mongodb", new String[] { - "connection", - "source"}); - - //http://api.mongodb.org/java/2.7.2/com/mongodb/MongoOptions.html/ - createPropertyGroup("options", new String[]{ - "autoConnectRetry", - "connectionsPerHost", - "connectTimeout", - "maxAutoConnectRetryTime", - "maxWaitTime", - "socketTimeout", - "socketKeepAlive", - "threadsAllowedToBlockForConnectionMultiplier"}); - - //http://api.mongodb.org/java/2.7.2/com/mongodb/MongoOptions.html/ - createPropertyGroup("writeConcern", new String[] { - "safe", - "fsync", - "waitForJournaling", - "writeOperationNumberOfServers", - "writeOperationTimeout", - "continueOnInsertError"}); - - PropertyDescriptor p = property("connection"); - p.setValue(NOT_UNDEFINED, Boolean.TRUE); - p.setValue(DEFAULT, ""); - p = property("source"); - p.setValue(NOT_UNDEFINED, Boolean.TRUE); - p.setValue(DEFAULT, ""); - - p = property("autoConnectRetry"); - p.setValue(NOT_UNDEFINED, Boolean.TRUE); - p.setValue(DEFAULT, Boolean.FALSE); - p = property("connectionsPerHost"); - p.setValue(NOT_UNDEFINED, Boolean.TRUE); - p.setValue(DEFAULT, Integer.valueOf(10)); - p = property("connectTimeout"); - p.setValue(NOT_UNDEFINED, Boolean.TRUE); - p.setValue(DEFAULT, Integer.valueOf(0)); - p = property("threadsAllowedToBlockForConnectionMultiplier"); - p.setValue(NOT_UNDEFINED, Boolean.TRUE); - p.setValue(DEFAULT, Integer.valueOf(5)); - p = property("maxAutoConnectRetryTime"); - p.setValue(NOT_UNDEFINED, Boolean.TRUE); - p.setValue(DEFAULT, Long.valueOf(0)); - p = property("maxWaitTime"); - p.setValue(NOT_UNDEFINED, Boolean.TRUE); - p.setValue(DEFAULT, Integer.valueOf(120000)); - p = property("socketTimeout"); - p.setValue(NOT_UNDEFINED, Boolean.TRUE); - p.setValue(DEFAULT, Integer.valueOf(0)); - p = property("socketKeepAlive"); - p.setValue(NOT_UNDEFINED, Boolean.TRUE); - p.setValue(DEFAULT, Boolean.FALSE); - - p = property("fsync"); - p.setValue(NOT_UNDEFINED, Boolean.TRUE); - p.setValue(DEFAULT, Boolean.FALSE); - p = property("safe"); - p.setValue(NOT_UNDEFINED, Boolean.TRUE); - p.setValue(DEFAULT, Boolean.FALSE); - p = property("waitForJournaling"); - p.setValue(NOT_UNDEFINED, Boolean.TRUE); - p.setValue(DEFAULT, Boolean.FALSE); - p = property("writeOperationNumberOfServers"); - p.setValue(NOT_UNDEFINED, Boolean.TRUE); - p.setValue(DEFAULT, Integer.valueOf(0)); - p = property("writeOperationTimeout"); - p.setValue(NOT_UNDEFINED, Boolean.TRUE); - p.setValue(DEFAULT, Integer.valueOf(0)); - p = property("continueOnInsertError"); - p.setValue(NOT_UNDEFINED, Boolean.TRUE); - p.setValue(DEFAULT, Boolean.FALSE); - - if(log.isDebugEnabled()) { - for (PropertyDescriptor pd : getPropertyDescriptors()) { - log.debug(pd.getName()); - log.debug(pd.getDisplayName()); - } - } - } -} diff --git a/src/protocol/mongodb/src/main/java/org/apache/jmeter/protocol/mongodb/mongo/EvalResultHandler.java b/src/protocol/mongodb/src/main/java/org/apache/jmeter/protocol/mongodb/mongo/EvalResultHandler.java deleted file mode 100644 index b9c5e82..0000000 --- a/src/protocol/mongodb/src/main/java/org/apache/jmeter/protocol/mongodb/mongo/EvalResultHandler.java +++ /dev/null @@ -1,67 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - */ - -package org.apache.jmeter.protocol.mongodb.mongo; - -import com.mongodb.DBObject; -import com.mongodb.util.JSON; - -/** - */ -public class EvalResultHandler { - - //This can lead to code smell, meh! Do we care - public String handle(Object o) { - if(o == null) { - return "ok"; - } - - if(o instanceof Double) { - return this.handle((Double)o); - } - else if(o instanceof Integer) { - return this.handle((Integer)o); - } - else if(o instanceof String) { - return this.handle((String)o); - } - else if(o instanceof DBObject) { - return this.handle((DBObject)o); - } - else { - return "return type not handled"; - } - } - - public String handle(Integer o) { - return o.toString(); - } - - public String handle(String o) { - return o; - } - - public String handle(Double o) { - return o.toString(); - } - - - public String handle(DBObject o) { - return JSON.serialize(o); - } -} diff --git a/src/protocol/mongodb/src/main/java/org/apache/jmeter/protocol/mongodb/mongo/MongoDB.java b/src/protocol/mongodb/src/main/java/org/apache/jmeter/protocol/mongodb/mongo/MongoDB.java deleted file mode 100644 index ec3008a..0000000 --- a/src/protocol/mongodb/src/main/java/org/apache/jmeter/protocol/mongodb/mongo/MongoDB.java +++ /dev/null @@ -1,75 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - */ - -package org.apache.jmeter.protocol.mongodb.mongo; - -import java.util.List; - -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -import com.mongodb.DB; -import com.mongodb.Mongo; -import com.mongodb.MongoClient; -import com.mongodb.MongoClientOptions; -import com.mongodb.ServerAddress; - -/** - */ -public class MongoDB { - - private static final Logger log = LoggerFactory.getLogger(MongoDB.class); - - // Mongo is Thread Safe - private Mongo mongo = null; - - public MongoDB( - List<ServerAddress> serverAddresses, - MongoClientOptions mongoOptions) { - mongo = new MongoClient(serverAddresses, mongoOptions); - } - - public DB getDB(String database, String username, String password) { - - if(log.isDebugEnabled()) { - log.debug("username: " + username+", password: " + password+", database: " + database); - } - DB db = mongo.getDB(database); - boolean authenticated = db.isAuthenticated(); - - if(!authenticated) { - if(username != null && password != null && username.length() > 0 && password.length() > 0) { - authenticated = db.authenticate(username, password.toCharArray()); - } - } - if(log.isDebugEnabled()) { - log.debug("authenticated: " + authenticated); - } - return db; - } - - public void clear() { - if(log.isDebugEnabled()) { - log.debug("clearing"); - } - - mongo.close(); - //there is no harm in trying to clear up - mongo = null; - } -} diff --git a/src/protocol/mongodb/src/main/java/org/apache/jmeter/protocol/mongodb/mongo/MongoUtils.java b/src/protocol/mongodb/src/main/java/org/apache/jmeter/protocol/mongodb/mongo/MongoUtils.java deleted file mode 100644 index 65003fd..0000000 --- a/src/protocol/mongodb/src/main/java/org/apache/jmeter/protocol/mongodb/mongo/MongoUtils.java +++ /dev/null @@ -1,51 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - */ - -package org.apache.jmeter.protocol.mongodb.mongo; - -import java.net.UnknownHostException; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.List; - -import org.apache.commons.lang3.StringUtils; - -import com.mongodb.ServerAddress; - -/** - */ -public class MongoUtils { - /** - * MongoDB default connection port - */ - public static final int DEFAULT_PORT = 27017; - - public static List<ServerAddress> toServerAddresses(String connections) throws UnknownHostException { - - List<ServerAddress> addresses = new ArrayList<>(); - for(String connection : Arrays.asList(connections.split(","))) { - int port = DEFAULT_PORT; - String[] hostPort = connection.split(":"); - if(hostPort.length > 1 && !StringUtils.isEmpty(hostPort[1])) { - port = Integer.parseInt(hostPort[1].trim()); - } - addresses.add(new ServerAddress(hostPort[0], port)); - } - return addresses; - } -} diff --git a/src/protocol/mongodb/src/main/java/org/apache/jmeter/protocol/mongodb/sampler/MongoScriptRunner.java b/src/protocol/mongodb/src/main/java/org/apache/jmeter/protocol/mongodb/sampler/MongoScriptRunner.java deleted file mode 100644 index 8bfd009..0000000 --- a/src/protocol/mongodb/src/main/java/org/apache/jmeter/protocol/mongodb/sampler/MongoScriptRunner.java +++ /dev/null @@ -1,69 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - */ - -package org.apache.jmeter.protocol.mongodb.sampler; - - -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -import com.mongodb.DB; - -/** - */ -public class MongoScriptRunner { - - private static final Logger log = LoggerFactory.getLogger(MongoScriptRunner.class); - - public MongoScriptRunner() { - super(); - } - - /** - * Evaluate a script on the database - * - * @param db - * database connection to use - * @param script - * script to evaluate on the database - * @return result of evaluation on the database - * @throws Exception - * when evaluation on the database fails - */ - public Object evaluate(DB db, String script) - throws Exception { - - if(log.isDebugEnabled()) { - log.debug("database: " + db.getName()+", script: " + script); - } - - db.requestStart(); - try { - db.requestEnsureConnection(); - - Object result = db.eval(script); - - if(log.isDebugEnabled()) { - log.debug("Result : " + result); - } - return result; - } finally { - db.requestDone(); - } - } -} diff --git a/src/protocol/mongodb/src/main/java/org/apache/jmeter/protocol/mongodb/sampler/MongoScriptSampler.java b/src/protocol/mongodb/src/main/java/org/apache/jmeter/protocol/mongodb/sampler/MongoScriptSampler.java deleted file mode 100644 index 924c917..0000000 --- a/src/protocol/mongodb/src/main/java/org/apache/jmeter/protocol/mongodb/sampler/MongoScriptSampler.java +++ /dev/null @@ -1,144 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - */ - -package org.apache.jmeter.protocol.mongodb.sampler; - -import org.apache.jmeter.protocol.mongodb.config.MongoSourceElement; -import org.apache.jmeter.protocol.mongodb.mongo.EvalResultHandler; -import org.apache.jmeter.protocol.mongodb.mongo.MongoDB; -import org.apache.jmeter.samplers.AbstractSampler; -import org.apache.jmeter.samplers.Entry; -import org.apache.jmeter.samplers.SampleResult; -import org.apache.jmeter.testbeans.TestBean; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -import com.mongodb.DB; - -/** - */ -public class MongoScriptSampler - extends AbstractSampler - implements TestBean { - - private static final long serialVersionUID = -7789012234636439896L; - - private static final Logger log = LoggerFactory.getLogger(MongoScriptSampler.class); - - public final static String SOURCE = "MongoScriptSampler.source"; //$NON-NLS-1$ - - public final static String DATABASE = "MongoScriptSampler.database"; //$NON-NLS-1$ - public final static String USERNAME = "MongoScriptSampler.username"; //$NON-NLS-1$ - public final static String PASSWORD = "MongoScriptSampler.password"; //$NON-NLS-1$ NOSONAR It's not a password - public final static String SCRIPT = "MongoScriptSampler.script"; //$NON-NLS-1$ - - - public MongoScriptSampler() { - trace("MongoScriptSampler()"); - } - - @Override - public SampleResult sample(Entry e) { - trace("sample()"); - - SampleResult res = new SampleResult(); - String data = getScript(); - - res.setSampleLabel(getTitle()); - res.setResponseCodeOK(); - res.setResponseCode("200"); // $NON-NLS-1$ - res.setSuccessful(true); - res.setResponseMessageOK(); - res.setSamplerData(data); - res.setDataType(SampleResult.TEXT); - res.setContentType("text/plain"); // $NON-NLS-1$ - res.sampleStart(); - - try { - MongoDB mongoDB = MongoSourceElement.getMongoDB(getSource()); - MongoScriptRunner runner = new MongoScriptRunner(); - DB db = mongoDB.getDB(getDatabase(), getUsername(), getPassword()); - res.latencyEnd(); - Object result = runner.evaluate(db, data); - EvalResultHandler handler = new EvalResultHandler(); - String resultAsString = handler.handle(result); - res.setResponseData(resultAsString.getBytes()); - } catch (Exception ex) { - res.setResponseCode("500"); // $NON-NLS-1$ - res.setSuccessful(false); - res.setResponseMessage(ex.toString()); - res.setResponseData(ex.getMessage().getBytes()); - } finally { - res.sampleEnd(); - } - return res; - } - - public String getTitle() { - return this.getName(); - } - - public String getScript() { - return getPropertyAsString(SCRIPT); - } - - public void setScript(String script) { - setProperty(SCRIPT, script); - } - - public String getDatabase() { - return getPropertyAsString(DATABASE); - } - - public void setDatabase(String database) { - setProperty(DATABASE, database); - } - - public String getUsername() { - return getPropertyAsString(USERNAME); - } - - public void setUsername(String username) { - setProperty(USERNAME, username); - } - - public String getPassword() { - return getPropertyAsString(PASSWORD); - } - - public void setPassword(String password) { - setProperty(PASSWORD, password); - } - - public String getSource() { - return getPropertyAsString(SOURCE); - } - - public void setSource(String source) { - setProperty(SOURCE, source); - } - - /* - * Helper - */ - private void trace(String s) { - if(log.isDebugEnabled()) { - log.debug(Thread.currentThread().getName() + " (" + getTitle() + " " + s + " " + this.toString()); - } - } -} diff --git a/src/protocol/mongodb/src/main/java/org/apache/jmeter/protocol/mongodb/sampler/MongoScriptSamplerBeanInfo.java b/src/protocol/mongodb/src/main/java/org/apache/jmeter/protocol/mongodb/sampler/MongoScriptSamplerBeanInfo.java deleted file mode 100644 index 3666dfb..0000000 --- a/src/protocol/mongodb/src/main/java/org/apache/jmeter/protocol/mongodb/sampler/MongoScriptSamplerBeanInfo.java +++ /dev/null @@ -1,74 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - */ - -package org.apache.jmeter.protocol.mongodb.sampler; - -import java.beans.PropertyDescriptor; - -import org.apache.jmeter.testbeans.BeanInfoSupport; -import org.apache.jmeter.testbeans.gui.TypeEditor; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -/** - */ -public class MongoScriptSamplerBeanInfo - extends BeanInfoSupport { - - private static final Logger log = LoggerFactory.getLogger(MongoScriptSamplerBeanInfo.class); - - public MongoScriptSamplerBeanInfo() { - super(MongoScriptSampler.class); - - //http://api.mongodb.org/java/2.7.2/com/mongodb/Mongo.html - createPropertyGroup("mongodb", new String[] { - "source", - "database", - "username", - "password" }); - - createPropertyGroup("sampler", new String[]{ - "script"}); - - PropertyDescriptor p = property("database"); - p.setValue(NOT_UNDEFINED, Boolean.TRUE); - p.setValue(DEFAULT, ""); - p = property("username"); - p.setValue(NOT_UNDEFINED, Boolean.TRUE); - p.setValue(DEFAULT, ""); - p = property("password", TypeEditor.PasswordEditor); - p.setValue(NOT_UNDEFINED, Boolean.TRUE); - p.setValue(DEFAULT, ""); - p = property("source"); - p.setValue(NOT_UNDEFINED, Boolean.TRUE); - p.setValue(DEFAULT, ""); - - p = property("script", TypeEditor.TextAreaEditor); - p.setValue(NOT_UNDEFINED, Boolean.FALSE); - p.setValue(DEFAULT, ""); - p.setValue(NOT_EXPRESSION, Boolean.TRUE); - p.setValue(TEXT_LANGUAGE, "javascript"); // $NON-NLS-1$ - - if(log.isDebugEnabled()) { - for (PropertyDescriptor pd : getPropertyDescriptors()) { - log.debug(pd.getName()); - log.debug(pd.getDisplayName()); - } - } - } -} diff --git a/src/protocol/mongodb/src/main/resources/org/apache/jmeter/protocol/mongodb/config/MongoSourceElementResources.properties b/src/protocol/mongodb/src/main/resources/org/apache/jmeter/protocol/mongodb/config/MongoSourceElementResources.properties deleted file mode 100644 index f203c28..0000000 --- a/src/protocol/mongodb/src/main/resources/org/apache/jmeter/protocol/mongodb/config/MongoSourceElementResources.properties +++ /dev/null @@ -1,55 +0,0 @@ -# Licensed to the Apache Software Foundation (ASF) under one or more -# contributor license agreements. See the NOTICE file distributed with -# this work for additional information regarding copyright ownership. -# The ASF licenses this file to You under the Apache License, Version 2.0 -# (the "License"); you may not use this file except in compliance with -# the License. You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -#Stored by I18NEdit, may be edited! -autoConnectRetry.displayName=Keep trying -autoConnectRetry.shortDescription=If true, the driver will keep trying to connect to the same server in case that the socket cannot be established.<br><br>There is maximum amount of time to keep retrying, which is 15s by default.<br><br>This can be useful to avoid some exceptions being thrown when a server is down temporarily by blocking the operations.<br><br>It also can be useful to smooth the transition to a new master (so that a new master is elected within the retry time).<br><br>No [...] -connectTimeout.displayName=Connection timeout -connectTimeout.shortDescription=The connection timeout in milliseconds.<br><br>It is used solely when establishing a new connection Socket.connect(java.net.SocketAddress, int)<br><br>Default is 0 and means no timeout. -connection.displayName=Server Address List -connection.shortDescription=Server Address List -connectionsPerHost.displayName=Maximum connections Per Host -connectionsPerHost.shortDescription=The maximum number of connections allowed per host for this Mongo instance.<br><br>Those connections will be kept in a pool when idle.<br><br>Once the pool is exhausted, any operation requiring a connection will block waiting for an available connection.<br><br>Default is 10. -continueOnInsertError.displayName=Continue on Error -continueOnInsertError.shortDescription=If batch inserts should continue after the first error -displayName=MongoDB Source Config (DEPRECATED) -fsync.displayName=Fsync -fsync.shortDescription=The fsync value of the global WriteConcern.<br><br>Default is false. -maxAutoConnectRetryTime.displayName=Maximum retry time -maxAutoConnectRetryTime.shortDescription=The maximum amount of time in MS to spend retrying to open connection to the same server.<br><br>Default is 0, which means to use the default 15s if autoConnectRetry is on. -maxWaitTime.displayName=Maximum wait time -maxWaitTime.shortDescription=The maximum wait time in ms that a thread may wait for a connection to become available.<br><br>Default is 120,000. -mongodb.displayName=MongoDB Connection -mongodb.shortDescription=Configure the connection -options.displayName=MongoDB Options -options.shortDescription=Various settings for the driver -safe.displayName=Safe -safe.shortDescription=If true the driver will use a WriteConcern of WriteConcern.SAFE for all operations.<br><br>If w, wtimeout, fsync or j are specified, this setting is ignored.<br><br>Default is false. -socketKeepAlive.displayName=Socket keep alive -socketKeepAlive.shortDescription=This flag controls the socket keep alive feature that keeps a connection alive through firewalls Socket.setKeepAlive(boolean)<br><br>Default is false. -socketTimeout.displayName=Socket timeout -socketTimeout.shortDescription=The socket timeout in milliseconds It is used for I/O socket read and write operations Socket.setSoTimeout(int)<br><br>Default is 0 and means no timeout. -source.displayName=MongoDB Source -source.shortDescription=Configure the Source -threadsAllowedToBlockForConnectionMultiplier.displayName=Block Multiplier -threadsAllowedToBlockForConnectionMultiplier.shortDescription=This multiplier, multiplied with the connectionsPerHost setting, gives the maximum number of threads that may be waiting for a connection to become available from the pool.<br><br>All further threads will get an exception right away.<br><br>For example if connectionsPerHost is 10 and threadsAllowedToBlockForConnectionMultiplier is 5, then up to 50 threads can wait for a connection.<br><br>Default is 5. -waitForJournaling.displayName=Wait for Journal -waitForJournaling.shortDescription=The j value of the global WriteConcern.<br><br>Default is false. -writeConcern.displayName=Write Concern Options -writeConcern.shortDescription=Various settings for the driver -writeOperationNumberOfServers.displayName=Wait for Servers -writeOperationNumberOfServers.shortDescription=The w value of the global WriteConcern.<br><br>Default is 0. -writeOperationTimeout.displayName=Wait Timeout -writeOperationTimeout.shortDescription=The wtimeout value of the global WriteConcern.<br><br>Default is 0. diff --git a/src/protocol/mongodb/src/main/resources/org/apache/jmeter/protocol/mongodb/config/MongoSourceElementResources_fr.properties b/src/protocol/mongodb/src/main/resources/org/apache/jmeter/protocol/mongodb/config/MongoSourceElementResources_fr.properties deleted file mode 100644 index 81b9065..0000000 --- a/src/protocol/mongodb/src/main/resources/org/apache/jmeter/protocol/mongodb/config/MongoSourceElementResources_fr.properties +++ /dev/null @@ -1,55 +0,0 @@ -# Licensed to the Apache Software Foundation (ASF) under one or more -# contributor license agreements. See the NOTICE file distributed with -# this work for additional information regarding copyright ownership. -# The ASF licenses this file to You under the Apache License, Version 2.0 -# (the "License"); you may not use this file except in compliance with -# the License. You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -#Stored by I18NEdit, may be edited! -autoConnectRetry.displayName=Essayer de garder la connexion -autoConnectRetry.shortDescription=Si positionné à True, le gestionnaire continuera d'essayer de se reconnecter au même serveur dans le cas où la connexion socket ne peut être établie. <br> Le délai d'attente maximum pour ressayer est de 15 sec par défaut.<br> <br>Cela peut être utile pour éviter certaines exceptions levées quand un serveur est arrêté temporairement, bloquant ainsi les opérations.<br>Il peut également être utile pour adoucir la transition vers un nouveau maître (de sorte [...] -connectTimeout.displayName=Delai d'expiration de connexion -connectTimeout.shortDescription=Le délai d'expiration de connexion, en millisecondes.<br> Il est utilisé uniquement lors de l'établissement d'une nouvelle connexion Socket.connect(java.net.SocketAddress, int)<br><br>La valeur par défaut est 0 et signifie aucun délai d'attente. -connection.displayName=Liste adresse serveur -connection.shortDescription=Liste adresse serveur -connectionsPerHost.displayName=Maximum de connexions par hôte -connectionsPerHost.shortDescription=Le nombre maximum de connexions autorisées par hôte for cette instance de Mongo.<br><br>Ces connexions seront gardées dans un pool quand elles seront disponibles.<br><br>Une fois que le pool est atteint, toute opération qui nécessite une connexion sera bloquée en attendant une connexion disponible.<br><br>La valeur par défaut est 10. -continueOnInsertError.displayName=Continuer en cas d'erreur -continueOnInsertError.shortDescription=Indique si les insertions en batch doivent se poursuivre après la première erreur -displayName=Gestionnaire de connexion MongoDB (DEPRECATED) -fsync.displayName=Fsync -fsync.shortDescription=Valeur Fsync pour l'élément global WriteConcern.<br><br>La valeur par défaut est False. -maxAutoConnectRetryTime.displayName=Temps de re-tentative maximum -maxAutoConnectRetryTime.shortDescription=Le délai maximal de temps en milli-secondes pour tenter d'ouvrir une connexion au même serveur.<br><br>La valeur par défaut est 0, ce qui signifie que pour utiliser les 15 sec. par défaut si autoConnectRetry est activé. -maxWaitTime.displayName=Temps d'attente maximum -maxWaitTime.shortDescription=Le temps d'attente maximum in milli-secondes qu'une unité d'exécution peut attendre pour qu'une connexion devienne disponible.<br><br>La valeur par défaut est 120000. -mongodb.displayName=Connexion MongoDB -mongodb.shortDescription=Configurer la connexion -options.displayName=Options MongoDB -options.shortDescription=Divers paramètres pour le gestionnaire -safe.displayName=Sûreté (Safe) -safe.shortDescription=Si positionné à True, le gestionnaire utilisera un WriteConcern de WriteConcern.SAFE pour toutes les opérations.<br><br>Si w, wtimeout, fsync or j sont spécifiés, ce paramètre est ignoré.<br><br>La valeur par défaut est False. -socketKeepAlive.displayName=Socket persistante -socketKeepAlive.shortDescription=Cet indicateur contrôle la fonctionnalité de garder la socket persistante à travers un pare-feu Socket.setKeepAlive(boolean)<br><br>La valeur par défaut est false. -socketTimeout.displayName=Délai d'expiration Socket -socketTimeout.shortDescription=Le délai d'expiration de Socket en milli-secondes. Il est utilisé pour en E/S de socket pour les opérations de lecture et écriture Socket.setSoTimeout(int)<br><br>La valeur par défaut est 0 et signifie \: pas de délai. -source.displayName=Source MongoDB -source.shortDescription=Configurer la source -threadsAllowedToBlockForConnectionMultiplier.displayName=Multiplicateur de blocage -threadsAllowedToBlockForConnectionMultiplier.shortDescription=Ce multiplicateur, multiplié avec le paramètre connectionsPerHost, donne le nombre maximal d'unités qui peuvent être en attente qu'une connexion se libère du pool.<br>Au délà une exception sera levée immédiatement.<br><br>Par exemple, si connectionsPerHost est de 10 et threadsAllowedToBlockForConnectionMultiplier est de 5, Alors jusqu'à 50 threads peuvent attendre une connexion.<br>La valeur par défaut est 5. -waitForJournaling.displayName=Attente du Journal -waitForJournaling.shortDescription=La valeur j pour l'élément global WriteConcern.<br><br>La valeur par défaut est False. -writeConcern.displayName=Options Write Concern -writeConcern.shortDescription=Divers paramètres pour le gestionnaire -writeOperationNumberOfServers.displayName=Attente des serveurs -writeOperationNumberOfServers.shortDescription=La valeur w pour l'élément global WriteConcern.<br><br>La valeur par défaut est 0. -writeOperationTimeout.displayName=Délai d'attente -writeOperationTimeout.shortDescription=La valeur wtimeout pour l'élément global WriteConcern.<br><br>La valeur par défaut est 0. diff --git a/src/protocol/mongodb/src/main/resources/org/apache/jmeter/protocol/mongodb/sampler/MongoScriptSamplerResources.properties b/src/protocol/mongodb/src/main/resources/org/apache/jmeter/protocol/mongodb/sampler/MongoScriptSamplerResources.properties deleted file mode 100644 index e41c0eb..0000000 --- a/src/protocol/mongodb/src/main/resources/org/apache/jmeter/protocol/mongodb/sampler/MongoScriptSamplerResources.properties +++ /dev/null @@ -1,27 +0,0 @@ -# Licensed to the Apache Software Foundation (ASF) under one or more -# contributor license agreements. See the NOTICE file distributed with -# this work for additional information regarding copyright ownership. -# The ASF licenses this file to You under the Apache License, Version 2.0 -# (the "License"); you may not use this file except in compliance with -# the License. You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -#Stored by I18NEdit, may be edited! -database.displayName=Database Name -displayName=MongoDB Script (DEPRECATED) -mongodb.displayName=MongoDB Connection -mongodb.shortDescription=Configure the connection -password.displayName=Password -sampler.displayName=Script -script.displayName=The script to run -script.shortDescription=Add your mongo shell script as you would via the mongo shell. -source.displayName=MongoDB Source -source.shortDescription=Configure the Source -username.displayName=Username diff --git a/src/protocol/mongodb/src/main/resources/org/apache/jmeter/protocol/mongodb/sampler/MongoScriptSamplerResources_fr.properties b/src/protocol/mongodb/src/main/resources/org/apache/jmeter/protocol/mongodb/sampler/MongoScriptSamplerResources_fr.properties deleted file mode 100644 index 6ea8a53..0000000 --- a/src/protocol/mongodb/src/main/resources/org/apache/jmeter/protocol/mongodb/sampler/MongoScriptSamplerResources_fr.properties +++ /dev/null @@ -1,27 +0,0 @@ -# Licensed to the Apache Software Foundation (ASF) under one or more -# contributor license agreements. See the NOTICE file distributed with -# this work for additional information regarding copyright ownership. -# The ASF licenses this file to You under the Apache License, Version 2.0 -# (the "License"); you may not use this file except in compliance with -# the License. You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -#Stored by I18NEdit, may be edited! -database.displayName=Nom base de données -displayName=Script MongoDB (DEPRECATED) -mongodb.displayName=Connexion MongoDB -mongodb.shortDescription=Configurer la connexion -password.displayName=Mot de passe -sampler.displayName=Script -script.displayName=Le script à exécuter -script.shortDescription=Ajouter votre script shell mongo comme vous le feriez dans le shell mongo. -source.displayName=Source MongoDB -source.shortDescription=Configurer la Source -username.displayName=Utilisateur diff --git a/src/protocol/mongodb/src/test/java/org/apache/jmeter/resources/ResourceKeyUsageTestMongodb.java b/src/protocol/mongodb/src/test/java/org/apache/jmeter/resources/ResourceKeyUsageTestMongodb.java deleted file mode 100644 index ad8a634..0000000 --- a/src/protocol/mongodb/src/test/java/org/apache/jmeter/resources/ResourceKeyUsageTestMongodb.java +++ /dev/null @@ -1,23 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - */ - -package org.apache.jmeter.resources; - -public class ResourceKeyUsageTestMongodb extends ResourceKeyUsageTest { - // Test from the base class is used, so we just validate current module -} diff --git a/xdocs/usermanual/component_reference.xml b/xdocs/usermanual/component_reference.xml index 5fa5c32..483c898 100644 --- a/xdocs/usermanual/component_reference.xml +++ b/xdocs/usermanual/component_reference.xml @@ -1886,42 +1886,8 @@ If the timeout expires before the command finishes, JMeter will attempt to kill </properties> </component> -<component name="MongoDB Script (DEPRECATED)" index="§-num;.1.21" width="847" height="635" screenshot="mongodb-script.png"> -<description><p>This sampler lets you send a Request to a MongoDB.</p> -<p>Before using this you need to set up a -<complink name="MongoDB Source Config"/> Configuration element -</p> -<note>This Element currently uses <code>com.mongodb.DB#eval</code> which takes a global write lock causing a performance impact on the database, see <a href="http://docs.mongodb.org/manual/reference/method/db.eval/"><code>db.eval()</code></a>. -So it is better to avoid using this element for load testing and use JSR223+Groovy scripting using <a href="../api/org/apache/jmeter/protocol/mongodb/config/MongoDBHolder.html">MongoDBHolder</a> instead. -MongoDB Script is more suitable for functional testing or test setup (setup/teardown threads)</note> -</description> - -<properties> - <property name="Name" required="No">Descriptive name for this sampler that is shown in the tree.</property> - <property name="MongoDB Source" required="Yes"> - Name of the JMeter variable that the MongoDB connection is bound to. - This must agree with the '<code>MongoDB Source</code>' field of a MongoDB Source Config. - </property> - <property name="Database Name" required="Yes">Database Name, will be used in your script - </property> - <property name="Username" required="No"> - </property> - <property name="Password" required="No"> - </property> - <property name="Script" required="Yes"> - Mongo script as it would be used in MongoDB shell - </property> -</properties> - -<links> - <complink name="MongoDB Source Config"/> -</links> -<note>Ensure Variable Name is unique across Test Plan.</note> -</component> - <a href="#">^</a> - <component name="Bolt Request" index="§-num;.1.22" width="711" height="488" screenshot="bolt-request.png"> <description> <p>This sampler allows you to run Cypher queries through the Bolt protocol.</p> @@ -4341,94 +4307,6 @@ GUI that they can use while developing new JMeter components.</p> are not generally documented. Only those familiar with the code will know these values.</property> <property name="Parameter Value" required="Yes">The value to apply to that parameter.</property> </properties> - -</component> - - -<component name="MongoDB Source Config (DEPRECATED)" index="§-num;.4.20" - width="1233" height="618" screenshot="mongodb-source-config.png"> - <description>Creates a MongoDB connection (used by <complink name="MongoDB Script"/>Sampler) - from the supplied Connection settings. Each thread gets its own connection. - The connection configuration name is used by the JDBC Sampler to select the appropriate - connection. - <p> - You can then access <code>com.mongodb.DB</code> object in Beanshell or JSR223 Test Elements through the element <a href="../api/org/apache/jmeter/protocol/mongodb/config/MongoDBHolder.html">MongoDBHolder</a> - using this code</p> - - <source> -import com.mongodb.DB; -import org.apache.jmeter.protocol.mongodb.config.MongoDBHolder; -DB db = MongoDBHolder.getDBFromSource("value of property MongoDB Source", - "value of property Database Name"); -… - </source> - </description> - <properties> - <property name="Name" required="No">Descriptive name for the connection configuration that is shown in the tree.</property> - <property name="Server Address List" required="Yes">Mongo DB Servers</property> - <property name="MongoDB Source" required="Yes">The name of the variable the connection is tied to. - <note>Each name must be different. If there are two configuration elements using the same name, only one will be saved.</note> - </property> - - <property name="Keep Trying" required="No"> - If <code>true</code>, the driver will keep trying to connect to the same server in case that the socket cannot be established.<br/> - There is maximum amount of time to keep retrying, which is 15s by default.<br/>This can be useful to avoid some exceptions being thrown when a server is down temporarily by blocking the operations. - <br/>It can also be useful to smooth the transition to a new master (so that a new master is elected within the retry time).<br/> - <note>Note that when using this flag - <ul> - <li>for a replica set, the driver will try to connect to the old master for that time, instead of failing over to the new one right away </li> - <li>this does not prevent exception from being thrown in read/write operations on the socket, which must be handled by application.</li> - </ul> - Even if this flag is false, the driver already has mechanisms to automatically recreate broken connections and retry the read operations. - </note> - Default is <code>false</code>. - </property> - <property name="Maximum connections per host" required="No"></property> - <property name="Connection timeout" required="No"> - The connection timeout in milliseconds.<br/>It is used solely when establishing a new connection <code>Socket.connect(java.net.SocketAddress, int)</code><br/>Default is <code>0</code> and means no timeout. - </property> - <property name="Maximum retry time" required="No"> - The maximum amount of time in milliseconds to spend retrying to open connection to the same server.<br/>Default is <code>0</code>, which means to use the default 15s if <code>autoConnectRetry</code> is on. - </property> - <property name="Maximum wait time" required="No"> - The maximum wait time in milliseconds that a thread may wait for a connection to become available.<br/>Default is <code>120,000</code>. - </property> - <property name="Socket timeout" required="No"> - The socket timeout in milliseconds It is used for I/O socket read and write operations <code>Socket.setSoTimeout(int)</code><br/>Default is <code>0</code> and means no timeout. - </property> - <property name="Socket keep alive" required="No"> - This flag controls the socket keep alive feature that keeps a connection alive through firewalls <code>Socket.setKeepAlive(boolean)</code><br/> - Default is <code>false</code>. - </property> - <property name="ThreadsAllowedToBlockForConnectionMultiplier" required="No"> - This multiplier, multiplied with the connectionsPerHost setting, gives the maximum number of threads that may be waiting for a connection to become available from the pool.<br/> - All further threads will get an exception right away.<br/> - For example if <code>connectionsPerHost</code> is <code>10</code> and <code>threadsAllowedToBlockForConnectionMultiplier</code> is <code>5</code>, then up to 50 threads can wait for a connection.<br/> - Default is <code>5</code>. - </property> - <property name="Write Concern : Safe" required="No"> - If <code>true</code> the driver will use a <code>WriteConcern</code> of <code>WriteConcern.SAFE</code> for all operations.<br/> - If <code>w</code>, <code>wtimeout</code>, <code>fsync</code> or <code>j</code> are specified, this setting is ignored.<br/> - Default is <code>false</code>. - </property> - <property name="Write Concern : Fsync" required="No"> - The <code>fsync</code> value of the global <code>WriteConcern</code>.<br/> - Default is <code>false</code>. - </property> - <property name="Write Concern : Wait for Journal" required="No"> - The <code>j</code> value of the global <code>WriteConcern</code>.<br/> - Default is <code>false</code>. - </property> - <property name="Write Concern : Wait for servers" required="No"> - The <code>w</code> value of the global <code>WriteConcern</code>.<br/>Default is <code>0</code>. - </property> - <property name="Write Concern : Wait timeout" required="No"> - The <code>wtimeout</code> value of the global <code>WriteConcern</code>.<br/>Default is <code>0</code>. - </property> - <property name="Write Concern : Continue on error" required="No"> - If batch inserts should continue after the first error - </property> - </properties> </component> <a href="#">^</a> diff --git a/xdocs/usermanual/properties_reference.xml b/xdocs/usermanual/properties_reference.xml index 87994c8..7f30c3a 100644 --- a/xdocs/usermanual/properties_reference.xml +++ b/xdocs/usermanual/properties_reference.xml @@ -236,9 +236,11 @@ Defaults to: <code>true</code> <property name="not_in_menu"> Components to not display in JMeter GUI (GUI class name or static label).<br/> These elements are deprecated and will be removed in next version: - <source>MongoDB Script, MongoDB Source Config</source> + <source>BSF elements, </source> Defaults to: - <source>org.apache.jmeter.protocol.mongodb.sampler.MongoScriptSampler, org.apache.jmeter.protocol.mongodb.config.MongoSourceElement</source> + <source>org.apache.jmeter.timers.BSFTimer,org.apache.jmeter.modifiers.BSFPreProcessor, + org.apache.jmeter.extractor.BSFPostProcessor,org.apache.jmeter.assertions.BSFAssertion, + org.apache.jmeter.visualizers.BSFListener,org.apache.jmeter.protocol.java.sampler.BSFSampler</source> </property> <property name="undo.history.size"> Number of items in undo history.<br/>
