<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!--
- Licensed Materials - Property of IBM* and/or HCL**
- UrbanCode Deploy
- (c) Copyright IBM Corporation 2013, 2017. All Rights Reserved.
- (c) Copyright HCL Technologies Ltd. 2018, 2019. All Rights Reserved.
-
- U.S. Government Users Restricted Rights - Use, duplication or disclosure restricted by
- GSA ADP Schedule Contract with IBM Corp.
-
- * Trademark of International Business Machines
- ** Trademark of HCL Technologies Limited
--><plugin xmlns="http://www.urbancode.com/PluginXMLSchema_v1" xmlns:server="http://www.urbancode.com/PluginServerXMLSchema_v1" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">

  <!--  ===================================================================
        Metadata
        ===================================================================  -->
  <header>
    <identifier id="com.hcl.urbancode.air.plugin.rtas" name="IBM DevOps Test Hub" version="4"/>
    <description>
      The IBM DevOps Test Hub DD-IBM plugin allows communication with the IBM DevOps Test Hub.
    </description>
    <tag>IBM DevOps Test Workbench/IBM DevOps Test Hub</tag>
  </header>

  <!--  ==================================================================
        Start Job Task
        ==================================================================  -->
  <step-type name="Run IBM DevOps Test Hub test">
    <description>
      Start a job on IBM DevOps Test Hub.
    </description>
    <properties>
      <property name="serverUrl" required="true">
        <property-ui description="The URL of your IBM DevOps Test Hub." label="IBM DevOps Test Hub URL" type="textBox"/>
      </property>
      <property name="offlineToken" required="true">
        <property-ui description="IBM DevOps Test Hub Offline Token" hidden="false" label="Offline Token" type="secureBox"/>
      </property>
      <property name="teamspace" required="true">
        <property-ui description="Team Space name of the project." hidden="false" label="Team Space Name" type="textBox"/>
      </property>
      <property name="projName" required="true">
        <property-ui description="Project Name of the job to run." hidden="false" label="Project Name" type="textBox"/>
      </property>
      <property name="branchName">
        <property-ui default-value="master" description="Branch Name of the job to run. Defaults to master." hidden="false" label="Branch Name" type="textBox"/>
      </property>
      <property name="repoName" required="true">
        <property-ui description="Repository Link for the job to run." hidden="false" label="Repository Link" type="textBox"/>
      </property>
      <property name="filepath" required="true">
        <property-ui description="Path to the IBM DevOps Test Hub test file." label="File Path" type="textBox"/>
      </property>

      <property name="datasets">
        <property-ui description="Optional semicolon (;) delimited list of datasets:replacement for the job to run, For example. (dataset1:dataset2;dataset3:dataset4)" hidden="false" label="Datasets" type="textBox"/>
      </property>
      <property name="variables">
        <property-ui description="Runtime job variables, for example name1=value1;name2=value2" hidden="false" label="Variables" type="textBox"/>
      </property>
      <property name="tags">
        <property-ui description="Comma (,) delimited list of labels for the job to run." hidden="false" label="Labels" type="textBox"/>
      </property>
      <property name="secretsCollectionName">
        <property-ui description="Secrets collection name for the job to run." hidden="false" label="Secrets Collection Name" type="textBox"/>
      </property>
      <property name="ritEnv">
        <property-ui description="Environment for the job to run, only applicable for Api Test." hidden="false" label="Environment" type="textBox"/>
      </property>
      <property name="trustStorePath">
        <property-ui description="Path to the custom trust store including the file name. This trust store must include the certificate of the CA that issued the SSL certificate of your IBM DevOps Test Hub instance or the SSL certificate of your IBM DevOps Test Hub instance. This field cannot be left blank when the SSL certificate of your IBM DevOps Test Hub instance is signed by an internal CA or when you're unable to establish secure connection to your IBM DevOps Test Hub instance. Otherwise it can be left blank." hidden="false" label="Custom Trust Store Path" type="textBox"/>
      </property>
      <property name="trustStorePassword">
        <property-ui description="Password of the custom trust store. This field can be left blank if the default password of the custom trust store hasn't been modified." hidden="false" label="Custom Trust Store Password" type="secureBox"/>
      </property>
      <property name="proxyHost">
        <property-ui description="Provide the hostname of the HTTP proxy to use to connect to IBM DevOps Test Hub. Eg proxy.domain.com" hidden="true" label="HTTP Proxy Host" type="textBox"/>
      </property>
      <property name="proxyPort">
        <property-ui description="Provide the port number of the HTTP proxy to use to connect to IBM DevOps Test Hub." hidden="true" label="HTTP Proxy Port" type="textBox"/>
      </property>
      <property name="proxyUser">
        <property-ui description="Provide the user name to authenticate with HTTP proxy." hidden="true" label="HTTP Proxy User name" type="textBox"/>
      </property>
      <property name="proxyPass">
        <property-ui description="Provide the password to authenticate with HTTP proxy." hidden="true" label="HTTP Proxy Password" type="secureBox"/>
      </property>

    </properties>
    <post-processing><![CDATA[
        if (properties.get("exitCode") != 0) {
            properties.put(new java.lang.String("Status"), new java.lang.String("Failure"));
        }
     ]]></post-processing>
    <command program="${GROOVY_HOME}/bin/groovy">
      <arg value="-cp"/>
      <arg path="classes:lib/httpclient-4.5.3.jar:lib/httpcore-4.4.1.jar:lib/commons-codec-1.13.jar:lib/commons-logging-1.2.jar:lib/jsoup-1.8.3.jar:lib/gson-2.3.1.jar:lib/groovy-all-1.3-2.5.4.jar"/>
      <arg file="UCDRunner.groovy"/>
      <arg file="${PLUGIN_INPUT_PROPS}"/>
      <arg file="${PLUGIN_OUTPUT_PROPS}"/>
    </command>
  </step-type>

</plugin>
