/** * {@inheritDoc} */ @Override protected void processData(DefaultData defaultData, EntityManager entityManager) { if (defaultData instanceof HttpTimerData) { try { HttpTimerData original = (HttpTimerData) defaultData; HttpInfo httpInfo = getHttpInfo(original, entityManager); HttpTimerData clone = getClone(original); clone.setHttpInfo(httpInfo); entityManager.persist(clone); } catch (SerializationException e) { log.warn("TimerDataChartingCmrProcessor failed to clone the given HttpTimerData", e); } } else { timerDataAggregator.processTimerData((TimerData) defaultData); } }
/** * Tests the {@link TimerDataChartingCmrProcessor} when influx is active. */ @Test public void chartingProcessorInfluxActive() throws CloneNotSupportedException, SerializationException { TimerDataChartingCmrProcessor processor = new TimerDataChartingCmrProcessor(); processor.timerDataAggregator = timerDataAggregator; processor.serializationManager = serializationManager; processor.influxActive = true; // don't write TimerData timerData = new TimerData(); timerData.setCharting(true); processor.process(timerData, entityManager); verifyZeroInteractions(timerDataAggregator, entityManager); }
TimerDataChartingCmrProcessor processor = new TimerDataChartingCmrProcessor(); processor.timerDataAggregator = timerDataAggregator; processor.serializationManager = serializationManager; processor.process((DefaultData) null, entityManager); verifyZeroInteractions(timerDataAggregator, entityManager); processor.process(timerData, entityManager); processor.process(httpTimerData, entityManager); verifyZeroInteractions(timerDataAggregator, entityManager); processor.process(timerData, entityManager); processor.process(httpTimerData, entityManager);