internal virtual void WriteValues(Locale locale, long timestamp, string line, object[] values) { lock (this) { StreamSupplier.get(); PrintWriter.printf(locale, string.format(locale, "%d,%s%n", timestamp, line), values); PrintWriter.flush(); } }
//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(); }