提交 0adad6f0 编写于 作者: D djKooks 提交者: dongeforever

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

上级 e5d01b41
...@@ -19,6 +19,8 @@ package org.apache.rocketmq.client.consumer.store; ...@@ -19,6 +19,8 @@ package org.apache.rocketmq.client.consumer.store;
import java.io.File; import java.io.File;
import java.util.Collections; import java.util.Collections;
import java.util.HashSet; import java.util.HashSet;
import java.util.Map;
import org.apache.rocketmq.client.ClientConfig; import org.apache.rocketmq.client.ClientConfig;
import org.apache.rocketmq.client.impl.factory.MQClientInstance; import org.apache.rocketmq.client.impl.factory.MQClientInstance;
import org.apache.rocketmq.common.message.MessageQueue; import org.apache.rocketmq.common.message.MessageQueue;
...@@ -72,4 +74,15 @@ public class LocalFileOffsetStoreTest { ...@@ -72,4 +74,15 @@ public class LocalFileOffsetStoreTest {
offsetStore.persistAll(new HashSet<MessageQueue>(Collections.singletonList(messageQueue))); offsetStore.persistAll(new HashSet<MessageQueue>(Collections.singletonList(messageQueue)));
assertThat(offsetStore.readOffset(messageQueue, ReadOffsetType.READ_FROM_STORE)).isEqualTo(1024); 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.
先完成此消息的编辑!
想要评论请 注册