void test_ClientFilter() { // should fail because there is no session CPPUNIT_ASSERT( msdo->addClientFilter("non-existing-id","test1", "test1" ) == false ); // add a session so the other attribute checks will pass CPPUNIT_ASSERT( msdo->addClientAttribute("test-session","test1", "value") == true ); CPPUNIT_ASSERT( msdo->addClientFilter("test-session","test1", "test1" ) == true ); // Assert that the value we just inserted is good std::map < std::string, std::string > filterList; filterList = msdo->getClientFilter("test-session"); CPPUNIT_ASSERT( filterList.size() == 1 ); // the one we just added CPPUNIT_ASSERT( filterList.find("test1") != filterList.end() ); // make sure it exists CPPUNIT_ASSERT( filterList["test1"] == "test1" ); // Add another of the same name, which is effectively an update CPPUNIT_ASSERT( msdo->addClientFilter("test-session", "test1", "updated") == true ); CPPUNIT_ASSERT( msdo->getClientFilter("test-session","test1") == "updated"); // Remove the object msdo->removeClientFilter("test-session", "test1" ); // Make sure it's gone CPPUNIT_ASSERT( msdo->getClientFilter("test-session", "test1" ) == "" ); // Can't have an empty sessionid or name/key CPPUNIT_ASSERT( msdo->addClientAttribute("","key","value") == false ); CPPUNIT_ASSERT( msdo->addClientAttribute("test-session", "", "value") == false ); }
void test_ClientAttribute() { // Add an attribute CPPUNIT_ASSERT( msdo->addClientAttribute("test-session","test1", "test1" ) == true ); // Assert that the value we just inserted is good CPPUNIT_ASSERT( msdo->getClientAttribute("test-session", "test1" ) == "test1" ); // Add another of the same name, which is effectively an update CPPUNIT_ASSERT( msdo->addClientAttribute("test-session", "test1", "updated") == true ); CPPUNIT_ASSERT( msdo->getClientAttribute("test-session","test1") == "updated"); // Remove the object msdo->removeClientAttribute("test-session", "test1" ); // Make sure it's gone CPPUNIT_ASSERT( msdo->getClientAttribute("test-session", "test1" ) == "" ); // Can't have an empty sessionid or name/key CPPUNIT_ASSERT( msdo->addClientAttribute("","key","value") == false ); CPPUNIT_ASSERT( msdo->addClientAttribute("test-session", "", "value") == false ); }