Java 类javax.sql.rowset.serial.SerialStruct 实例源码

项目:cn1    文件:SQLOutputImplTest.java   
/**
 * @tests {@link javax.sql.rowset.serial.SQLOutputImpl#writeObject(java.sql.SQLData)}
 */
public void test_writeObjectLjava_sql_SQLData() throws SQLException {
    MockSQLData sqlData = new MockSQLData();
    sqlData.firstAttribute = "one";
    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());
}
项目:freeVM    文件:SQLOutputImplTest.java   
/**
 * @tests {@link javax.sql.rowset.serial.SQLOutputImpl#writeObject(java.sql.SQLData)}
 */
public void test_writeObjectLjava_sql_SQLData() throws SQLException {
    MockSQLData sqlData = new MockSQLData();
    sqlData.firstAttribute = "one";
    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());
}
项目:jdk8u-jdk    文件:SQLOutputImplTests.java   
@Test(enabled = true)
public void test08() throws Exception {
    Object[] attributes = new Object[]{"Bruce", "Wayne", 1939,
        "Batman"};
    Struct s = new StubStruct(sqlType, attributes);
    outImpl.writeStruct(s);
    SerialStruct ss = (SerialStruct) results.get(0);
    assertTrue(Arrays.equals(attributes, (Object[]) ss.getAttributes()));
    assertTrue(sqlType.equals(ss.getSQLTypeName()));
}
项目:jdk8u-jdk    文件:SQLOutputImplTests.java   
@Test(enabled = true)
public void test10() throws Exception {
    Object[] attributes = new Object[]{"Bruce", "Wayne", 1939,
        "Batman"};
    outImpl.writeObject(hero);
    SerialStruct ss = (SerialStruct) results.get(0);
    assertTrue(Arrays.equals(attributes, (Object[]) ss.getAttributes()));
    assertTrue(sqlType.equals(ss.getSQLTypeName()));
}
项目:jdk8u-jdk    文件:SerialStructTests.java   
/**
 * Validate that a SerialStruct that is serialized & deserialized is equal
 * to itself
 */
@Test
public void test08() throws Exception {
    SerialStruct ss = new SerialStruct(struct, map);
    SerialStruct ss1 = serializeDeserializeObject(ss);;
    assertTrue(ss.equals(ss1));
}
项目:openjdk-jdk10    文件:SQLOutputImplTests.java   
@Test(enabled = true)
public void test08() throws Exception {
    Object[] attributes = new Object[]{"Bruce", "Wayne", 1939,
        "Batman"};
    Struct s = new StubStruct(sqlType, attributes);
    outImpl.writeStruct(s);
    SerialStruct ss = (SerialStruct) results.get(0);
    assertTrue(Arrays.equals(attributes, (Object[]) ss.getAttributes()));
    assertTrue(sqlType.equals(ss.getSQLTypeName()));
}
项目:openjdk-jdk10    文件:SQLOutputImplTests.java   
@Test(enabled = true)
public void test10() throws Exception {
    Object[] attributes = new Object[]{"Bruce", "Wayne", 1939,
        "Batman"};
    outImpl.writeObject(hero);
    SerialStruct ss = (SerialStruct) results.get(0);
    assertTrue(Arrays.equals(attributes, (Object[]) ss.getAttributes()));
    assertTrue(sqlType.equals(ss.getSQLTypeName()));
}
项目:openjdk-jdk10    文件:SerialStructTests.java   
/**
 * Validate that a SerialStruct that is serialized & deserialized is equal
 * to itself
 */
@Test
public void test08() throws Exception {
    SerialStruct ss = new SerialStruct(struct, map);
    SerialStruct ss1 = serializeDeserializeObject(ss);;
    assertTrue(ss.equals(ss1));
}
项目:openjdk9    文件:SQLOutputImplTests.java   
@Test(enabled = true)
public void test08() throws Exception {
    Object[] attributes = new Object[]{"Bruce", "Wayne", 1939,
        "Batman"};
    Struct s = new StubStruct(sqlType, attributes);
    outImpl.writeStruct(s);
    SerialStruct ss = (SerialStruct) results.get(0);
    assertTrue(Arrays.equals(attributes, (Object[]) ss.getAttributes()));
    assertTrue(sqlType.equals(ss.getSQLTypeName()));
}
项目:openjdk9    文件:SQLOutputImplTests.java   
@Test(enabled = true)
public void test10() throws Exception {
    Object[] attributes = new Object[]{"Bruce", "Wayne", 1939,
        "Batman"};
    outImpl.writeObject(hero);
    SerialStruct ss = (SerialStruct) results.get(0);
    assertTrue(Arrays.equals(attributes, (Object[]) ss.getAttributes()));
    assertTrue(sqlType.equals(ss.getSQLTypeName()));
}
项目:openjdk9    文件:SerialStructTests.java   
/**
 * Validate that a SerialStruct that is serialized & deserialized is equal
 * to itself
 */
