Package org.apache.servicemix.nmr.api

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


    public void testInOutNoTxRbInError() throws Exception {
        createRoute(Transacted.None, true, false, true);

        Channel client = nmr1.createChannel();
        Exchange exchange = client.createExchange(Pattern.InOut);
        exchange.getIn().setBody(new StringSource("<hello/>"));
        exchange.setTarget(nmr1.getEndpointRegistry().lookup(ServiceHelper.createMap(Endpoint.NAME, PROXY_ENDPOINT_NAME)));
        assertTrue("sendSync failed for exchange " + exchange.getId(), client.sendSync(exchange));
        assertEquals("bad status for exchange " + exchange.getId(), Status.Error, exchange.getStatus());
        client.close();
        receiver.assertExchangesReceived(1, TIMEOUT);
    }
View Full Code Here


    public void testInOutJmsTxNoRb() throws Exception {
        createRoute(Transacted.Jms, false, false, false);

        Channel client = nmr1.createChannel();
        Exchange exchange = client.createExchange(Pattern.InOut);
        exchange.getIn().setBody(new StringSource("<hello/>"));
        exchange.setTarget(nmr1.getEndpointRegistry().lookup(ServiceHelper.createMap(Endpoint.NAME, PROXY_ENDPOINT_NAME)));
        assertTrue("sendSync failed for exchange " + exchange.getId(), client.sendSync(exchange));
        assertEquals("bad status for exchange " + exchange.getId(), Status.Active, exchange.getStatus());
        exchange.setStatus(Status.Done);
        client.send(exchange);
        client.close();
        receiver.assertExchangesReceived(2, TIMEOUT);
    }
View Full Code Here

    public void testInOutJmsTxNoRbInError() throws Exception {
        createRoute(Transacted.Jms, false, false, true);

        Channel client = nmr1.createChannel();
        Exchange exchange = client.createExchange(Pattern.InOut);
        exchange.getIn().setBody(new StringSource("<hello/>"));
        exchange.setTarget(nmr1.getEndpointRegistry().lookup(ServiceHelper.createMap(Endpoint.NAME, PROXY_ENDPOINT_NAME)));
        assertTrue("sendSync failed for exchange " + exchange.getId(), client.sendSync(exchange));
        assertEquals("bad status for exchange " + exchange.getId(), Status.Error, exchange.getStatus());
        client.close();
        receiver.assertExchangesReceived(1, TIMEOUT);
    }
View Full Code Here

    public void testInOutJmsTxRb() throws Exception {
        createRoute(Transacted.Jms, true, false, false);

        Channel client = nmr1.createChannel();
        Exchange exchange = client.createExchange(Pattern.InOut);
        exchange.getIn().setBody(new StringSource("<hello/>"));
        exchange.setTarget(nmr1.getEndpointRegistry().lookup(ServiceHelper.createMap(Endpoint.NAME, PROXY_ENDPOINT_NAME)));
        assertTrue("sendSync failed for exchange " + exchange.getId(), client.sendSync(exchange));
        assertEquals("bad status for exchange " + exchange.getId(), Status.Active, exchange.getStatus());
        exchange.setStatus(Status.Done);
        client.send(exchange);
        client.close();
        receiver.assertExchangesReceived(2, TIMEOUT);
    }
View Full Code Here

    public void testInOutJmsTxRbInError() throws Exception {
        createRoute(Transacted.Jms, true, false, true);

        Channel client = nmr1.createChannel();
        Exchange exchange = client.createExchange(Pattern.InOut);
        exchange.getIn().setBody(new StringSource("<hello/>"));
        exchange.setTarget(nmr1.getEndpointRegistry().lookup(ServiceHelper.createMap(Endpoint.NAME, PROXY_ENDPOINT_NAME)));
        assertTrue("sendSync failed for exchange " + exchange.getId(), client.sendSync(exchange));
        assertEquals("bad status for exchange " + exchange.getId(), Status.Active, exchange.getStatus());
        exchange.setStatus(Status.Done);
        client.send(exchange);
        client.close();
        receiver.assertExchangesReceived(3, TIMEOUT);
    }
