Java Code Examples for org.apache.axiom.om.util.AXIOMUtil#stringToOM()

The following examples show how to use org.apache.axiom.om.util.AXIOMUtil#stringToOM() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: MailToTransportActionAfterFailureMOVETestCase.java    From micro-integrator with Apache License 2.0 6 votes vote down vote up
@BeforeClass(alwaysRun = true)
public void initialize() throws Exception {
    super.init();
    OMElement mailToProxyOMElement = AXIOMUtil.stringToOM(FileUtils.readFileToString(new File(
            getESBResourceLocation() + File.separator + "mailTransport" + File.separator +
                    "mailTransportReceiver" + File.separator + "mail_transport_actionafter_failure_move.xml")));
    Utils.deploySynapseConfiguration(mailToProxyOMElement,
            "MailToTransportActionAfterFailureMoveTestCase","proxy-services",
            true);
    carbonLogReader = new CarbonLogReader();
    carbonLogReader.start();
    greenMailUser = GreenMailServer.getPrimaryUser();
    greenMailClient = new GreenMailClient(greenMailUser);

    // Since ESB reads all unread emails one by one, we have to
    // delete the all unread emails before run the test
    GreenMailServer.deleteAllEmails("imap");
}
 
Example 2
Source File: VFSTransportTestCase.java    From micro-integrator with Apache License 2.0 6 votes vote down vote up
private void addVFSProxy10() throws Exception {

        String proxyName = "VFSProxy10";
        OMElement proxy = AXIOMUtil.stringToOM("<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n"
                + "<proxy xmlns=\"http://ws.apache.org/ns/synapse\" name=\"VFSProxy10\" transports=\"vfs\">\n"
                + "                <parameter name=\"transport.vfs.FileURI\">" + pathToVfsDir + "test"
                + File.separator + proxyName + File.separator + "in" + File.separator + "</parameter> <!--CHANGE-->\n"
                + "                <parameter name=\"transport.vfs.ContentType\">text/plain</parameter>\n"
                + "                <parameter name=\"transport.vfs.FileNamePattern\">.*.txt</parameter>"
                + "                <parameter name=\"transport.PollInterval\">1</parameter>\n"
                + "                <target>\n" + "                        <inSequence>\n"
                + "                           <property name=\"transport.vfs.ReplyFileName\" value=\"out123@wso2_text.txt\" scope=\"transport\"/>"
                + "                           <property action=\"set\" name=\"OUT_ONLY\" value=\"true\"/>\n"
                + "                           <log level=\"full\"/>\n" + "                           <send>\n"
                + "                                 <endpoint name=\"FileEpr\">\n"
                + "                                   <address uri=\"vfs:file://" + pathToVfsDir + "test"
                + File.separator + proxyName + File.separator + "out" + File.separator + "\"/>\n"
                + "                                 </endpoint>\n"
                + "                           </send>" + "                        </inSequence>"
                + "                </target>\n" + "        </proxy>");
        addProxy(proxy, proxyName);
    }
 
Example 3
Source File: VFSTransportTestCase.java    From micro-integrator with Apache License 2.0 6 votes vote down vote up
private void addVFSProxy17() throws Exception {

        String proxyName = "VFSProxy17";
        OMElement proxy = AXIOMUtil.stringToOM("<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n"
                + "<proxy xmlns=\"http://ws.apache.org/ns/synapse\" name=\"VFSProxy17\" transports=\"vfs\">\n"
                + "                <parameter name=\"transport.vfs.FileURI\">file://" + pathToVfsDir + "test"
                + File.separator + proxyName + File.separator + "in" + File.separator + "</parameter> <!--CHANGE-->\n"
                + "                <parameter name=\"transport.vfs.FileNamePattern\">.*\\.xml</parameter>\n"
                + "                <parameter name=\"transport.PollInterval\">1</parameter>\n"
                + "                <target>\n" + "                        <endpoint>\n"
                + "                                <address format=\"soap12\" uri=\"http://localhost:9000/services/SimpleStockQuoteService\"/>\n"
                + "                        </endpoint>\n" + "                        <outSequence>\n"
                + "                                <property action=\"set\" name=\"OUT_ONLY\" value=\"true\"/>\n"
                + "                                <send>\n" + "                                        <endpoint>\n"
                + "                                                <address uri=\"vfs:file://" + pathToVfsDir + "test"
                + File.separator + proxyName + File.separator + "out" + File.separator + "out.xml\"/> <!--CHANGE-->\n"
                + "                                        </endpoint>\n" + "                                </send>\n"
                + "                        </outSequence>\n" + "                </target>\n" + "        </proxy>");
        addProxy(proxy, proxyName);
    }
 
