Re: svn commit: r557062 - /ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/LoadProperties.java

2007-08-01 Thread Paul King

Peter Reilly wrote:

On 7/17/07, Matt Benson <[EMAIL PROTECTED]> wrote:

The refactoring is much bigger than the formatting
here, FYI... wanted to reassure you that I am taking
your comments to heart, Peter.

Cool!
I think perhaps we should push to remove all
checkstyle errors for ant1.8. At work, I have
implemented a zero checkstyle error policy -
with an checkconfig based on ant's (removing some
of the sillier checks) - this is run as part of CI and
reports are seen by the project manager.
(within a couple of weeks all checkstyle errors
disappeared!).


Yes, I am a fan of breaking the build if a checkstyle
violation is found. And then you make your IDE know about
the exact same set of checkstyle rules, so any breakage
won't come as a surprise.

Paul.


Peter


-Matt

--- [EMAIL PROTECTED] wrote:

> Author: mbenson
> Date: Tue Jul 17 14:35:26 2007
> New Revision: 557062
>
> URL:
> http://svn.apache.org/viewvc?view=rev&rev=557062
> Log:
> fmt/refac
>
> Modified:
>
>
ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/LoadProperties.java
>
> Modified:
>
ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/LoadProperties.java
> URL:
>
http://svn.apache.org/viewvc/ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/LoadProperties.java?view=diff&rev=557062&r1=557061&r2=557062 


>
== 


