Skip to content

Commit ef313c0

Browse files
Core: Fix naming for storage service (#3374)
1 parent c1bd6fb commit ef313c0

3 files changed

Lines changed: 24 additions & 24 deletions

File tree

src/main/java/org/prebid/server/cache/BasicPbcStorageService.java

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -47,17 +47,17 @@ public Future<Void> storeEntry(String key,
4747
StorageDataType type,
4848
Integer ttlseconds,
4949
String application,
50-
String moduleCode) {
50+
String appCode) {
5151

5252
try {
53-
validateStoreData(key, value, application, type, moduleCode);
53+
validateStoreData(key, value, application, type, appCode);
5454
} catch (PreBidException e) {
5555
return Future.failedFuture(e);
5656
}
5757

5858
final ModuleCacheRequest moduleCacheRequest =
5959
ModuleCacheRequest.of(
60-
constructEntryKey(key, moduleCode),
60+
constructEntryKey(key, appCode),
6161
type,
6262
prepareValueForStoring(value, type),
6363
application,
@@ -124,18 +124,18 @@ private Future<Void> processStoreResponse(int statusCode, String responseBody) {
124124
}
125125

126126
@Override
127-
public Future<ModuleCacheResponse> retrieveModuleEntry(String key,
128-
String moduleCode,
129-
String application) {
127+
public Future<ModuleCacheResponse> retrieveEntry(String key,
128+
String appCode,
129+
String application) {
130130

131131
try {
132-
validateRetrieveData(key, application, moduleCode);
132+
validateRetrieveData(key, application, appCode);
133133
} catch (PreBidException e) {
134134
return Future.failedFuture(e);
135135
}
136136

137137
return httpClient.get(
138-
getRetrieveEndpoint(key, moduleCode, application),
138+
getRetrieveEndpoint(key, appCode, application),
139139
securedCallHeaders(),
140140
callTimeoutMs)
141141
.map(response -> toModuleCacheResponse(response.getStatusCode(), response.getBody()));

src/main/java/org/prebid/server/cache/PbcStorageService.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,9 @@ Future<Void> storeEntry(String key,
1111
StorageDataType type,
1212
Integer ttlseconds,
1313
String application,
14-
String moduleCode);
14+
String appCode);
1515

16-
Future<ModuleCacheResponse> retrieveModuleEntry(String key, String moduleCode, String application);
16+
Future<ModuleCacheResponse> retrieveEntry(String key, String appCode, String application);
1717

1818
static NoOpPbcStorageService noOp() {
1919
return new NoOpPbcStorageService();
@@ -27,13 +27,13 @@ public Future<Void> storeEntry(String key,
2727
StorageDataType type,
2828
Integer ttlseconds,
2929
String application,
30-
String moduleCode) {
30+
String appCode) {
3131

3232
return Future.succeededFuture();
3333
}
3434

3535
@Override
36-
public Future<ModuleCacheResponse> retrieveModuleEntry(String key, String moduleCode, String application) {
36+
public Future<ModuleCacheResponse> retrieveEntry(String key, String appCode, String application) {
3737
return Future.succeededFuture(ModuleCacheResponse.empty());
3838
}
3939
}

src/test/java/org/prebid/server/cache/BasicPbcStorageServiceTest.java

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -225,10 +225,10 @@ public void storeEntryShouldCreateCallWithApiKeyInHeader() {
225225
}
226226

227227
@Test
228-
public void retrieveModuleEntryShouldReturnFailedFutureIfModuleKeyIsMissed() {
228+
public void retrieveModuleEntryShouldReturnFailedFutureIfKeyIsMissed() {
229229
// when
230230
final Future<ModuleCacheResponse> result =
231-
target.retrieveModuleEntry(null, "some-module-code", "some-app");
231+
target.retrieveEntry(null, "some-module-code", "some-app");
232232

233233
// then
234234
assertThat(result.failed()).isTrue();
@@ -237,10 +237,10 @@ public void retrieveModuleEntryShouldReturnFailedFutureIfModuleKeyIsMissed() {
237237
}
238238

239239
@Test
240-
public void retrieveModuleEntryShouldReturnFailedFutureIfModuleApplicationIsMissed() {
240+
public void retrieveModuleEntryShouldReturnFailedFutureIfApplicationIsMissed() {
241241
// when
242242
final Future<ModuleCacheResponse> result =
243-
target.retrieveModuleEntry("some-key", "some-module-code", null);
243+
target.retrieveEntry("some-key", "some-module-code", null);
244244

245245
// then
246246
assertThat(result.failed()).isTrue();
@@ -249,10 +249,10 @@ public void retrieveModuleEntryShouldReturnFailedFutureIfModuleApplicationIsMiss
249249
}
250250

251251
@Test
252-
public void retrieveModuleEntryShouldReturnFailedFutureIfModuleCodeIsMissed() {
252+
public void retrieveModuleEntryShouldReturnFailedFutureIfCodeIsMissed() {
253253
// when
254254
final Future<ModuleCacheResponse> result =
255-
target.retrieveModuleEntry("some-key", null, "some-app");
255+
target.retrieveEntry("some-key", null, "some-app");
256256

257257
// then
258258
assertThat(result.failed()).isTrue();
@@ -261,19 +261,19 @@ public void retrieveModuleEntryShouldReturnFailedFutureIfModuleCodeIsMissed() {
261261
}
262262

263263
@Test
264-
public void retrieveModuleEntryShouldCreateCallWithApiKeyInHeader() {
264+
public void retrieveEntryShouldCreateCallWithApiKeyInHeader() {
265265
// when
266-
target.retrieveModuleEntry("some-key", "some-module-code", "some-app");
266+
target.retrieveEntry("some-key", "some-module-code", "some-app");
267267

268268
// then
269269
final MultiMap result = captureRetrieveRequestHeaders();
270270
assertThat(result.get(HttpUtil.X_PBC_API_KEY_HEADER)).isEqualTo("pbc-api-key");
271271
}
272272

273273
@Test
274-
public void retrieveModuleEntryShouldCreateCallWithKeyInParams() {
274+
public void retrieveEntryShouldCreateCallWithKeyInParams() {
275275
// when
276-
target.retrieveModuleEntry("some-key", "some-module-code", "some-app");
276+
target.retrieveEntry("some-key", "some-module-code", "some-app");
277277

278278
// then
279279
final String result = captureRetrieveUrl();
@@ -282,10 +282,10 @@ public void retrieveModuleEntryShouldCreateCallWithKeyInParams() {
282282
}
283283

284284
@Test
285-
public void retrieveModuleEntryShouldReturnExpectedResponse() {
285+
public void retrieveEntryShouldReturnExpectedResponse() {
286286
// when
287287
final Future<ModuleCacheResponse> result =
288-
target.retrieveModuleEntry("some-key", "some-module-code", "some-app");
288+
target.retrieveEntry("some-key", "some-module-code", "some-app");
289289

290290
// then
291291
assertThat(result.result())

0 commit comments

Comments
 (0)