Example 4
Source File: EnrichIntegrationAddSiblingInOutMessageTestCase.java    From micro-integrator with Apache License 2.0 6 votes vote down vote up
@SetEnvironment(executionEnvironments = { ExecutionEnvironment.STANDALONE })
@Test(groups = { "wso2.esb" }, description = "Enrich mediator:Add as a sibling to message body")
public void addAsSiblingToMessageBody() throws Exception {
    wireMonitorServer.start();
    String payload =
            "<m:getQuote xmlns:m=\"http://services.samples\">" + "<m:request>" + "</m:request>" + "</m:getQuote>";
    OMElement payloadOM = AXIOMUtil.stringToOM(payload);
    try {
        OMElement response = axis2Client
                .sendSimpleStockQuoteRequest(getProxyServiceURLHttp("enrichAddSiblingInOutMessageTestProxy"), null,
                        payloadOM);
    } catch (Exception e) {

    }
    String wireResponse = wireMonitorServer.getCapturedMessage();
    String expectedSoapBody = "<soapenv:Body>" + "<m:symbol1 xmlns:m=\"http://services.samples\">IBM</m:symbol1>"
            + "<m:symbol2 xmlns:m=\"http://services.samples\">WSO2</m:symbol2>" + "</soapenv:Body>";
    assertTrue(wireResponse.contains(expectedSoapBody), "Invalid soap body");

}
 
Example 5
Source File: AggregateWithMaxMInLimitsTestCase.java    From micro-integrator with Apache License 2.0 6 votes vote down vote up
@Test(groups = { "wso2.esb" }, description = "less number of messages than minimum count")
public void testLessNumberThanMaximum() throws IOException, XMLStreamException {
    int responseCount = 0;

    no_of_requests = 3;
    aggregatedRequestClient.setNoOfIterations(no_of_requests);
    String Response = aggregatedRequestClient.getResponse();
    Assert.assertNotNull(Response);
    OMElement Response2 = AXIOMUtil.stringToOM(Response);
    OMElement soapBody = Response2.getFirstElement();
    Iterator iterator = soapBody.getChildrenWithName(new QName("http://services.samples", "getQuoteResponse"));

    while (iterator.hasNext()) {
        responseCount++;
        OMElement getQuote = (OMElement) iterator.next();
        Assert.assertTrue(getQuote.toString().contains("IBM"));
    }

    Assert.assertTrue(2 <= responseCount && responseCount <= no_of_requests);

}
 
Example 6
Source File: VFSTransportTestCase.java    From micro-integrator with Apache License 2.0 6 votes vote down vote up
private void addVFSProxy12() throws Exception {

        String proxyName = "VFSProxy12";
        OMElement proxy = AXIOMUtil.stringToOM("<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n"
                + "<proxy xmlns=\"http://ws.apache.org/ns/synapse\" name=\"VFSProxy12\" transports=\"vfs\">\n"
                + "                <parameter name=\"transport.vfs.FileURI\">file://" + pathToVfsDir + "test"
                + File.separator + proxyName + File.separator + "in" + File.separator + "</parameter> <!--CHANGE-->\n"
                + "                <parameter name=\"transport.vfs.ContentType\">text/xml</parameter>\n"
                + "                <parameter name=\"transport.vfs.FileNamePattern\">.*\\.xml</parameter>\n"
                + "                <parameter name=\"transport.PollInterval\">1</parameter>\n"
                + "                <parameter name=\"transport.vfs.MoveAfterFailure\">file://" + pathToVfsDir + "test"
                + File.separator + proxyName + File.separator + "failure" + File.separator + "</parameter>\n"
                + "                <parameter name=\"transport.vfs.ActionAfterFailure\">MOVE</parameter>"
                + "                <target>\n" + "                        <endpoint>\n"
                + "                                <address format=\"soap12\" uri=\"http://localhost:9000/services/SimpleStockQuoteService\"/>\n"
                + "                        </endpoint>\n" + "                        <outSequence>\n"
                + "                                <property action=\"set\" name=\"OUT_ONLY\" value=\"true\"/>\n"
                + "                                <send>\n" + "                                        <endpoint>\n"
                + "                                                <address uri=\"vfs:file://" + pathToVfsDir + "test"
                + File.separator + proxyName + File.separator + "out" + File.separator + "out.xml\"/> <!--CHANGE-->\n"
                + "                                        </endpoint>\n" + "                                </send>\n"
                + "                        </outSequence>\n" + "                </target>\n" + "        </proxy>");
        addProxy(proxy, proxyName);
    }
 
