Package org.apache.synapse.mediators.builtin

Examples of org.apache.synapse.mediators.builtin.SendMediator


                          "</wsdl>" +
                     "</endpoint>" +
                "</send>";

        OMElement config1 = createOMElement(sendConfig);
        SendMediator send1 = (SendMediator) factory.createMediator(config1);

        OMElement config2 = serializer.serializeMediator(null, send1);
        SendMediator send2 = (SendMediator) factory.createMediator(config2);

        assertTrue("Top level endpoint should be a WSDL endpoint.",
                send1.getEndpoint() instanceof WSDLEndpoint);
        WSDLEndpoint ep1 = (WSDLEndpoint) send1.getEndpoint();

        assertTrue("Top level endpoint should be a WSDL endpoint.",
                send2.getEndpoint() instanceof WSDLEndpoint);
        WSDLEndpoint ep2 = (WSDLEndpoint) send2.getEndpoint();

        assertEquals("Service name is not serialized properly.",
                ep1.getServiceName(), ep2.getServiceName());

        assertEquals("Port name is not serialized properly", ep1.getPortName(), ep2.getPortName());
View Full Code Here


                    "</loadbalance>" +
                "</endpoint>" +
                "</send>";

        OMElement config1 = createOMElement(sendConfig);
        SendMediator send1 = (SendMediator) factory.createMediator(config1);

        OMElement config2 = serializer.serializeMediator(null, send1);
        SendMediator send2 = (SendMediator) factory.createMediator(config2);

        assertTrue("Top level endpoint should be a load balance endpoint.",
                send2.getEndpoint() instanceof LoadbalanceEndpoint);

        LoadbalanceEndpoint endpoint = (LoadbalanceEndpoint) send2.getEndpoint();
        List addresses = endpoint.getEndpoints();
        assertEquals("There should be 3 leaf level address endpoints", addresses.size(), 3);

        assertTrue("Leaf level endpoints should be address endpoints",
                addresses.get(0) instanceof AddressEndpoint);
View Full Code Here

                    "</failover>" +
                "</endpoint>" +
                "</send>";

        OMElement config1 = createOMElement(sendConfig);
        SendMediator send1 = (SendMediator) factory.createMediator(config1);

        OMElement config2 = serializer.serializeMediator(null, send1);
        SendMediator send2 = (SendMediator) factory.createMediator(config2);

        assertTrue("Top level endpoint should be a failover endpoint.",
                send2.getEndpoint() instanceof FailoverEndpoint);

        FailoverEndpoint endpoint = (FailoverEndpoint) send2.getEndpoint();
        List addresses = endpoint.getEndpoints();
        assertEquals("There should be 3 leaf level address endpoints", addresses.size(), 3);

        assertTrue("Leaf level endpoints should be address endpoints",
                addresses.get(0) instanceof AddressEndpoint);
