harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "George Harley (JIRA)" <j...@apache.org>
Subject [jira] Commented: (HARMONY-704) [classlib][nio]refactory nio buffer test step 2 - CharBuffer tests
Date Thu, 29 Jun 2006 19:32:30 GMT
    [ 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);
    CharBuffer other = CharBuffer.allocate(buf.capacity());
    assertEquals(0, buf.compareTo(other));
    assertEquals(0, other.compareTo(buf));
    assertTrue(buf.compareTo(other) > 0);  <------*****FAILS THIS ASSERT ****
    assertTrue(other.compareTo(buf) < 0);

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 {
    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, 

> [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:
For more information on JIRA, see:

View raw message