@SuppressWarnings("unchecked") @Test public void noSetterInteractions() { TimerData timerData = mock(TimerData.class); when(timerData.getTimeStamp()).thenReturn(new Timestamp(new Date().getTime())); when(timerData.getPlatformIdent()).thenReturn(10L); when(timerData.getMethodIdent()).thenReturn(20L); aggregator.processTimerData(timerData); verify(timerData, times(0)).setCount(anyLong()); verify(timerData, times(0)).setCpuDuration(anyDouble()); verify(timerData, times(0)).calculateCpuMax(anyDouble()); verify(timerData, times(0)).calculateCpuMin(anyDouble()); verify(timerData, times(0)).setDuration(anyDouble()); verify(timerData, times(0)).setExclusiveCount(anyLong()); verify(timerData, times(0)).setExclusiveDuration(anyDouble()); verify(timerData, times(0)).calculateExclusiveMax(anyDouble()); verify(timerData, times(0)).calculateExclusiveMin(anyDouble()); verify(timerData, times(0)).setId(anyLong()); verify(timerData, times(0)).calculateMax(anyDouble()); verify(timerData, times(0)).setMethodIdent(anyLong()); verify(timerData, times(0)).calculateMin(anyDouble()); verify(timerData, times(0)).setParameterContentData((Set<ParameterContentData>) anyObject()); verify(timerData, times(0)).setPlatformIdent(anyLong()); verify(timerData, times(0)).setSensorTypeIdent(anyLong()); verify(timerData, times(0)).setTimeStamp((Timestamp) anyObject()); verify(timerData, times(0)).setVariance(anyDouble()); }
public void processTimerData(TimerData timerData) { long aggregationTimestamp = getAlteredTimestamp(timerData); int cacheHash = getCacheHash(timerData.getPlatformIdent(), timerData.getMethodIdent(), aggregationTimestamp); persistAllLock.lock(); try { TimerData aggTimerData = map.get(cacheHash); if (aggTimerData == null) { aggTimerData = new DatabaseAggregatedTimerData(new Timestamp(aggregationTimestamp), timerData.getPlatformIdent(), timerData.getSensorTypeIdent(), timerData.getMethodIdent()); map.put(cacheHash, aggTimerData); queue.add(aggTimerData); if (null != timerDataAggregatorCacheCleaner) { timerDataAggregatorCacheCleaner.setMostRecentlyAdded(aggTimerData); } int count = elementCount.incrementAndGet(); while (maxElements < count) { TimerData oldest = queue.poll(); if (null != oldest) { map.remove(getCacheHash(oldest.getPlatformIdent(), oldest.getMethodIdent(), oldest.getTimeStamp().getTime())); persistList.add(oldest); count = elementCount.decrementAndGet(); } } } aggTimerData.aggregateTimerData(timerData); } finally { persistAllLock.unlock(); } }
TimerDataAggregator extends AbstractJpaDao<TimerData> { public void processTimerData(TimerData timerData) { long aggregationTimestamp = getAlteredTimestamp(timerData); int cacheHash = getCacheHash(timerData.getPlatformIdent(), timerData.getMethodIdent(), aggregationTimestamp); persistAllLock.lock(); try { TimerData aggTimerData = map.get(cacheHash); if (aggTimerData == null) { aggTimerData = new DatabaseAggregatedTimerData(new Timestamp(aggregationTimestamp), timerData.getPlatformIdent(), timerData.getSensorTypeIdent(), timerData.getMethodIdent()); map.put(cacheHash, aggTimerData); queue.add(aggTimerData); if (null != timerDataAggregatorCacheCleaner) { timerDataAggregatorCacheCleaner.setMostRecentlyAdded(aggTimerData); } int count = elementCount.incrementAndGet(); while (maxElements < count) { TimerData oldest = queue.poll(); if (null != oldest) { map.remove(getCacheHash(oldest.getPlatformIdent(), oldest.getMethodIdent(), oldest.getTimeStamp().getTime())); persistList.add(oldest); count = elementCount.decrementAndGet(); } } } aggTimerData.aggregateTimerData(timerData); } finally { persistAllLock.unlock(); } } }
TimerDataAggregator extends AbstractJpaDao<TimerData> { public void processTimerData(TimerData timerData) { long aggregationTimestamp = getAlteredTimestamp(timerData); int cacheHash = getCacheHash(timerData.getPlatformIdent(), timerData.getMethodIdent(), aggregationTimestamp); persistAllLock.lock(); try { TimerData aggTimerData = map.get(cacheHash); if (aggTimerData == null) { aggTimerData = new DatabaseAggregatedTimerData(new Timestamp(aggregationTimestamp), timerData.getPlatformIdent(), timerData.getSensorTypeIdent(), timerData.getMethodIdent()); map.put(cacheHash, aggTimerData); queue.add(aggTimerData); if (null != timerDataAggregatorCacheCleaner) { timerDataAggregatorCacheCleaner.setMostRecentlyAdded(aggTimerData); } int count = elementCount.incrementAndGet(); while (maxElements < count) { TimerData oldest = queue.poll(); if (null != oldest) { map.remove(getCacheHash(oldest.getPlatformIdent(), oldest.getMethodIdent(), oldest.getTimeStamp().getTime())); persistList.add(oldest); count = elementCount.decrementAndGet(); } } } aggTimerData.aggregateTimerData(timerData); } finally { persistAllLock.unlock(); } } @Autowired  TimerDataAggregator(PlatformTransactionManager transactionManager); }
TimerDataAggregator extends AbstractJpaDao<TimerData> { public void processTimerData(TimerData timerData) { long aggregationTimestamp = getAlteredTimestamp(timerData); int cacheHash = getCacheHash(timerData.getPlatformIdent(), timerData.getMethodIdent(), aggregationTimestamp); persistAllLock.lock(); try { TimerData aggTimerData = map.get(cacheHash); if (aggTimerData == null) { aggTimerData = new DatabaseAggregatedTimerData(new Timestamp(aggregationTimestamp), timerData.getPlatformIdent(), timerData.getSensorTypeIdent(), timerData.getMethodIdent()); map.put(cacheHash, aggTimerData); queue.add(aggTimerData); if (null != timerDataAggregatorCacheCleaner) { timerDataAggregatorCacheCleaner.setMostRecentlyAdded(aggTimerData); } int count = elementCount.incrementAndGet(); while (maxElements < count) { TimerData oldest = queue.poll(); if (null != oldest) { map.remove(getCacheHash(oldest.getPlatformIdent(), oldest.getMethodIdent(), oldest.getTimeStamp().getTime())); persistList.add(oldest); count = elementCount.decrementAndGet(); } } } aggTimerData.aggregateTimerData(timerData); } finally { persistAllLock.unlock(); } } @Autowired  TimerDataAggregator(PlatformTransactionManager transactionManager); void processTimerData(TimerData timerData); void removeAndPersistAll(); @PostConstruct void postConstruct(); long getAggregationPeriod(); int getMaxElements(); long getCacheCleanSleepingPeriod(); int getElementCount(); }
TimerDataAggregator extends AbstractJpaDao<TimerData> { public void processTimerData(TimerData timerData) { long aggregationTimestamp = getAlteredTimestamp(timerData); int cacheHash = getCacheHash(timerData.getPlatformIdent(), timerData.getMethodIdent(), aggregationTimestamp); persistAllLock.lock(); try { TimerData aggTimerData = map.get(cacheHash); if (aggTimerData == null) { aggTimerData = new DatabaseAggregatedTimerData(new Timestamp(aggregationTimestamp), timerData.getPlatformIdent(), timerData.getSensorTypeIdent(), timerData.getMethodIdent()); map.put(cacheHash, aggTimerData); queue.add(aggTimerData); if (null != timerDataAggregatorCacheCleaner) { timerDataAggregatorCacheCleaner.setMostRecentlyAdded(aggTimerData); } int count = elementCount.incrementAndGet(); while (maxElements < count) { TimerData oldest = queue.poll(); if (null != oldest) { map.remove(getCacheHash(oldest.getPlatformIdent(), oldest.getMethodIdent(), oldest.getTimeStamp().getTime())); persistList.add(oldest); count = elementCount.decrementAndGet(); } } } aggTimerData.aggregateTimerData(timerData); } finally { persistAllLock.unlock(); } } @Autowired  TimerDataAggregator(PlatformTransactionManager transactionManager); void processTimerData(TimerData timerData); void removeAndPersistAll(); @PostConstruct void postConstruct(); long getAggregationPeriod(); int getMaxElements(); long getCacheCleanSleepingPeriod(); int getElementCount();  }