You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@directory.apache.org by sm...@apache.org on 2023/08/09 22:10:34 UTC

[directory-fortress-core] branch master updated: FC323 + add perm load tests

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 b231c9bc FC323 + add perm load tests
b231c9bc is described below

commit b231c9bc4c6be1e8449f25c70294eca69968f41f
Author: Shawn McKinney <sm...@symas.com>
AuthorDate: Wed Aug 9 17:10:27 2023 -0500

    FC323 + add perm load tests
---
 .../directory/fortress/core/jmeter/AddPerm.java    |  72 +++++++++++++
 src/test/jmeter/AddPerm.jmx                        | 116 +++++++++++++++++++++
 2 files changed, 188 insertions(+)

diff --git a/src/test/java/org/apache/directory/fortress/core/jmeter/AddPerm.java b/src/test/java/org/apache/directory/fortress/core/jmeter/AddPerm.java
new file mode 100644
index 00000000..109de2e3
--- /dev/null
+++ b/src/test/java/org/apache/directory/fortress/core/jmeter/AddPerm.java
@@ -0,0 +1,72 @@
+/*
+ *   Licensed to the Apache Software Foundation (ASF) under one
+ *   or more contributor license agreements.  See the NOTICE file
+ *   distributed with this work for additional information
+ *   regarding copyright ownership.  The ASF licenses this file
+ *   to you under the Apache License, Version 2.0 (the
+ *   "License"); you may not use this file except in compliance
+ *   with the License.  You may obtain a copy of the License at
+ *
+ *     https://www.apache.org/licenses/LICENSE-2.0
+ *
+ *   Unless required by applicable law or agreed to in writing,
+ *   software distributed under the License is distributed on an
+ *   "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *   KIND, either express or implied.  See the License for the
+ *   specific language governing permissions and limitations
+ *   under the License.
+ *
+ */
+package org.apache.directory.fortress.core.jmeter;
+
+import org.apache.directory.fortress.core.model.PermObj;
+import org.apache.directory.fortress.core.model.Permission;
+import org.apache.jmeter.protocol.java.sampler.JavaSamplerContext;
+import org.apache.jmeter.samplers.SampleResult;
+
+import static org.junit.Assert.*;
+
+/**
+ * Add role entry tests.
+ *
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ */
+public class AddPerm extends UserBase
+{
+    /**
+     * This test case performs add object entry.
+     *
+     * @param samplerContext Description of the Parameter
+     * @return Description of the Return Value
+     */
+    public SampleResult runTest( JavaSamplerContext samplerContext )
+    {
+        boolean result = false;
+        SampleResult sampleResult = new SampleResult();
+        Permission perm = null;
+        try
+        {
+            sampleResult.sampleStart();
+            assertNotNull( adminMgr );
+            int count = getKey( Op.ADD );
+            perm = getPermission( count );
+            if ( count == 1 )
+            {
+                assertNotNull( "ou operand not setup", ou );
+                PermObj obj = adminMgr.addPermObj( new PermObj( perm.getObjName(), ou ));
+                assertNotNull( perm.getObjName(), obj );
+            }
+            Permission outPerm = adminMgr.addPermission( perm );
+            assertNotNull( perm.getOpName(), outPerm );
+            LOG.debug( "threadid: {}, perm obj: {}, op: {}", getThreadId(), perm.getObjName(), perm.getOpName() );
+            result = true;
+            sleep();
+        }
+        catch ( org.apache.directory.fortress.core.SecurityException se )
+        {
+            warn( se.getMessage() );
+        }
+        wrapup( sampleResult, perm.getObjName() + "." + perm.getOpName(), result );
+        return sampleResult;
+    }
+}
diff --git a/src/test/jmeter/AddPerm.jmx b/src/test/jmeter/AddPerm.jmx
new file mode 100644
index 00000000..ad753939
--- /dev/null
+++ b/src/test/jmeter/AddPerm.jmx
@@ -0,0 +1,116 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+  Licensed to the Apache Software Foundation (ASF) under one
+  or more contributor license agreements.  See the NOTICE file
+  distributed with this work for additional information
+  regarding copyright ownership.  The ASF licenses this file
+  to you under the Apache License, Version 2.0 (the
+  "License"); you may not use this file except in compliance
+  with the License.  You may obtain a copy of the License at
+
+  https://www.apache.org/licenses/LICENSE-2.0
+
+  Unless required by applicable law or agreed to in writing,
+  software distributed under the License is distributed on an
+  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+  KIND, either express or implied.  See the License for the
+  specific language governing permissions and limitations
+  under the License.
+-->
+<jmeterTestPlan version="1.2" properties="2.6" jmeter="2.11 r1554548">
+  <hashTree>
+    <TestPlan guiclass="TestPlanGui" testclass="TestPlan" testname="FortressLoadTester" 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">../../../config</stringProp>
+    </TestPlan>
+    <hashTree>
+      <CSVDataSet guiclass="TestBeanGUI" testclass="CSVDataSet" testname="CSV Data Set Config" enabled="false">
+        <stringProp name="delimiter">,</stringProp>
+        <stringProp name="fileEncoding"></stringProp>
+        <stringProp name="filename">AddPerm.csv</stringProp>
+        <boolProp name="quotedData">false</boolProp>
+        <boolProp name="recycle">true</boolProp>
+        <stringProp name="shareMode">shareMode.all</stringProp>
+        <boolProp name="stopThread">false</boolProp>
+        <stringProp name="variableNames"></stringProp>
+      </CSVDataSet>
+      <hashTree/>
+      <ThreadGroup guiclass="ThreadGroupGui" testclass="ThreadGroup" testname="Fortress AddPerm" 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>
+          <stringProp name="LoopController.loops">10000</stringProp>
+        </elementProp>
+        <stringProp name="ThreadGroup.num_threads">10</stringProp>
+        <stringProp name="ThreadGroup.ramp_time">10</stringProp>
+        <boolProp name="ThreadGroup.scheduler">false</boolProp>
+        <stringProp name="ThreadGroup.duration"></stringProp>
+        <stringProp name="ThreadGroup.delay"></stringProp>
+      </ThreadGroup>
+      <hashTree>
+        <JavaSampler guiclass="JavaTestSamplerGui" testclass="JavaSampler" testname="Fortress AddPerm" enabled="true">
+          <elementProp name="arguments" elementType="Arguments" guiclass="ArgumentsPanel" testclass="Arguments" enabled="true">
+            <collectionProp name="Arguments.arguments">
+              <elementProp name="ou" elementType="Argument">
+                <stringProp name="Argument.name">ou</stringProp>
+                <!-- Use one from JmeterTestPolicy.xml -->
+                <stringProp name="Argument.value">loadtestp</stringProp>
+                <stringProp name="Argument.metadata">=</stringProp>
+              </elementProp>
+              <elementProp name="perm" elementType="Argument">
+                <stringProp name="Argument.name">perm</stringProp>
+                <!-- Use one from JmeterTestPolicy.xml -->
+                <stringProp name="Argument.value">foo.exe</stringProp>
+                <stringProp name="Argument.metadata">=</stringProp>
+              </elementProp>
+              <elementProp name="sleep" elementType="Argument">
+                <stringProp name="Argument.name">sleep</stringProp>
+                <stringProp name="Argument.value">0</stringProp>
+                <stringProp name="Argument.metadata">=</stringProp>
+              </elementProp>
+            </collectionProp>
+          </elementProp>
+          <stringProp name="classname">org.apache.directory.fortress.core.jmeter.AddPerm</stringProp>
+        </JavaSampler>
+        <hashTree/>
+        <ResultCollector guiclass="SummaryReport" testclass="ResultCollector" testname="Summary Report" 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>