TestConstructQuery.java
上传用户:quxuerui
上传日期:2018-01-08
资源大小:41811k
文件大小:1k
- package org.apache.hadoop.mapred.lib.db;
- import org.apache.hadoop.io.NullWritable;
- import junit.framework.TestCase;
- public class TestConstructQuery extends TestCase {
- public void testConstructQuery() {
- DBOutputFormat<DBWritable, NullWritable> format = new DBOutputFormat<DBWritable, NullWritable>();
- String expected = "INSERT INTO hadoop_output (id,name,value) VALUES (?,?,?);";
- String[] fieldNames = new String[] { "id", "name", "value" };
- String actual = format.constructQuery("hadoop_output", fieldNames);
- assertEquals(expected, actual);
- expected = "INSERT INTO hadoop_output VALUES (?,?,?);";
- fieldNames = new String[] { null, null, null };
- actual = format.constructQuery("hadoop_output", fieldNames);
- assertEquals(expected, actual);
- }
- }