astitcher commented on a change in pull request #293: URL: https://github.com/apache/qpid-proton/pull/293#discussion_r566256123
########## File path: cpp/src/link_test.cpp ########## @@ -45,8 +55,107 @@ int test_link_name() return 0; } +/* + * Want to test remote properties so need to run a container and make loopback links. + * Basing these classes on those used in container_test.cpp but reducing the checks on + * container logic as that is not the subject of these tests. + */ + +class test_handler : public proton::messaging_handler { + public: + bool done; + bool had_receiver; + bool had_sender; + + proton::listener listener; + proton::connection connection; + + proton::receiver_options receiver_options; + proton::sender_options sender_options; + + std::map<proton::symbol, proton::value> peer_receiver_properties; + std::map<proton::symbol, proton::value> peer_sender_properties; + + test_handler(const proton::receiver_options &r_opts=proton::receiver_options(), + const proton::sender_options &s_opts=proton::sender_options()) + : done(false), + had_receiver(false), + had_sender(false), + receiver_options(r_opts), + sender_options(s_opts) + {} + + void on_container_start(proton::container &c) PN_CPP_OVERRIDE { + listener = c.listen("//:5678"); // Dynamic port doesn't work on MAC build - presumably not allocated until later + connection = c.connect("//:5678"); Review comment: You have to use a dynamic port for tests as you have no idea what environment they run in. It could be running an AMQP broker or something already! ########## File path: cpp/src/link_test.cpp ########## @@ -45,8 +55,107 @@ int test_link_name() return 0; } +/* + * Want to test remote properties so need to run a container and make loopback links. + * Basing these classes on those used in container_test.cpp but reducing the checks on + * container logic as that is not the subject of these tests. + */ Review comment: You could add these tests to the container tests - the connection tests are equaly not essentially container tests either. ########## File path: cpp/src/link_test.cpp ########## @@ -45,8 +55,107 @@ int test_link_name() return 0; } +/* + * Want to test remote properties so need to run a container and make loopback links. + * Basing these classes on those used in container_test.cpp but reducing the checks on + * container logic as that is not the subject of these tests. + */ + +class test_handler : public proton::messaging_handler { + public: + bool done; + bool had_receiver; + bool had_sender; + + proton::listener listener; + proton::connection connection; + + proton::receiver_options receiver_options; + proton::sender_options sender_options; + + std::map<proton::symbol, proton::value> peer_receiver_properties; + std::map<proton::symbol, proton::value> peer_sender_properties; + + test_handler(const proton::receiver_options &r_opts=proton::receiver_options(), + const proton::sender_options &s_opts=proton::sender_options()) + : done(false), + had_receiver(false), + had_sender(false), + receiver_options(r_opts), + sender_options(s_opts) + {} + + void on_container_start(proton::container &c) PN_CPP_OVERRIDE { + listener = c.listen("//:5678"); // Dynamic port doesn't work on MAC build - presumably not allocated until later + connection = c.connect("//:5678"); Review comment: The way to do this is: first start a listener with a listener address "//:0" then only when the listener on_open() event is fired then create a connection with the address extracted out of the listener. ---------------------------------------------------------------- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscr...@qpid.apache.org For additional commands, e-mail: dev-h...@qpid.apache.org