Package org.apache.synapse

Examples of org.apache.synapse.SynapseEnvironment


    public void testAddressingProcessor() throws Exception {
        SynapseMessage sm = new Axis2SynapseMessage(
                Axis2EnvSetup.axis2Deployment("target/synapse-repository"));
        Processor addressingProcessor = new AddressingInProcessor();
        SynapseEnvironment env = new Axis2SynapseEnvironment(null,null);
        boolean result = addressingProcessor.process(env,sm);
        assertTrue(((Boolean) sm.getProperty(
                Constants.MEDIATOR_RESPONSE_PROPERTY)).booleanValue());
        assertTrue(result);
    }
View Full Code Here


public class AddressingInProcessorTest extends TestCase {

    public void testAddressingInProcessor() throws Exception {

        SynapseEnvironment se = TestSynapseEnvironment.createAxis2SynapseEnvironment();
        SynapseMessage smNoAdd = TestSynapseMessage.createSampleSOAP11MessageWithoutAddressing("target/synapse-repository");
        AddressingInProcessor aip = new AddressingInProcessor();

        aip.process(se, smNoAdd);
        assertTrue("to should be null if there is no addressing header", smNoAdd.getTo() == null);
View Full Code Here

    private Log log = LogFactory.getLog(getClass());

    public void receive(MessageContext mc) throws AxisFault {
        log.debug("receiving message");
        SynapseEnvironment env = Axis2SynapseEnvironmentFinder
                .getSynapseEnvironment(mc);
        ////////////////////////////////////////////////////////////////////////
        // SynapseEnvironment is set as a property in MessageContext. This is due
        // use we can expect in ServiceMeidatorProcessor and many extensions yet to come
        // So it a mediator uses EnvironmentAware, that mediator will be injected with the correct environment
        mc.setProperty(
                org.apache.synapse.Constants.MEDIATOR_SYNAPSE_ENV_PROPERTY,
                env);
        ////////////////////////////////////////////////////////////////////////
        SynapseMessage smc = new Axis2SynapseMessage(mc);
        env.injectMessage(smc);

        ///////////////////////////////////////////////////////////////////////
        // Response handling mechanism for 200/202 and 5XX
        // smc.isResponse =true then the response will be handle with 200 OK
        // else, response will be 202 OK without no http body
View Full Code Here


public class SynapseConfiguratorTest extends TestCase {
    public void testSynapseEnvironmentFinder() throws Exception {
        MessageContext mc = Axis2EnvSetup.axis2Deployment("target/synapse-repository");
        SynapseEnvironment env = Axis2SynapseEnvironmentFinder
        .getSynapseEnvironment(mc);
        assertNotNull(env);

        AxisConfiguration ac = mc.getConfigurationContext().getAxisConfiguration();
View Full Code Here

    public void setUp() throws Exception {
        msgCtx = Axis2EnvSetup.axis2Deployment("target/synapse-repository");
    }

    public void testAddressingProcessor() throws Exception {
        SynapseEnvironment env = new Axis2SynapseEnvironment(
                Axis2EnvSetup.getSynapseConfigElement(synapsexml),
                Thread.currentThread().getContextClassLoader());
        SynapseMessage smc = new Axis2SynapseMessage(msgCtx);
        env.injectMessage(smc);
        assertTrue(((Boolean) smc.getProperty(
                Constants.MEDIATOR_RESPONSE_PROPERTY)).booleanValue());
        assertEquals("add",env.lookupProcessor("add").getName());
    }
View Full Code Here

        Object processorObject = clazz.newInstance();
        if (!(processorObject instanceof XSLTProcessorConfigurator)) {
            throw new Exception(
                    "XSLTProcessorConfigurator initialization falied");
        }
        SynapseEnvironment env = new Axis2SynapseEnvironment(
                Axis2EnvSetup.getSynapseConfigElement(synapsexml),
                Thread.currentThread().getContextClassLoader());
        assertNotNull(env.getMasterProcessor());

        SynapseMessage sm = new Axis2SynapseMessage(
                Axis2EnvSetup.axis2Deployment("target/synapse-repository"));
        // throws exceptions if anything goes wrong
        env.injectMessage(sm);

    }
View Full Code Here

        Object obj = makeNewServiceObject(messageContext);

        Mediator mediator = (Mediator) obj;

        if (EnvironmentAware.class.isAssignableFrom(mediator.getClass())) {
            SynapseEnvironment se = (SynapseEnvironment) messageContext
                    .getProperty(Constants.MEDIATOR_SYNAPSE_ENV_PROPERTY);
            ((EnvironmentAware) mediator).setSynapseEnvironment(se);
            ((EnvironmentAware) mediator).setClassLoader(
                    messageContext.getAxisService().getClassLoader());
        }
View Full Code Here

TOP

Related Classes of org.apache.synapse.SynapseEnvironment

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.