directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From smckin...@apache.org
Subject [directory-fortress-core] branch master updated: user ou set in jmeter config, user default ldap host name if not passed in
Date Sat, 24 Oct 2020 15:02:06 GMT
This is an automated email from the ASF dual-hosted git repository.

smckinney pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/directory-fortress-core.git


The following commit(s) were added to refs/heads/master by this push:
     new c931dfd  user ou set in jmeter config, user default ldap host name if not passed
in
c931dfd is described below

commit c931dfde57e877d64652eceedb1e5222566e0cdb
Author: Shawn McKinney <smckinney@symas.com>
AuthorDate: Sat Oct 24 10:02:00 2020 -0500

    user ou set in jmeter config, user default ldap host name if not passed in
---
 README.md                                                    | 12 +++++++++---
 .../org/apache/directory/fortress/core/jmeter/AddUser.java   |  3 +--
 .../org/apache/directory/fortress/core/jmeter/UserBase.java  | 11 +++++++++++
 src/test/jmeter/ftAddUser.jmx                                |  6 ++++++
 4 files changed, 27 insertions(+), 5 deletions(-)

diff --git a/README.md b/README.md
index a037f92..9c77042 100644
--- a/README.md
+++ b/README.md
@@ -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.
diff --git a/src/test/java/org/apache/directory/fortress/core/jmeter/AddUser.java b/src/test/java/org/apache/directory/fortress/core/jmeter/AddUser.java
index e767e7d..6d50748 100644
--- a/src/test/java/org/apache/directory/fortress/core/jmeter/AddUser.java
+++ b/src/test/java/org/apache/directory/fortress/core/jmeter/AddUser.java
@@ -51,8 +51,7 @@ public class AddUser extends UserBase
             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 );
diff --git a/src/test/java/org/apache/directory/fortress/core/jmeter/UserBase.java b/src/test/java/org/apache/directory/fortress/core/jmeter/UserBase.java
index a4de4b3..9f1eaf7 100644
--- a/src/test/java/org/apache/directory/fortress/core/jmeter/UserBase.java
+++ b/src/test/java/org/apache/directory/fortress/core/jmeter/UserBase.java
@@ -23,6 +23,7 @@ import org.apache.commons.lang.StringUtils;
 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 @@ public abstract class UserBase extends AbstractJavaSamplerClient
         {
             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 ))
         {
diff --git a/src/test/jmeter/ftAddUser.jmx b/src/test/jmeter/ftAddUser.jmx
index 45712ae..633de05 100644
--- a/src/test/jmeter/ftAddUser.jmx
+++ b/src/test/jmeter/ftAddUser.jmx
@@ -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>


Mime
View raw message