Menu

diff tag

Anonymous
2004-07-23
2004-07-27
  • Anonymous

    Anonymous - 2004-07-23

    I am running sql unit to compare procs on two different sybase databases in dependentantly the two calls generate this output using TUI:

    <test name="Checking it">
      <call>
        <stmt>dbo.mrs_sp_ase_check</stmt>
      </call>
      <result>
        <exception>
          <code>2812</code>
          <message>Stored procedure 'dbo.mrs_sp_ase_check' not found. Specify owner.objectname or use sp_help to check whether the object exists (sp_help may produce lots of output).</message>
        </exception>
      </result>
    </test>

    and:

    <test name="Running mrs_iqsp_check">
      <call>
        <stmt>mrs_iqsp_check</stmt>
      </call>
      <result>
        <resultset id="1">
          <row id="1">
            <col id="1" type="CHAR">CLC_DT</col>
            <col id="2" type="TIMESTAMP">2004-07-21 00:00:00.000</col>
          </row>
        </resultset>
        <resultset id="2">
          <row id="1">
            <col id="1" type="CHAR">POS_DT</col>
            <col id="2" type="TIMESTAMP">2004-07-21 00:00:00.000</col>
          </row>
        </resultset>
        <resultset id="3">
          <row id="1">
            <col id="1" type="VARCHAR">POS_ARC</col>
            <col id="2" type="BIGINT">2021707</col>
            <col id="3" type="DOUBLE">-8.705643601695709E10</col>
          </row>
        </resultset>
        <resultset id="4">
          <row id="1">
            <col id="1" type="VARCHAR">POS_DET_ARC</col>
            <col id="2" type="BIGINT">9027172</col>
            <col id="3" type="DOUBLE">9.408811224712927E8</col>
            <col id="4" type="DOUBLE">9.218967839765028E8</col>
          </row>
        </resultset>
        <resultset id="5">
          <row id="1">
            <col id="1" type="VARCHAR">POS_SNS_PRD_ARC</col>
            <col id="2" type="BIGINT">120994</col>
            <col id="3" type="DOUBLE">-8.705626521495189E10</col>
          </row>
        </resultset>
        <resultset id="6">
          <row id="1">
            <col id="1" type="VARCHAR">POS_SNS_TNR_ARC</col>
            <col id="2" type="BIGINT">729970</col>
            <col id="3" type="DOUBLE">-4.2339957796568665E10</col>
          </row>
        </resultset>
      </result>
    </test>

    now diff should fail! but the diff test:

    <diff name="Difference between IQS and SQL" failure-message="Diff test failed">
            <call connection-id="1">
             <stmt>mrs_sp_ase_check()</stmt>
           </call>
           <call connection-id="2">
             <stmt>mrs_iqsp_check()</stmt>
           </call>
         </diff>

    gives:

    SQLTest:
      [sqlunit] *** Running SQLUnit file: U:\TestEnv\Framework\test\SQL_test.xml
      [sqlunit] Getting connection(1)
      [sqlunit] Getting connection(2)
      [sqlunit] Setting up test...
      [sqlunit] Running diff[1]: Difference between IQS and SQL (110ms)
      [sqlunit] Tearing down test...

    BUILD SUCCESSFUL
    Total time: 4 seconds

    hmm.... am I doing something wrong?

    Thanks,
    Omer

     
    • Sujit Pal

      Sujit Pal - 2004-07-23

      Hi Omer,

      I think the diff handler compares two resultsets, the second one being used for a reference. But that is obviously wrong, as you pointed out. I will look at the code and get back to you.

      Thanks,
      Sujit

       
    • Anonymous

      Anonymous - 2004-07-26

      The following statements give these results individually when run using the TUI tool:

      <test name="Selecting count from Coef">
        <sql>
          <stmt>Select count(*) from coef</stmt>
        </sql>
        <result>
          <resultset id="1">
            <row id="1">
              <col id="1" type="INTEGER">160</col>
            </row>
          </resultset>
        </result>
      </test>

      and:

      <test name="Selecting count from Coef">
        <sql>
          <stmt>Select count(*) from ccy</stmt>
        </sql>
        <result>
          <resultset id="1">
            <row id="1">
              <col id="1" type="INTEGER">216</col>
            </row>
          </resultset>
        </result>
      </test>

      The result sets are different. Now when they are run under a diff command in 3.7 the test succeeds. Under 3.8 the test succeeds as long as a default connection is specified.

      *** Running SQLUnit file: U:\TestEnv\Framework\test\SQL_test.xml
      Getting connection(3)
      Setting up test...
      Running diff[1]: Testing Diff (125ms)
      Tearing down test...

      If a connection-id is given then a null pointer exception is thrown:

      [sqlunit] null
      t file: U:\TestEnv\Framework\test\SQL_test.xml
      Getting connection(3)
      Setting up test...
      Running diff[1]: Testing DiffError (java.lang.NullPointerException) encountered: null

      Omer

       
      • Sujit Pal

        Sujit Pal - 2004-07-26

        Hi Omer,

        Ken found this out and submitted a patch which I put in, but it hasnt made it out into a release yet. Details are here:
        https://sourceforge.net/tracker/index.php?func=detail&aid=988562&group_id=77832&atid=551357

        You can just download the one file that is needed for this fix to work from CVS and recompile. This will be part of the next release. Let me know if you would prefer a release, though.

        When you say that the diff succeeds, do you mean that the diff reports a success for different count values? I dont think it should, unless you had a matcher override. I am pretty sure I have a test case for it which passes, since this is a very basic testcase.

        Thanks
        Sujit

         
    • Anonymous

      Anonymous - 2004-07-27

      Hi Sujit,

      Sorry the diff doesn't succeed I was calling an incorrect stored procedue.

      However even after downloading the new file ConnectionHandler.java and rebuilding the project my null pointer exception hasn't gone. Its most probably a problem with my class paths or smoething but I have tried hard and can't detect it. The test seems to be using my newly built jar file and still giving the null pointer error:

      [sqlunit] *** Running SQLUnit file: U:\TestEnv\Framework\test\SQL_test.xml
      [sqlunit] Getting connection(1)
      [sqlunit] Error (java.lang.NullPointerException) encountered: null
      [sqlunit] null
      [sqlunit] One or more SQLUnit Tests failed, see the console for details

      please look it up if I find the problem in the meantime I will tell you.

      Thanks
      Omer

       
    • Anonymous

      Anonymous - 2004-07-27

      Hi Sujit,

      Ken's fix as mentioned in the link is:

      ConnectionRegistry.setConnection(connectionId, connPropertyMap);
      Connection conn = ConnectionRegistry.getConnection(connectionId);

      with which I get the error:

      [sqlunit] *** Running SQLUnit file: U:\TestEnv\Framework\test\SQL_test.xml
      [sqlunit] Getting connection(2)
      [sqlunit] Error (java.lang.NullPointerException) encountered: null
      [sqlunit] null
      [sqlunit] One or more SQLUnit Tests failed, see the console for details

      The actual code in the file is:

      ConnectionRegistry.setConnection(connectionId, connPropertyMap);
              Connection conn = ConnectionRegistry.getConnection(null);

      with which I get slightly different though similar error message:

      [sqlunit] *** Running SQLUnit file: U:\TestEnv\Framework\test\SQL_test.xml
      [sqlunit] Getting connection(2)
      [sqlunit] Error (java.lang.NullPointerException) encountered: null
      [sqlunit] null
      [sqlunit] One or more SQLUnit Tests failed, see the console for details

      What is the correct fix?

      Omer

       
    • Anonymous

      Anonymous - 2004-07-27

      Sorry for posting so many messages, its tempting to get help when its so easily available. Thankyou.

      Its working now with Ken's code. But apparently its not updated in the CVS files correctly as the call to getConnection is still made with a hardwired null.

      Thanks,
      Omer

       
    • Sujit Pal

      Sujit Pal - 2004-07-27

      Hi Omer,

      No problems with many messages, glad to know that SQLUnit is working for you.

      I see Ken's fix in the code in revision 1.25 of ConnectionHandler.java which was posted 5 days ago. Not sure why it did not download for you, but its there in cvs.

      Also to recompile, you will need to run:
      ant install
      and then move the dist/sqlunit-${rel.ver}.jar file to lib/sqlunit-${rel.ver}.jar, where ${rel.ver} is the release version that was last released, in this case 3.8.

      -sujit

       

Log in to post a comment.