You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@servicemix.apache.org by gn...@apache.org on 2007/03/19 14:05:49 UTC

svn commit: r519937 - in /incubator/servicemix/trunk: common/servicemix-soap/src/main/java/org/apache/servicemix/soap/handlers/addressing/ common/servicemix-soap/src/main/java/org/apache/servicemix/soap/marshalers/ core/servicemix-core/src/main/java/or...

Author: gnodet
Date: Mon Mar 19 06:05:48 2007
New Revision: 519937

URL: http://svn.apache.org/viewvc?view=rev&rev=519937
Log:
SM-885, SM-820: Improvements on EPR (WS-Addressing) resolution

Added:
    incubator/servicemix/trunk/core/servicemix-core/src/main/java/org/apache/servicemix/jbi/util/WSAddressingConstants.java   (with props)
    incubator/servicemix/trunk/core/servicemix-core/src/test/java/org/apache/servicemix/jbi/resolver/
    incubator/servicemix/trunk/core/servicemix-core/src/test/java/org/apache/servicemix/jbi/resolver/URIResolverTest.java   (with props)
Modified:
    incubator/servicemix/trunk/common/servicemix-soap/src/main/java/org/apache/servicemix/soap/handlers/addressing/AddressingHandler.java
    incubator/servicemix/trunk/common/servicemix-soap/src/main/java/org/apache/servicemix/soap/marshalers/SoapWriter.java
    incubator/servicemix/trunk/core/servicemix-core/src/main/java/org/apache/servicemix/jbi/framework/Registry.java
    incubator/servicemix/trunk/core/servicemix-core/src/main/java/org/apache/servicemix/jbi/resolver/URIResolver.java
    incubator/servicemix/trunk/core/servicemix-core/src/test/java/org/apache/servicemix/jbi/framework/RegistryTest.java

Modified: incubator/servicemix/trunk/common/servicemix-soap/src/main/java/org/apache/servicemix/soap/handlers/addressing/AddressingHandler.java
URL: http://svn.apache.org/viewvc/incubator/servicemix/trunk/common/servicemix-soap/src/main/java/org/apache/servicemix/soap/handlers/addressing/AddressingHandler.java?view=diff&rev=519937&r1=519936&r2=519937
==============================================================================
--- incubator/servicemix/trunk/common/servicemix-soap/src/main/java/org/apache/servicemix/soap/handlers/addressing/AddressingHandler.java (original)
+++ incubator/servicemix/trunk/common/servicemix-soap/src/main/java/org/apache/servicemix/soap/handlers/addressing/AddressingHandler.java Mon Mar 19 06:05:48 2007
@@ -23,7 +23,9 @@
 
 import org.apache.servicemix.id.IdGenerator;
 import org.apache.servicemix.jbi.jaxp.SourceTransformer;
+import org.apache.servicemix.jbi.resolver.URIResolver;
 import org.apache.servicemix.jbi.util.DOMUtil;
+import org.apache.servicemix.jbi.util.WSAddressingConstants;
 import org.apache.servicemix.soap.Context;
 import org.apache.servicemix.soap.SoapFault;
 import org.apache.servicemix.soap.handlers.AbstractHandler;
@@ -42,24 +44,6 @@
  */
 public class AddressingHandler extends AbstractHandler {
 
-    public static final String WSA_NAMESPACE_200303 = "http://schemas.xmlsoap.org/ws/2003/03/addressing";
-    public static final String WSA_NAMESPACE_200403 = "http://schemas.xmlsoap.org/ws/2004/03/addressing";
-    public static final String WSA_NAMESPACE_200408 = "http://schemas.xmlsoap.org/ws/2004/08/addressing";
-    public static final String WSA_NAMESPACE_200508 = "http://www.w3.org/2005/08/addressing";
-    
-    public static final String WSA_PREFIX = "wsa";
-    
-    public static final String EL_ACTION = "Action";
-    public static final String EL_ADDRESS = "Address";
-    public static final String EL_FAULT_TO = "FaultTo";
-    public static final String EL_FROM = "From";
-    public static final String EL_MESSAGE_ID = "MessageID";
-    public static final String EL_METADATA = "Metadata";
-    public static final String EL_REFERENCE_PARAMETERS = "ReferenceParameters";
-    public static final String EL_RELATES_TO = "RelatesTo";
-    public static final String EL_REPLY_TO = "ReplyTo";
-    public static final String EL_TO = "To";
-    
     protected final SourceTransformer sourceTransformer = new SourceTransformer();
     protected final IdGenerator idGenerator = new IdGenerator();
     
@@ -79,14 +63,14 @@
 	    			} else if (!nsUri.equals(qname.getNamespaceURI())) {
 	    				throw new SoapFault(SoapFault.SENDER, "Inconsistent use of wsa namespaces");
 	    			}
