Browse Source

getPropertys from new TaskContext method

git-svn-id: https://svn.apache.org/repos/asf/ant/core/trunk@271483 13f79535-47bb-0310-9956-ffa450edef68
master
Peter Donald 23 years ago
parent
commit
3844394878
4 changed files with 22 additions and 34 deletions
  1. +9
    -14
      proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/junit/JUnitTask.java
  2. +2
    -3
      proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/junit/JUnitTest.java
  3. +9
    -14
      proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/junit/JUnitTask.java
  4. +2
    -3
      proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/junit/JUnitTest.java

+ 9
- 14
proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/junit/JUnitTask.java View File

@@ -13,17 +13,15 @@ import java.io.IOException;
import java.net.URL;
import java.net.URLClassLoader;
import java.util.ArrayList;
import java.util.Enumeration;
import java.util.Hashtable;
import java.util.Iterator;
import java.util.Map;
import java.util.Properties;
import java.util.Random;
import org.apache.aut.nativelib.ExecManager;
import org.apache.myrmidon.api.AbstractTask;
import org.apache.myrmidon.api.TaskContext;
import org.apache.myrmidon.api.TaskException;
import org.apache.myrmidon.api.AbstractTask;
import org.apache.myrmidon.framework.Execute;
import org.apache.tools.ant.Task;
import org.apache.tools.ant.types.Argument;
import org.apache.tools.ant.types.Commandline;
import org.apache.tools.ant.types.CommandlineJava;
@@ -102,7 +100,7 @@ import org.apache.tools.ant.types.SysProperties;
* @see JUnitTest
* @see BatchTest
*/
public class JUnitTask extends Task
public class JUnitTask extends AbstractTask
{

private CommandlineJava commandline = new CommandlineJava();
@@ -555,7 +553,7 @@ public class JUnitTask extends Task
}
else
{
super.handleErrorOutput( line );
//super.handleErrorOutput( line );
}
}

@@ -572,7 +570,7 @@ public class JUnitTask extends Task
}
else
{
super.handleOutput( line );
//super.handleOutput( line );
}
}

@@ -582,9 +580,6 @@ public class JUnitTask extends Task
* killedProcess()</tt> method of the watchdog class.
*
* @param test the testcase to execute.
* @param watchdog the watchdog in charge of cancelling the test if it
* exceeds a certain amount of time. Can be <tt>null</tt> , in this
* case the test could probably hang forever.
*/
private int executeAsForked( JUnitTest test )
throws TaskException
@@ -622,11 +617,11 @@ public class JUnitTask extends Task
// Create a temporary file to pass the Ant properties to the forked test
File propsFile = new File( "junit" + ( new Random( System.currentTimeMillis() ) ).nextLong() + ".properties" );
cmd.addArgument( "propsfile=" + propsFile.getAbsolutePath() );
Hashtable p = getProject().getProperties();
Map p = getContext().getPropertys();
Properties props = new Properties();
for( Enumeration enum = p.keys(); enum.hasMoreElements(); )
for( Iterator enum = p.keySet().iterator(); enum.hasNext(); )
{
final Object key = enum.nextElement();
final Object key = enum.next();
props.put( key, p.get( key ) );
}
try
@@ -668,7 +663,7 @@ public class JUnitTask extends Task
private int executeInVM( JUnitTest test )
throws TaskException
{
test.setProperties( getProject().getProperties() );
test.setProperties( getContext().getPropertys() );
if( dir != null )
{
getLogger().warn( "dir attribute ignored if running in the same VM" );


+ 2
- 3
proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/junit/JUnitTest.java View File

@@ -8,10 +8,9 @@
package org.apache.tools.ant.taskdefs.optional.junit;

import java.util.ArrayList;
import java.util.Hashtable;
import java.util.Iterator;
import java.util.Map;
import java.util.Properties;
import org.apache.tools.ant.Project;
import org.apache.myrmidon.api.TaskContext;

/**
@@ -95,7 +94,7 @@ public class JUnitTest extends BaseTest
m_outfile = value;
}

public void setProperties( final Hashtable properties )
public void setProperties( final Map properties )
{
m_props = new Properties();
final Iterator enum = properties.keySet().iterator();


+ 9
- 14
proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/junit/JUnitTask.java View File

@@ -13,17 +13,15 @@ import java.io.IOException;
import java.net.URL;
import java.net.URLClassLoader;
import java.util.ArrayList;
import java.util.Enumeration;
import java.util.Hashtable;
import java.util.Iterator;
import java.util.Map;
import java.util.Properties;
import java.util.Random;
import org.apache.aut.nativelib.ExecManager;
import org.apache.myrmidon.api.AbstractTask;
import org.apache.myrmidon.api.TaskContext;
import org.apache.myrmidon.api.TaskException;
import org.apache.myrmidon.api.AbstractTask;
import org.apache.myrmidon.framework.Execute;
import org.apache.tools.ant.Task;
import org.apache.tools.ant.types.Argument;
import org.apache.tools.ant.types.Commandline;
import org.apache.tools.ant.types.CommandlineJava;
@@ -102,7 +100,7 @@ import org.apache.tools.ant.types.SysProperties;
* @see JUnitTest
* @see BatchTest
*/
public class JUnitTask extends Task
public class JUnitTask extends AbstractTask
{

private CommandlineJava commandline = new CommandlineJava();
@@ -555,7 +553,7 @@ public class JUnitTask extends Task
}
else
{
super.handleErrorOutput( line );
//super.handleErrorOutput( line );
}
}

@@ -572,7 +570,7 @@ public class JUnitTask extends Task
}
else
{
super.handleOutput( line );
//super.handleOutput( line );
}
}

