Package org.apache.synapse

Examples of org.apache.synapse.Mediator.mediate()


            setProperties(m, synCtx, shouldTrace);
            if (shouldTrace) {
                trace.trace("Executing an instance of the specified class : " + clazz.getName());
            }
            return m.mediate(synCtx);
        } finally {
            if (shouldTrace) {
                trace.trace("End : Class mediator");
            }
        }
View Full Code Here


            if (o != null && Mediator.class.isAssignableFrom(o.getClass())) {
                Mediator m = (Mediator) o;
                if (shouldTrace) {
                    trace.trace("Loaded mediator from bean : " + beanName + " executing...");
                }
                return m.mediate(synCtx);

            } else {
                if (shouldTrace) {
                    trace.trace("Unable to load mediator from bean : " + beanName);
                }
View Full Code Here

            } else {
                if (traceOrDebugOn) {
                    traceOrDebug(traceOn, "Executing with key " + key);
                }

                boolean result = m.mediate(synCtx);

                if (traceOrDebugOn) {
                    traceOrDebug(traceOn, "End : Sequence key=<" + key + ">");
                }
                return result;
View Full Code Here

            for (Iterator it = mediators.iterator(); it.hasNext();) {
                Mediator m = (Mediator) it.next();

                // ensure correct trace state after each invocation of a mediator
                synCtx.setTracingState(myEffectiveTraceState);
                if (!m.mediate(synCtx)) {
                    return false;
                }
            }
        } finally {
            synCtx.setTracingState(parentsEffectiveTraceState);
View Full Code Here

    public void testInlineScriptMediatorFactory() throws XMLStreamException {
        ScriptMediatorFactory mf = new ScriptMediatorFactory();
        Mediator mediator = mf.createMediator(INLINE_MEDIATOR_CONFIG);
        try{
            MessageContext mc = TestUtils.getTestContext("<foo/>",null);
            assertTrue(mediator.mediate(mc));
        }catch(Exception e){
            e.printStackTrace();
        }
    }
View Full Code Here

        props.put("MyMediator", prop);
        MessageContext mc = TestUtils.getTestContext("<foo/>", props);

        ScriptMediatorFactory mf = new ScriptMediatorFactory();
        Mediator mediator = mf.createMediator(REG_PROP_MEDIATOR_CONFIG);
        assertTrue(mediator.mediate(mc));
    }

    public void testRegPropWithFunctionMediatorFactory() throws Exception {
        Entry prop = new Entry();
        prop.setValue(MY_MEDIATOR_FOO_FUNC);
View Full Code Here

        props.put("MyFooMediator", prop);
        MessageContext mc = TestUtils.getTestContext("<foo/>", props);

        ScriptMediatorFactory mf = new ScriptMediatorFactory();
        Mediator mediator = mf.createMediator(REG_PROP_FOO_FUNC_MEDIATOR_CONFIG);
        assertTrue(mediator.mediate(mc));
    }

}
View Full Code Here

            if (o != null && Mediator.class.isAssignableFrom(o.getClass())) {
                Mediator m = (Mediator) o;
                if (traceOrDebugOn) {
                    traceOrDebug(traceOn, "Loaded mediator from bean : " + beanName + " executing...");
                }
                return m.mediate(synCtx);

            } else {
                if (traceOrDebugOn) {
                    traceOrDebug(traceOn, "Unable to load mediator from bean : " + beanName);
                }
View Full Code Here

    public void testIterationScenarioOne() throws Exception {
        Mediator iterate = fac.createMediator(createOMElement("<iterate " +
            "expression=\"//original/itr\" xmlns=\"http://ws.apache.org/ns/synapse\">" +
            "<target soapAction=\"urn:iterate\" sequence=\"seqRef\"/></iterate>"));
        helperMediator.clearMediatedContexts();
        iterate.mediate(testCtx);
        while(helperMediator.getMediatedContext(1) == null) {
            Thread.sleep(100);
        }
        MessageContext mediatedCtx = helperMediator.getMediatedContext(0);
        assertEquals(mediatedCtx.getSoapAction(), "urn:iterate");
View Full Code Here

    public void testIterationWithPreservePayload() throws Exception {
        Mediator iterate = fac.createMediator(createOMElement("<iterate " +
            "expression=\"//original/itr\" preservePayload=\"true\" attachPath=\"//original\" " +
            "xmlns=\"http://ws.apache.org/ns/synapse\"><target soapAction=\"urn:iterate\" " +
            "sequence=\"seqRef\"/></iterate>"));
        iterate.mediate(testCtx);
        while(helperMediator.getMediatedContext(1) == null) {
            Thread.sleep(100);
        }
        MessageContext mediatedCtx = helperMediator.getMediatedContext(0);
        assertEquals(mediatedCtx.getSoapAction(), "urn:iterate");
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. 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.