You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@servicemix.apache.org by en...@apache.org on 2009/06/03 15:58:40 UTC

svn commit: r781380 - in /servicemix/components/shared-libraries/trunk/servicemix-common/src/test: java/org/apache/servicemix/common/util/ resources/org/apache/servicemix/common/util/

Author: enolan
Date: Wed Jun  3 13:58:39 2009
New Revision: 781380

URL: http://svn.apache.org/viewvc?rev=781380&view=rev
Log:
SMXCOMP-559 - New tests for the Util package to improve test coverage of servicemix common

Added:
    servicemix/components/shared-libraries/trunk/servicemix-common/src/test/java/org/apache/servicemix/common/util/
    servicemix/components/shared-libraries/trunk/servicemix-common/src/test/java/org/apache/servicemix/common/util/DOMUtilTest.java   (with props)
    servicemix/components/shared-libraries/trunk/servicemix-common/src/test/java/org/apache/servicemix/common/util/IntrospectionSupportTest.java   (with props)
    servicemix/components/shared-libraries/trunk/servicemix-common/src/test/java/org/apache/servicemix/common/util/MessageUtilTest.java   (with props)
    servicemix/components/shared-libraries/trunk/servicemix-common/src/test/resources/org/apache/servicemix/common/util/
    servicemix/components/shared-libraries/trunk/servicemix-common/src/test/resources/org/apache/servicemix/common/util/employee.xml   (with props)

