当前位置: 首页>>代码示例>>Java>>正文


Java SerialStruct类代码示例

本文整理汇总了Java中javax.sql.rowset.serial.SerialStruct的典型用法代码示例。如果您正苦于以下问题:Java SerialStruct类的具体用法?Java SerialStruct怎么用?Java SerialStruct使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


SerialStruct类属于javax.sql.rowset.serial包,在下文中一共展示了SerialStruct类的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: test_writeObjectLjava_sql_SQLData

import javax.sql.rowset.serial.SerialStruct; //导入依赖的package包/类
/**
 * @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());
}
 
开发者ID:shannah,项目名称:cn1,代码行数:20,代码来源:SQLOutputImplTest.java

示例2: test08

import javax.sql.rowset.serial.SerialStruct; //导入依赖的package包/类
@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()));
}
 
开发者ID:lambdalab-mirror,项目名称:jdk8u-jdk,代码行数:11,代码来源:SQLOutputImplTests.java

示例3: test10

import javax.sql.rowset.serial.SerialStruct; //导入依赖的package包/类
@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()));
}
 
开发者ID:lambdalab-mirror,项目名称:jdk8u-jdk,代码行数:10,代码来源:SQLOutputImplTests.java

示例4: test08

import javax.sql.rowset.serial.SerialStruct; //导入依赖的package包/类
/**
 * 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));
}
 
开发者ID:lambdalab-mirror,项目名称:jdk8u-jdk,代码行数:11,代码来源:SerialStructTests.java

示例5: convertObject

import javax.sql.rowset.serial.SerialStruct; //导入依赖的package包/类
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;
}
 
开发者ID:kenweezy,项目名称:teiid,代码行数:14,代码来源:JDBCExecutionFactory.java

示例6: test_writeStructLjava_sql_Struct

import javax.sql.rowset.serial.SerialStruct; //导入依赖的package包/类
/**
 * @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());
}
 
开发者ID:shannah,项目名称:cn1,代码行数:13,代码来源:SQLOutputImplTest.java

示例7: testSerialStructStructMapOfStringClassOfQ

import javax.sql.rowset.serial.SerialStruct; //导入依赖的package包/类
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);
}
 
开发者ID:shannah,项目名称:cn1,代码行数:15,代码来源:SerialStructTest.java

示例8: test01

import javax.sql.rowset.serial.SerialStruct; //导入依赖的package包/类
@Test
public void test01() throws Exception {
    SerialStruct ss = new SerialStruct(struct, map);
    assertEquals(ss.getSQLTypeName(), sqlType);
}
 
开发者ID:lambdalab-mirror,项目名称:jdk8u-jdk,代码行数:6,代码来源:SerialStructTests.java

示例9: test02

import javax.sql.rowset.serial.SerialStruct; //导入依赖的package包/类
@Test
public void test02() throws Exception {
    SerialStruct ss = new SerialStruct(hero, map);
    assertEquals(ss.getSQLTypeName(), sqlType);
}
 
开发者ID:lambdalab-mirror,项目名称:jdk8u-jdk,代码行数:6,代码来源:SerialStructTests.java

示例10: test03

import javax.sql.rowset.serial.SerialStruct; //导入依赖的package包/类
@Test
public void test03() throws Exception {
    SerialStruct ss = new SerialStruct(struct, map);
    assertTrue(Arrays.equals(attributes,
            ss.getAttributes()));
}
 
开发者ID:lambdalab-mirror,项目名称:jdk8u-jdk,代码行数:7,代码来源:SerialStructTests.java

示例11: test04

import javax.sql.rowset.serial.SerialStruct; //导入依赖的package包/类
@Test
public void test04() throws Exception {
    SerialStruct ss = new SerialStruct(hero, map);
    assertTrue(Arrays.equals(attributes,
            ss.getAttributes()));
}
 
开发者ID:lambdalab-mirror,项目名称:jdk8u-jdk,代码行数:7,代码来源:SerialStructTests.java

示例12: test05

import javax.sql.rowset.serial.SerialStruct; //导入依赖的package包/类
@Test
public void test05() throws Exception {
    SerialStruct ss = new SerialStruct(struct, map);
    assertTrue(Arrays.equals(attributes,
            ss.getAttributes(map)));
}
 
开发者ID:lambdalab-mirror,项目名称:jdk8u-jdk,代码行数:7,代码来源:SerialStructTests.java

示例13: test06

import javax.sql.rowset.serial.SerialStruct; //导入依赖的package包/类
@Test
public void test06() throws Exception {
    SerialStruct ss = new SerialStruct(hero, map);
    assertTrue(Arrays.equals(attributes,
            ss.getAttributes(map)));
}
 
开发者ID:lambdalab-mirror,项目名称:jdk8u-jdk,代码行数:7,代码来源:SerialStructTests.java

示例14: test07

import javax.sql.rowset.serial.SerialStruct; //导入依赖的package包/类
@Test
public void test07() throws Exception {
    SerialStruct ss = new SerialStruct(struct, map);
    SerialStruct ss1 = (SerialStruct) ss.clone();
    assertTrue(ss.equals(ss1));
}
 
开发者ID:lambdalab-mirror,项目名称:jdk8u-jdk,代码行数:7,代码来源:SerialStructTests.java


注:本文中的javax.sql.rowset.serial.SerialStruct类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。