Package org.apache.servicemix.jbi.jaxp

Examples of org.apache.servicemix.jbi.jaxp.SourceTransformer


       
        tm.commit();
       
        me = (InOut) client.receive();
        assertEquals(ExchangeStatus.ACTIVE, me.getStatus());
        Node node = new SourceTransformer().toDOMNode(me.getOutMessage());
        assertEquals("from1", node.getFirstChild().getNodeName());
        client.done(me);
       
        tm.begin();
       
        me = client.createInOutExchange();
        me.setService(new QName("router"));
        me.getInMessage().setContent(createSource("<hello id='2' />"));
        client.send(me);
       
        tm.commit();
       
        me = (InOut) client.receive();
        assertEquals(ExchangeStatus.ACTIVE, me.getStatus());
        node = new SourceTransformer().toDOMNode(me.getOutMessage());
        assertEquals("from2", node.getFirstChild().getNodeName());
        client.done(me);
       
        tm.begin();
       
        me = client.createInOutExchange();
        me.setService(new QName("router"));
        me.getInMessage().setContent(createSource("<hello id='3' />"));
        client.send(me);
       
        tm.commit();
       
        me = (InOut) client.receive();
        assertEquals(ExchangeStatus.ACTIVE, me.getStatus());
        node = new SourceTransformer().toDOMNode(me.getOutMessage());
        assertEquals("from3", node.getFirstChild().getNodeName());
        client.done(me);
    }
View Full Code Here


     */
    public void buildAggregate(Object aggregation, NormalizedMessage message,
            MessageExchange exchange, boolean doTimeout) throws Exception {
        NormalizedMessage[] messages = ((SplitterAggregation) aggregation).messages;
        String correlationId = ((SplitterAggregation) aggregation).correlationId;
        SourceTransformer st = new SourceTransformer();
        Document doc = st.createDocument();
        Element root = createChildElement(aggregateElementName, doc);
        root.setAttribute(countAttribute, Integer.toString(messages.length));
        for (int i = 0; i < messages.length; i++) {
            if (messages[i] != null) {
                Element elem = st.toDOMElement(messages[i]);
                if (messageElementName != null) {
                    Element msg = createChildElement(messageElementName, root);
                    msg.setAttribute(indexAttribute, Integer.toString(i));
                    msg.appendChild(doc.importNode(elem, true));
                } else {
View Full Code Here

    }

    private static Element toElement(Source src) throws Fault {
        try {
            SourceTransformer transformer = new SourceTransformer();
            Element ret = transformer.toDOMElement(src);
            ret = removeEmptyDefaultTns(ret);
            return ret;
        } catch (Exception e) {
            throw new Fault(e);
        }
View Full Code Here

        try {
            Source source = message.getContent(Source.class);
            if (source == null) {
                return;
            }
            Element element = new SourceTransformer().toDOMElement(source);
            if (!JbiConstants.WSDL11_WRAPPER_NAMESPACE.equals(element
                    .getNamespaceURI())
                    || !JbiConstants.WSDL11_WRAPPER_MESSAGE_LOCALNAME
                            .equals(element.getLocalName())) {
                throw new Fault(new Exception("Message wrapper element is '"
View Full Code Here

        // Wait for notification
        Thread.sleep(150);

        receiver.getMessageList().assertMessagesReceived(1);
        NormalizedMessage msg = (NormalizedMessage) receiver.getMessageList().getMessages().get(0);
        Node node = new SourceTransformer().toDOMNode(msg);
        assertEquals("Notify", node.getLocalName());

        // Wait for acks to be processed
        Thread.sleep(150);
    }
View Full Code Here

        // Wait for notification
        Thread.sleep(150);

        receiver.getMessageList().assertMessagesReceived(1);
        NormalizedMessage msg = (NormalizedMessage) receiver.getMessageList().getMessages().get(0);
        Node node = new SourceTransformer().toDOMNode(msg);
        assertEquals("hello", node.getLocalName());

        // Wait for acks to be processed
        Thread.sleep(150);
    }
View Full Code Here

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

    protected Element parse(String txt) throws Exception {
        DocumentBuilder builder = new SourceTransformer().createDocumentBuilder();
        InputSource is = new InputSource(new StringReader(txt));
        Document doc = builder.parse(is);
        return doc.getDocumentElement();
    }
View Full Code Here

   
    private static void assertSequenceProperties(NormalizedMessage m, long num) throws Exception {
        Long l = (Long)m.getProperty(SEQNUM_KEY);
        if (l == null) {
            // get sequence number from message content
            long n = getNumber(new SourceTransformer().toString(m.getContent()));
            assertEquals("wrong sequence number", num, n);
            // TODO: investigate JDK 1.6.0_01 issues here
            // When using JDK 1.6.0_01 then messages transported to receiver
            // conponent don't have any properties set. This is only the case
            // if this test is running with all other EIP tests. When running
View Full Code Here

       
        me = client.createInOutExchange();
        me.setService(new QName("drools"));
        me.getInMessage().setContent(new StringSource("<test id='1' />"));
        client.sendSync(me);
        Element e = new SourceTransformer().toDOMElement(me.getOutMessage());
        assertEquals("target1", e.getLocalName());
        client.done(me);

        me = client.createInOutExchange();
        me.setService(new QName("drools"));
        me.getInMessage().setContent(new StringSource("<test id='2' />"));
        client.sendSync(me);
        e = new SourceTransformer().toDOMElement(me.getOutMessage());
        assertEquals("target2", e.getLocalName());
        client.done(me);

        me = client.createInOutExchange();
        me.setService(new QName("drools"));
        me.getInMessage().setContent(new StringSource("<test id='3' />"));
        me.getInMessage().setProperty("prop", Boolean.TRUE);
        client.sendSync(me);
        e = new SourceTransformer().toDOMElement(me.getOutMessage());
        assertEquals("target3", e.getLocalName());
        client.done(me);

        me = client.createInOutExchange();
        me.setService(new QName("drools"));
View Full Code Here

        InOut me = client.createInOutExchange();
        me.setService(new QName("drools"));
        me.getInMessage().setContent(new StringSource("<fibonacci>50</fibonacci>"));
        me.getInMessage().setProperty("prop", Boolean.TRUE);
        client.sendSync(me);
        Element e = new SourceTransformer().toDOMElement(me.getOutMessage());
        assertEquals("result", e.getLocalName());
        assertEquals("12586269025", e.getTextContent());
        client.done(me);

        me = client.createInOutExchange();
View Full Code Here

TOP

Related Classes of org.apache.servicemix.jbi.jaxp.SourceTransformer

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.