You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@harmony.apache.org by "Sean Qiu (JIRA)" <ji...@apache.org> on 2007/03/15 08:57:09 UTC

[jira] Created: (HARMONY-3400) [classlib][luni] Add testcase for ObjectInputStream's resolveObject(Object) function

[classlib][luni] Add testcase for ObjectInputStream's resolveObject(Object) function
------------------------------------------------------------------------------------

                 Key: HARMONY-3400
                 URL: https://issues.apache.org/jira/browse/HARMONY-3400
             Project: Harmony
          Issue Type: Improvement
          Components: Classlib
         Environment: ubuntu
            Reporter: Sean Qiu


Add missing test case for java.io.ObjectInputStream#resolveObject(Object)
Exist testcase only test the subclass' resolveObject rather than testing the super one.

--------- Add test in ObjectInputStreamTest.java---------------------

    static class ObjectInputStreamWithResolveObject extends ObjectInputStream {
        public ObjectInputStreamWithResolveObject(InputStream in) throws IOException {
            super(in);
            enableResolveObject(true);
        }
        
        protected Object resolveObject(Object obj) throws IOException {
            if(obj instanceof Integer){
                obj = new Integer(1000);
            }
            return super.resolveObject(obj);
        }        
    }
    
    /**
     * @tests java.io.ObjectInputStream#resolveObject(Object)
     */
    public void test_resolveObjectLjava_lang_Object() throws Exception {
        // Write an Integer object into memory
        Integer original = new Integer(10);
        ByteArrayOutputStream baos = new ByteArrayOutputStream();
        ObjectOutputStream oos = new ObjectOutputStream(baos);
        oos.writeObject(original);
        oos.flush();
        oos.close();

        // Read the object from memory
        byte[] bytes = baos.toByteArray();
        ByteArrayInputStream bais = new ByteArrayInputStream(bytes);
        ObjectInputStreamWithResolveObject ois = 
            new ObjectInputStreamWithResolveObject(bais);
        Integer actual = (Integer) ois.readObject();
        ois.close();

        // object should be resolved from 10 to 1000 
        assertEquals(new Integer(1000), actual);
    }

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


[jira] Closed: (HARMONY-3400) [classlib][luni] Add testcase for ObjectInputStream's resolveObject(Object) function

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

Sean Qiu closed HARMONY-3400.
-----------------------------


> [classlib][luni] Add testcase for ObjectInputStream's resolveObject(Object) function
> ------------------------------------------------------------------------------------
>
>                 Key: HARMONY-3400
>                 URL: https://issues.apache.org/jira/browse/HARMONY-3400
>             Project: Harmony
>          Issue Type: Improvement
>          Components: Classlib
>         Environment: ubuntu
>            Reporter: Sean Qiu
>            Assignee: Richard Liang
>         Attachments: Harmony-3400.diff
>
>
> Add missing test case for java.io.ObjectInputStream#resolveObject(Object)
> Exist testcase only test the subclass' resolveObject rather than testing the super one.
> --------- Add test in ObjectInputStreamTest.java---------------------
>     static class ObjectInputStreamWithResolveObject extends ObjectInputStream {
>         public ObjectInputStreamWithResolveObject(InputStream in) throws IOException {
>             super(in);
>             enableResolveObject(true);
>         }
>         
>         protected Object resolveObject(Object obj) throws IOException {
>             if(obj instanceof Integer){
>                 obj = new Integer(1000);
>             }
>             return super.resolveObject(obj);
>         }        
>     }
>     
>     /**
>      * @tests java.io.ObjectInputStream#resolveObject(Object)
>      */
>     public void test_resolveObjectLjava_lang_Object() throws Exception {
>         // Write an Integer object into memory
>         Integer original = new Integer(10);
>         ByteArrayOutputStream baos = new ByteArrayOutputStream();
>         ObjectOutputStream oos = new ObjectOutputStream(baos);
>         oos.writeObject(original);
>         oos.flush();
>         oos.close();
>         // Read the object from memory
>         byte[] bytes = baos.toByteArray();
>         ByteArrayInputStream bais = new ByteArrayInputStream(bytes);
>         ObjectInputStreamWithResolveObject ois = 
>             new ObjectInputStreamWithResolveObject(bais);
>         Integer actual = (Integer) ois.readObject();
>         ois.close();
>         // object should be resolved from 10 to 1000 
>         assertEquals(new Integer(1000), actual);
>     }

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


[jira] Resolved: (HARMONY-3400) [classlib][luni] Add testcase for ObjectInputStream's resolveObject(Object) function

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

Richard Liang resolved HARMONY-3400.
------------------------------------

    Resolution: Fixed

