Commit 80ecc05e authored by Alexandre Savard's avatar Alexandre Savard
Browse files

[#1883] Add debug messages in conference and fix mainbufferTest

parent bb3040a4
......@@ -647,6 +647,7 @@ ManagerImpl::createConference(const CallID& id)
Conference* conf = new Conference();
_conferencecall.insert(pair<CallID, Conference*>(id, conf));
_conferencecall.insert(pair<CallID, Conference*>(getCurrentCallId(), conf));
_conferencemap.insert(pair<CallID, Conference*>(default_conf, conf));
conf->add(getCurrentCallId());
......@@ -660,23 +661,38 @@ ManagerImpl::removeConference(const CallID& conference_id)
_debug("ManagerImpl::removeConference(%s)\n", conference_id.c_str());
Conference* conf;
Conference* conf;
conf = NULL;
_debug("ManagerImpl:: _conferencemap.size: %i\n", _conferencemap.size());
ConferenceMap::iterator iter = _conferencemap.find(conference_id);
conf = iter->second;
if (iter != _conferencemap.end())
{
_debug("Found conference id %s in conferencemap\n", conference_id.c_str());
conf = iter->second;
}
if(conf == NULL)
return;
_debug("ManagerImpl:: _conferencecall.size: %i\n", _conferencecall.size());
ConferenceCallMap::iterator iter_p;
for(iter_p = _conferencecall.begin(); iter_p != _conferencecall.end(); iter_p++)
{
_debug("ManagerImpl:: iterate participant %s\n", iter_p->first.c_str());
if(iter_p->second == conf)
{
_debug("ManagerImpl:: remove particiant (%s) from conference %s\n", iter_p->first.c_str(), conference_id.c_str());
_conferencecall.erase(iter_p);
}
}
_conferencemap.erase(default_conf);
_debug("ManagerImpl::conference removed succesfully\n");
_debug("ManagerImpl:: remove conference %s\n", conference_id.c_str());
if (_conferencemap.erase(conference_id) == 1)
_debug("ManagerImpl:: conference %s removed succesfully\n", conference_id.c_str());
else
_debug("ManagerImpl:: error cannot remove conference id: %s\n", conference_id.c_str());
}
......
......@@ -277,22 +277,34 @@ void MainBufferTest::testRingBufferInt()
CPPUNIT_ASSERT(test_ring_buffer->getNbReadPointer() == 0);
test_ring_buffer->createReadPointer(default_id);
CPPUNIT_ASSERT(test_ring_buffer->getNbReadPointer() == 1);
CPPUNIT_ASSERT(test_ring_buffer->AvailForGet() == 2*sizeof(int));
CPPUNIT_ASSERT(test_ring_buffer->getLen() == 2*sizeof(int));
CPPUNIT_ASSERT(test_ring_buffer->AvailForGet() == 0);
CPPUNIT_ASSERT(test_ring_buffer->getLen() == 0);
// add some data
CPPUNIT_ASSERT(test_ring_buffer->Put(&testint1, sizeof(int)) == sizeof(int));
CPPUNIT_ASSERT(test_ring_buffer->putLen() == sizeof(int));
CPPUNIT_ASSERT(test_ring_buffer->AvailForPut() == (init_put_size - (int)sizeof(int)));
CPPUNIT_ASSERT(test_ring_buffer->getReadPointer() == 2*sizeof(int));
// add some other data
CPPUNIT_ASSERT(test_ring_buffer->Put(&testint2, sizeof(int)) == sizeof(int));
CPPUNIT_ASSERT(test_ring_buffer->putLen() == 2*sizeof(int));
CPPUNIT_ASSERT(test_ring_buffer->AvailForPut() == (init_put_size - 2*(int)sizeof(int)));
CPPUNIT_ASSERT(test_ring_buffer->getReadPointer() == 2*sizeof(int));
CPPUNIT_ASSERT(test_ring_buffer->Get(&testget, sizeof(int), 100, default_id) == sizeof(int));
CPPUNIT_ASSERT(test_ring_buffer->AvailForGet() == sizeof(int));
CPPUNIT_ASSERT(test_ring_buffer->getLen() == sizeof(int));
CPPUNIT_ASSERT(testget == testint1);
CPPUNIT_ASSERT(test_ring_buffer->AvailForPut() == (init_put_size - (int)sizeof(int)));
CPPUNIT_ASSERT(test_ring_buffer->getReadPointer() == sizeof(int));
CPPUNIT_ASSERT(test_ring_buffer->getReadPointer() == 3*sizeof(int));
CPPUNIT_ASSERT(test_ring_buffer->Get(&testget, sizeof(int)) == sizeof(int));
CPPUNIT_ASSERT(testget == testint2);
CPPUNIT_ASSERT(test_ring_buffer->AvailForGet() == 0);
CPPUNIT_ASSERT(test_ring_buffer->getLen() == 0);
CPPUNIT_ASSERT(test_ring_buffer->AvailForPut() == init_put_size);
CPPUNIT_ASSERT(test_ring_buffer->getReadPointer() == 2*sizeof(int));
CPPUNIT_ASSERT(test_ring_buffer->getReadPointer() == 4*sizeof(int));
// test flush data
......@@ -310,7 +322,7 @@ void MainBufferTest::testRingBufferInt()
CPPUNIT_ASSERT(test_ring_buffer->AvailForPut() == init_put_size);
CPPUNIT_ASSERT(test_ring_buffer->getLen() == 0);
CPPUNIT_ASSERT(test_ring_buffer->AvailForGet() == 0);
CPPUNIT_ASSERT(test_ring_buffer->getReadPointer() == 3*sizeof(int));
CPPUNIT_ASSERT(test_ring_buffer->getReadPointer() == 5*sizeof(int));
// test flush data
init_put_size = test_ring_buffer->AvailForPut();
......@@ -320,14 +332,14 @@ void MainBufferTest::testRingBufferInt()
CPPUNIT_ASSERT(test_ring_buffer->AvailForPut() == (init_put_size - (int)sizeof(int)));
CPPUNIT_ASSERT(test_ring_buffer->AvailForGet() == sizeof(int));
CPPUNIT_ASSERT(test_ring_buffer->getLen() == sizeof(int));
CPPUNIT_ASSERT(test_ring_buffer->getReadPointer() == 3*sizeof(int));
CPPUNIT_ASSERT(test_ring_buffer->getReadPointer() == 5*sizeof(int));
test_ring_buffer->Discard(sizeof(int));
CPPUNIT_ASSERT(test_ring_buffer->putLen() == 0);
CPPUNIT_ASSERT(test_ring_buffer->AvailForPut() == init_put_size);
CPPUNIT_ASSERT(test_ring_buffer->getLen() == 0);
CPPUNIT_ASSERT(test_ring_buffer->AvailForGet() == 0);
CPPUNIT_ASSERT(test_ring_buffer->getReadPointer() == 4*sizeof(int));
CPPUNIT_ASSERT(test_ring_buffer->getReadPointer() == 6*sizeof(int));
}
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment