Package org.apache.synapse.mediators.builtin

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


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

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

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

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

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

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

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


                SequenceMediator mainSeq = new SequenceMediator();
                mainSeq.setName("main");
                InMediator in = new InMediator();

                OutMediator out = new OutMediator();
                out.addChild(new SendMediator());
                mainSeq.addChild(in);
                mainSeq.addChild(out);

                SendMediator send = new SendMediator();
                LoadbalanceEndpoint lb = new LoadbalanceEndpoint();

                FilterMediator filterMediator = new FilterMediator();
                in.addChild(filterMediator);
                SynapseXPath xpath = new SynapseXPath("get-property('To')");
                filterMediator.setSource(xpath);
                filterMediator.setRegex(Pattern.compile("/carbon"));

                PropertyMediator httpSCProperty = new PropertyMediator();
                httpSCProperty.setName("HTTP_SC");
                httpSCProperty.setScope("axis2");
                httpSCProperty.setValue("302");

                PropertyMediator locationHeader = new PropertyMediator();
                locationHeader.setName("Location");
                locationHeader.setScope("transport");
                locationHeader.setValue(getMasterHttpsEndpoint(PortSelector.normalEndpointList));

                PropertyMediator responseProperty = new PropertyMediator();
                responseProperty.setName(SynapseConstants.RESPONSE);
                responseProperty.setValue("true");

                HeaderMediator headerMediator = new HeaderMediator();
                headerMediator.setQName(new QName("To"));
                headerMediator.setAction(1);

                SendMediator sendMediator = new SendMediator();
                DropMediator dropMediator = new DropMediator();

                filterMediator.addChild(locationHeader);
                filterMediator.addChild(httpSCProperty);
                filterMediator.addChild(responseProperty);
View Full Code Here

        // Test
        assertDependency(ConfigurationObject.TYPE_ENTRY, entry.getKey(), endpoint.getName());

        // Add a sequence which is dependent on the endpoint
        SequenceMediator seq1 = createSequence("seq1", null);
        SendMediator send = new SendMediator();
        IndirectEndpoint endpointRef = new IndirectEndpoint();
        endpointRef.setKey(endpoint.getName());
        send.setEndpoint(endpointRef);
        seq1.addChild(send);
        synapseConfig.addSequence(seq1.getName(), seq1);

        // Test
        assertDependency(ConfigurationObject.TYPE_ENDPOINT, endpoint.getName(), seq1.getName());
View Full Code Here

        Endpoint endpoint = createEndpoint("endpoint");
        initEndpoint(endpoint, entry.getKey());
        synapseConfig.addEndpoint(endpoint.getName(), endpoint);

        SequenceMediator seq1 = createSequence("seq1", null);
        SendMediator send = new SendMediator();
        IndirectEndpoint endpointRef = new IndirectEndpoint();
        endpointRef.setKey(endpoint.getName());
        send.setEndpoint(endpointRef);
        seq1.addChild(send);
        synapseConfig.addSequence(seq1.getName(), seq1);

        SequenceMediator seq2 = createSequence("seq2", seq1.getName());
        synapseConfig.addSequence(seq2.getName(), seq2);
View Full Code Here

        Endpoint endpoint2 = createEndpoint("endpoint2");
        initEndpoint(endpoint2, null);
        synapseConfig.addEndpoint(endpoint2.getName(), endpoint2);

        SequenceMediator seq1 = createSequence("seq1", null);
        SendMediator send = new SendMediator();
        IndirectEndpoint endpointRef = new IndirectEndpoint();
        endpointRef.setKey(endpoint.getName());
        send.setEndpoint(endpointRef);
        seq1.addChild(send);
        synapseConfig.addSequence(seq1.getName(), seq1);

        assertDependency(ConfigurationObject.TYPE_ENDPOINT, endpoint.getName(), seq1.getName());
        synapseConfig.removeSequence(seq1.getName());
        seq1.removeChild(0);
        send = new SendMediator();
        endpointRef = new IndirectEndpoint();
        endpointRef.setKey(endpoint2.getName());
        send.setEndpoint(endpointRef);
        seq1.addChild(send);
        synapseConfig.addSequence(seq1.getName(), seq1);
        assertNoDependency(ConfigurationObject.TYPE_ENDPOINT, endpoint.getName());
        assertDependency(ConfigurationObject.TYPE_ENDPOINT, endpoint2.getName(), seq1.getName());
View Full Code Here

        Endpoint endpoint = createEndpoint("endpoint");
        initEndpoint(endpoint, null);
        synapseConfig.addEndpoint(endpoint.getName(), endpoint);

        SequenceMediator sequence = createSequence("sequence", null);
        SendMediator send = new SendMediator();
        IndirectEndpoint target = new IndirectEndpoint();
        target.setKey(endpoint.getName());
        send.setEndpoint(target);
        sequence.addChild(send);
        synapseConfig.addSequence(sequence.getName(), sequence);
        assertDependency(ConfigurationObject.TYPE_ENDPOINT, endpoint.getName(), sequence.getName());

        SequenceMediator sequence2 = createSequence("sequence2", sequence.getName());
View Full Code Here

    public List<ConfigurationObject> resolve(Mediator m) {
        if (!(m instanceof SendMediator)) {
            return null;
        }

        SendMediator sendMediator = (SendMediator) m;
        Endpoint endpoint = sendMediator.getEndpoint();
        if (endpoint instanceof IndirectEndpoint) {
            IndirectEndpoint indirect = (IndirectEndpoint) endpoint;
            List<ConfigurationObject> providers = new ArrayList<ConfigurationObject>();
            providers.add(new ConfigurationObject(ConfigurationObject.TYPE_ENDPOINT,
                    indirect.getKey()));
View Full Code Here

                    for(Mediator inChild : ((InMediator)child).getList()){
                       
                        // find the SendMediator
                        if (inChild instanceof SendMediator) {
                           
                            SendMediator sendMediator = (SendMediator) inChild;
                           
                            /* add Tenant Aware LB endpoint */
                           
                            TenantAwareLoadBalanceEndpoint tenantAwareEp = new TenantAwareLoadBalanceEndpoint();

                            tenantAwareEp.init(synapseEnv);
                           
                            sendMediator.setEndpoint(tenantAwareEp);
                           
                            successfullyRegistered = true;

                            if (log.isDebugEnabled()) {
                                log.debug("Added Tenant Aware Endpoint: " +
                                          sendMediator.getEndpoint().getName() + "" +
                                          " to Send Mediator.");
                            }
                        }
                    }
                }
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.setMainMediator(mainmediator);
        return config;
    }
View Full Code Here

                          "</address>" +
                     "</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 address endpoint.",
                send1.getEndpoint() instanceof AddressEndpoint);
        AddressEndpoint ep1 = (AddressEndpoint) send1.getEndpoint();

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

        assertEquals("Address URI is not serialized properly",
                ep1.getEndpoint().getAddress(), ep2.getEndpoint().getAddress());

        assertEquals(
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.