Skip to content
Permalink
Browse files
user ou set in jmeter config, user default ldap host name if not pass…
…ed in
  • Loading branch information
shawnmckinney committed Oct 24, 2020
1 parent cd0dab9 commit c931dfde57e877d64652eceedb1e5222566e0cdb
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 5 deletions.
@@ -832,12 +832,18 @@ ________________________________________________________________________________

F. Add Users:
```
mvn -Ploadtest-fortress-adduser jmeter:jmeter
mvn -Ploadtest-fortress-adduser jmeter:jmeter -Dqualifier=A1 -Dverify=true -Dsleep=30 -Dou=uou1
```

This test will add users. It uses runtime arguments to define behavior like:
-Dhostname=foo <-- optional field useful for distributing the load in a multi-master env, will override what's set in fortress.properties
-Dqualifier=A1 <-- this is used to construct userid: hostname + qualifier + counter
-Dverify=true <-- will read after operation to verify success
-Dsleep=30 <-- sleep this many millisecones after each op
-Dou=uou1 <-- this is a required attribute on fortress user and must exist in user ou tree

G. Delete Users:
```
mvn -Ploadtest-fortress-deluser jmeter:jmeter
mvn -Ploadtest-fortress-deluser jmeter:jmeter -Dqualifier=A1 -Dverify=true -Dsleep=30
```

The tests will run and produce measurements for throughput and latency.
@@ -51,8 +51,7 @@ public SampleResult runTest( JavaSamplerContext samplerContext )
User user = new User();
user.setUserId( userId );
user.setPassword( "secret" );
// Use one from OrgUnitExample.xml:
user.setOu( "uou1");
user.setOu( ou );
write( "threadid: " + getThreadId() + ", userId: " + userId );
User outUser = adminMgr.addUser( user );
assertNotNull( outUser );
@@ -23,6 +23,7 @@
import org.apache.directory.fortress.core.*;
import org.apache.directory.fortress.core.SecurityException;
import org.apache.directory.fortress.core.model.User;
import org.apache.directory.fortress.core.util.Config;
import org.apache.jmeter.protocol.java.sampler.AbstractJavaSamplerClient;
import org.apache.jmeter.protocol.java.sampler.JavaSamplerContext;
import org.slf4j.Logger;
@@ -56,6 +57,7 @@ public abstract class UserBase extends AbstractJavaSamplerClient
protected boolean verify = false;
protected boolean output = false;
protected boolean update = false;
protected String ou = null;
protected int sleep = 0;
private PrintWriter printWriter;

@@ -123,11 +125,20 @@ private void init( JavaSamplerContext samplerContext )
{
System.setProperty( "fortress.host", hostname );
}
else
{
hostname = Config.getInstance().getProperty( GlobalIds.LDAP_HOST );
}
qualifier = System.getProperty( "qualifier" );
if (StringUtils.isEmpty( qualifier ))
{
qualifier = samplerContext.getParameter( "qualifier" );
}
ou = System.getProperty( "ou" );
if (StringUtils.isEmpty( ou ))
{
ou = samplerContext.getParameter( "ou" );
}
String szVerify = System.getProperty( "verify" );
if (StringUtils.isEmpty( szVerify ))
{
@@ -82,6 +82,12 @@
<stringProp name="Argument.value">5</stringProp>
<stringProp name="Argument.metadata">=</stringProp>
</elementProp>
<elementProp name="ou" elementType="Argument">
<stringProp name="Argument.name">ou</stringProp>
<!-- Use one from OrgUnitExample.xml -->
<stringProp name="Argument.value">uou1</stringProp>
<stringProp name="Argument.metadata">=</stringProp>
</elementProp>
</collectionProp>
</elementProp>
<stringProp name="classname">org.apache.directory.fortress.core.jmeter.AddUser</stringProp>

0 comments on commit c931dfd

Please sign in to comment.