ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bode...@apache.org
Subject cvs commit: ant/src/testcases/org/apache/tools/ant AntClassLoaderDelegationTest.java AntClassLoaderTest.java
Date Tue, 27 Jul 2004 14:25:12 GMT
bodewig     2004/07/27 07:25:12

  Modified:    src/testcases/org/apache/tools/ant Tag: ANT_16_BRANCH
                        AntClassLoaderTest.java
  Added:       src/testcases/org/apache/tools/ant Tag: ANT_16_BRANCH
                        AntClassLoaderDelegationTest.java
  Log:
  merge
  
  Revision  Changes    Path
  No                   revision
  No                   revision
  1.3.2.6   +0 -52     ant/src/testcases/org/apache/tools/ant/AntClassLoaderTest.java
  
  Index: AntClassLoaderTest.java
  ===================================================================
  RCS file: /home/cvs/ant/src/testcases/org/apache/tools/ant/AntClassLoaderTest.java,v
  retrieving revision 1.3.2.5
  retrieving revision 1.3.2.6
  diff -u -r1.3.2.5 -r1.3.2.6
  --- AntClassLoaderTest.java	27 Jul 2004 07:15:09 -0000	1.3.2.5
  +++ AntClassLoaderTest.java	27 Jul 2004 14:25:12 -0000	1.3.2.6
  @@ -82,56 +82,4 @@
               fail("loader should not fail even if project finished");
           }
       }
  -    
  -    /** Sample resource present in build/testcases/ */
  -    private static final String TEST_RESOURCE = "org/apache/tools/ant/IncludeTest.class";
  -    
  -    public void testFindResources() throws Exception {
  -        //System.err.println("loading from: " + AntClassLoader.class.getProtectionDomain().getCodeSource().getLocation());
  -        // See bug #30161.
  -        // This path should contain the class files for these testcases:
  -        String buildTestcases = System.getProperty("build.tests");
  -        assertNotNull("defined ${build.tests}", buildTestcases);
  -        assertTrue("have a dir " + buildTestcases, new File(buildTestcases).isDirectory());
  -        Path path = new Path(p, buildTestcases);
  -        // A special parent loader which is not the system class loader:
  -        ClassLoader parent = new ParentLoader();
  -        // An AntClassLoader which is supposed to delegate to the parent and then to the
disk path:
  -        ClassLoader acl = new AntClassLoader(parent, p, path, true);
  -        // The intended result URLs:
  -        URL urlFromPath = new URL(FileUtils.newFileUtils().toURI(buildTestcases) + TEST_RESOURCE);
  -        URL urlFromParent = new URL("http://ant.apache.org/" + TEST_RESOURCE);
  -        assertEquals("correct resources (regular delegation order)",
  -            Arrays.asList(new URL[] {urlFromParent, urlFromPath}),
  -            enum2List(acl.getResources(TEST_RESOURCE)));
  -        acl = new AntClassLoader(parent, p, path, false);
  -        assertEquals("correct resources (reverse delegation order)",
  -            Arrays.asList(new URL[] {urlFromPath, urlFromParent}),
  -            enum2List(acl.getResources(TEST_RESOURCE)));
  -    }
  -    
  -    private static List enum2List(Enumeration e) {
  -        // JDK 1.4: return Collections.list(e);
  -        List l = new ArrayList();
  -        while (e.hasMoreElements()) {
  -            l.add(e.nextElement());
  -        }
  -        return l;
  -    }
  -    
  -    /** Special loader that just knows how to find TEST_RESOURCE. */
  -    private static final class ParentLoader extends ClassLoader {
  -        
  -        public ParentLoader() {}
  -        
  -        protected Enumeration findResources(String name) throws IOException {
  -            if (name.equals(TEST_RESOURCE)) {
  -                return Collections.enumeration(Collections.singleton(new URL("http://ant.apache.org/"
+ name)));
  -            } else {
  -                return Collections.enumeration(Collections.EMPTY_SET);
  -            }
  -        }
  -        
  -    }
  -    
   }
  
  
  
  No                   revision
  
  Index: AntClassLoaderTest.java
  ===================================================================
  RCS file: /home/cvs/ant/src/testcases/org/apache/tools/ant/AntClassLoaderTest.java,v
  retrieving revision 1.3.2.5
  retrieving revision 1.3.2.6
  diff -u -r1.3.2.5 -r1.3.2.6
  --- AntClassLoaderTest.java	27 Jul 2004 07:15:09 -0000	1.3.2.5
  +++ AntClassLoaderTest.java	27 Jul 2004 14:25:12 -0000	1.3.2.6
  @@ -82,56 +82,4 @@
               fail("loader should not fail even if project finished");
           }
       }
  -    
  -    /** Sample resource present in build/testcases/ */
  -    private static final String TEST_RESOURCE = "org/apache/tools/ant/IncludeTest.class";
  -    
  -    public void testFindResources() throws Exception {
  -        //System.err.println("loading from: " + AntClassLoader.class.getProtectionDomain().getCodeSource().getLocation());
  -        // See bug #30161.
  -        // This path should contain the class files for these testcases:
  -        String buildTestcases = System.getProperty("build.tests");
  -        assertNotNull("defined ${build.tests}", buildTestcases);
  -        assertTrue("have a dir " + buildTestcases, new File(buildTestcases).isDirectory());
  -        Path path = new Path(p, buildTestcases);
  -        // A special parent loader which is not the system class loader:
  -        ClassLoader parent = new ParentLoader();
  -        // An AntClassLoader which is supposed to delegate to the parent and then to the
disk path:
  -        ClassLoader acl = new AntClassLoader(parent, p, path, true);
  -        // The intended result URLs:
  -        URL urlFromPath = new URL(FileUtils.newFileUtils().toURI(buildTestcases) + TEST_RESOURCE);
  -        URL urlFromParent = new URL("http://ant.apache.org/" + TEST_RESOURCE);
  -        assertEquals("correct resources (regular delegation order)",
  -            Arrays.asList(new URL[] {urlFromParent, urlFromPath}),
  -            enum2List(acl.getResources(TEST_RESOURCE)));
  -        acl = new AntClassLoader(parent, p, path, false);
  -        assertEquals("correct resources (reverse delegation order)",
  -            Arrays.asList(new URL[] {urlFromPath, urlFromParent}),
  -            enum2List(acl.getResources(TEST_RESOURCE)));
  -    }
  -    
  -    private static List enum2List(Enumeration e) {
  -        // JDK 1.4: return Collections.list(e);
  -        List l = new ArrayList();
  -        while (e.hasMoreElements()) {
  -            l.add(e.nextElement());
  -        }
  -        return l;
  -    }
  -    
  -    /** Special loader that just knows how to find TEST_RESOURCE. */
  -    private static final class ParentLoader extends ClassLoader {
  -        
  -        public ParentLoader() {}
  -        
  -        protected Enumeration findResources(String name) throws IOException {
  -            if (name.equals(TEST_RESOURCE)) {
  -                return Collections.enumeration(Collections.singleton(new URL("http://ant.apache.org/"
+ name)));
  -            } else {
  -                return Collections.enumeration(Collections.EMPTY_SET);
  -            }
  -        }
  -        
  -    }
  -    
   }
  
  
  
  No                   revision
  
  Index: AntClassLoaderTest.java
  ===================================================================
  RCS file: /home/cvs/ant/src/testcases/org/apache/tools/ant/AntClassLoaderTest.java,v
  retrieving revision 1.3.2.5
  retrieving revision 1.3.2.6
  diff -u -r1.3.2.5 -r1.3.2.6
  --- AntClassLoaderTest.java	27 Jul 2004 07:15:09 -0000	1.3.2.5
  +++ AntClassLoaderTest.java	27 Jul 2004 14:25:12 -0000	1.3.2.6
  @@ -82,56 +82,4 @@
               fail("loader should not fail even if project finished");
           }
       }
  -    
  -    /** Sample resource present in build/testcases/ */
  -    private static final String TEST_RESOURCE = "org/apache/tools/ant/IncludeTest.class";
  -    
  -    public void testFindResources() throws Exception {
  -        //System.err.println("loading from: " + AntClassLoader.class.getProtectionDomain().getCodeSource().getLocation());
  -        // See bug #30161.
  -        // This path should contain the class files for these testcases:
  -        String buildTestcases = System.getProperty("build.tests");
  -        assertNotNull("defined ${build.tests}", buildTestcases);
  -        assertTrue("have a dir " + buildTestcases, new File(buildTestcases).isDirectory());
  -        Path path = new Path(p, buildTestcases);
  -        // A special parent loader which is not the system class loader:
  -        ClassLoader parent = new ParentLoader();
  -        // An AntClassLoader which is supposed to delegate to the parent and then to the
disk path:
  -        ClassLoader acl = new AntClassLoader(parent, p, path, true);
  -        // The intended result URLs:
  -        URL urlFromPath = new URL(FileUtils.newFileUtils().toURI(buildTestcases) + TEST_RESOURCE);
  -        URL urlFromParent = new URL("http://ant.apache.org/" + TEST_RESOURCE);
  -        assertEquals("correct resources (regular delegation order)",
  -            Arrays.asList(new URL[] {urlFromParent, urlFromPath}),
  -            enum2List(acl.getResources(TEST_RESOURCE)));
  -        acl = new AntClassLoader(parent, p, path, false);
  -        assertEquals("correct resources (reverse delegation order)",
  -            Arrays.asList(new URL[] {urlFromPath, urlFromParent}),
  -            enum2List(acl.getResources(TEST_RESOURCE)));
  -    }
  -    
  -    private static List enum2List(Enumeration e) {
  -        // JDK 1.4: return Collections.list(e);
  -        List l = new ArrayList();
  -        while (e.hasMoreElements()) {
  -            l.add(e.nextElement());
  -        }
  -        return l;
  -    }
  -    
  -    /** Special loader that just knows how to find TEST_RESOURCE. */
  -    private static final class ParentLoader extends ClassLoader {
  -        
  -        public ParentLoader() {}
  -        
  -        protected Enumeration findResources(String name) throws IOException {
  -            if (name.equals(TEST_RESOURCE)) {
  -                return Collections.enumeration(Collections.singleton(new URL("http://ant.apache.org/"
+ name)));
  -            } else {
  -                return Collections.enumeration(Collections.EMPTY_SET);
  -            }
  -        }
  -        
  -    }
  -    
   }
  
  
  
  1.1.2.1   +0 -0      ant/src/testcases/org/apache/tools/ant/AntClassLoaderDelegationTest.java
  
  Index: AntClassLoaderDelegationTest.java
  ===================================================================
  RCS file: /home/cvs/ant/src/testcases/org/apache/tools/ant/AntClassLoaderDelegationTest.java,v
  retrieving revision 1.1
  retrieving revision 1.1.2.1
  diff -u -r1.1 -r1.1.2.1
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@ant.apache.org
For additional commands, e-mail: dev-help@ant.apache.org


Mime
View raw message