@Test
public void test08() throws Exception {
    SerialStruct ss = new SerialStruct(struct, map);
    SerialStruct ss1 = serializeDeserializeObject(ss);;
    assertTrue(ss.equals(ss1));
}
项目:jdk8u_jdk    文件:SQLOutputImplTests.java   
@Test(enabled = true)
public void test08() throws Exception {
    Object[] attributes = new Object[]{"Bruce", "Wayne", 1939,
        "Batman"};
    Struct s = new StubStruct(sqlType, attributes);
    outImpl.writeStruct(s);
    SerialStruct ss = (SerialStruct) results.get(0);
    assertTrue(Arrays.equals(attributes, (Object[]) ss.getAttributes()));
    assertTrue(sqlType.equals(ss.getSQLTypeName()));
}
项目:jdk8u_jdk    文件:SQLOutputImplTests.java   
@Test(enabled = true)
public void test10() throws Exception {
    Object[] attributes = new Object[]{"Bruce", "Wayne", 1939,
        "Batman"};
    outImpl.writeObject(hero);
    SerialStruct ss = (SerialStruct) results.get(0);
    assertTrue(Arrays.equals(attributes, (Object[]) ss.getAttributes()));
    assertTrue(sqlType.equals(ss.getSQLTypeName()));
}
项目:jdk8u_jdk    文件:SerialStructTests.java   
/**
 * Validate that a SerialStruct that is serialized & deserialized is equal
 * to itself
 */
@Test
public void test08() throws Exception {
    SerialStruct ss = new SerialStruct(struct, map);
    SerialStruct ss1 = serializeDeserializeObject(ss);;
    assertTrue(ss.equals(ss1));
}
项目:lookaside_java-1.8.0-openjdk    文件:SQLOutputImplTests.java   
@Test(enabled = true)
public void test08() throws Exception {
    Object[] attributes = new Object[]{"Bruce", "Wayne", 1939,
        "Batman"};
    Struct s = new StubStruct(sqlType, attributes);
    outImpl.writeStruct(s);
    SerialStruct ss = (SerialStruct) results.get(0);
    assertTrue(Arrays.equals(attributes, (Object[]) ss.getAttributes()));
    assertTrue(sqlType.equals(ss.getSQLTypeName()));
}
项目:lookaside_java-1.8.0-openjdk    文件:SQLOutputImplTests.java   
@Test(enabled = true)
public void test10() throws Exception {
    Object[] attributes = new Object[]{"Bruce", "Wayne", 1939,
        "Batman"};
    outImpl.writeObject(hero);
    SerialStruct ss = (SerialStruct) results.get(0);
    assertTrue(Arrays.equals(attributes, (Object[]) ss.getAttributes()));
    assertTrue(sqlType.equals(ss.getSQLTypeName()));
}
项目:lookaside_java-1.8.0-openjdk    文件:SerialStructTests.java   
/**
 * Validate that a SerialStruct that is serialized & deserialized is equal
 * to itself
 */
