[jboss-svn-commits] JBL Code SVN: r32982 - in labs/jbossesb/branches/JBESB_4_7_CP/product/rosetta: tests/src/org/jboss/soa/esb/listeners/deployers/mc/util and 1 other directory.

jboss-svn-commits at lists.jboss.org jboss-svn-commits at lists.jboss.org
Thu May 20 08:03:29 EDT 2010


Author: kevin.conner at jboss.com
Date: 2010-05-20 08:03:28 -0400 (Thu, 20 May 2010)
New Revision: 32982

Modified:
   labs/jbossesb/branches/JBESB_4_7_CP/product/rosetta/src/org/jboss/soa/esb/listeners/deployers/mc/util/VfsUtil.java
   labs/jbossesb/branches/JBESB_4_7_CP/product/rosetta/tests/src/org/jboss/soa/esb/listeners/deployers/mc/util/VfsUtilUnitTest.java
Log:
Fix prefix when no match: JBESB-3324

Modified: labs/jbossesb/branches/JBESB_4_7_CP/product/rosetta/src/org/jboss/soa/esb/listeners/deployers/mc/util/VfsUtil.java
===================================================================
--- labs/jbossesb/branches/JBESB_4_7_CP/product/rosetta/src/org/jboss/soa/esb/listeners/deployers/mc/util/VfsUtil.java	2010-05-20 11:59:47 UTC (rev 32981)
+++ labs/jbossesb/branches/JBESB_4_7_CP/product/rosetta/src/org/jboss/soa/esb/listeners/deployers/mc/util/VfsUtil.java	2010-05-20 12:03:28 UTC (rev 32982)
@@ -128,20 +128,27 @@
         }
         
         final int idx = path.indexOf(pathName);
+        final String subpath ;
         if (idx != -1)
         {
-            String filePath = path.substring(idx + pathName.length());
-            if (pathPrefix == null)
-            {
-                return filePath;
-            }
-            else 
-            {
-                return pathPrefix + filePath;
-            }
+            subpath = path.substring(idx + pathName.length());
         }
-        return path;
-        
+        else
+        {
+            subpath = path ;
+        }
+        if (pathPrefix == null)
+        {
+            return subpath;
+        }
+        else if (subpath.startsWith("/")) 
+        {
+            return pathPrefix + subpath;
+        }
+        else
+        {
+            return pathPrefix + "/" + subpath;
+        }
     }
     
     static String subpath(final String path, final String pathName)

Modified: labs/jbossesb/branches/JBESB_4_7_CP/product/rosetta/tests/src/org/jboss/soa/esb/listeners/deployers/mc/util/VfsUtilUnitTest.java
===================================================================
--- labs/jbossesb/branches/JBESB_4_7_CP/product/rosetta/tests/src/org/jboss/soa/esb/listeners/deployers/mc/util/VfsUtilUnitTest.java	2010-05-20 11:59:47 UTC (rev 32981)
+++ labs/jbossesb/branches/JBESB_4_7_CP/product/rosetta/tests/src/org/jboss/soa/esb/listeners/deployers/mc/util/VfsUtilUnitTest.java	2010-05-20 12:03:28 UTC (rev 32982)
@@ -195,4 +195,12 @@
         assertEquals(expectedPath, VfsUtil.subpath(actualPath, "Test.esb", "WEB-INF/wsdl"));
     }
 
+    @Test
+    public void subpathWithoutPrefix()
+    {
+        String actualPath = "types/custom-request-type.xsd";
+        String expectedPath = "WEB-INF/wsdl/types/custom-request-type.xsd";
+
+        assertEquals(expectedPath, VfsUtil.subpath(actualPath, "Test.esb", "WEB-INF/wsdl"));
+    }
 }



More information about the jboss-svn-commits mailing list