first test for the whisper com service #5
@ -36,16 +36,14 @@ SCENARIO("Constructing two services that send and receive messages.","[Service]"
|
||||
std::string testTopic = "testTopic";
|
||||
|
||||
std::shared_ptr<WhisperCom::Service> serviceSource = nullptr;
|
||||
REQUIRE_NOTHROW( serviceSource == std::make_shared<WhisperCom::Service>() );
|
||||
REQUIRE_NOTHROW( serviceSource = std::make_shared<WhisperCom::Service>() );
|
||||
REQUIRE( serviceSource != nullptr );
|
||||
serviceSource->subscribe( testTopic );
|
||||
std::this_thread::sleep_for( 2000ms );
|
||||
|
||||
std::shared_ptr<WhisperCom::Service> serviceSink = nullptr;
|
||||
REQUIRE_NOTHROW( serviceSink == std::make_shared<WhisperCom::Service>() );
|
||||
REQUIRE_NOTHROW( serviceSink = std::make_shared<WhisperCom::Service>() );
|
||||
REQUIRE( serviceSink != nullptr );
|
||||
serviceSink->subscribe( testTopic );
|
||||
std::this_thread::sleep_for( 2000ms );
|
||||
|
||||
WHEN("Sending a message")
|
||||
{
|
||||
@ -54,17 +52,15 @@ SCENARIO("Constructing two services that send and receive messages.","[Service]"
|
||||
WhisperCom::Protobuf::Message wmsg{};
|
||||
wmsg.mutable_payload()->PackFrom( msg );
|
||||
serviceSource->sendMessage( "test", wmsg );
|
||||
std::this_thread::sleep_for( 200ms );
|
||||
std::this_thread::sleep_for( 400ms );
|
||||
|
||||
THEN("The sink service should receive the message")
|
||||
{
|
||||
CHECK( serviceSink->hasMessages() );
|
||||
std::this_thread::sleep_for( 6000ms );
|
||||
} //THEN
|
||||
} // WHEN
|
||||
|
||||
serviceSource->stop();
|
||||
std::this_thread::sleep_for( 2000ms );
|
||||
serviceSink->stop();
|
||||
} // GIVEN
|
||||
} //SCENARIO
|
||||
|
Loading…
Reference in New Issue
Block a user