@Test public void testProduce() throws Exception { TimedRecordEvent rpcEvent = generateTestRPCRecord(); Map<String, String> partitionKVs = Maps.newHashMap(); partitionKVs.put(TimePropertyEnum.DAY_DATE.toString(), rpcEvent.getDayDate()); List<Object> value = Lists.newArrayList(rpcEvent.getHost(), "default", "test_cube", "sandbox", "NULL", 80L, 3L, 3L, 0L, 0L, 0L, rpcEvent.getTime(), rpcEvent.getYear(), rpcEvent.getMonth(), rpcEvent.getWeekBeginDate(), rpcEvent.getDayTime(), rpcEvent.getTimeHour(), rpcEvent.getTimeMinute(), rpcEvent.getTimeSecond(), rpcEvent.getDayDate()); HiveProducerRecord.RecordKey key = new HiveProducerRecord.KeyBuilder("HIVE_metrics_query_rpc_test") .setDbName("KYLIN").setPartitionKVs(partitionKVs).build(); HiveProducerRecord target = new HiveProducerRecord(key, value); prepareMockForEvent(rpcEvent); assertEquals(target, hiveProducer.convertTo(rpcEvent)); }
HiveProducerRecord convertTo(Record record) throws Exception { Map<String, Object> rawValue = record.getValueRaw(); Map<String, String> partitionKVs = Maps.newHashMapWithExpectedSize(1); partitionKVs.put(TimePropertyEnum.DAY_DATE.toString(), rawValue.get(TimePropertyEnum.DAY_DATE.toString()).toString()); return parseToHiveProducerRecord(HiveReservoirReporter.getTableFromSubject(record.getSubject()), partitionKVs, rawValue); }
HiveProducer { HiveProducerRecord convertTo(Record record) throws Exception { Map<String, Object> rawValue = record.getValueRaw(); Map<String, String> partitionKVs = Maps.newHashMapWithExpectedSize(1); partitionKVs.put(TimePropertyEnum.DAY_DATE.toString(), rawValue.get(TimePropertyEnum.DAY_DATE.toString()).toString()); return parseToHiveProducerRecord(HiveReservoirReporter.getTableFromSubject(record.getSubject()), partitionKVs, rawValue); } }
HiveProducer { HiveProducerRecord convertTo(Record record) throws Exception { Map<String, Object> rawValue = record.getValueRaw(); Map<String, String> partitionKVs = Maps.newHashMapWithExpectedSize(1); partitionKVs.put(TimePropertyEnum.DAY_DATE.toString(), rawValue.get(TimePropertyEnum.DAY_DATE.toString()).toString()); return parseToHiveProducerRecord(HiveReservoirReporter.getTableFromSubject(record.getSubject()), partitionKVs, rawValue); } HiveProducer(String metricType, Properties props);   HiveProducer(String metricType, Properties props, HiveConf hiveConfig); }
HiveProducer { HiveProducerRecord convertTo(Record record) throws Exception { Map<String, Object> rawValue = record.getValueRaw(); Map<String, String> partitionKVs = Maps.newHashMapWithExpectedSize(1); partitionKVs.put(TimePropertyEnum.DAY_DATE.toString(), rawValue.get(TimePropertyEnum.DAY_DATE.toString()).toString()); return parseToHiveProducerRecord(HiveReservoirReporter.getTableFromSubject(record.getSubject()), partitionKVs, rawValue); } HiveProducer(String metricType, Properties props);   HiveProducer(String metricType, Properties props, HiveConf hiveConfig); void close(); void send(final Record record); void send(final List<Record> recordList); HiveProducerRecord parseToHiveProducerRecord(String tableName, Map<String, String> partitionKVs,
                                                        Map<String, Object> rawValue); }
HiveProducer { HiveProducerRecord convertTo(Record record) throws Exception { Map<String, Object> rawValue = record.getValueRaw(); Map<String, String> partitionKVs = Maps.newHashMapWithExpectedSize(1); partitionKVs.put(TimePropertyEnum.DAY_DATE.toString(), rawValue.get(TimePropertyEnum.DAY_DATE.toString()).toString()); return parseToHiveProducerRecord(HiveReservoirReporter.getTableFromSubject(record.getSubject()), partitionKVs, rawValue); } HiveProducer(String metricType, Properties props);   HiveProducer(String metricType, Properties props, HiveConf hiveConfig); void close(); void send(final Record record); void send(final List<Record> recordList); HiveProducerRecord parseToHiveProducerRecord(String tableName, Map<String, String> partitionKVs,
                                                        Map<String, Object> rawValue);  }