Beispiel #1
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void stopAllWritersOnStop() throws java.io.IOException
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
        public virtual void StopAllWritersOnStop()
        {
            Stream outputStream = mock(typeof(Stream));

            when(_fileOutputStreamSupplier.get()).thenReturn(outputStream);
            RotatableCsvReporter             reporter = new RotatableCsvReporter(mock(typeof(MetricRegistry)), Locale.US, TimeUnit.SECONDS, TimeUnit.SECONDS, Clock.defaultClock(), TestDirectory.directory(), (file, rotationListener) => _fileOutputStreamSupplier);
            SortedDictionary <string, Gauge> gauges   = new SortedDictionary <string, Gauge>();

            gauges["a"] = () => ThreadLocalRandom.current().nextLong();
            gauges["b"] = () => ThreadLocalRandom.current().nextLong();
            gauges["c"] = () => ThreadLocalRandom.current().nextLong();
            reporter.report(gauges, new SortedDictionary <>(), new SortedDictionary <>(), new SortedDictionary <>(), new SortedDictionary <>());

            gauges["b"] = () => ThreadLocalRandom.current().nextLong();
            gauges["c"] = () => ThreadLocalRandom.current().nextLong();
            gauges["d"] = () => ThreadLocalRandom.current().nextLong();
            reporter.report(gauges, new SortedDictionary <>(), new SortedDictionary <>(), new SortedDictionary <>(), new SortedDictionary <>());

            reporter.Stop();
            verify(_fileOutputStreamSupplier, times(4)).close();
        }
Beispiel #2
0
 public override void Report(SortedDictionary <string, Gauge> gauges, SortedDictionary <string, Counter> counters, SortedDictionary <string, Histogram> histograms, SortedDictionary <string, Meter> meters, SortedDictionary <string, Timer> timers)
 {
     _csvReporter.report(gauges, counters, histograms, meters, timers);
 }