Package org.apache.servicemix.nmr.api

Examples of org.apache.servicemix.nmr.api.Channel.createExchange()


        ExchangeListener listener = control.createMock(ExchangeListener.class);
        control.makeThreadSafe(true);
        nmr.getListenerRegistry().register(listener, null);

        Channel channel = nmr.createChannel();
        Exchange e = channel.createExchange(Pattern.InOnly);
        e.setTarget(nmr.getEndpointRegistry().lookup(ServiceHelper.createMap(Endpoint.NAME, "zz")));

        listener.exchangeSent(same(e));
        listener.exchangeFailed(same(e));
View Full Code Here


                    Channel client = null;
                    try {
                        client = nmr1.createChannel();
                        lock.readLock().lock();
                        for (int i = 0; i < nbExchanges; i++) {
                            Exchange exchange = client.createExchange(Pattern.InOnly);
                            exchange.getIn().setBody(new StringSource("<hello id='" + id.getAndIncrement() + "'/>"));
                            exchange.setTarget(nmr1.getEndpointRegistry().lookup(ServiceHelper.createMap(Endpoint.NAME, PROXY_ENDPOINT_NAME)));
                            client.sendSync(exchange);
                            assertEquals(Status.Done, exchange.getStatus());
                        }
View Full Code Here

    public void testInOutNoTxNoRb() throws Exception {
        createRoute(Transacted.None, 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);
View Full Code Here

    public void testInOutNoTxNoRbInError() throws Exception {
        createRoute(Transacted.None, 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();
View Full Code Here

    public void testInOutNoTxRb() throws Exception {
        createRoute(Transacted.None, 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);
View Full Code Here

    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();
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);
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();
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);
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);
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.