Package org.apache.servicemix.nmr.api

Examples of org.apache.servicemix.nmr.api.Wire


    }
   
    private void startConnections() {
        if (serviceAssemblyDesc.getConnections() != null && serviceAssemblyDesc.getConnections().getConnections() != null) {
            for (Connection connection : serviceAssemblyDesc.getConnections().getConnections()) {
                Wire wire = connection.getWire();
                wires.put(wire, registerWire(wire));
            }
        }
    }
View Full Code Here


    public void testCreateWire() throws Exception {
        Map<String, Object> from = ServiceHelper.createMap(Endpoint.SERVICE_NAME, "test:service",
                                                           Endpoint.ENDPOINT_NAME, "endpoint");
        Map<String, Object> to = ServiceHelper.createMap(Endpoint.SERVICE_NAME, "test:wired-service",
                                                         Endpoint.ENDPOINT_NAME, "endpoint");
        Wire wire = ServiceHelper.createWire(from, to);
        assertEquals(from, wire.getFrom());
        assertEquals(to, wire.getTo());
    }
View Full Code Here

        Consumer consumer = new Consumer();
        consumer.setInterfaceName(CONSUMER_INTERFACE);
        connection.setConsumer(consumer);
        connection.setProvider(createProvider());
       
        Wire wire = connection.getWire();
        assertNotNull(wire);
        assertSame(wire, connection.getWire());
        Map<String, ?> from = ServiceHelper.createMap(Endpoint.INTERFACE_NAME, CONSUMER_INTERFACE.toString());
        assertTrue(ServiceHelper.equals(from, wire.getFrom()));
        assertWireToEnd(wire);
    }
View Full Code Here

        consumer.setServiceName(CONSUMER_SERVICE);
        consumer.setEndpointName(CONSUMER_ENDPOINT);
        connection.setConsumer(consumer);
        connection.setProvider(createProvider());
       
        Wire wire = connection.getWire();
        assertNotNull(wire);
        assertSame(wire, connection.getWire());
        Map<String, ?> from = ServiceHelper.createMap(Endpoint.SERVICE_NAME, CONSUMER_SERVICE.toString(),
                                                      Endpoint.ENDPOINT_NAME, CONSUMER_ENDPOINT);
        assertTrue(ServiceHelper.equals(from, wire.getFrom()));
        assertWireToEnd(wire);
    }
View Full Code Here

     * @param properties the original properties
     * @return the target endpoint if there is a registered {@link Wire} or the original properties
     */
    protected Map<String, ?> handleWiring(Map<String, ?> properties) {
        // check for wires on this Map
        Wire wire = nmr.getWireRegistry().getWire(properties);
        if (wire == null) {
            return properties;
        } else {
            return wire.getTo();
        }
    }
View Full Code Here

     *
     * @param to the target for the wire
     * @return the wire object
     */
    public static Wire createWire(final Map<String, ?> from, final Map<String, Object> to) {
        return new Wire() {
            public Map<String, ?> getFrom() {
                return from;
            }
            public Map<String, ?> getTo() {
                return to;
View Full Code Here

* Test cases for {@link WireRegistryImpl}
*/
public class WireRegistryImplTest extends TestCase {
   
    public void testBasicRegistryBehavior() {
        Wire wire = new MockWire();
        Map<String, Object> properties = new HashMap<String, Object>();
        properties.put("wire-length", 12);
        properties.put("wire-type", "coton");
       
        WireRegistry registry = new WireRegistryImpl();
View Full Code Here

   
    public void testBasicRegistryBehaviorWithConvenienceMethods() {
        Map<String, Object> from = new HashMap<String, Object>();
        from.put("wire-length", 12);
        from.put("wire-type", "coton");
        Wire wire = ServiceHelper.createWire(from, ServiceHelper.createMap("wire-usage", "knitting"));
       
        WireRegistry registry = new WireRegistryImpl();
        registry.register(wire);
        assertEquals(1, registry.getServices().size());
        assertEquals(from, registry.getProperties(wire));
View Full Code Here

     * @param properties the original properties
     * @return the target endpoint if there is a registered {@link Wire} or the original properties
     */
    protected Map<String, ?> handleWiring(Map<String, ?> properties) {
        // check for wires on this Map
        Wire wire = nmr.getWireRegistry().getWire(properties);
        if (wire == null) {
            return properties;
        } else {
            return wire.getTo();
        }
    }
View Full Code Here

    }
   
    private void startConnections() {
        if (serviceAssemblyDesc.getConnections() != null && serviceAssemblyDesc.getConnections().getConnections() != null) {
            for (Connection connection : serviceAssemblyDesc.getConnections().getConnections()) {
                Wire wire = connection.getWire();
                wires.put(wire, registerWire(wire));
            }
        }
    }
View Full Code Here

TOP

Related Classes of org.apache.servicemix.nmr.api.Wire

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.