Added: servicemix/components/shared-libraries/trunk/servicemix-common/src/test/java/org/apache/servicemix/common/util/DOMUtilTest.java
URL: http://svn.apache.org/viewvc/servicemix/components/shared-libraries/trunk/servicemix-common/src/test/java/org/apache/servicemix/common/util/DOMUtilTest.java?rev=781380&view=auto
==============================================================================
--- servicemix/components/shared-libraries/trunk/servicemix-common/src/test/java/org/apache/servicemix/common/util/DOMUtilTest.java (added)
+++ servicemix/components/shared-libraries/trunk/servicemix-common/src/test/java/org/apache/servicemix/common/util/DOMUtilTest.java Wed Jun  3 13:58:39 2009
@@ -0,0 +1,133 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.servicemix.common.util;
+
+import java.io.File;
+import java.net.URL;
+
+import javax.xml.parsers.DocumentBuilder;
+import org.w3c.dom.Document;
+import org.w3c.dom.Element;
+import org.w3c.dom.Node;
+import org.w3c.dom.NodeList;
+
+import junit.framework.TestCase;
+
+public class DOMUtilTest extends TestCase {
+	
+	static String fileName = "org/apache/servicemix/common/util/employee.xml";
+
+	
+	public void testCreateDocument() throws Exception {		
+		Document doc = DOMUtil.newDocument();
+	    Element element = doc.createElementNS("http://java.sun.com/xml/ns/jbi/wsdl-11-wrapper", "organisation");
+	    
+	    Element el = doc.createElement("Paul");	    
+	    DOMUtil.addChildElement(element, "employee", "Jack");	    
+	    DOMUtil.addChildElement(element, "employee", "Rose");
+	    DOMUtil.addChildElement(element, "employee", null);
+	    DOMUtil.moveContent(element, el);	
+	    el.setAttribute("xmlns:number", "http://java.sun.com/xml/ns/jbi/wsdl-11-wrapper");
+	    doc.appendChild(el);
+	    assertNull(DOMUtil.getQName(null));
+	    DOMUtil.createQName(el, "number:One");
+        assertEquals("organisation", DOMUtil.getQName(element).getLocalPart());
+        
+        Element elem = doc.createElementNS(null, "org");
+        Element childElem = doc.createElementNS(null, "org");
+        elem.appendChild(childElem);
+	    DOMUtil.createQName(childElem, "letter");
+	    assertEquals("org", DOMUtil.getQName(childElem).getLocalPart());
+	    	    
+	    DOMUtil.createQName(el, "letter:One");
+	    assertEquals("organisation", DOMUtil.getQName(element).getLocalPart());	    
+	    element.setPrefix("jbi");
+	    assertEquals("organisation", DOMUtil.getQName(element).getLocalPart());
+	    
+	    NodeList nodeLst = doc.getElementsByTagName("employee");
+	    Node fstNode = nodeLst.item(0);
+    	if (fstNode.getNodeType() == Node.ELEMENT_NODE) {	    	    
+            assertEquals("Jack" , fstNode.getFirstChild().getNodeValue());
+    	}
+    	fstNode = nodeLst.item(1);
+    	if (fstNode.getNodeType() == Node.ELEMENT_NODE) {	    	    
+            assertEquals("Rose" , fstNode.getFirstChild().getNodeValue());
+    	}
+    	fstNode = nodeLst.item(2);
+    	if (fstNode.getNodeType() == Node.ELEMENT_NODE) {	    	    
+            assertNull("" , fstNode.getFirstChild());
+    	}	    
+	}
+	
+    public void testParseDocument() throws Exception {    	    	
+    	
+    	try {
+    	    File file = getFile(fileName);    	    
+    	    DocumentBuilder db = DOMUtil.getBuilder();    	    
+    	    Document doc = db.parse(file);
+    	    doc.getDocumentElement().normalize();
+    	    assertEquals("organization", doc.getDocumentElement().getNodeName());    	    
+    	    NodeList nodeLst = doc.getElementsByTagName("employee");    	    
+
+    	    Node fstNode = nodeLst.item(0);
+    	    String log = DOMUtil.asXML(fstNode);
+    	    assertNotNull(log);
+    	    String indentlog = DOMUtil.asIndentedXML(fstNode);
+    	    assertNotNull(indentlog);
+    	    Element fstElmnt = (Element) fstNode;      
+    	    	            
+                Element fstNmElmnt = DOMUtil.getFirstChildElement(fstElmnt);
+                assertEquals("Jack", DOMUtil.getElementText(fstNmElmnt));
+                assertEquals("letters", DOMUtil.recursiveGetAttributeValue(fstNmElmnt, "type"));
+                NodeList lstNmElmntLst = fstElmnt.getElementsByTagName("lastname");
+                Element lstNmElmnt = (Element) lstNmElmntLst.item(0);
+                assertEquals("", DOMUtil.recursiveGetAttributeValue(lstNmElmnt, "type"));
+                DOMUtil.copyAttributes(fstNmElmnt, lstNmElmnt);
+                assertEquals("Rose", DOMUtil.getElementText(lstNmElmnt));
+                assertEquals("letters", lstNmElmnt.getAttribute("type").toString());
+                fstElmnt = DOMUtil.getNextSiblingElement(fstElmnt);                
+                assertNull(DOMUtil.getFirstChildElement(fstNmElmnt));
+                
+                fstNmElmnt = DOMUtil.getFirstChildElement(fstElmnt);
+                assertEquals("Paul", DOMUtil.getElementText(fstNmElmnt));
+                assertEquals("letters", DOMUtil.recursiveGetAttributeValue(fstNmElmnt, "type"));
+                lstNmElmntLst = fstElmnt.getElementsByTagName("lastname");
+                lstNmElmnt = (Element) lstNmElmntLst.item(0);
+                assertEquals("", DOMUtil.recursiveGetAttributeValue(lstNmElmnt, "type"));                
+                assertEquals("McNealy", DOMUtil.getElementText(lstNmElmnt));                
+                fstElmnt = DOMUtil.getNextSiblingElement(fstElmnt);
+                
+                fstNmElmnt = DOMUtil.getFirstChildElement(fstElmnt);
+                assertEquals("Joe", DOMUtil.getElementText(fstNmElmnt));
+                assertEquals("letters", DOMUtil.recursiveGetAttributeValue(fstNmElmnt, "type"));
+                lstNmElmntLst = fstElmnt.getElementsByTagName("lastname");
+                lstNmElmnt = (Element) lstNmElmntLst.item(0);
+                assertEquals("", DOMUtil.recursiveGetAttributeValue(lstNmElmnt, "type"));                
+                assertEquals("Bloggs", DOMUtil.getElementText(lstNmElmnt));                
+    	        	    
+    	} catch (Exception e) {
+    	    e.printStackTrace();
+    	}
+    	
+    } 
+    
+    protected File getFile(String name) {
+        URL url = getClass().getClassLoader().getResource(name);    	
+        return new File(url.getFile());        
+    }
+
+}

