TEST_F(RemoteResourceUnitTest, onCacheCBCalled) { bool isCalled = false; mocks.ExpectCallFunc(onCacheCB).Do( [this, &isCalled](const RCSResourceAttributes &) { isCalled = true; }); RemoteResourceUnit::Ptr ptr = m_pRemoteResourceUnit->createRemoteResourceInfoWithCacheCB( m_pRCSRemoteResourceObject, m_updatedCBFromServer, onCacheCB); ptr->startCaching(); testObject->ChangeAttributeValue(); EXPECT_TRUE(isCalled); }
void DiscoverResourceUnit::discoverdCB(RCSRemoteResourceObject::Ptr remoteObject, std::string uri) { if (remoteObject && !isAlreadyDiscoveredResource(remoteObject)) { RemoteResourceUnit::Ptr newDiscoveredResource = RemoteResourceUnit::createRemoteResourceInfo(remoteObject, pUpdatedCBFromServer); if (uri.empty() || uri.compare(remoteObject->getUri()) == 0) { m_vecRemoteResource.push_back(newDiscoveredResource); newDiscoveredResource->startMonitoring(); newDiscoveredResource->startCaching(); } } else { // Already Discovered Resource } }
TEST_F(RemoteResourceUnitTest, startCaching) { RemoteResourceUnit::Ptr ptr = m_pRemoteResourceUnit->createRemoteResourceInfo( m_pRCSRemoteResourceObject, m_updatedCBFromServer); ptr->startCaching(); }