Skip to content

Commit

Permalink
Add Test5 - create containers with RDF bodies (#8)
Browse files Browse the repository at this point in the history
* Add Test5 - create containers with RDF bodies

Resolves: https://jira.duraspace.org/browse/FCREPO-1947

* Parameterize location of resource directory
* i.e, parent directory of 'sample.ttl'
  • Loading branch information
Andrew Woods authored and ruebot committed Jul 4, 2016
1 parent 642cd36 commit cad81b5
Show file tree
Hide file tree
Showing 3 changed files with 144 additions and 0 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1 +1,3 @@
*~
jmeter.log
log/
7 changes: 7 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -78,3 +78,10 @@ jmeter -Dfedora_4_server=<default=localhost> -Dfedora_4_context=<default=rest> -
```bash
jmeter -Dfedora_4_server=<default=localhost> -Dfedora_4_context=<default=rest> -Dcontainer_threads=1 -n -t <path/to/fcrepo4-jmeter>/fedora.jmx
```

#### Test 5 - Number of containers - with RDF bodies

* Run:
```bash
jmeter -Dfedora_4_server=<default=localhost> -Dfedora_4_context=<default=rest> -Dresource_directory=<default=.> -Dcontainer_rdf_threads=1 -n -t <path/to/fcrepo4-jmeter>/fedora.jmx
```
135 changes: 135 additions & 0 deletions fedora.jmx
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,11 @@
<stringProp name="Argument.value">${__property(container_threads,,0)}</stringProp>
<stringProp name="Argument.metadata">=</stringProp>
</elementProp>
<elementProp name="CONTAINER_RDF_THREADS" elementType="Argument">
<stringProp name="Argument.name">CONTAINER_RDF_THREADS</stringProp>
<stringProp name="Argument.value">${__property(container_rdf_threads,,0)}</stringProp>
<stringProp name="Argument.metadata">=</stringProp>
</elementProp>
<elementProp name="BINARY_THREADS" elementType="Argument">
<stringProp name="Argument.name">BINARY_THREADS</stringProp>
<stringProp name="Argument.value">${__property(binary_threads,,0)}</stringProp>
Expand Down Expand Up @@ -72,6 +77,11 @@
<stringProp name="Argument.value">${__property(fedora_4_protocol,,http)}</stringProp>
<stringProp name="Argument.metadata">=</stringProp>
</elementProp>
<elementProp name="RESOURCE_DIRECTORY" elementType="Argument">
<stringProp name="Argument.name">RESOURCE_DIRECTORY</stringProp>
<stringProp name="Argument.value">${__property(resource_directory,,.)}</stringProp>
<stringProp name="Argument.metadata">=</stringProp>
</elementProp>
</collectionProp>
</elementProp>
<stringProp name="TestPlan.user_define_classpath"></stringProp>
Expand Down Expand Up @@ -350,6 +360,131 @@ vars.put(&quot;post_body&quot;, RandomStringUtils.randomAscii(size));
<hashTree/>
</hashTree>
</hashTree>
<ThreadGroup guiclass="ThreadGroupGui" testclass="ThreadGroup" testname="Fedora4 Create New Containers with RDF" enabled="true">
<stringProp name="ThreadGroup.on_sample_error">stoptest</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">${CONTAINER_RDF_THREADS}</stringProp>
<stringProp name="ThreadGroup.ramp_time">${RAMP_UP_PERIOD}</stringProp>
<longProp name="ThreadGroup.start_time">1370357053000</longProp>
<longProp name="ThreadGroup.end_time">1370357053000</longProp>
<boolProp name="ThreadGroup.scheduler">false</boolProp>
<stringProp name="ThreadGroup.duration"></stringProp>
<stringProp name="ThreadGroup.delay"></stringProp>
</ThreadGroup>
<hashTree>
<ConfigTestElement guiclass="HttpDefaultsGui" testclass="ConfigTestElement" testname="HTTP Request Defaults" enabled="true">
<elementProp name="HTTPsampler.Arguments" elementType="Arguments" guiclass="HTTPArgumentsPanel" testclass="Arguments" testname="User Defined Variables" enabled="true">
<collectionProp name="Arguments.arguments"/>
</elementProp>
<stringProp name="HTTPSampler.domain">${FEDORA_4_SERVER_NAME}</stringProp>
<stringProp name="HTTPSampler.port">${FEDORA_4_SERVER_PORT}</stringProp>
<stringProp name="HTTPSampler.connect_timeout"></stringProp>
<stringProp name="HTTPSampler.response_timeout"></stringProp>
<stringProp name="HTTPSampler.protocol">${FEDORA_4_SERVER_PROTOCOL}</stringProp>
<stringProp name="HTTPSampler.contentEncoding"></stringProp>
<stringProp name="HTTPSampler.path"></stringProp>
<stringProp name="HTTPSampler.implementation">HttpClient4</stringProp>
<stringProp name="HTTPSampler.concurrentPool">4</stringProp>
</ConfigTestElement>
<hashTree/>
<BSFPreProcessor guiclass="TestBeanGUI" testclass="BSFPreProcessor" testname="Set Context" enabled="true">
<stringProp name="scriptLanguage">javascript</stringProp>
<stringProp name="parameters"></stringProp>
<stringProp name="filename"></stringProp>
<stringProp name="script">vars.put(&apos;FEDORA_SERVER_CONTEXT&apos;, vars.get(&apos;FEDORA_4_SERVER_CONTEXT&apos;));</stringProp>
</BSFPreProcessor>
<hashTree/>
<IfController guiclass="IfControllerPanel" testclass="IfController" testname="If Controller" enabled="true">
<stringProp name="TestPlan.comments">Execute on every 1000 requests</stringProp>
<stringProp name="IfController.condition">${num_requests}%1000==0</stringProp>
<boolProp name="IfController.evaluateAll">true</boolProp>
</IfController>
<hashTree>
<ModuleController guiclass="ModuleControllerGui" testclass="ModuleController" testname="Performance Requests" enabled="true">
<collectionProp name="ModuleController.node_path">
<stringProp name="-1227702913">WorkBench</stringProp>
<stringProp name="1667018239">Fedora Profiling</stringProp>
<stringProp name="1163303380">Performance requests</stringProp>
</collectionProp>
</ModuleController>
<hashTree/>
<BeanShellAssertion guiclass="BeanShellAssertionGui" testclass="BeanShellAssertion" testname="BeanShell Assertion" enabled="true">
<stringProp name="TestPlan.comments">Fail if there are more failures than MAX_ERRORS</stringProp>
<stringProp name="BeanShellAssertion.query">long elapsed = SampleResult.getTime();

long threshold = Long.parseLong(vars.get(&quot;RESPONSE_THRESHOLD_MILLIS&quot;));
int maxErrors = Integer.parseInt(vars.get(&quot;MAX_ERRORS&quot;));

if (vars.get(&quot;NUM_ERRORS&quot;) == null) {
vars.put(&quot;NUM_ERRORS&quot;, &quot;0&quot;);
}

if (elapsed &gt; threshold) {

int failureCount = Integer.parseInt(vars.get(&quot;NUM_ERRORS&quot;));
failureCount++;

if (failureCount &gt;= maxErrors) {
SampleResult.setSuccessful(false);
SampleResult.setResponseMessage(failureCount + &quot; requests failed to finish in &quot; + threshold + &quot; ms&quot;);
SampleResult.setStopTest(true);
log.error(&quot;Errored out!&quot;);

} else {
vars.put(&quot;NUM_ERRORS&quot;, String.valueOf(failureCount));
log.warn(&quot;Error occurred. Elapsed millis: &quot; + elapsed + &quot;, num errors: &quot; + failureCount);
}
}</stringProp>
<stringProp name="BeanShellAssertion.filename"></stringProp>
<stringProp name="BeanShellAssertion.parameters"></stringProp>
<boolProp name="BeanShellAssertion.resetInterpreter">false</boolProp>
</BeanShellAssertion>
<hashTree/>
</hashTree>
<HTTPSamplerProxy guiclass="HttpTestSampleGui" testclass="HTTPSamplerProxy" testname="Create New Container with RDF" enabled="true">
<elementProp name="HTTPsampler.Arguments" elementType="Arguments" guiclass="HTTPArgumentsPanel" testclass="Arguments" testname="User Defined Variables" enabled="true">
<collectionProp name="Arguments.arguments"/>
</elementProp>
<stringProp name="HTTPSampler.domain"></stringProp>
<stringProp name="HTTPSampler.port"></stringProp>
<stringProp name="HTTPSampler.connect_timeout"></stringProp>
<stringProp name="HTTPSampler.response_timeout"></stringProp>
<stringProp name="HTTPSampler.protocol"></stringProp>
<stringProp name="HTTPSampler.contentEncoding">utf-8</stringProp>
<stringProp name="HTTPSampler.path">${FEDORA_4_SERVER_CONTEXT}</stringProp>
<stringProp name="HTTPSampler.method">POST</stringProp>
<boolProp name="HTTPSampler.follow_redirects">false</boolProp>
<boolProp name="HTTPSampler.auto_redirects">false</boolProp>
<boolProp name="HTTPSampler.use_keepalive">false</boolProp>
<boolProp name="HTTPSampler.DO_MULTIPART_POST">false</boolProp>
<stringProp name="HTTPSampler.implementation">HttpClient4</stringProp>
<elementProp name="HTTPsampler.Files" elementType="HTTPFileArgs">
<collectionProp name="HTTPFileArgs.files">
<elementProp name="${RESOURCE_DIRECTORY}/sample.ttl" elementType="HTTPFileArg">
<stringProp name="File.path">${RESOURCE_DIRECTORY}/sample.ttl</stringProp>
<stringProp name="File.paramname"></stringProp>
<stringProp name="File.mimetype">text/turtle</stringProp>
</elementProp>
</collectionProp>
</elementProp>
<boolProp name="HTTPSampler.monitor">false</boolProp>
<stringProp name="HTTPSampler.embedded_url_re"></stringProp>
</HTTPSamplerProxy>
<hashTree>
<CounterConfig guiclass="CounterConfigGui" testclass="CounterConfig" testname="Counter" enabled="true">
<stringProp name="CounterConfig.start">0</stringProp>
<stringProp name="CounterConfig.end">1000</stringProp>
<stringProp name="CounterConfig.incr">1</stringProp>
<stringProp name="CounterConfig.name">num_requests</stringProp>
<stringProp name="CounterConfig.format"></stringProp>
<boolProp name="CounterConfig.per_user">false</boolProp>
</CounterConfig>
<hashTree/>
</hashTree>
</hashTree>
<ResultCollector guiclass="GraphVisualizer" testclass="ResultCollector" testname="Graph Results" enabled="true">
<boolProp name="ResultCollector.error_logging">false</boolProp>
<objProp>
Expand Down

0 comments on commit cad81b5

Please sign in to comment.