// Path: test-automation-framework/org.wso2.carbon.automation.engine/src/main/java/org/wso2/carbon/automation/engine/exceptions/AutomationFrameworkException.java
// public class AutomationFrameworkException extends Exception {
//     public AutomationFrameworkException(String message) {
//         super(message);
//     }
// 
//     public AutomationFrameworkException(String message, Throwable e) {
//         super(message, e);
//     }
// 
//     public AutomationFrameworkException(Throwable e) {
//         super(e);
//     }
// }


import org.apache.axiom.om.OMAbstractFactory;
import org.apache.axiom.om.OMElement;
import org.apache.axiom.om.OMFactory;
import org.apache.axiom.om.OMNamespace;
import org.apache.axiom.om.util.AXIOMUtil;
import org.apache.axis2.AxisFault;
import org.apache.axis2.addressing.EndpointReference;
import org.apache.axis2.client.Options;
import org.apache.axis2.client.ServiceClient;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.wso2.carbon.automation.engine.exceptions.AutomationFrameworkException;
import javax.xml.stream.XMLStreamException;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.net.MalformedURLException;
import java.net.URL;
import java.nio.charset.Charset;
import java.util.List;
import static org.testng.Assert.assertFalse;
import static org.testng.Assert.fail;
            } catch (IOException e) {
                return false;
            } finally {
                if (in != null) {
                    in.close();
                }
            }
        }
        return false;
    }

    public static void waitForServiceDeployment(String serviceUrl) throws IOException {
        int serviceTimeOut = 0;
        while (!isServiceAvailable(serviceUrl)) {
            if (serviceTimeOut == 0) {
            } else if (serviceTimeOut > 100) { //Check for the service for 100 seconds
                // if Service not available assertfalse;
                fail(serviceUrl + " service is not found");
                break;
            }
            try {
                Thread.sleep(500);
                serviceTimeOut++;
            } catch (InterruptedException ignored) {
            }
        }
    }

    public static void sendRequest(String eprUrl, String operation, String payload,
                                   int numberOfInstances, List<String> expectedStrings,
// Path: test-automation-framework/org.wso2.carbon.automation.engine/src/main/java/org/wso2/carbon/automation/engine/exceptions/AutomationFrameworkException.java
// public class AutomationFrameworkException extends Exception {
//     public AutomationFrameworkException(String message) {
//         super(message);
//     }
// 
//     public AutomationFrameworkException(String message, Throwable e) {
//         super(message, e);
//     }
// 
//     public AutomationFrameworkException(Throwable e) {
//         super(e);
//     }
// }


// Path: test-automation-framework/org.wso2.carbon.automation.test.utils/src/main/java/org/wso2/carbon/automation/test/utils/axis2client/AxisServiceClientUtils.java
import org.apache.axiom.om.OMAbstractFactory;
import org.apache.axiom.om.OMElement;
import org.apache.axiom.om.OMFactory;
import org.apache.axiom.om.OMNamespace;
import org.apache.axiom.om.util.AXIOMUtil;
import org.apache.axis2.AxisFault;
import org.apache.axis2.addressing.EndpointReference;
import org.apache.axis2.client.Options;
import org.apache.axis2.client.ServiceClient;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.wso2.carbon.automation.engine.exceptions.AutomationFrameworkException;
import javax.xml.stream.XMLStreamException;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.net.MalformedURLException;
import java.net.URL;
import java.nio.charset.Charset;
import java.util.List;
import static org.testng.Assert.assertFalse;
import static org.testng.Assert.fail;

            } catch (IOException e) {
                return false;
            } finally {
                if (in != null) {
                    in.close();
                }
            }
        }
        return false;
    }

    public static void waitForServiceDeployment(String serviceUrl) throws IOException {
        int serviceTimeOut = 0;
        while (!isServiceAvailable(serviceUrl)) {
            if (serviceTimeOut == 0) {
            } else if (serviceTimeOut > 100) { //Check for the service for 100 seconds
                // if Service not available assertfalse;
                fail(serviceUrl + " service is not found");
                break;
            }
            try {
                Thread.sleep(500);
                serviceTimeOut++;
            } catch (InterruptedException ignored) {
            }
        }
    }

    public static void sendRequest(String eprUrl, String operation, String payload,
                                   int numberOfInstances, List<String> expectedStrings,
                                   boolean twoWay) throws  AutomationFrameworkException {