@Test
public void test08() throws Exception {
    SerialStruct ss = new SerialStruct(struct, map);
    SerialStruct ss1 = serializeDeserializeObject(ss);;
    assertTrue(ss.equals(ss1));
}
项目:teiid    文件:JDBCExecutionFactory.java   
protected Object convertObject(Object object) throws SQLException {
    if (object instanceof Struct) {
        switch (structRetrieval) {
        case OBJECT:
            return object;
        case ARRAY:
            return new ArrayImpl(((Struct)object).getAttributes());
        case COPY:
            return new SerialStruct((Struct)object, Collections.<String, Class<?>> emptyMap());
        }
    }
    return object;
}
项目:cn1    文件:SQLOutputImplTest.java   
/**
 * @tests {@link javax.sql.rowset.serial.SQLOutputImpl#writeStruct(java.sql.Struct)}
 */
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());
}
项目:cn1    文件:SerialStructTest.java   
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);
}
项目:freeVM    文件:SQLOutputImplTest.java   
/**
 * @tests {@link javax.sql.rowset.serial.SQLOutputImpl#writeStruct(java.sql.Struct)}
 */
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());
}
项目:freeVM    文件:SerialStructTest.java   
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);
}
项目:jdk8u-jdk    文件:SerialStructTests.java   
@Test
public void test01() throws Exception {
    SerialStruct ss = new SerialStruct(struct, map);
    assertEquals(ss.getSQLTypeName(), sqlType);
}
项目:jdk8u-jdk    文件:SerialStructTests.java   
@Test
public void test02() throws Exception {
    SerialStruct ss = new SerialStruct(hero, map);
    assertEquals(ss.getSQLTypeName(), sqlType);
}
项目:jdk8u-jdk    文件:SerialStructTests.java   
@Test
public void test03() throws Exception {
    SerialStruct ss = new SerialStruct(struct, map);
    assertTrue(Arrays.equals(attributes,
            ss.getAttributes()));
}
项目:jdk8u-jdk    文件:SerialStructTests.java   
@Test
public void test04() throws Exception {
    SerialStruct ss = new SerialStruct(hero, map);
    assertTrue(Arrays.equals(attributes,
            ss.getAttributes()));
}
项目:jdk8u-jdk    文件:SerialStructTests.java   
@Test
public void test05() throws Exception {
    SerialStruct ss = new SerialStruct(struct, map);
    assertTrue(Arrays.equals(attributes,
            ss.getAttributes(map)));
}
项目:jdk8u-jdk    文件:SerialStructTests.java   
@Test
public void test06() throws Exception {
    SerialStruct ss = new SerialStruct(hero, map);
    assertTrue(Arrays.equals(attributes,
            ss.getAttributes(map)));
}
项目:jdk8u-jdk    文件:SerialStructTests.java   
@Test
public void test07() throws Exception {
    SerialStruct ss = new SerialStruct(struct, map);
    SerialStruct ss1 = (SerialStruct) ss.clone();
    assertTrue(ss.equals(ss1));
}
项目:openjdk-jdk10    文件:SerialStructTests.java   
@Test
public void test01() throws Exception {
    SerialStruct ss = new SerialStruct(struct, map);
    assertEquals(ss.getSQLTypeName(), sqlType);
}
项目:openjdk-jdk10    文件:SerialStructTests.java   
@Test
public void test02() throws Exception {
    SerialStruct ss = new SerialStruct(hero, map);
    assertEquals(ss.getSQLTypeName(), sqlType);
}
项目:openjdk-jdk10    文件:SerialStructTests.java   
@Test
public void test03() throws Exception {
    SerialStruct ss = new SerialStruct(struct, map);
    assertTrue(Arrays.equals(attributes,
            ss.getAttributes()));
}
项目:openjdk-jdk10    文件:SerialStructTests.java   
@Test
public void test04() throws Exception {
    SerialStruct ss = new SerialStruct(hero, map);
    assertTrue(Arrays.equals(attributes,
            ss.getAttributes()));
}
项目:openjdk-jdk10    文件:SerialStructTests.java   
@Test
public void test05() throws Exception {
    SerialStruct ss = new SerialStruct(struct, map);
    assertTrue(Arrays.equals(attributes,
            ss.getAttributes(map)));
}
项目:openjdk-jdk10    文件:SerialStructTests.java   
@Test
public void test06() throws Exception {
    SerialStruct ss = new SerialStruct(hero, map);
    assertTrue(Arrays.equals(attributes,
            ss.getAttributes(map)));
}
项目:openjdk-jdk10    文件:SerialStructTests.java   
@Test
public void test07() throws Exception {
    SerialStruct ss = new SerialStruct(struct, map);
    SerialStruct ss1 = (SerialStruct) ss.clone();
    assertTrue(ss.equals(ss1));
}
项目:openjdk9    文件:SerialStructTests.java   
@Test
public void test01() throws Exception {
    SerialStruct ss = new SerialStruct(struct, map);
    assertEquals(ss.getSQLTypeName(), sqlType);
}
项目:openjdk9    文件:SerialStructTests.java   
@Test
public void test02() throws Exception {
    SerialStruct ss = new SerialStruct(hero, map);
    assertEquals(ss.getSQLTypeName(), sqlType);
}
项目:openjdk9    文件:SerialStructTests.java   
@Test
public void test03() throws Exception {
    SerialStruct ss = new SerialStruct(struct, map);
    assertTrue(Arrays.equals(attributes,
            ss.getAttributes()));
}
项目:openjdk9    文件:SerialStructTests.java   
@Test
public void test04() throws Exception {
    SerialStruct ss = new SerialStruct(hero, map);
    assertTrue(Arrays.equals(attributes,
            ss.getAttributes()));
}