Skip to content

Commit

Permalink
March Update 2 (#17)
Browse files Browse the repository at this point in the history
* Correct detection of version for the PAS instance, and use that to drive API calls

* Update zip

* Introduce new "Load Testing" folder and contents for APSV and REST/WEB transport testing.

---------

Co-authored-by: DustinGrau-PSC <[email protected]>
  • Loading branch information
DustinGrau-PSC and DustinGrau-PSC authored Mar 30, 2023
1 parent d4f91a3 commit 51e5403
Show file tree
Hide file tree
Showing 21 changed files with 1,601 additions and 53 deletions.
35 changes: 35 additions & 0 deletions PAS/Load Testing/APSV/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
# APSV Testing #

A simple set of tools which demonstrates the use of parallel ANT tasks to place stress on the APSV transport. By default the included task will execute 5 batches of 10 client connections against the configured endpoint. The tests run for a set amount of time, executing requests against the AppServer, pausing, and running again. By default a session-managed model is used, together with a persistent procedure to produce bound clients on the PAS instance's ABL Application. This approach mimics a common pattern as observed in customer applications.

## Requirements ##

Use of **proant** is required to execute the **build.xml** included. This can be accessed via the `DLC/bin` directory, typically via a **PROENV** session. If necessary, ABL code may be compiled before deployment in an environment where a 4GL compiler is not available. A database is not provided nor required for this sample application.

- OpenEdge 11.7.x or 12.2+
- PAS for OpenEdge

## Deployment ##

### Server ###

For demonstrating a simple "Hello World" test, place the included **server/Business** folder within the PROPATH of an ABL Application on your PAS instance. Note the name of a WebApp associated with this ABL Application which has the APSV adapter enabled--this will be your means of access to the test code. The included **HelloProc.p** offers simple procedures to demonstrate 2 typical coding patterns for APSV:

1. **setHelloUser** and **sayHelloStoredUser** - Used to demonstrate a session-managed session-model where the remote procedure is run persistently. The former procedure is called to set a context value, while the latter performs the business logic to return the context value and an additional string.
2. **sayHello** - Simple procedure for the session-free session-model which accepts a character parameter and immediately returns a character response. (This test case is not currently configured, but exists as a basic sanity-check if/when needed.)

### Client ###

Simply run **proant** from this directory to obtain usage information as shown below. Parameters may be specified via command-line or by editing the `build.properties` file in advance. Note the parameters for port and webapp which will most likely need to be specified for your instance.

[echo] Usage Instructions:
[echo]
[echo] proant runtest - Run concurrent tests against the APSV transport using session-managed model
[echo] -Dbad=[true|false] - Run without cleaning up persistent procedure handles (Default: false)
[echo] -Dtype=[hello|looper] - Type of test to be run on the PAS instance (Default: hello)
[echo]
[echo] Standard parameters with their defaults:
[echo] -Dscheme=http
[echo] -Dhost=localhost
[echo] -Dport=8810
[echo] -Dwebapp=ROOT
11 changes: 11 additions & 0 deletions PAS/Load Testing/APSV/build.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# build.properties file
#
#scheme=http
#host=localhost
#port=8810
#webapp=ROOT
#
# Used for testAPSV target:
#bad=false
#verbose=true
#type=hello
259 changes: 259 additions & 0 deletions PAS/Load Testing/APSV/build.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,259 @@
<project name="TestingTools" basedir="." default="usage">

<!-- Utilize a local file for properties. Allows build.xml to provide defaults only. -->
<property file="${basedir}/build.properties"/>

<target name="usage" description="Usage Instructions">
<init_oe/> <!-- Set standard environment variables. -->

<echo message="${line.separator}"/>
<echo message="Run from a PROENV session or with DLC and DLC/bin in your PATH."/>
<echo message="${line.separator}Usage Instructions:"/>
<echo message="${line.separator} proant runtest - Run concurrent tests against the APSV transport of a PAS instance"/>
<echo message=" -Dproc.name=${proc.name} - Client procedure to execute as the concurrent test"/>
<echo message=" -Dproc.ext=${proc.ext} - Client procedure file extention"/>
<echo message=" -Dbad=${bad} - Run without cleaning up persistent procedure handles [true|false]"/>
<echo message=" -Dtype=${type} - Type of test for '${proc.name}${proc.ext}' to run on the PAS instance [hello|looper]"/>
<echo message="${line.separator}"/>
<echo message="${line.separator}Standard parameters with their defaults:"/>
<echo message=" -Dscheme=${scheme}"/>
<echo message=" -Dhost=${host}"/>
<echo message=" -Dport=${port}"/>
<echo message=" -Dwebapp=${webapp}"/>
</target>

<macrodef name="init_env">
<sequential>
<!-- Access environmental variables via "env.*". -->
<property environment="env"/>

<!-- Set a property if environment is Windows. -->
<condition property="isWin">
<os family="windows"/>
</condition>

<!-- Set a property if environment is Unix. -->
<condition property="isUnix">
<os family="unix"/>
</condition>

<!-- Set a property if environment is 32bit. -->
<condition property="is32bit">
<or>
<os arch="x86"/>
<os arch="i386"/>
</or>
</condition>

<!-- Set a property if environment is 64bit. -->
<condition property="is64bit">
<not>
<or>
<os arch="x86"/>
<os arch="i386"/>
</or>
</not>
</condition>

<!-- Set the script suffix for the OS. -->
<condition property="scriptSuffix" value=".sh" else=".bat">
<os family="unix"/>
</condition>

<!-- Set path delimiter for the OS. -->
<condition property="delim" value="/" else="\">
<os family="unix"/>
</condition>

<!-- Set general properties for this build file. -->
<property name="scheme" value="http"/>
<property name="host" value="localhost"/>
<property name="port" value="8810"/>
<property name="webapp" value="ROOT"/>
<property name="proc.name" value="testApsv"/>
<property name="proc.ext" value=".p"/>
<!-- Set specialized properties for the default test. -->
<property name="bad" value="false"/> <!-- Run with inefficient code cleanup practices. -->
<property name="verbose" value="true"/> <!-- Default to true, set false to suppress messages. -->
<property name="type" value="hello"/> <!-- Allows easy switching of test pre-configured cases. -->
</sequential>
</macrodef>

<macrodef name="init_oe">
<sequential>
<init_env/> <!-- Initialize environmental and general properties. -->

<!-- Fail immediately if not a 64-bit OS. -->
<fail message="Environment is not 64-bit">
<condition>
<not>
<isset property="is64bit"/>
</not>
</condition>
</fail>

<!-- Check if DLC is set as an environment variable. -->
<fail message="DLC Home path is not set">
<condition>
<and>
<not><isset property="dlcHome"/></not>
<not><isset property="env.DLC"/></not>
</and>
</condition>
</fail>
<property name="dlcHome" value="${env.DLC}"/>
<echo message="DLC Home: ${dlcHome}"/>

<!-- Assume the DLC WRK directory unless overridden. -->
<condition property="wrk" value="/usr/wrk" else="C:\OpenEdge\WRK">
<os family="unix"/>
</condition>

<!-- Load the current PCT library from DLC. -->
<taskdef resource="PCT.properties" classpath="${dlcHome}/pct/PCT.jar"/>
<!-- Define this property to disable anonymous PCT statistics telemetry. -->
<property name="pct.skip.analytics" value=""/>

<!-- Access the OE version info, and read into a property. -->
<ProgressVersion dlcHome="${dlcHome}" majorVersion="oeMajor" minorVersion="oeMinor" revision="oeRev" fullVersion="full"/>
<property name="oe.version" value="${oeMajor}.${oeMinor}.${oeRev}"/>
<echo message="OpenEdge Version: ${oe.version}"/>

<!-- Add the ANT-Contrib library to this environment (present in 11.7.4+ and 12.0+). -->
<taskdef resource="net/sf/antcontrib/antcontrib.properties" classpath="${dlcHome}/ant/lib/ant-contrib-0.6.jar"/>
</sequential>
</macrodef>

<macrodef name="require">
<!-- Usage <require file="_path_to_file_"/> -->
<attribute name="file"/>
<attribute name="message" default="File @{file} not set or missing"/>

<sequential>
<fail message="@{message}">
<condition>
<not>
<available file="@{file}" type="file"/>
</not>
</condition>
</fail>
</sequential>
</macrodef>

<macrodef name="requireDir">
<!-- Usage <requireDir folder="_path_to_folder_"/> -->
<attribute name="folder"/>
<attribute name="message" default="Directory @{folder} not set or missing"/>

<sequential>
<fail message="@{message}">
<condition>
<not>
<available file="@{folder}" type="dir"/>
</not>
</condition>
</fail>
</sequential>
</macrodef>

<macrodef name="tester">
<attribute name="batch"/>
<attribute name="run"/>

<sequential>
<echo message="Initiating test @{batch}.@{run} of ${num.batches}..."/>
<!-- Execute the client test procedure with options (eg. logging) and parameters. -->
<PCTRun
dlcHome="${dlcHome}"
graphicalMode="false"
procedure="client/${proc.name}${proc.ext}">
<Option name="-clientlog" value="${log.dir}/client-@{batch}.@{run}.log"/>
<Option name="-logginglevel" value="${log.level}"/>
<Option name="-logentrytypes" value="${log.types}"/>

<!-- Provide connection information to the client test procedure. -->
<Parameter name="scheme" value="${scheme}"/>
<Parameter name="host" value="${host}"/>
<Parameter name="port" value="${port}"/>
<Parameter name="webapp" value="${webapp}"/>

<!-- These are informational and optional for use. -->
<Parameter name="tests" value="${num.batches}"/> <!-- Total number of batched tests. -->
<Parameter name="test" value="@{batch}.@{run}"/> <!-- Will show as 1.0, 1.1, etc. -->

<!-- The following are specific parameters to the client test procedure. -->
<Parameter name="pause" value="${pause.time}"/>
<Parameter name="duration" value="${test.time}"/>
<Parameter name="waitAfter" value="${wait.time}"/>
<Parameter name="badCode" value="${bad}"/>
<Parameter name="verbose" value="${verbose}"/>
<Parameter name="type" value="${type}"/>
</PCTRun>
</sequential>
</macrodef>

<target name="_runbatch">
<echo message="Running batch ${batch} of ${num.batches}..."/>

<!-- Run a batch of 10 tests. -->
<parallel failonany="false">
<tester batch="${batch}" run="0"/>
<tester batch="${batch}" run="1"/>
<tester batch="${batch}" run="2"/>
<tester batch="${batch}" run="3"/>
<tester batch="${batch}" run="4"/>
<tester batch="${batch}" run="5"/>
<tester batch="${batch}" run="6"/>
<tester batch="${batch}" run="7"/>
<tester batch="${batch}" run="8"/>
<tester batch="${batch}" run="9"/>
</parallel>
</target>

<target name="runtest">
<init_oe/> <!-- Initialize all OpenEdge properties. -->

<!-- Should match the number of batches defined below. -->
<property name="num.batches" value="5"/>

<!-- Set variables for the test behavior. -->
<property name="pause.time" value="5"/> <!-- How long to wait between iterations of internal tests. -->
<property name="test.time" value="60"/> <!-- Overall testing time (main loop execution). -->
<property name="wait.time" value="2"/> <!-- How long to wait after main loop completes. -->
<property name="log.level" value="2"/>
<property name="log.types" value="DB.Connects"/>
<property name="log.dir" value="${basedir}/logs"/>

<!--
Override properties above like normal, eg.:
-Dlog.level=5 -Dlog.types=4GLTrace:4
-->

<!-- Create an output directory for log files. -->
<mkdir dir="${log.dir}"/>

<!-- Run a set of batches in parallel (10 tests per batch). -->
<parallel failonany="false">
<antcall target="_runbatch">
<param name="batch" value="1"/>
</antcall>

<antcall target="_runbatch">
<param name="batch" value="2"/>
</antcall>

<antcall target="_runbatch">
<param name="batch" value="3"/>
</antcall>

<antcall target="_runbatch">
<param name="batch" value="4"/>
</antcall>

<antcall target="_runbatch">
<param name="batch" value="5"/>
</antcall>
</parallel>
</target>

</project>
Loading

0 comments on commit 51e5403

Please sign in to comment.