Package org.apache.synapse

Examples of org.apache.synapse.MessageContext


        seq.addChild(t1);
        seq.addChild(t2);
        seq.addChild(t3);

        // invoke transformation, with static enveope
        MessageContext synCtx = TestUtils.getTestContext("<empty/>");
        seq.mediate(synCtx);

        assertTrue("T1.T2.T3".equals(result.toString()));
    }
View Full Code Here


        Mediator pcm = MediatorFactoryFinder.getInstance().getMediator(createOMElement(
                "<pojoCommand name='org.apache.synapse.mediators.ext.POJOCommandTestImplementedMediator' " +
                        "xmlns='http://ws.apache.org/ns/synapse'><property name=\"ctxTest\" " +
                        "context-name=\"testCtxProp\" action=\"ReadAndUpdateContext\"/></pojoCommand>"), new Properties());
        POJOCommandTestHelper.reset();
        MessageContext ctx = new TestMessageContext();
        ctx.setProperty("testCtxProp", "test");
        pcm.mediate(ctx);
        assertEquals("testcommand", ctx.getProperty("testCtxProp").toString());
        assertTrue(POJOCommandTestHelper.getInstance().isExecuted());
    }
View Full Code Here

        // set the schema url, source xpath and any name spaces
        validate.setSchemaKeys(Collections.singletonList("xsd-key"));
        validate.setSource(createXPath("//m0:CheckPriceRequest"));

        MessageContext synCtx = new TestMessageContextBuilder()
                .addFileEntry("xsd-key", "./../../repository/conf/sample/resources/validate/validate.xsd")
                .setBodyFromString(VALID_ENVELOPE).build();

        // test validate mediator, with static enveope
        test(validate, synCtx, false);
View Full Code Here

        // set the schema url, source xpath and any name spaces
        validate.setSchemaKeys(Arrays.asList("xsd-key-1", "xsd-key-2"));
        validate.setSource(createXPath("//m1:Outer"));

        MessageContext synCtx = new TestMessageContextBuilder()
                .addFileEntry("xsd-key-1", "./../../repository/conf/sample/resources/validate/validate.xsd")
                .addFileEntry("xsd-key-2", "./../../repository/conf/sample/resources/validate/validate2.xsd")
                .setBodyFromString(VALID_ENVELOPE_TWO_SCHEMAS).build();

        // test validate mediator, with static enveope
View Full Code Here

        // set the schema url, source xpath and any name spaces
        validate.setSchemaKeys(Arrays.asList("xsd-key-1", "xsd-key-2"));
        validate.setSource(createXPath("//m1:Outer"));

        MessageContext synCtx = new TestMessageContextBuilder()
                .addFileEntry("xsd-key-1", "./../../repository/conf/sample/resources/validate/validate.xsd")
                .addFileEntry("xsd-key-2", "./../../repository/conf/sample/resources/validate/validate2.xsd")
                .setBodyFromString(INVALID_ENVELOPE_TWO_SCHEMAS).build();

        // test validate mediator, with static enveope
View Full Code Here

        // set the schema url, source xpath and any name spaces
        validate.setSchemaKeys(Collections.singletonList("xsd-key-1"));
        validate.setSource(createXPath("//m0:CheckPriceRequest"));

        MessageContext synCtx = new TestMessageContextBuilder()
                .addFileEntry("xsd-key-1", "./../../repository/conf/sample/resources/validate/validate.xsd")
                .setBodyFromString(IN_VALID_ENVELOPE).build();

        // test validate mediator, with static enveope
        test(validate, synCtx, true);
View Full Code Here

        // set the schema url, source xpath and any name spaces
        validate.setSchemaKeys(Collections.singletonList("xsd-key-1"));
        validate.setSource(createXPath("//m0:CheckPriceRequest"));

        MessageContext synCtx = new TestMessageContextBuilder()
                .addFileEntry("xsd-key-1", "./../../repository/conf/sample/resources/validate/validate.xsd")
                .setBodyFromString(VALID_ENVELOPE_NO_NS).build();

        // test validate mediator, with static enveope
        test(validate, synCtx, false);
View Full Code Here

        // set the schema url, source xpath and any name spaces
        validate.setSchemaKeys(Collections.singletonList("xsd-key-1"));
        validate.setSource(createXPath("//m0:CheckPriceRequest"));

        MessageContext synCtx = new TestMessageContextBuilder()
                .addFileEntry("xsd-key-1", "./../../repository/conf/sample/resources/validate/validate.xsd")
                .setBodyFromString(IN_VALID_ENVELOPE_NO_NS).build();

        // test validate mediator, with static enveope
        test(validate, synCtx, true);
View Full Code Here

    private void makeValidInvocation(ValidateMediator validate) throws Exception {
        // set the schema url, source xpath and any name spaces
        validate.setSchemaKeys(Collections.singletonList("xsd-key-1"));
        validate.setSource(createXPath("//m0:CheckPriceRequest"));

        MessageContext synCtx = new TestMessageContextBuilder()
                .addFileEntry("xsd-key-1", "./../../repository/conf/sample/resources/validate/validate.xsd")
                .setBodyFromString(VALID_ENVELOPE).build();

        // test validate mediator, with static enveope
        test(validate, synCtx, false);
View Full Code Here

            "key=\"seqRef\"/></sequence></target></clone>"), new Properties());
        clone.mediate(testCtx);
        while(helperMediator.getMediatedContext(1) == null) {
            Thread.sleep(100);
        }
        MessageContext mediatedCtx = helperMediator.getMediatedContext(0);
        String formerSAction = mediatedCtx.getSoapAction();
        mediatedCtx = helperMediator.getMediatedContext(1);
        if ("urn:clone".equals(formerSAction)) {
            assertEquals(mediatedCtx.getSoapAction(), "urn:test");
            assertEquals(mediatedCtx.getTo().getAddress(), "http://test");
        } else {
            assertEquals(mediatedCtx.getSoapAction(), "urn:clone");
        }
    }
View Full Code Here

TOP

Related Classes of org.apache.synapse.MessageContext

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.