@@ -582,9 +580,6 @@ public class JUnitTask extends Task
* killedProcess()</tt> method of the watchdog class.
*
* @param test the testcase to execute.
* @param watchdog the watchdog in charge of cancelling the test if it
* exceeds a certain amount of time. Can be <tt>null</tt> , in this
* case the test could probably hang forever.
*/
private int executeAsForked( JUnitTest test )
throws TaskException
@@ -622,11 +617,11 @@ public class JUnitTask extends Task
// Create a temporary file to pass the Ant properties to the forked test
File propsFile = new File( "junit" + ( new Random( System.currentTimeMillis() ) ).nextLong() + ".properties" );
cmd.addArgument( "propsfile=" + propsFile.getAbsolutePath() );
Hashtable p = getProject().getProperties();
Map p = getContext().getPropertys();
Properties props = new Properties();
for( Enumeration enum = p.keys(); enum.hasMoreElements(); )
for( Iterator enum = p.keySet().iterator(); enum.hasNext(); )
{
final Object key = enum.nextElement();
final Object key = enum.next();
props.put( key, p.get( key ) );
}
try
@@ -668,7 +663,7 @@ public class JUnitTask extends Task
private int executeInVM( JUnitTest test )
throws TaskException
{
test.setProperties( getProject().getProperties() );
test.setProperties( getContext().getPropertys() );
if( dir != null )
{
getLogger().warn( "dir attribute ignored if running in the same VM" );


+ 2
- 3
proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/junit/JUnitTest.java View File

@@ -8,10 +8,9 @@
package org.apache.tools.ant.taskdefs.optional.junit;

import java.util.ArrayList;
import java.util.Hashtable;
import java.util.Iterator;
import java.util.Map;
import java.util.Properties;
import org.apache.tools.ant.Project;
import org.apache.myrmidon.api.TaskContext;

/**
@@ -95,7 +94,7 @@ public class JUnitTest extends BaseTest
m_outfile = value;
}

public void setProperties( final Hashtable properties )
public void setProperties( final Map properties )
{
m_props = new Properties();
final Iterator enum = properties.keySet().iterator();


Loading…
Cancel
Save