Package org.apache.synapse.endpoints

Examples of org.apache.synapse.endpoints.AddressEndpoint


        return null;
    }

    protected OMNode createAddressEndpoint(URI uri) {
        AddressEndpoint endpoint = new AddressEndpoint();
        EndpointDefinition def = new EndpointDefinition();
        def.setAddress(uri.toString());
        endpoint.setDefinition(def);
        return EndpointSerializer.getElementFromEndpoint(endpoint);
    }
View Full Code Here


            } else {
                assertEquals(expected.getName(), actual.getName());
            }

            if (expected instanceof AddressEndpoint && actual instanceof AddressEndpoint) {
                AddressEndpoint original = (AddressEndpoint) expected;
                AddressEndpoint copy = (AddressEndpoint) actual;
                assertEquals(original.getDefinition().getAddress(), copy.getDefinition().getAddress());
                return;
            }

            // TODO: Implement support for comparing other types of endpoints
            // TODO: For the moment we can live with only address endpoints
View Full Code Here

            }
        }
    }

    protected Endpoint createEndpoint(String key) {
        Endpoint endpoint = new AddressEndpoint();
        endpoint.setName(key);
        return endpoint;
    }
View Full Code Here

            if (targetEp != null) {
                Endpoint ep = messageContext.getEndpoint(targetEp);

                if (ep instanceof AddressEndpoint) {
                    AddressEndpoint addEp = (AddressEndpoint) ep;
                    String addressUrl = addEp.getDefinition().getAddress();

                    try {
                        MessageContext outCtx = sender.send(messageContext, addressUrl);
                        // If no Exception Occurred We remove the Message
                        if (delete) {
View Full Code Here

                if (targetEp != null) {
                    Endpoint ep = messageContext.getEndpoint(targetEp);

                    if (ep instanceof AddressEndpoint) {
                        AddressEndpoint addEp = (AddressEndpoint) ep;
                        String addressUrl = addEp.getDefinition().getAddress();

                        try {
                            MessageContext outCtx = sender.send(messageContext, addressUrl);

                            if (outCtx != null && "true".equals(outCtx.
View Full Code Here

        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(
                "Addressing information is not serialized properly",
                ep1.getEndpoint().isAddressingOn(),
                ep2.getEndpoint().isAddressingOn());
    }
View Full Code Here

        assertTrue("Leaf level endpoints should be address endpoints",
                addresses.get(1) instanceof AddressEndpoint);
        assertTrue("Leaf level endpoints should be address endpoints",
                addresses.get(2) instanceof AddressEndpoint);

        AddressEndpoint addressEndpoint = (AddressEndpoint) addresses.get(0);
        assertTrue("URI of address endpoint is not serialized properly",
                "http://localhost:9001/soap/Service1".equals(addressEndpoint.getEndpoint().getAddress()));
    }
View Full Code Here

        assertTrue("Leaf level endpoints should be address endpoints",
                addresses.get(1) instanceof AddressEndpoint);
        assertTrue("Leaf level endpoints should be address endpoints",
                addresses.get(2) instanceof AddressEndpoint);

        AddressEndpoint addressEndpoint = (AddressEndpoint) addresses.get(0);
        assertTrue("URI of address endpoint is not serialized properly",
                "http://localhost:9001/soap/Service1".equals(addressEndpoint.getEndpoint().getAddress()));
    }
View Full Code Here

        return instance;
    }

    public Endpoint createEndpoint(OMElement epConfig, boolean anonymousEndpoint) {

        AddressEndpoint addressEndpoint = new AddressEndpoint();

        if (!anonymousEndpoint) {
            OMAttribute name = epConfig.getAttribute(new QName(
                    org.apache.synapse.config.xml.Constants.NULL_NAMESPACE, "name"));

            if (name != null) {
                addressEndpoint.setName(name.getAttributeValue());
            }
        }

        OMElement addressElement = epConfig.getFirstChildWithName
                (new QName(Constants.SYNAPSE_NAMESPACE, "address"));

        if (addressElement != null) {
            EndpointDefinition endpoint = createEndpointDefinition(addressElement);
            addressEndpoint.setEndpoint(endpoint);

            // set the suspend on fail duration.
            OMElement suspendElement = addressElement.getFirstChildWithName(new QName(
                    Constants.SYNAPSE_NAMESPACE,
                    org.apache.synapse.config.xml.Constants.SUSPEND_DURATION_ON_FAILURE));

            if (suspendElement != null) {
                String suspend = suspendElement.getText();

                try {
                    if (suspend != null) {
                        long suspendDuration = Long.parseLong(suspend.trim());
                        addressEndpoint.setSuspendOnFailDuration(suspendDuration * 1000);
                    }

                } catch (NumberFormatException e) {
                    handleException("The suspend duration should be specified as a valid number :: "
                        + e.getMessage(), e);
View Full Code Here

        }

        fac = OMAbstractFactory.getOMFactory();
        OMElement endpointElement = fac.createOMElement("endpoint", Constants.SYNAPSE_OMNAMESPACE);

        AddressEndpoint addressEndpoint = (AddressEndpoint) endpoint;
        String name = addressEndpoint.getName();
        if (name != null) {
            endpointElement.addAttribute("name", name, null);
        }

        EndpointDefinition epAddress = addressEndpoint.getEndpoint();
        OMElement addressElement = serializeEndpointDefinition(epAddress);
        endpointElement.addChild(addressElement);

        long suspendDuration = addressEndpoint.getSuspendOnFailDuration();
        if (suspendDuration != -1) {
            // user has set some value for this. let's serialize it.

            OMElement suspendElement = fac.createOMElement(
                    org.apache.synapse.config.xml.Constants.SUSPEND_DURATION_ON_FAILURE,
View Full Code Here

TOP

Related Classes of org.apache.synapse.endpoints.AddressEndpoint

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.