ATS : Building and deploying an Agent Component

You have created your Agent component here

Now it is time to build it.



Building

In Java world, it is easiest to have class and other resources packaged into JAR files.

Currently, we use Maven for all ATS projects, but there is one piece left that still needs to be done by Ant.

This piece is the code building your Agent components.

Currently Ant is invoked within Maven. We will update this documentation after making this part to run entirely within Maven.

So for now you need to copy this the pom.xml and build.xml files into the root project folder.

Prior to running these files, you may want to change:

  • The used ATS version as declared in the pom.xml
  • The component.name parameter in the build.xml
  • The class packages in the agent-component-generate-client Ant target.

Currently, all this info is set according to the User Guide examples.

After running the pom.xml, Maven will retrieve the ATS artifacts and will then start Ant with the build.xml file.

If everything goes as OK a few seconds later you will see a new folder target and in its dist subfolder, there will be two JAR files.

You can go ahead and open these two JAR files to see their content.

The produced server-side JAR

We call it a server-side JAR because it will operate on the side of the Agent. Its name ends with -autoserver.jar because this is how we set it by the build script. This JAR will work like a service accepting commands from the client-side JAR.

It has all action classes and their source files in the root folder.

It also has the agent_descriptor.xml in its META-INF subfolder.

The produced client-side JAR

We call it a client-side JAR because it will operate on the side of the Test Executor. Its name ends with -autoclient.jar because this is how we set it by the build script.

It also contains classes with the same names as the ones in the server-side JAR, but if you open them you will be surprised by their content.

These classes have the same names, their methods have the same names and input arguments as the server-side ones, but their body is very different.

All classes in the client-side JAR are simple and generated by the build procedure and they only contain instructions for the Agent so it knows which server-side class should be executed. Client classes are just like a convenient proxy for local-like execution of the Agent classes (a.k.a. Actions).

But you do not really need to bother with them in detail. The simple effect is that by using the client-side class you easily and transparently execute remote code (on the Agent). Also, the execution result is available locally on Test Executor.



Deploying

The client-side JAR

This one must be present in the classpath of the Test Executor. From that point on you can use them in your test code.

The server-side JAR

This one must be placed in the ats-agent\actions subfolder of your ATS Agent distribution.

Even a fresh Agent will have some such components already available. These are the ones ATS uses internally to do something (like filesystem operations) on the host the Agent is working on.

In case your actions depend on some other third party classes, you must place their JARs in the ats-agent/actions_dependencies subfolder of your ATS Agent distribution.

You do not have to restart the Agent in case of replacing your component JAR as the ats-agent/actions subfolder is constantly monitored and the changes will be picked up in a few seconds.

But you will need to restart the Agent when placing JARs in the ats-agent/actions_dependencies subfolder.

The Agent log file (placed in logs subfolder) will tell you when your component is found and will list the loaded action class names.



Proceed with running your actions in some performance test.

Back to parent page

Go to Table of Contents