You are viewing a plain text version of this content. The canonical link for it is here.
Posted to derby-dev@db.apache.org by "Kathey Marsden (JIRA)" <ji...@apache.org> on 2007/12/13 00:25:43 UTC

[jira] Created: (DERBY-3273) convert derbynet/testconnection.java to junit

convert derbynet/testconnection.java to junit
---------------------------------------------

                 Key: DERBY-3273
                 URL: https://issues.apache.org/jira/browse/DERBY-3273
             Project: Derby
          Issue Type: Test
          Components: Test
    Affects Versions: 10.4.0.0
            Reporter: Kathey Marsden
            Priority: Minor


convert derbynet/testconnection.java to junit.


-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Updated: (DERBY-3273) convert derbynet/testconnection.java to junit

Posted by "Kathey Marsden (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/DERBY-3273?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Kathey Marsden updated DERBY-3273:
----------------------------------

    Attachment: derby-3273_diff2.txt

A new patch addressing Myrna's and Dan's comments.



> convert derbynet/testconnection.java to junit
> ---------------------------------------------
>
>                 Key: DERBY-3273
>                 URL: https://issues.apache.org/jira/browse/DERBY-3273
>             Project: Derby
>          Issue Type: Test
>          Components: Test
>    Affects Versions: 10.4.0.0
>            Reporter: Kathey Marsden
>            Assignee: Kathey Marsden
>            Priority: Minor
>         Attachments: derby-3273_diff.txt, derby-3273_diff2.txt
>
>
> convert derbynet/testconnection.java to junit.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (DERBY-3273) convert derbynet/testconnection.java to junit

Posted by "Daniel John Debrunner (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/DERBY-3273?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12551190 ] 

Daniel John Debrunner commented on DERBY-3273:
----------------------------------------------

In NetworkServerControlApiTest 