Example 7
Source File: SequenceMediaTypeTestCase.java    From micro-integrator with Apache License 2.0 6 votes vote down vote up
@Test(groups = { "wso2.esb" }, description = "Test dynamic Sequence media type - application/vnd.wso2.sequence")
public void dynamicSequenceMediaTypeTest() throws Exception {
    final String name = "automationDynamicSequence";

    OMElement sequence = AXIOMUtil.stringToOM(
            "<sequence xmlns=\"http://ws.apache.org/ns/synapse\" name=\"" + name + "\">" + " <in>"
                    + "<log level=\"full\"/>" + "<send>" + "<endpoint> "
                    + "<address uri=\"http://localhost:9000/services/SimpleStockQuoteService\"/>" + "</endpoint> "
                    + "</send> " + "</in> " + "<out> " + "<send/> " + "</out> " + "</sequence>");

    sequenceAdminServiceClient.addDynamicSequence(KEY, sequence);
    isDynamicSequenceExist = true;
    MetadataBean metadata = resourceAdmin.getMetadata("/_system/config/sequence/testAutomationSequence");
    Assert.assertEquals(metadata.getMediaType(), "application/vnd.wso2.sequence",
            "Media Type mismatched for Dynamic Sequence");

}
 
Example 8
Source File: SpecifyMaxMessageCountAsExpressionTestCase.java    From micro-integrator with Apache License 2.0 6 votes vote down vote up
@Test(groups = { "wso2.esb" }, description = "higher number of messages than minimum count")
public void testMoreNumberThanMinimum() throws IOException, XMLStreamException {
    int responseCount = 0;
    no_of_requests = 8;
    aggregatedRequestClient.setNoOfIterations(no_of_requests);
    String Response = aggregatedRequestClient.getResponse();
    Assert.assertNotNull(Response);
    OMElement Response2 = AXIOMUtil.stringToOM(Response);
    OMElement soapBody = Response2.getFirstElement();
    Iterator iterator = soapBody.getChildrenWithName(new QName("http://services.samples", "getQuoteResponse"));

    while (iterator.hasNext()) {
        responseCount++;
        OMElement getQuote = (OMElement) iterator.next();
        Assert.assertTrue(getQuote.toString().contains("IBM"));
    }
    Assert.assertTrue(minMessageCount <= responseCount && responseCount <= no_of_requests);

}
 
Example 9
Source File: MailToTransportInvalidAddressTestCase.java    From micro-integrator with Apache License 2.0 6 votes vote down vote up
@BeforeClass(alwaysRun = true)
public void initialize() throws Exception {
    super.init();
    OMElement mailToProxyOMElement = AXIOMUtil.stringToOM(FileUtils.readFileToString(new File(
            getESBResourceLocation() + File.separator + "mailTransport" + File.separator
                    + "mailTransportReceiver" + File.separator + "mail_transport_invalid_address.xml")));
    Utils.deploySynapseConfiguration(mailToProxyOMElement,
            "MailTransportInvalidAddress","proxy-services",
            true);
    carbonLogReader = new CarbonLogReader();
    carbonLogReader.start();

    // Since ESB reads all unread emails one by one, we have to delete
    // the all unread emails before run the test
    GreenMailServer.deleteAllEmails("pop3");
}
 
