void test002() { IStaticServiceHandler* handler; TestObject* test; IObject* obj; ITestInterface *itest; handler = new StaticServiceHandler; ASSERT(handler != 0, "could not instantiate static service handler"); test = new TestObject; ASSERT(test != 0, "could not instantiate test object"); VERIFY(test->getRefCount() == 1, "the test object has an incorrect refcount"); handler->addObject(TestObject_CID, test); VERIFY(test->getRefCount() == 2, "static service handler did not addRef the test component"); obj = handler->getObject(TestObject_CID); ASSERT(obj != 0, "could not get test component from static service handler"); itest = mutate<ITestInterface>(obj); ASSERT(itest != 0, "test component does not have the expected interface"); VERIFY(test->getRefCount() == 3, "the test object has an incorrect refcount"); itest->setRefCount(10); itest->addRef(); VERIFY(itest->getRefCount() == 11, "test component has unexpected behavior"); itest->setRefCount(3); VERIFY(itest->release() == 2, "test component has incorrect refcount"); handler->removeObject(TestObject_CID); VERIFY(test->getRefCount() == 1, "static service handler did not release the test component"); obj = handler->getObject(TestObject_CID); VERIFY(!obj, "static service handler did not remove the test component"); if(obj) obj->release(); VERIFY(handler->release() == 0, "static service handler has non-zero refcount after release"); VERIFY(test->release() == 0, "test object has non-zero refcount after release"); xplcdelete test; }