Propchange: servicemix/components/shared-libraries/trunk/servicemix-common/src/test/java/org/apache/servicemix/common/util/DOMUtilTest.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: servicemix/components/shared-libraries/trunk/servicemix-common/src/test/java/org/apache/servicemix/common/util/IntrospectionSupportTest.java
URL: http://svn.apache.org/viewvc/servicemix/components/shared-libraries/trunk/servicemix-common/src/test/java/org/apache/servicemix/common/util/IntrospectionSupportTest.java?rev=781380&view=auto
==============================================================================
--- servicemix/components/shared-libraries/trunk/servicemix-common/src/test/java/org/apache/servicemix/common/util/IntrospectionSupportTest.java (added)
+++ servicemix/components/shared-libraries/trunk/servicemix-common/src/test/java/org/apache/servicemix/common/util/IntrospectionSupportTest.java Wed Jun  3 13:58:39 2009
@@ -0,0 +1,175 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.servicemix.common.util;
+
+import java.net.URI;
+import java.net.URL;
+import java.util.HashMap;
+
+import java.util.Map;
+import junit.framework.TestCase;
+
+public class IntrospectionSupportTest extends TestCase {
+	
+    public void testProperties() throws Exception {    	   	
+    	
+    	// Tests setProperties
+    	try {
+    	    IntrospectionSupport.setProperties(null, null);
+    	    fail();
+    	} catch (IllegalArgumentException ex) {
+    		// "target was null."
+    	}
+    	
+    	try {
+    	    IntrospectionSupport.setProperties(new Object(), null);
+    	    fail();
+    	} catch (IllegalArgumentException ex) {
+    		// "props was null."
+    	}
+    	        
+        IntrospectionSupport.setProperties(new Person(), getProps());                
+        
+        // Tests extractProperties
+        try {
+    	    IntrospectionSupport.extractProperties(null, "test-");
+    	    fail();
+    	} catch (IllegalArgumentException ex) {
+    		// "props was null."
+    	}
+        
+        Map map = IntrospectionSupport.extractProperties(getProps(), "test-");
+        assertTrue(map.containsKey("Name"));
+        assertEquals("Joe", map.get("Name").toString());
+        
+    	// Tests setProperties
+        try {
+    	    IntrospectionSupport.setProperties(null, null, null);
+    	    fail();
+    	} catch (IllegalArgumentException ex) {
+    		// "target was null."
+    	}
+    	
+    	try {
+    	    IntrospectionSupport.setProperties(new Object(), null, null);
+    	    fail();
+    	} catch (IllegalArgumentException ex) {
+    		// "props was null."
+    	}
+        
+        boolean setProp = IntrospectionSupport.setProperties(new Person(), getProps(), "test-");
+        assertTrue(setProp);
+        
+        String name = IntrospectionSupport.toString(new Person("bloggs"));
+        assertTrue(name.contains("bloggs"));
+        String buf = IntrospectionSupport.toString(new Person("bloggs"), new Person().getClass());
+        assertTrue(name.contains("bloggs"));
+        System.out.println("end");
+    }
+    
+    public Map getProps() throws Exception {    	    	
+    	URI uri = new URI("http://www.apache.org/");
+    	Map<String, Object> props =  new HashMap<String,Object>();
+    	props.put("test-Name", "Joe");
+    	props.put("test-location", "USA");
+    	props.put("test-job", "IT");
+    	props.put("test-Number", "12");
+    	return props;
+    }
+    
+    
+    public class Address {
+    	String city;
+    	String country;
+    	
+    	public Address(String city, String country) {
+    		this.city = city;
+    		this.country = country;
+    	}
+    	
+    	public void setCity(String city) {
+    		this.city = city;
+    	}
+    	
+    	public String getCity() {
+    		return this.city;
+    	}
+    	
+    	public void setCountry(String country) {
+    		this.country = country;   	
+    	}
+    	
+    	public String getCountry() {
+    		return this.country;
+    	}    
+    	
+    	public String toString() {
+    		return this.city + this.country;
+    	}
+    }
+    
+    public class Person {
+    	
+    	String name;
+    	URI location;
+    	String job;    	
+    	long number;
+    	
+    	public Person() {
+    	}
+    	
+    	public Person(String name) {
+    		this.name =  name;
+    	}
+    	
+    	public Person(String name, String job) {
+    		this.name =  name;
+    		this.job =  job;
+    	}
+    	
+    	public void setName(String name) {
+    		this.name =  name;    		    		
+    	}
+    	
+    	public String getName() {
+    		return this.name;
+    	}
+    	
+    	public void setLocation(URI location) {
+    		this.location = location;
+    	}
+    	
+    	public URI getLocation() {
+    		return this.location;
+    	}    	
+    	
+    	public String getJob() {
+    		return this.job;
+    	}
+    	
+    	public void setNumber(long number) {    		
+    		this.number = number; 
+    	}
+    	
+    	public long getNumber() {
+    		return this.number;
+    	}
+    
+    }
+    
+
+}