Example 10
Source File: HighTimeoutWithLessMessagesTestCase.java    From micro-integrator with Apache License 2.0 6 votes vote down vote up
@Test(groups = { "wso2.esb" }, description = "replacing a property by using an enrich mediator")
public void maxValueTest() throws IOException, XMLStreamException {
    int responseCount = 0;

    String Response = aggregatedRequestClient.getResponse();
    Assert.assertNotNull(Response);

    OMElement Response2 = AXIOMUtil.stringToOM(Response);
    OMElement soapBody = Response2.getFirstElement();
    Iterator iterator = soapBody.getChildrenWithName(new QName("http://services.samples", "getQuoteResponse"));

    while (iterator.hasNext()) {
        responseCount++;
        OMElement getQuote = (OMElement) iterator.next();
        Assert.assertTrue(getQuote.toString().contains("IBM"));
    }

    Assert.assertEquals(responseCount, no_of_requests, "GetQuoteResponse Element count mismatched");
}
 
Example 11
Source File: AggregateWithMaxMInLimitsTestCase.java    From micro-integrator with Apache License 2.0 6 votes vote down vote up
@Test(groups = { "wso2.esb" }, description = "number of messages is equal to the maximum")
public void testEqualtoMaximum() throws IOException, XMLStreamException {
    int responseCount = 0;

    no_of_requests = 100;
    aggregatedRequestClient.setNoOfIterations(no_of_requests);
    String Response = aggregatedRequestClient.getResponse();
    Assert.assertNotNull(Response);
    OMElement Response2 = AXIOMUtil.stringToOM(Response);
    OMElement soapBody = Response2.getFirstElement();
    Iterator iterator = soapBody.getChildrenWithName(new QName("http://services.samples", "getQuoteResponse"));

    while (iterator.hasNext()) {
        responseCount++;
        OMElement getQuote = (OMElement) iterator.next();
        Assert.assertTrue(getQuote.toString().contains("IBM"));
    }

    Assert.assertTrue(2 <= responseCount && responseCount <= no_of_requests);

}
 
Example 12
Source File: VFSTransportTestCase.java    From micro-integrator with Apache License 2.0 6 votes vote down vote up
private void addVFSProxy6() throws Exception {

        String proxyName = "VFSProxy6";
        OMElement proxy = AXIOMUtil.stringToOM("<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n"
                + "<proxy xmlns=\"http://ws.apache.org/ns/synapse\" name=\"VFSProxy6\" transports=\"vfs\">\n"
                + "                <parameter name=\"transport.vfs.FileURI\">" + pathToVfsDir + "test"
                + File.separator + proxyName + File.separator + "in" + File.separator + "</parameter> <!--CHANGE-->\n"
                + "                <parameter name=\"transport.vfs.ContentType\">text/plain</parameter>\n"
                + "                <parameter name=\"transport.vfs.FileNamePattern\">.*.txt</parameter>"
                + "                <parameter name=\"transport.PollInterval\">30</parameter>\n"
                + "                <target>\n" + "                        <inSequence>\n"
                + "                           <property action=\"set\" name=\"OUT_ONLY\" value=\"true\"/>\n"
                + "                           <log level=\"full\"/>\n" + "                           <send>\n"
                + "                               <endpoint name=\"FileEpr\">\n"
                + "                                   <address uri=\"vfs:file://" + pathToVfsDir + "test"
                + File.separator + proxyName + File.separator + "out" + File.separator + "out.txt\"/>\n"
                + "                               </endpoint>\n" + "                           </send>"
                + "                        </inSequence>" + "                </target>\n" + "        </proxy>");
        addProxy(proxy, proxyName);
    }
 
