Open Source RDBMS - Seamless, Scalable, Stable and Free

한국어 | Login |Register

How to develop plugin


The following describes the plugin structure in nGrinder. nGrinder uses the Atlanssian Plugin Framwork to customize nGrinder behavior without modifying nGrinder core code. nGrinder supports the following plugin extension points.

Extension Interface

Extension Point Name
(Plugin-Key)

Description

version

OnLoginRunnable

on-login

loadUser is invoked whenever user info is required, Therefore if you like to allow not-yet-registered users to access ngrinder without explicit registration, you have to write the loadUser to load the user info from external user store procedure. Then this will invoke validateUser method to check  the user provides the valid password for the given id. If you have the external server which is able to validate the user with the given id and password, you can use it for the user validation.
Default plugin embedded in nGrinder can be found in here.

OnTestSamplingRunnable

on-test-sampling

This is a place to invoke external logic which should be executed whenever the sampling is started, is performed, and stopped. For example, If you have to monitor external servers using your own logic, you can use this extension point to retrieve them. sampling method should be very fast. we're expecting sampling method should be done within 2 ms. If it takes more time to finish this method, it can eventually ruin the performance test sampling. So we're highly recommend the plugin implementer to invoke another thread which retrieves the data in the startSampling method and fetch the already retrieved data from this thread in sampling method.
You can find the sample implementation here

OnControllerLifeCycle
Runnable

on-start

This is the plugin extension point to invoke your logic when the start and shutdown nGrinder controller.

OnPeriodicWorking
AgentCheckRunnable

on-working-agent-check

This is the plugin extension point to invoke your logic with the current agent status periodically. You can find the sample implementation here. This sample checks the current controllers whole agent's network usages and if it is over the designated traffics, stops all running test to block the network overflow.

OnTestLifeCycleRunnable on-test-start

This is the plugin extension point to invoke your logic when the test is executed and stopped.

 

javax.servlet.Filter

on-servletfilter

This is only one interface which ngrinder itself does not define. You should import as a servlet dependency in the plugin’s pom.xml to extend this interface.

<!-- Servlet -->
<dependency>
   <groupId>javax.servlet</groupId>
   <artifactId>servlet-api</artifactId>
   <version>2.5</version>
   <scope>provided</scope>
</dependency>


The plugin will be located in the servlet filter chain. Therefore if you need to intercept the HTTPRequest or HTTPResponse to modify the WAS level behavior, you should implement this plugin. The sample implementation can be found here.

javax.servlet.Filter

on-preauth-servletfilter This is the same extension point as on-servletfilter but it’s located before pre-auth by spring security is executed. The most common usage of this extension point is to allow SSO(such as SiteMinder) which is already processed by web servers like apache httpd.
The sample implementation can be found here.
 

<groupId>place any plugin group id</groupId>
<artifactId>place any plugin artifact id</artifactId>
<version>place your plugin version number</version>
<name>place any prefered name</name>

<atlassian-plugin key="any key of this plugin" name="the plugin name" plugins-version="2">
    <plugin-info>
        <version>1.0.0</version>
    </plugin-info>
<!—fix below plugin-key name with the plugin key you like to extend. <{plugin-key} key="any extension name" class="full class name of which extends the plugin interface" /> </atlassian-plugin>
  • Package it with atals-package.sh or atlas-package.bat command and see the packaged jar file in the target folder.
  • Copy this to ${NGRINDER_HOME}/plugins folder.
  • That's it.
comments powered by Disqus
Page info
viewed 1679 times
translations en
Author
posted 11 months ago by
junoyoon
Contributors
updated 8 months ago by
View revisions
tagged
Share this article