本文整理汇总了Java中com.cloudera.sqoop.testutil.MockResultSet.blobData方法的典型用法代码示例。如果您正苦于以下问题:Java MockResultSet.blobData方法的具体用法?Java MockResultSet.blobData怎么用?Java MockResultSet.blobData使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.cloudera.sqoop.testutil.MockResultSet
的用法示例。
在下文中一共展示了MockResultSet.blobData方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: testReadBlobRef
import com.cloudera.sqoop.testutil.MockResultSet; //导入方法依赖的package包/类
public void testReadBlobRef()
throws IOException, InterruptedException, SQLException {
// This should give us an inline BLOB.
ResultSet resultSet = new MockResultSet();
BlobRef blob = loader.readBlobRef(0, resultSet);
assertNotNull(blob);
assertFalse(blob.isExternal());
byte [] data = blob.getData();
byte [] blobData = MockResultSet.blobData();
assertEquals(blobData.length, data.length);
for (int i = 0; i < data.length; i++) {
assertEquals(blobData[i], data[i]);
}
// LOBs bigger than 4 bytes are now external.
conf.setLong(LargeObjectLoader.MAX_INLINE_LOB_LEN_KEY, 4);
blob = loader.readBlobRef(0, resultSet);
assertNotNull(blob);
assertTrue(blob.isExternal());
loader.close();
InputStream is = blob.getDataStream(conf, outDir);
byte [] buf = new byte[4096];
int bytes = is.read(buf, 0, 4096);
is.close();
assertEquals(blobData.length, bytes);
for (int i = 0; i < bytes; i++) {
assertEquals(blobData[i], buf[i]);
}
}