Example 13
Source File: SpecifyMaxMessageCountAsExpressionTestCase.java    From micro-integrator with Apache License 2.0 6 votes vote down vote up
@Test(groups = { "wso2.esb" }, description = "more number of messages than maximum count")
public void testMoreNumberThanMaximum() throws IOException, XMLStreamException {
    int responseCount = 0;
    no_of_requests = 15;
    aggregatedRequestClient.setNoOfIterations(no_of_requests);
    String Response = aggregatedRequestClient.getResponse();
    Assert.assertNotNull(Response);
    OMElement Response2 = AXIOMUtil.stringToOM(Response);
    OMElement soapBody = Response2.getFirstElement();
    Iterator iterator = soapBody.getChildrenWithName(new QName("http://services.samples", "getQuoteResponse"));

    while (iterator.hasNext()) {
        responseCount++;
        OMElement getQuote = (OMElement) iterator.next();
        Assert.assertTrue(getQuote.toString().contains("IBM"));
    }
    Assert.assertTrue(minMessageCount <= responseCount && responseCount <= maxMessageCount);

}
 
Example 14
Source File: AggregationWithoutMaxValueTestCase.java    From micro-integrator with Apache License 2.0 6 votes vote down vote up
@Test(groups = { "wso2.esb" }, description = "higher number of messages than minimum count")
public void testMoreNumberThanMinimum() throws IOException, XMLStreamException {
    int responseCount = 0;

    no_of_requests = 80;
    aggregatedRequestClient.setNoOfIterations(no_of_requests);
    String Response = aggregatedRequestClient.getResponse();
    Assert.assertNotNull(Response);
    OMElement Response2 = AXIOMUtil.stringToOM(Response);
    OMElement soapBody = Response2.getFirstElement();
    Iterator iterator = soapBody.getChildrenWithName(new QName("http://services.samples", "getQuoteResponse"));

    while (iterator.hasNext()) {
        responseCount++;
        OMElement getQuote = (OMElement) iterator.next();
        Assert.assertTrue(getQuote.toString().contains("IBM"));
    }

    Assert.assertTrue(50 <= responseCount && responseCount <= no_of_requests);

}
 
Example 15
Source File: EnrichIntegrationReplaceEnvelopeTestCase.java    From micro-integrator with Apache License 2.0 5 votes vote down vote up
@Test(groups = "wso2.esb", description = "Replace envelope ")
public void testEnrichMediator() throws Exception {

    String soapResponse = getResponse();
    assertNotNull(soapResponse, "Response message null");

    OMElement response = AXIOMUtil.stringToOM(soapResponse);
    OMElement soapBody = response
            .getFirstChildWithName(new QName("http://schemas.xmlsoap.org/soap/envelope/", "Body"));
    OMElement soapHeader = response
            .getFirstChildWithName(new QName("http://schemas.xmlsoap.org/soap/envelope/", "Header"));
    OMElement quoteBody = soapBody.getFirstElement();
    OMElement returnBody = quoteBody.getFirstElement();

    String symbolResponse = returnBody.getFirstChildWithName(new QName("http://services.samples/xsd", "symbol"))
            .getText();

    assertEquals(symbolResponse, "ABC", "envelope body not changed");

    String nameResponse = returnBody.getFirstChildWithName(new QName("http://services.samples/xsd", "name"))
            .getText();
    assertEquals(nameResponse, "ABC Company", "envelope body not changed");
    String newTagResponse = returnBody.getFirstChildWithName(new QName("http://services.samples/xsd", "newTag"))
            .getText();
    assertEquals(newTagResponse, "Test Field", "envelope body not changed");

    String headerContent = soapHeader
            .getFirstChildWithName(new QName("http://ws.apache.org/ns/synapse", "TestHeader")).getText();
    assertEquals(headerContent, "Test", "envelope header not changed");

}
 
Example 16
Source File: MessageStoreMediaTypeTestCase.java    From micro-integrator with Apache License 2.0 5 votes vote down vote up
@Test(groups = { "wso2.esb" }, description = "Test message Store media type - text/xml", enabled = false)
public void messageStoreMediaTypeTest() throws Exception {

    OMElement messageStore = AXIOMUtil.stringToOM(
            "<messageStore xmlns=\"http://ws.apache.org/ns/synapse\" name=\"" + MESSAGE_STORE_NAME + "\">"
                    + "<parameter name=\"abc\">10</parameter>" + "</messageStore>");
    messageStoreAdminClient.addMessageStore(messageStore);
    isMessageStoreExist = true;
    //addEndpoint is a a asynchronous call, it will take some time to write to a registry
    Thread.sleep(10000);
    MetadataBean metadata = resourceAdmin
            .getMetadata("/_system/config/repository/synapse/default/synapse-message-stores/" + MESSAGE_STORE_NAME);
    Assert.assertEquals(metadata.getMediaType(), "text/xml", "Media Type mismatched for Message Store");

}
 