Hello Sean,

The patch has been applied at revision r518898 with minor modifications, thanks a lot for this enhancement.

Best regards,
Richard

> [classlib][luni] Add testcase for ObjectInputStream's resolveObject(Object) function
> ------------------------------------------------------------------------------------
>
>                 Key: HARMONY-3400
>                 URL: https://issues.apache.org/jira/browse/HARMONY-3400
>             Project: Harmony
>          Issue Type: Improvement
>          Components: Classlib
>         Environment: ubuntu
>            Reporter: Sean Qiu
>         Assigned To: Richard Liang
>         Attachments: Harmony-3400.diff
>
>
> Add missing test case for java.io.ObjectInputStream#resolveObject(Object)
> Exist testcase only test the subclass' resolveObject rather than testing the super one.
> --------- Add test in ObjectInputStreamTest.java---------------------
>     static class ObjectInputStreamWithResolveObject extends ObjectInputStream {
>         public ObjectInputStreamWithResolveObject(InputStream in) throws IOException {
>             super(in);
>             enableResolveObject(true);
>         }
>         
>         protected Object resolveObject(Object obj) throws IOException {
>             if(obj instanceof Integer){
>                 obj = new Integer(1000);
>             }
>             return super.resolveObject(obj);
>         }        
>     }
>     
>     /**
>      * @tests java.io.ObjectInputStream#resolveObject(Object)
>      */
>     public void test_resolveObjectLjava_lang_Object() throws Exception {
>         // Write an Integer object into memory
>         Integer original = new Integer(10);
>         ByteArrayOutputStream baos = new ByteArrayOutputStream();
>         ObjectOutputStream oos = new ObjectOutputStream(baos);
>         oos.writeObject(original);
>         oos.flush();
>         oos.close();
>         // Read the object from memory
>         byte[] bytes = baos.toByteArray();
>         ByteArrayInputStream bais = new ByteArrayInputStream(bytes);
>         ObjectInputStreamWithResolveObject ois = 
>             new ObjectInputStreamWithResolveObject(bais);
>         Integer actual = (Integer) ois.readObject();
>         ois.close();
>         // object should be resolved from 10 to 1000 
>         assertEquals(new Integer(1000), actual);
>     }

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


[jira] Assigned: (HARMONY-3400) [classlib][luni] Add testcase for ObjectInputStream's resolveObject(Object) function

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

Richard Liang reassigned HARMONY-3400:
--------------------------------------

    Assignee: Richard Liang

> [classlib][luni] Add testcase for ObjectInputStream's resolveObject(Object) function
> ------------------------------------------------------------------------------------
>
>                 Key: HARMONY-3400
>                 URL: https://issues.apache.org/jira/browse/HARMONY-3400
>             Project: Harmony
>          Issue Type: Improvement
>          Components: Classlib
>         Environment: ubuntu
>            Reporter: Sean Qiu
>         Assigned To: Richard Liang
>         Attachments: Harmony-3400.diff
>
>
> Add missing test case for java.io.ObjectInputStream#resolveObject(Object)
> Exist testcase only test the subclass' resolveObject rather than testing the super one.
> --------- Add test in ObjectInputStreamTest.java---------------------
>     static class ObjectInputStreamWithResolveObject extends ObjectInputStream {
>         public ObjectInputStreamWithResolveObject(InputStream in) throws IOException {
>             super(in);
>             enableResolveObject(true);
>         }
>         
>         protected Object resolveObject(Object obj) throws IOException {
>             if(obj instanceof Integer){
>                 obj = new Integer(1000);
>             }
>             return super.resolveObject(obj);
>         }        
>     }
>     
>     /**
>      * @tests java.io.ObjectInputStream#resolveObject(Object)
>      */
>     public void test_resolveObjectLjava_lang_Object() throws Exception {
>         // Write an Integer object into memory
>         Integer original = new Integer(10);
>         ByteArrayOutputStream baos = new ByteArrayOutputStream();
>         ObjectOutputStream oos = new ObjectOutputStream(baos);
>         oos.writeObject(original);
>         oos.flush();
>         oos.close();
>         // Read the object from memory
>         byte[] bytes = baos.toByteArray();
>         ByteArrayInputStream bais = new ByteArrayInputStream(bytes);
>         ObjectInputStreamWithResolveObject ois = 
>             new ObjectInputStreamWithResolveObject(bais);
>         Integer actual = (Integer) ois.readObject();
>         ois.close();
>         // object should be resolved from 10 to 1000 
>         assertEquals(new Integer(1000), actual);
>     }

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


[jira] Updated: (HARMONY-3400) [classlib][luni] Add testcase for ObjectInputStream's resolveObject(Object) function

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

