@Test public void testAddMetricsWithServiceInInput() { AddMetricInputBuilder input = new AddMetricInputBuilder(); input.setMetricName("Test"); input.setMetricValue(new BigDecimal(10)); input.setNodeID("Test"); input.setTimeStamp(System.currentTimeMillis()); input.setTSDRDataCategory(DataCategory.EXTERNAL); input.setRecordKeys(new ArrayList<RecordKeys>()); impl.addMetric(input.build()); Mockito.verify(metricDataService, Mockito.atLeastOnce()) .storeTSDRMetricRecord(Mockito.any(StoreTSDRMetricRecordInput.class)); }
@Override public ListenableFuture<RpcResult<AddMetricOutput>> addMetric(AddMetricInput input) { TSDRMetricRecordBuilder builder = new TSDRMetricRecordBuilder(); builder.setMetricName(input.getMetricName()); builder.setMetricValue(input.getMetricValue()); builder.setNodeID(input.getNodeID()); builder.setTimeStamp(input.getTimeStamp()); builder.setTSDRDataCategory(input.getTSDRDataCategory()); builder.setRecordKeys(input.getRecordKeys()); StoreTSDRMetricRecordInputBuilder in = new StoreTSDRMetricRecordInputBuilder(); List<TSDRMetricRecord> list = new LinkedList<>(); list.add(builder.build()); in.setTSDRMetricRecord(list); store(in.build()); return RpcResultBuilder.success(new AddMetricOutputBuilder().build()).buildFuture(); }
TSDRNbiServiceImpl implements TSDRDataqueryImplService { @Override public ListenableFuture<RpcResult<AddMetricOutput>> addMetric(AddMetricInput input) { TSDRMetricRecordBuilder builder = new TSDRMetricRecordBuilder(); builder.setMetricName(input.getMetricName()); builder.setMetricValue(input.getMetricValue()); builder.setNodeID(input.getNodeID()); builder.setTimeStamp(input.getTimeStamp()); builder.setTSDRDataCategory(input.getTSDRDataCategory()); builder.setRecordKeys(input.getRecordKeys()); StoreTSDRMetricRecordInputBuilder in = new StoreTSDRMetricRecordInputBuilder(); List<TSDRMetricRecord> list = new LinkedList<>(); list.add(builder.build()); in.setTSDRMetricRecord(list); store(in.build()); return RpcResultBuilder.success(new AddMetricOutputBuilder().build()).buildFuture(); } }
TSDRNbiServiceImpl implements TSDRDataqueryImplService { @Override public ListenableFuture<RpcResult<AddMetricOutput>> addMetric(AddMetricInput input) { TSDRMetricRecordBuilder builder = new TSDRMetricRecordBuilder(); builder.setMetricName(input.getMetricName()); builder.setMetricValue(input.getMetricValue()); builder.setNodeID(input.getNodeID()); builder.setTimeStamp(input.getTimeStamp()); builder.setTSDRDataCategory(input.getTSDRDataCategory()); builder.setRecordKeys(input.getRecordKeys()); StoreTSDRMetricRecordInputBuilder in = new StoreTSDRMetricRecordInputBuilder(); List<TSDRMetricRecord> list = new LinkedList<>(); list.add(builder.build()); in.setTSDRMetricRecord(list); store(in.build()); return RpcResultBuilder.success(new AddMetricOutputBuilder().build()).buildFuture(); } @Inject  TSDRNbiServiceImpl(TsdrMetricDataService metricService, TsdrLogDataService logService); }
TSDRNbiServiceImpl implements TSDRDataqueryImplService { @Override public ListenableFuture<RpcResult<AddMetricOutput>> addMetric(AddMetricInput input) { TSDRMetricRecordBuilder builder = new TSDRMetricRecordBuilder(); builder.setMetricName(input.getMetricName()); builder.setMetricValue(input.getMetricValue()); builder.setNodeID(input.getNodeID()); builder.setTimeStamp(input.getTimeStamp()); builder.setTSDRDataCategory(input.getTSDRDataCategory()); builder.setRecordKeys(input.getRecordKeys()); StoreTSDRMetricRecordInputBuilder in = new StoreTSDRMetricRecordInputBuilder(); List<TSDRMetricRecord> list = new LinkedList<>(); list.add(builder.build()); in.setTSDRMetricRecord(list); store(in.build()); return RpcResultBuilder.success(new AddMetricOutputBuilder().build()).buildFuture(); } @Inject  TSDRNbiServiceImpl(TsdrMetricDataService metricService, TsdrLogDataService logService); @Override ListenableFuture<RpcResult<AddMetricOutput>> addMetric(AddMetricInput input); @Override ListenableFuture<RpcResult<AddLogOutput>> addLog(AddLogInput input); }
TSDRNbiServiceImpl implements TSDRDataqueryImplService { @Override public ListenableFuture<RpcResult<AddMetricOutput>> addMetric(AddMetricInput input) { TSDRMetricRecordBuilder builder = new TSDRMetricRecordBuilder(); builder.setMetricName(input.getMetricName()); builder.setMetricValue(input.getMetricValue()); builder.setNodeID(input.getNodeID()); builder.setTimeStamp(input.getTimeStamp()); builder.setTSDRDataCategory(input.getTSDRDataCategory()); builder.setRecordKeys(input.getRecordKeys()); StoreTSDRMetricRecordInputBuilder in = new StoreTSDRMetricRecordInputBuilder(); List<TSDRMetricRecord> list = new LinkedList<>(); list.add(builder.build()); in.setTSDRMetricRecord(list); store(in.build()); return RpcResultBuilder.success(new AddMetricOutputBuilder().build()).buildFuture(); } @Inject  TSDRNbiServiceImpl(TsdrMetricDataService metricService, TsdrLogDataService logService); @Override ListenableFuture<RpcResult<AddMetricOutput>> addMetric(AddMetricInput input); @Override ListenableFuture<RpcResult<AddLogOutput>> addLog(AddLogInput input);  }