DBZ-4727 Make wait for snapshot event generic

This commit is contained in:
Vojtech Juranek 2022-04-04 09:30:20 +02:00 committed by Chris Cranford
parent 13c9e517ef
commit 65bfeeccea

View File

@ -1159,6 +1159,10 @@ public static int waitTimeForRecordsAfterNulls() {
} }
public static void waitForSnapshotToBeCompleted(String connector, String server) throws InterruptedException { public static void waitForSnapshotToBeCompleted(String connector, String server) throws InterruptedException {
waitForSnapshotEvent(connector, server, "SnapshotCompleted");
}
private static void waitForSnapshotEvent(String connector, String server, String event) throws InterruptedException {
final MBeanServer mbeanServer = ManagementFactory.getPlatformMBeanServer(); final MBeanServer mbeanServer = ManagementFactory.getPlatformMBeanServer();
Awaitility.await() Awaitility.await()
@ -1167,7 +1171,7 @@ public static void waitForSnapshotToBeCompleted(String connector, String server)
.atMost(waitTimeForRecords() * 30, TimeUnit.SECONDS) .atMost(waitTimeForRecords() * 30, TimeUnit.SECONDS)
.ignoreException(InstanceNotFoundException.class) .ignoreException(InstanceNotFoundException.class)
.until(() -> (boolean) mbeanServer .until(() -> (boolean) mbeanServer
.getAttribute(getSnapshotMetricsObjectName(connector, server), "SnapshotCompleted")); .getAttribute(getSnapshotMetricsObjectName(connector, server), event));
} }
public static void waitForStreamingRunning(String connector, String server) throws InterruptedException { public static void waitForStreamingRunning(String connector, String server) throws InterruptedException {