1
0
mirror of https://github.com/google/nomulus synced 2026-07-22 07:52:22 +00:00

Upgrade to Beam 2.34.0 (#1472)

This version of Beam does not have an explicit dependency on log4j.
There are a couple of other things that need to change due to the
upgrade.

1) The new version pulls in a dependency that is not on Maven Central
but on packages.confluent.io, so we need to explicitly add this repo.

2) The new version has a dependency on flogger 0.6 anb above , which removed
the LoggerConfig class (see google/flogger#142).
We therefore backported the class. In the long term we should do what
was suggested in the issue and use the normal JDK Logger config
directly.

3) The intSqlPipeline dependency graph also needs to be updated.

<!-- Reviewable:start -->
---
This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/google/nomulus/1472)
<!-- Reviewable:end -->
This commit is contained in:
Lai Jiang
2021-12-19 22:48:15 -05:00
committed by GitHub
parent a23e3aa479
commit 7e115fa23e
135 changed files with 8778 additions and 7605 deletions
@@ -32,11 +32,11 @@ import com.google.cloud.storage.BlobInfo;
import com.google.cloud.storage.contrib.nio.testing.LocalStorageHelper;
import com.google.common.collect.ImmutableList;
import com.google.common.collect.ImmutableMap;
import com.google.common.flogger.LoggerConfig;
import com.google.common.testing.TestLogHandler;
import com.google.common.util.concurrent.MoreExecutors;
import google.registry.gcs.GcsUtils;
import google.registry.testing.AppEngineExtension;
import google.registry.util.JdkLoggerConfig;
import java.io.IOException;
import java.util.concurrent.Executors;
import java.util.logging.LogRecord;
@@ -67,7 +67,7 @@ public class GcsDiffFileListerTest {
for (int i = 0; i < 5; i++) {
addGcsFile(i, i + 1);
}
LoggerConfig.getConfig(GcsDiffFileLister.class).addHandler(logHandler);
JdkLoggerConfig.getConfig(GcsDiffFileLister.class).addHandler(logHandler);
}
private Iterable<DateTime> extractTimesFromDiffFiles(ImmutableList<BlobInfo> diffFiles) {
@@ -34,7 +34,6 @@ import static org.junit.Assert.assertThrows;
import static org.mockito.Mockito.when;
import com.google.common.collect.ImmutableSortedSet;
import com.google.common.flogger.LoggerConfig;
import google.registry.model.contact.ContactResource;
import google.registry.model.domain.RegistryLock;
import google.registry.testing.AppEngineExtension;
@@ -44,6 +43,7 @@ import google.registry.testing.InjectExtension;
import google.registry.testing.TaskQueueHelper.TaskMatcher;
import google.registry.util.AppEngineServiceUtils;
import google.registry.util.CapturingLogHandler;
import google.registry.util.JdkLoggerConfig;
import google.registry.util.Retrier;
import java.util.logging.Level;
import org.joda.time.DateTime;
@@ -75,7 +75,7 @@ public class AsyncTaskEnqueuerTest {
@BeforeEach
void beforeEach() {
LoggerConfig.getConfig(AsyncTaskEnqueuer.class).addHandler(logHandler);
JdkLoggerConfig.getConfig(AsyncTaskEnqueuer.class).addHandler(logHandler);
when(appEngineServiceUtils.getServiceHostname("backend")).thenReturn("backend.hostname.fake");
asyncTaskEnqueuer = createForTesting(appEngineServiceUtils, clock, standardSeconds(90));
}
@@ -35,7 +35,6 @@ import com.google.api.services.bigquery.model.JobStatus;
import com.google.appengine.api.taskqueue.TaskOptions;
import com.google.appengine.api.taskqueue.TaskOptions.Method;
import com.google.appengine.api.taskqueue.dev.QueueStateInfo.TaskStateInfo;
import com.google.common.flogger.LoggerConfig;
import google.registry.export.BigqueryPollJobAction.BigqueryPollJobEnqueuer;
import google.registry.request.HttpException.BadRequestException;
import google.registry.request.HttpException.NotModifiedException;
@@ -45,6 +44,7 @@ import google.registry.testing.FakeSleeper;
import google.registry.testing.TaskQueueHelper;
import google.registry.testing.TaskQueueHelper.TaskMatcher;
import google.registry.util.CapturingLogHandler;
import google.registry.util.JdkLoggerConfig;
import google.registry.util.Retrier;
import google.registry.util.TaskQueueUtils;
import java.io.ByteArrayInputStream;
@@ -85,7 +85,7 @@ public class BigqueryPollJobActionTest {
action.projectId = PROJECT_ID;
action.jobId = JOB_ID;
action.chainedQueueName = () -> CHAINED_QUEUE_NAME;
LoggerConfig.getConfig(BigqueryPollJobAction.class).addHandler(logHandler);
JdkLoggerConfig.getConfig(BigqueryPollJobAction.class).addHandler(logHandler);
}
private static TaskMatcher newPollJobTaskMatcher(String method) {
@@ -20,7 +20,6 @@ import static org.junit.jupiter.api.Assertions.assertThrows;
import com.google.common.collect.ImmutableList;
import com.google.common.collect.ImmutableSet;
import com.google.common.flogger.LoggerConfig;
import com.google.common.testing.TestLogHandler;
import google.registry.flows.EppException.UnimplementedExtensionException;
import google.registry.flows.ExtensionManager.UndeclaredServiceExtensionException;
@@ -36,6 +35,7 @@ import google.registry.model.eppcommon.ProtocolDefinition.ServiceExtension;
import google.registry.model.eppinput.EppInput;
import google.registry.model.eppinput.EppInput.CommandExtension;
import google.registry.testing.AppEngineExtension;
import google.registry.util.JdkLoggerConfig;
import google.registry.util.TypeUtils;
import java.util.logging.LogRecord;
import org.junit.jupiter.api.Test;
@@ -66,7 +66,7 @@ class ExtensionManagerTest {
@Test
void testUndeclaredExtensionsLogged() throws Exception {
TestLogHandler handler = new TestLogHandler();
LoggerConfig.getConfig(ExtensionManager.class).addHandler(handler);
JdkLoggerConfig.getConfig(ExtensionManager.class).addHandler(handler);
ExtensionManager manager =
new TestInstanceBuilder()
.setEppRequestSource(EppRequestSource.TOOL)
@@ -21,7 +21,6 @@ import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.when;
import com.google.common.collect.ImmutableList;
import com.google.common.flogger.LoggerConfig;
import com.google.common.testing.TestLogHandler;
import google.registry.flows.annotations.ReportingSpec;
import google.registry.model.eppcommon.Trid;
@@ -29,6 +28,7 @@ import google.registry.model.eppinput.EppInput;
import google.registry.model.eppoutput.EppOutput.ResponseOrGreeting;
import google.registry.model.eppoutput.EppResponse;
import google.registry.model.reporting.IcannReportingTypes.ActivityReportField;
import google.registry.util.JdkLoggerConfig;
import java.util.Map;
import java.util.Optional;
import org.json.simple.JSONValue;
@@ -58,7 +58,7 @@ class FlowReporterTest {
@BeforeEach
void beforeEach() {
LoggerConfig.getConfig(FlowReporter.class).addHandler(handler);
JdkLoggerConfig.getConfig(FlowReporter.class).addHandler(handler);
flowReporter.trid = Trid.create("client-123", "server-456");
flowReporter.registrarId = "TheRegistrar";
flowReporter.inputXmlBytes = "<xml/>".getBytes(UTF_8);
@@ -29,7 +29,6 @@ import com.google.common.base.Joiner;
import com.google.common.base.Splitter;
import com.google.common.collect.ImmutableSet;
import com.google.common.collect.ImmutableSortedMap;
import com.google.common.flogger.LoggerConfig;
import com.google.common.testing.TestLogHandler;
import google.registry.flows.certs.CertificateChecker;
import google.registry.model.eppcommon.Trid;
@@ -39,6 +38,7 @@ import google.registry.monitoring.whitebox.EppMetric;
import google.registry.testing.AppEngineExtension;
import google.registry.testing.FakeClock;
import google.registry.testing.FakeHttpSession;
import google.registry.util.JdkLoggerConfig;
import java.util.List;
import java.util.Optional;
import org.joda.time.DateTime;
@@ -79,7 +79,7 @@ class FlowRunnerTest {
@BeforeEach
void beforeEach() {
LoggerConfig.getConfig(FlowRunner.class).addHandler(handler);
JdkLoggerConfig.getConfig(FlowRunner.class).addHandler(handler);
flowRunner.registrarId = "TheRegistrar";
flowRunner.credentials = new PasswordOnlyTransportCredentials();
flowRunner.eppRequestSource = EppRequestSource.UNIT_TEST;
@@ -28,7 +28,6 @@ import com.google.common.collect.ImmutableList;
import com.google.common.collect.ImmutableMap;
import com.google.common.collect.Iterables;
import com.google.common.collect.Streams;
import com.google.common.flogger.LoggerConfig;
import com.google.common.testing.TestLogHandler;
import com.googlecode.objectify.Key;
import google.registry.model.EppResource;
@@ -48,6 +47,7 @@ import google.registry.model.tmch.ClaimsList;
import google.registry.model.tmch.ClaimsListDao;
import google.registry.testing.DatabaseHelper;
import google.registry.testing.TaskQueueHelper.TaskMatcher;
import google.registry.util.JdkLoggerConfig;
import google.registry.util.TypeUtils.TypeInstantiator;
import java.util.logging.Level;
import javax.annotation.Nullable;
@@ -72,7 +72,7 @@ public abstract class ResourceFlowTestCase<F extends Flow, R extends EppResource
// Attach TestLogHandler to the root logger so it has access to all log messages.
// Note that in theory for assertIcannReportingActivityFieldLogged() below it would suffice to
// attach it only to the FlowRunner logger, but for some reason this doesn't work for all flows.
LoggerConfig.getConfig("").addHandler(logHandler);
JdkLoggerConfig.getConfig("").addHandler(logHandler);
}
@Nullable
@@ -21,8 +21,8 @@ import static org.junit.jupiter.api.Assertions.assertThrows;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.when;
import com.google.common.flogger.LoggerConfig;
import com.google.common.testing.TestLogHandler;
import google.registry.util.JdkLoggerConfig;
import java.io.IOException;
import java.util.logging.Level;
import org.bouncycastle.bcpg.BCPGKey;
@@ -78,12 +78,12 @@ class ComparatorKeyringTest {
@BeforeEach
void beforeEach() {
LoggerConfig.getConfig(ComparatorKeyring.class).addHandler(testLogHandler);
JdkLoggerConfig.getConfig(ComparatorKeyring.class).addHandler(testLogHandler);
}
@AfterEach
void afterEach() {
LoggerConfig.getConfig(ComparatorKeyring.class).removeHandler(testLogHandler);
JdkLoggerConfig.getConfig(ComparatorKeyring.class).removeHandler(testLogHandler);
}
@Test
@@ -29,7 +29,6 @@ import static org.mockito.Mockito.when;
import com.google.appengine.api.users.User;
import com.google.common.collect.ImmutableSetMultimap;
import com.google.common.flogger.LoggerConfig;
import com.google.common.testing.NullPointerTester;
import com.google.common.testing.TestLogHandler;
import dagger.Lazy;
@@ -41,6 +40,7 @@ import google.registry.testing.AppEngineExtension;
import google.registry.testing.DualDatabaseTest;
import google.registry.testing.InjectExtension;
import google.registry.testing.TestOfyAndSql;
import google.registry.util.JdkLoggerConfig;
import java.util.Optional;
import java.util.logging.Level;
import javax.servlet.http.HttpServletRequest;
@@ -109,7 +109,7 @@ class AuthenticatedRegistrarAccessorTest {
@BeforeEach
void beforeEach() {
when(lazyGroupsConnection.get()).thenReturn(groupsConnection);
LoggerConfig.getConfig(AuthenticatedRegistrarAccessor.class).addHandler(testLogHandler);
JdkLoggerConfig.getConfig(AuthenticatedRegistrarAccessor.class).addHandler(testLogHandler);
// persistResource(loadRegistrar(ADMIN_CLIENT_ID));
persistResource(
loadRegistrar(REAL_CLIENT_ID_WITHOUT_CONTACT)
@@ -130,7 +130,7 @@ class AuthenticatedRegistrarAccessorTest {
@AfterEach
void afterEach() {
LoggerConfig.getConfig(AuthenticatedRegistrarAccessor.class).removeHandler(testLogHandler);
JdkLoggerConfig.getConfig(AuthenticatedRegistrarAccessor.class).removeHandler(testLogHandler);
}
/** Users are owners for registrars if and only if they are in the contacts for that registrar. */
@@ -33,7 +33,6 @@ import static org.junit.jupiter.api.Assertions.assertThrows;
import com.beust.jcommander.ParameterException;
import com.google.common.collect.ImmutableMap;
import com.google.common.collect.ImmutableSet;
import com.google.common.flogger.LoggerConfig;
import google.registry.model.billing.BillingEvent;
import google.registry.model.billing.BillingEvent.Flag;
import google.registry.model.billing.BillingEvent.Reason;
@@ -50,6 +49,7 @@ import google.registry.testing.DualDatabaseTest;
import google.registry.testing.InjectExtension;
import google.registry.testing.TestOfyAndSql;
import google.registry.util.CapturingLogHandler;
import google.registry.util.JdkLoggerConfig;
import java.util.logging.Level;
import org.junit.jupiter.api.AfterEach;
import org.junit.jupiter.api.BeforeEach;
@@ -70,12 +70,12 @@ class UpdateDomainCommandTest extends EppToolCommandTestCase<UpdateDomainCommand
inject.setStaticField(Ofy.class, "clock", fakeClock);
command.clock = fakeClock;
domain = persistActiveDomain("example.tld");
LoggerConfig.getConfig(UpdateDomainCommand.class).addHandler(logHandler);
JdkLoggerConfig.getConfig(UpdateDomainCommand.class).addHandler(logHandler);
}
@AfterEach
void afterEach() {
LoggerConfig.getConfig(UpdateDomainCommand.class).removeHandler(logHandler);
JdkLoggerConfig.getConfig(UpdateDomainCommand.class).removeHandler(logHandler);
}
@TestOfyAndSql
@@ -25,7 +25,6 @@ import com.google.appengine.api.log.LogService;
import com.google.appengine.api.log.RequestLogs;
import com.google.apphosting.api.ApiProxy;
import com.google.common.collect.ImmutableList;
import com.google.common.flogger.LoggerConfig;
import com.google.common.testing.TestLogHandler;
import google.registry.testing.AppEngineExtension;
import java.util.logging.Level;
@@ -62,13 +61,13 @@ final class RequestStatusCheckerImplTest {
@BeforeEach
void beforeEach() {
LoggerConfig.getConfig(RequestStatusCheckerImpl.class).addHandler(logHandler);
JdkLoggerConfig.getConfig(RequestStatusCheckerImpl.class).addHandler(logHandler);
RequestStatusCheckerImpl.logService = mock(LogService.class);
}
@AfterEach
void afterEach() {
LoggerConfig.getConfig(RequestStatusCheckerImpl.class).removeHandler(logHandler);
JdkLoggerConfig.getConfig(RequestStatusCheckerImpl.class).removeHandler(logHandler);
}
// If a logId is unrecognized, it could be that the log hasn't been uploaded yet - so we assume
@@ -19,12 +19,12 @@ import static google.registry.testing.DatabaseHelper.createTlds;
import static google.registry.testing.LogsSubject.assertAboutLogs;
import static org.junit.jupiter.api.Assertions.assertThrows;
import com.google.common.flogger.LoggerConfig;
import com.google.common.testing.TestLogHandler;
import google.registry.testing.AppEngineExtension;
import google.registry.testing.DualDatabaseTest;
import google.registry.testing.FakeClock;
import google.registry.testing.TestOfyAndSql;
import google.registry.util.JdkLoggerConfig;
import java.io.StringReader;
import java.util.logging.Level;
import org.junit.jupiter.api.BeforeEach;
@@ -44,7 +44,7 @@ class WhoisReaderTest {
@BeforeEach
void beforeEach() {
createTlds("tld", "xn--kgbechtv", "1.test");
LoggerConfig.getConfig(WhoisReader.class).addHandler(testLogHandler);
JdkLoggerConfig.getConfig(WhoisReader.class).addHandler(testLogHandler);
}
@SuppressWarnings({"TypeParameterUnusedInFormals", "unchecked"})
File diff suppressed because it is too large Load Diff
Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.1 MiB

After

Width:  |  Height:  |  Size: 1.2 MiB