Skip to content

Commit 39a259d

Browse files
committed
making it easier to read
1 parent f6fe324 commit 39a259d

File tree

1 file changed

+11
-24
lines changed

1 file changed

+11
-24
lines changed

modules/ingest-geoip/src/internalClusterTest/java/org/elasticsearch/ingest/geoip/EnterpriseGeoIpDownloaderIT.java

Lines changed: 11 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -157,34 +157,21 @@ public void cleanup() throws InterruptedException {
157157
*/
158158
CountDownLatch latch = new CountDownLatch(1);
159159
LatchedActionListener<AcknowledgedResponse> listener = new LatchedActionListener<>(ActionListener.noop(), latch);
160-
SubscribableListener.<AcknowledgedResponse>newForked(
161-
l -> admin().cluster()
162-
.execute(
163-
DeleteDatabaseConfigurationAction.INSTANCE,
164-
new DeleteDatabaseConfigurationAction.Request(
165-
TimeValue.MAX_VALUE,
166-
TimeValue.timeValueSeconds(10),
167-
MAXMIND_CONFIGURATION
168-
),
169-
l
170-
)
171-
)
172-
.<AcknowledgedResponse>andThen(
173-
l -> admin().cluster()
174-
.execute(
175-
DeleteDatabaseConfigurationAction.INSTANCE,
176-
new DeleteDatabaseConfigurationAction.Request(
177-
TimeValue.MAX_VALUE,
178-
TimeValue.timeValueSeconds(10),
179-
IPINFO_CONFIGURATION
180-
),
181-
l
182-
)
183-
)
160+
SubscribableListener.<AcknowledgedResponse>newForked(l -> deleteDatabaseConfiguration(MAXMIND_CONFIGURATION, l))
161+
.<AcknowledgedResponse>andThen(l -> deleteDatabaseConfiguration(IPINFO_CONFIGURATION, l))
184162
.addListener(listener);
185163
latch.await(10, TimeUnit.SECONDS);
186164
}
187165

166+
private void deleteDatabaseConfiguration(String configurationName, ActionListener<AcknowledgedResponse> listener) {
167+
admin().cluster()
168+
.execute(
169+
DeleteDatabaseConfigurationAction.INSTANCE,
170+
new DeleteDatabaseConfigurationAction.Request(TimeValue.MAX_VALUE, TimeValue.timeValueSeconds(10), configurationName),
171+
listener
172+
);
173+
}
174+
188175
private void startEnterpriseGeoIpDownloaderTask() {
189176
PersistentTasksService persistentTasksService = internalCluster().getInstance(PersistentTasksService.class);
190177
persistentTasksService.sendStartRequest(

0 commit comments

Comments
 (0)