Menu

Code contributions from James Henderson

Sujit Pal
2005-06-02
2013-04-25
  • Sujit Pal

    Sujit Pal - 2005-06-02

    James Henderson (ffoozle) has contributed the following code to SQLUnit.
    1) A suite of tests for MS SQL Server that he uses to regression test each release of SQLUnit, to verify that the functionality he uses is not broken.
    2) He uses the Canoo reporter, and he has developed a nifty set of tools that convert the Canoo XML output to HTML that is now viewable from a browser.

    Details follow:
    James's original email:
    ---------------------------
    >On Wed, 2005-05-25 at 11:22, James Henderson wrote:
    Hi Sujit,
    As I have been developing tests with SQLUnit, I have
    developed some utilities that I have found useful.  On the behalf of the company that I work for, I would like to offer the SQLUnit project the utilities that I have developed.
    The utilties are as follows:
    1. Test Directory Generatory Utility
    This is a Java application that when provided with a
    directory with SQLUnit XML files, will generate XHTML files using XSLT to provide an index and listing of all tests within each XML file.  The caveat is that you must use the specified naming convention (described within the nominal documentation that will be supplied).
    Since I have over 1600 tests, I use this utility to
    determine if a have a test case or a specific test within a test case. This utility could use some work, and with some modification to the SQLUnit DTD, I think that it would work quite nicely.
    2. Test Results Transaformation
    I have developed an XSLT that will transform the
    TestResults.xml into TestResults.html.  It makes the results easier to read. I have used this since I started using SQLUnit.  However, to integrate it with executing tests, modifications to the ant build.xml are required.  (The modificatiosn will be sent in addition to the XSLT.)
    3. MS SQL Server Tests
    In working with you on several issues, I have developed my own suite of tests that work against MS SQL Server 2000 to validate the fixes for the issues that I have reported

    There are some limitations to these utilities.  Like
    SQLUnit, the utilities are not perfect and come with no
    guarantees.

    Please let me know if you are interested in these utilities.

    -jh

    My reply:
    >Sent: Friday, May 27, 2005 3:05 PM
    Hi James,

    The tools and tests sound very useful and thanks very much for the offer. If you send them to me, I would be happy to add them in to SQLUnit. What I may do is change the package names around a bit to make it fit into the existing sqlunit package structure. The tests will obviously go under tests/mssql2000 or something similar.

    Thanks again,
    -sujit

    James's reply accompanied with the zip file with the code:
    > On Tue, 2005-05-31 at 08:53, James Henderson wrote (somewhat edited):
    Not a problem at all.
    Attached to this e-mail is a .ZIP file.  If you can't read
    .ZIP files, I will send the files to you as individual
    attachments.
    Some notes:
    1. The 00Readme1st.txt file explains the mods to be made to the build.xml in order for the Test Results Transformation to  with as part of a test run
    \2. The MS SQL Server tests that I have developed use a username/password of "sqlunit"/"sqlunit".
    3. You will need to compiler the Test Directory Generator application. (Located in the output/sqlunit directory.)
    Compile from a command prompt within the output directory:
    P:\sqlunit-4.7\output>javac sqlunit/TestDirectoryGenerator.java
    Take a look at the small documentation file (TestDirectoryGenerator.txt)
    in output/sqlunit for what it expects for naming conventions. 

    (Which reminds me: Could add some improvements to this application  if we had optional id and description attributes for the <test> tag; We could do away with the naming coventions that this utility  uses!)

    -jh

    And, finally, here is my reply to James regarding where his things will go into SQLUnit:
    Hi James,

    I am going to separate out your files to accomodate the SQLUnit structure.
    1) the (.sql, .xml) tests will go to test/mssqlserver. I have added a README file that includes part of what you wrote in 00Readme.txt.
    2) the TestDirectoryGenerator.java will go to src/net/sourceforge/sqlunit/tools/Canoo2HtmlGenerator.java and the two .xsl files will go to etc/canoo2html_dir_transform.xsl and etc/canoo2html_result_transform.xsl. I have reformatted the code to make it in line with the rest of SQLUnit java code (it /is/ my coding style, but its fairly common, and most of the default checkstyle configuration works with it :-)).
    3) I notice that you have to do an ant clean-output, then build the output directory, then run TestDirectoryGenerator to create the frame and the test listing htmls. Then you run sqlunit-nested or sqlunit-flat to output the canoo xml output to the output directory, and then this target also runs an xslt target to convert the test xml to html.
       What I will do is create a separate target "canoo2html" perhaps which will run the Canoo2HtmlGenerator class with the canoo2html_dir_transform.xsl and then run the xslt target. Your scripts could call two targets in future instead of having to bake in the calls into build.xml each time sqlunit is released.
    4) I will add optional description and identifier (not id) attributes for the test tag which will never be called by the code but which could be used by the next iteration of your tool.

    Please let me know if you see any obvious problems with this. I am going to put this information on the forum also so its visible to others and they know whats coming down the pipe in the next release.

    Thanks
    Sujit

    BTW, I am targeting the next release to contain all these changes.

     
    • Sujit Pal

      Sujit Pal - 2005-06-07

      Hi James,

      You were right, I realize now that the test directory generator needs to be run only once...

      I have checked in all the code. There are two new targets in the build.xml "test-doc" and canoo2html. I have updated the sqlunit-book.xml with two new sections, one each for the tools, using mostly the text you provided and the ant calls.

      I did check all of it in, but I forgot to save the commit logs, sorry about that. Basically you should see the following file:
      src/net/sourceforge/net/tools/TestDocGenerator.java

      this is the test directory generator. If you see this, you can be sure that the other changes made it in too, and just do a cvs update -dAP to get everything.

      -sujit

       
    • James Henderson

      James Henderson - 2005-06-16

      Hi Sujit,

      I hope that your vacation was pleasant.

      Here are some notes/issues that I encountered when I examined the latest code that I pulled from CVS.

      1. Missing docs/book1.html.  Is this file generated via an XSL?  If so, you could attached it as the stylesheet to the sqlunit-book.xml

      2. ${output.file} property has empty string for a value (i.e., "")  Was this intentional?

      3. Once a value is specified for ${output.file}, file is generated within root directory of sqlunit installation.  Shouldn't the output be placed within ${output.dir}?  It would seem logical.

      4. A crash occurs When I set the value of for ${log.format} to "canoo" and specify a value for ${output.file} with a .xml file extension, when executing the "sqlunit-nested" target in ant (it appears to be within ant). If a value for ${output.file} is specified without a .xml file extension the results are generated without an error (as an XML file).

      For example:

        Offending command:
        ant sqlunit-nested -Dlog.format="canoo" -Doutput.file="TestResults.xml" -Dtestdir="mssqlserver" canoo2html

        Successful command
        ant sqlunit-nested  -Dlog.format="canoo" -Doutput.file="TestResults" -Dtestdir="mssqlserver" canoo2html

        Results in the following files in the root directory:
        * TestResults (XML file with no.xml extension)
        * TestResults.html (XHTML file)

      5. When executing a single file, there is no problem with respect to the XML extension for the output file name.  However, the resulting XHTML file has a ".xml.html" file extension.  Perhaps the user should specify ${output.filename} and ${output.fileext} properties?

      6. You removed the clean-output target.  I created that target so that if the ${output.file} exists, it will be deleted before the test run begins.  This way if you execute a test suite, and then you re-execute another test suite, the output from the previous test run is blown away.    It is up to the user to preserve the results of the previous run.  Currently, if you run two test cases/suites back-to-back, the results of the second run get appended to the end of the results of the first run (if you use the same file name).

      7. The documentation for the TestDocsGenerator currently indicates the command line as:

        ant test-doc [-Doutput.dir=/path/to/output/directory]

      It should indicate the command line as

        ant test-doc [-Doutput.dir=/path/to/output/directory] [-Dtest.dir=/path/to/tests/directory]

      The format currently listed in the documentation will give you everything under the test directory.

       
    • Sujit Pal

      Sujit Pal - 2005-07-08

      Hi James,

      Thanks, it was quite pleasant, although the weather could have been a little less warm... :-). Thanks for catching these, I am answering your issues above using the same numbering scheme you used.

      1. book1.html is generated using docbook. The source is sqlunit-book.xml. I believe it does use stylesheets, but they are supplied with docbook, and the resulting HTML file contains the styles inlined in them. To generate it locally, you will need to install docbook. I have so far installed docbook on two machines (my current laptop and the one before that), but I have not had a smooth install either time, I always had to go in and make links and such...

      2. Yes it is intentional. I typically run my tests onto the console, either tee-ing to a file or scrolling up if I want to see something that went across too fast for me. Since output.file is defined as the logfile attribute for sqlunit-flat and test targets, specifying an empty value allows me to do this, otherwise it will go into a file.

      The reason I chose output.file to be the variable for sqlunit-flat@logfile and canoo2html/xslt@in attributes is that these targets can then be chained, like this:
      ant -Doutput.file=foo -Dlog.format=canoo sqlunit-flat canoo2html

      3. Placing the html output into the output.dir would definitely be more convenient, I missed that. So what we should probably do is to check for the existence of output.dir, if not available mkdir it, then specify the xslt target thus, changing the out attribute value.
      <xslt in="${output.file}"
      ..out="${output.dir}/${output.file}.html"
      ..style="${etc.dir}/canoo2html_result_transform.xsl" />
      and at the end, deleting the output.file. Can you think of anything else we can do here?

      4. I ran the command you specified against the mock database, and I got back 2 of these in both cases, with output.file with and without the .xml suffix.
        [sqlunit] sqlunit-ant: System error (java.lang.ClassCastException): null
        [sqlunit] sqlunit-ant: System error (java.lang.ClassCastException): null
      Is this what you are seeing? I need to look at these and figure out which test they are coming from, will update this thread with more info when I have it.

      5. I could make the .xml be hardcoded for the xslt input file name and the .html for the output file name. In that case only the output file (minus the suffix) needs to be specified. We should probably change the variable name to make it more intuitive then.

      6. Deleting the output.file before executing the xslt target (described in 3) should take care of the use case you described, right? I am open to putting the clean-output target back in, just not sure that its necessary. I guess it could exist as a convenience target though.

      7. Thanks for pointing that out, I have updated the sqlunit-book.xml and committed to CVS.
      Checking in docs/sqlunit-book.xml;
      /cvsroot/sqlunit/sqlunit/docs/sqlunit-book.xml,v  <--  sqlunit-book.xml
      new revision: 1.99; previous revision: 1.98
      done

      Let me know what you think and we can address the remaining issues from there.

      -sujit

       
    • James Henderson

      James Henderson - 2005-07-11

      Hi Sujit,

      I am responding to your responses in order.

      1. OK.  Given your description of the docbook installation, I have elected to not install it at this time.  :-)

      2. OK, it is intentional to allow target chaining. (But see #3)

      3. If we place the HTML output into the output directory, does it also make sense to place the XML output in this directory?  This would group all output files into one directory.

      In understand that this would make target chaining more verbose (since you would also need to specify the output directory, rather than just the output file).

      4. I have tried repeat this error, but am unable to do so.  I apologize.  It currently passes on my system, so I am unable to confirm the problem that I was having was caused by a ClassCastException.

      5.  Hardcoding the suffix for XSLT input and HTML output , so that you only need to specify the output file name (sans suffix) sounds good.  I also agree that we should chang ethe variable name in that case, but to what? ${output.file.sans.suffix}?  Sounds a little wordy.  Perhaps we could not it within the documentation for SQLUnit?  Thoughts on that?

      6.Yes, deleting the output file(s) before executing the XSLT target should take care of the use case.  I don't care how it is done.

      Essentially, I don't want the results appended to the end of an existing file with the same name.  Each time SQLUnit is run, the result file(s) should only contain the results for the most recent rest run.

      7.  I pulled sqlunit-book.xml v1.99 from CVS and everything looks good.

      I did notice, however, that the XML file does not appear to be valid.  Given the following XML snippet from sqlunit-book.xml:

              <section>
                  <title>List of currently supported tags</title>
                  <para>The XML Tags that make up a SQLUnit test specification are described below.</para>
      &tag-top;
      &tags;
          </section>

      The text

      &tag-top;
      &tags;

      is is being flagged as invalid.

      -jh

       
    • Sujit Pal

      Sujit Pal - 2005-07-13

      Hi James,

      Thanks for the reply and sorry about the delay in responding. I will look at these on my way home tonight, hopefully tomorrow I should have these changes in CVS.

      -sujit

       
    • Sujit Pal

      Sujit Pal - 2005-07-16

      Hi James,

      Sorry about the delay, but I think I got all of it.

      3. I did not place the intermediate file in the output directory, but I ensure that it gets deleted after the canoo2html target.

      4. The error I got was related to a problem with one of the new handlers, thats fixed.

      5. I discovered the ant target basename, which strips the directory portion of a file name, and can also optionally strip the suffix. Used that, so things work now.

      6.Added a delete for the test-doc target to ensure that files are deleted.

      Fixes are here:
      Checking in build.xml;
      /cvsroot/sqlunit/sqlunit/build.xml,v  <--  build.xml
      new revision: 1.110; previous revision: 1.109
      done
      Checking in src/net/sourceforge/sqlunit/matchers/ForgivingNullMatcher.java;
      /cvsroot/sqlunit/sqlunit/src/net/sourceforge/sqlunit/matchers/ForgivingNullMatcher.java,v  <--  ForgivingNullMatcher.java
      new revision: 1.2; previous revision: 1.1
      done

      Please let me know if you find any problems.

      -sujit

       
    • James Henderson

      James Henderson - 2005-07-21

      Hi Sujit,

      I pulled the SQLUnit 4.9 Release and re-tested.

      I am having some difficulty executing when I specify canoo as the log.format.

      For example, if I issue the command:
      ant sqlunit-nested -Dtestdir="mssqlserver" -Doutput.file="Testresults.xml"

      Then the MS SQL Server tests execute and a TestResults.xml file is created within the sqlunit installation directory.

      However, if I issue the command:
      ant sqlunit-nested -Dtestdir="mssqlserver" -Doutput.file="Testresults.xml" -Dlog.format="canoo"

      Then I recieve the following error:

      java.lang.NullPointerException
              at org.apache.tools.ant.Project.fireMessageLoggedEvent(Project.java:1890
      )
              at org.apache.tools.ant.Project.fireMessageLogged(Project.java:1956)
              at org.apache.tools.ant.Project.log(Project.java:396)
              at org.apache.tools.ant.Task.log(Task.java:347)
              at net.sourceforge.sqlunit.ant.SqlunitTask.execute(SqlunitTask.java:137)

              at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:269)
              at org.apache.tools.ant.Task.perform(Task.java:364)
              at org.apache.tools.ant.Target.execute(Target.java:301)
              at org.apache.tools.ant.Target.performTasks(Target.java:328)
              at org.apache.tools.ant.Project.executeTarget(Project.java:1215)
              at org.apache.tools.ant.Project.executeTargets(Project.java:1063)
              at org.apache.tools.ant.Main.runBuild(Main.java:632)
              at org.apache.tools.ant.Main.startAnt(Main.java:183)
              at org.apache.tools.ant.launch.Launcher.run(Launcher.java:197)
              at org.apache.tools.ant.launch.Launcher.main(Launcher.java:56)

      The same thing will occur if I modify the log.file property within build.xml.

      Replies to your previous responses:

      3. I'm confused.  Are you saying that you are deleting the results file represented by the ${output.file} property?   (This is what the build.xml appears to be doing in 4.9.)   If so, that's not what I was suggesting. 

      What I was suggesting is that the results (${output.file}) and the XHTML file generated by canoo2html be overwritten if a file of the same name exists.  Keeping the ${output.file} after the canoo2html transform is still useful, and I do not want it deleted.

      4. OK

      5. I can't confirm this modification works because of the error I just reported, but I can see the change.

      6.  Refer to my response to 3.  I think I misunderstood what you were proposing, and I apologize for that misunderstanding.

       
    • Sujit Pal

      Sujit Pal - 2005-07-26

      Hi James,

      I just checked in a fix to the SqlUnitTask.java file which sets the error stream to the declared logfile as well. That is probably what the stack trace is trying to say is that there is no error stream defined when it tries to write the error message. Can you post the results using the changed task with the above test case?

      Also, I moved the output XML file from the canoo reporter to the output.dir instead of deleting it, the build.xml checked in contains these changes. I think this is the expected behavior?

      Here is the commit log:
      Checking in build.xml;
      /cvsroot/sqlunit/sqlunit/build.xml,v  <--  build.xml
      new revision: 1.112; previous revision: 1.111
      done
      Checking in src/net/sourceforge/sqlunit/ant/SqlunitTask.java;
      /cvsroot/sqlunit/sqlunit/src/net/sourceforge/sqlunit/ant/SqlunitTask.java,v  <--  SqlunitTask.java
      new revision: 1.7; previous revision: 1.6
      done

      Thanks
      -sujit

       
    • James Henderson

      James Henderson - 2005-07-27

      Hi Sujit,

      I am unable to re-build SQLUnit, since the following file is not available within the project:

      net.sourceforge.sqlunit.reporters.ReporterList

      Without this file, I am unable to compile.

      -jh

       
    • Sujit Pal

      Sujit Pal - 2005-07-28

      Hi James,

      Sorry about that, I started folding in Ivan's changes, but neglected to commit them, relying instead on trying to comment out the stuff I added. So now I am adding all the ones that I have folded in, there are others, but it should work without any problems. Let me know if you have problems.

      Here is the commit log:
      Checking in etc/reporters.properties;
      /cvsroot/sqlunit/sqlunit/etc/reporters.properties,v  <--  reporters.properties
      new revision: 1.2; previous revision: 1.1
      done
      RCS file: /cvsroot/sqlunit/sqlunit/src/net/sourceforge/sqlunit/ant/ReporterElement.java,v
      done
      Checking in src/net/sourceforge/sqlunit/ant/ReporterElement.java;
      /cvsroot/sqlunit/sqlunit/src/net/sourceforge/sqlunit/ant/ReporterElement.java,v  <--  ReporterElement.java
      initial revision: 1.1
      done
      Checking in src/net/sourceforge/sqlunit/ant/SqlunitTask.java;
      /cvsroot/sqlunit/sqlunit/src/net/sourceforge/sqlunit/ant/SqlunitTask.java,v  <--  SqlunitTask.java
      new revision: 1.8; previous revision: 1.7
      done
      RCS file: /cvsroot/sqlunit/sqlunit/src/net/sourceforge/sqlunit/ant/SyspropertyElement.java,v
      done
      Checking in src/net/sourceforge/sqlunit/ant/SyspropertyElement.java;
      /cvsroot/sqlunit/sqlunit/src/net/sourceforge/sqlunit/ant/SyspropertyElement.java,v  <--  SyspropertyElement.java
      initial revision: 1.1
      done
      RCS file: /cvsroot/sqlunit/sqlunit/src/net/sourceforge/sqlunit/reporters/EmptyReporter.java,v
      done
      Checking in src/net/sourceforge/sqlunit/reporters/EmptyReporter.java;
      /cvsroot/sqlunit/sqlunit/src/net/sourceforge/sqlunit/reporters/EmptyReporter.java,v  <--  EmptyReporter.java
      initial revision: 1.1
      done
      RCS file: /cvsroot/sqlunit/sqlunit/src/net/sourceforge/sqlunit/reporters/ReporterList.java,v
      done
      Checking in src/net/sourceforge/sqlunit/reporters/ReporterList.java;
      /cvsroot/sqlunit/sqlunit/src/net/sourceforge/sqlunit/reporters/ReporterList.java,v  <--  ReporterList.java
      initial revision: 1.1
      done

      -sujit

       
    • James Henderson

      James Henderson - 2005-07-28

      Hi Sujit,

      I managed to re-compile SQLUnit this time with files that you folded into the project.

      I am still unable to execute the following:

      ant sqlunit-nested -Dtestdir="mssqlserver" -Doutput.file="Testresults.xml" -Dlog.format="canoo"

      When I attempt this target under ant, I recieve the following:

      Buildfile: build.xml

      init:

      precompile:

      compile:

      def:

      sqlunit-nested:
        [sqlunit] [Fatal Error] Testresults.xml:1:1: Content is not allowed in prolog.

      BUILD FAILED
      java.lang.NullPointerException
              at org.apache.tools.ant.Project.fireMessageLoggedEvent(Project.java:1890
      )
              at org.apache.tools.ant.Project.fireMessageLogged(Project.java:1956)
              at org.apache.tools.ant.Project.log(Project.java:396)
              at org.apache.tools.ant.Task.log(Task.java:347)
              at net.sourceforge.sqlunit.ant.SqlunitTask.execute(SqlunitTask.java:141)

              at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:269)
              at org.apache.tools.ant.Task.perform(Task.java:364)
              at org.apache.tools.ant.Target.execute(Target.java:301)
              at org.apache.tools.ant.Target.performTasks(Target.java:328)
              at org.apache.tools.ant.Project.executeTarget(Project.java:1215)
              at org.apache.tools.ant.Project.executeTargets(Project.java:1063)
              at org.apache.tools.ant.Main.runBuild(Main.java:632)
              at org.apache.tools.ant.Main.startAnt(Main.java:183)
              at org.apache.tools.ant.launch.Launcher.run(Launcher.java:197)
              at org.apache.tools.ant.launch.Launcher.main(Launcher.java:56)

      Total time: 3 seconds
      java.lang.NullPointerException
              at org.apache.tools.ant.Project.fireMessageLoggedEvent(Project.java:1890
      )
              at org.apache.tools.ant.Project.fireMessageLogged(Project.java:1956)
              at org.apache.tools.ant.Project.log(Project.java:396)
              at org.apache.tools.ant.Task.log(Task.java:347)
              at net.sourceforge.sqlunit.ant.SqlunitTask.execute(SqlunitTask.java:141)

              at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:269)
              at org.apache.tools.ant.Task.perform(Task.java:364)
              at org.apache.tools.ant.Target.execute(Target.java:301)
              at org.apache.tools.ant.Target.performTasks(Target.java:328)
              at org.apache.tools.ant.Project.executeTarget(Project.java:1215)
              at org.apache.tools.ant.Project.executeTargets(Project.java:1063)
              at org.apache.tools.ant.Main.runBuild(Main.java:632)
              at org.apache.tools.ant.Main.startAnt(Main.java:183)
              at org.apache.tools.ant.launch.Launcher.run(Launcher.java:197)
              at org.apache.tools.ant.launch.Launcher.main(Launcher.java:56)

      Hope this helps.

       
    • Sujit Pal

      Sujit Pal - 2005-07-30

      Hi James,

      I ran the identical command locally on my mock directory, and I was able to get it to generate the xml file. I think that one of the procedures is erroring out for some reason and SQLUnit is failing to handle it. It may be informative to run it on the console, ie without the output.file and log.format declared, so we know where its dying.

      My suspicion was that since I enabled the errorStream, it was trying to write something to the XML file which the parser took to be the prolog. It may still be true, and maybe I am not seeing it because my mock test dont throw errors.

      Also, I know I have been slow to respond this week, and I apologize for that, but I was working on learning AspectJ and applying aspects for logging and profiling to the codebase and trying to come up with a basic structure for the refactoring, and I had quite a few things going on at work as well.

      I did find a place where the Canoo reporter may not handle null resultsets nicely, I dont know of a way to handle it, so I am skipping it in the code update here.
      Checking in src/net/sourceforge/sqlunit/reporters/CanooWebTestReporter.java;
      /cvsroot/sqlunit/sqlunit/src/net/sourceforge/sqlunit/reporters/CanooWebTestReporter.java,v  <--  CanooWebTestReporter.java
      new revision: 1.8; previous revision: 1.7
      done

      If you could find out where this is failing (I think this may be related to the change we made for handling the null results, but not sure), and then take the test which is failing and do a debug trace of it, I think that may be helpful.

      Thanks, and sorry about the delay in responding again.

      -sujit

       
    • James Henderson

      James Henderson - 2005-08-04

      Hi Sujit,

      I pulled the latest CanooWebTestReporter and re-built.

      If I execute the following target (without the output.file defined), then I am successful:

      ant sqlunit-nested -Dtestdir="mssqlserver" -Dlog.format="canoo"

      When I attempt to execute the following target, I receive an error:

      ant sqlunit-nested -Dtestdir="mssqlserver" -Doutput.file="Testresults.xml" -Dlog.format="canoo" 

      The error is as follows:

      Buildfile: build.xml

      init:

      precompile:

      compile:

      def:

      sqlunit-nested:
        [sqlunit] [Fatal Error] Testresults.xml:1:1: Content is not allowed in prolog.

      BUILD FAILED
      java.lang.NullPointerException
              at org.apache.tools.ant.Project.fireMessageLoggedEvent(Project.java:1890
      )
              at org.apache.tools.ant.Project.fireMessageLogged(Project.java:1956)
              at org.apache.tools.ant.Project.log(Project.java:396)
              at org.apache.tools.ant.Task.log(Task.java:347)
              at net.sourceforge.sqlunit.ant.SqlunitTask.execute(SqlunitTask.java:137)

              at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:269)
              at org.apache.tools.ant.Task.perform(Task.java:364)
              at org.apache.tools.ant.Target.execute(Target.java:301)
              at org.apache.tools.ant.Target.performTasks(Target.java:328)
              at org.apache.tools.ant.Project.executeTarget(Project.java:1215)
              at org.apache.tools.ant.Project.executeTargets(Project.java:1063)
              at org.apache.tools.ant.Main.runBuild(Main.java:632)
              at org.apache.tools.ant.Main.startAnt(Main.java:183)
              at org.apache.tools.ant.launch.Launcher.run(Launcher.java:197)
              at org.apache.tools.ant.launch.Launcher.main(Launcher.java:56)

      Total time: 3 seconds
      java.lang.NullPointerException
              at org.apache.tools.ant.Project.fireMessageLoggedEvent(Project.java:1890
      )
              at org.apache.tools.ant.Project.fireMessageLogged(Project.java:1956)
              at org.apache.tools.ant.Project.log(Project.java:396)
              at org.apache.tools.ant.Task.log(Task.java:347)
              at net.sourceforge.sqlunit.ant.SqlunitTask.execute(SqlunitTask.java:137)

              at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:269)
              at org.apache.tools.ant.Task.perform(Task.java:364)
              at org.apache.tools.ant.Target.execute(Target.java:301)
              at org.apache.tools.ant.Target.performTasks(Target.java:328)
              at org.apache.tools.ant.Project.executeTarget(Project.java:1215)
              at org.apache.tools.ant.Project.executeTargets(Project.java:1063)
              at org.apache.tools.ant.Main.runBuild(Main.java:632)
              at org.apache.tools.ant.Main.startAnt(Main.java:183)
              at org.apache.tools.ant.launch.Launcher.run(Launcher.java:197)
              at org.apache.tools.ant.launch.Launcher.main(Launcher.java:56)

      Given that you wer not recieving the error, I decided to poke around a little more.  It turns out that if I delete TestResults.xml, then the following target will execute without a problem:

      ant sqlunit-nested -Dtestdir="mssqlserver" -Doutput.file="TestResults.xml" -Dlog.format="canoo"

      In fact, it can be executed more than once.

      The steps to repeat the error condition that I am experiencing are as follows:

      1. Execute the target:
      ant sqlunit-nested -Dtestdir="mssqlserver" -Doutput.file="TestResults.xml"

      2. Execute the target:
      ant sqlunit-nested -Dtestdir="mssqlserver" -Doutput.file="TestResults.xml" -Dlog.format="canoo"

      The reported error will occur.

      3. Delete TestResults.xml

      4. Execute the target:
      ant sqlunit-nested -Dtestdir="mssqlserver" -Doutput.file="TestResults.xml" -Dlog.format="canoo"

      This time the test run will succeed.  You can be able to execute this target multiple times with success. 

      It appears that not removing the results of the previous test run will cause this error.  Without much investigation, I'm guessing that the CanooWebTestReporter is attempting to parse the XML file generated from the previous run (which it is unable to do).

      I never experienced this in sqlunit-4.7 with the code that I submitted, since I added the clean-output target which removed all output from the previous test run.

      Hope this helps.

      -jh
      This is why I had the clean-output directive from the

       
    • Sujit Pal

      Sujit Pal - 2005-08-09

      Hi James,

      I tried the same sequence of commands on my sandbox for the mock database, but I dont see the error you notice. It may be something to do with the fact that my environment is a developer's environment (dev.mode set) but if you send me the clean-output target (perhaps as a patch to the latest build.xml in CVS) I could apply it.

      -sujit

       
    • James Henderson

      James Henderson - 2005-12-30

      Hi Sujit,

      I just wanted to follow up on a few things with respect to this thread:

      From sujit's post on 2005-07-15 21:25 in this thread:
      [sujit] 5. I discovered the ant target basename, which strips the directory portion of a file name, and can also optionally strip the suffix. Used that, so things work now.

      I just wanted to confirm that I rested and have verified that this modification does work, and causes no errors.

      From My post on 2005-08-04 08:57 in this thread:  I outlined several steps that caused a NullPointerException.  I had suggested that we use the clean-output target, and you indicated that you might apply it to build.xml to resolve this issue.

      Here is the (revised) clean-output target:
          <!-- Clean up output files before executing tests -->
          <target name="clean-output" depends="init">
              <delete file="${output.dir}/${output.file}"/>
              <delete file="${output.dir}/${output.file}.html"/>
          </target>

       
    • Sujit Pal

      Sujit Pal - 2006-01-07

      Hi James,

      Committed to build.xml in CVS, sorry about the delay.

      -sujit

       

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.