gt:             log(myName, Constants.VERBOSE, myArea, logMessage);
context: /**
   * This purpose of this fixture is to call a PowerCenter workflow via a webservice call.
   * The input parameters are provided by a table in the FitNesse wiki. 
   * @author Jac Beekers
   * @version 20160122.0
   * @since March 2014
   */
  package nl.jacbeekers.testautomation.fitnesse.powercenter;
  
  import com.informatica.wsh.*;
  
  import nl.jacbeekers.testautomation.fitnesse.supporting.Constants;
  import nl.jacbeekers.testautomation.fitnesse.supporting.GetParameters;
  import nl.jacbeekers.testautomation.fitnesse.supporting.Logging;
  
  import java.io.*;
  
  
  import java.net.URL;
  
  import java.text.SimpleDateFormat;
  
  import java.util.ArrayList;
  import java.util.Enumeration;
  import java.util.List;
  import java.util.Properties;
  
  import javax.xml.namespace.QName;
  import javax.xml.ws.WebServiceRef;
  
  
  public class StartWorkflow {
  
      private static String version = "20160122.0";
      private String className = "StartWorkflow";
      private String logFileName = Constants.NOT_INITIALIZED;
      private String startDate = Constants.NOT_INITIALIZED;
      private String context = Constants.DEFAULT;
      private int logLevel = 3;
      private int logEntries = 0;
      private String logUrl=Constants.LOG_DIR;
      private String resultFormat =Constants.DEFAULT_RESULT_FORMAT;
  
  
      private String folder;
      private String application;
      //connectivity
      private String workflowName;
      private String domainName;
      private String repoName;
      private String serviceName;
      private String userName;
      private String passWord;
  
      //wsdl
      private String WsdlUrl;
      private static URL wsdlLocationURL;
      DataIntegrationService diService;
  
      private String abortYesNo = Constants.YES;
      private boolean userSetAbortOnError = false;
  
      List<String> appProps = new ArrayList<String>();
  
  
      private String parameterFileName;
      private String parameterDirectory;
      //	protected String return_message = Constants.NOT_INITIALIZED;
      private String workflowResult, FirstErr, LastErr, FirstErrCode, RowsTarget, RowsSource, Duration =
          Constants.NOT_INITIALIZED;
      private int NumSrcFailedRows, NumSrcSuccessRows, NumDuration, NumTables, NumTgtFailedRows, NumTgtSuccessRows, NumTransErrors, NumEndTime, NumStartTime 
          =0;
  
      private int repeat=1;
      List<String> iterationReturnCodes = new ArrayList<String>();
  
      @WebServiceRef
      private static MetadataService metadataService;
  
      public StartWorkflow() {
          // Constructor
          java.util.Date started = new java.util.Date();
          SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMddHHmmss");
          startDate = sdf.format(started);
          context = className;
          logFileName = startDate + "." + className;
          readParameterFile();
          readInfaProcessProperties();
  
      }
  
      /**
       * @param context
       */
      public StartWorkflow(String context) {
          // Constructor
          java.util.Date started = new java.util.Date();
          SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMddHHmmss");
          startDate = sdf.format(started);
          this.context = context;
          logFileName = startDate + "." + className + "." + context;
          readParameterFile();
          readInfaProcessProperties();
  
      }
  
      /**
       * @param abortYesNo
       * @throws WorkflowStopTest
       */
      public void setAbortOnError(String abortYesNo) throws WorkflowStopTest {
          //Function to set abort on error, i.e. if workflowstoptest should be thrown in case of exceptions
          userSetAbortOnError = true;
          if (abortYesNo == null || abortYesNo.isEmpty()) {
              this.abortYesNo = Constants.DEFAULT_ABORTONERROR;
          } else {
              if (Constants.YES.equals(abortYesNo) || Constants.NO.equals(abortYesNo)) {
                  this.abortYesNo = abortYesNo;
              } else {
                  String myName = "setAbortOnError";
                  String myArea = "Error";
                  String logMessage =
                      "Invalid value =>" + abortYesNo + "< specified for abort on error. Must be =>" + Constants.YES +
                      "< or =>" + Constants.NO + "<.";
                  log(myName, Constants.FATAL, myArea, logMessage);
                  throw new WorkflowStopTest(logMessage);
              }
          }
      }
  
      public String getAbortOnError() {
          return this.abortYesNo;
      }
  
      /**
       * @param application
       */
      public void setApplication(String application) {
          this.application = application;
      }
  
      public String getApplication() {
          return this.application;
      }
  
      /**
       * @param folder
       */
      public void setFolder(String folder) {
          this.folder = folder;
      }
  
      /**
       * @param workflowName
       */
      public void setWorkflowName(String workflowName) {
          //Function to get workflow name or DAC run name from row in fitnesse table
          this.workflowName = workflowName;
      }
  
      /**
       * @param parameterFile
       */
      public void setParameterFile(String parameterFile) {
          this.parameterFileName = parameterFile;
      }
  
      /**
       * @param parameterDirectory
       */
      public void setParameterDirectory(String parameterDirectory) {
          this.parameterDirectory = parameterDirectory;
      }
  
      /**
       * @return
       */
      public String error() {
          //let's get the first error msg from pwc repository
          if ("0".equals(FirstErrCode)) {
              return LastErr;
          } else {
              return FirstErr;
          }
      }
  
      private void setError(String errCode, String errMsg) {
          FirstErrCode = errCode;
          FirstErr = errMsg;
          log("setError", Constants.INFO, "set error code",
              "FirstErrCode set to >" + errCode + "< and FirstErr set to >" + errMsg);
      }
  
      public String getErrorCode() {
          return FirstErrCode;
      }
      
      /**
       * @return
       */
      public String sourceRows() {
          if (Constants.UNKNOWN.equals(RowsSource)) {
              return Integer.toString(NumSrcSuccessRows);
          } else {
              return RowsSource;
          }
      }
  
      /**
       * @return
       */
      public String duration() {
          NumDuration = NumEndTime - NumStartTime;
          return Integer.toString(NumDuration);
      }
  
      /**
       * @return
       */
      public String startTime() {
          return Integer.toString(NumStartTime);
      }
  
      /**
       * @return
       */
      public String endTime() {
          return Integer.toString(NumEndTime);
      }
  
      /**
       * @return
       */
      public String targetRows() {
          if (Constants.UNKNOWN.equals(RowsTarget)) {
              return Integer.toString(NumTgtSuccessRows);
          } else {
              return RowsTarget;
          }
      }
  
      /**
       * @return
       */
      public int sourceSuccessRows() {
          return NumSrcSuccessRows;
      }
  
      /**
       * @return
       */
      public int sourceFailedRows() {
          return NumSrcFailedRows;
      }
  
      /**
       * @return
       */
      public int numTables() {
          return NumTables;
      }
  
      /**
       * @return
       */
      public int targetFailedRows() {
          return NumTgtFailedRows;
      }
  
      /**
       * @return
       */
      public int targetSuccessRows() {
          return NumTgtSuccessRows;
      }
  
      /**
       * @return
       */
      public int tranformationErrors() {
          return NumTransErrors;
      }
  
      private String getSession() throws WorkflowStopTest {
          // create a session with PowerCenter web service hub
          String myName = "getSession";
          String myArea = "undetermined";
          String logMessage = "none";
          String sessionID = Constants.NOT_INITIALIZED;
          String rc = Constants.OK;
  
          myArea = "initialization";
          logMessage = "start";
          log(myName, Constants.INFO, myArea, logMessage);
  
  
          try {
              myArea = "Create Session";
              String infaWsh = "http://www.informatica.com/wsh";
              String dataIntService = "DataIntegrationService";
              logMessage = "Getting QN using >" + infaWsh + "< and >" + dataIntService + "<.";
              log(myName, Constants.VERBOSE, myArea, logMessage);
              QName qn = new QName(infaWsh, dataIntService);
              logMessage = "Created QN. String =>" + qn.toString() + "<.";
              log(myName, Constants.VERBOSE, myArea, logMessage);
              logMessage = "Created QN. Prefix =>" + qn.getPrefix() + "<.";
              log(myName, Constants.VERBOSE, myArea, logMessage);
              logMessage = "Created QN. LocalPart =>" + qn.getLocalPart() + "<.";
              log(myName, Constants.VERBOSE, myArea, logMessage);
              logMessage = "Created QN. Namespace =>" + qn.getNamespaceURI() + "<.";
              log(myName, Constants.VERBOSE, myArea, logMessage);
  
              logMessage = "Getting DataIntegrationService for URL >" + WsdlUrl + "< and QN >" + qn.toString() + "<.";
              log(myName, Constants.DEBUG, myArea, logMessage);
              wsdlLocationURL = new URL(WsdlUrl);
              logMessage = "wsdlLocationURL url is >" + wsdlLocationURL.toString() + "<.";
              log(myName, Constants.VERBOSE, myArea, logMessage);
  
              diService = new DataIntegrationService(wsdlLocationURL, qn);
              logMessage = "Created diService for wsdlLocationURL =>" + wsdlLocationURL.toString() + "<.";
              log(myName, Constants.VERBOSE, myArea, logMessage);
  
  
          } catch (Exception e) {
              myArea = "Exception GetSession";
              logMessage = "Exception occurred in CreateSession. Error >" + e.toString() + "<.";
              rc = Constants.FATAL;
              String logCode = "INFAPWC0001";
              setError(logCode, e.toString());
              log(myName, Constants.FATAL, myArea, logCode);
              if (Constants.YES.equals(abortYesNo)) {
                  workflowResult = Constants.FATAL;
                  throw new WorkflowStopTest(logCode);
              }
          }
  
          if (rc.equals(Constants.OK)) {
              logMessage = "LoginRequest instantiation...";
              log(myName, Constants.VERBOSE, myArea, logMessage);
              LoginRequest loginReq = new LoginRequest();
              logMessage = "Getting diService Data Integration reference...";
              log(myName, Constants.VERBOSE, myArea, logMessage);
              DataIntegrationInterface diInterface = diService.getDataIntegration();
  
              logMessage = "setting user name for Login to =>" + userName + "<.";
              log(myName, Constants.VERBOSE, myArea, logMessage);
              loginReq.setUserName(userName);
              logMessage = "setting password for Login.";
  