+    public void testPing() throws Exception
+    {
+        NetworkServerControl nsctrl = new NetworkServerControl();
+        nsctrl.ping();
+ 

This code has the problem that it assumes the default of localhost and 1527 matches the current configuration of the test which may not be true.
Existing tests in NetworkServerControlApiTest have this problem, as Myrna points out the NetworkServerControl should be pulled based on the configuration.

+        try {
+        	nsctrl = new NetworkServerControl(InetAddress.getByName("notthere"), 1527);
+        	nsctrl.ping();
+        	fail("Should not have been able to ping host \"notthere\"");


I think this is a dangerous coding style for tests, which method call are you expecting to fail? Only the method expected to fail should be in the try catch block.

> convert derbynet/testconnection.java to junit
> ---------------------------------------------
>
>                 Key: DERBY-3273
>                 URL: https://issues.apache.org/jira/browse/DERBY-3273
>             Project: Derby
>          Issue Type: Test
>          Components: Test
>    Affects Versions: 10.4.0.0
>            Reporter: Kathey Marsden
>            Assignee: Kathey Marsden
>            Priority: Minor
>         Attachments: derby-3273_diff.txt
>
>
> convert derbynet/testconnection.java to junit.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (DERBY-3273) convert derbynet/testconnection.java to junit

Posted by "Daniel John Debrunner (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/DERBY-3273?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12551186 ] 

Daniel John Debrunner commented on DERBY-3273:
----------------------------------------------

In the Utilities.execCmd() if Runtime.getRuntime().exec(command) throws an exception a NPE will result.

I think the exception should simply be thrown which will cause the test to fail.

In the same method:

+            if (pr.exitValue() != expectedExitCode) {
+                BaseTestCase.fail("FAIL: expected exit code of " + expectedExitCode
+                                + ", got exit code of " + pr.exitValue());
+            }

any reason not to use Assert.assertEquals()?

and

+            int j = 0;
+            for (int i = 3; i < totalSize; i++) {
+                cmd[i] = args[j++];
+            }

any reason not to use System.arraycopy()?

Putting this exec in Utilities is good, it could be the base to fix DERBY-3250 since the new method handles multiple arguments correctly.


> convert derbynet/testconnection.java to junit
> ---------------------------------------------
>
>                 Key: DERBY-3273
>                 URL: https://issues.apache.org/jira/browse/DERBY-3273
>             Project: Derby
>          Issue Type: Test
>          Components: Test
>    Affects Versions: 10.4.0.0
>            Reporter: Kathey Marsden
>            Assignee: Kathey Marsden
>            Priority: Minor
>         Attachments: derby-3273_diff.txt
>
>
> convert derbynet/testconnection.java to junit.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (DERBY-3273) convert derbynet/testconnection.java to junit

Posted by "Ole Solberg (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/DERBY-3273?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12551718 ] 

Ole Solberg commented on DERBY-3273:
------------------------------------

Looks like the 604074 checkin was incomplete: old test still referenced in derbynetmats and j9derbynetmats:

./org/apache/derbyTesting/functionTests/suites/derbynetmats.runall:10:derbynet/testconnection.java
./org/apache/derbyTesting/functionTests/suites/j9derbynetmats.runall:6:derbynet/testconnection.java


See
http://dbtg.thresher.com/derby/test/tinderbox_trunk16/jvm1.6/testing/testlog/SunOS-5.10_i86pc-i386/604075-derbyall_diff.txt

> Exception in thread "main" java.lang.NoClassDefFoundError: org/apache/derbyTesting/functionTests/tests/derbynet/testconnection


> convert derbynet/testconnection.java to junit
> ---------------------------------------------
>
>                 Key: DERBY-3273
>                 URL: https://issues.apache.org/jira/browse/DERBY-3273
>             Project: Derby
>          Issue Type: Test
>          Components: Test
>    Affects Versions: 10.4.0.0
>            Reporter: Kathey Marsden
>            Assignee: Kathey Marsden
>            Priority: Minor
>         Attachments: derby-3273_diff.txt, derby-3273_diff2.txt
>
>
> convert derbynet/testconnection.java to junit.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Updated: (DERBY-3273) convert derbynet/testconnection.java to junit

Posted by "Kathey Marsden (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/DERBY-3273?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Kathey Marsden updated DERBY-3273:
----------------------------------

    Derby Info:   (was: [Patch Available])

> convert derbynet/testconnection.java to junit
> ---------------------------------------------
>
>                 Key: DERBY-3273
>                 URL: https://issues.apache.org/jira/browse/DERBY-3273
>             Project: Derby
>          Issue Type: Test
>          Components: Test
>    Affects Versions: 10.4.0.0
>            Reporter: Kathey Marsden
>            Assignee: Kathey Marsden
>            Priority: Minor
>         Attachments: derby-3273_diff.txt
>
>
> convert derbynet/testconnection.java to junit.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Updated: (DERBY-3273) convert derbynet/testconnection.java to junit

Posted by "Kathey Marsden (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/DERBY-3273?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Kathey Marsden updated DERBY-3273:
----------------------------------

    Derby Info: [Patch Available]

> convert derbynet/testconnection.java to junit
> ---------------------------------------------
>
>                 Key: DERBY-3273
>                 URL: https://issues.apache.org/jira/browse/DERBY-3273
>             Project: Derby
>          Issue Type: Test
>          Components: Test
>    Affects Versions: 10.4.0.0
>            Reporter: Kathey Marsden
>            Assignee: Kathey Marsden
>            Priority: Minor
>         Attachments: derby-3273_diff.txt, derby-3273_diff2.txt
>
>
> convert derbynet/testconnection.java to junit.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (DERBY-3273) convert derbynet/testconnection.java to junit

Posted by "Daniel John Debrunner (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/DERBY-3273?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12551184 ] 

Daniel John Debrunner commented on DERBY-3273:
----------------------------------------------

Or even:

  NetworkServerTestSetup.getNetworkServerControl()

which returns a correctly setup NetworkServerControl object for the current configuration including handling SSL.

> convert derbynet/testconnection.java to junit
> ---------------------------------------------
>
>                 Key: DERBY-3273
>                 URL: https://issues.apache.org/jira/browse/DERBY-3273
>             Project: Derby
>          Issue Type: Test
>          Components: Test
>    Affects Versions: 10.4.0.0
>            Reporter: Kathey Marsden
>            Assignee: Kathey Marsden
>            Priority: Minor
>         Attachments: derby-3273_diff.txt
>
>
> convert derbynet/testconnection.java to junit.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Updated: (DERBY-3273) convert derbynet/testconnection.java to junit

Posted by "Kathey Marsden (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/DERBY-3273?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Kathey Marsden updated DERBY-3273:
----------------------------------

    Derby Info: [Patch Available]
      Assignee: Kathey Marsden

> convert derbynet/testconnection.java to junit
> ---------------------------------------------
>
>                 Key: DERBY-3273
>                 URL: https://issues.apache.org/jira/browse/DERBY-3273
>             Project: Derby
>          Issue Type: Test
>          Components: Test
>    Affects Versions: 10.4.0.0
>            Reporter: Kathey Marsden
>            Assignee: Kathey Marsden
>            Priority: Minor
>         Attachments: derby-3273_diff.txt
>
>
> convert derbynet/testconnection.java to junit.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (DERBY-3273) convert derbynet/testconnection.java to junit

Posted by "Myrna van Lunteren (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/DERBY-3273?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12551172 ] 

Myrna van Lunteren commented on DERBY-3273:
-------------------------------------------

I have no reply to your question (looks ok to me, but then I'm working on English systems also), but I have two comments:
 - although it's negative testing, maybe you should use the          InetAddress.getByName(
                TestConfiguration.getCurrent().getHostName()),
                TestConfiguration.getCurrent().getPort());
  instead of hard-coded localhost and 1527.

- although the jvm executable for J2ME may not be 'java' I wouldn't say it's "not right". :-)  Just different.

