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:
guyben 2017-04-11 19:38:14 -07:00 committed by Ben McIlwain
parent dea386d08a
commit ab515cb352
16 changed files with 94 additions and 36 deletions

View file

@ -50,8 +50,8 @@ public class EncryptEscrowDepositCommandTest
res.pgpFileFactory = new RydePgpFileOutputStreamFactory(Providers.of(1024));
res.pgpSigningFactory = new RydePgpSigningOutputStreamFactory();
res.tarFactory = new RydeTarOutputStreamFactory();
res.rdeReceiverKey = new FakeKeyringModule().get().getRdeReceiverKey();
res.rdeSigningKey = new FakeKeyringModule().get().getRdeSigningKey();
res.rdeReceiverKey = Providers.of(new FakeKeyringModule().get().getRdeReceiverKey());
res.rdeSigningKey = Providers.of(new FakeKeyringModule().get().getRdeSigningKey());
return res;
}

View file

@ -23,6 +23,7 @@ import google.registry.rde.Ghostryde.DecodeResult;
import google.registry.testing.BouncyCastleProviderRule;
import google.registry.testing.FakeKeyringModule;
import google.registry.testing.InjectRule;
import google.registry.testing.Providers;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.Paths;
@ -67,8 +68,8 @@ public class GhostrydeCommandTest extends CommandTestCase<GhostrydeCommand> {
public void before() throws Exception {
keyring = new FakeKeyringModule().get();
command.ghostryde = new Ghostryde(1024);
command.rdeStagingDecryptionKey = keyring.getRdeStagingDecryptionKey();
command.rdeStagingEncryptionKey = keyring.getRdeStagingEncryptionKey();
command.rdeStagingDecryptionKey = Providers.of(keyring.getRdeStagingDecryptionKey());
command.rdeStagingEncryptionKey = Providers.of(keyring.getRdeStagingEncryptionKey());
}
@Test

View file

@ -94,12 +94,12 @@ public class ComparingInvocationHandlerTest {
return super.stringifyResult(method, a);
}
@Override protected boolean compareException(Method method, Throwable a, Throwable b) {
return exceptionEqualsResult && super.compareException(method, a, b);
@Override protected boolean compareThrown(Method method, Throwable a, Throwable b) {
return exceptionEqualsResult && super.compareThrown(method, a, b);
}
@Override protected String stringifyException(Method method, Throwable a) {
return String.format("testException(%s)", super.stringifyException(method, a));
@Override protected String stringifyThrown(Method method, Throwable a) {
return String.format("testException(%s)", super.stringifyThrown(method, a));
}
}