mirror of
https://github.com/google/nomulus.git
synced 2025-08-01 23:42:12 +02:00
Re-enable Java 17 features (#2333)
This commit is contained in:
parent
7a301edab7
commit
9d0ff74377
26 changed files with 52 additions and 106 deletions
3
.gitignore
vendored
3
.gitignore
vendored
|
@ -117,3 +117,6 @@ core/**/registrar_dbg*.css
|
|||
# Appengine generated files
|
||||
core/WEB-INF/appengine-generated/*.bin
|
||||
core/WEB-INF/appengine-generated/*.xml
|
||||
|
||||
# jEnv
|
||||
.java-version
|
||||
|
|
|
@ -22,7 +22,6 @@ import static google.registry.flows.FlowUtils.unmarshalEpp;
|
|||
import static java.nio.charset.StandardCharsets.UTF_8;
|
||||
|
||||
import com.google.common.annotations.VisibleForTesting;
|
||||
import com.google.common.base.Strings;
|
||||
import com.google.common.collect.ImmutableMap;
|
||||
import com.google.common.flogger.FluentLogger;
|
||||
import google.registry.flows.FlowModule.EppExceptionInProviderException;
|
||||
|
@ -45,7 +44,7 @@ import org.json.simple.JSONValue;
|
|||
public final class EppController {
|
||||
|
||||
private static final FluentLogger logger = FluentLogger.forEnclosingClass();
|
||||
private static final String LOG_SEPARATOR = Strings.repeat("=", 40);
|
||||
private static final String LOG_SEPARATOR = "=".repeat(40);
|
||||
|
||||
@Inject FlowComponent.Builder flowComponentBuilder;
|
||||
@Inject EppMetric.Builder eppMetricBuilder;
|
||||
|
|
|
@ -17,7 +17,6 @@ package google.registry.flows;
|
|||
import static google.registry.persistence.transaction.TransactionManagerFactory.tm;
|
||||
import static google.registry.xml.XmlTransformer.prettyPrint;
|
||||
|
||||
import com.google.common.base.Strings;
|
||||
import com.google.common.flogger.FluentLogger;
|
||||
import google.registry.flows.FlowModule.DryRun;
|
||||
import google.registry.flows.FlowModule.InputXml;
|
||||
|
@ -36,7 +35,7 @@ import javax.inject.Provider;
|
|||
/** Run a flow, either transactionally or not, with logging and retrying as needed. */
|
||||
public class FlowRunner {
|
||||
|
||||
private static final String COMMAND_LOG_FORMAT = "EPP Command" + Strings.repeat("\n\t%s", 8);
|
||||
private static final String COMMAND_LOG_FORMAT = "EPP Command" + "\n\t%s".repeat(8);
|
||||
|
||||
private static final FluentLogger logger = FluentLogger.forEnclosingClass();
|
||||
|
||||
|
|
|
@ -38,8 +38,8 @@ import google.registry.xml.ValidationMode;
|
|||
import google.registry.xml.XmlException;
|
||||
import google.registry.xml.XmlFragmentMarshaller;
|
||||
import java.io.ByteArrayOutputStream;
|
||||
import java.io.Serial;
|
||||
import java.io.Serializable;
|
||||
import java.io.UnsupportedEncodingException;
|
||||
import java.util.Collection;
|
||||
import javax.annotation.concurrent.NotThreadSafe;
|
||||
import javax.xml.bind.JAXBElement;
|
||||
|
@ -51,7 +51,7 @@ import org.joda.time.DateTime;
|
|||
public final class RdeMarshaller implements Serializable {
|
||||
|
||||
private static final FluentLogger logger = FluentLogger.forEnclosingClass();
|
||||
private static final long serialVersionUID = 202890386611768455L;
|
||||
@Serial private static final long serialVersionUID = 202890386611768455L;
|
||||
|
||||
private final ValidationMode validationMode;
|
||||
private transient XmlFragmentMarshaller memoizedMarshaller;
|
||||
|
@ -85,13 +85,12 @@ public final class RdeMarshaller implements Serializable {
|
|||
ByteArrayOutputStream os = new ByteArrayOutputStream();
|
||||
try {
|
||||
XjcXmlTransformer.marshal(deposit, os, UTF_8, validationMode);
|
||||
// TODO: Call StandardCharset.UTF_8 instead once we are one Java 17 runtime.
|
||||
String rdeDocument = os.toString("UTF-8");
|
||||
String rdeDocument = os.toString(UTF_8);
|
||||
String marker = "<rde:contents>\n";
|
||||
int startOfContents = rdeDocument.indexOf(marker);
|
||||
verify(startOfContents > 0, "Bad RDE document:\n%s", rdeDocument);
|
||||
return rdeDocument.substring(0, startOfContents + marker.length());
|
||||
} catch (XmlException | UnsupportedEncodingException e) {
|
||||
} catch (XmlException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
|
||||
|
|
|
@ -22,7 +22,6 @@ import static com.google.common.net.HttpHeaders.CONTENT_LENGTH;
|
|||
import static com.google.common.net.HttpHeaders.CONTENT_TYPE;
|
||||
import static java.nio.charset.StandardCharsets.UTF_8;
|
||||
|
||||
import com.google.common.base.Strings;
|
||||
import com.google.common.io.ByteStreams;
|
||||
import com.google.common.net.MediaType;
|
||||
import java.io.ByteArrayInputStream;
|
||||
|
@ -133,6 +132,6 @@ public final class UrlConnectionUtils {
|
|||
random.nextBytes(rand);
|
||||
// Boundary strings can be up to 70 characters long, so use 30 hyphens plus 32 random digits.
|
||||
// See https://tools.ietf.org/html/rfc2046#section-5.1.1
|
||||
return Strings.repeat("-", 30) + base64().encode(rand);
|
||||
return "-".repeat(30) + base64().encode(rand);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -17,7 +17,6 @@ package google.registry.tools;
|
|||
import static com.google.common.base.Preconditions.checkState;
|
||||
|
||||
import com.google.common.base.Ascii;
|
||||
import com.google.common.base.Strings;
|
||||
import google.registry.model.EppResource;
|
||||
import google.registry.model.ForeignKeyUtils;
|
||||
import google.registry.model.contact.Contact;
|
||||
|
@ -46,10 +45,8 @@ class CommandUtilities {
|
|||
}
|
||||
}
|
||||
|
||||
// TODO: change Strings.repeat("-", n) to "-".repeat(n) once we are on Java 17 runtime.
|
||||
@SuppressWarnings("InlineMeInliner")
|
||||
static String addHeader(String header, String body) {
|
||||
return String.format("%s:\n%s\n%s", header, Strings.repeat("-", header.length() + 1), body);
|
||||
return String.format("%s:\n%s\n%s", header, "-".repeat(header.length() + 1), body);
|
||||
}
|
||||
|
||||
/** Prompts for yes/no input using promptText, defaulting to no. */
|
||||
|
|
|
@ -19,7 +19,6 @@ import static google.registry.persistence.transaction.TransactionManagerFactory.
|
|||
|
||||
import com.beust.jcommander.Parameter;
|
||||
import com.beust.jcommander.Parameters;
|
||||
import com.google.common.base.Strings;
|
||||
import com.google.common.collect.ImmutableMap;
|
||||
import google.registry.model.common.Cursor;
|
||||
import google.registry.model.common.Cursor.CursorType;
|
||||
|
@ -64,7 +63,7 @@ final class ListCursorsCommand implements Command {
|
|||
tm().transact(() -> tm().loadByKeysIfPresent(cursorKeys.values()));
|
||||
if (!cursorKeys.isEmpty()) {
|
||||
String header = String.format(OUTPUT_FMT, "TLD", "Cursor Time", "Last Update Time");
|
||||
System.out.printf("%s\n%s\n", header, Strings.repeat("-", header.length()));
|
||||
System.out.printf("%s\n%s\n", header, "-".repeat(header.length()));
|
||||
cursorKeys.entrySet().stream()
|
||||
.map(e -> renderLine(e.getKey(), Optional.ofNullable(cursors.get(e.getValue()))))
|
||||
.sorted()
|
||||
|
|
|
@ -21,7 +21,6 @@ import static google.registry.util.PreconditionsUtils.checkArgumentPresent;
|
|||
|
||||
import com.beust.jcommander.Parameter;
|
||||
import com.beust.jcommander.Parameters;
|
||||
import com.google.common.base.Strings;
|
||||
import com.google.common.collect.ImmutableMap;
|
||||
import com.google.common.collect.ImmutableSet;
|
||||
import com.google.common.collect.Streams;
|
||||
|
@ -94,14 +93,14 @@ final class VerifyOteCommand implements CommandWithConnection {
|
|||
ImmutableMap.of(
|
||||
"summarize", Boolean.toString(summarize),
|
||||
"registrars", new ArrayList<>(registrars)));
|
||||
System.out.println(Strings.repeat("-", 80));
|
||||
System.out.println("-".repeat(80));
|
||||
for (Entry<String, Object> registrar : response.entrySet()) {
|
||||
System.out.printf(
|
||||
summarize ? "%-20s - %s\n" : "\n=========== %s OT&E status ============\n%s\n",
|
||||
registrar.getKey(),
|
||||
registrar.getValue());
|
||||
}
|
||||
System.out.println(Strings.repeat("-", 80));
|
||||
System.out.println("-".repeat(80));
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -239,8 +239,7 @@ public abstract class ListObjectsAction<T extends ImmutableObject> implements Ru
|
|||
lines.add(rowFormatter.apply(headerRow));
|
||||
|
||||
// Add a row of separator lines (column names mapping to '-' * column width).
|
||||
Map<String, String> separatorRow =
|
||||
Maps.transformValues(columnWidths, width -> Strings.repeat("-", width));
|
||||
Map<String, String> separatorRow = Maps.transformValues(columnWidths, "-"::repeat);
|
||||
lines.add(rowFormatter.apply(separatorRow));
|
||||
}
|
||||
|
||||
|
|
|
@ -40,7 +40,6 @@ import static org.joda.money.CurrencyUnit.JPY;
|
|||
import static org.joda.money.CurrencyUnit.USD;
|
||||
import static org.junit.jupiter.api.Assertions.assertThrows;
|
||||
|
||||
import com.google.common.base.Strings;
|
||||
import com.google.common.collect.ImmutableList;
|
||||
import com.google.common.collect.ImmutableMap;
|
||||
import com.google.common.collect.ImmutableSet;
|
||||
|
@ -802,7 +801,7 @@ class DomainCheckFlowTest extends ResourceCheckFlowTestCase<DomainCheckFlow, Dom
|
|||
|
||||
@Test
|
||||
void testFailure_tooLong() {
|
||||
doFailingBadLabelTest(Strings.repeat("a", 64) + ".tld", DomainLabelTooLongException.class);
|
||||
doFailingBadLabelTest("a".repeat(64) + ".tld", DomainLabelTooLongException.class);
|
||||
}
|
||||
|
||||
@Test
|
||||
|
|
|
@ -65,7 +65,6 @@ import static org.joda.money.CurrencyUnit.JPY;
|
|||
import static org.joda.money.CurrencyUnit.USD;
|
||||
import static org.junit.jupiter.api.Assertions.assertThrows;
|
||||
|
||||
import com.google.common.base.Strings;
|
||||
import com.google.common.collect.ImmutableList;
|
||||
import com.google.common.collect.ImmutableMap;
|
||||
import com.google.common.collect.ImmutableSet;
|
||||
|
@ -191,8 +190,6 @@ import google.registry.tmch.SmdrlCsvParser;
|
|||
import google.registry.tmch.TmchData;
|
||||
import google.registry.tmch.TmchTestData;
|
||||
import google.registry.xml.ValidationMode;
|
||||
import java.io.BufferedReader;
|
||||
import java.io.StringReader;
|
||||
import java.math.BigDecimal;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.util.Map;
|
||||
|
@ -2764,7 +2761,7 @@ class DomainCreateFlowTest extends ResourceFlowTestCase<DomainCreateFlow, Domain
|
|||
|
||||
@Test
|
||||
void testFailure_tooLong() {
|
||||
doFailingDomainNameTest(Strings.repeat("a", 64) + ".tld", DomainLabelTooLongException.class);
|
||||
doFailingDomainNameTest("a".repeat(64) + ".tld", DomainLabelTooLongException.class);
|
||||
}
|
||||
|
||||
@Test
|
||||
|
@ -2887,11 +2884,7 @@ class DomainCreateFlowTest extends ResourceFlowTestCase<DomainCreateFlow, Domain
|
|||
|
||||
@Test
|
||||
void testFail_startDateSunriseRegistration_revokedSignedMark() throws Exception {
|
||||
SmdrlCsvParser.parse(
|
||||
// TODO: Use String.lines() once we are on Java 17.
|
||||
new BufferedReader(new StringReader(TmchTestData.loadFile("smd/smdrl.csv")))
|
||||
.lines()
|
||||
.collect(toImmutableList()))
|
||||
SmdrlCsvParser.parse(TmchTestData.loadFile("smd/smdrl.csv").lines().collect(toImmutableList()))
|
||||
.save();
|
||||
createTld("tld", START_DATE_SUNRISE);
|
||||
clock.setTo(SMD_VALID_TIME);
|
||||
|
@ -2917,11 +2910,8 @@ class DomainCreateFlowTest extends ResourceFlowTestCase<DomainCreateFlow, Domain
|
|||
if (labels.isEmpty()) {
|
||||
return;
|
||||
}
|
||||
// TODO: Use String.lines() once we are on Java 17.
|
||||
SmdrlCsvParser.parse(
|
||||
new BufferedReader(new StringReader(TmchTestData.loadFile("idn/idn_smdrl.csv")))
|
||||
.lines()
|
||||
.collect(toImmutableList()))
|
||||
TmchTestData.loadFile("idn/idn_smdrl.csv").lines().collect(toImmutableList()))
|
||||
.save();
|
||||
createTld("tld", START_DATE_SUNRISE);
|
||||
clock.setTo(SMD_VALID_TIME);
|
||||
|
|
|
@ -30,7 +30,6 @@ import static google.registry.testing.EppExceptionSubject.assertAboutEppExceptio
|
|||
import static google.registry.testing.HostSubject.assertAboutHosts;
|
||||
import static org.junit.jupiter.api.Assertions.assertThrows;
|
||||
|
||||
import com.google.common.base.Strings;
|
||||
import com.google.common.collect.ImmutableMap;
|
||||
import com.google.common.collect.ImmutableSet;
|
||||
import google.registry.flows.EppException;
|
||||
|
@ -259,7 +258,7 @@ class HostCreateFlowTest extends ResourceFlowTestCase<HostCreateFlow, Host> {
|
|||
|
||||
@Test
|
||||
void testFailure_longHostName() {
|
||||
setEppHostCreateInputWithIps("a" + Strings.repeat(".labelpart", 25) + ".tld");
|
||||
setEppHostCreateInputWithIps("a" + ".labelpart".repeat(25) + ".tld");
|
||||
EppException thrown = assertThrows(HostNameTooLongException.class, this::runFlow);
|
||||
assertAboutEppExceptions().that(thrown).marshalsToXml();
|
||||
}
|
||||
|
|
|
@ -18,7 +18,6 @@ import static com.google.common.truth.Truth.assertThat;
|
|||
import static google.registry.flows.host.HostFlowUtils.validateHostName;
|
||||
import static org.junit.jupiter.api.Assertions.assertThrows;
|
||||
|
||||
import com.google.common.base.Strings;
|
||||
import google.registry.flows.host.HostFlowUtils.HostNameNotLowerCaseException;
|
||||
import google.registry.flows.host.HostFlowUtils.HostNameNotNormalizedException;
|
||||
import google.registry.flows.host.HostFlowUtils.HostNameNotPunyCodedException;
|
||||
|
@ -61,8 +60,7 @@ class HostFlowUtilsTest {
|
|||
@Test
|
||||
void test_validateHostName_hostNameTooLong() {
|
||||
assertThrows(
|
||||
HostNameTooLongException.class,
|
||||
() -> validateHostName(Strings.repeat("na", 200) + ".wat.man"));
|
||||
HostNameTooLongException.class, () -> validateHostName("na".repeat(200) + ".wat.man"));
|
||||
}
|
||||
|
||||
@Test
|
||||
|
|
|
@ -41,7 +41,6 @@ import static google.registry.util.DateTimeUtils.END_OF_TIME;
|
|||
import static org.junit.jupiter.api.Assertions.assertThrows;
|
||||
|
||||
import com.google.cloud.tasks.v2.HttpMethod;
|
||||
import com.google.common.base.Strings;
|
||||
import com.google.common.collect.ImmutableMap;
|
||||
import com.google.common.collect.ImmutableSet;
|
||||
import com.google.common.net.InetAddresses;
|
||||
|
@ -1274,7 +1273,7 @@ class HostUpdateFlowTest extends ResourceFlowTestCase<HostUpdateFlow, Host> {
|
|||
void testFailure_renameToTooLong() throws Exception {
|
||||
// Host names can be max 253 chars.
|
||||
String suffix = ".example.tld";
|
||||
String tooLong = Strings.repeat("a", 254 - suffix.length()) + suffix;
|
||||
String tooLong = "a".repeat(254 - suffix.length()) + suffix;
|
||||
doFailingHostNameTest(tooLong, HostNameTooLongException.class);
|
||||
}
|
||||
|
||||
|
|
|
@ -14,6 +14,7 @@
|
|||
|
||||
package google.registry.persistence.transaction;
|
||||
|
||||
import static com.google.common.base.Preconditions.checkArgument;
|
||||
import static com.google.common.truth.Truth.assertThat;
|
||||
import static google.registry.persistence.transaction.TransactionManagerFactory.tm;
|
||||
import static java.nio.charset.StandardCharsets.UTF_8;
|
||||
|
@ -24,12 +25,12 @@ import google.registry.persistence.transaction.JpaTestExtensions.JpaUnitTestExte
|
|||
import java.io.ByteArrayInputStream;
|
||||
import java.io.IOException;
|
||||
import java.util.logging.Level;
|
||||
import java.util.logging.LogManager;
|
||||
import java.util.logging.Logger;
|
||||
import javax.persistence.Entity;
|
||||
import javax.persistence.Id;
|
||||
import org.junit.jupiter.api.AfterEach;
|
||||
import org.junit.jupiter.api.BeforeEach;
|
||||
import org.junit.jupiter.api.Disabled;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.junit.jupiter.api.extension.RegisterExtension;
|
||||
|
||||
|
@ -38,8 +39,6 @@ import org.junit.jupiter.api.extension.RegisterExtension;
|
|||
*
|
||||
* <p>Please refer to the class javadoc of {@link DatabaseException} for more information.
|
||||
*/
|
||||
@Disabled // TODO: re-enable test class after upgrading to Java 17.
|
||||
// LogManager.updateConfiguration() is only supported in Java 9 and later.
|
||||
public class HibernateLoggingSuppressionTest {
|
||||
|
||||
private static final String LOG_SUPPRESSION_TARGET =
|
||||
|
@ -74,7 +73,6 @@ public class HibernateLoggingSuppressionTest {
|
|||
void suppressHibernateLogs() throws IOException {
|
||||
try (ByteArrayInputStream additionalProperties =
|
||||
new ByteArrayInputStream(LOGGING_PROPERTIES_LINE.getBytes(UTF_8))) {
|
||||
/*
|
||||
LogManager.getLogManager()
|
||||
.updateConfiguration(
|
||||
additionalProperties,
|
||||
|
@ -86,14 +84,12 @@ public class HibernateLoggingSuppressionTest {
|
|||
checkArgument(o == null, "Cannot override old value in this test");
|
||||
return n;
|
||||
});
|
||||
*/
|
||||
}
|
||||
}
|
||||
|
||||
void revertSuppressionOfHibernateLogs() throws IOException {
|
||||
try (ByteArrayInputStream additionalProperties =
|
||||
new ByteArrayInputStream(LOGGING_PROPERTIES_LINE.getBytes(UTF_8))) {
|
||||
/*
|
||||
LogManager.getLogManager()
|
||||
.updateConfiguration(
|
||||
additionalProperties,
|
||||
|
@ -104,7 +100,6 @@ public class HibernateLoggingSuppressionTest {
|
|||
}
|
||||
return null;
|
||||
});
|
||||
*/
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -150,7 +145,7 @@ public class HibernateLoggingSuppressionTest {
|
|||
int value;
|
||||
|
||||
// For Hibernate
|
||||
TestEntity() {}
|
||||
public TestEntity() {}
|
||||
|
||||
TestEntity(long id, int value) {
|
||||
this.id = id;
|
||||
|
|
|
@ -173,8 +173,7 @@ public abstract class JpaTransactionManagerExtension
|
|||
File tempSqlFile = File.createTempFile("tempSqlFile", ".sql");
|
||||
tempSqlFile.deleteOnExit();
|
||||
exporter.export(extraEntityClasses, tempSqlFile);
|
||||
// TODO: Use Files.readString() once we upgrade to Java 17 runtime.
|
||||
executeSql(new String(Files.readAllBytes(tempSqlFile.toPath()), UTF_8));
|
||||
executeSql(Files.readString(tempSqlFile.toPath(), UTF_8));
|
||||
}
|
||||
assertReasonableNumDbConnections();
|
||||
emf = createEntityManagerFactory(getJpaProperties());
|
||||
|
|
|
@ -21,7 +21,6 @@ import static google.registry.testing.SystemInfo.hasCommand;
|
|||
import static java.nio.charset.StandardCharsets.UTF_8;
|
||||
import static org.junit.jupiter.api.Assumptions.assumeTrue;
|
||||
|
||||
import com.google.common.base.Strings;
|
||||
import com.google.common.collect.ImmutableList;
|
||||
import com.google.common.io.CharStreams;
|
||||
import google.registry.keyring.api.Keyring;
|
||||
|
@ -55,10 +54,7 @@ class GhostrydeGpgIntegrationTest {
|
|||
|
||||
private static final ImmutableList<String> CONTENTS =
|
||||
ImmutableList.of(
|
||||
"(◕‿◕)",
|
||||
Strings.repeat("Fanatics have their dreams, wherewith they weave\n", 1000),
|
||||
"\0yolo",
|
||||
"");
|
||||
"(◕‿◕)", "Fanatics have their dreams, wherewith they weave\n".repeat(1000), "\0yolo", "");
|
||||
|
||||
@SuppressWarnings("unused")
|
||||
static Stream<Arguments> provideTestCombinations() {
|
||||
|
|
|
@ -20,7 +20,6 @@ import static java.nio.charset.StandardCharsets.UTF_8;
|
|||
import static org.junit.jupiter.api.Assertions.assertThrows;
|
||||
import static org.junit.jupiter.api.Assumptions.assumeTrue;
|
||||
|
||||
import com.google.common.base.Strings;
|
||||
import com.google.common.io.ByteStreams;
|
||||
import google.registry.keyring.api.Keyring;
|
||||
import google.registry.testing.BouncyCastleProviderExtension;
|
||||
|
@ -54,7 +53,7 @@ public class GhostrydeTest {
|
|||
return Stream.of(
|
||||
"hi",
|
||||
"(◕‿◕)",
|
||||
Strings.repeat("Fanatics have their dreams, wherewith they weave\n", 1000),
|
||||
"Fanatics have their dreams, wherewith they weave\n".repeat(1000),
|
||||
"\0yolo",
|
||||
"")
|
||||
.map(Arguments::of);
|
||||
|
|
|
@ -21,7 +21,6 @@ import static google.registry.testing.SystemInfo.hasCommand;
|
|||
import static java.nio.charset.StandardCharsets.UTF_8;
|
||||
import static org.junit.jupiter.api.Assumptions.assumeTrue;
|
||||
|
||||
import com.google.common.base.Strings;
|
||||
import com.google.common.collect.ImmutableList;
|
||||
import com.google.common.flogger.FluentLogger;
|
||||
import com.google.common.io.CharStreams;
|
||||
|
@ -63,10 +62,7 @@ public class RydeGpgIntegrationTest {
|
|||
|
||||
private static final ImmutableList<String> CONTENTS =
|
||||
ImmutableList.of(
|
||||
"(◕‿◕)",
|
||||
Strings.repeat("Fanatics have their dreams, wherewith they weave\n", 1000),
|
||||
"\0yolo",
|
||||
"");
|
||||
"(◕‿◕)", "Fanatics have their dreams, wherewith they weave\n".repeat(1000), "\0yolo", "");
|
||||
|
||||
static Stream<Arguments> provideTestCombinations() {
|
||||
Stream.Builder<Arguments> stream = Stream.builder();
|
||||
|
|
|
@ -71,19 +71,20 @@ import org.junit.jupiter.api.extension.RegisterExtension;
|
|||
class NordnUploadActionTest {
|
||||
|
||||
private static final String CLAIMS_CSV =
|
||||
"1,2010-05-04T10:11:12.000Z,2\n"
|
||||
+ "roid,domain-name,notice-id,registrar-id,registration-datetime,ack-datetime,"
|
||||
+ "application-datetime\n"
|
||||
+ "6-TLD,claims-landrush2.tld,landrush2tcn,88888,2010-05-03T10:11:12.000Z,"
|
||||
+ "2010-05-03T08:11:12.000Z\n"
|
||||
+ "8-TLD,claims-landrush1.tld,landrush1tcn,99999,2010-05-04T10:11:12.000Z,"
|
||||
+ "2010-05-04T09:11:12.000Z\n";
|
||||
"""
|
||||
1,2010-05-04T10:11:12.000Z,2
|
||||
roid,domain-name,notice-id,registrar-id,registration-datetime,ack-datetime,application-datetime
|
||||
6-TLD,claims-landrush2.tld,landrush2tcn,88888,2010-05-03T10:11:12.000Z,2010-05-03T08:11:12.000Z
|
||||
8-TLD,claims-landrush1.tld,landrush1tcn,99999,2010-05-04T10:11:12.000Z,2010-05-04T09:11:12.000Z
|
||||
""";
|
||||
|
||||
private static final String SUNRISE_CSV =
|
||||
"1,2010-05-04T10:11:12.000Z,2\n"
|
||||
+ "roid,domain-name,SMD-id,registrar-id,registration-datetime,application-datetime\n"
|
||||
+ "2-TLD,sunrise2.tld,new-smdid,88888,2010-05-01T10:11:12.000Z\n"
|
||||
+ "4-TLD,sunrise1.tld,my-smdid,99999,2010-05-02T10:11:12.000Z\n";
|
||||
"""
|
||||
1,2010-05-04T10:11:12.000Z,2
|
||||
roid,domain-name,SMD-id,registrar-id,registration-datetime,application-datetime
|
||||
2-TLD,sunrise2.tld,new-smdid,88888,2010-05-01T10:11:12.000Z
|
||||
4-TLD,sunrise1.tld,my-smdid,99999,2010-05-02T10:11:12.000Z
|
||||
""";
|
||||
|
||||
private static final String LOCATION_URL = "http://trololol";
|
||||
|
||||
|
@ -249,8 +250,7 @@ class NordnUploadActionTest {
|
|||
verify(httpUrlConnection).setRequestMethod("POST");
|
||||
assertThat(httpUrlConnection.getURL())
|
||||
.isEqualTo(new URL("http://127.0.0.1/LORDN/tld/" + phase));
|
||||
// TODO: use toString(StandardCharsets.UTF_8) once we upgrade to Java 17.
|
||||
assertThat(connectionOutputStream.toString("UTF-8")).contains(csv);
|
||||
assertThat(connectionOutputStream.toString(UTF_8)).contains(csv);
|
||||
verifyColumnCleared(domain1);
|
||||
verifyColumnCleared(domain2);
|
||||
cloudTasksHelper.assertTasksEnqueued(
|
||||
|
|
|
@ -73,8 +73,7 @@ final class GcpProjectConnectionTest {
|
|||
ByteArrayOutputStream output = new ByteArrayOutputStream();
|
||||
getStreamingContent().writeTo(output);
|
||||
output.close();
|
||||
// TODO: use toString(StandardCharsets.UTF_8) once we upgrade to Java 17.
|
||||
return output.toString("UTF-8");
|
||||
return output.toString(UTF_8);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -22,7 +22,6 @@ import static org.junit.jupiter.api.Assertions.assertThrows;
|
|||
import static org.mockito.ArgumentMatchers.eq;
|
||||
import static org.mockito.Mockito.verify;
|
||||
|
||||
import com.google.common.base.Strings;
|
||||
import com.google.common.collect.ImmutableMap;
|
||||
import com.google.common.net.MediaType;
|
||||
import google.registry.model.tld.Tld.TldType;
|
||||
|
@ -51,7 +50,7 @@ public class ListDomainsCommandTest extends ListObjectsCommandTestCase<ListDomai
|
|||
@Test
|
||||
@MockitoSettings(strictness = Strictness.LENIENT)
|
||||
void test_tldsParamTooLong() {
|
||||
String tldsParam = "--tlds=foo,bar" + Strings.repeat(",baz", 300);
|
||||
String tldsParam = "--tlds=foo,bar" + ",baz".repeat(300);
|
||||
IllegalArgumentException thrown =
|
||||
assertThrows(IllegalArgumentException.class, () -> runCommand(tldsParam));
|
||||
assertThat(thrown)
|
||||
|
|
|
@ -14,7 +14,6 @@
|
|||
|
||||
package google.registry.ui.server.registrar;
|
||||
|
||||
import static com.google.common.base.Strings.repeat;
|
||||
import static com.google.common.truth.Truth.assertThat;
|
||||
import static google.registry.testing.DatabaseHelper.loadRegistrar;
|
||||
|
||||
|
@ -98,7 +97,7 @@ class WhoisSettingsTest extends RegistrarSettingsActionTestCase {
|
|||
.setFaxNumber("+1.2125650001")
|
||||
.setLocalizedAddress(
|
||||
new RegistrarAddress.Builder()
|
||||
.setStreet(ImmutableList.of("76 Ninth Avenue", repeat("lol", 200)))
|
||||
.setStreet(ImmutableList.of("76 Ninth Avenue", "lol".repeat(200)))
|
||||
.setCity("New York")
|
||||
.setState("NY")
|
||||
.setZip("10009")
|
||||
|
|
|
@ -29,11 +29,9 @@ import com.google.common.collect.ImmutableList;
|
|||
import com.google.common.collect.ImmutableMap;
|
||||
import com.google.common.collect.ImmutableSet;
|
||||
import com.google.common.flogger.FluentLogger;
|
||||
import com.google.common.io.ByteStreams;
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.nio.file.Path;
|
||||
import java.nio.file.Paths;
|
||||
import java.util.Map;
|
||||
import java.util.Optional;
|
||||
import java.util.regex.Matcher;
|
||||
|
@ -143,10 +141,7 @@ public class FlywayDeadlockTest {
|
|||
"create index if not exists index_name on public.element_name ...",
|
||||
"create index if not exists \"index_name\" on public.element_name ...",
|
||||
"create unique index public.index_name on public.\"element_name\" ...");
|
||||
ddls.forEach(
|
||||
ddl -> {
|
||||
assertThat(getDdlLockedElementName(ddl)).hasValue("element_name");
|
||||
});
|
||||
ddls.forEach(ddl -> assertThat(getDdlLockedElementName(ddl)).hasValue("element_name"));
|
||||
}
|
||||
|
||||
@Test
|
||||
|
@ -160,10 +155,7 @@ public class FlywayDeadlockTest {
|
|||
"drop table element_name ...;",
|
||||
"drop sequence element_name ...;",
|
||||
"drop INDEX element_name ...;");
|
||||
ddls.forEach(
|
||||
ddl -> {
|
||||
assertThat(getDdlLockedElementName(ddl)).isEmpty();
|
||||
});
|
||||
ddls.forEach(ddl -> assertThat(getDdlLockedElementName(ddl)).isEmpty());
|
||||
}
|
||||
|
||||
static Optional<String> getDdlLockedElementName(String ddl) {
|
||||
|
@ -183,8 +175,7 @@ public class FlywayDeadlockTest {
|
|||
.splitToStream(
|
||||
readAllLines(path, UTF_8).stream()
|
||||
.map(line -> line.replaceAll("--.*", ""))
|
||||
// TODO: Use line.isBlank() one we are on Java 17.
|
||||
.filter(line -> !line.trim().isEmpty())
|
||||
.filter(line -> !line.isBlank())
|
||||
.collect(joining(" ")))
|
||||
.map(FlywayDeadlockTest::getDdlLockedElementName)
|
||||
.filter(Optional::isPresent)
|
||||
|
@ -214,8 +205,7 @@ public class FlywayDeadlockTest {
|
|||
.splitToList(executeShellCommand(changedScriptsCommand, Optional.of(rootDir)))
|
||||
.stream()
|
||||
.map(pathStr -> rootDir + File.separator + pathStr)
|
||||
// TODO: Use Path::of once we are on Java 17.
|
||||
.map(path -> Paths.get(path))
|
||||
.map(Path::of)
|
||||
.collect(toImmutableList());
|
||||
if (changedPaths.isEmpty()) {
|
||||
logger.atInfo().log("There are no schema changes.");
|
||||
|
@ -238,9 +228,8 @@ public class FlywayDeadlockTest {
|
|||
new ProcessBuilder(SHELL_COMMAND_SPLITTER.splitToList(command).toArray(new String[0]));
|
||||
workingDir.map(File::new).ifPresent(processBuilder::directory);
|
||||
Process process = processBuilder.start();
|
||||
// TODO:Use InputStream.readAllBytes() once we are on Java 17.
|
||||
String output = new String(ByteStreams.toByteArray(process.getInputStream()), UTF_8);
|
||||
String error = new String(ByteStreams.toByteArray(process.getErrorStream()), UTF_8);
|
||||
String output = new String(process.getInputStream().readAllBytes(), UTF_8);
|
||||
String error = new String(process.getErrorStream().readAllBytes(), UTF_8);
|
||||
try {
|
||||
process.waitFor(1, SECONDS);
|
||||
} catch (InterruptedException ie) {
|
||||
|
|
|
@ -194,8 +194,7 @@ ext {
|
|||
'org.junit.jupiter:junit-jupiter-params:[5.6.2,)',
|
||||
'org.junit.platform:junit-platform-runner:[1.6.2,)',
|
||||
'org.junit.platform:junit-platform-suite-api:[1.6.2,)',
|
||||
// TODO: remove the exclusive upper bound once we are on Java 17 runtime.
|
||||
'org.junit-pioneer:junit-pioneer:[0.7.0,2.0.0[',
|
||||
'org.junit-pioneer:junit-pioneer:[0.7.0,)',
|
||||
'org.apache.avro:avro:[1.8.2,)',
|
||||
'org.apache.beam:beam-runners-core-construction-java:[2.37.0,)',
|
||||
'org.apache.beam:beam-runners-direct-java:[2.37.0,)',
|
||||
|
|
|
@ -133,8 +133,6 @@ tasks.withType(JavaCompile).configureEach {
|
|||
options.errorprone.disable("LongDoubleConversion")
|
||||
// Allow import of commonly-used names such as "Type".
|
||||
options.errorprone.disable("BadImport")
|
||||
// TODO: enable this once we are on Java 17 runtime.
|
||||
options.errorprone.disable("InlineMeInliner")
|
||||
options.errorprone.disableWarningsInGeneratedCode = true
|
||||
options.errorprone.errorproneArgumentProviders.add([
|
||||
asArguments: {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue