mirror of
https://github.com/google/nomulus.git
synced 2025-04-30 12:07:51 +02:00
Merge pull request #121 from weiminyu/deprecate
Fix or suppress some deprecation warnings
This commit is contained in:
commit
f3ceeb33af
6 changed files with 22 additions and 18 deletions
|
@ -48,7 +48,7 @@ import org.junit.Rule;
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
import org.junit.runner.RunWith;
|
import org.junit.runner.RunWith;
|
||||||
import org.junit.runners.JUnit4;
|
import org.junit.runners.JUnit4;
|
||||||
import org.mockito.Matchers;
|
import org.mockito.ArgumentMatchers;
|
||||||
|
|
||||||
@RunWith(JUnit4.class)
|
@RunWith(JUnit4.class)
|
||||||
public class ExportPremiumTermsActionTest {
|
public class ExportPremiumTermsActionTest {
|
||||||
|
@ -188,7 +188,8 @@ public class ExportPremiumTermsActionTest {
|
||||||
EXPECTED_FILE_CONTENT.getBytes(UTF_8));
|
EXPECTED_FILE_CONTENT.getBytes(UTF_8));
|
||||||
verifyNoMoreInteractions(driveConnection);
|
verifyNoMoreInteractions(driveConnection);
|
||||||
verify(response).setStatus(SC_INTERNAL_SERVER_ERROR);
|
verify(response).setStatus(SC_INTERNAL_SERVER_ERROR);
|
||||||
verify(response).setPayload(Matchers.contains("Error exporting premium terms file to Drive."));
|
verify(response).setPayload(
|
||||||
|
ArgumentMatchers.contains("Error exporting premium terms file to Drive."));
|
||||||
verify(response).setContentType(PLAIN_TEXT_UTF_8);
|
verify(response).setContentType(PLAIN_TEXT_UTF_8);
|
||||||
verifyNoMoreInteractions(response);
|
verifyNoMoreInteractions(response);
|
||||||
}
|
}
|
||||||
|
|
|
@ -22,7 +22,6 @@ import java.util.Map;
|
||||||
import javax.annotation.Nullable;
|
import javax.annotation.Nullable;
|
||||||
import javax.servlet.ServletContext;
|
import javax.servlet.ServletContext;
|
||||||
import javax.servlet.http.HttpSession;
|
import javax.servlet.http.HttpSession;
|
||||||
import javax.servlet.http.HttpSessionContext;
|
|
||||||
|
|
||||||
/** A fake {@link HttpSession} that only provides support for getting/setting attributes. */
|
/** A fake {@link HttpSession} that only provides support for getting/setting attributes. */
|
||||||
@SuppressWarnings("deprecation")
|
@SuppressWarnings("deprecation")
|
||||||
|
@ -63,7 +62,7 @@ public class FakeHttpSession implements HttpSession {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public HttpSessionContext getSessionContext() {
|
public javax.servlet.http.HttpSessionContext getSessionContext() {
|
||||||
throw new UnsupportedOperationException();
|
throw new UnsupportedOperationException();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -29,6 +29,7 @@ import google.registry.model.registrar.RegistrarContact;
|
||||||
import google.registry.module.frontend.FrontendServlet;
|
import google.registry.module.frontend.FrontendServlet;
|
||||||
import google.registry.server.RegistryTestServer;
|
import google.registry.server.RegistryTestServer;
|
||||||
import google.registry.testing.AppEngineRule;
|
import google.registry.testing.AppEngineRule;
|
||||||
|
import java.util.concurrent.TimeUnit;
|
||||||
import org.junit.Rule;
|
import org.junit.Rule;
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
import org.junit.rules.Timeout;
|
import org.junit.rules.Timeout;
|
||||||
|
@ -60,7 +61,7 @@ public class RegistrarConsoleWebTest extends WebDriverTestCase {
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@Rule public final Timeout deathClock = new Timeout(60000);
|
@Rule public final Timeout deathClock = new Timeout(60000, TimeUnit.MILLISECONDS);
|
||||||
|
|
||||||
/** Checks the identified element has the given text content. */
|
/** Checks the identified element has the given text content. */
|
||||||
void assertEltText(String eltId, String eltValue) {
|
void assertEltText(String eltId, String eltValue) {
|
||||||
|
|
|
@ -39,17 +39,19 @@ import org.openqa.selenium.TakesScreenshot;
|
||||||
import org.openqa.selenium.WebDriver;
|
import org.openqa.selenium.WebDriver;
|
||||||
import org.openqa.selenium.WebDriverException;
|
import org.openqa.selenium.WebDriverException;
|
||||||
import org.openqa.selenium.WebElement;
|
import org.openqa.selenium.WebElement;
|
||||||
import org.openqa.selenium.interactions.HasInputDevices;
|
|
||||||
import org.openqa.selenium.interactions.Keyboard;
|
|
||||||
import org.openqa.selenium.interactions.Mouse;
|
|
||||||
import org.openqa.selenium.remote.DesiredCapabilities;
|
import org.openqa.selenium.remote.DesiredCapabilities;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* WebDriver delegate JUnit Rule that exposes most {@link WebDriver} API plus {@link ScreenDiffer}
|
* WebDriver delegate JUnit Rule that exposes most {@link WebDriver} API plus {@link ScreenDiffer}
|
||||||
* API.
|
* API.
|
||||||
*/
|
*/
|
||||||
|
@SuppressWarnings("deprecation")
|
||||||
public final class WebDriverPlusScreenDifferRule extends ExternalResource
|
public final class WebDriverPlusScreenDifferRule extends ExternalResource
|
||||||
implements WebDriver, HasInputDevices, TakesScreenshot, JavascriptExecutor, HasCapabilities {
|
implements WebDriver,
|
||||||
|
org.openqa.selenium.interactions.HasInputDevices,
|
||||||
|
TakesScreenshot,
|
||||||
|
JavascriptExecutor,
|
||||||
|
HasCapabilities {
|
||||||
|
|
||||||
private static final int WAIT_FOR_ELEMENTS_POLLING_INTERVAL_MS = 10;
|
private static final int WAIT_FOR_ELEMENTS_POLLING_INTERVAL_MS = 10;
|
||||||
private static final int WAIT_FOR_ELEMENTS_BONUS_DELAY_MS = 150;
|
private static final int WAIT_FOR_ELEMENTS_BONUS_DELAY_MS = 150;
|
||||||
|
@ -274,13 +276,13 @@ public final class WebDriverPlusScreenDifferRule extends ExternalResource
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Keyboard getKeyboard() {
|
public org.openqa.selenium.interactions.Keyboard getKeyboard() {
|
||||||
return ((HasInputDevices) driver).getKeyboard();
|
return ((org.openqa.selenium.interactions.HasInputDevices) driver).getKeyboard();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Mouse getMouse() {
|
public org.openqa.selenium.interactions.Mouse getMouse() {
|
||||||
return ((HasInputDevices) driver).getMouse();
|
return ((org.openqa.selenium.interactions.HasInputDevices) driver).getMouse();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -33,7 +33,7 @@ import java.security.cert.Certificate;
|
||||||
import java.security.cert.X509Certificate;
|
import java.security.cert.X509Certificate;
|
||||||
import javax.inject.Named;
|
import javax.inject.Named;
|
||||||
import javax.inject.Singleton;
|
import javax.inject.Singleton;
|
||||||
import org.bouncycastle.openssl.PEMWriter;
|
import org.bouncycastle.openssl.jcajce.JcaPEMWriter;
|
||||||
import org.junit.Before;
|
import org.junit.Before;
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
import org.junit.runner.RunWith;
|
import org.junit.runner.RunWith;
|
||||||
|
@ -50,8 +50,8 @@ public class CertificateModuleTest {
|
||||||
|
|
||||||
private static byte[] getPemBytes(Object... objects) throws Exception {
|
private static byte[] getPemBytes(Object... objects) throws Exception {
|
||||||
ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream();
|
ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream();
|
||||||
try (PEMWriter pemWriter =
|
try (JcaPEMWriter pemWriter =
|
||||||
new PEMWriter(new OutputStreamWriter(byteArrayOutputStream, UTF_8))) {
|
new JcaPEMWriter(new OutputStreamWriter(byteArrayOutputStream, UTF_8))) {
|
||||||
for (Object object : objects) {
|
for (Object object : objects) {
|
||||||
pemWriter.writeObject(object);
|
pemWriter.writeObject(object);
|
||||||
}
|
}
|
||||||
|
|
|
@ -31,12 +31,12 @@ import java.util.Date;
|
||||||
import javax.net.ssl.SSLSession;
|
import javax.net.ssl.SSLSession;
|
||||||
import javax.security.auth.x500.X500Principal;
|
import javax.security.auth.x500.X500Principal;
|
||||||
import org.bouncycastle.jce.provider.BouncyCastleProvider;
|
import org.bouncycastle.jce.provider.BouncyCastleProvider;
|
||||||
import org.bouncycastle.x509.X509V3CertificateGenerator;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Utility class that provides methods used by {@link SslClientInitializerTest} and {@link
|
* Utility class that provides methods used by {@link SslClientInitializerTest} and {@link
|
||||||
* SslServerInitializerTest}.
|
* SslServerInitializerTest}.
|
||||||
*/
|
*/
|
||||||
|
@SuppressWarnings("deprecation")
|
||||||
public class SslInitializerTestUtils {
|
public class SslInitializerTestUtils {
|
||||||
|
|
||||||
static {
|
static {
|
||||||
|
@ -56,7 +56,8 @@ public class SslInitializerTestUtils {
|
||||||
*/
|
*/
|
||||||
public static X509Certificate signKeyPair(
|
public static X509Certificate signKeyPair(
|
||||||
SelfSignedCertificate ssc, KeyPair keyPair, String hostname) throws Exception {
|
SelfSignedCertificate ssc, KeyPair keyPair, String hostname) throws Exception {
|
||||||
X509V3CertificateGenerator certGen = new X509V3CertificateGenerator();
|
org.bouncycastle.x509.X509V3CertificateGenerator certGen =
|
||||||
|
new org.bouncycastle.x509.X509V3CertificateGenerator();
|
||||||
X500Principal dnName = new X500Principal("CN=" + hostname);
|
X500Principal dnName = new X500Principal("CN=" + hostname);
|
||||||
certGen.setSerialNumber(BigInteger.valueOf(System.currentTimeMillis()));
|
certGen.setSerialNumber(BigInteger.valueOf(System.currentTimeMillis()));
|
||||||
certGen.setSubjectDN(dnName);
|
certGen.setSubjectDN(dnName);
|
||||||
|
|
Loading…
Add table
Reference in a new issue