本文整理汇总了Java中org.apache.tajo.util.TestProtos.TestMessageProto.getDefaultInstance方法的典型用法代码示例。如果您正苦于以下问题:Java TestMessageProto.getDefaultInstance方法的具体用法?Java TestMessageProto.getDefaultInstance怎么用?Java TestMessageProto.getDefaultInstance使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.apache.tajo.util.TestProtos.TestMessageProto
的用法示例。
在下文中一共展示了TestMessageProto.getDefaultInstance方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: testWriteLoadProtoFromFile
import org.apache.tajo.util.TestProtos.TestMessageProto; //导入方法依赖的package包/类
@Test
public final void testWriteLoadProtoFromFile() throws IOException {
File file = new File(TEST_PATH+"/file.bin");
file.createNewFile();
FileUtil.writeProto(file, proto);
Message defaultInstance = TestMessageProto.getDefaultInstance();
TestMessageProto message = (TestMessageProto)
FileUtil.loadProto(new File(TEST_PATH+"/file.bin"), defaultInstance);
assertEquals(proto, message);
}
示例2: testWriteLoadProtoFromStream
import org.apache.tajo.util.TestProtos.TestMessageProto; //导入方法依赖的package包/类
@Test
public final void testWriteLoadProtoFromStream() throws IOException {
FileOutputStream out = new FileOutputStream(new File(TEST_PATH+"/file.bin"));
FileUtil.writeProto(out, proto);
FileInputStream in = new FileInputStream(new File(TEST_PATH+"/file.bin"));
Message defaultInstance = TestMessageProto.getDefaultInstance();
TestMessageProto message = (TestMessageProto)
FileUtil.loadProto(in, defaultInstance);
assertEquals(proto, message);
}
示例3: testWriteLoadProtoFromPath
import org.apache.tajo.util.TestProtos.TestMessageProto; //导入方法依赖的package包/类
@Test
public final void testWriteLoadProtoFromPath() throws IOException {
Path path = new Path(TEST_PATH+"/file.bin");
Configuration conf = new Configuration();
FileSystem localFS = FileSystem.getLocal(conf);
FileUtil.writeProto(localFS, path, proto);
Message defaultInstance = TestMessageProto.getDefaultInstance();
TestMessageProto message = (TestMessageProto)
FileUtil.loadProto(localFS, new Path(TEST_PATH+"/file.bin"),
defaultInstance);
assertEquals(proto, message);
}