@@ -326,33 +326,34 @@ public void getMinLoadChannel() {
326326
327327 @ Test
328328 public void stickySessionHandler () {
329- // PollerCallbackMock cb = new PollerCallbackMock();
330- // HecAckPoller poller = new HecAckPoller(cb);
331- // poller.setAckPollThreads(1);
332- // poller.setAckPollInterval(2);
333- // poller.start();
334- //
335- // IndexerMock indexer = new IndexerMock();
336- // String ackResponse = "{\"acks\":{\"1\":true}}";
337- // indexer.setResponse(ackResponse);
338- //
339- // HecChannel ch = new HecChannel(indexer);
340- // EventBatch batch = UnitUtil.createBatch();
341- //
342- // String response = "{\"text\":\"Success\",\"code\":0,\"ackId\":1}";
343- // poller.add(ch, batch, response);
344- //
345- // long outstanding = poller.getTotalOutstandingEventBatches();
346- // Assert.assertEquals(1, outstanding);
347- // UnitUtil.milliSleep(3000);
348- //
349- // String oldId = ch.getId();
350- // poller.stickySessionHandler(ch);
351- // Assert.assertNotEquals(oldId, ch.getId());
352- //
353- // outstanding = poller.getTotalOutstandingEventBatches();
354- // Assert.assertEquals(0, outstanding);
355- //
356- // poller.stop();
329+ PollerCallbackMock cb = new PollerCallbackMock ();
330+ HecAckPoller poller = new HecAckPoller (cb );
331+ poller .setAckPollThreads (1 );
332+ poller .setAckPollInterval (2 );
333+ poller .start ();
334+
335+ IndexerMock indexer = new IndexerMock ();
336+ String ackResponse = "{\" acks\" :{\" 1\" :true}}" ;
337+ indexer .setResponse (ackResponse );
338+
339+ HecChannel ch = new HecChannel (indexer );
340+ EventBatch batch = UnitUtil .createBatch ();
341+
342+ String response = "{\" text\" :\" Success\" ,\" code\" :0,\" ackId\" :1}" ;
343+ poller .add (ch , batch , response );
344+
345+ long outstanding = poller .getTotalOutstandingEventBatches ();
346+ Assert .assertEquals (1 , outstanding );
347+ UnitUtil .milliSleep (3000 );
348+
349+ String oldId = ch .getId ();
350+ poller .setStickySessionToTrue ();
351+ poller .stickySessionHandler (ch );
352+ Assert .assertNotEquals (oldId , ch .getId ());
353+
354+ outstanding = poller .getTotalOutstandingEventBatches ();
355+ Assert .assertEquals (0 , outstanding );
356+
357+ poller .stop ();
357358 }
358359}
0 commit comments