You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@kafka.apache.org by gw...@apache.org on 2015/11/09 19:39:52 UTC
kafka git commit: KAFKA-2782: Fix KafkaBasedLogTest assertion and
move it to the main test thread.
Repository: kafka
Updated Branches:
refs/heads/trunk 13ba57dcf -> 75f2b8c8b
KAFKA-2782: Fix KafkaBasedLogTest assertion and move it to the main test thread.
Author: Ewen Cheslack-Postava <me...@ewencp.org>
Reviewers: Gwen Shapira
Closes #463 from ewencp/kafka-2782-fix-kafka-based-log-test-assertion
Project: http://git-wip-us.apache.org/repos/asf/kafka/repo
Commit: http://git-wip-us.apache.org/repos/asf/kafka/commit/75f2b8c8
Tree: http://git-wip-us.apache.org/repos/asf/kafka/tree/75f2b8c8
Diff: http://git-wip-us.apache.org/repos/asf/kafka/diff/75f2b8c8
Branch: refs/heads/trunk
Commit: 75f2b8c8b42459a3ab2962f75f0e05fbbb9e8333
Parents: 13ba57d
Author: Ewen Cheslack-Postava <me...@ewencp.org>
Authored: Mon Nov 9 10:39:34 2015 -0800
Committer: Gwen Shapira <cs...@gmail.com>
Committed: Mon Nov 9 10:39:34 2015 -0800
----------------------------------------------------------------------
.../apache/kafka/connect/util/KafkaBasedLogTest.java | 15 ++++++++-------
1 file changed, 8 insertions(+), 7 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/kafka/blob/75f2b8c8/connect/runtime/src/test/java/org/apache/kafka/connect/util/KafkaBasedLogTest.java
----------------------------------------------------------------------
diff --git a/connect/runtime/src/test/java/org/apache/kafka/connect/util/KafkaBasedLogTest.java b/connect/runtime/src/test/java/org/apache/kafka/connect/util/KafkaBasedLogTest.java
index 1c3b842..2ead813 100644
--- a/connect/runtime/src/test/java/org/apache/kafka/connect/util/KafkaBasedLogTest.java
+++ b/connect/runtime/src/test/java/org/apache/kafka/connect/util/KafkaBasedLogTest.java
@@ -258,14 +258,11 @@ public class KafkaBasedLogTest {
assertEquals(2, invoked.get());
// Now we should have to wait for the records to be read back when we call readToEnd()
- final AtomicBoolean getInvokedAndPassed = new AtomicBoolean(false);
+ final AtomicBoolean getInvoked = new AtomicBoolean(false);
final FutureCallback<Void> readEndFutureCallback = new FutureCallback<>(new Callback<Void>() {
@Override
public void onCompletion(Throwable error, Void result) {
- assertEquals(4, consumedRecords.size());
- assertEquals(TP0_VALUE_NEW, consumedRecords.get(2).value());
- assertEquals(TP1_VALUE_NEW, consumedRecords.get(3).value());
- getInvokedAndPassed.set(true);
+ getInvoked.set(true);
}
});
consumer.schedulePollTask(new Runnable() {
@@ -275,7 +272,6 @@ public class KafkaBasedLogTest {
// that should follow. This readToEnd call will immediately wakeup this consumer.poll() call without
// returning any data.
store.readToEnd(readEndFutureCallback);
-
// Needs to seek to end to find end offsets
consumer.schedulePollTask(new Runnable() {
@Override
@@ -311,7 +307,12 @@ public class KafkaBasedLogTest {
}
});
readEndFutureCallback.get(10000, TimeUnit.MILLISECONDS);
- assertTrue(getInvokedAndPassed.get());
+ assertTrue(getInvoked.get());
+ assertEquals(4, consumedRecords.size());
+ assertEquals(TP0_VALUE, consumedRecords.get(0).value());
+ assertEquals(TP0_VALUE_NEW, consumedRecords.get(1).value());
+ assertEquals(TP1_VALUE, consumedRecords.get(2).value());
+ assertEquals(TP1_VALUE_NEW, consumedRecords.get(3).value());
// Cleanup
store.stop();