Skip to content
Permalink
Browse files
introduce delay
  • Loading branch information
shawnmckinney committed Sep 23, 2020
1 parent 66080bd commit ef09a3879bbd22929357571b97d2f7c788e2dd9c
Show file tree
Hide file tree
Showing 5 changed files with 42 additions and 0 deletions.
@@ -59,6 +59,17 @@ public SampleResult runTest( JavaSamplerContext samplerContext )
{
assertTrue( verify( userId, Op.ADD ) );
}
if( sleep > 0 )
{
try
{
Thread.sleep( sleep );
}
catch (InterruptedException ie)
{
Thread.currentThread().interrupt();
}
}
sampleResult.sampleEnd();
sampleResult.setBytes(1);
sampleResult.setResponseMessage("test completed TID: " + getThreadId() + " UID: " + userId);
@@ -56,6 +56,17 @@ public SampleResult runTest( JavaSamplerContext samplerContext )
{
assertFalse( verify( userId, Op.DEL ) );
}
if( sleep > 0 )
{
try
{
Thread.sleep( sleep );
}
catch (InterruptedException ie)
{
Thread.currentThread().interrupt();
}
}
sampleResult.sampleEnd();
sampleResult.setBytes(1);
sampleResult.setResponseMessage("test completed TID: " + getThreadId() + " UID: " + userId);
@@ -55,6 +55,7 @@ public abstract class UserBase extends AbstractJavaSamplerClient
private String filename;
protected boolean verify = false;
protected boolean output = false;
protected int sleep = 0;
private PrintWriter printWriter;

protected enum Op
@@ -144,6 +145,15 @@ private void init( JavaSamplerContext samplerContext )
{
output = szLog.equalsIgnoreCase( "true" );
}
String szSleep = System.getProperty( "sleep" );
if (StringUtils.isEmpty( szSleep ))
{
szSleep = samplerContext.getParameter( "sleep" );
}
if (!StringUtils.isEmpty( szSleep ))
{
sleep = Integer.valueOf(szSleep);
}
filename = "operations" + '-' + "thread" + getThreadId() + '-' + hostname + '-' + qualifier + ".txt";
open();
}
@@ -77,6 +77,11 @@
<stringProp name="Argument.value">false</stringProp>
<stringProp name="Argument.metadata">=</stringProp>
</elementProp>
<elementProp name="output" elementType="Argument">
<stringProp name="Argument.name">sleep</stringProp>
<stringProp name="Argument.value">5</stringProp>
<stringProp name="Argument.metadata">=</stringProp>
</elementProp>
</collectionProp>
</elementProp>
<stringProp name="classname">org.apache.directory.fortress.core.jmeter.AddUser</stringProp>
@@ -77,6 +77,11 @@
<stringProp name="Argument.value">false</stringProp>
<stringProp name="Argument.metadata">=</stringProp>
</elementProp>
<elementProp name="output" elementType="Argument">
<stringProp name="Argument.name">sleep</stringProp>
<stringProp name="Argument.value">5</stringProp>
<stringProp name="Argument.metadata">=</stringProp>
</elementProp>
</collectionProp>
</elementProp>
<stringProp name="classname">org.apache.directory.fortress.core.jmeter.DelUser</stringProp>

0 comments on commit ef09a38

Please sign in to comment.