Package javax.sql.rowset.serial

Examples of javax.sql.rowset.serial.SerialStruct


    public void test_writeStructLjava_sql_Struct() throws SQLException {
        Struct struct = new MockStruct(new Object[] {}, "mockStruct1");
        impl.writeStruct(struct);
        assertEquals(1, attr.size());
        assertTrue(attr.get(0) instanceof SerialStruct);
        SerialStruct ss = (SerialStruct) attr.get(0);
        assertEquals(0, ss.getAttributes().length);
        assertEquals("mockStruct1", ss.getSQLTypeName());
    }
View Full Code Here


    }

    public void testSerialStructStructMapOfStringClassOfQ()
            throws SerialException {
        Man sdata = new Man(1, new Name("Tony", "Wu"));
        SerialStruct ss = new SerialStruct(sdata, emptyMap);
        try {
            new SerialStruct((SerialStruct) null, emptyMap);
            fail("should throw NullPointerException.");
        } catch (NullPointerException e) {
            // expected.
        }
        new SerialStruct(ss, null);
        SerialStruct ss2 = new SerialStruct(ss, emptyMap);
        assertNotNull(ss2);
    }
View Full Code Here

        assertNotNull(ss2);
    }

    public void testGetAttributes() throws SerialException {
        Man sdata = new Man(1, new Name("Tony", "Wu"));
        SerialStruct ss = new SerialStruct(sdata, emptyMap);
        Object[] o = ss.getAttributes();
        assertSame(o, ss.getAttributes());
    }
View Full Code Here

        assertSame(o, ss.getAttributes());
    }

    public void testGetAttributesMapOfStringClassOfQ() throws SerialException {
        Man sdata = new Man(1, new Name("Tony", "Wu"));
        SerialStruct ss = new SerialStruct(sdata, emptyMap);
        Object[] o = ss.getAttributes(map);
        assertSame(o, ss.getAttributes(map));
    }
View Full Code Here

        assertSame(o, ss.getAttributes(map));
    }

    public void testGetSQLTypeName() throws SQLException {
        Man sdata = new Man(1, new Name("Tony", "Wu"));
        SerialStruct ss = new SerialStruct(sdata, emptyMap);
        assertEquals(sdata.getSQLTypeName(), ss.getSQLTypeName());

    }
View Full Code Here

        sqlData.secondAttribute = Boolean.FALSE;
        sqlData.thirdAttribute = "three";
        sqlData.fourthAttribute = Integer.valueOf(4);
        impl.writeObject(sqlData);
        assertTrue(attr.get(0) instanceof SerialStruct);
        SerialStruct struct = (SerialStruct) attr.get(0);
        Object[] attributes = struct.getAttributes();
        assertEquals(sqlData.firstAttribute, attributes[0]);
        assertEquals(sqlData.secondAttribute, attributes[1]);
        assertEquals(sqlData.thirdAttribute, attributes[2]);
        assertEquals(sqlData.fourthAttribute, attributes[3]);
        assertEquals("harmonytests.MockSQLData", struct.getSQLTypeName());
    }
View Full Code Here

        sqlData.secondAttribute = Boolean.FALSE;
        sqlData.thirdAttribute = "three";
        sqlData.fourthAttribute = Integer.valueOf(4);
        impl.writeObject(sqlData);
        assertTrue(attr.get(0) instanceof SerialStruct);
        SerialStruct struct = (SerialStruct) attr.get(0);
        Object[] attributes = struct.getAttributes();
        assertEquals(sqlData.firstAttribute, attributes[0]);
        assertEquals(sqlData.secondAttribute, attributes[1]);
        assertEquals(sqlData.thirdAttribute, attributes[2]);
        assertEquals(sqlData.fourthAttribute, attributes[3]);
        assertEquals("harmonytests.MockSQLData", struct.getSQLTypeName());
    }
View Full Code Here

    public void test_writeStructLjava_sql_Struct() throws SQLException {
        Struct struct = new MockStruct(new Object[] {}, "mockStruct1");
        impl.writeStruct(struct);
        assertEquals(1, attr.size());
        assertTrue(attr.get(0) instanceof SerialStruct);
        SerialStruct ss = (SerialStruct) attr.get(0);
        assertEquals(0, ss.getAttributes().length);
        assertEquals("mockStruct1", ss.getSQLTypeName());
    }
View Full Code Here

                        // read the values...
                        obj.readSQL(sqlInput, s.getSQLTypeName());
                        rsval = obj;
                    }
                } else if (rsval instanceof SQLData) {
                    rsval = new SerialStruct((SQLData)rsval, map);
                } else if (rsval instanceof Blob) {
                    rsval = new SerialBlob((Blob)rsval);
                } else if (rsval instanceof Clob) {
                    rsval = new SerialClob((Clob)rsval);
                } else if (rsval instanceof java.sql.Array) {
View Full Code Here

TOP

Related Classes of javax.sql.rowset.serial.SerialStruct

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.