public void testSendOrderedMessage() throws Exception {
final String topic = "topic1";
final byte[] data = "hello".getBytes();
final Message message = new Message(topic, data);
final String url = "meta://localhost:0";
final Partition partition = new Partition("0-0");
EasyMock.expect(this.producerZooKeeper.selectPartition(topic, message, this.partitionSelector))
.andReturn(partition).times(2);
EasyMock.expect(this.producerZooKeeper.selectBroker(topic, partition)).andReturn(url);
EasyMock.expect(this.localMessageStorageManager.getMessageCount(topic, partition)).andReturn(0);
OpaqueGenerator.resetOpaque();
final int flag = MessageFlagUtils.getFlag(null);
EasyMock.expect(
this.remotingClient.invokeToGroup(url, new PutCommand(topic, partition.getPartition(), data, flag, CheckSum.crc32(data),
null, Integer.MIN_VALUE), 3000, TimeUnit.MILLISECONDS)).andReturn(
new BooleanCommand(200, "1111 1 1024", Integer.MIN_VALUE));
this.mocksControl.replay();
assertEquals(0, message.getId());
final SendResult sendResult = this.producer.sendMessage(message);