Inject the BigQuery streaming metrics queue

This makes local development easier by allowing a stub to be injected for the
queue.

Based on Justin Graham's PR: https://github.com/google/nomulus/pull/51

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=144439454
This commit is contained in:
mcilwain
2017-01-13 10:29:36 -05:00
committed by Ben McIlwain
parent f7e84b56a0
commit 8f8d67a17b
3 changed files with 16 additions and 3 deletions
@@ -14,7 +14,9 @@
package google.registry.monitoring.whitebox;
import static com.google.appengine.api.taskqueue.QueueFactory.getQueue;
import static google.registry.bigquery.BigqueryUtils.toBigqueryTimestamp;
import static google.registry.monitoring.whitebox.BigQueryMetricsEnqueuer.QUEUE_BIGQUERY_STREAMING_METRICS;
import static google.registry.testing.TaskQueueHelper.assertTasksEnqueued;
import static org.mockito.Mockito.when;
@@ -59,6 +61,7 @@ public class BigQueryMetricsEnqueuerTest {
enqueuer = new BigQueryMetricsEnqueuer();
enqueuer.idGenerator = Suppliers.ofInstance("laffo");
enqueuer.modulesService = modulesService;
enqueuer.queue = getQueue(QUEUE_BIGQUERY_STREAMING_METRICS);
when(modulesService.getVersionHostname(Matchers.anyString(), Matchers.anyString()))
.thenReturn("1.backend.test.localhost");
}