@Test public void testDontRotate() throws Exception { final CommonStats commonStats = new CommonStats(); commonStats.store = new StoreStats(1000, 0); final IndexStatistics stats = IndexStatistics.create( "name", commonStats, commonStats, Collections.<ShardRouting>emptyList()); when(indices.getIndexStats("name")).thenReturn(stats); when(deflector.getNewestTargetName()).thenReturn("name"); when(clusterConfigService.get(SizeBasedRotationStrategyConfig.class)) .thenReturn(SizeBasedRotationStrategyConfig.create(100000L)); final SizeBasedRotationStrategy strategy = new SizeBasedRotationStrategy( indices, deflector, clusterConfigService, nodeId, auditEventSender); strategy.rotate(); verify(deflector, never()).cycle(); reset(deflector); }
public void add(CommonStats stats) { if (docs == null) { if (stats.docs() != null) { docs = new DocsStats(); docs.add(stats.docs()); } } else { docs.add(stats.docs()); } if (store == null) { if (stats.store() != null) { store = new StoreStats(); store.add(stats.store()); } } else { store.add(stats.store()); } if (indexing == null) { if (stats.indexing() != null) { indexing = new IndexingStats(); indexing.add(stats.indexing()); } } else { indexing.add(stats.indexing()); } if (get == null) { if (stats.get() != null) { get = new GetStats(); get.add(stats.get()); } } else { get.add(stats.get()); } if (search == null) { if (stats.search() != null) { search = new SearchStats(); search.add(stats.search()); } } else { search.add(stats.search()); } if (merge == null) { if (stats.merge() != null) { merge = new MergeStats(); merge.add(stats.merge()); } } else { merge.add(stats.merge()); } if (refresh == null) { if (stats.refresh() != null) { refresh = new RefreshStats(); refresh.add(stats.refresh()); } } else { refresh.add(stats.refresh()); } if (flush == null) { if (stats.flush() != null) { flush = new FlushStats(); flush.add(stats.flush()); } } else { flush.add(stats.flush()); } if (warmer == null) { if (stats.warmer() != null) { warmer = new WarmerStats(); warmer.add(stats.warmer()); } } else { warmer.add(stats.warmer()); } }