Differences
This shows you the differences between two versions of the page.
| Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
| writehandler [2017/03/12 20:25] – [Create Java Handler] admin | writehandler [2020/05/10 03:38] (current) – removed admin | ||
|---|---|---|---|
| Line 1: | Line 1: | ||
| - | ===== Writing a Java Handler ===== | ||
| - | |||
| - | Java Handler is a java class you write for a specific model to perform the desired action when model executes, which is typically used to perform test automation, saving test steps (test sequence) into a file (either tab delimited file or automation script for external test automation tools) or visualize workflows. | ||
| - | |||
| - | ==== Create Java Handler ==== | ||
| - | |||
| - | The java handler class must implement // | ||
| - | |||
| - | The easiest way to create the handler class is to let // | ||
| - | |||
| - | |||
| - | The generated java code (skeleton code) should be displayed as a text file. Copy and paste the java code into your favorite java editor and add your implementation java code for each class method accordingly. See {{http:// | ||
| - | |||
| - | You may need to add // | ||
| - | |||
| - | ==== Deploy Java Handler ==== | ||
| - | |||
| - | There are two ways to deploy the java handler class | ||
| - | |||
| - | * Java source code | ||
| - | * Compiled jar file | ||
| - | |||
| - | |||
| - | === Deploy Java Source File === | ||
| - | Copy your java handler source code (*.java) into one of the following locations: | ||
| - | |||
| - | * //your model/// - preferred location so that your java handler code is stored within your model. | ||
| - | * //script/// - common folder accessible to all models. | ||
| - | |||
| - | The source code file name must represent the full class path. For example, if you declare java handler class within a java package, for example // | ||
| - | |||
| - | Your java source code will be dynamically compiled - you do not need to restart // | ||
| - | |||
| - | === Deploy Jar File === | ||
| - | You may pre-compile your java handler class into a //jar// file and copy the //jar// file into //lib/// folder. You must restart // | ||
| - | |||
| - | |||
| - | === Which Deployment Option Should I Use? === | ||
| - | |||
| - | The advantage of //Deploy Java Source Code// is that you can make changes to the java source code and just re-run the model to test your changes. | ||
| - | |||
| - | However the disadvantage of this option is that all of the dependent java packages/ | ||
| - | |||
| - | The advantage of //Deploy Jar File// is that you can package up all java classes including your handler class into a nice //jar// file and deploy it. This option works the best if you have to create many java classes besides handler class necessary to perform the model actions. | ||
| - | |||