(OIC::Service::NSProvider::MessageReceivedCallback)NotificationReceivedCallbackEmpty,
(OIC::Service::NSProvider::SyncInfoReceivedCallback)SyncCallbackEmpty);
if (!g_provider->isSubscribed())
+ {
g_provider->subscribe();
+ }
std::unique_lock< std::mutex > lock { mutexForCondition };
responseCon.wait_for(lock, g_waitForResponse);
EXPECT_EQ(OIC::Service::NSProviderState::ALLOW, revState);
(OIC::Service::NSProvider::MessageReceivedCallback)NotificationReceivedCallbackEmpty,
(OIC::Service::NSProvider::SyncInfoReceivedCallback)SyncCallbackEmpty);
if (!g_provider->isSubscribed())
+ {
g_provider->subscribe();
+ }
std::cout << g_provider->getProviderId() << std::endl;
responseCon.notify_all();
});
{
isSame = false; break;
}
- it1++;it2++;
- }
+ it1++;it2++;
+ }
EXPECT_EQ(true, isSame);
MockRepository mocks;
protected:
- virtual ~TestWithMock() noexcept(noexcept(std::declval<Test>().~Test())) {}
+ virtual ~TestWithMock() noexcept(noexcept(std::declval<Test>().~Test()))
+ {
+ }
virtual void TearDown()
{
TEST_F(NotificationProviderServiceTest, NeverCallNotifyOnConsumerByAcceptIsFalse)
{
bool expectTrue = true;
- int msgID;
+ int msgID = 0;
mocks.OnCallFunc(MessageCallbackFromConsumerEmpty).Do(
[& expectTrue, &msgID](const int & id, const std::string &, const std::string &,
TEST_F(NotificationProviderServiceTest, ExpectCallNotifyOnConsumerByAcceptIsTrue)
{
- int msgID;
+ int msgID = 0;
mocks.ExpectCallFunc(MessageCallbackFromConsumerEmpty).Do(
[&msgID](const int & id, const std::string &, const std::string &, const std::string &)
TEST_F(NotificationProviderServiceTest, ExpectCallbackSyncOnReadToConsumer)
{
- int id;
+ int id = 0;
mocks.ExpectCallFunc(SyncCallbackFromConsumerEmpty).Do(
[& id](int & type, int & syncId)
TEST_F(NotificationProviderServiceTest, ExpectCallbackSyncOnReadFromConsumer)
{
int type = (int)OIC::Service::NSSyncInfo::NSSyncType::NS_SYNC_READ;
- int id;
+ int id = 0;
mocks.ExpectCallFunc(MessageSynchronizedCallbackEmpty).Do(
[& id](OIC::Service::NSSyncInfo * sync)
{
OIC::Service::NSProviderService::getInstance()->unregisterTopic(str1);
OIC::Service::NSProviderService::getInstance()->unregisterTopic(str2);
+ if(topicList != nullptr)
+ {
+ delete topicList;
+ }
responseCon.wait_for(lock, g_waitForResponse);
}
EXPECT_EQ(isSame, true);
OIC::Service::NSProviderService::getInstance()->unregisterTopic(str1);
+ if(topicList != nullptr)
+ {
+ delete topicList;
+ }
responseCon.wait_for(lock, g_waitForResponse);
}
else
{
std::string compString[10];
- int i = 0, state[10];
+ int i = 0, state[10] = {0};
for (auto itr : topicList->getTopicsList())
{
compString[i] = itr->getTopicName();
OIC::Service::NSProviderService::getInstance()->unregisterTopic(str1);
OIC::Service::NSProviderService::getInstance()->unregisterTopic(str2);
+ if(topicList != nullptr)
+ {
+ delete topicList;
+ }
responseCon.wait_for(lock, g_waitForResponse);
}
else
{
std::string compString[10];
- int i = 0, state[10];
+ int i = 0, state[10] = {0};
for (auto itr : topicList->getTopicsList())
{
compString[i] = itr->getTopicName();
OIC::Service::NSProviderService::getInstance()->unregisterTopic(str1);
OIC::Service::NSProviderService::getInstance()->unregisterTopic(str2);
+
+ if(topicList != nullptr)
+ {
+ delete topicList;
+ }
responseCon.wait_for(lock, g_waitForResponse);
}