geronimo-scm mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jdil...@apache.org
Subject svn commit: r420023 - /geronimo/sandbox/svkmerge/m2migration/modules/kernel/src/test/org/apache/geronimo/kernel/classloader/UrlResourceFinderTest.java
Date Sat, 08 Jul 2006 00:34:04 GMT
Author: jdillon
Date: Fri Jul  7 17:34:03 2006
New Revision: 420023

URL: http://svn.apache.org/viewvc?rev=420023&view=rev
Log:
Root files to ${basedir}

Modified:
    geronimo/sandbox/svkmerge/m2migration/modules/kernel/src/test/org/apache/geronimo/kernel/classloader/UrlResourceFinderTest.java

Modified: geronimo/sandbox/svkmerge/m2migration/modules/kernel/src/test/org/apache/geronimo/kernel/classloader/UrlResourceFinderTest.java
URL: http://svn.apache.org/viewvc/geronimo/sandbox/svkmerge/m2migration/modules/kernel/src/test/org/apache/geronimo/kernel/classloader/UrlResourceFinderTest.java?rev=420023&r1=420022&r2=420023&view=diff
==============================================================================
--- geronimo/sandbox/svkmerge/m2migration/modules/kernel/src/test/org/apache/geronimo/kernel/classloader/UrlResourceFinderTest.java
(original)
+++ geronimo/sandbox/svkmerge/m2migration/modules/kernel/src/test/org/apache/geronimo/kernel/classloader/UrlResourceFinderTest.java
Fri Jul  7 17:34:03 2006
@@ -31,9 +31,10 @@
 import junit.framework.TestCase;
 
 /**
- * @version $Rev:$ $Date:$
+ * @version $Rev$ $Date$
  */
 public class UrlResourceFinderTest extends TestCase {
+    private File basedir = new File(System.getProperty("basedir"));
     private File jarFile;
     private Manifest manifest;
     private Attributes resourceAttributes;
@@ -45,8 +46,8 @@
      * @throws Exception
      */
     public void testResourceEnumeration() throws Exception {
-        URL jar1 = new File("src/test-data/resourceFinderTest/jar1/").toURL();
-        URL jar2 = new File("src/test-data/resourceFinderTest/jar2/").toURL();
+        URL jar1 = new File(basedir, "src/test-data/resourceFinderTest/jar1/").toURL();
+        URL jar2 = new File(basedir, "src/test-data/resourceFinderTest/jar2/").toURL();
         UrlResourceFinder resourceFinder = new UrlResourceFinder(new URL[] {jar1, jar2});
 
         Enumeration enumeration = resourceFinder.findResources("resource");
@@ -68,7 +69,7 @@
     }
 
     public void testDirectoryResource() throws Exception {
-        URL jar = new File("src/test-data/resourceFinderTest/jar1/").toURL();
+        URL jar = new File(basedir, "src/test-data/resourceFinderTest/jar1/").toURL();
         UrlResourceFinder resourceFinder = new UrlResourceFinder(new URL[] {jar});
 
         ResourceHandle resource = resourceFinder.getResource("resource");
@@ -146,7 +147,7 @@
     }
 
     public void testAddURL() throws Exception {
-        URL jar1 = new File("src/test-data/resourceFinderTest/jar1/").toURL();
+        URL jar1 = new File(basedir, "src/test-data/resourceFinderTest/jar1/").toURL();
         UrlResourceFinder resourceFinder = new UrlResourceFinder(new URL[] {jar1});
 
         Enumeration enumeration = resourceFinder.findResources("resource");
@@ -160,7 +161,7 @@
         assertFalse(enumeration.hasMoreElements());
 
         // addUrl
-        URL jar2 = new File("src/test-data/resourceFinderTest/jar2/").toURL();
+        URL jar2 = new File(basedir, "src/test-data/resourceFinderTest/jar2/").toURL();
         resourceFinder.addUrl(jar2);
 
         // getResource should find the first jar only
@@ -193,8 +194,8 @@
     }
 
     public void testConcurrentAddURL() throws Exception {
-        URL jar1 = new File("src/test-data/resourceFinderTest/jar1/").toURL();
-        URL jar2 = new File("src/test-data/resourceFinderTest/jar2/").toURL();
+        URL jar1 = new File(basedir, "src/test-data/resourceFinderTest/jar1/").toURL();
+        URL jar2 = new File(basedir, "src/test-data/resourceFinderTest/jar2/").toURL();
         UrlResourceFinder resourceFinder = new UrlResourceFinder(new URL[] {jar1, jar2});
 
         Enumeration enumeration = resourceFinder.findResources("resource");
@@ -237,7 +238,7 @@
     }
 
     public void testDirectoryDestroy() throws Exception {
-        URL jar = new File("src/test-data/resourceFinderTest/jar1/").toURL();
+        URL jar = new File(basedir, "src/test-data/resourceFinderTest/jar1/").toURL();
         UrlResourceFinder resourceFinder = new UrlResourceFinder(new URL[] {jar});
         assertDestroyed(resourceFinder, "resource1", null);
     }
@@ -326,7 +327,10 @@
 
     protected void setUp() throws Exception {
         super.setUp();
-
+        
+        //
+        // Build a simple Jar file to test with
+        //
         manifest = new Manifest();
         Attributes mainAttributes = manifest.getMainAttributes();
         mainAttributes.put(Attributes.Name.MANIFEST_VERSION, "1.0");
@@ -334,9 +338,9 @@
         resourceAttributes = new Attributes();
         resourceAttributes.putValue("drink", "margarita");
         manifest.getEntries().put("resource", resourceAttributes);
-
-        jarFile = new File("target/resourceFinderTest.jar");
-        System.out.println(jarFile.getAbsolutePath());
+        
+        File targetDir = new File(basedir, "target");
+        jarFile = new File(targetDir, "resourceFinderTest.jar");
         JarOutputStream jarOutputStream = new JarOutputStream(new FileOutputStream(jarFile),
manifest);
         jarOutputStream.putNextEntry(new ZipEntry("resource"));
         jarOutputStream.write("resource3".getBytes());



Mime
View raw message