mirror of
https://github.com/google/nomulus.git
synced 2025-05-31 17:54:08 +02:00
Consolidate BigQuery handling into one place
I'm writing a follow-up CL that will send integrity checking data to BigQuery, and that is made a lot easier by centralizing the BigQuery connection logic. ------------- Created by MOE: https://github.com/google/moe MOE_MIGRATED_REVID=119375766
This commit is contained in:
parent
c880a042a7
commit
755fce9e52
12 changed files with 329 additions and 347 deletions
|
@ -15,7 +15,6 @@
|
|||
package com.google.domain.registry.monitoring.whitebox;
|
||||
|
||||
import static org.mockito.Matchers.anyString;
|
||||
import static org.mockito.Mockito.doNothing;
|
||||
import static org.mockito.Mockito.verify;
|
||||
import static org.mockito.Mockito.when;
|
||||
|
||||
|
@ -28,12 +27,9 @@ import com.google.api.services.bigquery.Bigquery.Tabledata.InsertAll;
|
|||
import com.google.api.services.bigquery.model.TableDataInsertAllRequest;
|
||||
import com.google.api.services.bigquery.model.TableDataInsertAllResponse;
|
||||
import com.google.api.services.bigquery.model.TableDataInsertAllResponse.InsertErrors;
|
||||
import com.google.api.services.bigquery.model.TableFieldSchema;
|
||||
import com.google.api.services.bigquery.model.TableReference;
|
||||
import com.google.common.collect.ImmutableList;
|
||||
import com.google.common.collect.ImmutableMap;
|
||||
import com.google.domain.registry.bigquery.BigqueryFactory;
|
||||
import com.google.domain.registry.bigquery.BigqueryHelper;
|
||||
import com.google.domain.registry.testing.AppEngineRule;
|
||||
import com.google.domain.registry.testing.InjectRule;
|
||||
|
||||
|
@ -73,9 +69,6 @@ public class MetricsTaskServletTest {
|
|||
@Mock
|
||||
BigqueryFactory bigqueryFactory;
|
||||
|
||||
@Mock
|
||||
BigqueryHelper bigqueryHelper;
|
||||
|
||||
@Mock
|
||||
Bigquery bigquery;
|
||||
|
||||
|
@ -119,6 +112,8 @@ public class MetricsTaskServletTest {
|
|||
when(rsp.getWriter()).thenReturn(new PrintWriter(httpOutput));
|
||||
|
||||
inject.setStaticField(MetricsTaskServlet.class, "bigqueryFactory", bigqueryFactory);
|
||||
when(bigqueryFactory.create(anyString(), anyString(), anyString()))
|
||||
.thenReturn(bigquery);
|
||||
when(bigqueryFactory.create(
|
||||
anyString(),
|
||||
Matchers.any(HttpTransport.class),
|
||||
|
@ -126,14 +121,6 @@ public class MetricsTaskServletTest {
|
|||
Matchers.any(HttpRequestInitializer.class)))
|
||||
.thenReturn(bigquery);
|
||||
|
||||
inject.setStaticField(MetricsTaskServlet.class, "bigqueryHelper", bigqueryHelper);
|
||||
doNothing().when(bigqueryHelper).ensureDataset(Matchers.any(Bigquery.class), anyString(),
|
||||
anyString());
|
||||
doNothing().when(bigqueryHelper).ensureTable(
|
||||
Matchers.any(Bigquery.class),
|
||||
Matchers.any(TableReference.class),
|
||||
Matchers.<ImmutableList<TableFieldSchema>>any());
|
||||
|
||||
when(bigquery.tabledata()).thenReturn(tabledata);
|
||||
when(tabledata.insertAll(
|
||||
anyString(),
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue