MT#17709 remove only 1st occurrence of the key from the call-id list

The count argument influences the operation in the following ways:
   * count > 0: Remove elements equal to value moving from head to tail.
   * count < 0: Remove elements equal to value moving from tail to head.
   * count = 0: Remove all elements equal to value.

Change-Id: Ia77b760fcada0027fe58a48f4b335d5c264e8917
changes/35/4435/2
Andrew Pogrebennyk 10 years ago committed by Victor Seva
parent 51a8be0b69
commit da71d44227

@ -131,7 +131,7 @@ end
if not self._test_connection(self.pair) then if not self._test_connection(self.pair) then
self.pair = self._connect(self.config.pair); self.pair = self._connect(self.config.pair);
end end
local num = self.pair:lrem(callid, 0, key); local num = self.pair:lrem(callid, 1, key);
sr.log("dbg", string.format("pair:lrem[%s]=>[%s] %d\n", callid, key, num)); sr.log("dbg", string.format("pair:lrem[%s]=>[%s] %d\n", callid, key, num));
if not self._test_connection(self.central) then if not self._test_connection(self.central) then
self.central = self._connect(self.config.central); self.central = self._connect(self.config.central);

@ -230,5 +230,20 @@ TestNGCPDlgCnt = {} --class
assertTrue(res) assertTrue(res)
end end
function TestNGCPDlgCnt:test_del_key()
self.pair:ping() ;mc :returns(true)
self.pair:lrem("callid0", 1, "key1") ;mc :returns(1)
self.central:ping() ;mc :returns(true)
self.central:decr("key1") ;mc :returns(1)
mc:replay()
self.dlg:del_key("callid0", "key1")
mc:verify()
assertIs(self.dlg.central, self.central)
assertIs(self.dlg.pair, self.pair)
end
-- class TestNGCPDlgCnt -- class TestNGCPDlgCnt
--EOF --EOF

Loading…
Cancel
Save