1
0
Fork 0
mirror of https://github.com/pgpainless/pgpainless.git synced 2025-12-16 09:11:08 +01:00

Rename SubkeyLookup.getCertificateFingerprintsForSubkeyId()

This commit is contained in:
Paul Schaub 2022-03-01 14:36:22 +01:00
parent 5acd1f1812
commit 3193df37b0
8 changed files with 23 additions and 23 deletions

View file

@ -22,7 +22,7 @@ public class DatabaseSubkeyLookup implements SubkeyLookup {
}
@Override
public Set<String> getCertificatesForSubkeyId(long subkeyId) throws IOException {
public Set<String> getCertificateFingerprintsForSubkeyId(long subkeyId) throws IOException {
try {
List<Entry> entries = dao.selectValues(subkeyId);
Set<String> certificates = new HashSet<>();

View file

@ -38,25 +38,25 @@ public class SqliteSubkeyLookupTest {
store("eb85bb5fa33a75e15e944e63f231550c4f47e38e", 123L, 234L);
store("d1a66e1a23b182c9980f788cfbfcc82a015e7330", 234L);
assertEquals(Collections.singleton("eb85bb5fa33a75e15e944e63f231550c4f47e38e"), lookup.getCertificatesForSubkeyId(123L));
assertEquals(Collections.singleton("eb85bb5fa33a75e15e944e63f231550c4f47e38e"), lookup.getCertificateFingerprintsForSubkeyId(123L));
assertEquals(
new HashSet<>(Arrays.asList("eb85bb5fa33a75e15e944e63f231550c4f47e38e", "d1a66e1a23b182c9980f788cfbfcc82a015e7330")),
lookup.getCertificatesForSubkeyId(234L));
lookup.getCertificateFingerprintsForSubkeyId(234L));
}
@Test
public void getNonExistingSubkeyYieldsNull() throws IOException {
assertTrue(lookup.getCertificatesForSubkeyId(6666666).isEmpty());
assertTrue(lookup.getCertificateFingerprintsForSubkeyId(6666666).isEmpty());
}
@Test
public void secondInstanceLookupTest() throws IOException, SQLException {
store("eb85bb5fa33a75e15e944e63f231550c4f47e38e", 1337L);
assertEquals(Collections.singleton("eb85bb5fa33a75e15e944e63f231550c4f47e38e"), lookup.getCertificatesForSubkeyId(1337));
assertEquals(Collections.singleton("eb85bb5fa33a75e15e944e63f231550c4f47e38e"), lookup.getCertificateFingerprintsForSubkeyId(1337));
// do the lookup using a second db instance on the same file
DatabaseSubkeyLookup secondInstance = new DatabaseSubkeyLookup(SqliteSubkeyLookupDaoImpl.forDatabaseFile(databaseFile));
assertEquals(Collections.singleton("eb85bb5fa33a75e15e944e63f231550c4f47e38e"), secondInstance.getCertificatesForSubkeyId(1337));
assertEquals(Collections.singleton("eb85bb5fa33a75e15e944e63f231550c4f47e38e"), secondInstance.getCertificateFingerprintsForSubkeyId(1337));
}
@Test