当前位置: 首页>>代码示例>>Java>>正文


Java TestMessageProto类代码示例

本文整理汇总了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();
}
 
开发者ID:apache,项目名称:incubator-tajo,代码行数:16,代码来源:TestFileUtils.java

示例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);
}
 
开发者ID:apache,项目名称:incubator-tajo,代码行数:13,代码来源:TestFileUtils.java

示例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);
}
 
开发者ID:apache,项目名称:incubator-tajo,代码行数:14,代码来源:TestFileUtils.java

示例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);
}
 
开发者ID:apache,项目名称:incubator-tajo,代码行数:15,代码来源:TestFileUtils.java


注:本文中的org.apache.tajo.util.TestProtos.TestMessageProto类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。