std::condition_variable responseCon;
std::mutex mutexForCondition;
+ enum class NSSelector
+ {
+ NS_SELECTION_CONSUMER = 0,
+ NS_SELECTION_PROVIDER = 1
+ };
+
}
class TestWithMock: public testing::Test
std::cout << __func__ << std::endl;
}
- static void foundResourceEmpty(std::shared_ptr< OC::OCResource >)
+ static void NSFoundResourceEmpty(std::shared_ptr< OC::OCResource >)
{
std::cout << __func__ << std::endl;
}
- static void SubscriptionAcceptedCallback(NSProvider *)
+ static void NSSubscriptionAcceptedCallback(NSProvider *)
{
std::cout << __func__ << std::endl;
}
{
NSConsumerConfig cfg;
cfg.discoverCb = NSProviderDiscoveredCallbackEmpty;
- cfg.acceptedCb = SubscriptionAcceptedCallback;
+ cfg.acceptedCb = NSSubscriptionAcceptedCallback;
cfg.messageCb = NSNotificationReceivedCallbackEmpty;
cfg.syncInfoCb = NSSyncCallbackEmpty;
EXPECT_EQ(NS_OK, NSStartConsumer(cfg));
NSConsumerConfig cfg;
cfg.discoverCb = NSProviderDiscoveredCallbackEmpty;
- cfg.acceptedCb = SubscriptionAcceptedCallback;
+ cfg.acceptedCb = NSSubscriptionAcceptedCallback;
cfg.messageCb = NSNotificationReceivedCallbackEmpty;
cfg.syncInfoCb = NSSyncCallbackEmpty;
NSStartConsumer(cfg);
- g_providerSimul.setAccepter(1);
+ g_providerSimul.setAccepter((int)NSSelector::NS_SELECTION_CONSUMER);
g_providerSimul.createNotificationResource();
std::unique_lock< std::mutex > lock{ mutexForCondition };
TEST_F(NotificationConsumerTest, DiscoverProviderWithNonAccepterWhenStartedConsumerAfter)
{
- g_providerSimul.setAccepter(1);
+ g_providerSimul.setAccepter((int)NSSelector::NS_SELECTION_CONSUMER);
g_providerSimul.createNotificationResource();
{
std::unique_lock< std::mutex > lock{ mutexForCondition };
NSConsumerConfig cfg;
cfg.discoverCb = NSProviderDiscoveredCallbackEmpty;
- cfg.acceptedCb = SubscriptionAcceptedCallback;
+ cfg.acceptedCb = NSSubscriptionAcceptedCallback;
cfg.messageCb = NSNotificationReceivedCallbackEmpty;
cfg.syncInfoCb = NSSyncCallbackEmpty;
NSStartConsumer(cfg);
TEST_F(NotificationConsumerTest, DiscoverProviderWithNonAccepterWhenRescan)
{
- g_providerSimul.setAccepter(1);
+ g_providerSimul.setAccepter((int)NSSelector::NS_SELECTION_CONSUMER);
mocks.ExpectCallFunc(NSProviderDiscoveredCallbackEmpty).Do(
[this](NSProvider * provider)
{
TEST_F(NotificationConsumerTest, ExpectSubscribeSuccess)
{
- mocks.ExpectCallFunc(SubscriptionAcceptedCallback).Do(
- [](NSProvider * )
- {
- std::cout << "Income Accepted subscription : " << std::endl;
- });
+// mocks.ExpectCallFunc(NSSubscriptionAcceptedCallback).Do(
+// [](NSProvider * )
+// {
+// std::cout << "Income Accepted subscription : " << std::endl;
+// });
NSResult ret = NSSubscribe(g_provider);
std::unique_lock< std::mutex > lock{ mutexForCondition };
std::string title = "title";
std::string msg = "msg";
- g_providerSimul.setAccepter(0);
+ g_providerSimul.setAccepter((int)NSSelector::NS_SELECTION_PROVIDER);
NSConsumerConfig cfg;
cfg.discoverCb = NSProviderDiscoveredCallbackEmpty;
- cfg.acceptedCb = SubscriptionAcceptedCallback;
+ cfg.acceptedCb = NSSubscriptionAcceptedCallback;
cfg.messageCb = NSNotificationReceivedCallbackEmpty;
cfg.syncInfoCb = NSSyncCallbackEmpty;
NSStartConsumer(cfg);