cvs commit: ant/src/testcases/org/apache/tools/ant ProjectTest.java

2005-01-07 Thread jkf
jkf 2005/01/07 07:04:09

  Modified:src/testcases/org/apache/tools/ant ProjectTest.java
  Log:
  forgot to update cright year
  
  Revision  ChangesPath
  1.27  +1 -1  ant/src/testcases/org/apache/tools/ant/ProjectTest.java
  
  Index: ProjectTest.java
  ===
  RCS file: /home/cvs/ant/src/testcases/org/apache/tools/ant/ProjectTest.java,v
  retrieving revision 1.26
  retrieving revision 1.27
  diff -u -r1.26 -r1.27
  --- ProjectTest.java  7 Jan 2005 14:04:41 -   1.26
  +++ ProjectTest.java  7 Jan 2005 15:04:09 -   1.27
  @@ -1,5 +1,5 @@
   /*
  - * Copyright  2000-2004 The Apache Software Foundation
  + * Copyright  2000-2005 The Apache Software Foundation
*
*  Licensed under the Apache License, Version 2.0 (the "License");
*  you may not use this file except in compliance with the License.
  
  
  

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



cvs commit: ant/src/testcases/org/apache/tools/ant ProjectTest.java

2005-01-07 Thread jkf
jkf 2005/01/07 06:04:41

  Modified:src/testcases/org/apache/tools/ant/util FileUtilsTest.java
   src/testcases/org/apache/tools/ant ProjectTest.java
  Log:
  Adapted the FileUtils test to show behaviour based on os type.
  
  Revision  ChangesPath
  1.32  +73 -50
ant/src/testcases/org/apache/tools/ant/util/FileUtilsTest.java
  
  Index: FileUtilsTest.java
  ===
  RCS file: 
/home/cvs/ant/src/testcases/org/apache/tools/ant/util/FileUtilsTest.java,v
  retrieving revision 1.31
  retrieving revision 1.32
  diff -u -r1.31 -r1.32
  --- FileUtilsTest.java6 Jan 2005 12:05:07 -   1.31
  +++ FileUtilsTest.java7 Jan 2005 14:04:41 -   1.32
  @@ -109,37 +109,37 @@
   assertEquals(File.separator,
FILE_UTILS.resolveFile(null, "\\").getPath());
   
  -/*
  - * throw in drive letters
  - */
  -String driveSpec = "C:";
  -assertEquals(driveSpec + "\\",
  - FILE_UTILS.resolveFile(null, driveSpec + 
"/").getPath());
  -assertEquals(driveSpec + "\\",
  - FILE_UTILS.resolveFile(null, driveSpec + 
"\\").getPath());
  -String driveSpecLower = "c:";
  -assertEquals(driveSpec + "\\",
  - FILE_UTILS.resolveFile(null, driveSpecLower + 
"/").getPath());
  -assertEquals(driveSpec + "\\",
  - FILE_UTILS.resolveFile(null, driveSpecLower + 
"\\").getPath());
  -/*
  - * promised to eliminate consecutive slashes after drive letter.
  - */
  -assertEquals(driveSpec + "\\",
  - FILE_UTILS.resolveFile(null, driveSpec + 
"/").getPath());
  -assertEquals(driveSpec + "\\",
  - FILE_UTILS.resolveFile(null, driveSpec + 
"").getPath());
  -
  -if (Os.isFamily("netware")) {
  +if (Os.isFamily("dos")) {
  +/*
  + * throw in drive letters
  + */
  +String driveSpec = "C:";
  +assertEquals(driveSpec + "\\",
  + FILE_UTILS.resolveFile(null, driveSpec + 
"/").getPath());
  +assertEquals(driveSpec + "\\",
  + FILE_UTILS.resolveFile(null, driveSpec + 
"\\").getPath());
  +String driveSpecLower = "c:";
  +assertEquals(driveSpec + "\\",
  + FILE_UTILS.resolveFile(null, driveSpecLower + 
"/").getPath());
  +assertEquals(driveSpec + "\\",
  + FILE_UTILS.resolveFile(null, driveSpecLower + 
"\\").getPath());
  +/*
  + * promised to eliminate consecutive slashes after drive letter.
  + */
  +assertEquals(driveSpec + "\\",
  + FILE_UTILS.resolveFile(null, driveSpec + 
"/").getPath());
  +assertEquals(driveSpec + "\\",
  + FILE_UTILS.resolveFile(null, driveSpec + 
"").getPath());
  +} else if (Os.isFamily("netware")) {
   /*
* throw in NetWare volume names
*/
  -driveSpec = "SYS:";
  +String driveSpec = "SYS:";
   assertEquals(driveSpec,
FILE_UTILS.resolveFile(null, driveSpec + 
"/").getPath());
   assertEquals(driveSpec,
FILE_UTILS.resolveFile(null, driveSpec + 
"\\").getPath());
  -driveSpecLower = "sys:";
  +String driveSpecLower = "sys:";
   assertEquals(driveSpec,
FILE_UTILS.resolveFile(null, driveSpecLower + 
"/").getPath());
   assertEquals(driveSpec,
  @@ -151,6 +151,20 @@
FILE_UTILS.resolveFile(null, driveSpec + 
"/").getPath());
   assertEquals(driveSpec,
FILE_UTILS.resolveFile(null, driveSpec + 
"").getPath());
  +} else {
  +/*
  + * drive letters must be considered just normal filenames.
  + */
  +String driveSpec = "C:";
  +assertEquals(driveSpec,
  + FILE_UTILS.resolveFile(null, driveSpec + 
"/").getPath());
  +assertEquals(driveSpec,
  + FILE_UTILS.resolveFile(null, driveSpec + 
"\\").getPath());
  +String driveSpecLower = "c:";
  +assertEquals(driveSpecLower,
  + FILE_UTILS.resolveFile(null, driveSpecLower + 
"/").getPath());
  +assertEquals(driveSpecLower,
  + FILE_UTILS.resolveFile(null, driveSpecLower + 
"\\").getPath());
   }
   
   /*
  @@ -191,41 +205,41 @@
   assertEquals(File.separator,
FILE_UTILS.normalize("\\").getPath());
   
  - 

cvs commit: ant/src/testcases/org/apache/tools/ant ProjectTest.java

2004-02-20 Thread jhm
jhm 2004/02/20 04:24:04

  Modified:src/testcases/org/apache/tools/ant ProjectTest.java
  Added:   src/etc/testcases/core duplicate-target2.xml
duplicate-target-imported.xml
  Log:
  Another testcase for double target-definition
  
  Revision  ChangesPath
  1.1  ant/src/etc/testcases/core/duplicate-target2.xml
  
  Index: duplicate-target2.xml
  ===
  
  
  
  
  
  
  
  once from buildfile
  
  
  
  
  1.1  ant/src/etc/testcases/core/duplicate-target-imported.xml
  
  Index: duplicate-target-imported.xml
  ===
  
  
  
  
  once from imported
  
  
  
  
  1.23  +8 -2  ant/src/testcases/org/apache/tools/ant/ProjectTest.java
  
  Index: ProjectTest.java
  ===
  RCS file: /home/cvs/ant/src/testcases/org/apache/tools/ant/ProjectTest.java,v
  retrieving revision 1.22
  retrieving revision 1.23
  diff -u -r1.22 -r1.23
  --- ProjectTest.java  18 Feb 2004 08:17:15 -  1.22
  +++ ProjectTest.java  20 Feb 2004 12:24:04 -  1.23
  @@ -204,12 +204,18 @@
   
assertTrue(p.getTaskDefinitions().contains(org.apache.tools.ant.taskdefs.Echo.class));
   }
   
  -// Bug in Ant 1.6/1.7 found by Dominique: there must no multiple
  -// targets with the same name in a project.
   public void testDuplicateTargets() {
  +// fail, because buildfile contains two targets with the same name
   BFT bft = new BFT("", "core/duplicate-target.xml");
   bft.expectBuildException("twice", "Duplicate target");
   }
  +
  +public void testDuplicateTargetsImport() {
  +// overriding target from imported buildfile is allowed
  +BFT bft = new BFT("", "core/duplicate-target2.xml");
  +bft.expectLog("once", "once from buildfile");
  +}
  +
   
   private class DummyTaskPrivate extends Task {
   public DummyTaskPrivate() {}
  
  
  

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: cvs commit: ant/src/testcases/org/apache/tools/ant ProjectTest.java

2004-02-18 Thread Stefan Bodewig
On 18 Feb 2004, <[EMAIL PROTECTED]> wrote:

>   + * @author Jan Matèrne

You probably better use \u00e8 instead of è.

Stefan

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



cvs commit: ant/src/testcases/org/apache/tools/ant ProjectTest.java

2004-02-18 Thread jhm
jhm 2004/02/18 00:17:15

  Modified:src/testcases/org/apache/tools/ant ProjectTest.java
  Added:   src/etc/testcases/core duplicate-target.xml
  Log:
  Testcase for duplicate targets. Reported by Dominique Devienne.
  
  Revision  ChangesPath
  1.1  ant/src/etc/testcases/core/duplicate-target.xml
  
  Index: duplicate-target.xml
  ===
  
  
  
  
  once
  
  
  
  twice-a
  
  
  
  twice-b
  
  
  
  
  1.22  +43 -2 ant/src/testcases/org/apache/tools/ant/ProjectTest.java
  
  Index: ProjectTest.java
  ===
  RCS file: /home/cvs/ant/src/testcases/org/apache/tools/ant/ProjectTest.java,v
  retrieving revision 1.21
  retrieving revision 1.22
  diff -u -r1.21 -r1.22
  --- ProjectTest.java  9 Feb 2004 21:05:40 -   1.21
  +++ ProjectTest.java  18 Feb 2004 08:17:15 -  1.22
  @@ -34,7 +34,8 @@
* Very limited test class for Project. Waiting to be extended.
*
* @author Stefan Bodewig
  - */
  + * @author Jan Matèrne
  +*/
   public class ProjectTest extends TestCase {
   
   private Project p;
  @@ -203,6 +204,13 @@
   
assertTrue(p.getTaskDefinitions().contains(org.apache.tools.ant.taskdefs.Echo.class));
   }
   
  +// Bug in Ant 1.6/1.7 found by Dominique: there must no multiple
  +// targets with the same name in a project.
  +public void testDuplicateTargets() {
  +BFT bft = new BFT("", "core/duplicate-target.xml");
  +bft.expectBuildException("twice", "Duplicate target");
  +}
  +
   private class DummyTaskPrivate extends Task {
   public DummyTaskPrivate() {}
   public void execute() {}
  @@ -213,9 +221,42 @@
   public void execute() {}
   }
   
  +private class BFT extends org.apache.tools.ant.BuildFileTest {
  +BFT(String name, String buildfile) {
  +super(name);
  +this.buildfile = buildfile;
  +setUp();
  +}
  +
  +// avoid multiple configurations
  +boolean isConfigured = false;
  +
  +// the buildfile to use
  +String buildfile = "";
  +
  +public void setUp() {
  +if (!isConfigured) {
  +configureProject("src/etc/testcases/"+buildfile);
  +isConfigured = true;
  +}
  +}
  +
  +public void tearDown() { }
  +
  +// call a target
  +public void doTarget(String target) {
  +if (!isConfigured) setUp();
  +executeTarget(target);
  +}
  +
  +public org.apache.tools.ant.Project getProject() {
  +return super.getProject();
  +}
  +}//class-BFT
  +
   }
   
   class DummyTaskPackage extends Task {
   public DummyTaskPackage() {}
   public void execute() {}
  -}
  +}
  \ No newline at end of file
  
  
  

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



