Package org.apache.servicemix.client

Examples of org.apache.servicemix.client.DefaultServiceMixClient.sendSync()


        "ProviderInterface"));
    in.getInMessage().setContent(
        new StreamSource(new ByteArrayInputStream(msg.getBytes())));

    long t0 = System.currentTimeMillis();
    client.sendSync(in);
    long t1 = System.currentTimeMillis();
    assertTrue(in.getStatus() == ExchangeStatus.DONE);

    // Check we received the message
    receiver.getMessageList().assertMessagesReceived(1);
View Full Code Here


        "ProviderInterface"));
    inout.getInMessage().setContent(
        new StreamSource(new ByteArrayInputStream(msg.getBytes())));

    long t0 = System.currentTimeMillis();
    client.sendSync(inout);
    long t1 = System.currentTimeMillis();
    assertTrue(inout.getStatus() == ExchangeStatus.ACTIVE);

    // Check we received the message
    assertNotNull(inout.getOutMessage());
View Full Code Here

        RobustInOnly in = client.createRobustInOnlyExchange();
        in.setService(new QName("urn:test", "invoker"));
        in.getInMessage().setContent(new StreamSource(new ByteArrayInputStream(msg.getBytes())));
       
        long t0 = System.currentTimeMillis();
        client.sendSync(in);
        long t1 = System.currentTimeMillis();
        assertEquals(ExchangeStatus.DONE, in.getStatus());
       
        // Check we received the message
        receiver.getMessageList().assertMessagesReceived(1);
View Full Code Here

        InOut inout = client.createInOutExchange();
        inout.setService(new QName("urn:test", "invoker"));
        inout.getInMessage().setContent(new StreamSource(new ByteArrayInputStream(msg.getBytes())));
       
        long t0 = System.currentTimeMillis();
        client.sendSync(inout);
        long t1 = System.currentTimeMillis();
        assertTrue(inout.getStatus() == ExchangeStatus.ACTIVE);
       
        // Check we received the message
        assertNotNull(inout.getOutMessage());
View Full Code Here

        as.setComponentName("client");
        ServiceMixClient client = new DefaultServiceMixClient(jbi, as);
        InOnly me = client.createInOnlyExchange();
        me.setService(new QName("http://test", "entryPoint"));
        me.getInMessage().setContent(new StringSource("<test xmlns=\"http://test\"><echo/><world/><earth/></test>"));
        client.sendSync(me);
       
        ((Receiver) getBean("trace1")).getMessageList().assertMessagesReceived(1);
        ((Receiver) getBean("trace2")).getMessageList().assertMessagesReceived(1);
        ((Receiver) getBean("trace3")).getMessageList().assertMessagesReceived(1);
        ((Receiver) getBean("trace4")).getMessageList().assertMessagesReceived(2);
View Full Code Here

       
        ServiceMixClient client = new DefaultServiceMixClient(container);
        Destination dest = client.createDestination("service:urn:test:s2");
        InOut me = dest.createInOutExchange();
        me.getInMessage().setContent(new StringSource("<hello>world</hello>"));
        client.sendSync(me);
        assertEquals(ExchangeStatus.ACTIVE, me.getStatus());
        String str = new SourceTransformer().contentToString(me.getOutMessage());
        client.done(me);
        System.err.println(str);
    }
View Full Code Here

        ByteArrayOutputStream baos = new ByteArrayOutputStream();
        FileUtil.copyInputStream(new FileInputStream(f), baos);
        DataSource ds = new ByteArrayDataSource(baos.toByteArray(), "image/jpeg");
        DataHandler dh = new DataHandler(ds);
        me.getInMessage().addAttachment("image", dh);
        client.sendSync(me);
        assertEquals(ExchangeStatus.ACTIVE, me.getStatus());
        assertEquals(1, me.getOutMessage().getAttachmentNames().size());
        client.done(me);
    }
   
View Full Code Here

        Destination d = client.createDestination("service:urn:test:s0");
        InOut me = d.createInOutExchange();
        me.getInMessage().setContent(new StringSource("<hello>world</hello>"));
       
        tm.begin();
        boolean ok = client.sendSync(me);
        assertTrue(ok);
        client.done(me);
        tm.commit();
    }
   
View Full Code Here

        assertNotNull(se);

        InOnly inonly = client.createInOnlyExchange();
        inonly.setEndpoint(se);
        inonly.getInMessage().setContent(new StringSource("<hello>world</hello>"));
        client.sendSync(inonly);

        assertEquals(ExchangeStatus.DONE, inonly.getStatus());
        receiver.getMessageList().assertMessagesReceived(1);
        List msgs = receiver.getMessageList().flushMessages();
        NormalizedMessage msg = (NormalizedMessage) msgs.get(0);
View Full Code Here

                // Send message
                MessageExchange exchange = createExchange(client);
                configureExchange(client, exchange);
                populateExchange(exchange);
                client.sendSync(exchange);
                checkResult(exchange);
                //assertNotNull(exchange.getMessage("out").getContent());
                // TODO: check out the exchange
                client.done(exchange);
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.