Make EscrowDepositEncryptor work with BRDA deposits (#1512)

Also make it possible to specify a revision number.

<!-- Reviewable:start -->
---
This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/google/nomulus/1512)
<!-- Reviewable:end -->
This commit is contained in:
Lai Jiang
2022-02-07 12:40:00 -05:00
committed by GitHub
parent b412bdef9f
commit 09dca28122
3 changed files with 72 additions and 11 deletions
@@ -40,6 +40,8 @@ public class EncryptEscrowDepositCommandTest
EscrowDepositEncryptor res = new EscrowDepositEncryptor();
res.rdeReceiverKey = () -> new FakeKeyringModule().get().getRdeReceiverKey();
res.rdeSigningKey = () -> new FakeKeyringModule().get().getRdeSigningKey();
res.brdaReceiverKey = () -> new FakeKeyringModule().get().getBrdaReceiverKey();
res.brdaSigningKey = () -> new FakeKeyringModule().get().getBrdaSigningKey();
return res;
}
@@ -61,4 +63,34 @@ public class EncryptEscrowDepositCommandTest
"lol_2010-10-17_full_S1_R0.sig",
"lol.pub");
}
@Test
void testSuccess_brda() throws Exception {
Path depositFile = tmpDir.resolve("deposit.xml");
Files.write(depositXml.read(), depositFile.toFile());
runCommand(
"--mode=THIN", "--tld=lol", "--input=" + depositFile, "--outdir=" + tmpDir.toString());
assertThat(tmpDir.toFile().list())
.asList()
.containsExactly(
"deposit.xml",
"lol_2010-10-17_thin_S1_R0.ryde",
"lol_2010-10-17_thin_S1_R0.sig",
"lol.pub");
}
@Test
void testSuccess_revision() throws Exception {
Path depositFile = tmpDir.resolve("deposit.xml");
Files.write(depositXml.read(), depositFile.toFile());
runCommand(
"--revision=1", "--tld=lol", "--input=" + depositFile, "--outdir=" + tmpDir.toString());
assertThat(tmpDir.toFile().list())
.asList()
.containsExactly(
"deposit.xml",
"lol_2010-10-17_full_S1_R1.ryde",
"lol_2010-10-17_full_S1_R1.sig",
"lol.pub");
}
}