Skip to content

wiki_read_modify_write

Denis Sheahan edited this page Feb 29, 2012 · 1 revision
<?xml version="1.0" encoding="UTF-8"?>
<jmeterTestPlan version="1.2" properties="2.2">
 <hashTree>
   <TestPlan guiclass="TestPlanGui" testclass="TestPlan" testname="Cassandra Test" enabled="true">
     <stringProp name="TestPlan.comments"></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>
     <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">1</stringProp>
       <longProp name="ThreadGroup.start_time">1330016286000</longProp>
       <longProp name="ThreadGroup.end_time">1330016286000</longProp>
       <boolProp name="ThreadGroup.scheduler">false</boolProp>
       <stringProp name="ThreadGroup.duration"></stringProp>
       <stringProp name="ThreadGroup.delay"></stringProp>
     </ThreadGroup>
     <hashTree>
       <Arguments guiclass="ArgumentsPanel" testclass="Arguments" testname="User Defined Variables" enabled="true">
         <collectionProp name="Arguments.arguments">
           <elementProp name="do_put" elementType="Argument">
             <stringProp name="Argument.name">do_put</stringProp>
             <stringProp name="Argument.value">0</stringProp>
             <stringProp name="Argument.metadata">=</stringProp>
           </elementProp>
           <elementProp name="cvalue" elementType="Argument">
             <stringProp name="Argument.name">cvalue</stringProp>
             <stringProp name="Argument.value"></stringProp>
             <stringProp name="Argument.metadata">=</stringProp>
           </elementProp>
         </collectionProp>
       </Arguments>
       <hashTree/>
       <com.netflix.jmeter.properties.CassandraProperties guiclass="TestBeanGUI" testclass="com.netflix.jmeter.properties.CassandraProperties" testname="MyTestCluster" enabled="true">
         <stringProp name="cassandraServers">ec2-174-129-54-43.compute-1.amazonaws.com:7102,ec2-107-22-120-211.compute-1.amazonaws.com:7102,ec2-184-73-88-78.compute-1.amazonaws.com:7102,ec2-50-17-146-28.compute-1.amazonaws.com:7102,ec2-107-22-20-216.compute-1.amazonaws.com:7102,ec2-107-22-12-160.compute-1.amazonaws.com:7102</stringProp>
         <stringProp name="clientType">com.netflix.jmeter.connections.a6x.AstyanaxConnection</stringProp>
         <stringProp name="clusterName">cass_c4_subscriber</stringProp>
         <stringProp name="keyspace">MemberKeySp</stringProp>
         <stringProp name="maxConnsPerHost">100</stringProp>
         <stringProp name="readConsistency">CL_ONE</stringProp>
         <stringProp name="writeConsistency">CL_QUORUM</stringProp>
       </com.netflix.jmeter.properties.CassandraProperties>
       <hashTree/>
       <CSVDataSet guiclass="TestBeanGUI" testclass="CSVDataSet" testname="CSV Data Set Config" enabled="true">
         <stringProp name="delimiter">,</stringProp>
         <stringProp name="fileEncoding"></stringProp>
         <stringProp name="filename">wiki_example_rmw.csv</stringProp>
         <boolProp name="quotedData">false</boolProp>
         <boolProp name="recycle">false</boolProp>
         <stringProp name="shareMode">All threads</stringProp>
         <boolProp name="stopThread">true</boolProp>
         <stringProp name="variableNames">rowid,cname</stringProp>
       </CSVDataSet>
       <hashTree/>
       <com.netflix.jmeter.sampler.GetSampler guiclass="com.netflix.jmeter.gui.Get" testclass="com.netflix.jmeter.sampler.GetSampler" testname="Cassandra Get" enabled="true">
         <stringProp name="TestPlan.comments">test comment</stringProp>
         <stringProp name="KEY_SERIALIZER_TYPE">StringSerializer</stringProp>
         <stringProp name="KEY">${rowid}</stringProp>
         <stringProp name="COLUMN_FAMILY">CustomerSimple</stringProp>
         <stringProp name="COLUMN_SERIALIZER_TYPE">StringSerializer</stringProp>
         <stringProp name="VALUE_SERIALIZER_TYPE">StringSerializer</stringProp>
         <stringProp name="COLUMN_NAME">${cname}</stringProp>
       </com.netflix.jmeter.sampler.GetSampler>
       <hashTree/>
       <BeanShellListener guiclass="TestBeanGUI" testclass="BeanShellListener" testname="BeanShell Listener" enabled="true">
         <boolProp name="resetInterpreter">false</boolProp>
         <stringProp name="parameters"></stringProp>
         <stringProp name="filename"></stringProp>
         <stringProp name="script">import org.apache.jmeter.util.JMeterUtils; 