-		    		if (EL_ACTION.equals(qname.getLocalPart())) {
+		    		if (WSAddressingConstants.EL_ACTION.equals(qname.getLocalPart())) {
 		    			action = getHeaderText(value);
-		        		String[] parts = split(action);
+		        		String[] parts = URIResolver.split3(action);
 		        		context.setProperty(Context.INTERFACE, new QName(parts[0], parts[1]));
 		        		context.setProperty(Context.OPERATION, new QName(parts[0], parts[2]));
-		    		} else if (EL_TO.equals(qname.getLocalPart())) {
+		    		} else if (WSAddressingConstants.EL_TO.equals(qname.getLocalPart())) {
                         to = getHeaderText(value);
-		        		String[] parts = split(to);
+		        		String[] parts = URIResolver.split3(to);
 		        		context.setProperty(Context.SERVICE, new QName(parts[0], parts[1]));
 		        		context.setProperty(Context.ENDPOINT, parts[2]);
 		    		} else {
@@ -106,11 +90,11 @@
                 QName qname = (QName) it.next();
                 Object value = headers.get(qname);
                 if (isWSANamespace(qname.getNamespaceURI())) {
-                    if (EL_MESSAGE_ID.equals(qname.getLocalPart())) {
-                        QName name = new QName(qname.getNamespaceURI(), EL_MESSAGE_ID, qname.getPrefix() != null ? qname.getPrefix() : WSA_PREFIX);
+                    if (WSAddressingConstants.EL_MESSAGE_ID.equals(qname.getLocalPart())) {
+                        QName name = new QName(qname.getNamespaceURI(), WSAddressingConstants.EL_MESSAGE_ID, qname.getPrefix() != null ? qname.getPrefix() : WSAddressingConstants.WSA_PREFIX);
                         DocumentFragment df = createHeader(name, idGenerator.generateSanitizedId());
                         out.addHeader(name, df);
-                        name = new QName(qname.getNamespaceURI(), EL_RELATES_TO, qname.getPrefix() != null ? qname.getPrefix() : WSA_PREFIX);
+                        name = new QName(qname.getNamespaceURI(), WSAddressingConstants.EL_RELATES_TO, qname.getPrefix() != null ? qname.getPrefix() : WSAddressingConstants.WSA_PREFIX);
                         df = createHeader(name, getHeaderText(value));
                         out.addHeader(name, df);
                     }
@@ -120,10 +104,10 @@
     }
     
     protected boolean isWSANamespace(String ns) {
-        return WSA_NAMESPACE_200303.equals(ns) ||
-               WSA_NAMESPACE_200403.equals(ns) ||
-               WSA_NAMESPACE_200408.equals(ns) ||
-               WSA_NAMESPACE_200508.equals(ns);
+        return WSAddressingConstants.WSA_NAMESPACE_200303.equals(ns) ||
+               WSAddressingConstants.WSA_NAMESPACE_200403.equals(ns) ||
+               WSAddressingConstants.WSA_NAMESPACE_200408.equals(ns) ||
+               WSAddressingConstants.WSA_NAMESPACE_200508.equals(ns);
     }
     
     protected String getHeaderText(Object header) {
@@ -138,22 +122,6 @@
         el.appendChild(doc.createTextNode(value));
         df.appendChild(el);
         return df;
-    }
-    
-    protected String[] split(String uri) {
-		char sep;
-        uri = uri.trim();
-		if (uri.indexOf('/') > 0) {
-			sep = '/';
-		} else {
-			sep = ':';
-		}
-		int idx1 = uri.lastIndexOf(sep);
-		int idx2 = uri.lastIndexOf(sep, idx1 - 1);
-		String epName = uri.substring(idx1 + 1);
-		String svcName = uri.substring(idx2 + 1, idx1);
-		String nsUri   = uri.substring(0, idx2);
-    	return new String[] { nsUri, svcName, epName };
     }
     
 }

Modified: incubator/servicemix/trunk/common/servicemix-soap/src/main/java/org/apache/servicemix/soap/marshalers/SoapWriter.java
URL: http://svn.apache.org/viewvc/incubator/servicemix/trunk/common/servicemix-soap/src/main/java/org/apache/servicemix/soap/marshalers/SoapWriter.java?view=diff&rev=519937&r1=519936&r2=519937
==============================================================================
--- incubator/servicemix/trunk/common/servicemix-soap/src/main/java/org/apache/servicemix/soap/marshalers/SoapWriter.java (original)
+++ incubator/servicemix/trunk/common/servicemix-soap/src/main/java/org/apache/servicemix/soap/marshalers/SoapWriter.java Mon Mar 19 06:05:48 2007
@@ -132,6 +132,7 @@
         ByteArrayOutputStream baos = new ByteArrayOutputStream();
         writeSimpleMessage(baos);
         soapPart.setDataHandler(new DataHandler(new ByteArrayDataSource(baos.toByteArray(), "text/xml")));
+        soapPart.addHeader("Content-Transfer-Encoding", "8bit");
         parts.addBodyPart(soapPart);
         // Add attachments
         for (Iterator itr = message.getAttachments().entrySet().iterator(); itr.hasNext();) {
@@ -141,6 +142,7 @@
             MimeBodyPart part = new MimeBodyPart();
             part.setDataHandler(dh);
             part.setContentID("<" + id + ">");
+            part.addHeader("Content-Transfer-Encoding", "binary");
             parts.addBodyPart(part);
         }
         mime.setContent(parts);

Modified: incubator/servicemix/trunk/core/servicemix-core/src/main/java/org/apache/servicemix/jbi/framework/Registry.java
URL: http://svn.apache.org/viewvc/incubator/servicemix/trunk/core/servicemix-core/src/main/java/org/apache/servicemix/jbi/framework/Registry.java?view=diff&rev=519937&r1=519936&r2=519937
==============================================================================
--- incubator/servicemix/trunk/core/servicemix-core/src/main/java/org/apache/servicemix/jbi/framework/Registry.java (original)
+++ incubator/servicemix/trunk/core/servicemix-core/src/main/java/org/apache/servicemix/jbi/framework/Registry.java Mon Mar 19 06:05:48 2007
@@ -46,10 +46,12 @@
 import org.apache.servicemix.jbi.management.AttributeInfoHelper;
 import org.apache.servicemix.jbi.management.BaseSystemService;
 import org.apache.servicemix.jbi.messaging.MessageExchangeImpl;
+import org.apache.servicemix.jbi.resolver.URIResolver;
 import org.apache.servicemix.jbi.servicedesc.AbstractServiceEndpoint;
 import org.apache.servicemix.jbi.servicedesc.DynamicEndpoint;
 import org.apache.servicemix.jbi.servicedesc.InternalEndpoint;
 import org.apache.servicemix.jbi.util.DOMUtil;
+import org.apache.servicemix.jbi.util.WSAddressingConstants;
 import org.w3c.dom.Document;
 import org.w3c.dom.DocumentFragment;
 import org.w3c.dom.Element;
@@ -354,8 +356,19 @@
                     continue;
                 }
                 Element elem = (Element) n;
-                NodeList nl = elem.getElementsByTagNameNS("http://www.w3.org/2005/08/addressing", "Address");
-                if (nl.getLength() == 1) {
+                String[] namespaces = new String[] { WSAddressingConstants.WSA_NAMESPACE_200508,
+                                                     WSAddressingConstants.WSA_NAMESPACE_200408,
+                                                     WSAddressingConstants.WSA_NAMESPACE_200403,
+                                                     WSAddressingConstants.WSA_NAMESPACE_200303 };
+                NodeList nl = null;
+                for (int ns = 0; ns < namespaces.length; ns++) {
+                    NodeList tnl = elem.getElementsByTagNameNS(namespaces[ns], WSAddressingConstants.EL_ADDRESS);
+                    if (tnl.getLength() == 1) {
+                        nl = tnl;
+                        break;
+                    }
+                }
+                if (nl != null) {
                     Element address = (Element) nl.item(0);
                     String uri = DOMUtil.getElementText(address);
                     if (uri != null) {
@@ -363,53 +376,23 @@
                     }
                     if (uri.startsWith("endpoint:")) {
                         uri = uri.substring("endpoint:".length());
-                        String[] parts = split(uri);
+                        String[] parts = URIResolver.split3(uri);
                         return getInternalEndpoint(new QName(parts[0], parts[1]), parts[2]);
                     }
                     else if (uri.startsWith("service:")) {
                         uri = uri.substring("service:".length());
-                        String[] parts = splitService(uri);
+                        String[] parts = URIResolver.split2(uri);
                         return getEndpoint(new QName(parts[0], parts[1]), parts[1]);
                     }
                     // TODO should we support interface: and operation: here?
                 }
             }
         } catch (Exception e) {
-            // Ignored
+            log.debug("Unable to resolve EPR: " + e);
         }
         return null;
     }
 