Example 17
Source File: ESBJAVA4692_MP_FaultSequence_HttpsEndpoint_TestCase.java    From micro-integrator with Apache License 2.0 5 votes vote down vote up
@Test(groups = {"wso2.esb"}, description = "MP Fault Sequence test case for https")
public void testCalloutJMSHeaders() throws Exception {
    CarbonLogReader carbonLogReader = new CarbonLogReader();
    carbonLogReader.start();
    AxisServiceClient client = new AxisServiceClient();
    String payload = "<payload/>";
    AXIOMUtil.stringToOM(payload);
    client.sendRobust(AXIOMUtil.stringToOM(payload), getProxyServiceURLHttps("MSProxy"), "urn:mediate");
    boolean logFound = carbonLogReader.checkForLog("FaultSeq = *********** FaultSeq *****************", DEFAULT_TIMEOUT);
    carbonLogReader.stop();
    assertTrue(logFound, "Fault Sequence Not Executed for Soap Fault");
}
 
Example 18
Source File: PropertyPersistenceDeletingTestCase.java    From micro-integrator with Apache License 2.0 5 votes vote down vote up
@BeforeClass(alwaysRun = true)
public void setEnvironment() throws Exception {

    super.init();
    serverConfigurationManager = new ServerConfigurationManager(context);
    serverConfigurationManager.copyToComponentLib(
            new File(getClass().getResource(JAR_LOCATION + File.separator + CLASS_JAR_FIVE_PROPERTIES).toURI()));
    OMElement class_five_properties = AXIOMUtil.stringToOM(FileUtils.readFileToString(
            new File(getESBResourceLocation() + File.separator + "mediatorconfig" + File.separator +
                    "class" + File.separator + "class_property_persistence_five_properties.xml")));
    Utils.deploySynapseConfiguration(class_five_properties, "class_property_persistence_five_properties",
            "proxy-services", true);
    super.init();
}
 
Example 19
Source File: EnrichIntegrationCopyXpathOfSingleNodeTest.java    From micro-integrator with Apache License 2.0 5 votes vote down vote up
@Test(groups = "wso2.esb", description = "Tests-copy xpath of single node")
public void testCopyXpathOfSingleNode() throws AxisFault, XMLStreamException {
    OMElement response;
    String payload =
            "<m:getQuote xmlns:m=\"http://services.samples\">" + "<m:symbol>IBM</m:symbol>" + "</m:getQuote>";
    OMElement payloadOM = AXIOMUtil.stringToOM(payload);
    response = axis2Client
            .sendSimpleStockQuoteRequest(getProxyServiceURLHttp("enrichCopyXpathOfSingleNodeTestProxy"), null,
                    payloadOM);
    assertNotNull(response, "Response is null");
    assertEquals(
            response.getFirstElement().getFirstChildWithName(new QName("http://services.samples/xsd", "symbol"))
                    .getText(), "IBM", "Tag does not match");

}
 
