mirror of
https://github.com/google/nomulus.git
synced 2025-05-14 16:37:13 +02:00
Move VerifyEntityIntegrityAction to batch package
By moving []s into the batch package, which is not included in the frontend service, we pave the way to remove the dependency of frontend on the [] library. ------------- Created by MOE: https://github.com/google/moe MOE_MIGRATED_REVID=142265351
This commit is contained in:
parent
246098d8e8
commit
0afafeff03
11 changed files with 67 additions and 29 deletions
|
@ -8,6 +8,8 @@ java_library(
|
|||
name = "batch",
|
||||
srcs = glob(["*.java"]),
|
||||
deps = [
|
||||
"//apiserving/discoverydata/bigquery:bigqueryv2",
|
||||
"//java/com/google/api/client/util",
|
||||
"//java/com/google/common/annotations",
|
||||
"//java/com/google/common/base",
|
||||
"//java/com/google/common/collect",
|
||||
|
@ -15,17 +17,22 @@ java_library(
|
|||
"//java/com/google/common/io",
|
||||
"//java/com/google/common/math",
|
||||
"//java/com/google/common/net",
|
||||
"//java/google/registry/bigquery",
|
||||
"//java/google/registry/config",
|
||||
"//java/google/registry/dns",
|
||||
"//java/google/registry/flows",
|
||||
"//java/google/registry/mapreduce",
|
||||
"//java/google/registry/mapreduce/inputs",
|
||||
"//java/google/registry/model",
|
||||
"//java/google/registry/monitoring/whitebox",
|
||||
"//java/google/registry/pricing",
|
||||
"//java/google/registry/request",
|
||||
"//java/google/registry/request:modules",
|
||||
"//java/google/registry/util",
|
||||
"//third_party/java/appengine:appengine-api",
|
||||
"//third_party/java/appengine_gcs_client",
|
||||
"//third_party/java/appengine_mapreduce2:appengine_mapreduce",
|
||||
"//third_party/java/auto:auto_factory",
|
||||
"//third_party/java/auto:auto_value",
|
||||
"//third_party/java/dagger",
|
||||
"//third_party/java/joda_money",
|
||||
|
|
|
@ -12,25 +12,27 @@
|
|||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
package google.registry.monitoring.whitebox;
|
||||
package google.registry.batch;
|
||||
|
||||
import dagger.Component;
|
||||
import google.registry.bigquery.BigqueryModule;
|
||||
import google.registry.config.ConfigModule;
|
||||
import google.registry.monitoring.whitebox.WhiteboxModule;
|
||||
import google.registry.request.Modules.DatastoreServiceModule;
|
||||
import google.registry.util.SystemSleeper.SystemSleeperModule;
|
||||
import javax.inject.Singleton;
|
||||
|
||||
/** Dagger component with instance lifetime for Whitebox package. */
|
||||
/** Dagger component with instance lifetime for batch package. */
|
||||
@Singleton
|
||||
@Component(
|
||||
modules = {
|
||||
BatchModule.class,
|
||||
BigqueryModule.class,
|
||||
ConfigModule.class,
|
||||
DatastoreServiceModule.class,
|
||||
SystemSleeperModule.class,
|
||||
WhiteboxModule.class
|
||||
})
|
||||
interface WhiteboxComponent {
|
||||
interface BatchComponent {
|
||||
VerifyEntityIntegrityStreamerFactory verifyEntityIntegrityStreamerFactory();
|
||||
}
|
36
java/google/registry/batch/BatchModule.java
Normal file
36
java/google/registry/batch/BatchModule.java
Normal file
|
@ -0,0 +1,36 @@
|
|||
// Copyright 2016 The Nomulus Authors. All Rights Reserved.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
package google.registry.batch;
|
||||
|
||||
import com.google.api.services.bigquery.model.TableFieldSchema;
|
||||
import com.google.common.collect.ImmutableList;
|
||||
import dagger.Module;
|
||||
import dagger.Provides;
|
||||
import dagger.multibindings.IntoMap;
|
||||
import dagger.multibindings.StringKey;
|
||||
|
||||
/**
|
||||
* Dagger module for injecting common settings for batch actions.
|
||||
*/
|
||||
@Module
|
||||
public class BatchModule {
|
||||
|
||||
@Provides
|
||||
@IntoMap
|
||||
@StringKey(EntityIntegrityAlertsSchema.TABLE_ID)
|
||||
static ImmutableList<TableFieldSchema> provideEntityIntegrityAlertsSchema() {
|
||||
return EntityIntegrityAlertsSchema.SCHEMA_FIELDS;
|
||||
}
|
||||
}
|
|
@ -12,7 +12,7 @@
|
|||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
package google.registry.monitoring.whitebox;
|
||||
package google.registry.batch;
|
||||
|
||||
import static google.registry.bigquery.BigqueryUtils.FieldType.STRING;
|
||||
import static google.registry.bigquery.BigqueryUtils.FieldType.TIMESTAMP;
|
|
@ -12,7 +12,7 @@
|
|||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
package google.registry.monitoring.whitebox;
|
||||
package google.registry.batch;
|
||||
|
||||
import static com.google.common.base.Preconditions.checkState;
|
||||
import static com.google.common.collect.Iterables.getOnlyElement;
|
||||
|
@ -95,7 +95,7 @@ public class VerifyEntityIntegrityAction implements Runnable {
|
|||
private static final int NUM_SHARDS = 200;
|
||||
@NonFinalForTesting
|
||||
@VisibleForTesting
|
||||
static WhiteboxComponent component = DaggerWhiteboxComponent.create();
|
||||
static BatchComponent component = DaggerBatchComponent.create();
|
||||
private static final ImmutableSet<Class<?>> RESOURCE_CLASSES =
|
||||
ImmutableSet.<Class<?>>of(
|
||||
ForeignKeyDomainIndex.class,
|
|
@ -12,15 +12,15 @@
|
|||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
package google.registry.monitoring.whitebox;
|
||||
package google.registry.batch;
|
||||
|
||||
import static com.google.api.client.util.Data.NULL_STRING;
|
||||
import static google.registry.monitoring.whitebox.EntityIntegrityAlertsSchema.DATASET;
|
||||
import static google.registry.monitoring.whitebox.EntityIntegrityAlertsSchema.FIELD_MESSAGE;
|
||||
import static google.registry.monitoring.whitebox.EntityIntegrityAlertsSchema.FIELD_SCANTIME;
|
||||
import static google.registry.monitoring.whitebox.EntityIntegrityAlertsSchema.FIELD_SOURCE;
|
||||
import static google.registry.monitoring.whitebox.EntityIntegrityAlertsSchema.FIELD_TARGET;
|
||||
import static google.registry.monitoring.whitebox.EntityIntegrityAlertsSchema.TABLE_ID;
|
||||
import static google.registry.batch.EntityIntegrityAlertsSchema.DATASET;
|
||||
import static google.registry.batch.EntityIntegrityAlertsSchema.FIELD_MESSAGE;
|
||||
import static google.registry.batch.EntityIntegrityAlertsSchema.FIELD_SCANTIME;
|
||||
import static google.registry.batch.EntityIntegrityAlertsSchema.FIELD_SOURCE;
|
||||
import static google.registry.batch.EntityIntegrityAlertsSchema.FIELD_TARGET;
|
||||
import static google.registry.batch.EntityIntegrityAlertsSchema.TABLE_ID;
|
||||
|
||||
import com.google.api.services.bigquery.Bigquery;
|
||||
import com.google.api.services.bigquery.Bigquery.Tabledata.InsertAll;
|
|
@ -21,10 +21,12 @@ import google.registry.backup.CommitLogCheckpointAction;
|
|||
import google.registry.backup.DeleteOldCommitLogsAction;
|
||||
import google.registry.backup.ExportCommitLogDiffAction;
|
||||
import google.registry.backup.RestoreCommitLogsAction;
|
||||
import google.registry.batch.BatchModule;
|
||||
import google.registry.batch.DeleteContactsAndHostsAction;
|
||||
import google.registry.batch.DeleteProberDataAction;
|
||||
import google.registry.batch.ExpandRecurringBillingEventsAction;
|
||||
import google.registry.batch.RefreshDnsOnHostRenameAction;
|
||||
import google.registry.batch.VerifyEntityIntegrityAction;
|
||||
import google.registry.cron.CommitLogFanoutAction;
|
||||
import google.registry.cron.CronModule;
|
||||
import google.registry.cron.TldFanoutAction;
|
||||
|
@ -47,7 +49,6 @@ import google.registry.export.sheet.SyncRegistrarsSheetAction;
|
|||
import google.registry.flows.async.AsyncFlowsModule;
|
||||
import google.registry.mapreduce.MapreduceModule;
|
||||
import google.registry.monitoring.whitebox.MetricsExportAction;
|
||||
import google.registry.monitoring.whitebox.VerifyEntityIntegrityAction;
|
||||
import google.registry.monitoring.whitebox.WhiteboxModule;
|
||||
import google.registry.rde.BrdaCopyAction;
|
||||
import google.registry.rde.RdeModule;
|
||||
|
@ -75,6 +76,7 @@ import google.registry.tmch.TmchSmdrlAction;
|
|||
AsyncFlowsModule.class,
|
||||
BackendModule.class,
|
||||
BackupModule.class,
|
||||
BatchModule.class,
|
||||
CloudDnsWriterModule.class,
|
||||
CronModule.class,
|
||||
DnsModule.class,
|
||||
|
|
|
@ -12,7 +12,6 @@ java_library(
|
|||
"//google/monitoring:monitoring_java_lib",
|
||||
"//java/com/google/api/client/http",
|
||||
"//java/com/google/api/client/json",
|
||||
"//java/com/google/api/client/util",
|
||||
"//java/com/google/common/annotations",
|
||||
"//java/com/google/common/base",
|
||||
"//java/com/google/common/cache",
|
||||
|
@ -20,16 +19,11 @@ java_library(
|
|||
"//java/com/google/common/net",
|
||||
"//java/google/registry/bigquery",
|
||||
"//java/google/registry/config",
|
||||
"//java/google/registry/mapreduce",
|
||||
"//java/google/registry/mapreduce/inputs",
|
||||
"//java/google/registry/model",
|
||||
"//java/google/registry/monitoring/metrics",
|
||||
"//java/google/registry/request",
|
||||
"//java/google/registry/request:modules",
|
||||
"//java/google/registry/util",
|
||||
"//third_party/java/appengine:appengine-api",
|
||||
"//third_party/java/appengine_mapreduce2:appengine_mapreduce",
|
||||
"//third_party/java/auto:auto_factory",
|
||||
"//third_party/java/auto:auto_value",
|
||||
"//third_party/java/dagger",
|
||||
"//third_party/java/joda_time",
|
||||
|
|
|
@ -45,13 +45,6 @@ public class WhiteboxModule {
|
|||
return EppMetric.SCHEMA_FIELDS;
|
||||
}
|
||||
|
||||
@Provides
|
||||
@IntoMap
|
||||
@StringKey(EntityIntegrityAlertsSchema.TABLE_ID)
|
||||
static ImmutableList<TableFieldSchema> provideEntityIntegrityAlertsSchema() {
|
||||
return EntityIntegrityAlertsSchema.SCHEMA_FIELDS;
|
||||
}
|
||||
|
||||
@Provides
|
||||
@Parameter("tableId")
|
||||
static String provideTableId(HttpServletRequest req) {
|
||||
|
|
|
@ -11,13 +11,17 @@ java_library(
|
|||
name = "batch",
|
||||
srcs = glob(["*.java"]),
|
||||
deps = [
|
||||
"//apiserving/discoverydata/bigquery:bigqueryv2",
|
||||
"//java/com/google/api/client/util",
|
||||
"//java/com/google/common/annotations",
|
||||
"//java/com/google/common/base",
|
||||
"//java/com/google/common/collect",
|
||||
"//java/com/google/common/io",
|
||||
"//java/com/google/common/net",
|
||||
"//java/google/registry/batch",
|
||||
"//java/google/registry/bigquery",
|
||||
"//java/google/registry/flows",
|
||||
"//java/google/registry/mapreduce",
|
||||
"//java/google/registry/model",
|
||||
"//java/google/registry/util",
|
||||
"//javatests/google/registry/testing",
|
||||
|
|
|
@ -12,7 +12,7 @@
|
|||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
package google.registry.monitoring.whitebox;
|
||||
package google.registry.batch;
|
||||
|
||||
import static com.google.common.truth.Truth.assertThat;
|
||||
import static google.registry.testing.DatastoreHelper.createTld;
|
||||
|
@ -104,7 +104,7 @@ public class VerifyEntityIntegrityActionTest
|
|||
action = new VerifyEntityIntegrityAction();
|
||||
action.mrRunner = new MapreduceRunner(Optional.of(2), Optional.of(2));
|
||||
action.response = new FakeResponse();
|
||||
WhiteboxComponent component = mock(WhiteboxComponent.class);
|
||||
BatchComponent component = mock(BatchComponent.class);
|
||||
inject.setStaticField(VerifyEntityIntegrityAction.class, "component", component);
|
||||
integrity =
|
||||
new VerifyEntityIntegrityStreamer(
|
Loading…
Add table
Add a link
Reference in a new issue