cvs commit: ant/src/testcases/org/apache/tools/ant ProjectTest.java

2003-06-27 Thread peterreilly
peterreilly2003/06/27 02:24:10

  Modified:src/main/org/apache/tools/ant ComponentHelper.java
   src/main/org/apache/tools/ant/taskdefs Typedef.java
   src/testcases/org/apache/tools/ant ProjectTest.java
  Log:
  Get Project#getTaskDefinitions and Project#getDataTypeDefinitions
  to emulate old behaviour
This fixs the  output.
  Provide ComponentHelper#getAntTypeTable to provide the full table
  Revert changes to ProjectTest
  Update Typedef.java (forgot this in previous commit)
  
  Revision  ChangesPath
  1.13  +69 -8 ant/src/main/org/apache/tools/ant/ComponentHelper.java
  
  Index: ComponentHelper.java
  ===
  RCS file: /home/cvs/ant/src/main/org/apache/tools/ant/ComponentHelper.java,v
  retrieving revision 1.12
  retrieving revision 1.13
  diff -u -r1.12 -r1.13
  --- ComponentHelper.java  26 Jun 2003 08:54:28 -  1.12
  +++ ComponentHelper.java  27 Jun 2003 09:24:10 -  1.13
  @@ -92,12 +92,19 @@