Example 20
Source File: ESBJAVA4770VFSPasswordSecurityWithLargekeyTestCase.java    From micro-integrator with Apache License 2.0 4 votes vote down vote up
@Test(groups = "wso2.esb", description = "VFS secure password test")
public void securePasswordTest() throws XMLStreamException, IOException {

    //copy SOAP message  into the SFTP server
    String sentMessageFile = "test.xml";
    File sourceMessage = new File(sampleFileFolder + File.separator + sentMessageFile);
    File destinationMessage = new File(inputFolder + File.separator + sentMessageFile);
    copyFile(sourceMessage, destinationMessage);

    //Below is encrypted value of "SFTPUser:SFTP321" using vfsKeystore.jks which has a key with key strength 2048
    String encryptedPass = "qZnz8nFwQGqI1jp5DcjW8mUurphNc9Mj1DH8cGQBYB0p05geEDMQE3mNp3FTGhAhlohzvzuHdymETTEniprVua4PqPoeB1ZOXpCxE2Xy/auq+JSo77uPmPc9Uf3wgx5fhKqSghENwiCeWqAvbiLwyArwpmq4A5PVAuIzjADFwSkIpRxD9VnDlaDr2ovYVfbrwM7Z3DF4w4GJmyeXdswoCiYBZ+t+SJEU8tihzLsO0B3cbYXbzDEDNUVF6lWnokD01Ywp4VcI3FSHI1XwyKeZj1RAtP4YdhqEnUbSnlG3VsMeSgFpjUrnRomVY6/Pw2rq7s19RGgVO+X6JekON1mH2w==";
    String fileUri =
            "sftp://{wso2:vault-decrypt('" + encryptedPass + "')}@localhost:" + FTPPort + "/" + inputFolderName
                    + "/?transport.vfs.AvoidPermissionCheck=true";
    String moveAfterProcess =
            "sftp://{wso2:vault-decrypt('" + encryptedPass + "')}@localhost:" + FTPPort + "/" + outputFolderName
                    + "?transport.vfs.AvoidPermissionCheck=true";

    //create VFS transport listener proxy
    String proxy = "<proxy xmlns=\"http://ws.apache.org/ns/synapse\"\n" + "       name=\"VfsSecurePasswordTest1\"\n"
            + "       transports=\"vfs http https\"\n" + "       startOnLoad=\"true\"\n"
            + "       trace=\"disable\">\n" + "   <description/>\n" + "   <target>\n" + "      <inSequence>\n"
            + "         <property name=\"transport.vfs.ReplyFileName\"\n"
            + "                   expression=\"get-property('transport', 'FILE_NAME')\"\n"
            + "                   scope=\"transport\"\n" + "                   type=\"STRING\"/>\n"
            + "         <log level=\"custom\">\n"
            + "            <property name=\"File recieved for the proxy service - \"\n"
            + "                      expression=\"fn:concat(' - File ',get-property('transport','FILE_NAME'),' received')\"/>\n"
            + "         </log>\n" + "         <drop/>\n" + "      </inSequence>\n" + "   </target>\n"
            + "   <parameter name=\"transport.PollInterval\">1</parameter>\n"
            + "   <parameter name=\"transport.vfs.ActionAfterProcess\">MOVE</parameter>\n"
            + "   <parameter name=\"transport.vfs.ClusterAwareness\">true</parameter>\n"
            + "   <parameter name=\"transport.vfs.FileURI\">" + fileUri + "</parameter>\n"
            + "   <parameter name=\"transport.vfs.MoveAfterProcess\">" + moveAfterProcess + "</parameter>\n"
            + "   <parameter name=\"transport.vfs.FileNamePattern\">test.*\\.xml</parameter>\n"
            + "   <parameter name=\"transport.vfs.Locking\">enable</parameter>\n"
            + "   <parameter name=\"transport.vfs.ContentType\">application/octet-stream</parameter>\n"
            + "   <parameter name=\"transport.vfs.ActionAfterFailure\">DELETE</parameter>\n" + "</proxy>";

    OMElement proxyOM = AXIOMUtil.stringToOM(proxy);

    //add the listener proxy to ESB server
    try {
        Utils.deploySynapseConfiguration(proxyOM, "VfsSecurePasswordTest1", "proxy-services", true);
    } catch (Exception e) {
        LOGGER.error("Error while updating the Synapse config", e);
    }
    LOGGER.info("Synapse config updated");
    // Here we can't know whether the proxy polling happened or not, hence only way is to wait and see. Since poll interval is 1,
    // this waiting period should suffice. But it may include the time it take to deploy ther service as well.
    //check whether file is moved to "out" folder
    Awaitility.await().atMost(60, TimeUnit.SECONDS).until(checkForOutputFile(outputFolder));
}