-    protected String[] splitService(String uri) {
-        char sep;
-        uri = uri.trim();
-        if (uri.indexOf('/') > 0) {
-            sep = '/';
-        } else {
-            sep = ':';
-        }
-        int idx1 = uri.lastIndexOf(sep);
-        String svcName = uri.substring(idx1 + 1);
-        String nsUri   = uri.substring(0, idx1);
-        return new String[] { nsUri, svcName };
-    }
-    
-    protected String[] split(String uri) {
-        char sep;
-        uri = uri.trim();
-        if (uri.indexOf('/') > 0) {
-            sep = '/';
-        } else {
-            sep = ':';
-        }
-        int idx1 = uri.lastIndexOf(sep);
-        int idx2 = uri.lastIndexOf(sep, idx1 - 1);
-        String epName = uri.substring(idx1 + 1);
-        String svcName = uri.substring(idx2 + 1, idx1);
-        String nsUri   = uri.substring(0, idx2);
-        return new String[] { nsUri, svcName, epName };
-    }
-    
     /**
      * @param provider
      * @param externalEndpoint the external endpoint to be registered, must be non-null.

Modified: incubator/servicemix/trunk/core/servicemix-core/src/main/java/org/apache/servicemix/jbi/resolver/URIResolver.java
URL: http://svn.apache.org/viewvc/incubator/servicemix/trunk/core/servicemix-core/src/main/java/org/apache/servicemix/jbi/resolver/URIResolver.java?view=diff&rev=519937&r1=519936&r2=519937
==============================================================================
--- incubator/servicemix/trunk/core/servicemix-core/src/main/java/org/apache/servicemix/jbi/resolver/URIResolver.java (original)
+++ incubator/servicemix/trunk/core/servicemix-core/src/main/java/org/apache/servicemix/jbi/resolver/URIResolver.java Mon Mar 19 06:05:48 2007
@@ -23,6 +23,7 @@
 import javax.xml.namespace.QName;
 
 import org.apache.servicemix.jbi.jaxp.SourceTransformer;
+import org.apache.servicemix.jbi.util.WSAddressingConstants;
 import org.w3c.dom.Document;
 import org.w3c.dom.DocumentFragment;
 import org.w3c.dom.Element;
@@ -102,7 +103,8 @@
         }
         DocumentFragment epr = doc.createDocumentFragment();
         Element root = doc.createElement("epr");
-        Element address = doc.createElementNS("http://www.w3.org/2005/08/addressing", "wsa:Address");
+        Element address = doc.createElementNS(WSAddressingConstants.WSA_NAMESPACE_200508, 
+                                              WSAddressingConstants.WSA_PREFIX + ":" + WSAddressingConstants.EL_ADDRESS);
         Text txt = doc.createTextNode(uri);
         address.appendChild(txt);
         root.appendChild(address);
@@ -155,6 +157,9 @@
         }
         int idx1 = uri.lastIndexOf(sep);
         int idx2 = uri.lastIndexOf(sep, idx1 - 1);
+        if (idx1 < 0 || idx2 < 0) {
+            throw new IllegalArgumentException("Bad syntax: expected [part0][sep][part1][sep][part2]");
+        }
         String epName = uri.substring(idx1 + 1);
         String svcName = uri.substring(idx2 + 1, idx1);
         String nsUri   = uri.substring(0, idx2);
@@ -169,6 +174,9 @@
             sep = ':';
         }
         int idx1 = uri.lastIndexOf(sep);
+        if (idx1 < 0) {
+            throw new IllegalArgumentException("Bad syntax: expected [part0][sep][part1]");
+        }
         String svcName = uri.substring(idx1 + 1);
         String nsUri   = uri.substring(0, idx1);
         return new String[] { nsUri, svcName };

Added: incubator/servicemix/trunk/core/servicemix-core/src/main/java/org/apache/servicemix/jbi/util/WSAddressingConstants.java
URL: http://svn.apache.org/viewvc/incubator/servicemix/trunk/core/servicemix-core/src/main/java/org/apache/servicemix/jbi/util/WSAddressingConstants.java?view=auto&rev=519937
==============================================================================
--- incubator/servicemix/trunk/core/servicemix-core/src/main/java/org/apache/servicemix/jbi/util/WSAddressingConstants.java (added)
+++ incubator/servicemix/trunk/core/servicemix-core/src/main/java/org/apache/servicemix/jbi/util/WSAddressingConstants.java Mon Mar 19 06:05:48 2007
@@ -0,0 +1,39 @@
+/*
+ * 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.jbi.util;
+
+public interface WSAddressingConstants {
+
+    public static final String WSA_NAMESPACE_200303 = "http://schemas.xmlsoap.org/ws/2003/03/addressing";
+    public static final String WSA_NAMESPACE_200403 = "http://schemas.xmlsoap.org/ws/2004/03/addressing";
+    public static final String WSA_NAMESPACE_200408 = "http://schemas.xmlsoap.org/ws/2004/08/addressing";
+    public static final String WSA_NAMESPACE_200508 = "http://www.w3.org/2005/08/addressing";
+    
+    public static final String WSA_PREFIX = "wsa";
+    
+    public static final String EL_ACTION = "Action";
+    public static final String EL_ADDRESS = "Address";
+    public static final String EL_FAULT_TO = "FaultTo";
+    public static final String EL_FROM = "From";
+    public static final String EL_MESSAGE_ID = "MessageID";
+    public static final String EL_METADATA = "Metadata";
+    public static final String EL_REFERENCE_PARAMETERS = "ReferenceParameters";
+    public static final String EL_RELATES_TO = "RelatesTo";
+    public static final String EL_REPLY_TO = "ReplyTo";
+    public static final String EL_TO = "To";
+
+}

Propchange: incubator/servicemix/trunk/core/servicemix-core/src/main/java/org/apache/servicemix/jbi/util/WSAddressingConstants.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/servicemix/trunk/core/servicemix-core/src/main/java/org/apache/servicemix/jbi/util/WSAddressingConstants.java
------------------------------------------------------------------------------
    svn:keywords = Date Revision

Propchange: incubator/servicemix/trunk/core/servicemix-core/src/main/java/org/apache/servicemix/jbi/util/WSAddressingConstants.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Modified: incubator/servicemix/trunk/core/servicemix-core/src/test/java/org/apache/servicemix/jbi/framework/RegistryTest.java
URL: http://svn.apache.org/viewvc/incubator/servicemix/trunk/core/servicemix-core/src/test/java/org/apache/servicemix/jbi/framework/RegistryTest.java?view=diff&rev=519937&r1=519936&r2=519937
==============================================================================
--- incubator/servicemix/trunk/core/servicemix-core/src/test/java/org/apache/servicemix/jbi/framework/RegistryTest.java (original)
+++ incubator/servicemix/trunk/core/servicemix-core/src/test/java/org/apache/servicemix/jbi/framework/RegistryTest.java Mon Mar 19 06:05:48 2007
@@ -22,8 +22,8 @@
 import junit.framework.TestCase;
 
 import org.apache.servicemix.components.util.EchoComponent;
-import org.apache.servicemix.jbi.container.ActivationSpec;
 import org.apache.servicemix.jbi.container.JBIContainer;
+import org.apache.servicemix.jbi.resolver.URIResolver;
 import org.w3c.dom.DocumentFragment;
 
 public class RegistryTest extends TestCase {
@@ -40,7 +40,20 @@
         DocumentFragment epr = ep.getAsReference(null);
         ServiceEndpoint ep2 = component.getContext().resolveEndpointReference(epr);
         assertSame(ep, ep2);
-
+    }
+    
+    public void testResolveWSAEPR() throws Exception {
+        JBIContainer container = new JBIContainer();
+        container.setEmbedded(true);
+        container.init();
+        container.start();
+        
+        EchoComponent component = new EchoComponent();
+        container.activateComponent(component, "component");
+        ServiceEndpoint ep = component.getContext().activateEndpoint(new QName("http://foo.bar.com", "myService"), "myEndpoint");
+        DocumentFragment epr = URIResolver.createWSAEPR("endpoint:http://foo.bar.com/myService/myEndpoint");
+        ServiceEndpoint ep2 = component.getContext().resolveEndpointReference(epr);
+        assertSame(ep, ep2);
     }
     
 }

Added: incubator/servicemix/trunk/core/servicemix-core/src/test/java/org/apache/servicemix/jbi/resolver/URIResolverTest.java
URL: http://svn.apache.org/viewvc/incubator/servicemix/trunk/core/servicemix-core/src/test/java/org/apache/servicemix/jbi/resolver/URIResolverTest.java?view=auto&rev=519937
==============================================================================
--- incubator/servicemix/trunk/core/servicemix-core/src/test/java/org/apache/servicemix/jbi/resolver/URIResolverTest.java (added)
+++ incubator/servicemix/trunk/core/servicemix-core/src/test/java/org/apache/servicemix/jbi/resolver/URIResolverTest.java Mon Mar 19 06:05:48 2007
@@ -0,0 +1,107 @@
+/*
+ * 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.jbi.resolver;
+
+import junit.framework.TestCase;
+
+public class URIResolverTest extends TestCase {
+
+    public void testSplit2Column() {
+        String[] parts = URIResolver.split2("urn:ns:svc");
+        assertNotNull(parts);
+        assertEquals(2, parts.length);
+        assertEquals("urn:ns", parts[0]);
+        assertEquals("svc", parts[1]);
+    }
+    
+    public void testSplit2Slash() {
+        String[] parts = URIResolver.split2("urn://ns/svc");
+        assertNotNull(parts);
+        assertEquals(2, parts.length);
+        assertEquals("urn://ns", parts[0]);
+        assertEquals("svc", parts[1]);
+    }
+    
+    public void testSplit2SlashEnding() {
+        String[] parts = URIResolver.split2("urn://ns//svc");
+        assertNotNull(parts);
+        assertEquals(2, parts.length);
+        assertEquals("urn://ns/", parts[0]);
+        assertEquals("svc", parts[1]);
+    }
+    
+    public void testSplit2Bad() {
+        try {
+            String[] parts = URIResolver.split2("urn");
+            fail();
+        } catch (IllegalArgumentException e) {
+            // ok
+        }
+    }
+    
+    public void testSplit3Column() {
+        String[] parts = URIResolver.split3("urn:ns:svc:ep");
+        assertNotNull(parts);
+        assertEquals(3, parts.length);
+        assertEquals("urn:ns", parts[0]);
+        assertEquals("svc", parts[1]);
+        assertEquals("ep", parts[2]);
+    }
+    
+    public void testSplit3ColumnEmpty() {
+        String[] parts = URIResolver.split3("urn:ns::ep");
+        assertNotNull(parts);
+        assertEquals(3, parts.length);
+        assertEquals("urn:ns", parts[0]);
+        assertEquals("", parts[1]);
+        assertEquals("ep", parts[2]);
+    }
+    
+    public void testSplit3Slash() {
+        String[] parts = URIResolver.split3("urn://ns/svc/ep");
+        assertNotNull(parts);
+        assertEquals(3, parts.length);
+        assertEquals("urn://ns", parts[0]);
+        assertEquals("svc", parts[1]);
+        assertEquals("ep", parts[2]);
+    }
+    
+    public void testSplit3SlashEnding() {
+        String[] parts = URIResolver.split3("urn://ns//svc/ep");
+        assertNotNull(parts);
+        assertEquals(3, parts.length);
+        assertEquals("urn://ns/", parts[0]);
+        assertEquals("svc", parts[1]);
+        assertEquals("ep", parts[2]);
+    }
+    
+    public void testSplit3Bad() {
+        try {
+            String[] parts = URIResolver.split3("urn");
+            fail();
+        } catch (IllegalArgumentException e) {
+            // ok
+        }
+        try {
+            String[] parts = URIResolver.split3("urn:test");
+            fail();
+        } catch (IllegalArgumentException e) {
+            // ok
+        }
+    }
+    
+}

Propchange: incubator/servicemix/trunk/core/servicemix-core/src/test/java/org/apache/servicemix/jbi/resolver/URIResolverTest.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/servicemix/trunk/core/servicemix-core/src/test/java/org/apache/servicemix/jbi/resolver/URIResolverTest.java
------------------------------------------------------------------------------
    svn:keywords = Date Revision

Propchange: incubator/servicemix/trunk/core/servicemix-core/src/test/java/org/apache/servicemix/jbi/resolver/URIResolverTest.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain