本文整理汇总了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());
}
示例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()));
}
示例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()));
}
示例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));
}
示例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;
}
示例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());
}
示例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);
}
示例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);
}
示例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);
}
示例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()));
}
示例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()));
}
示例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)));
}
示例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)));
}
示例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));
}