qpid-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From astitc...@apache.org
Subject [3/4] qpid-proton git commit: PROTON-1182: [C++ binding] Change engine tests to use senders/receivers where appropriate
Date Tue, 26 Apr 2016 22:18:38 GMT
PROTON-1182: [C++ binding] Change engine tests to use senders/receivers where appropriate


Project: http://git-wip-us.apache.org/repos/asf/qpid-proton/repo
Commit: http://git-wip-us.apache.org/repos/asf/qpid-proton/commit/bfb5d19d
Tree: http://git-wip-us.apache.org/repos/asf/qpid-proton/tree/bfb5d19d
Diff: http://git-wip-us.apache.org/repos/asf/qpid-proton/diff/bfb5d19d

Branch: refs/heads/master
Commit: bfb5d19d46c2a4a24ffd9d697e4a1b76d2273c1f
Parents: 52338b8
Author: Andrew Stitcher <astitcher@apache.org>
Authored: Tue Apr 26 16:21:30 2016 -0400
Committer: Andrew Stitcher <astitcher@apache.org>
Committed: Tue Apr 26 18:16:09 2016 -0400

----------------------------------------------------------------------
 proton-c/bindings/cpp/src/engine_test.cpp | 50 +++++++++++++-------------
 1 file changed, 26 insertions(+), 24 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/bfb5d19d/proton-c/bindings/cpp/src/engine_test.cpp
----------------------------------------------------------------------
diff --git a/proton-c/bindings/cpp/src/engine_test.cpp b/proton-c/bindings/cpp/src/engine_test.cpp
index 571bebd..d94abdc 100644
--- a/proton-c/bindings/cpp/src/engine_test.cpp
+++ b/proton-c/bindings/cpp/src/engine_test.cpp
@@ -95,16 +95,17 @@ template <class S> typename S::value_type quick_pop(S& s) {
 
 /// A handler that records incoming endpoints, errors etc.
 struct record_handler : public handler {
-    std::deque<proton::internal::link> links;
+    std::deque<proton::receiver> receivers;
+    std::deque<proton::sender> senders;
     std::deque<proton::session> sessions;
     std::deque<std::string> unhandled_errors, transport_errors, connection_errors;
 
     void on_receiver_open(receiver &l) override {
-        links.push_back(l);
+        receivers.push_back(l);
     }
 
     void on_sender_open(sender &l) override {
-        links.push_back(l);
+        senders.push_back(l);
     }
 
     void on_session_open(session &s) override {
@@ -136,19 +137,19 @@ void test_engine_prefix() {
     ASSERT_EQUAL("b", e.b.connection().container_id());
 
     e.a.connection().open_sender("x");
-    while (ha.links.empty() || hb.links.empty()) e.process();
-    ASSERT_EQUAL("x/1", quick_pop(ha.links).name());
-    ASSERT_EQUAL("x/1", quick_pop(hb.links).name());
+    while (ha.senders.empty() || hb.receivers.empty()) e.process();
+    ASSERT_EQUAL("x/1", quick_pop(ha.senders).name());
+    ASSERT_EQUAL("x/1", quick_pop(hb.receivers).name());
 
     e.a.connection().open_receiver("");
-    while (ha.links.empty() || hb.links.empty()) e.process();
-    ASSERT_EQUAL("x/2", quick_pop(ha.links).name());
-    ASSERT_EQUAL("x/2", quick_pop(hb.links).name());
+    while (ha.receivers.empty() || hb.senders.empty()) e.process();
+    ASSERT_EQUAL("x/2", quick_pop(ha.receivers).name());
+    ASSERT_EQUAL("x/2", quick_pop(hb.senders).name());
 
     e.b.connection().open_receiver("");
-    while (ha.links.empty() || hb.links.empty()) e.process();
-    ASSERT_EQUAL("y/1", quick_pop(ha.links).name());
-    ASSERT_EQUAL("y/1", quick_pop(hb.links).name());
+    while (ha.senders.empty() || hb.receivers.empty()) e.process();
+    ASSERT_EQUAL("y/1", quick_pop(ha.senders).name());
+    ASSERT_EQUAL("y/1", quick_pop(hb.receivers).name());
 }
 
 void test_container_prefix() {
@@ -164,15 +165,15 @@ void test_container_prefix() {
     sender s = e.a.connection().open_sender("x");
     ASSERT_EQUAL("1/1", s.name());
 
-    while (ha.links.empty() || hb.links.empty()) e.process();
+    while (ha.senders.empty() || hb.receivers.empty()) e.process();
 
-    ASSERT_EQUAL("1/1", quick_pop(ha.links).name());
-    ASSERT_EQUAL("1/1", quick_pop(hb.links).name());
+    ASSERT_EQUAL("1/1", quick_pop(ha.senders).name());
+    ASSERT_EQUAL("1/1", quick_pop(hb.receivers).name());
 
     e.a.connection().open_receiver("y");
-    while (ha.links.empty() || hb.links.empty()) e.process();
-    ASSERT_EQUAL("1/2", quick_pop(ha.links).name());
-    ASSERT_EQUAL("1/2", quick_pop(hb.links).name());
+    while (ha.receivers.empty() || hb.senders.empty()) e.process();
+    ASSERT_EQUAL("1/2", quick_pop(ha.receivers).name());
+    ASSERT_EQUAL("1/2", quick_pop(hb.senders).name());
 
     // Open a second connection in each container, make sure links have different IDs.
     record_handler ha2, hb2;
@@ -185,10 +186,10 @@ void test_container_prefix() {
     receiver r = e2.b.connection().open_receiver("z");
     ASSERT_EQUAL("2/1", r.name());
 
-    while (ha2.links.empty() || hb2.links.empty()) e2.process();
+    while (ha2.senders.empty() || hb2.receivers.empty()) e2.process();
 
-    ASSERT_EQUAL("2/1", quick_pop(ha2.links).name());
-    ASSERT_EQUAL("2/1", quick_pop(hb2.links).name());
+    ASSERT_EQUAL("2/1", quick_pop(ha2.senders).name());
+    ASSERT_EQUAL("2/1", quick_pop(hb2.receivers).name());
 };
 
 void test_endpoint_close() {
@@ -199,9 +200,10 @@ void test_endpoint_close() {
     e.a.connection().open();
     e.a.connection().open_sender("x");
     e.a.connection().open_receiver("y");
-    while (ha.links.size() < 2 || hb.links.size() < 2) e.process();
-    proton::internal::link ax = quick_pop(ha.links), ay = quick_pop(ha.links);
-    proton::internal::link bx = quick_pop(hb.links), by = quick_pop(hb.links);
+    while (ha.senders.size()+ha.receivers.size() < 2 ||
+           hb.senders.size()+hb.receivers.size() < 2) e.process();
+    proton::internal::link ax = quick_pop(ha.senders), ay = quick_pop(ha.receivers);
+    proton::internal::link bx = quick_pop(hb.receivers), by = quick_pop(hb.senders);
 
     // Close a link
     ax.close(proton::error_condition("err", "foo bar"));


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@qpid.apache.org
For additional commands, e-mail: commits-help@qpid.apache.org


Mime
View raw message