Derby
  1. Derby
  2. DERBY-5303

Convert tools/URLCheck.sql to junit

    Details

    • Type: Task Task
    • Status: Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 10.9.1.0
    • Component/s: Test
    • Labels:
    1. derby-5303-1.patch
      3 kB
      Houx Zhang
    2. derby-5303-1-URLCheck.out
      1 kB
      Houx Zhang
    3. derby-5303-2.patch
      6 kB
      Houx Zhang
    4. derby-5303-2.stat
      0.4 kB
      Houx Zhang
    5. derby-5303-3.patch
      3 kB
      Houx Zhang
    6. derby-5303-3.stat
      0.3 kB
      Houx Zhang

      Issue Links

        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 -

        Ask for help:

        when ran the URLCheckTest in patch -1, the test failed with the output file -1. Besides, in my console, I got:

        URL Attribute [unknown=x]
        Attribute is unknown to Derby.
        URL Attribute [dataEncryption=true]
        Attribute is a duplicate.
        URL Attribute [dataEncryption=false]
        Attribute is a duplicate.
        URL Attribute [dataencryption=true]
        Attribute is unknown to Derby.

        it's just the missing info that -1.out failed because of. If add them into .out, the test will pass.

        Why the console ouput the messages above, please? How to convert them into the .output file?

        Thanks!

        Show
        Houx Zhang added a comment - Ask for help: when ran the URLCheckTest in patch -1, the test failed with the output file -1. Besides, in my console, I got: URL Attribute [unknown=x] Attribute is unknown to Derby. URL Attribute [dataEncryption=true] Attribute is a duplicate. URL Attribute [dataEncryption=false] Attribute is a duplicate. URL Attribute [dataencryption=true] Attribute is unknown to Derby. it's just the missing info that -1.out failed because of. If add them into .out, the test will pass. Why the console ouput the messages above, please? How to convert them into the .output file? Thanks!
        Houx Zhang made changes -
        Attachment derby-5303-1.patch [ 12485140 ]
        Attachment derby-5303-1-URLCheck.out [ 12485141 ]
        Hide
        Bryan Pendleton added a comment -

        It looks to me as though CanonTestCase tries to capture the output in a ByteArrayOutputStream,
        but LocalizedResource.OutputWriter sends its output directly to System.out, and doesn't make
        provision for directing the output elsewhere.

        I wonder if it would help to make a subclass of ScriptTestCase which overrides CanonTestCase.getOutputStream
        so that, in addition to fabricating the test output stream, we also call System.setOut() to tell
        System.out to redirect its output to the CanonTestCase's output stream?

        Alternatively, and perhaps better, in ij.java, around line 110, when ij.runScript() is calling
        LocalizedResource.getNewOutput(sqlOut), perhaps we could create a new LocalizedResource.setOutput()
        method which we could pass the LocalizedOutput object to, and it would reset the "out" field
        in the LocalizedResource class to point to the new LocalizedOutput object, rather than the
        one which points to System.out.

        What do you think?

        Show
        Bryan Pendleton added a comment - It looks to me as though CanonTestCase tries to capture the output in a ByteArrayOutputStream, but LocalizedResource.OutputWriter sends its output directly to System.out, and doesn't make provision for directing the output elsewhere. I wonder if it would help to make a subclass of ScriptTestCase which overrides CanonTestCase.getOutputStream so that, in addition to fabricating the test output stream, we also call System.setOut() to tell System.out to redirect its output to the CanonTestCase's output stream? Alternatively, and perhaps better, in ij.java, around line 110, when ij.runScript() is calling LocalizedResource.getNewOutput(sqlOut), perhaps we could create a new LocalizedResource.setOutput() method which we could pass the LocalizedOutput object to, and it would reset the "out" field in the LocalizedResource class to point to the new LocalizedOutput object, rather than the one which points to System.out. What do you think?
        Hide
        Houx Zhang added a comment -

        Hi, Bryan, I have change LocalizedResource.out to get the correct result in 5303-2.patch and 5303-3.patch.

        5303-2.patch and 5303-3.patch is different, 5303-3.patch just adds URLCheck.sql into ToolScripts.java instead of adding a new URLCheckTest class. However, I'm not sure it's right to ignore URLCheck_app.properties in this situation, so wish for your opinion on these two patches.

        Show
        Houx Zhang added a comment - Hi, Bryan, I have change LocalizedResource.out to get the correct result in 5303-2.patch and 5303-3.patch. 5303-2.patch and 5303-3.patch is different, 5303-3.patch just adds URLCheck.sql into ToolScripts.java instead of adding a new URLCheckTest class. However, I'm not sure it's right to ignore URLCheck_app.properties in this situation, so wish for your opinion on these two patches.
        Houx Zhang made changes -
        Attachment derby-5303-2.patch [ 12485586 ]
        Attachment derby-5303-2.stat [ 12485587 ]
        Attachment derby-5303-3.patch [ 12485588 ]
        Attachment derby-5303-3.stat [ 12485589 ]
        Hide
        Bryan Pendleton added a comment -

        All other things being equal, the simpler patch seems better to me,
        so I think patch-3 is therefore preferable to patch-2.

        I don't believe any of the properties in the properties file are
        needed by the test, so I think we can move ahead with this approach.

        derby-5303-3.patch runs great in my environment, so I committed
        it to the trunk as revision 1144123.

        Thank you for the contribution!

        Show
        Bryan Pendleton added a comment - All other things being equal, the simpler patch seems better to me, so I think patch-3 is therefore preferable to patch-2. I don't believe any of the properties in the properties file are needed by the test, so I think we can move ahead with this approach. derby-5303-3.patch runs great in my environment, so I committed it to the trunk as revision 1144123. Thank you for the contribution!
        Bryan Pendleton made changes -
        Status In Progress [ 3 ] Resolved [ 5 ]
        Fix Version/s 10.9.0.0 [ 12316344 ]
        Resolution Fixed [ 1 ]
        Hide
        Houx Zhang added a comment -

        Thanks for your checking and advice, Bryan!

        Show
        Houx Zhang added a comment - Thanks for your checking and advice, Bryan!
        Houx Zhang made changes -
        Status Resolved [ 5 ] Closed [ 6 ]
        Knut Anders Hatlen made changes -
        Link This issue breaks DERBY-5345 [ DERBY-5345 ]
        Gavin made changes -
        Workflow jira [ 12618315 ] Default workflow, editable Closed status [ 12801108 ]

          People

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

            Dates

            • Created:
              Updated:
              Resolved:

              Development