public RepositoryImpl(@Nonnull ContentRepository contentRepository, @Nonnull Whiteboard whiteboard, @Nonnull SecurityProvider securityProvider, int observationQueueLength, CommitRateLimiter commitRateLimiter, boolean fastQueryResultSize) { this.contentRepository = checkNotNull(contentRepository); this.whiteboard = checkNotNull(whiteboard); this.securityProvider = checkNotNull(securityProvider); this.observationQueueLength = observationQueueLength; this.commitRateLimiter = commitRateLimiter; this.descriptors = determineDescriptors(); this.statisticManager = new StatisticManager(whiteboard, scheduledExecutor); this.clock = new Clock.Fast(scheduledExecutor); this.gcMonitorRegistration = whiteboard.register(GCMonitor.class, gcMonitor, emptyMap()); this.fastQueryResultSize = fastQueryResultSize; this.mountInfoProvider = WhiteboardUtils.getService(whiteboard, MountInfoProvider.class); }
public RepositoryImpl(@NotNull ContentRepository contentRepository, @NotNull Whiteboard whiteboard, @NotNull SecurityProvider securityProvider, int observationQueueLength, CommitRateLimiter commitRateLimiter, boolean fastQueryResultSize) { this.contentRepository = checkNotNull(contentRepository); this.whiteboard = checkNotNull(whiteboard); this.securityProvider = checkNotNull(securityProvider); this.observationQueueLength = observationQueueLength; this.commitRateLimiter = commitRateLimiter; this.descriptors = determineDescriptors(); this.statisticManager = new StatisticManager(whiteboard, scheduledExecutor); this.clock = new Clock.Fast(scheduledExecutor); this.gcMonitorRegistration = whiteboard.register(GCMonitor.class, gcMonitor, emptyMap()); this.fastQueryResultSize = fastQueryResultSize; this.mountInfoProvider = WhiteboardUtils.getService(whiteboard, MountInfoProvider.class); this.blobAccessProvider = WhiteboardUtils.getService(whiteboard, BlobAccessProvider.class); }
public RepositoryImpl(@NotNull ContentRepository contentRepository, @NotNull Whiteboard whiteboard, @NotNull SecurityProvider securityProvider, int observationQueueLength, CommitRateLimiter commitRateLimiter, boolean fastQueryResultSize) { this.contentRepository = checkNotNull(contentRepository); this.whiteboard = checkNotNull(whiteboard); this.securityProvider = checkNotNull(securityProvider); this.observationQueueLength = observationQueueLength; this.commitRateLimiter = commitRateLimiter; this.descriptors = determineDescriptors(); this.statisticManager = new StatisticManager(whiteboard, scheduledExecutor); this.clock = new Clock.Fast(scheduledExecutor); this.gcMonitorRegistration = whiteboard.register(GCMonitor.class, gcMonitor, emptyMap()); this.fastQueryResultSize = fastQueryResultSize; this.mountInfoProvider = WhiteboardUtils.getService(whiteboard, MountInfoProvider.class); this.blobAccessProvider = WhiteboardUtils.getService(whiteboard, BlobAccessProvider.class); }
@Test public void timeSeriesOnly() throws Exception{ Whiteboard wb = new DefaultWhiteboard(); final Map<String, StatsOptions> optionsPassed = Maps.newHashMap(); wb.register(StatisticsProvider.class, new DummyStatsProvider(){ @Override public MeterStats getMeter(String name, StatsOptions options) { optionsPassed.put(name, options); return super.getMeter(name, options); } }, null); StatisticManager mgr = new StatisticManager(wb, executorService); mgr.getMeter(Type.SESSION_READ_COUNTER); assertEquals(StatsOptions.TIME_SERIES_ONLY, optionsPassed.get(Type.SESSION_READ_COUNTER.name())); mgr.getMeter(Type.SESSION_WRITE_COUNTER); assertEquals(StatsOptions.DEFAULT, optionsPassed.get(Type.SESSION_WRITE_COUNTER.name())); }
@Test public void setupWithCustom() throws Exception { Whiteboard wb = new DefaultWhiteboard(); wb.register(StatisticsProvider.class, StatisticsProvider.NOOP, null); StatisticManager mgr = new StatisticManager(wb, executorService); MeterStats meterStats = mgr.getMeter(Type.QUERY_COUNT); meterStats.mark(5); //TODO Not easy to do any asserts on call. Need to figure out a way }
StatisticManager mgr = new StatisticManager(wb, executorService);
@Test public void defaultSetup() throws Exception { Whiteboard wb = new DefaultWhiteboard(); StatisticManager mgr = new StatisticManager(wb, executorService); MeterStats meterStats = mgr.getMeter(Type.QUERY_COUNT); meterStats.mark(5); assertNotNull(WhiteboardUtils.getServices(wb, RepositoryStatsMBean.class)); assertNotNull(WhiteboardUtils.getServices(wb, QueryStatManagerMBean.class)); }