Propchange: servicemix/components/shared-libraries/trunk/servicemix-common/src/test/java/org/apache/servicemix/common/util/IntrospectionSupportTest.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: servicemix/components/shared-libraries/trunk/servicemix-common/src/test/java/org/apache/servicemix/common/util/MessageUtilTest.java
URL: http://svn.apache.org/viewvc/servicemix/components/shared-libraries/trunk/servicemix-common/src/test/java/org/apache/servicemix/common/util/MessageUtilTest.java?rev=781380&view=auto
==============================================================================
--- servicemix/components/shared-libraries/trunk/servicemix-common/src/test/java/org/apache/servicemix/common/util/MessageUtilTest.java (added)
+++ servicemix/components/shared-libraries/trunk/servicemix-common/src/test/java/org/apache/servicemix/common/util/MessageUtilTest.java Wed Jun  3 13:58:39 2009
@@ -0,0 +1,206 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.servicemix.common.util;
+
+import java.net.URL;
+import java.util.Set;
+
+import javax.activation.DataHandler;
+import javax.jbi.messaging.Fault;
+import javax.jbi.messaging.MessageExchange;
+import javax.jbi.messaging.NormalizedMessage;
+import javax.mail.util.ByteArrayDataSource;
+import javax.security.auth.Subject;
+import javax.xml.transform.dom.DOMSource; 
+import javax.xml.transform.stream.StreamSource;
+
+import junit.framework.TestCase;
+
+import org.apache.servicemix.common.util.MessageUtil;
+import org.apache.servicemix.jbi.jaxp.SourceTransformer;
+import org.apache.servicemix.jbi.jaxp.StringSource;
+import org.apache.servicemix.tck.mock.MockMessageExchange;
+
+public class MessageUtilTest extends TestCase {
+	
+    public void testNormalizedMessageImpl() throws Exception {    	
+        Subject subject = new Subject();        
+        
+        MessageUtil.NormalizedMessageImpl src = new MessageUtil.NormalizedMessageImpl();
+        MessageUtil.NormalizedMessageImpl dest = new MessageUtil.NormalizedMessageImpl();
+        src.setContent(new StringSource("<hello>world</hello>"));
+        src.setProperty("name", "edell");
+        src.setProperty("surname", "nolan");
+        DataHandler param = new DataHandler(new ByteArrayDataSource("foo".getBytes(), 
+            "application/octet-stream"));
+        src.addAttachment("fooId", param);
+        DataHandler param2 = new DataHandler(new ByteArrayDataSource("bar".getBytes(), 
+        "application/octet-stream"));
+        src.addAttachment("barId", param);
+        Object credential = new String("test-credential");
+        subject.getPublicCredentials().add(credential);
+        src.setSecuritySubject(subject);
+        
+        MessageUtil.transfer(src,dest);
+        
+        String txt = new SourceTransformer().toString(dest.getContent());
+        assertEquals("<hello>world</hello>", txt);        
+        assertEquals("edell", dest.getProperty("name").toString());
+        Set s = dest.getPropertyNames();       
+        assertTrue(s.contains("name"));
+        assertTrue(s.contains("surname"));        
+        
+        param = null;
+        param = dest.getAttachment("fooId");        
+        assertEquals("application/octet-stream", param.getDataSource().getContentType());
+        
+        Set attachementSet = dest.getAttachmentNames();
+        assertTrue(attachementSet.contains("fooId"));
+        assertTrue(attachementSet.contains("barId"));
+        
+        dest.removeAttachment("barId");
+        assertFalse(attachementSet.contains("barId"));
+        
+        Subject sub = dest.getSecuritySubject();
+        assertTrue(sub.getPublicCredentials().contains(credential));
+        
+        MessageUtil.NormalizedMessageImpl nmsg = new MessageUtil.NormalizedMessageImpl(src);        
+        assertEquals("StringSource[<hello>world</hello>]", nmsg.getContent().toString());
+        
+        NormalizedMessage newMsg = MessageUtil.copy(src);
+        assertEquals("StringSource[<hello>world</hello>]", newMsg.getContent().toString());
+        
+        src.setContent(null);
+        MessageUtil.NormalizedMessageImpl nmsg2 = new MessageUtil.NormalizedMessageImpl(src);
+        assertNull(nmsg2.getContent());
+        
+        URL url = new URL("http://schemas.xmlsoap.org/soap/http");
+        DataHandler urlDataHandler = new DataHandler(url);
+        src.addAttachment("urlId", urlDataHandler);
+        MessageUtil.NormalizedMessageImpl nmsg3 = new MessageUtil.NormalizedMessageImpl(src);   
+        DataHandler dh = nmsg3.getAttachment("urlId");
+        assertEquals("text/html", dh.getDataSource().getContentType());                
+    }
+    
+    public void testTransfers() throws Exception {      	
+        MessageExchange meSrc = new MockMessageExchange();
+        MessageExchange meDest = new MockMessageExchange();
+        
+        MessageUtil.NormalizedMessageImpl srcMsg = new MessageUtil.NormalizedMessageImpl();
+        srcMsg.setContent(new StringSource("<hello>world</hello>"));
+        srcMsg.setProperty("name", "edell");
+        DataHandler param = new DataHandler(new ByteArrayDataSource("foo".getBytes(), 
+        "application/octet-stream"));
+        srcMsg.addAttachment("fooId", param);
+        Object credential = new String("test-credential");
+        Subject subject = new Subject();
+        subject.getPublicCredentials().add(credential);
+        srcMsg.setSecuritySubject(subject);
+        
+        // Tests transferTo
+        meSrc.setMessage(srcMsg, "in");
+        MessageUtil.transferTo(meSrc, meDest, "in");
+        NormalizedMessage nm = meDest.getMessage("in");        
+        assertEquals("StringSource[<hello>world</hello>]", nm.getContent().toString());
+        
+        // Tests transferInToIn
+        meSrc.setMessage(srcMsg, "in");
+        MessageUtil.transferInToIn(meSrc, meDest);
+        nm = meDest.getMessage("in");        
+        assertEquals("StringSource[<hello>world</hello>]", nm.getContent().toString());
+   
+        // Tests transferOutToIn
+        meSrc.setMessage(srcMsg, "out");
+        MessageUtil.transferOutToIn(meSrc, meDest);
+        nm = meDest.getMessage("in");        
+        assertEquals("StringSource[<hello>world</hello>]", nm.getContent().toString());
+        
+        // Tests transferOutToOut
+        meSrc.setMessage(srcMsg, "out");
+        MessageUtil.transferOutToOut(meSrc, meDest);
+        nm = meDest.getMessage("out");        
+        assertEquals("StringSource[<hello>world</hello>]", nm.getContent().toString());
+        
+        // Tests transferInToOut
+        meSrc.setMessage(srcMsg, "in");
+        MessageUtil.transferInToOut(meSrc, meDest);
+        nm = meDest.getMessage("out");        
+        assertEquals("StringSource[<hello>world</hello>]", nm.getContent().toString());
+        
+        // Tests tranfer just on exchanges
+        MessageExchange meDest2 = new MockMessageExchange();
+        MessageUtil.transferTo(meSrc, meDest2, "out");
+        nm = meDest.getMessage("out");        
+        assertEquals("StringSource[<hello>world</hello>]", nm.getContent().toString());
+        
+        // Tests copyIn
+        NormalizedMessage copyIn = MessageUtil.copyIn(meSrc);
+        assertEquals("StringSource[<hello>world</hello>]", copyIn.getContent().toString());
+        
+        // Tests copyOut
+        NormalizedMessage copyOut = MessageUtil.copyOut(meSrc);
+        assertEquals("StringSource[<hello>world</hello>]", copyOut.getContent().toString());
+    }
+    
+    public void testEnableContentRereadability() throws Exception {
+    	MessageUtil.NormalizedMessageImpl srcMsg = new MessageUtil.NormalizedMessageImpl();
+        srcMsg.setContent(new StringSource("<hello>world</hello>"));
+        srcMsg.setProperty("name", "edell");        
+        MessageUtil.enableContentRereadability(srcMsg);
+        assertEquals("StringSource[<hello>world</hello>]", srcMsg.getContent().toString());                
+        
+        try {
+            srcMsg.setContent(new StreamSource("@@@@@@@@@@@@@"));            
+            MessageUtil.enableContentRereadability(srcMsg);
+            fail();
+        } catch (javax.jbi.messaging.MessagingException ex) {
+        	// MessagingException("Unable to convert message content into StringSource
+        }                     
+        
+        srcMsg = new MessageUtil.NormalizedMessageImpl();
+        srcMsg.setContent(new DOMSource());
+        MessageUtil.enableContentRereadability(srcMsg);
+        DOMSource domSrc = (DOMSource)srcMsg.getContent();
+        assertNotNull(domSrc);                        
+    }
+    
+    public void testFault() throws Exception {
+    	MessageExchange exchangeSrc = new MockMessageExchange();
+        MessageExchange exchangeDest = new MockMessageExchange();
+
+    	MessageUtil.FaultImpl fault = new MessageUtil.FaultImpl();
+    	fault.setContent(new StringSource("<fault>failure</fault>"));    	
+    	exchangeSrc.setFault(fault);
+    	    	    	    	
+    	// Tests copyFault    	
+        Fault copyFault = MessageUtil.copyFault(exchangeSrc);
+        assertEquals("StringSource[<fault>failure</fault>]", copyFault.getContent().toString());
+        
+        NormalizedMessage nm = MessageUtil.copy(fault);
+        assertEquals("StringSource[<fault>failure</fault>]", nm.getContent().toString());
+        
+    	// Tests transferFaultToFault
+        MessageUtil.transferFaultToFault(exchangeSrc, exchangeDest);
+        assertEquals("StringSource[<fault>failure</fault>]", exchangeDest.getFault().getContent().toString());
+        
+        MessageUtil.transferTo(exchangeSrc, exchangeDest, "fault");
+        assertEquals("StringSource[<fault>failure</fault>]", exchangeDest.getFault().getContent().toString());
+
+    }
+    
+
+}