Sean Qiu updated HARMONY-3400:
------------------------------

    Attachment: Harmony-3400.diff

Would you please try my patch? thanks a lot!

> [classlib][luni] Add testcase for ObjectInputStream's resolveObject(Object) function
> ------------------------------------------------------------------------------------
>
>                 Key: HARMONY-3400
>                 URL: https://issues.apache.org/jira/browse/HARMONY-3400
>             Project: Harmony
>          Issue Type: Improvement
>          Components: Classlib
>         Environment: ubuntu
>            Reporter: Sean Qiu
>         Attachments: Harmony-3400.diff
>
>
> Add missing test case for java.io.ObjectInputStream#resolveObject(Object)
> Exist testcase only test the subclass' resolveObject rather than testing the super one.
> --------- Add test in ObjectInputStreamTest.java---------------------
>     static class ObjectInputStreamWithResolveObject extends ObjectInputStream {
>         public ObjectInputStreamWithResolveObject(InputStream in) throws IOException {
>             super(in);
>             enableResolveObject(true);
>         }
>         
>         protected Object resolveObject(Object obj) throws IOException {
>             if(obj instanceof Integer){
>                 obj = new Integer(1000);
>             }
>             return super.resolveObject(obj);
>         }        
>     }
>     
>     /**
>      * @tests java.io.ObjectInputStream#resolveObject(Object)
>      */
>     public void test_resolveObjectLjava_lang_Object() throws Exception {
>         // Write an Integer object into memory
>         Integer original = new Integer(10);
>         ByteArrayOutputStream baos = new ByteArrayOutputStream();
>         ObjectOutputStream oos = new ObjectOutputStream(baos);
>         oos.writeObject(original);
>         oos.flush();
>         oos.close();
>         // Read the object from memory
>         byte[] bytes = baos.toByteArray();
>         ByteArrayInputStream bais = new ByteArrayInputStream(bytes);
>         ObjectInputStreamWithResolveObject ois = 
>             new ObjectInputStreamWithResolveObject(bais);
>         Integer actual = (Integer) ois.readObject();
>         ois.close();
>         // object should be resolved from 10 to 1000 
>         assertEquals(new Integer(1000), actual);
>     }

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


[jira] Commented: (HARMONY-3400) [classlib][luni] Add testcase for ObjectInputStream's resolveObject(Object) function

Posted by "Sean Qiu (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/HARMONY-3400?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12504085 ] 

Sean Qiu commented on HARMONY-3400:
-----------------------------------

Thanks, Richard.
Verified by Sean at revision r518898

> [classlib][luni] Add testcase for ObjectInputStream's resolveObject(Object) function
> ------------------------------------------------------------------------------------
>
>                 Key: HARMONY-3400
>                 URL: https://issues.apache.org/jira/browse/HARMONY-3400
>             Project: Harmony
>          Issue Type: Improvement
>          Components: Classlib
>         Environment: ubuntu
>            Reporter: Sean Qiu
>            Assignee: Richard Liang
>         Attachments: Harmony-3400.diff
>
>
> Add missing test case for java.io.ObjectInputStream#resolveObject(Object)
> Exist testcase only test the subclass' resolveObject rather than testing the super one.
> --------- Add test in ObjectInputStreamTest.java---------------------
>     static class ObjectInputStreamWithResolveObject extends ObjectInputStream {
>         public ObjectInputStreamWithResolveObject(InputStream in) throws IOException {
>             super(in);
>             enableResolveObject(true);
>         }
>         
>         protected Object resolveObject(Object obj) throws IOException {
>             if(obj instanceof Integer){
>                 obj = new Integer(1000);
>             }
>             return super.resolveObject(obj);
>         }        
>     }
>     
>     /**
>      * @tests java.io.ObjectInputStream#resolveObject(Object)
>      */
>     public void test_resolveObjectLjava_lang_Object() throws Exception {
>         // Write an Integer object into memory
>         Integer original = new Integer(10);
>         ByteArrayOutputStream baos = new ByteArrayOutputStream();
>         ObjectOutputStream oos = new ObjectOutputStream(baos);
>         oos.writeObject(original);
>         oos.flush();
>         oos.close();
>         // Read the object from memory
>         byte[] bytes = baos.toByteArray();
>         ByteArrayInputStream bais = new ByteArrayInputStream(bytes);
>         ObjectInputStreamWithResolveObject ois = 
>             new ObjectInputStreamWithResolveObject(bais);
>         Integer actual = (Integer) ois.readObject();
>         ois.close();
>         // object should be resolved from 10 to 1000 
>         assertEquals(new Integer(1000), actual);
>     }

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