> ---
>
ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/LoadProperties.java
> (original)
> +++
>
ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/LoadProperties.java
> Tue Jul 17 14:35:26 2007
> @@ -76,8 +76,7 @@
>   * @param resource resource on classpath
>   */
>  public void setResource(String resource) {
> -assertSrcIsJavaResource();
> -((JavaResource) src).setName(resource);
> +
> getRequiredJavaResource().setName(resource);
>  }
>
>  /**
> @@ -100,8 +99,7 @@
>   * @param classpath to add to any existing
> classpath
>   */
>  public void setClasspath(Path classpath) {
> -assertSrcIsJavaResource();
> -((JavaResource)
> src).setClasspath(classpath);
> +
> getRequiredJavaResource().setClasspath(classpath);
>  }
>
>  /**
> @@ -109,8 +107,7 @@
>   * @return The classpath to be configured
>   */
>  public Path createClasspath() {
> -assertSrcIsJavaResource();
> -return ((JavaResource)
> src).createClasspath();
> +return
> getRequiredJavaResource().createClasspath();
>  }
>
>  /**
> @@ -119,8 +116,7 @@
>   * @param r The reference value
>   */
>  public void setClasspathRef(Reference r) {
> -assertSrcIsJavaResource();
> -((JavaResource) src).setClasspathRef(r);
> +
> getRequiredJavaResource().setClasspathRef(r);
>  }
>
>  /**
> @@ -128,8 +124,7 @@
>   * @return The classpath
>   */
>  public Path getClasspath() {
> -assertSrcIsJavaResource();
> -return ((JavaResource) src).getClasspath();
> +return
> getRequiredJavaResource().getClasspath();
>  }
>
>  /**
> @@ -150,7 +145,6 @@
>  }
>  throw new BuildException("Source
> resource does not exist: " + src);
>  }
> -
>  BufferedInputStream bis = null;
>  Reader instream = null;
>  ByteArrayInputStream tis = null;
> @@ -162,7 +156,6 @@
>  } else {
>  instream = new
> InputStreamReader(bis, encoding);
>  }
> -
>  ChainReaderHelper crh = new
> ChainReaderHelper();
>  crh.setPrimaryReader(instream);
>  crh.setFilterChains(filterChains);
> @@ -175,7 +168,6 @@
>  if (!text.endsWith("\n")) {
>  text = text + "\n";
>  }
> -
>  if (encoding == null) {
>  tis = new
> ByteArrayInputStream(text.getBytes());
>  } else {
> @@ -188,10 +180,8 @@
>  propertyTask.bindToOwner(this);
>  propertyTask.addProperties(props);
>  }
> -
>  } catch (final IOException ioe) {
> -final String message = "Unable to load
> file: " + ioe.toString();
> -throw new BuildException(message, ioe,
> getLocation());
> +throw new BuildException("Unable to
> load file: " + ioe, ioe, getLocation());
>  } finally {
>  FileUtils.close(bis);
>  FileUtils.close(tis);
> @@ -211,23 +201,24 @@
>   * @param a the resource to load as a single
> element Resource collection.
>   * @since Ant 1.7
>   */
> -public void addConfigured(ResourceCollection a)
> {
> +public synchronized void
> addConfigured(ResourceCollection a) {
>  if (src != null) {
>  throw new BuildException("only a single
> source is supported");
>  }
>  if (a.size() != 1) {
> -throw new BuildException("only single
> argument resource collections"
> -  

Re: Functional testing with AntUnit

2007-08-01 Thread Paul King

Chris Connelly wrote:

Hello,

I apologize in advance if this is the wrong forum for this question. 


My organization is looking to replace some home-grown, in-house test automation 
tools with open source tools where possible. I've prototyped some solutions 
using Ant and AntUnit, and was impressed by how easy it was to replace custom 
tools with Ant tasks; display results through CruiseControl; and integrate 
tests and results into our existing test management systems (also home grown). 
I think Ant and AntUnit could provide the basis for an incremental path for 
migrating off our custom tools.

My questions: the AntUnit home page says: "AntUnit could also be used for 
functional and integration tests
  outside of the scope of Ant tasks ...  This is an area that will need more 
research." Is anyone currently looking into this, and is this still considered 
a reasonable use of AntUnit? We do a lot of different types of testing -- from 
drivers and distros to middleware integration -- and I'm interested in any opinions 
on this possibility.

Thanks in advance,
Chris Connelly
 


You might want to consider WebTest (http://webtest.canoo.com).
I have about 10 customers using it quite happily. It is ant extensions
just like AntUnit. 5 of those customers now use it almost exclusively
with Groovy. 2 arbitrarily mix AntUnit and WebTest (via Groovy).

Cheers, Paul.

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



Target.getTasks returns UnknownElement

2007-08-01 Thread James Mao

Hi,

Sorry, if you receive this twice, i sent it to the user list as well.


I'm trying to parse the build.xml myself, and tried to get the tasks 
object with the following code


 File buildFile = new File("c:/myproject/build.xml");

 Project project = new Project();
 project.init();
 project.setUserProperty( "ant.file" , buildFile.getAbsolutePath());
 project.addBuildListener(new DefaultLogger());
 ProjectHelper.configureProject(project, buildFile);

 Target target = (Target) project.getTargets().get("echome");
 Task[] tasks = target.getTasks();
 System.out.println(((Echo)tasks[0]));   <<< Failure point


The build.xml is



   




How can i get an instance of Echo , instead of UnknownElement 
?


I'm running the above code inside a junit test

ant 1.7.0, junit4, jdk1.6


Thanks in advance!
James

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



DO NOT REPLY [Bug 39122] - uptodate treats an outdated target as up to date

2007-08-01 Thread bugzilla
DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUGĀ·
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED ANDĀ·
INSERTED IN THE BUG DATABASE.

http://issues.apache.org/bugzilla/show_bug.cgi?id=39122





--- Additional Comments From [EMAIL PROTECTED]  2007-08-01 02:00 ---
Hi, I've got similar problems.
>From what I've gathered when finding a work-around,
the problem is maybe in the nested  element.

Consider the following setup on the filesystem:

.
\-${jspsrc}
   \- index.jsp (modified 2007-08-01 09:00)
   \- ... (other .jsp pages)
\-${jspdest}  (Inside exploded war, modified 2007-08-01 09:00)

The following build.xml-snippet does NOT set the jspc.uptodate prop:




The following build.xml-snippet DOES set the jspc.uptodate prop:






This behaviour IMHO is a bit unconsistent.
Platform details: 
- Apache Ant version 1.7.0 compiled on December 13 2006
- Windows XP
- Java 142_08


-- 
Configure bugmail: http://issues.apache.org/bugzilla/userprefs.cgi?tab=email
--- You are receiving this mail because: ---
You are the assignee for the bug, or are watching the assignee.

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



[EMAIL PROTECTED]: Project svn-antlib-test (in module ant-antlibs) failed

2007-08-01 Thread Gump Integration Build
To whom it may engage...

This is an automated request, but not an unsolicited one. For 
more information please visit http://gump.apache.org/nagged.html, 
and/or contact the folk at [EMAIL PROTECTED]

Project svn-antlib-test has an issue affecting its community integration.
This issue affects 1 projects,
 and has been outstanding for 56 runs.
The current state of this project is 'Failed', with reason 'Build Failed'.
For reference only, the following projects are affected by this:
- svn-antlib-test :  Task and Type Libraries for Apache Ant


Full details are available at:
http://vmgump.apache.org/gump/public/ant-antlibs/svn-antlib-test/index.html

That said, some information snippets are provided here.

The following annotations (debug/informational/warning/error messages) were 
provided:
 -DEBUG- Dependency on ant-testutil exists, no need to add for property 
ant-testutil.jar.
 -INFO- Failed with reason build failed



The following work was performed:
http://vmgump.apache.org/gump/public/ant-antlibs/svn-antlib-test/gump_work/build_ant-antlibs_svn-antlib-test.html
Work Name: build_ant-antlibs_svn-antlib-test (Type: Build)
Work ended in a state of : Failed
Elapsed: 1 min 12 secs
Command Line: /usr/lib/jvm/java-1.5.0-sun/bin/java -Djava.awt.headless=true 
-Xbootclasspath/p:/srv/gump/public/workspace/xml-xerces2/build/xercesImpl.jar:/srv/gump/public/workspace/xml-commons/java/external/build/xml-apis.jar
 org.apache.tools.ant.Main -Dgump.merge=/srv/gump/public/gump/work/merge.xml 
-Dbuild.sysclasspath=only 
-Dant-testutil.jar=/srv/gump/public/workspace/ant/build/lib/ant-testutil.jar 
test 
[Working Directory: /srv/gump/public/workspace/ant-antlibs/svn]
CLASSPATH: 
/usr/lib/jvm/java-1.5.0-sun/lib/tools.jar:/srv/gump/public/workspace/ant-antlibs/svn/build/test-classes:/srv/gump/public/workspace/ant/dist/lib/ant-jmf.jar:/srv/gump/public/workspace/ant/dist/lib/ant-swing.jar:/srv/gump/public/workspace/ant/dist/lib/ant-apache-resolver.jar:/srv/gump/public/workspace/ant/dist/lib/ant-trax.jar:/srv/gump/public/workspace/ant/dist/lib/ant-junit.jar:/srv/gump/public/workspace/ant/dist/lib/ant-launcher.jar:/srv/gump/public/workspace/ant/dist/lib/ant-nodeps.jar:/srv/gump/public/workspace/ant/dist/lib/ant.jar:/srv/gump/public/workspace/ant/build/lib/ant-testutil.jar:/srv/gump/public/workspace/junit/dist/junit-01082007.jar:/srv/gump/public/workspace/ant-antlibs/svn/build/ant-svn-01082007.jar:/srv/gump/public/workspace/xml-commons/java/external/build/xml-apis-ext.jar
-
[junit] at junit.framework.TestSuite.run(TestSuite.java:227)
[junit] at 
org.junit.internal.runners.JUnit38ClassRunner.run(JUnit38ClassRunner.java:81)
[junit] at 
junit.framework.JUnit4TestAdapter.run(JUnit4TestAdapter.java:36)
[junit] at 
org.apache.tools.ant.taskdefs.optional.junit.JUnitTestRunner.run(JUnitTestRunner.java:421)
[junit] at 
org.apache.tools.ant.taskdefs.optional.junit.JUnitTestRunner.launch(JUnitTestRunner.java:912)
[junit] at 
org.apache.tools.ant.taskdefs.optional.junit.JUnitTestRunner.main(JUnitTestRunner.java:743)
[junit] 
[junit] Testcase: testDiffWithImplicitTrunk took 17.7 sec
[junit] FAILED
[junit] null
[junit] junit.framework.AssertionFailedError: null
[junit] at junit.framework.Assert.fail(Assert.java:47)
[junit] at junit.framework.Assert.assertTrue(Assert.java:20)
[junit] at junit.framework.Assert.assertTrue(Assert.java:27)
[junit] at 
org.apache.ant.svn.SvnTagDiffTest.assertModified(SvnTagDiffTest.java:110)
[junit] at 
org.apache.ant.svn.SvnTagDiffTest.assertDiffWithTrunk(SvnTagDiffTest.java:63)
[junit] at 
org.apache.ant.svn.SvnTagDiffTest.testDiffWithImplicitTrunk(SvnTagDiffTest.java:57)
[junit] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
[junit] at 
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
[junit] at 
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
[junit] at java.lang.reflect.Method.invoke(Method.java:585)
[junit] at junit.framework.TestCase.runTest(TestCase.java:168)
[junit] at junit.framework.TestCase.runBare(TestCase.java:134)
[junit] at junit.framework.TestResult$1.protect(TestResult.java:110)
[junit] at junit.framework.TestResult.runProtected(TestResult.java:128)
[junit] at junit.framework.TestResult.run(TestResult.java:113)
[junit] at junit.framework.TestCase.run(TestCase.java:124)
[junit] at junit.framework.TestSuite.runTest(TestSuite.java:232)
[junit] at junit.framework.TestSuite.run(TestSuite.java:227)
[junit] at 
org.junit.internal.runners.JUnit38ClassRunner.run(JUnit38ClassRunner.java:81)
[junit] at 
junit.framework.JUnit4TestAdapter.run(JUnit4TestAdapter.java:36)
[junit] at 
org.apache.tools.ant.taskdefs.optional.junit.JUnitTestRu

[EMAIL PROTECTED]: Project dotnet-antlib-test (in module ant-antlibs) failed

2007-08-01 Thread Gump Integration Build
To whom it may engage...

This is an automated request, but not an unsolicited one. For 
more information please visit http://gump.apache.org/nagged.html, 
and/or contact the folk at [EMAIL PROTECTED]

Project dotnet-antlib-test has an issue affecting its community integration.
This issue affects 1 projects,
 and has been outstanding for 56 runs.
The current state of this project is 'Failed', with reason 'Build Failed'.
For reference only, the following projects are affected by this:
- dotnet-antlib-test :  Task and Type Libraries for Apache Ant


Full details are available at:

http://vmgump.apache.org/gump/public/ant-antlibs/dotnet-antlib-test/index.html

That said, some information snippets are provided here.

The following annotations (debug/informational/warning/error messages) were 
provided:
 -INFO- Failed with reason build failed



The following work was performed:
http://vmgump.apache.org/gump/public/ant-antlibs/dotnet-antlib-test/gump_work/build_ant-antlibs_dotnet-antlib-test.html
Work Name: build_ant-antlibs_dotnet-antlib-test (Type: Build)
Work ended in a state of : Failed
Elapsed: 15 secs
Command Line: /usr/lib/jvm/java-1.5.0-sun/bin/java -Djava.awt.headless=true 
-Xbootclasspath/p:/srv/gump/public/workspace/xml-xerces2/build/xercesImpl.jar:/srv/gump/public/workspace/xml-commons/java/external/build/xml-apis.jar
 org.apache.tools.ant.Main -Dgump.merge=/srv/gump/public/gump/work/merge.xml 
-Dbuild.sysclasspath=only 
-Dant-testutil.jar=/srv/gump/public/workspace/ant/build/lib/ant-testutil.jar 
test 
[Working Directory: /srv/gump/public/workspace/ant-antlibs/dotnet]
CLASSPATH: 
/usr/lib/jvm/java-1.5.0-sun/lib/tools.jar:/srv/gump/public/workspace/ant-antlibs/dotnet/build/test-classes:/srv/gump/public/workspace/ant/dist/lib/ant-jmf.jar:/srv/gump/public/workspace/ant/dist/lib/ant-swing.jar:/srv/gump/public/workspace/ant/dist/lib/ant-apache-resolver.jar:/srv/gump/public/workspace/ant/dist/lib/ant-trax.jar:/srv/gump/public/workspace/ant/dist/lib/ant-junit.jar:/srv/gump/public/workspace/ant/dist/lib/ant-launcher.jar:/srv/gump/public/workspace/ant/dist/lib/ant-nodeps.jar:/srv/gump/public/workspace/ant/dist/lib/ant.jar:/srv/gump/public/workspace/ant-antlibs/antunit/build/ant-antunit-01082007.jar:/srv/gump/public/workspace/ant-antlibs/dotnet/build/ant-dotnet-01082007.jar:/srv/gump/public/workspace/xml-commons/java/external/build/xml-apis-ext.jar
-
[au:antunit] Tests run: 1, Failures: 0, Errors: 0, Time elapsed: 0.029 sec
[au:antunit] Target: test-passing took 0 sec
[au:antunit] Build File: 
/srv/gump/public/workspace/ant-antlibs/dotnet/src/tests/antunit/dir with 
spaces/wsdl-test.xml
[au:antunit] Tests run: 1, Failures: 0, Errors: 0, Time elapsed: 0.759 sec
[au:antunit] Target: testWSDL took 0.731 sec
[au:antunit] Build File: 
/srv/gump/public/workspace/ant-antlibs/dotnet/src/tests/antunit/dotnetexec-test.xml
[au:antunit] Tests run: 1, Failures: 0, Errors: 0, Time elapsed: 0.661 sec
[au:antunit] Target: testCSC took 0.609 sec
[au:antunit] Build File: 
/srv/gump/public/workspace/ant-antlibs/dotnet/src/tests/antunit/nunit/nunit-test.xml
[au:antunit] Tests run: 5, Failures: 0, Errors: 0, Time elapsed: 0.201 sec
[au:antunit] Target: test-passing took 0 sec
[au:antunit] Target: test-failing took 0 sec
[au:antunit] Target: test-failing-errorproperty took 0.069 sec
[au:antunit] Target: test-failing-with-fail took 0 sec
[au:antunit] Target: test-no-assembly took 0.009 sec
[au:antunit] Build File: 
/srv/gump/public/workspace/ant-antlibs/dotnet/src/tests/antunit/old-core-test.xml
[au:antunit] Tests run: 9, Failures: 0, Errors: 0, Time elapsed: 4.704 sec
[au:antunit] Target: testCSCintrinsicFileset took 0 sec
[au:antunit] Target: testCSCresponseFile took 0.534 sec
[au:antunit] Target: testILASM took 0.001 sec
[au:antunit] Target: testCSCdll took 0 sec
[au:antunit] Target: testILDASM took 0 sec
[au:antunit] Target: testILDASM_empty took 0.013 sec
[au:antunit] Target: testJsharp took 0 sec
[au:antunit] Target: testCSCResources took 0.001 sec
[au:antunit] Target: testCSC took 0.001 sec
[au:antunit] Build File: 
/srv/gump/public/workspace/ant-antlibs/dotnet/src/tests/antunit/wsdl2dotnet-test.xml
[au:antunit] Tests run: 15, Failures: 0, Errors: 0, Time elapsed: 3.316 sec
[au:antunit] Target: testSchemaMustBeSet took 0.008 sec
[au:antunit] Target: testLocalWsdlVB took 0.004 sec
[au:antunit] Target: testInvalidExtraOps took 0.002 sec
[au:antunit] Target: testSrcIsMissing took 0.006 sec
[au:antunit] Target: testNoParams took 0.002 sec
[au:antunit] Target: testBothSrc took 0.005 sec
[au:antunit] Target: testSchemaFileMustHaveOneOptionOnly took 0.019 sec
[au:antunit] Target: testLocalWsdl took 1.195 sec
[au:antunit] Target: testSrcIsDir took 0.017 sec
[au:antunit] Target: testLocalWsdlServerVB took 0 sec
[au:antunit] Target: testLocalWsdlServer took 1.322 sec
[au:antunit] Target: testNoSrc took 0.014 sec
[au:antunit] Target: testSchemaFileMustExist took 0.005 sec
[au