* @since Ant1.6
*/
   public class ComponentHelper  {
  -// Map from task names to implementing classes - not used anymore
  -private Hashtable taskClassDefinitions = new Hashtable();
  -
   /** Map from compoennt name to anttypedefinition */
   private AntTypeTable antTypeTable;
   
  +/** Map of tasks generated from antTypeTable */
  +private Hashtable taskClassDefinitions = new Hashtable();
  +/** flag to rebuild taskClassDefinitions */
  +private boolean rebuildTaskClassDefinitions = true;
  +
  +/** Map of types generated from antTypeTable */
  +private Hashtable typeClassDefinitions = new Hashtable();
  +/** flag to rebuild typeClassDefinitions */
  +private boolean rebuildTypeClassDefinitions = true;
  +
   /**
* Map from task names to vectors of created tasks
* (String to Vector of Task). This is used to invalidate tasks if
  @@ -105,7 +112,6 @@
*/
   private Hashtable createdTasks = new Hashtable();
   
  -
   protected ComponentHelper next;
   protected Project project;
   
  @@ -301,15 +307,70 @@
   /**
* Returns the current task definition hashtable. The returned hashtable 
is
* "live" and so should not be modified.
  - * This table does not contain any information
*
* @return a map of from task name to implementing class
* (String to Class).
*/
   public Hashtable getTaskDefinitions() {
  +synchronized(taskClassDefinitions) {
  +synchronized (antTypeTable) {
  +if (rebuildTaskClassDefinitions) {
  +taskClassDefinitions.clear();
  +for (Iterator i = antTypeTable.keySet().iterator();
  + i.hasNext();)
  +{
  +String name = (String) i.next();
  +Class clazz =
  +(Class) antTypeTable.getExposedClass(name);
  +if (clazz == null) {
  +continue;
  +}
  +if (Task.class.isAssignableFrom(clazz)) {
  +taskClassDefinitions.put(
  +name, antTypeTable.getTypeClass(name));
  +}
  +}
  +rebuildTaskClassDefinitions = false;
  +}
  +}
  +}
   return taskClassDefinitions;
   }
   
  +
  +/**
  + * Returns the current type definition hashtable. The returned hashtable 
is
  + * "live" and so should not be modified.
  + *
  + * @return a map of from type name to implementing class
  + * (String to Class).
  + */
  +public Hashtable getDataTypeDefinitions() {
  +synchronized(typeClassDefinitions) {
  +synchronized (antTypeTable) {
  +if (rebuildTypeClassDefinitions) {
  +typeClassDefinitions.clear();
  +for (Iterator i = antTypeTable.keySet().iterator();
  + i.hasNext();)
  +{
  +String name = (String) i.next();
  +Class clazz =
  +(Class) antTypeTable.getExposedClass(name);
  +if (clazz == null) {
  +continue;
  +}
  +if (! Task.class.isAssignableFrom(clazz)) {
  +typeClassDefinitions.put(
  +name, antTypeTable.getTypeClass(name));
  +}
  +}
  +rebuildTypeClassDefinitions = false;
  +}
  +}
  +}
  +return typeClassDefinitions;
  +}
  +
   /**
*