public static final class StatsTestUtils.FakeStatsContextFactory
extends com.google.instrumentation.stats.StatsContextFactory
StatsContexts and saves the created contexts to be
accessible from pollContextOrFail(). The contexts it has created would save metrics
records to be accessible from pollRecord() and pollRecord(long, TimeUnit),
until rolloverRecords() is called.| Modifier and Type | Field and Description |
|---|---|
BlockingQueue<StatsTestUtils.FakeStatsContext> |
contexts |
| Constructor and Description |
|---|
FakeStatsContextFactory()
Constructor.
|
| Modifier and Type | Method and Description |
|---|---|
com.google.instrumentation.stats.StatsContext |
deserialize(InputStream buffer) |
StatsTestUtils.FakeStatsContext |
getDefault() |
com.google.instrumentation.stats.StatsContext |
pollContextOrFail() |
StatsTestUtils.MetricsRecord |
pollRecord() |
StatsTestUtils.MetricsRecord |
pollRecord(long timeout,
TimeUnit unit) |
void |
rolloverRecords()
Disconnect this factory with the contexts it has created so far.
|
public final BlockingQueue<StatsTestUtils.FakeStatsContext> contexts
public com.google.instrumentation.stats.StatsContext pollContextOrFail()
public StatsTestUtils.MetricsRecord pollRecord()
public StatsTestUtils.MetricsRecord pollRecord(long timeout, TimeUnit unit) throws InterruptedException
InterruptedExceptionpublic com.google.instrumentation.stats.StatsContext deserialize(InputStream buffer) throws IOException
deserialize in class com.google.instrumentation.stats.StatsContextFactoryIOExceptionpublic StatsTestUtils.FakeStatsContext getDefault()
getDefault in class com.google.instrumentation.stats.StatsContextFactorypublic void rolloverRecords()
pollRecord(). Useful for isolating the records between
test cases.