@Test(
      groups = {"wso2.bps", "wso2.bps.bpelactivities"},
      description = "Correlation with attribute sample test case")
  public void testCorrelationWithAttribute() throws Exception {
    String payload =
        " <p:TestCorrelationWithAttributeRequest xmlns:p=\"http://wso2.org/bps/sample\">\n"
            + "      <!--Exactly 1 occurrence-->\n"
            + "      <input xmlns=\"http://wso2.org/bps/sample\">99ee992</input>\n"
            + "   </p:TestCorrelationWithAttributeRequest>";
    String operation = "process";
    String serviceName = "TestCorrelationWithAttribute";
    List<String> expectedOutput = Collections.emptyList();

    requestSender.sendRequest(
        backEndUrl + serviceName, operation, payload, 1, expectedOutput, false);

    Thread.sleep(2000);
    payload =
        " <p:CallbackOperation xmlns:p=\"http://www.example.org/callback/\">\n"
            + "      <!--Exactly 1 occurrence-->\n"
            + "      <xsd:in xmlns:xsd=\"http://www.example.org/callback/\">99ee992</xsd:in>\n"
            + "   </p:CallbackOperation>";
    operation = "CallbackOperation";
    serviceName = "CallbackService";
    expectedOutput = new ArrayList<String>();
    expectedOutput.add("99ee992");

    requestSender.sendRequest(
        backEndUrl + serviceName, operation, payload, 1, expectedOutput, true);
  }
 @BeforeClass(alwaysRun = true, groups = "wso2.bps.bpelactivities")
 public void deployArtifact() throws Exception {
   setEnvironment();
   uploadBpelForTest("TestForEach");
   uploadBpelForTest("TestPickOneWay");
   uploadBpelForTest("TestFlowLinks");
   requestSender.waitForProcessDeployment(backEndUrl + "FlowLinkTest");
 }
 @BeforeClass(alwaysRun = true)
 public void deployArtifact() throws Exception {
   setEnvironment();
   uploadBpelForTest("Async-Server");
   uploadBpelForTest("Async-Client");
   uploadBpelForTest("TestCorrelationWithAttribute");
   requestSender.waitForProcessDeployment(backEndUrl + "TestCorrelationWithAttribute");
 }
  private void pickDiamond() throws Exception {
    String payload =
        "<pic:pickDiamond xmlns:pic=\"http://www.stark.com/PickService\"><pic:Deck>one</pic:Deck></pic:pickDiamond>";
    String operation = "pickDiamond";
    String serviceName = "PickService";

    log.info("Service: " + backEndUrl + serviceName);
    requestSender.sendRequest(
        backEndUrl + serviceName, operation, payload, 1, new ArrayList<String>(), false);
  }
  public void ignoreMissingFromData() throws XMLStreamException, AxisFault {
    String payload = "<test:Input xmlns:test=\"test:test\">yy</test:Input>";
    String operation = "process";
    String serviceName = "TestIgnoreMissingFromDataService";
    String expectedOutput = "Test passed.";

    log.info("Service: " + backEndUrl + serviceName);
    requestSender.assertRequest(
        backEndUrl + serviceName, operation, payload, 1, expectedOutput, true);
  }
  public void flexibleAssign() throws XMLStreamException, AxisFault {
    String payload =
        "<flex:typeA xmlns:flex=\"http://wso2.org/bps/schema/FlexibleAssign\">"
            + "<flex:paramA>ee</flex:paramA></flex:typeA>";
    String operation = "operation1";
    String serviceName = "FlexibleAssign";
    String expectedOutput = "ee";

    log.info("Service: " + backEndUrl + serviceName);
    requestSender.assertRequest(
        backEndUrl + serviceName, operation, payload, 1, expectedOutput, true);
  }
  private void dealDeck() throws Exception {
    String payload =
        "<pic:dealDeck xmlns:pic=\"http://www.stark.com/PickService\"><pic:Deck>one</pic:Deck></pic:dealDeck>";
    String operation = "dealDeck";
    String serviceName = "PickService";
    List<String> expectedOutput = new ArrayList<String>();
    expectedOutput.add(">one<");

    log.info("Service: " + backEndUrl + serviceName);
    requestSender.sendRequest(
        backEndUrl + serviceName, operation, payload, 1, expectedOutput, true);
  }
  @Test(
      groups = {"wso2.bps", "wso2.bps.bpelactivities"},
      description = "for each in structured activities",
      dependsOnMethods = "flowLinks")
  private void forEach() throws Exception {
    String payload = "<input xmlns=\"http://www.example.org/jms\">in</input>";
    String operation = "start";
    String serviceName = "ForEachService";
    List<String> expectedOutput = new ArrayList<String>();
    expectedOutput.add("123");

    log.info("Service: " + backEndUrl + serviceName);
    requestSender.sendRequest(
        backEndUrl + serviceName, operation, payload, 1, expectedOutput, true);
  }
  @Test(
      groups = {"wso2.bps", "wso2.bps.bpelactivities"},
      description = "assign activity in data handling test case")
  public void assignActivity2() throws XMLStreamException, AxisFault {
    String payload =
        "<un:testAssign xmlns:un=\"http://ode/bpel/unit-test.wsdl\">"
            + "<TestPart>Hello</TestPart></un:testAssign>";
    String operation = "testAssign";
    String serviceName = "TestAssignService";
    String expectedOutput = "Hello World7true3";

    log.info("Service: " + backEndUrl + serviceName);
    requestSender.assertRequest(
        backEndUrl + serviceName, operation, payload, 1, expectedOutput, true);
  }
  @Test(
      groups = {"wso2.bps", "wso2.bps.bpelactivities"},
      description = "assign data in data handling test case")
  public void assignDate() throws XMLStreamException, AxisFault {
    String payload =
        "<ns1:TaskRequest xmlns:ns1=\"http://example.com/NewDiagram/Pool\">"
            + "start</ns1:TaskRequest>";
    String operation = "Task";
    String serviceName = "TestAssignDateService";
    String expectedOutput = "OK";

    log.info("Service: " + backEndUrl + serviceName);
    requestSender.assertRequest(
        backEndUrl + serviceName, operation, payload, 1, expectedOutput, true);
  }
  @Test(
      groups = {"wso2.bps", "wso2.bps.bpelactivities", "wso2.bps.bpelactivities"},
      description = "counter in data handling test case")
  public void counter() throws AxisFault, XMLStreamException {
    String payload =
        "<un:initialize xmlns:un=\"http://example.com/bpel/counter\">"
            + "<counterName>foo</counterName></un:initialize>";
    String operation = "initialize";
    String serviceName = "counterService";
    String expectedOutput = "10.0";

    log.info("Service: " + backEndUrl + serviceName);
    requestSender.assertRequest(
        backEndUrl + serviceName, operation, payload, 1, expectedOutput, true);
  }
  @Test(
      groups = {"wso2.bps", "wso2.bps.bpelactivities"},
      description = "XSLT transform in data handling test case")
  public void XSLTransform() throws XMLStreamException, AxisFault {
    String payload =
        "<un:helloXsl xmlns:un=\"http://ode/bpel/unit-test.wsdl\"><TestPart>"
            + "<content>Hello</content></TestPart></un:helloXsl>";
    String operation = "helloXsl";
    String serviceName = "HelloXslService";
    String expectedOutput = "HelloXsl World";

    log.info("Service: " + backEndUrl + serviceName);
    requestSender.assertRequest(
        backEndUrl + serviceName, operation, payload, 1, expectedOutput, true);
  }
 @BeforeClass(alwaysRun = true)
 public void deployArtifact() throws Exception {
   setEnvironment();
   uploadBpelForTest("TestComposeUrl");
   uploadBpelForTest("FlexibleAssign");
   uploadBpelForTest("TestIgnoreMissingFromData");
   uploadBpelForTest("TestCombineUrl");
   uploadBpelForTest("TestExpandTemplate");
   uploadBpelForTest("TestAssignActivity1");
   uploadBpelForTest("TestAssignDate");
   uploadBpelForTest("TestXslTransform");
   uploadBpelForTest("TestCounter");
   uploadBpelForTest("TestSplit");
   uploadBpelForTest("XMLAttributeProcess");
   requestSender.waitForProcessDeployment(backEndUrl + "XMLAttributeProcessService");
 }
  @Test(
      groups = {"wso2.bps", "wso2.bps.bpelactivities"},
      description = "Combine URL on data handling test case")
  public void combineUrl() throws XMLStreamException, AxisFault {
    String payload =
        "<un:combineUrl xmlns:un=\"http://ode/bpel/unit-test.wsdl\">"
            + "<base>http://example.com/html/about.html</base>"
            + "<relative>../experts/</relative></un:combineUrl>";
    String operation = "combineUrl";
    String serviceName = "TestCombineUrlService";
    String expectedOutput = "http://example.com/experts/";

    log.info("Service: " + backEndUrl + serviceName);
    requestSender.assertRequest(
        backEndUrl + serviceName, operation, payload, 1, expectedOutput, true);
  }
  @Test(
      groups = {"wso2.bps", "wso2.bps.bpelactivities"},
      description = "flow links in structured activities")
  private void flowLinks() throws Exception {
    String payload =
        "<ns1:ExecuteWorkflow xmlns:ns1=\"workflowns\"><value>foo</value>"
            + "</ns1:ExecuteWorkflow>";
    String operation = "ExecuteWorkflow";
    String serviceName = "FlowLinkTest";
    List<String> expectedOutput = new ArrayList<String>();
    expectedOutput.add("foo");

    log.info("Service: " + backEndUrl + serviceName);
    requestSender.sendRequest(
        backEndUrl + serviceName, operation, payload, 1, expectedOutput, true);
  }
  @Test(
      groups = {"wso2.bps", "wso2.bps.bpelactivities"},
      description = "Async BPEL sample test case")
  public void testAsyncBPELSample() throws Exception {
    String payload =
        "<p:ClientRequest xmlns:p=\"urn:ode-apache-org:example:async:client\">\n"
            + "      <p:id>1</p:id>\n"
            + "      <p:input>2</p:input>\n"
            + "   </p:ClientRequest>";
    String operation = "process";
    String serviceName = "ClientService";
    List<String> expectedOutput = new ArrayList<String>();
    expectedOutput.add("Server says 2");

    requestSender.sendRequest(
        backEndUrl + serviceName, operation, payload, 1, expectedOutput, true);
  }
  @Test(
      groups = {"wso2.bps", "wso2.bps.bpelactivities"},
      description = "expanding template")
  public void expandTemplate() throws XMLStreamException, AxisFault {
    String payload =
        "<un:expandTemplate xmlns:un=\"http://ode/bpel/unit-test.wsdl\">"
            + "<template>http://example.com/{user}/{a_missing_var}/"
            + "{another_missing_var=but_with_a_default}</template><name>user</name>"
            + "<value>bill</value><pairs/></un:expandTemplate>";
    String operation = "expandTemplate";
    String serviceName = "TestExpandTemplateService";
    String expectedOutput = "http://example.com/bill/{a_missing_var}/but_with_a_default";

    log.info("Service: " + backEndUrl + serviceName);
    requestSender.assertRequest(
        backEndUrl + serviceName, operation, payload, 1, expectedOutput, true);
  }
  @Test(
      groups = {"wso2.bps", "wso2.bps.bpelactivities"},
      description =
          "this test will use composeUrl with a list of " + "name, value, name, value, etc")
  public void composeURL() throws XMLStreamException, AxisFault {
    String payload =
        "<un:composeUrl xmlns:un=\"http://ode/bpel/unit-test.wsdl\">"
            + "<template>http://example.com/{user}/{a_missing_var}</template>"
            + "<name>user</name><value>bill</value><pairs /></un:composeUrl>";
    String operation = "composeUrl";
    String serviceName = "TestComposeUrlService";
    String expectedOutput = "http://example.com/bill/";

    log.info("Service: " + backEndUrl + serviceName);
    requestSender.assertRequest(
        backEndUrl + serviceName, operation, payload, 1, expectedOutput, true);
  }
  @Test(
      groups = {"wso2.bps", "wso2.bps.bpelactivities"},
      description = "this test will use " + "composeUrl with the element argument")
  public void composeURLWithElement() throws XMLStreamException, AxisFault {
    String payload =
        "<un:composeUrl xmlns:un=\"http://ode/bpel/unit-test.wsdl\">"
            + "<template>http://example.com/{user}/{tag}/{a_missing_var}</template>"
            + "<name/><value/><pairs><user>bill</user><tag>ruby</tag></pairs>"
            + "</un:composeUrl>";
    String operation = "composeUrl";
    String serviceName = "TestComposeUrlService";
    String expectedOutput = "http://example.com/bill/ruby/";

    log.info("Service: " + backEndUrl + serviceName);
    requestSender.assertRequest(
        backEndUrl + serviceName, operation, payload, 1, expectedOutput, true);
  }
  @Test(
      groups = {"wso2.bps", "wso2.bps.bpelactivities"},
      description = "test attribute manipulations in data handling test case")
  public void processProperty() throws Exception {
    String payload =
        "<p:XMLAttributeProcessRequest xmlns:p=\"http://eclipse.org/bpel/sample\">\n"
            + "      <p:input>1</p:input>\n"
            + "   </p:XMLAttributeProcessRequest>";
    String operation = "initiate";
    String serviceName = "XMLAttributeProcessService";
    List<String> expectedOutput = new ArrayList<String>();
    expectedOutput.add("testUserIdAttribute=\"1\"");
    expectedOutput.add("testAttribute=\"testAttributeValue\"");

    log.info("Service: " + backEndUrl + serviceName);
    requestSender.sendRequest(
        backEndUrl + serviceName, operation, payload, 1, expectedOutput, true);
  }
  @Test(
      groups = {"wso2.bps", "wso2.bps.bpelactivities"},
      description = "split in data handling test case")
  public void split() throws AxisFault, XMLStreamException {
    String payload =
        "<un:split xmlns:un=\"http://ode/bpel/unit-test.wsdl\">"
            + "<TestPart>split,me,this,please</TestPart></un:split>";
    String operation = "split";
    String serviceName = "TestSplitService";
    String expectedOutput =
        "<chunk>split</chunk>"
            + "<chunk>me</chunk>"
            + "<chunk>this</chunk>"
            + "<chunk>please</chunk>";

    log.info("Service: " + backEndUrl + serviceName);
    requestSender.assertRequest(
        backEndUrl + serviceName, operation, payload, 1, expectedOutput, true);
  }