import org.apache.jmeter.samplers.SampleResult; 
import org.apache.jorphan.util.JOrphanUtils;


// Get result from previous Cassandra Get
SampleResult prev_result=ctx.getPreviousResult();
String respCode = prev_result.getResponseCode();


// Only do the second put if the Get succeeded
int do_put = 0;

// Check if the previous Get succeeded
if (respCode.equals( &quot;200&quot;))
{

    do_put = 1;

// Extract the data from the Get
    String theResponse = prev_result.getResponseDataAsString();

// Modify the data and store it in the cvalue thread variable   
    vars.put(&quot;cvalue&quot;,theResponse + &quot;_modified&quot;);

}

// Set the indication of whether the put should beexecute
vars.put(&quot;do_put&quot;,Integer.toString(do_put));</stringProp>
       </BeanShellListener>
       <hashTree/>
       <IfController guiclass="IfControllerPanel" testclass="IfController" testname="If Controller" enabled="true">
         <stringProp name="IfController.condition">${__javaScript(&quot;${do_put}&quot;==&quot;1&quot;)}</stringProp>
         <boolProp name="IfController.evaluateAll">false</boolProp>
       </IfController>
       <hashTree>
         <com.netflix.jmeter.sampler.PutSampler guiclass="com.netflix.jmeter.gui.Put" testclass="com.netflix.jmeter.sampler.PutSampler" testname="Cassandra Put" enabled="true">
           <stringProp name="TestPlan.comments">test comment</stringProp>
           <stringProp name="KEY_SERIALIZER_TYPE">StringSerializer</stringProp>
           <stringProp name="KEY">${rowid}</stringProp>
           <stringProp name="COLUMN_FAMILY">CustomerSimple</stringProp>
           <stringProp name="COLUMN_SERIALIZER_TYPE">StringSerializer</stringProp>
           <stringProp name="VALUE_SERIALIZER_TYPE">StringSerializer</stringProp>
           <stringProp name="COLUMN_NAME">${cname}</stringProp>
           <stringProp name="VALUE">${cvalue}</stringProp>
           <boolProp name="IS_COUNTER">false</boolProp>
         </com.netflix.jmeter.sampler.PutSampler>
         <hashTree/>
       </hashTree>
       <ResultCollector guiclass="ViewResultsFullVisualizer" testclass="ResultCollector" testname="View Results Tree" 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>true</dataType>
             <encoding>false</encoding>
             <assertions>true</assertions>
             <subresults>true</subresults>
             <responseData>false</responseData>
             <samplerData>false</samplerData>
             <xml>true</xml>
             <fieldNames>false</fieldNames>
             <responseHeaders>false</responseHeaders>
             <requestHeaders>false</requestHeaders>
             <responseDataOnError>false</responseDataOnError>
             <saveAssertionResultsFailureMessage>false</saveAssertionResultsFailureMessage>
             <assertionsResultsToSave>0</assertionsResultsToSave>
             <bytes>true</bytes>
           </value>
         </objProp>
         <stringProp name="filename"></stringProp>
       </ResultCollector>
       <hashTree/>
     </hashTree>
   </hashTree>
 </hashTree>
</jmeterTestPlan>
Clone this wiki locally