提交 16c8d43a 编写于 作者: D djKooks 提交者: dongeforever

Add test case for LocalFileOffsetStore closes apache/incubator-rocketmq#59

上级 3eea44a7
......@@ -19,6 +19,8 @@ package org.apache.rocketmq.client.consumer.store;
import java.io.File;
import java.util.Collections;
import java.util.HashSet;
import java.util.Map;
import org.apache.rocketmq.client.ClientConfig;
import org.apache.rocketmq.client.impl.factory.MQClientInstance;
import org.apache.rocketmq.common.message.MessageQueue;
......@@ -72,4 +74,15 @@ public class LocalFileOffsetStoreTest {
offsetStore.persistAll(new HashSet<MessageQueue>(Collections.singletonList(messageQueue)));
assertThat(offsetStore.readOffset(messageQueue, ReadOffsetType.READ_FROM_STORE)).isEqualTo(1024);
}
@Test
public void testCloneOffset() throws Exception {
OffsetStore offsetStore = new LocalFileOffsetStore(mQClientFactory, group);
MessageQueue messageQueue = new MessageQueue(topic, brokerName, 3);
offsetStore.updateOffset(messageQueue, 1024, false);
Map<MessageQueue, Long> cloneOffsetTable = offsetStore.cloneOffsetTable(topic);
assertThat(cloneOffsetTable.size()).isEqualTo(1);
assertThat(cloneOffsetTable.get(messageQueue)).isEqualTo(1024);
}
}
\ No newline at end of file
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册