Package org.servicemix.client

Examples of org.servicemix.client.ServiceMixClient


        receiver.getMessageList().assertMessagesReceived(1);
    }

    public void testSendUsingMapAndPOJOsUsingContainerRouting() throws Exception {

        ServiceMixClient clientNoRouting = (ServiceMixClient) context.getBean("clientWithRouting");

        Map properties = new HashMap();
        properties.put("name", "James");

        clientNoRouting.send(null, null, properties, "<hello>world</hello>");

        receiver.getMessageList().assertMessagesReceived(1);
    }
View Full Code Here


    }

    public void testRequestUsingPOJOWithXStreamMarshaling() throws Exception {
        QName service = new QName("http://servicemix.org/cheese/", "myService");

        ServiceMixClient client = (ServiceMixClient) context.getBean("clientWithXStream");

        Map properties = new HashMap();
        properties.put("name", "James");

        EndpointResolver resolver = client.createResolverForService(service);
        TestBean bean = new TestBean();
        bean.setName("James");
        bean.setLength(12);
        bean.getAddresses().addAll(Arrays.asList(new String[] {"London", "LA"}));

        Object response = client.request(resolver, null, properties, bean);

        assertNotNull("Should have returned a non-null response!", response);

        System.out.println("Received result: " + response);
    }
View Full Code Here

    protected Object requestServiceWithFileRequest(QName serviceName, String fileOnClassPath) throws JBIException, TransformerException, ParserConfigurationException, IOException, SAXException {
        Source content = getSourceFromClassPath(fileOnClassPath);

        ServiceNameEndpointResolver resolver = new ServiceNameEndpointResolver(serviceName);

        ServiceMixClient client = new DefaultServiceMixClient(container);
        Object answer = client.request(resolver, null, null, content);
        if (answer instanceof Source) {
            answer = transformer.toDOMNode((Source) answer);
        }
        return answer;
    }
View Full Code Here

    protected Object requestServiceWithFileRequest(QName serviceName, String fileOnClassPath) throws JBIException {
        Source content = getSourceFromClassPath(fileOnClassPath);

        ServiceNameEndpointResolver resolver = new ServiceNameEndpointResolver(serviceName);

        ServiceMixClient client = new DefaultServiceMixClient(container);
        Object answer = client.request(resolver, null, null, content);
        return answer;
    }
View Full Code Here

        super.tearDown();
    }

    public void testSendSync() throws Exception{
        ApplicationContext ctx=new ClassPathXmlApplicationContext("org/servicemix/jbi/nmr/flow/jms/client.xml");
        ServiceMixClient client=(ServiceMixClient) ctx.getBean("client");
        Thread.sleep(5000);
        InOut exchange=client.createInOutExchange();
        exchange.setService(new QName("http://www.habuma.com/foo","pingService"));
        NormalizedMessage in=exchange.getInMessage();
        in.setContent(new StringSource("<ping>Pinging you</ping>"));
        System.out.println("SENDING; exchange.status="+exchange.getStatus());
        client.sendSync(exchange);
        assertNotNull(exchange.getOutMessage());
        System.out.println("GOT RESPONSE; exchange.out="+new SourceTransformer().toString(exchange.getOutMessage().getContent()));
        client.done(exchange);
    }
View Full Code Here

                    throw new RuntimeException(e);
                }
            }
        };
        container.activateComponent(new ActivationSpec("receiver", receiver));
        ServiceMixClient client = new DefaultServiceMixClient(container);
        ServiceEndpoint[] endpoints = client.getContext().getExternalEndpoints(null);
        assertNotNull(endpoints);
        assertEquals(1, endpoints.length);
        assertNull(client.getContext().getEndpointDescriptor(endpoints[0]));
        ServiceEndpoint se = client.getContext().resolveEndpointReference(endpoints[0].getAsReference(null));
        assertNull(client.getContext().getEndpointDescriptor(se));
        InOnly me = client.createInOnlyExchange();
        me.setEndpoint(se);
        client.send(me);
        receiver.getMessageList().assertMessagesReceived(1);
    }
View Full Code Here

TOP

Related Classes of org.servicemix.client.ServiceMixClient

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.