mirror of
https://github.com/google/nomulus
synced 2026-05-13 11:21:46 +00:00
Replace KeystoreKeyring with KmsKeystore comparison
Replace KeystoreKeyring with ComparatorKeyring between KeystoreKeyring and KmsKeystore. In the opensource version, will replace DummyKeyring with KmsKeyring directly. ------------- Created by MOE: https://github.com/google/moe MOE_MIGRATED_REVID=152893767
This commit is contained in:
@@ -21,6 +21,8 @@ import google.registry.util.ComparingInvocationHandler;
|
||||
import google.registry.util.FormattingLogger;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.PrintWriter;
|
||||
import java.io.StringWriter;
|
||||
import java.lang.reflect.Method;
|
||||
import java.util.Arrays;
|
||||
import java.util.Objects;
|
||||
@@ -43,7 +45,7 @@ import org.bouncycastle.openpgp.PGPPublicKey;
|
||||
* <p>If both keyrings threw exceptions, there is no check whether the exeptions are the same. The
|
||||
* assumption is that an error happened in both, but they might report that error differently.
|
||||
*/
|
||||
final class ComparatorKeyring extends ComparingInvocationHandler<Keyring> {
|
||||
public final class ComparatorKeyring extends ComparingInvocationHandler<Keyring> {
|
||||
|
||||
@VisibleForTesting
|
||||
static final FormattingLogger logger = FormattingLogger.getLoggerForCallerClass();
|
||||
@@ -98,6 +100,14 @@ final class ComparatorKeyring extends ComparingInvocationHandler<Keyring> {
|
||||
return super.stringifyResult(method, a);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String stringifyThrown(Method method, Throwable throwable) {
|
||||
StringWriter stringWriter = new StringWriter();
|
||||
PrintWriter printWriter = new PrintWriter(stringWriter);
|
||||
throwable.printStackTrace(printWriter);
|
||||
return String.format("%s\nStack trace:\n%s", throwable.toString(), stringWriter.toString());
|
||||
}
|
||||
|
||||
// .equals implementation for PGP types.
|
||||
|
||||
@VisibleForTesting
|
||||
|
||||
Reference in New Issue
Block a user