本文整理汇总了Java中org.apache.tajo.util.TestProtos.TestMessageProto类的典型用法代码示例。如果您正苦于以下问题:Java TestMessageProto类的具体用法?Java TestMessageProto怎么用?Java TestMessageProto使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
TestMessageProto类属于org.apache.tajo.util.TestProtos包,在下文中一共展示了TestMessageProto类的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: setUp
import org.apache.tajo.util.TestProtos.TestMessageProto; //导入依赖的package包/类
@Before
public void setUp() throws Exception {
TestMessageProto.Builder builder = TestMessageProto.newBuilder();
builder.setName("TestFileUtils");
builder.setAge(30);
builder.setAddr(TestFileUtils.class.getName());
proto = builder.build();
File testDir = new File(TEST_PATH);
if(testDir.exists()) {
testDir.delete();
}
testDir.mkdirs();
}
示例2: 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);
}
示例3: 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);
}
示例4: 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);
}