Propchange: servicemix/components/shared-libraries/trunk/servicemix-common/src/test/java/org/apache/servicemix/common/util/MessageUtilTest.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: servicemix/components/shared-libraries/trunk/servicemix-common/src/test/resources/org/apache/servicemix/common/util/employee.xml
URL: http://svn.apache.org/viewvc/servicemix/components/shared-libraries/trunk/servicemix-common/src/test/resources/org/apache/servicemix/common/util/employee.xml?rev=781380&view=auto
==============================================================================
--- servicemix/components/shared-libraries/trunk/servicemix-common/src/test/resources/org/apache/servicemix/common/util/employee.xml (added)
+++ servicemix/components/shared-libraries/trunk/servicemix-common/src/test/resources/org/apache/servicemix/common/util/employee.xml Wed Jun  3 13:58:39 2009
@@ -0,0 +1,22 @@
+<?xml version="1.0"?>
+
+<organization xmlns="http://java.sun.com/xml/ns/jbi/wsdl-11-wrapper">
+
+<employee xmlns:number="1">
+    <firstname type="letters" >Jack</firstname>
+    <lastname>Rose</lastname>
+</employee>
+
+<employee number="2">
+    <firstname type="letters">Paul</firstname>
+    <lastname>McNealy</lastname>
+</employee>
+
+<employee>
+    <firstname type="letters">Joe</firstname>
+    <lastname>Bloggs</lastname>
+</employee>
+
+</organization>
+
+

Propchange: servicemix/components/shared-libraries/trunk/servicemix-common/src/test/resources/org/apache/servicemix/common/util/employee.xml
------------------------------------------------------------------------------
    svn:eol-style = native