Package org.apache.servicemix.client

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


        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

        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

        assertNotNull("We should find a service endpoint!", se);

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

        assertExchangeWorked(exchange);
    }

    protected void assertExchangeWorked(MessageExchange me) throws Exception {
View Full Code Here

        NormalizedMessage message = me.getInMessage();

        message.setProperty("name", "cheese");
        message.setContent(new StringSource("<hello>world</hello>"));

        client.sendSync(me);
        assertExchangeWorked(me);
    }


    protected void setUp() throws Exception {
View Full Code Here

    public void test() throws Exception {
        DefaultServiceMixClient client = new DefaultServiceMixClient(jbi);
        InOut me = client.createInOutExchange();
        me.setService(new QName("urn:test", "service"));
        me.getInMessage().setContent(new StringSource("<hello>world</hello>"));
        client.sendSync(me);
        if (me.getStatus() == ExchangeStatus.ERROR) {
            if (me.getError() != null) {
                throw me.getError();
            } else {
                fail("Received ERROR status");
View Full Code Here

        ServiceMixClient client = new DefaultServiceMixClient(jbi);
        InOnly me = client.createInOnlyExchange();
        me.setService(ReceiverComponent.SERVICE);
        me.getInMessage().setSecuritySubject(subject);
        me.getInMessage().setContent(new StringSource("<hello>world</hello>"));
        client.sendSync(me);
       
        receiver.getMessageList().assertMessagesReceived(1);
    }
   
    public void testNOk() throws Exception {
View Full Code Here

        InOnly me = client.createInOnlyExchange();
        me.setService(ReceiverComponent.SERVICE);
        me.getInMessage().setSecuritySubject(subject);
        me.getInMessage().setContent(new StringSource("<hello>world</hello>"));
        try {
            client.sendSync(me);
            fail("Should have thrown a SecurityException");
        } catch (SecurityException e) {
            // ok
        }
    }
View Full Code Here

        DefaultServiceMixClient client = new DefaultServiceMixClient(container);
        InOut me = client.createInOutExchange();
        me.setInterfaceName(new QName("http://xfire.jsr181.servicemix.apache.org", "ProxyPojoPortType"));
        me.getInMessage().setContent(new StringSource(
                "<echo xmlns='http://jsr181.servicemix.apache.org'><echoin0>world</echoin0></echo>"));
        client.sendSync(me);
        if (me.getError() != null) {
            throw me.getError();
        }
        assertTrue(me.getStatus() == ExchangeStatus.ACTIVE);
        client.done(me);
View Full Code Here

        ServiceMixClient client = new DefaultServiceMixClient(jbi);
        InOnly me = client.createInOnlyExchange();
        me.setService(ReceiverComponent.SERVICE);
        me.getInMessage().setSecuritySubject(subject);
        me.getInMessage().setContent(new StringSource("<hello>world</hello>"));
        client.sendSync(me);
       
        receiver.getMessageList().assertMessagesReceived(1);
    }
   
    public void testNOk() throws Exception {
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.