mirror of
https://github.com/google/nomulus.git
synced 2025-05-14 00:17:20 +02: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:
parent
dea386d08a
commit
ab515cb352
16 changed files with 94 additions and 36 deletions
|
@ -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
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue