Differences
This shows you the differences between two versions of the page.
| Both sides previous revision Previous revision Next revision | Previous revision | ||
|
tutorial:plugins [2020/06/08 03:02] admin [Develop custom plugin] |
tutorial:plugins [2021/01/10 17:58] (current) admin [Using Custom Plugin] |
||
|---|---|---|---|
| Line 1: | Line 1: | ||
| - | ====== Tutorial: Plugins ====== | + | ====== Tutorial: |
| + | |||
| + | ====Learning Objectives==== | ||
| + | * [[#What does a plugin do?]] | ||
| + | * [[#Develop custom plugin]] | ||
| + | * [[#Deploy custom plugin]] | ||
| + | * [[#Using custom plugin]] | ||
| + | |||
| + | |||
| + | ===== What does a plugin do?===== | ||
| + | Plugin extends capability that enables your script to interact with AUT like [[plugins# | ||
| - | Learning Objectives: | ||
| - | * What does a plugin do? | ||
| - | * System plugins | ||
| - | * Develop custom plugin | ||
| - | * Deploy custom plugin | ||
| - | * Sharing custom plugin | ||
| ===== Develop custom plugin ===== | ===== Develop custom plugin ===== | ||
| Line 12: | Line 17: | ||
| Before we can start building our custom plugin, we need to set up the java development environment: | Before we can start building our custom plugin, we need to set up the java development environment: | ||
| - | * create a java project | + | * create a java maven project |
| - | * add toplugin.jar | + | * add following maven dependency |
| + | |||
| + | < | ||
| + | < | ||
| + | < | ||
| + | < | ||
| + | </dependency> | ||
| Now we are ready to build our first custom plugin in Eclipse: | Now we are ready to build our first custom plugin in Eclipse: | ||
| Line 20: | Line 32: | ||
| * add @TO_PLUGIN annotation to your java class | * add @TO_PLUGIN annotation to your java class | ||
| * implement required methods | * implement required methods | ||
| - | * add your plugin functions, declare as public functions | + | * add your plugin functions |
| Below is an example of the java class: | Below is an example of the java class: | ||
| Line 61: | Line 73: | ||
| } | } | ||
| - | By default, all public methods declared as well as inherited are exposed as MScript function. | + | By default, all public methods declared as well as inherited are exposed as MScript function. |
| Don't forget to write junit test to test the plugin functions. | Don't forget to write junit test to test the plugin functions. | ||
| Line 67: | Line 79: | ||
| ===== Deploy Custom Plugin ===== | ===== Deploy Custom Plugin ===== | ||
| - | Export project as jar file | + | * Export project as jar file |
| - | Copy plugin jar file to /lib folder in // | + | |
| - | Register your plugin package in config.properties: | + | |
| - | | + | |
| Above registry tells // | Above registry tells // | ||
| - | Restart TestOptimal server to make the changes effective. | + | * Restart TestOptimal server to make the changes effective. |
| + | |||
| + | ===== Using Custom Plugin ===== | ||
| + | Plugins must be activated before they can be used in the script. | ||
| + | |||
| + | * Open an existing model or create a new model | ||
| + | * Select //SCRIP//T tab | ||
| + | * Click on " | ||
| + | * Check the checkbox for your custom plugin | ||
| + | * Close Plugin Activation dialog | ||
| - | ====Use Custom Plugin ==== | + | Press // |
| - | Open an existing model or create a new model | + | |
| - | Select SCRIPT tab | + | |
| - | Click on " | + | |
| - | Check the checbox for your custom plugin | + | |
| - | Your plugin should show up on CodeAssist list as // | + | |