Package org.apache.synapse

Examples of org.apache.synapse.TestMessageContextBuilder


        transformMediator.setXsltKey("xslt-key");

        for (int i=0; i<2; i++) {

            // invoke transformation, with static enveope
            MessageContext synCtx = new TestMessageContextBuilder().addFileEntry("xslt-key",
                    "../../repository/conf/sample/resources/transform/transform_load_3.xml")
                    .setBodyFromFile("../../repository/conf/sample/resources/transform/message.xml")
                    .addTextAroundBody().build();
            //MessageContext synCtx = TestUtils.getTestContextForXSLTMediator(SOURCE, props);
            transformMediator.mediate(synCtx);
View Full Code Here


         XSLTMediator transformMediator = new XSLTMediator();
        // set XSLT transformation URL
        transformMediator.setXsltKey("xslt-key");

         // invoke transformation, with static enveope
         MessageContext synCtx = new TestMessageContextBuilder().addFileEntry("xslt-key",
                 "../../repository/conf/sample/resources/transform/transform_load_2.xml")
                 .setBodyFromFile("../../repository/conf/sample/resources/transform/med_message.xml")
                 .addTextAroundBody().build();
         transformMediator.mediate(synCtx);
View Full Code Here

        // set XSLT transformation URL
        transformMediator.setXsltKey("xslt-key");

        for (int i=0; i<5; i++) {
            // invoke transformation, with static enveope
            MessageContext synCtx = new TestMessageContextBuilder().addFileEntry("xslt-key",
                    "../../repository/conf/sample/resources/transform/transform_load_2.xml")
                    .setBodyFromFile("../../repository/conf/sample/resources/transform/small_message.xml")
                    .addTextAroundBody().build();
            //MessageContext synCtx = TestUtils.getTestContextForXSLTMediator(SOURCE, props);
            transformMediator.mediate(synCtx);
View Full Code Here

        // set XSLT transformation URL
        transformMediator.setXsltKey("xslt-key");

        // invoke transformation, with static enveope
        MessageContext synCtx = new TestMessageContextBuilder().addFileEntry("xslt-key",
                "../../repository/conf/sample/resources/transform/transform_unittest.xslt")
                .setBodyFromString(ENCLOSING_SOURCE)
                .addTextAroundBody().build();
        transformMediator.mediate(synCtx);
View Full Code Here

    public void testTextEncoding() throws Exception {
        XSLTMediator transformMediator = new XSLTMediator();
        transformMediator.setXsltKey("xslt-key");
       
        MessageContext mc = new TestMessageContextBuilder().addFileEntry("xslt-key",
                "../../repository/conf/sample/resources/transform/encoding_test.xslt")
                .setEnvelopeFromFile("../../repository/conf/sample/resources/transform" +
                        "/encoding_test.xml").build();
       
        transformMediator.mediate(mc);
View Full Code Here

    // Test for SYNAPSE-307
    public void testInvalidStylesheet() throws Exception {
        XSLTMediator transformMediator = new XSLTMediator();
        transformMediator.setXsltKey("xslt-key");
       
        MessageContext mc = new TestMessageContextBuilder()
            .addEntry("xslt-key", getClass().getResource("invalid.xslt"))
            .setBodyFromString("<root/>")
            .build();
       
        try {
View Full Code Here

     */
    public void testWithCDATA() throws Exception {
        XSLTMediator transformMediator = new XSLTMediator();
        transformMediator.setXsltKey("xslt-key");
       
        MessageContext mc = new TestMessageContextBuilder()
            .addEntry("xslt-key", getClass().getResource("cdata.xslt"))
            .build();
       
        OMFactory factory = OMAbstractFactory.getOMFactory();
        OMElement in = factory.createOMElement(new QName(null, "in"));
View Full Code Here

    protected static void test(Class sbf, Class rbf) throws Exception {
       
        XSLTMediator transformMediator = new XSLTMediator();
        transformMediator.setXsltKey("xslt-key");
       
        MessageContext mc = new TestMessageContextBuilder()
            .addEntry("xslt-key", XSLTMediator.class.getResource("identity.xslt"))
            .build();
       
        OMFactory factory = OMAbstractFactory.getOMFactory();
        OMElement orgRoot = factory.createOMElement(new QName("root"));
View Full Code Here

import javax.xml.namespace.QName;

public class TestUtils {

    public static MessageContext getTestContext(String bodyText, Map<String,Entry> props) throws Exception {
        TestMessageContextBuilder builder = new TestMessageContextBuilder();
        builder.setBodyFromString(bodyText);
        if (props != null) {
            for (Map.Entry<String,Entry> mapEntry : props.entrySet()) {
                builder.addEntry(mapEntry.getKey(), mapEntry.getValue());
            }
        }
        return builder.build();
    }
View Full Code Here

        return builder.build();
    }

    public static Axis2MessageContext getAxis2MessageContext(String bodyText,
                                                             Map<String,Entry> props) throws Exception {
        TestMessageContextBuilder builder = new TestMessageContextBuilder();
        builder.setRequireAxis2MessageContext(true);
        builder.setBodyFromString(bodyText);
        if (props != null) {
            for (Map.Entry<String,Entry> mapEntry : props.entrySet()) {
                builder.addEntry(mapEntry.getKey(), mapEntry.getValue());
            }
        }
        return (Axis2MessageContext)builder.build();
    }
View Full Code Here

TOP

Related Classes of org.apache.synapse.TestMessageContextBuilder

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.