View Full Code Here

                    "</loadbalance>" +
                "</endpoint>" +
                "</send>";

        OMElement config1 = createOMElement(sendConfig);
        SendMediator send1 = (SendMediator) factory.createMediator(config1);

        OMElement config2 = serializer.serializeMediator(null, send1);
        SendMediator send2 = (SendMediator) factory.createMediator(config2);

        assertTrue("Top level endpoint should be a load balance endpoint.",
                send2.getEndpoint() instanceof LoadbalanceEndpoint);

        LoadbalanceEndpoint loadbalanceEndpoint = (LoadbalanceEndpoint) send2.getEndpoint();

        List children = loadbalanceEndpoint.getEndpoints();
        assertEquals("Top level endpoint should have 2 child endpoints.", children.size(), 2);

        assertTrue("First child should be a address endpoint",
View Full Code Here

     */
    public static SynapseConfiguration getDefaultConfiguration() {
        // programatically create an empty configuration which just sends messages to thier implicit destinations
        SynapseConfiguration config = new SynapseConfiguration();
        SynapseMediator mainmediator = new SynapseMediator();
        mainmediator.addChild(new SendMediator());
        config.addSequence("main", mainmediator);
        return config;
    }
View Full Code Here

    private static final QName SEND_Q = new QName(Constants.SYNAPSE_NAMESPACE, "send");

    public Mediator createMediator(OMElement elem) {

        SendMediator sm =  new SendMediator();

        // after successfully creating the mediator
        // set its common attributes such as tracing etc
        initMediator(sm,elem);

        OMElement epElement = elem.getFirstChildWithName(new QName(Constants.SYNAPSE_NAMESPACE, "endpoint"));
        if (epElement != null) {
            // get the factory for the element
            // create the endpoint and set it in the send medaitor

            EndpointFactory fac = EndpointAbstractFactory.getEndpointFactroy(epElement);
            if (fac != null) {
                Endpoint endpoint = fac.createEndpoint(epElement, true);
                if (endpoint != null) {
                    sm.setEndpoint(endpoint);
                }
            } else {
                throw new SynapseException("Invalid endpoint fromat.");
            }
        }
View Full Code Here

        if (!(m instanceof SendMediator)) {
            handleException("Unsupported mediator passed in for serialization : " + m.getType());
        }

        SendMediator mediator = (SendMediator) m;
        OMElement send = fac.createOMElement("send", synNS);
        finalizeSerialization(send, mediator);

        Endpoint activeEndpoint = mediator.getEndpoint();
        if (activeEndpoint != null) {
            EndpointSerializer serializer = EndpointAbstractSerializer.
                    getEndpointSerializer(activeEndpoint);

            OMElement endpointElement = serializer.serializeEndpoint(activeEndpoint);
View Full Code Here

     * @param config the configuration to be updated
     */
    private static void setDefaultMainSequence(SynapseConfiguration config) {
        SequenceMediator main = new SequenceMediator();
        main.setName(org.apache.synapse.Constants.MAIN_SEQUENCE_KEY);
        main.addChild(new SendMediator());
        config.addSequence(org.apache.synapse.Constants.MAIN_SEQUENCE_KEY, main);
    }
View Full Code Here

    private static final QName SEND_Q = new QName(XMLConfigConstants.SYNAPSE_NAMESPACE, "send");
    private static final QName ENDPOINT_Q = new QName(XMLConfigConstants.SYNAPSE_NAMESPACE, "endpoint");

    public Mediator createMediator(OMElement elem) {

        SendMediator sm =  new SendMediator();

        // after successfully creating the mediator
        // set its common attributes such as tracing etc
        processTraceState(sm,elem);

        OMElement epElement = elem.getFirstChildWithName(ENDPOINT_Q);
        if (epElement != null) {
            // get the factory for the element
            // create the endpoint and set it in the send medaitor

            EndpointFactory fac = EndpointAbstractFactory.getEndpointFactroy(epElement);
            if (fac != null) {
                Endpoint endpoint = fac.createEndpoint(epElement, true);
                if (endpoint != null) {
                    sm.setEndpoint(endpoint);
                }
            } else {
                throw new SynapseException("Invalid endpoint fromat.");
            }
        }
View Full Code Here

        if (!(m instanceof SendMediator)) {
            handleException("Unsupported mediator passed in for serialization : " + m.getType());
        }

        SendMediator mediator = (SendMediator) m;
        OMElement send = fac.createOMElement("send", synNS);
        saveTracingState(send, mediator);

        Endpoint activeEndpoint = mediator.getEndpoint();
        if (activeEndpoint != null) {
            EndpointSerializer serializer = EndpointAbstractSerializer.
                    getEndpointSerializer(activeEndpoint);

            OMElement endpointElement = serializer.serializeEndpoint(activeEndpoint);
View Full Code Here

TOP

Related Classes of org.apache.synapse.mediators.builtin.SendMediator

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.