You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@harmony.apache.org by "Paulex Yang (JIRA)" <ji...@apache.org> on 2006/06/29 07:27:29 UTC

[jira] Created: (HARMONY-704) [classlib][nio]refactory nio buffer test step 2 - CharBuffer tests

[classlib][nio]refactory nio buffer test step 2 - CharBuffer tests
------------------------------------------------------------------

         Key: HARMONY-704
         URL: http://issues.apache.org/jira/browse/HARMONY-704
     Project: Harmony
        Type: Improvement

  Components: Classlib  
    Reporter: Paulex Yang
    Priority: Minor


As I proposed on the mailing list, I'm going to refactor the nio buffers' tests, here goes the refactory for CharBuffer tests following Harmony-575. I'll attach patch soon.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira


[jira] Updated: (HARMONY-704) [classlib][nio]refactory nio buffer test step 2 - CharBuffer tests

Posted by "Paulex Yang (JIRA)" <ji...@apache.org>.
     [ http://issues.apache.org/jira/browse/HARMONY-704?page=all ]

Paulex Yang updated HARMONY-704:
--------------------------------

    Attachment: harmony-704v2.zip

George,

Please try this version instead, I fixed the bug in CharBufferTest as well as ByteBufferTest. Sorry for the inconvenience caused.

Regards,
Paulex.

> [classlib][nio]refactory nio buffer test step 2 - CharBuffer tests
> ------------------------------------------------------------------
>
>          Key: HARMONY-704
>          URL: http://issues.apache.org/jira/browse/HARMONY-704
>      Project: Harmony
>         Type: Improvement

>   Components: Classlib
>     Reporter: Paulex Yang
>     Assignee: George Harley
>     Priority: Minor
>  Attachments: harmony-704.zip, harmony-704v2.zip
>
> As I proposed on the mailing list, I'm going to refactor the nio buffers' tests, here goes the refactory for CharBuffer tests following Harmony-575. I'll attach patch soon.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira


[jira] Resolved: (HARMONY-704) [classlib][nio]refactory nio buffer test step 2 - CharBuffer tests

Posted by "George Harley (JIRA)" <ji...@apache.org>.
     [ http://issues.apache.org/jira/browse/HARMONY-704?page=all ]
     
George Harley resolved HARMONY-704:
-----------------------------------

    Resolution: Fixed

Hi Paulex, 

Second patch works fine for me. Thanks for nailing the source of the problem. Patch committed in revision 418214. Please could you check that it has been applied as expected. 

Thanks for this enhancement. 

Best regards, 
George


> [classlib][nio]refactory nio buffer test step 2 - CharBuffer tests
> ------------------------------------------------------------------
>
>          Key: HARMONY-704
>          URL: http://issues.apache.org/jira/browse/HARMONY-704
>      Project: Harmony
>         Type: Improvement

>   Components: Classlib
>     Reporter: Paulex Yang
>     Assignee: George Harley
>     Priority: Minor
>  Attachments: harmony-704.zip, harmony-704v2.zip
>
> As I proposed on the mailing list, I'm going to refactor the nio buffers' tests, here goes the refactory for CharBuffer tests following Harmony-575. I'll attach patch soon.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira


[jira] Assigned: (HARMONY-704) [classlib][nio]refactory nio buffer test step 2 - CharBuffer tests

Posted by "George Harley (JIRA)" <ji...@apache.org>.
     [ http://issues.apache.org/jira/browse/HARMONY-704?page=all ]

George Harley reassigned HARMONY-704:
-------------------------------------

    Assign To: George Harley

> [classlib][nio]refactory nio buffer test step 2 - CharBuffer tests
> ------------------------------------------------------------------
>
>          Key: HARMONY-704
>          URL: http://issues.apache.org/jira/browse/HARMONY-704
>      Project: Harmony
>         Type: Improvement

>   Components: Classlib
>     Reporter: Paulex Yang
>     Assignee: George Harley
>     Priority: Minor
>  Attachments: harmony-704.zip
>
> As I proposed on the mailing list, I'm going to refactor the nio buffers' tests, here goes the refactory for CharBuffer tests following Harmony-575. I'll attach patch soon.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira


[jira] Closed: (HARMONY-704) [classlib][nio]refactory nio buffer test step 2 - CharBuffer tests

Posted by "George Harley (JIRA)" <ji...@apache.org>.
     [ http://issues.apache.org/jira/browse/HARMONY-704?page=all ]
     
George Harley closed HARMONY-704:
---------------------------------


Verified by Paulex.

> [classlib][nio]refactory nio buffer test step 2 - CharBuffer tests
> ------------------------------------------------------------------
>
>          Key: HARMONY-704
>          URL: http://issues.apache.org/jira/browse/HARMONY-704
>      Project: Harmony
>         Type: Improvement

>   Components: Classlib
>     Reporter: Paulex Yang
>     Assignee: George Harley
>     Priority: Minor
>  Attachments: harmony-704.zip, harmony-704v2.zip
>
> As I proposed on the mailing list, I'm going to refactor the nio buffers' tests, here goes the refactory for CharBuffer tests following Harmony-575. I'll attach patch soon.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira


[jira] Commented: (HARMONY-704) [classlib][nio]refactory nio buffer test step 2 - CharBuffer tests

Posted by "Paulex Yang (JIRA)" <ji...@apache.org>.
    [ http://issues.apache.org/jira/browse/HARMONY-704?page=comments#action_12419999 ] 

Paulex Yang commented on HARMONY-704:
-------------------------------------

looks, fine, thank you, George.

> [classlib][nio]refactory nio buffer test step 2 - CharBuffer tests
> ------------------------------------------------------------------
>
>          Key: HARMONY-704
>          URL: http://issues.apache.org/jira/browse/HARMONY-704
>      Project: Harmony
>         Type: Improvement

>   Components: Classlib
>     Reporter: Paulex Yang
>     Assignee: George Harley
>     Priority: Minor
>  Attachments: harmony-704.zip, harmony-704v2.zip
>
> As I proposed on the mailing list, I'm going to refactor the nio buffers' tests, here goes the refactory for CharBuffer tests following Harmony-575. I'll attach patch soon.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira


[jira] Commented: (HARMONY-704) [classlib][nio]refactory nio buffer test step 2 - CharBuffer tests

Posted by "Paulex Yang (JIRA)" <ji...@apache.org>.
    [ http://issues.apache.org/jira/browse/HARMONY-704?page=comments#action_12418562 ] 

Paulex Yang commented on HARMONY-704:
-------------------------------------

George,

Very sorry for the inconvence caused, but you just caught a big bug of the test code!  

The setup() of CharBufferTest has tried to fill test data to buffer by statement below, and chars is a static char array
        buf = CharBuffer.wrap(chars);

but actually CharBuffer will use the chars as backing array, which means if writing to CharBuffer, the chars also been modified, that's definitely not what the setUp() intends to do.

And because Eclipse and Ant may run the test classes in different order, the tests may succeed in some cases while fail in others. 

I'll attach a new patch including the original one to fix this problem, thank you to point out this, and sorry again. 

> [classlib][nio]refactory nio buffer test step 2 - CharBuffer tests
> ------------------------------------------------------------------
>
>          Key: HARMONY-704
>          URL: http://issues.apache.org/jira/browse/HARMONY-704
>      Project: Harmony
>         Type: Improvement

>   Components: Classlib
>     Reporter: Paulex Yang
>     Assignee: George Harley
>     Priority: Minor
>  Attachments: harmony-704.zip
>
> As I proposed on the mailing list, I'm going to refactor the nio buffers' tests, here goes the refactory for CharBuffer tests following Harmony-575. I'll attach patch soon.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira


[jira] Updated: (HARMONY-704) [classlib][nio]refactory nio buffer test step 2 - CharBuffer tests

Posted by "Paulex Yang (JIRA)" <ji...@apache.org>.
     [ http://issues.apache.org/jira/browse/HARMONY-704?page=all ]

Paulex Yang updated HARMONY-704:
--------------------------------

    Attachment: harmony-704.zip

Please try this patch, I also fixed some exception compatiblity bugs of CharBuffer found during the test refactory, which is a demonstration why the refactory is necessary:).

> [classlib][nio]refactory nio buffer test step 2 - CharBuffer tests
> ------------------------------------------------------------------
>
>          Key: HARMONY-704
>          URL: http://issues.apache.org/jira/browse/HARMONY-704
>      Project: Harmony
>         Type: Improvement

>   Components: Classlib
>     Reporter: Paulex Yang
>     Priority: Minor
>  Attachments: harmony-704.zip
>
> As I proposed on the mailing list, I'm going to refactor the nio buffers' tests, here goes the refactory for CharBuffer tests following Harmony-575. I'll attach patch soon.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira


[jira] Commented: (HARMONY-704) [classlib][nio]refactory nio buffer test step 2 - CharBuffer tests

Posted by "George Harley (JIRA)" <ji...@apache.org>.
    [ http://issues.apache.org/jira/browse/HARMONY-704?page=comments#action_12418520 ] 

George Harley commented on HARMONY-704:
---------------------------------------

Hi Paulex, 

Thanks very much for the refactoring. Unfortunately I am seeing some very strange behaviour running these tests. Specifically, when I compile and run the tests on the command line using Ant and the "modern" javac compiler (with the target of "jsr14") I see one failure with the ReadOnlyCharBufferTest. The failure is in the inherited test method testCompareTo() at the point indicated below ...

public void testCompareTo() {
    // compare to self
    assertEquals(0, buf.compareTo(buf));

    assertTrue(buf.capacity() > SMALL_TEST_LENGTH);
    buf.clear();
    CharBuffer other = CharBuffer.allocate(buf.capacity());
    other.put(buf);
    other.clear();
    buf.clear();
    assertEquals(0, buf.compareTo(other));
    assertEquals(0, other.compareTo(buf));
    buf.position(1);
    assertTrue(buf.compareTo(other) > 0);  <------*****FAILS THIS ASSERT ****
    assertTrue(other.compareTo(buf) < 0);
    other.position(2);
    ...etc...

The baffling thing (for me) ws that if I compile and run the patched NIO test suite from inside Eclipse then everything works. My project settings for NIO are to use the 5.0 Eclipse compiler with a 1.4 target.

I have spent a long time checking and re-checking my environment as well as removing then re-applying your patch (more times than you would believe). It just doesn't make sense - which makes me wonder is this some quirk of using the jsr14 target with the modern/5.0 javac compiler ? My javac is the Sun 1.5.0_06. 

Some more fuel for the fire ...

* I can make the testCompareTo() test pass for the ReadOnlyCharBufferTest class if I run that test class on its own (i.e. as the only member of the test suite). 

* If running all of the patched NIO test suite then I can make the testCompareTo() test pass for the ReadOnlyCharBufferTest class if I modify its setUp() method so that there is a call to the inherited loadTestData1() method just before obtaining the read only buffer. So, when the ReadOnlyCharBufferTest setUp() method looks as below then everything passes ...

protected void setUp() throws Exception {
    super.setUp();
    loadTestData1(buf);                      <----- added this !!!!
    buf = buf.asReadOnlyBuffer();
    baseBuf = buf;
}

That addition was made purely on a hunch after looking at the setUp() methods of the other direct subtypes of CharBufferTest (e.g DirectCharBufferTest and HeapCharBufferTest) and the direct subtypes of ReadOnlyCharBufferTest (e.g. ReadOnlyHeapCharBufferTest and ReadOnlyWrappedCharBufferTest) which all employed loadTestData1() prior to finally setting buf. 

I still cannot understand the mechanism behind all of this and why it does not occur when the test classes are compiled and run inside of Eclipse. Please can you help me out here by confirming whether or not you are seeing this behaviour. 

Best regards, 
George




> [classlib][nio]refactory nio buffer test step 2 - CharBuffer tests
> ------------------------------------------------------------------
>
>          Key: HARMONY-704
>          URL: http://issues.apache.org/jira/browse/HARMONY-704
>      Project: Harmony
>         Type: Improvement

>   Components: Classlib
>     Reporter: Paulex Yang
>     Assignee: George Harley
>     Priority: Minor
>  Attachments: harmony-704.zip
>
> As I proposed on the mailing list, I'm going to refactor the nio buffers' tests, here goes the refactory for CharBuffer tests following Harmony-575. I'll attach patch soon.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira