Browse Source

Transient failure in ProducerTest; patched by Jun Rao; reviewed by Neha Narkhede; kafka-471

git-svn-id: https://svn.apache.org/repos/asf/incubator/kafka/branches/0.8@1381858 13f79535-47bb-0310-9956-ffa450edef68
0.8.0-beta1-candidate1
Jun Rao 12 years ago
parent
commit
50792c8765
  1. 8
      core/src/test/scala/unit/kafka/producer/ProducerTest.scala

8
core/src/test/scala/unit/kafka/producer/ProducerTest.scala

@ -162,7 +162,7 @@ class ProducerTest extends JUnit3Suite with ZooKeeperTestHarness with Logging{ @@ -162,7 +162,7 @@ class ProducerTest extends JUnit3Suite with ZooKeeperTestHarness with Logging{
val producer2 = new Producer[String, String](producerConfig2)
// Available partition ids should be 0.
producer1.send(new ProducerData[String, String]("new-topic", "test", Array("test1")))
producer1.send(new ProducerData[String, String]("new-topic", "test", Array("test1")))
producer1.send(new ProducerData[String, String]("new-topic", "test", Array("test2")))
// get the leader
val leaderOpt = ZkUtils.getLeaderForPartition(zkClient, "new-topic", 0)
assertTrue("Leader for topic new-topic partition 0 should exist", leaderOpt.isDefined)
@ -179,8 +179,10 @@ class ProducerTest extends JUnit3Suite with ZooKeeperTestHarness with Logging{ @@ -179,8 +179,10 @@ class ProducerTest extends JUnit3Suite with ZooKeeperTestHarness with Logging{
assertEquals(new Message("test1".getBytes), messageSet.next.message)
assertTrue("Message set should have 1 message", messageSet.hasNext)
assertEquals(new Message("test1".getBytes), messageSet.next.message)
assertFalse("Message set should not have any more messages", messageSet.hasNext)
assertEquals(new Message("test2".getBytes), messageSet.next.message)
if (messageSet.hasNext)
fail("Message set should not have any more messages, but received a message of %s"
.format(Utils.toString(messageSet.next.message.payload, "UTF-8")))
producer1.close()
try {

Loading…
Cancel
Save