Package org.apache.servicemix.nmr.api.internal

Examples of org.apache.servicemix.nmr.api.internal.InternalReference.choose()


        InternalReference r = (InternalReference) ref;
        assertNotNull(r.choose(registry));
        assertFalse(r.choose(registry).iterator().hasNext());
        registry.register(endpoint, ServiceHelper.createMap(Endpoint.NAME, "id"));
        assertNotNull(r.choose(registry));
        assertTrue(r.choose(registry).iterator().hasNext());
        registry.unregister(endpoint, null);
        assertNotNull(r.choose(registry));
        assertFalse(r.choose(registry).iterator().hasNext());
    }
View Full Code Here


        assertFalse(r.choose(registry).iterator().hasNext());
        registry.register(endpoint, ServiceHelper.createMap(Endpoint.NAME, "id"));
        assertNotNull(r.choose(registry));
        assertTrue(r.choose(registry).iterator().hasNext());
        registry.unregister(endpoint, null);
        assertNotNull(r.choose(registry));
        assertFalse(r.choose(registry).iterator().hasNext());
    }

    public void testEndpointListener() throws Exception {
        final CountDownLatch regLatch = new CountDownLatch(1);
View Full Code Here

        registry.register(endpoint, ServiceHelper.createMap(Endpoint.NAME, "id"));
        assertNotNull(r.choose(registry));
        assertTrue(r.choose(registry).iterator().hasNext());
        registry.unregister(endpoint, null);
        assertNotNull(r.choose(registry));
        assertFalse(r.choose(registry).iterator().hasNext());
    }

    public void testEndpointListener() throws Exception {
        final CountDownLatch regLatch = new CountDownLatch(1);
        final CountDownLatch unregLatch = new CountDownLatch(1);
View Full Code Here

        // make sure that the query for the wire's from returns the target endpoint
        Reference ref = registry.lookup(from);
        assertNotNull(ref);
        assertTrue(ref instanceof InternalReference);
        InternalReference reference = (InternalReference) ref;
        Iterable<InternalEndpoint> endpoints = reference.choose(registry);
        assertNotNull(endpoints);
        assertTrue(endpoints.iterator().hasNext());
        assertEquals(endpoint, endpoints.iterator().next().getEndpoint());
    }
View Full Code Here

        // make sure that the query for the wire's from returns the target endpoint
        Reference ref = registry.lookup(ServiceHelper.createMap());
        assertNotNull(ref);
        assertTrue(ref instanceof InternalReference);
        InternalReference reference = (InternalReference) ref;
        Iterable<InternalEndpoint> endpoints = reference.choose(registry);
        assertNotNull(endpoints);
        assertFalse(endpoints.iterator().hasNext());
    }

    private Endpoint createWiredEndpoint(Map<String, Object> from) {
View Full Code Here

                InternalReference target = (InternalReference) exchange.getTarget();
                // TODO: possible NPE on target should be avoided
                assert target != null;
                boolean match = false;
                boolean securityMatch = false;
                for (InternalEndpoint endpoint : target.choose(registry)) {
                    if (Boolean.valueOf((String) endpoint.getMetaData().get(Endpoint.UNTARGETABLE))) {
                        continue;
                    }
                    match = true;
                    if (authorizationService != null) {
View Full Code Here

    public void dispatch(InternalExchange exchange) {
        if (exchange.getRole() == Role.Consumer) {
            if (exchange.getDestination() == null) {
                InternalReference target = (InternalReference) exchange.getTarget();
                assert target != null;
                for (InternalEndpoint endpoint : target.choose()) {
                    for (Flow flow : getServices()) {
                        if (flow.canDispatch(exchange, endpoint)) {
                            exchange.setDestination(endpoint);
                            flow.dispatch(exchange);
                            return;
View Full Code Here

        Endpoint endpoint = new DummyEndpoint();
        Reference ref = registry.lookup(ServiceHelper.createMap(Endpoint.NAME, "id"));
        assertNotNull(ref);
        assertTrue(ref instanceof InternalReference);
        InternalReference r = (InternalReference) ref;
        assertNotNull(r.choose(registry));
        assertFalse(r.choose(registry).iterator().hasNext());
        registry.register(endpoint, ServiceHelper.createMap(Endpoint.NAME, "id"));
        assertNotNull(r.choose(registry));
        assertTrue(r.choose(registry).iterator().hasNext());
        registry.unregister(endpoint, null);
View Full Code Here

        Reference ref = registry.lookup(ServiceHelper.createMap(Endpoint.NAME, "id"));
        assertNotNull(ref);
        assertTrue(ref instanceof InternalReference);
        InternalReference r = (InternalReference) ref;
        assertNotNull(r.choose(registry));
        assertFalse(r.choose(registry).iterator().hasNext());
        registry.register(endpoint, ServiceHelper.createMap(Endpoint.NAME, "id"));
        assertNotNull(r.choose(registry));
        assertTrue(r.choose(registry).iterator().hasNext());
        registry.unregister(endpoint, null);
        assertNotNull(r.choose(registry));
View Full Code Here

        assertTrue(ref instanceof InternalReference);
        InternalReference r = (InternalReference) ref;
        assertNotNull(r.choose(registry));
        assertFalse(r.choose(registry).iterator().hasNext());
        registry.register(endpoint, ServiceHelper.createMap(Endpoint.NAME, "id"));
        assertNotNull(r.choose(registry));
        assertTrue(r.choose(registry).iterator().hasNext());
        registry.unregister(endpoint, null);
        assertNotNull(r.choose(registry));
        assertFalse(r.choose(registry).iterator().hasNext());
    }
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. 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.