Details

    • Type: Sub-task Sub-task
    • Status: Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 10.9.1.0
    • Component/s: Test
    • Labels:
    1. 5327-2.stat
      0.4 kB
      Houx Zhang
    2. 5327-2.patch
      6 kB
      Houx Zhang
    3. 5327-ij5-1.out
      1 kB
      Houx Zhang
    4. 5327-1.patch
      1 kB
      Houx Zhang

      Activity

      Houx Zhang created issue -
      Houx Zhang made changes -
      Field Original Value New Value
      Status Open [ 1 ] In Progress [ 3 ]
      Hide
      Houx Zhang added a comment - - edited

      Ask for help!

      I have ij5Test.java to test ij5.sql, but can not get the expected result.

      Question 1:
      As the ij5.sql has shows:
      "1)at the startup time, it will list all the connections".
      I have set "ij.showNoConnectionsAtStart" to "false". but no connection is shown. Why?

      Question 2:
      As the ij5.sql has shows:
      "2)select will now display number of rows selected".
      I have set "ij.showNoCountForSelect" to "false". but no count is shown. Why?

      Question 3:
      With the property "props.setProperty("ij.connection.connOne", "jdbc:derby:wombat;create=true");", connOne is created actually(I have ever tested this by adding "show connections;"). However, subclass of ScriptTestCase will create wombat by default, this will affect the expected result. How to stop subclass of ScriptTestCase to create wombat by default, please?

      Thanks!

      Show
      Houx Zhang added a comment - - edited Ask for help! I have ij5Test.java to test ij5.sql, but can not get the expected result. Question 1: As the ij5.sql has shows: "1)at the startup time, it will list all the connections". I have set "ij.showNoConnectionsAtStart" to "false". but no connection is shown. Why? Question 2: As the ij5.sql has shows: "2)select will now display number of rows selected". I have set "ij.showNoCountForSelect" to "false". but no count is shown. Why? Question 3: With the property "props.setProperty("ij.connection.connOne", "jdbc:derby:wombat;create=true");", connOne is created actually(I have ever tested this by adding "show connections;"). However, subclass of ScriptTestCase will create wombat by default, this will affect the expected result. How to stop subclass of ScriptTestCase to create wombat by default, please? Thanks!
      Houx Zhang made changes -
      Attachment 5327-1.patch [ 12486185 ]
      Attachment 5327-ij5-1.out [ 12486186 ]
      Hide
      Bryan Pendleton added a comment -

      I think that these problems arise from the fact that ScriptTestCase.runTest calls
      ij.runScript, which in turn calls utilMain.goScript, and these are not the "normal"
      ij invocation methods, but rather are slightly special and don't do quite the
      same things.

      In particular:

      Question 1:
      Since ij.runScript calls utilMain.goScript, rather than utilMain.go, we don't
      ever process the ij.showNoConnectionsAtStart logic, because the code to
      show the connections at start is in utilMain.go, and isn't being executed.

      Question 2:
      Similar to (1), ij.showNoCountForSelect is handled by utilMain.go, and so
      it isn't being executed, either.

      Question 3:
      ScriptTestCase passes a newly-created connection through to utilMain.goScript,
      and it gets set to be the current connection, which does indeed affect the
      expected result. I had some limited success with fixing this by making the
      following change to utilMain.goScript; the idea is that if there is already a current
      session when goScript() is called, it should preserve that current session
      instead of using the connection passed to it from the caller.

      Index: utilMain.java
      ===================================================================
      — utilMain.java (revision 1145422)
      +++ utilMain.java (working copy)
      @@ -273,7 +273,10 @@
      LocalizedInput in)
      {
      JDBCDisplayUtil.showSelectCount = false;
      + Session curSess = connEnv[0].getSession();
      connEnv[0].addSession(conn, (String) null);
      + if( curSess != null )
      + connEnv[0].setCurrentSession( curSess.name );
      fileInput = initialFileInput = !in.isStandardInput();
      commandGrabber[0].ReInit(in);
      return runScriptGuts();

      I guess the bottom line here is that 'ij5.sql' is testing certain
      features of utilMain.go(), and therefore it is hard to test these
      through ScriptTestCase because it uses runScript/goScript
      rather than go().

      Show
      Bryan Pendleton added a comment - I think that these problems arise from the fact that ScriptTestCase.runTest calls ij.runScript, which in turn calls utilMain.goScript, and these are not the "normal" ij invocation methods, but rather are slightly special and don't do quite the same things. In particular: Question 1: Since ij.runScript calls utilMain.goScript, rather than utilMain.go, we don't ever process the ij.showNoConnectionsAtStart logic, because the code to show the connections at start is in utilMain.go, and isn't being executed. Question 2: Similar to (1), ij.showNoCountForSelect is handled by utilMain.go, and so it isn't being executed, either. Question 3: ScriptTestCase passes a newly-created connection through to utilMain.goScript, and it gets set to be the current connection, which does indeed affect the expected result. I had some limited success with fixing this by making the following change to utilMain.goScript; the idea is that if there is already a current session when goScript() is called, it should preserve that current session instead of using the connection passed to it from the caller. Index: utilMain.java =================================================================== — utilMain.java (revision 1145422) +++ utilMain.java (working copy) @@ -273,7 +273,10 @@ LocalizedInput in) { JDBCDisplayUtil.showSelectCount = false; + Session curSess = connEnv [0] .getSession(); connEnv [0] .addSession(conn, (String) null); + if( curSess != null ) + connEnv [0] .setCurrentSession( curSess.name ); fileInput = initialFileInput = !in.isStandardInput(); commandGrabber [0] .ReInit(in); return runScriptGuts(); I guess the bottom line here is that 'ij5.sql' is testing certain features of utilMain.go(), and therefore it is hard to test these through ScriptTestCase because it uses runScript/goScript rather than go().
      Hide
      Houx Zhang added a comment -

      Thanks for your detailed instructions, Bryan.

      I think ij5.sql is not suitable to convert by extending ScriptTestCase, even not suitable to convert to junit, as its name contains "ij", which shows it's expected to test as a sql script. So it's best to keep it stay as a script one.

      What' your opinion?

      Show
      Houx Zhang added a comment - Thanks for your detailed instructions, Bryan. I think ij5.sql is not suitable to convert by extending ScriptTestCase, even not suitable to convert to junit, as its name contains "ij", which shows it's expected to test as a sql script. So it's best to keep it stay as a script one. What' your opinion?
      Hide
      Bryan Pendleton added a comment -

      I think we could re-factor some of the behaviors of utilMain.go() so that they were
      also performed by goScript(), and that might make it easier for us to test them.

      It would also be OK to defer this issue for now, and work on some of the other
      testing and bug-fixing projects, and come back to this later.

      Show
      Bryan Pendleton added a comment - I think we could re-factor some of the behaviors of utilMain.go() so that they were also performed by goScript(), and that might make it easier for us to test them. It would also be OK to defer this issue for now, and work on some of the other testing and bug-fixing projects, and come back to this later.
      Hide
      Houx Zhang added a comment -

      OK, I will work on other tasks first.

      Show
      Houx Zhang added a comment - OK, I will work on other tasks first.
      Hide
      Houx Zhang added a comment -

      With ScriptTestCase supporting "ij.showNoCountForSelect" and "ij.showNoConnectionsAtStart", the issue can be pushed forward.

      In 5327-2.patch, the property "ij.connection.connOne=jdbc:derby:wombat;create=true" in ij5_app.properties has been removed, as I don'y think this is important with the testing point, and it has been tested fully in other ij test.

      Besides, "runwithfoundation=false" is removed too, as ij5.sql doesn't relate to it too much.

      Show
      Houx Zhang added a comment - With ScriptTestCase supporting "ij.showNoCountForSelect" and "ij.showNoConnectionsAtStart", the issue can be pushed forward. In 5327-2.patch, the property "ij.connection.connOne=jdbc:derby:wombat;create=true" in ij5_app.properties has been removed, as I don'y think this is important with the testing point, and it has been tested fully in other ij test. Besides, "runwithfoundation=false" is removed too, as ij5.sql doesn't relate to it too much.
      Houx Zhang made changes -
      Attachment 5327-2.patch [ 12488402 ]
      Attachment 5327-2.stat [ 12488403 ]
      Houx Zhang made changes -
      Issue & fix info [Patch Available]
      Hide
      Bryan Pendleton added a comment -

      The new test program seems quite clean now.

      I ran both the tools suite and the old derbytools tests and
      everything seemed fine to me, so I committed this to the
      trunk as revision 1152796.

      Thank you for the contribution!

      Show
      Bryan Pendleton added a comment - The new test program seems quite clean now. I ran both the tools suite and the old derbytools tests and everything seemed fine to me, so I committed this to the trunk as revision 1152796. Thank you for the contribution!
      Bryan Pendleton made changes -
      Status In Progress [ 3 ] Resolved [ 5 ]
      Issue & fix info [Patch Available]
      Fix Version/s 10.9.0.0 [ 12316344 ]
      Resolution Fixed [ 1 ]
      Hide
      Houx Zhang added a comment -

      Thanks for your checking and committing, Bryan.

      Show
      Houx Zhang added a comment - Thanks for your checking and committing, Bryan.
      Houx Zhang made changes -
      Status Resolved [ 5 ] Closed [ 6 ]
      Hide
      Myrna van Lunteren added a comment -

      Just for the reference: the use of ij.connection. property is already tested in the ijConnNameTest.

      Show
      Myrna van Lunteren added a comment - Just for the reference: the use of ij.connection. property is already tested in the ijConnNameTest.
      Gavin made changes -
      Workflow jira [ 12620098 ] Default workflow, editable Closed status [ 12801113 ]

        People

        • Assignee:
          Houx Zhang
          Reporter:
          Houx Zhang
        • Votes:
          0 Vote for this issue
          Watchers:
          0 Start watching this issue

          Dates

          • Created:
            Updated:
            Resolved:

            Development