> convert derbynet/testconnection.java to junit
> ---------------------------------------------
>
>                 Key: DERBY-3273
>                 URL: https://issues.apache.org/jira/browse/DERBY-3273
>             Project: Derby
>          Issue Type: Test
>          Components: Test
>    Affects Versions: 10.4.0.0
>            Reporter: Kathey Marsden
>            Assignee: Kathey Marsden
>            Priority: Minor
>         Attachments: derby-3273_diff.txt
>
>
> convert derbynet/testconnection.java to junit.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (DERBY-3273) convert derbynet/testconnection.java to junit

Posted by "Kathey Marsden (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/DERBY-3273?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12551567 ] 

Kathey Marsden commented on DERBY-3273:
---------------------------------------

Dan said...
>+ try {
>+ nsctrl = new >NetworkServerControl(InetAddress.getByName("notthere"), 1527);
>+ nsctrl.ping();
>+ fail("Should not have been able to ping host >\"notthere\"");

>I think this is a dangerous coding style for tests, which >method call are you expecting to fail? Only the method >expected to fail should be in the try catch block

In fact the failure was happening in the InetAddress.getByName("notthere"), call, so we never got to the ping. It was a security exception, but when I added the permissions and privilege block, it failed with an UnknownHost exception, so the test itself does not make much sense for ping with the API.  I'll take the unknown host test out of testPing.




> convert derbynet/testconnection.java to junit
> ---------------------------------------------
>
>                 Key: DERBY-3273
>                 URL: https://issues.apache.org/jira/browse/DERBY-3273
>             Project: Derby
>          Issue Type: Test
>          Components: Test
>    Affects Versions: 10.4.0.0
>            Reporter: Kathey Marsden
>            Assignee: Kathey Marsden
>            Priority: Minor
>         Attachments: derby-3273_diff.txt
>
>
> convert derbynet/testconnection.java to junit.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (DERBY-3273) convert derbynet/testconnection.java to junit

Posted by "Kathey Marsden (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/DERBY-3273?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12551626 ] 

Kathey Marsden commented on DERBY-3273:
---------------------------------------

of course you are right, the two commands end up testing the same thing. I will remove the second.


> convert derbynet/testconnection.java to junit
> ---------------------------------------------
>
>                 Key: DERBY-3273
>                 URL: https://issues.apache.org/jira/browse/DERBY-3273
>             Project: Derby
>          Issue Type: Test
>          Components: Test
>    Affects Versions: 10.4.0.0
>            Reporter: Kathey Marsden
>            Assignee: Kathey Marsden
>            Priority: Minor
>         Attachments: derby-3273_diff.txt, derby-3273_diff2.txt
>
>
> convert derbynet/testconnection.java to junit.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Closed: (DERBY-3273) convert derbynet/testconnection.java to junit

Posted by "Kathey Marsden (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/DERBY-3273?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Kathey Marsden closed DERBY-3273.
---------------------------------

       Resolution: Fixed
    Fix Version/s: 10.4.0.0

> convert derbynet/testconnection.java to junit
> ---------------------------------------------
>
>                 Key: DERBY-3273
>                 URL: https://issues.apache.org/jira/browse/DERBY-3273
>             Project: Derby
>          Issue Type: Test
>          Components: Test
>    Affects Versions: 10.4.0.0
>            Reporter: Kathey Marsden
>            Assignee: Kathey Marsden
>            Priority: Minor
>             Fix For: 10.4.0.0
>
>         Attachments: derby-3273_diff.txt, derby-3273_diff2.txt
>
>
> convert derbynet/testconnection.java to junit.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


Re: [jira] Commented: (DERBY-3273) convert derbynet/testconnection.java to junit

Posted by Kathey Marsden <km...@sbcglobal.net>.
Andrew McIntyre (JIRA) wrote:
>     [ https://issues.apache.org/jira/browse/DERBY-3273?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12551724 ] 
>
> Andrew McIntyre commented on DERBY-3273:
> ----------------------------------------
>
> Removed testconnection from old harness suites with revision 604123.
>
>   
Thanks Andrew!


[jira] Commented: (DERBY-3273) convert derbynet/testconnection.java to junit

Posted by "Andrew McIntyre (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/DERBY-3273?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12551724 ] 

Andrew McIntyre commented on DERBY-3273:
----------------------------------------

Removed testconnection from old harness suites with revision 604123.

> convert derbynet/testconnection.java to junit
> ---------------------------------------------
>
>                 Key: DERBY-3273
>                 URL: https://issues.apache.org/jira/browse/DERBY-3273
>             Project: Derby
>          Issue Type: Test
>          Components: Test
>    Affects Versions: 10.4.0.0
>            Reporter: Kathey Marsden
>            Assignee: Kathey Marsden
>            Priority: Minor
>         Attachments: derby-3273_diff.txt, derby-3273_diff2.txt
>
>
> convert derbynet/testconnection.java to junit.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Updated: (DERBY-3273) convert derbynet/testconnection.java to junit

Posted by "Kathey Marsden (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/DERBY-3273?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Kathey Marsden updated DERBY-3273:
----------------------------------

    Attachment: derby-3273_diff.txt

Attached is the conversion of derbynet/testconnection.java to junit.

Added ping testing with the api to  NetworkServerControlApiTest

Created a new test NetworkServerControlClientCommandTest to test the command line ping testing.  Command line testing for runtimeinfo, sysinfo etc can be added to this file when converted.

I have a question about portability. I think that because the process input stream will use the platform default encoding as will the String constructor, my code comparing the command output will be ok, but I would appreciate a second opinion.

Kathey


> convert derbynet/testconnection.java to junit
> ---------------------------------------------
>
>                 Key: DERBY-3273
>                 URL: https://issues.apache.org/jira/browse/DERBY-3273
>             Project: Derby
>          Issue Type: Test
>          Components: Test
>    Affects Versions: 10.4.0.0
>            Reporter: Kathey Marsden
>            Priority: Minor
>         Attachments: derby-3273_diff.txt
>
>
> convert derbynet/testconnection.java to junit.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (DERBY-3273) convert derbynet/testconnection.java to junit

Posted by "Daniel John Debrunner (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/DERBY-3273?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12551622 ] 

Daniel John Debrunner commented on DERBY-3273:
----------------------------------------------

Can you comment what's going on here?

+        String currentHost = TestConfiguration.getCurrent().getHostName();
+        int currentPort = TestConfiguration.getCurrent().getPort();
+        NetworkServerControl nsctrl = NetworkServerTestSetup.getNetworkServerControl();
+        nsctrl.ping();
+        nsctrl = new NetworkServerControl(privInetAddressGetByName(currentHost), 
+                currentPort);
+        nsctrl.ping();

What's different about the second ping that requires additional testing?

Seems to me that if SSL is not enabled then the two pings are testing the same logic, if SSL is enabled then won't the second ping fail?

> convert derbynet/testconnection.java to junit
> ---------------------------------------------
>
>                 Key: DERBY-3273
>                 URL: https://issues.apache.org/jira/browse/DERBY-3273
>             Project: Derby
>          Issue Type: Test
>          Components: Test
>    Affects Versions: 10.4.0.0
>            Reporter: Kathey Marsden
>            Assignee: Kathey Marsden
>            Priority: Minor
>         Attachments: derby-3273_diff.txt, derby-3273_diff2.txt
>
>
> convert derbynet/testconnection.java to junit.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.