View Full Code Here

    public void testInOutAckTxNoRb() throws Exception {
        createRoute(Transacted.ClientAck, false, false, false);

        Channel client = nmr1.createChannel();
        Exchange exchange = client.createExchange(Pattern.InOut);
        exchange.getIn().setBody(new StringSource("<hello/>"));
        exchange.setTarget(nmr1.getEndpointRegistry().lookup(ServiceHelper.createMap(Endpoint.NAME, PROXY_ENDPOINT_NAME)));
        assertTrue("sendSync failed for exchange " + exchange.getId(), client.sendSync(exchange));
        assertEquals("bad status for exchange " + exchange.getId(), Status.Active, exchange.getStatus());
        exchange.setStatus(Status.Done);
        client.send(exchange);
        client.close();
        receiver.assertExchangesReceived(2, TIMEOUT);
    }
View Full Code Here

    public void testInOutAckTxNoRbInError() throws Exception {
        createRoute(Transacted.ClientAck, false, false, true);

        Channel client = nmr1.createChannel();
        Exchange exchange = client.createExchange(Pattern.InOut);
        exchange.getIn().setBody(new StringSource("<hello/>"));
        exchange.setTarget(nmr1.getEndpointRegistry().lookup(ServiceHelper.createMap(Endpoint.NAME, PROXY_ENDPOINT_NAME)));
        assertTrue("sendSync failed for exchange " + exchange.getId(), client.sendSync(exchange));
        assertEquals("bad status for exchange " + exchange.getId(), Status.Error, exchange.getStatus());
        client.close();
        receiver.assertExchangesReceived(1, TIMEOUT);
    }
View Full Code Here

    public void testInOutAckTxRb() throws Exception {
        createRoute(Transacted.ClientAck, true, false, false);

        Channel client = nmr1.createChannel();
        Exchange exchange = client.createExchange(Pattern.InOut);
        exchange.getIn().setBody(new StringSource("<hello/>"));
        exchange.setTarget(nmr1.getEndpointRegistry().lookup(ServiceHelper.createMap(Endpoint.NAME, PROXY_ENDPOINT_NAME)));
        assertTrue("sendSync failed for exchange " + exchange.getId(), client.sendSync(exchange));
        assertEquals("bad status for exchange " + exchange.getId(), Status.Active, exchange.getStatus());
        exchange.setStatus(Status.Done);
        client.send(exchange);
        client.close();
        receiver.assertExchangesReceived(2, TIMEOUT);
    }
View Full Code Here

    public void testInOutAckTxRbInError() throws Exception {
        createRoute(Transacted.ClientAck, true, false, true);

        Channel client = nmr1.createChannel();
        Exchange exchange = client.createExchange(Pattern.InOut);
        exchange.getIn().setBody(new StringSource("<hello/>"));
        exchange.setTarget(nmr1.getEndpointRegistry().lookup(ServiceHelper.createMap(Endpoint.NAME, PROXY_ENDPOINT_NAME)));
        assertTrue("sendSync failed for exchange " + exchange.getId(), client.sendSync(exchange));
        assertEquals("bad status for exchange " + exchange.getId(), Status.Active, exchange.getStatus());
        exchange.setStatus(Status.Done);
        client.send(exchange);
        client.close();
        receiver.assertExchangesReceived(3, TIMEOUT);
    }
View Full Code Here

        }
    }

    public void assertExchangeCompleted() throws Exception {
        long start = System.currentTimeMillis();
        Exchange active = null;
        while (true) {
            synchronized (exchanges) {
                for (Iterator<Exchange> it = exchanges.values().iterator(); it.hasNext();) {
                    active = null;
                    Exchange me = it.next();
                    if (me.getStatus() == Status.Active) {
                        active = me;
                        break;
                    }
                }
                if (active == null) {
View Full Code Here

TOP

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

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.