servicemix-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From gno...@apache.org
Subject svn commit: r391948 - in /incubator/servicemix/trunk/servicemix-core/src/test: java/org/apache/servicemix/jbi/framework/ java/org/apache/servicemix/jbi/loaders/ resources/org/apache/servicemix/jbi/loaders/
Date Thu, 06 Apr 2006 09:44:04 GMT
Author: gnodet
Date: Thu Apr  6 02:44:02 2006
New Revision: 391948

URL: http://svn.apache.org/viewcvs?rev=391948&view=rev
Log:
Add some tests for resource loading from components class loaders

Added:
    incubator/servicemix/trunk/servicemix-core/src/test/java/org/apache/servicemix/jbi/loaders/
    incubator/servicemix/trunk/servicemix-core/src/test/java/org/apache/servicemix/jbi/loaders/ClassLoaderTest.java
      - copied, changed from r391748, incubator/servicemix/trunk/servicemix-core/src/test/java/org/apache/servicemix/jbi/framework/ClassLoaderTest.java
    incubator/servicemix/trunk/servicemix-core/src/test/resources/org/apache/servicemix/jbi/loaders/
    incubator/servicemix/trunk/servicemix-core/src/test/resources/org/apache/servicemix/jbi/loaders/jndi.properties
Removed:
    incubator/servicemix/trunk/servicemix-core/src/test/java/org/apache/servicemix/jbi/framework/ClassLoaderTest.java

Copied: incubator/servicemix/trunk/servicemix-core/src/test/java/org/apache/servicemix/jbi/loaders/ClassLoaderTest.java
(from r391748, incubator/servicemix/trunk/servicemix-core/src/test/java/org/apache/servicemix/jbi/framework/ClassLoaderTest.java)
URL: http://svn.apache.org/viewcvs/incubator/servicemix/trunk/servicemix-core/src/test/java/org/apache/servicemix/jbi/loaders/ClassLoaderTest.java?p2=incubator/servicemix/trunk/servicemix-core/src/test/java/org/apache/servicemix/jbi/loaders/ClassLoaderTest.java&p1=incubator/servicemix/trunk/servicemix-core/src/test/java/org/apache/servicemix/jbi/framework/ClassLoaderTest.java&r1=391748&r2=391948&rev=391948&view=diff
==============================================================================
--- incubator/servicemix/trunk/servicemix-core/src/test/java/org/apache/servicemix/jbi/framework/ClassLoaderTest.java
(original)
+++ incubator/servicemix/trunk/servicemix-core/src/test/java/org/apache/servicemix/jbi/loaders/ClassLoaderTest.java
Thu Apr  6 02:44:02 2006
@@ -13,8 +13,10 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.servicemix.jbi.framework;
+package org.apache.servicemix.jbi.loaders;
 
+import java.io.File;
+import java.net.URL;
 import java.net.URLClassLoader;
 
 import org.apache.servicemix.jbi.loaders.ParentFirstClassLoader;
@@ -43,5 +45,25 @@
 		Class  clazz = clsLoader.loadClass(TestClass.class.getName());
 		assertNotSame(TestClass.class, clazz);
 	}
-	
+    
+    public void testParentFirstResource() throws Exception {
+        URLClassLoader pcl = (URLClassLoader) getClass().getClassLoader();
+        URL url = getClass().getResource("jndi.properties");
+        url = new File(url.toURI()).getParentFile().toURL();
+        ClassLoader clsLoader = new ParentFirstClassLoader(new URL[] { url }, pcl);
+        URL res1 = clsLoader.getResource("jndi.properties");
+        URL res2 = pcl.getResource("jndi.properties");
+        assertEquals(res2, res1);
+    }
+    
+    public void testSelfFirstResource() throws Exception {
+        URLClassLoader pcl = (URLClassLoader) getClass().getClassLoader();
+        URL url = getClass().getResource("jndi.properties");
+        url = new File(url.toURI()).getParentFile().toURL();
+        ClassLoader clsLoader = new SelfFirstClassLoader(new URL[] { url }, pcl);
+        URL res1 = clsLoader.getResource("jndi.properties");
+        URL res2 = pcl.getResource("jndi.properties");
+        assertFalse(res2.equals(res1));
+    }
+    
 }

Added: incubator/servicemix/trunk/servicemix-core/src/test/resources/org/apache/servicemix/jbi/loaders/jndi.properties
URL: http://svn.apache.org/viewcvs/incubator/servicemix/trunk/servicemix-core/src/test/resources/org/apache/servicemix/jbi/loaders/jndi.properties?rev=391948&view=auto
==============================================================================
    (empty)



Mime
View raw message