本文整理汇总了Java中javax.sql.rowset.serial.SerialRef类的典型用法代码示例。如果您正苦于以下问题:Java SerialRef类的具体用法?Java SerialRef怎么用?Java SerialRef使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
SerialRef类属于javax.sql.rowset.serial包,在下文中一共展示了SerialRef类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: testAdvancedParameters
import javax.sql.rowset.serial.SerialRef; //导入依赖的package包/类
@DataProvider(name = "testAdvancedParameters")
private Object[][] testAdvancedParameters() throws SQLException {
byte[] bytes = new byte[10];
Ref aRef = new SerialRef(new StubRef("INTEGER", query));
Array aArray = new SerialArray(new StubArray("INTEGER", new Object[1]));
Blob aBlob = new SerialBlob(new StubBlob());
Clob aClob = new SerialClob(new StubClob());
Reader rdr = new StringReader(query);
InputStream is = new StringBufferInputStream(query);;
brs = new StubBaseRowSet();
brs.setBytes(1, bytes);
brs.setAsciiStream(2, is, query.length());
brs.setRef(3, aRef);
brs.setArray(4, aArray);
brs.setBlob(5, aBlob);
brs.setClob(6, aClob);
brs.setBinaryStream(7, is, query.length());
brs.setUnicodeStream(8, is, query.length());
brs.setCharacterStream(9, rdr, query.length());
return new Object[][]{
{1, bytes},
{2, is},
{3, aRef},
{4, aArray},
{5, aBlob},
{6, aClob},
{7, is},
{8, is},
{9, rdr}
};
}
示例2: test07
import javax.sql.rowset.serial.SerialRef; //导入依赖的package包/类
@Test(enabled = true)
public void test07() throws Exception {
Ref ref = new StubRef(sqlType, hero);
outImpl.writeRef(ref);
SerialRef sr = (SerialRef) results.get(0);
assertTrue(hero.equals(sr.getObject()));
}
示例3: test06
import javax.sql.rowset.serial.SerialRef; //导入依赖的package包/类
@Test
public void test06() throws Exception {
SerialRef sr = new SerialRef(ref);
assertTrue(hero.equals(sr.getObject()));
SuperHero h = new SuperHero(sqlType, "Dick", "Grayson", 1940, "Robin");
sr.setObject(h);
assertFalse(hero.equals(sr.getObject()));
}
示例4: test10
import javax.sql.rowset.serial.SerialRef; //导入依赖的package包/类
/**
* Validate that a SerialRef that is serialized & deserialized is equal to
* itself for the Object & baseTypeName
*/
@Test
public void test10() throws Exception {
SerialRef sr = new SerialRef(ref);
SerialRef sr1 = serializeDeserializeObject(sr);
assertTrue(sr1.getObject().equals(sr.getObject())
&& sr1.getBaseTypeName().equals(sr.getBaseTypeName()));
}
示例5: createDataTypesRows
import javax.sql.rowset.serial.SerialRef; //导入依赖的package包/类
protected void createDataTypesRows(RowSet crs) throws SQLException {
Integer aInteger = 100;
String aChar = "Oswald Cobblepot";
Long aLong = Long.MAX_VALUE;
Short aShort = Short.MAX_VALUE;
Double aDouble = Double.MAX_VALUE;
BigDecimal aBigDecimal = BigDecimal.ONE;
Boolean aBoolean = false;
Float aFloat = Float.MAX_VALUE;
Byte aByte = Byte.MAX_VALUE;
Date aDate = Date.valueOf(LocalDate.now());
Time aTime = Time.valueOf(LocalTime.now());
Timestamp aTimeStamp = Timestamp.valueOf(LocalDateTime.now());
Array aArray = new StubArray("INTEGER", new Object[1]);
Ref aRef = new SerialRef(new StubRef("INTEGER", query));
byte[] bytes = new byte[10];
crs.moveToInsertRow();
crs.updateInt(1, aInteger);
crs.updateString(2, aChar);
crs.updateString(3, aChar);
crs.updateLong(4, aLong);
crs.updateBoolean(5, aBoolean);
crs.updateShort(6, aShort);
crs.updateDouble(7, aDouble);
crs.updateBigDecimal(8, aBigDecimal);
crs.updateFloat(9, aFloat);
crs.updateByte(10, aByte);
crs.updateDate(11, aDate);
crs.updateTime(12, aTime);
crs.updateTimestamp(13, aTimeStamp);
crs.updateBytes(14, bytes);
crs.updateArray(15, aArray);
crs.updateRef(16, aRef);
crs.updateDouble(17, aDouble);
crs.insertRow();
crs.moveToCurrentRow();
}
示例6: setRef
import javax.sql.rowset.serial.SerialRef; //导入依赖的package包/类
public void setRef(int parameterIndex, Ref ref) throws SQLException {
if (parameterIndex < 1) {
throw new SQLException();
}
if (params == null) {
throw new SQLException();
}
params.put(Integer.valueOf(parameterIndex - 1), new SerialRef(ref));
}
示例7: testSetRef
import javax.sql.rowset.serial.SerialRef; //导入依赖的package包/类
public void testSetRef() throws SQLException {
BaseRowSetImpl brs = new BaseRowSetImpl();
brs.initParams();
Ref r = new MockRef();
brs.setRef(1, r);
Object[] params = brs.getParams();
assertNotNull(params);
assertEquals(1, params.length);
assertTrue(r != params[0]);
assertTrue("Should have stored a SerialRef",
params[0] instanceof SerialRef);
}
示例8: test_writeRefLjava_sql_Ref
import javax.sql.rowset.serial.SerialRef; //导入依赖的package包/类
/**
* @tests {@link javax.sql.rowset.serial.SQLOutputImpl#writeRef(Ref)}
*/
public void test_writeRefLjava_sql_Ref() throws SQLException {
Ref ref = new MockRef();
impl.writeRef(ref);
assertEquals(1, attr.size());
assertTrue(attr.get(0) instanceof SerialRef);
}
示例9: setUp
import javax.sql.rowset.serial.SerialRef; //导入依赖的package包/类
@Override
protected void setUp() throws Exception {
super.setUp();
ref = new MockRef();
sr = new SerialRef(ref);
MockAbnormalRef maf = new MockAbnormalRef();
sr2 = new SerialRef(maf);
}
示例10: setUp
import javax.sql.rowset.serial.SerialRef; //导入依赖的package包/类
@Override
protected void setUp() throws Exception {
super.setUp();
ref = new MockRef();
sr = new SerialRef(ref);
MockAbnormalRef maf = new MockAbnormalRef();
sr2 = new SerialRef(maf);
}
示例11: test01
import javax.sql.rowset.serial.SerialRef; //导入依赖的package包/类
@Test(expectedExceptions = SQLException.class)
public void test01() throws Exception {
SerialRef sr = new SerialRef(null);
}
示例12: test02
import javax.sql.rowset.serial.SerialRef; //导入依赖的package包/类
@Test(expectedExceptions = SQLException.class)
public void test02() throws Exception {
SerialRef sr = new SerialRef(new StubRef(null, hero));
}
示例13: test03
import javax.sql.rowset.serial.SerialRef; //导入依赖的package包/类
@Test
public void test03() throws Exception {
SerialRef sr = new SerialRef(ref);
assertEquals(sr.getBaseTypeName(), sqlType);
}
示例14: test04
import javax.sql.rowset.serial.SerialRef; //导入依赖的package包/类
@Test
public void test04() throws Exception {
SerialRef sr = new SerialRef(ref);
assertTrue(hero.equals(sr.getObject()));
}
示例15: test05
import javax.sql.rowset.serial.SerialRef; //导入依赖的package包/类
@Test(enabled = false)
public void test05() throws Exception {
SerialRef sr = new SerialRef(ref);
assertTrue(hero.equals(sr.getObject(map)));
}