Skip to content

Commit

Permalink
600: rename method that caches our private key to mention Our
Browse files Browse the repository at this point in the history
  • Loading branch information
halprin committed Oct 25, 2023
1 parent 26e9dc5 commit 5f4c598
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,7 @@ protected String requestToken() throws UnableToSendOrderException {
}

// only cache our private key if we successfully authenticate to RS
cachePrivateKeyIfNotCachedAlready(ourPrivateKey);
cacheOurPrivateKeyIfNotCachedAlready(ourPrivateKey);

return token;
}
Expand All @@ -174,7 +174,7 @@ protected String retrievePrivateKey() throws SecretRetrievalException {
return key;
}

protected void cachePrivateKeyIfNotCachedAlready(String privateKey) {
void cacheOurPrivateKeyIfNotCachedAlready(String privateKey) {
String key = keyCache.get(OUR_PRIVATE_KEY_ID);
if (key != null) {
return;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ class ReportStreamOrderSenderTest extends Specification {
0 * mockCache.put(_ , _)
}

def "cachePrivateKeyIfNotCachedAlready doesn't cache when the key is already is cached"() {
def "cacheOurPrivateKeyIfNotCachedAlready doesn't cache when the key is already is cached"() {
given:
def mockCache = Mock(Cache)
mockCache.get(_ as String) >> "DogCow private key"
Expand All @@ -145,13 +145,13 @@ class ReportStreamOrderSenderTest extends Specification {
TestApplicationContext.injectRegisteredImplementations()

when:
ReportStreamOrderSender.getInstance().cachePrivateKeyIfNotCachedAlready("Moof!")
ReportStreamOrderSender.getInstance().cacheOurPrivateKeyIfNotCachedAlready("Moof!")

then:
0 * mockCache.put(_, _)
}

def "cachePrivateKeyIfNotCachedAlready caches when the key isn't cached"() {
def "cacheOurPrivateKeyIfNotCachedAlready caches when the key isn't cached"() {
given:
def mockCache = Mock(Cache)
mockCache.get(_ as String) >> null
Expand All @@ -161,7 +161,7 @@ class ReportStreamOrderSenderTest extends Specification {
TestApplicationContext.injectRegisteredImplementations()

when:
ReportStreamOrderSender.getInstance().cachePrivateKeyIfNotCachedAlready("Moof!")
ReportStreamOrderSender.getInstance().cacheOurPrivateKeyIfNotCachedAlready("Moof!")

then:
1 * mockCache.put(_, _)
Expand Down

0 comments on commit 5f4c598

Please sign in to comment.