Search code examples
javascriptpolarion

Polarion EventtriggerConfiguration


I have a questen in relation to scripts in Polarion. I want to develop some scripts to automate a few functions in Polarion. I downloaded a offline version of Polarion to have a seperated test area. Then I included a few Projects from the "online" Polarion server. Unfortunately I had to find out that the scripts with the EventTriggerConfiguration are no longer called offline(No logs are created). I dont understand why these trigger is not working offline.

    <EventTriggerConfiguration> 
    <WorkItem> 
        <type id="task"> 
            <event trigger="post-save"> 
                <script> 
                    <scriptName>project:scripts:createReviewWIPostSavenew.js</scriptName> 
                    <scriptEngine>js</scriptEngine> 
                </script> 
            </event> 
        </type> 
    </WorkItem>  
    <WorkItem> 
        <type id="task"> 
            <event trigger="pre-save"> 
                <script> 
                    <scriptName>project:scripts:createTaskWIPreSavenew.js</scriptName> 
                    <scriptEngine>js</scriptEngine> 
                </script> 
            </event> 
        </type> 
    </WorkItem> 
</EventTriggerConfiguration>

All files of the projects are the same and the triggers.xml is located at: .polarion/events. The scripts in the directory scripts. The type id "task" is also defined in Administration/WorkItems/Types


Solution

  • I managed to trigger the script!

    You have to first add the Polarion Scripting Engine plugin (search for Polarion PSO SE). Then edit polarion.properties (/opt/polarion/etc/polarion.properties) and add the following lines:

    com.polarion.eventhandler.trigger.monitor.enable = true
    com.polarion.platform.loggingServiceInterceptor.enabled = false
    

    Source for this: https://professionalservices.polarion.com/support/ScriptingEngine/

    My local tigger file is as follow: repo/test/.polarion/events/triggers.xml:

     <EventTriggerConfiguration>
        <WorkItem>
            <type id="task">
                <event trigger="pre-save">
                    <script>
                        <scriptName>PreTest.js</scriptName>
                        <scriptEngine>javaScript</scriptEngine>
                    </script>
                </event>
                <event trigger="post-save">
                    <script>
                        <scriptName>PostTest.js</scriptName>
                        <scriptEngine>javaScript</scriptEngine>
                    </script>
                    <script>
                        <scriptName>PostTest2.js</scriptName>
                        <scriptEngine>javaScript</scriptEngine>
                    </script>
                </event>
            </type>
        </WorkItem>
     </EventTriggerConfiguration>
    

    After a polarion restart, I now get proper error messages from Polarion UI as well as log. (My script was broken anyways).