Skip to content

Commit

Permalink
[ROCKETMQ-263]Sets a small timeout value for unit tests in OpenMessag…
Browse files Browse the repository at this point in the history
…ing module
  • Loading branch information
zhouxinyu committed Aug 11, 2017
1 parent aa1c757 commit 38bbb14
Showing 1 changed file with 6 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -46,20 +46,24 @@ public class PullConsumerImplTest {

@Mock
private DefaultMQPullConsumer rocketmqPullConsumer;
private LocalMessageCache localMessageCache =
spy(new LocalMessageCache(rocketmqPullConsumer, new ClientConfig()));
private LocalMessageCache localMessageCache = null;

@Before
public void init() throws NoSuchFieldException, IllegalAccessException {
final MessagingAccessPoint messagingAccessPoint = MessagingAccessPointFactory
.getMessagingAccessPoint("openmessaging:rocketmq://IP1:9876,IP2:9876/namespace");

consumer = messagingAccessPoint.createPullConsumer(queueName,
OMS.newKeyValue().put(NonStandardKeys.CONSUMER_GROUP, "TestGroup"));

Field field = PullConsumerImpl.class.getDeclaredField("rocketmqPullConsumer");
field.setAccessible(true);
field.set(consumer, rocketmqPullConsumer); //Replace

ClientConfig clientConfig = new ClientConfig();
clientConfig.setOmsOperationTimeout(200);
localMessageCache = spy(new LocalMessageCache(rocketmqPullConsumer, clientConfig));

field = PullConsumerImpl.class.getDeclaredField("localMessageCache");
field.setAccessible(true);
field.set(consumer, localMessageCache);
Expand Down

0 comments on commit 38bbb14

Please sign in to comment.