Examples of DefaultServiceMixClient


Examples of org.apache.servicemix.client.DefaultServiceMixClient

    protected String directoryName = "target/pollDirectory";
    protected String dynamicURI = "file:" + directoryName;

    public void testSendToWriterSoItCanBePolled() throws Exception {
        // now lets make a request on this endpoint
        DefaultServiceMixClient client = new DefaultServiceMixClient(jbi);

        StringBuffer sb = new StringBuffer("<root>");
        for (int i = 0; i < SIZE; i++) {
            sb.append("<hello>world</hello>");
        }
        sb.append("</root>");
       
        // lets send a request to be written to a file
        // which should then be polled
        for (int i = 0; i < NUMBER; i++) {
            InOnly me = client.createInOnlyExchange();
            me.setService(new QName("urn:test", "service"));
            NormalizedMessage message = me.getInMessage();
            message.setProperty(DefaultFileMarshaler.FILE_NAME_PROPERTY, "test" + i + ".xml");
            message.setContent(new StringSource(sb.toString()));
            client.sendSync(me);
        }

        Receiver receiver = (Receiver) getBean("receiver");
        receiver.getMessageList().assertMessagesReceived(NUMBER);
    }
View Full Code Here

Examples of org.servicemix.client.DefaultServiceMixClient

    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
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.