Examples of mediate()


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

    public void testMediationWithoutProperties() throws Exception {
        Mediator cm = MediatorFactoryFinder.getInstance().getMediator(createOMElement(
                "<class name='org.apache.synapse.mediators.ext.ClassMediatorTestMediator' " +
                        "xmlns='http://ws.apache.org/ns/synapse'/>"), new Properties());
        cm.mediate(new TestMessageContext());
        assertTrue(ClassMediatorTestMediator.invoked);
    }

    public void testMediationWithLiteralProperties() throws Exception {
        Mediator cm = MediatorFactoryFinder.getInstance().getMediator(createOMElement(
View Full Code Here

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

    public void testMediationWithLiteralProperties() throws Exception {
        Mediator cm = MediatorFactoryFinder.getInstance().getMediator(createOMElement(
                "<class name='org.apache.synapse.mediators.ext.ClassMediatorTestMediator' " +
                        "xmlns='http://ws.apache.org/ns/synapse'><property name='testProp' value='testValue'/></class>"), new Properties());
        cm.mediate(new TestMessageContext());
        assertTrue(ClassMediatorTestMediator.invoked);
        assertTrue(ClassMediatorTestMediator.testProp.equals("testValue"));
    }

    public void testInitializationAndMedition() throws Exception {
View Full Code Here

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

        Mediator cm = MediatorFactoryFinder.getInstance().getMediator(createOMElement(
                "<class name='org.apache.synapse.mediators.ext.ClassMediatorTestMediator' " +
                        "xmlns='http://ws.apache.org/ns/synapse'/>"), new Properties());
        ((ManagedLifecycle) cm).init(new Axis2SynapseEnvironment(new SynapseConfiguration()));
        assertTrue(ClassMediatorTestMediator.initialized);
        cm.mediate(new TestMessageContext());
        assertTrue(ClassMediatorTestMediator.invoked);
    }

    public void testDestroy() throws Exception {
        Mediator cm = MediatorFactoryFinder.getInstance().getMediator(createOMElement(
View Full Code Here

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

    public void testDestroy() throws Exception {
        Mediator cm = MediatorFactoryFinder.getInstance().getMediator(createOMElement(
                "<class name='org.apache.synapse.mediators.ext.ClassMediatorTestMediator' " +
                        "xmlns='http://ws.apache.org/ns/synapse'/>"), new Properties());
        cm.mediate(new TestMessageContext());
        assertTrue(ClassMediatorTestMediator.invoked);
        ((ManagedLifecycle) cm).destroy();
        assertTrue(ClassMediatorTestMediator.destroyed);
    }
View Full Code Here

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

    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>"), new Properties());
        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

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

    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>"), new Properties());
        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

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

        Mediator pcm = MediatorFactoryFinder.getInstance().getMediator(createOMElement(
           "<annotatedCommand name='org.apache.synapse.mediators.ext.AnnotatedCommand2' xmlns='http://ws.apache.org/ns/synapse'/>"), new Properties());

        MessageContext mc = TestUtils.getTestContext("<m:getQuote xmlns:m=\"http://services.samples/xsd\"><m:request><m:symbol>IBM</m:symbol></m:request></m:getQuote>");
        pcm.mediate(mc);
        assertEquals("IBM", AnnotatedCommand2.fieldResult);
        assertEquals("IBM", AnnotatedCommand2.methodResult);
    }
}
View Full Code Here

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

                    } else {
                        if (shouldTrace) {
                            trace.trace("Sequence " + name + "; Executing error handler sequence : "
                                + errorHandler);
                        }
                        return errHandler.mediate(synCtx);
                    }

                } else {
                    if (shouldTrace) {
                        trace.trace("Sequence " + name + " encountered an exception, but does " +
View Full Code Here

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

                handleException("Sequence named " + ref + " cannot be found.");
            } else {
                if (shouldTrace) {
                    trace.trace("Executing sequence named " + ref);
                }
                return m.mediate(synCtx);
            }
        }
        return false;
    }
View Full Code Here

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

                Axis2MessageContext.setErrorInformation(synCtx, e);
                saveAndSetTraceState(synCtx);
                Iterator it = errorHandlerMediators.iterator();
                while (it.hasNext()) {
                    Mediator m = (Mediator) it.next();
                    if (!m.mediate(synCtx)) {
                        return false;
                    }
                }
            } finally {
                restoreTracingState(synCtx);
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.