Commit 45931267 authored by Dominik Charousset's avatar Dominik Charousset

Avoid re-using "expect" in BASP unit test

parent 0d8c941f
...@@ -20,12 +20,13 @@ ...@@ -20,12 +20,13 @@
#include "caf/config.hpp" #include "caf/config.hpp"
#define CAF_SUITE io_basp #define CAF_SUITE io_basp
#include "caf/test/unit_test.hpp" #include "caf/test/dsl.hpp"
#include <array> #include <array>
#include <mutex> #include <mutex>
#include <memory> #include <memory>
#include <limits> #include <limits>
#include <vector>
#include <iostream> #include <iostream>
#include <condition_variable> #include <condition_variable>
...@@ -125,19 +126,22 @@ struct node { ...@@ -125,19 +126,22 @@ struct node {
class fixture { class fixture {
public: public:
fixture(bool autoconn = false) fixture(bool autoconn = false)
: system(cfg.load<io::middleman, network::test_multiplexer>() : sys(cfg.load<io::middleman, network::test_multiplexer>()
.set("middleman.enable-automatic-connections", autoconn)) { .set("middleman.enable-automatic-connections", autoconn)
auto& mm = system.middleman(); .set("scheduler.policy", autoconn ? caf::atom("testing")
: caf::atom("default"))
.set("middleman.detach-utility-actors", !autoconn)) {
auto& mm = sys.middleman();
mpx_ = dynamic_cast<network::test_multiplexer*>(&mm.backend()); mpx_ = dynamic_cast<network::test_multiplexer*>(&mm.backend());
CAF_REQUIRE(mpx_ != nullptr); CAF_REQUIRE(mpx_ != nullptr);
CAF_REQUIRE(&system == &mpx_->system()); CAF_REQUIRE(&sys == &mpx_->system());
auto hdl = mm.named_broker<basp_broker>(basp_atom); auto hdl = mm.named_broker<basp_broker>(basp_atom);
aut_ = static_cast<basp_broker*>(actor_cast<abstract_actor*>(hdl)); aut_ = static_cast<basp_broker*>(actor_cast<abstract_actor*>(hdl));
this_node_ = system.node(); this_node_ = sys.node();
self_.reset(new scoped_actor{system}); self_.reset(new scoped_actor{sys});
ahdl_ = accept_handle::from_int(1); ahdl_ = accept_handle::from_int(1);
mpx_->assign_tcp_doorman(aut_, ahdl_); mpx_->assign_tcp_doorman(aut_, ahdl_);
registry_ = &system.registry(); registry_ = &sys.registry();
registry_->put((*self_)->id(), actor_cast<strong_actor_ptr>(*self_)); registry_->put((*self_)->id(), actor_cast<strong_actor_ptr>(*self_));
// first remote node is everything of this_node + 1, then +2, etc. // first remote node is everything of this_node + 1, then +2, etc.
for (uint32_t i = 0; i < num_remote_nodes; ++i) { for (uint32_t i = 0; i < num_remote_nodes; ++i) {
...@@ -147,7 +151,7 @@ public: ...@@ -147,7 +151,7 @@ public:
c = static_cast<uint8_t>(c + i + 1); c = static_cast<uint8_t>(c + i + 1);
n.id = node_id{this_node_.process_id() + i + 1, tmp}; n.id = node_id{this_node_.process_id() + i + 1, tmp};
n.connection = connection_handle::from_int(i + 1); n.connection = connection_handle::from_int(i + 1);
new (&n.dummy_actor) scoped_actor(system); new (&n.dummy_actor) scoped_actor(sys);
// register all pseudo remote actors in the registry // register all pseudo remote actors in the registry
registry_->put(n.dummy_actor->id(), registry_->put(n.dummy_actor->id(),
actor_cast<strong_actor_ptr>(n.dummy_actor)); actor_cast<strong_actor_ptr>(n.dummy_actor));
...@@ -289,7 +293,7 @@ public: ...@@ -289,7 +293,7 @@ public:
{basp::message_type::client_handshake, 0, 0, 0, {basp::message_type::client_handshake, 0, 0, 0,
n.id, this_node(), n.id, this_node(),
invalid_actor_id, invalid_actor_id}, std::string{}) invalid_actor_id, invalid_actor_id}, std::string{})
.expect(hdl, .receive(hdl,
basp::message_type::server_handshake, no_flags, basp::message_type::server_handshake, no_flags,
any_vals, basp::version, this_node(), node_id{none}, any_vals, basp::version, this_node(), node_id{none},
published_actor_id, invalid_actor_id, std::string{}, published_actor_id, invalid_actor_id, std::string{},
...@@ -297,7 +301,7 @@ public: ...@@ -297,7 +301,7 @@ public:
published_actor_ifs) published_actor_ifs)
// upon receiving our client handshake, BASP will check // upon receiving our client handshake, BASP will check
// whether there is a SpawnServ actor on this node // whether there is a SpawnServ actor on this node
.expect(hdl, .receive(hdl,
basp::message_type::dispatch_message, basp::message_type::dispatch_message,
basp::header::named_receiver_flag, any_vals, basp::header::named_receiver_flag, any_vals,
no_operation_data, no_operation_data,
...@@ -359,7 +363,7 @@ public: ...@@ -359,7 +363,7 @@ public:
} }
template <class... Ts> template <class... Ts>
mock_t& expect(connection_handle hdl, mock_t& receive(connection_handle hdl,
maybe<basp::message_type> operation, maybe<basp::message_type> operation,
maybe<uint8_t> flags, maybe<uint8_t> flags,
maybe<uint32_t> payload_len, maybe<uint32_t> payload_len,
...@@ -429,7 +433,7 @@ public: ...@@ -429,7 +433,7 @@ public:
} }
actor_system_config cfg; actor_system_config cfg;
actor_system system; actor_system sys;
private: private:
basp_broker* aut_; basp_broker* aut_;
...@@ -448,9 +452,29 @@ private: ...@@ -448,9 +452,29 @@ private:
class autoconn_enabled_fixture : public fixture { class autoconn_enabled_fixture : public fixture {
public: public:
autoconn_enabled_fixture() : fixture(true) { using scheduler_type = caf::scheduler::test_coordinator;
scheduler_type& sched;
middleman_actor mma;
autoconn_enabled_fixture()
: fixture(true),
sched(dynamic_cast<scheduler_type&>(sys.scheduler())),
mma(sys.middleman().actor_handle()) {
// nop // nop
} }
void publish(const actor& whom, uint16_t port) {
using sig_t = std::set<std::string>;
scoped_actor tmp{sys};
sig_t sigs;
tmp->send(mma, publish_atom::value, port,
actor_cast<strong_actor_ptr>(whom), std::move(sigs), "", false);
expect((atom_value, uint16_t, strong_actor_ptr, sig_t, std::string, bool),
from(tmp).to(mma).with(_));
expect((uint16_t), from(mma).to(tmp).with(port));
}
}; };
} // namespace <anonymous> } // namespace <anonymous>
...@@ -494,7 +518,7 @@ CAF_TEST(non_empty_server_handshake) { ...@@ -494,7 +518,7 @@ CAF_TEST(non_empty_server_handshake) {
CAF_TEST(remote_address_and_port) { CAF_TEST(remote_address_and_port) {
CAF_MESSAGE("connect to Mars"); CAF_MESSAGE("connect to Mars");
connect_node(mars()); connect_node(mars());
auto mm = system.middleman().actor_handle(); auto mm = sys.middleman().actor_handle();
CAF_MESSAGE("ask MM about node ID of Mars"); CAF_MESSAGE("ask MM about node ID of Mars");
self()->send(mm, get_atom::value, mars().id); self()->send(mm, get_atom::value, mars().id);
do { do {
...@@ -520,7 +544,7 @@ CAF_TEST(client_handshake_and_dispatch) { ...@@ -520,7 +544,7 @@ CAF_TEST(client_handshake_and_dispatch) {
jupiter().id, this_node(), jupiter().dummy_actor->id(), self()->id()}, jupiter().id, this_node(), jupiter().dummy_actor->id(), self()->id()},
std::vector<actor_addr>{}, std::vector<actor_addr>{},
make_message(1, 2, 3)) make_message(1, 2, 3))
.expect(jupiter().connection, .receive(jupiter().connection,
basp::message_type::announce_proxy, no_flags, no_payload, basp::message_type::announce_proxy, no_flags, no_payload,
no_operation_data, this_node(), jupiter().id, no_operation_data, this_node(), jupiter().id,
invalid_actor_id, jupiter().dummy_actor->id()); invalid_actor_id, jupiter().dummy_actor->id());
...@@ -538,7 +562,8 @@ CAF_TEST(client_handshake_and_dispatch) { ...@@ -538,7 +562,8 @@ CAF_TEST(client_handshake_and_dispatch) {
); );
CAF_MESSAGE("exec message of forwarding proxy"); CAF_MESSAGE("exec message of forwarding proxy");
mpx()->exec_runnable(); mpx()->exec_runnable();
dispatch_out_buf(jupiter().connection); // deserialize and send message from out buf // deserialize and send message from out buf
dispatch_out_buf(jupiter().connection);
jupiter().dummy_actor->receive( jupiter().dummy_actor->receive(
[](int i) { [](int i) {
CAF_CHECK_EQUAL(i, 6); CAF_CHECK_EQUAL(i, 6);
...@@ -557,7 +582,7 @@ CAF_TEST(message_forwarding) { ...@@ -557,7 +582,7 @@ CAF_TEST(message_forwarding) {
jupiter().id, mars().id, jupiter().id, mars().id,
invalid_actor_id, mars().dummy_actor->id()}, invalid_actor_id, mars().dummy_actor->id()},
msg) msg)
.expect(mars().connection, .receive(mars().connection,
basp::message_type::dispatch_message, no_flags, any_vals, basp::message_type::dispatch_message, no_flags, any_vals,
no_operation_data, jupiter().id, mars().id, no_operation_data, jupiter().id, mars().id,
invalid_actor_id, mars().dummy_actor->id(), invalid_actor_id, mars().dummy_actor->id(),
...@@ -567,7 +592,7 @@ CAF_TEST(message_forwarding) { ...@@ -567,7 +592,7 @@ CAF_TEST(message_forwarding) {
CAF_TEST(publish_and_connect) { CAF_TEST(publish_and_connect) {
auto ax = accept_handle::from_int(4242); auto ax = accept_handle::from_int(4242);
mpx()->provide_acceptor(4242, ax); mpx()->provide_acceptor(4242, ax);
auto res = system.middleman().publish(self(), 4242); auto res = sys.middleman().publish(self(), 4242);
CAF_REQUIRE(res == 4242); CAF_REQUIRE(res == 4242);
mpx()->flush_runnables(); // process publish message in basp_broker mpx()->flush_runnables(); // process publish message in basp_broker
connect_node(jupiter(), ax, self()->id()); connect_node(jupiter(), ax, self()->id());
...@@ -578,7 +603,7 @@ CAF_TEST(remote_actor_and_send) { ...@@ -578,7 +603,7 @@ CAF_TEST(remote_actor_and_send) {
CAF_MESSAGE("self: " << to_string(self()->address())); CAF_MESSAGE("self: " << to_string(self()->address()));
mpx()->provide_scribe(lo, 4242, jupiter().connection); mpx()->provide_scribe(lo, 4242, jupiter().connection);
CAF_REQUIRE(mpx()->has_pending_scribe(lo, 4242)); CAF_REQUIRE(mpx()->has_pending_scribe(lo, 4242));
auto mm1 = system.middleman().actor_handle(); auto mm1 = sys.middleman().actor_handle();
actor result; actor result;
auto f = self()->request(mm1, infinite, auto f = self()->request(mm1, infinite,
connect_atom::value, lo, uint16_t{4242}); connect_atom::value, lo, uint16_t{4242});
...@@ -596,11 +621,11 @@ CAF_TEST(remote_actor_and_send) { ...@@ -596,11 +621,11 @@ CAF_TEST(remote_actor_and_send) {
std::string{}, std::string{},
jupiter().dummy_actor->id(), jupiter().dummy_actor->id(),
uint32_t{0}) uint32_t{0})
.expect(jupiter().connection, .receive(jupiter().connection,
basp::message_type::client_handshake, no_flags, 1u, basp::message_type::client_handshake, no_flags, 1u,
no_operation_data, this_node(), jupiter().id, no_operation_data, this_node(), jupiter().id,
invalid_actor_id, invalid_actor_id, std::string{}) invalid_actor_id, invalid_actor_id, std::string{})
.expect(jupiter().connection, .receive(jupiter().connection,
basp::message_type::dispatch_message, basp::message_type::dispatch_message,
basp::header::named_receiver_flag, any_vals, basp::header::named_receiver_flag, any_vals,
no_operation_data, this_node(), jupiter().id, no_operation_data, this_node(), jupiter().id,
...@@ -608,7 +633,7 @@ CAF_TEST(remote_actor_and_send) { ...@@ -608,7 +633,7 @@ CAF_TEST(remote_actor_and_send) {
spawn_serv_atom, spawn_serv_atom,
std::vector<actor_id>{}, std::vector<actor_id>{},
make_message(sys_atom::value, get_atom::value, "info")) make_message(sys_atom::value, get_atom::value, "info"))
.expect(jupiter().connection, .receive(jupiter().connection,
basp::message_type::announce_proxy, no_flags, no_payload, basp::message_type::announce_proxy, no_flags, no_payload,
no_operation_data, this_node(), jupiter().id, no_operation_data, this_node(), jupiter().id,
invalid_actor_id, jupiter().dummy_actor->id()); invalid_actor_id, jupiter().dummy_actor->id());
...@@ -629,7 +654,7 @@ CAF_TEST(remote_actor_and_send) { ...@@ -629,7 +654,7 @@ CAF_TEST(remote_actor_and_send) {
result = actor_cast<actor>(res); result = actor_cast<actor>(res);
}, },
[&](error& err) { [&](error& err) {
CAF_FAIL("error: " << system.render(err)); CAF_FAIL("error: " << sys.render(err));
} }
); );
CAF_MESSAGE("send message to proxy"); CAF_MESSAGE("send message to proxy");
...@@ -637,7 +662,7 @@ CAF_TEST(remote_actor_and_send) { ...@@ -637,7 +662,7 @@ CAF_TEST(remote_actor_and_send) {
mpx()->flush_runnables(); mpx()->flush_runnables();
// mpx()->exec_runnable(); // process forwarded message in basp_broker // mpx()->exec_runnable(); // process forwarded message in basp_broker
mock() mock()
.expect(jupiter().connection, .receive(jupiter().connection,
basp::message_type::dispatch_message, no_flags, any_vals, basp::message_type::dispatch_message, no_flags, any_vals,
no_operation_data, this_node(), jupiter().id, no_operation_data, this_node(), jupiter().id,
invalid_actor_id, jupiter().dummy_actor->id(), invalid_actor_id, jupiter().dummy_actor->id(),
...@@ -672,13 +697,13 @@ CAF_TEST(actor_serialize_and_deserialize) { ...@@ -672,13 +697,13 @@ CAF_TEST(actor_serialize_and_deserialize) {
connect_node(jupiter()); connect_node(jupiter());
auto prx = proxies().get_or_put(jupiter().id, jupiter().dummy_actor->id()); auto prx = proxies().get_or_put(jupiter().id, jupiter().dummy_actor->id());
mock() mock()
.expect(jupiter().connection, .receive(jupiter().connection,
basp::message_type::announce_proxy, no_flags, no_payload, basp::message_type::announce_proxy, no_flags, no_payload,
no_operation_data, this_node(), prx->node(), no_operation_data, this_node(), prx->node(),
invalid_actor_id, prx->id()); invalid_actor_id, prx->id());
CAF_CHECK_EQUAL(prx->node(), jupiter().id); CAF_CHECK_EQUAL(prx->node(), jupiter().id);
CAF_CHECK_EQUAL(prx->id(), jupiter().dummy_actor->id()); CAF_CHECK_EQUAL(prx->id(), jupiter().dummy_actor->id());
auto testee = system.spawn(testee_impl); auto testee = sys.spawn(testee_impl);
registry()->put(testee->id(), actor_cast<strong_actor_ptr>(testee)); registry()->put(testee->id(), actor_cast<strong_actor_ptr>(testee));
CAF_MESSAGE("send message via BASP (from proxy)"); CAF_MESSAGE("send message via BASP (from proxy)");
auto msg = make_message(actor_cast<actor_addr>(prx)); auto msg = make_message(actor_cast<actor_addr>(prx));
...@@ -694,7 +719,7 @@ CAF_TEST(actor_serialize_and_deserialize) { ...@@ -694,7 +719,7 @@ CAF_TEST(actor_serialize_and_deserialize) {
mpx()->exec_runnable(); // process forwarded message in basp_broker mpx()->exec_runnable(); // process forwarded message in basp_broker
// output buffer must contain the reflected message // output buffer must contain the reflected message
mock() mock()
.expect(jupiter().connection, .receive(jupiter().connection,
basp::message_type::dispatch_message, no_flags, any_vals, basp::message_type::dispatch_message, no_flags, any_vals,
no_operation_data, this_node(), prx->node(), testee->id(), prx->id(), no_operation_data, this_node(), prx->node(), testee->id(), prx->id(),
std::vector<actor_id>{}, msg); std::vector<actor_id>{}, msg);
...@@ -707,7 +732,7 @@ CAF_TEST(indirect_connections) { ...@@ -707,7 +732,7 @@ CAF_TEST(indirect_connections) {
CAF_MESSAGE("publish self at port 4242"); CAF_MESSAGE("publish self at port 4242");
auto ax = accept_handle::from_int(4242); auto ax = accept_handle::from_int(4242);
mpx()->provide_acceptor(4242, ax); mpx()->provide_acceptor(4242, ax);
system.middleman().publish(self(), 4242); sys.middleman().publish(self(), 4242);
mpx()->flush_runnables(); // process publish message in basp_broker mpx()->flush_runnables(); // process publish message in basp_broker
CAF_MESSAGE("connect to Mars"); CAF_MESSAGE("connect to Mars");
connect_node(mars(), ax, self()->id()); connect_node(mars(), ax, self()->id());
...@@ -720,7 +745,7 @@ CAF_TEST(indirect_connections) { ...@@ -720,7 +745,7 @@ CAF_TEST(indirect_connections) {
make_message("hello from jupiter!")); make_message("hello from jupiter!"));
CAF_MESSAGE("expect ('sys', 'get', \"info\") from Earth to Jupiter at Mars"); CAF_MESSAGE("expect ('sys', 'get', \"info\") from Earth to Jupiter at Mars");
// this asks Jupiter if it has a 'SpawnServ' // this asks Jupiter if it has a 'SpawnServ'
mx.expect(mars().connection, mx.receive(mars().connection,
basp::message_type::dispatch_message, basp::message_type::dispatch_message,
basp::header::named_receiver_flag, any_vals, basp::header::named_receiver_flag, any_vals,
no_operation_data, this_node(), jupiter().id, no_operation_data, this_node(), jupiter().id,
...@@ -729,7 +754,7 @@ CAF_TEST(indirect_connections) { ...@@ -729,7 +754,7 @@ CAF_TEST(indirect_connections) {
std::vector<actor_id>{}, std::vector<actor_id>{},
make_message(sys_atom::value, get_atom::value, "info")); make_message(sys_atom::value, get_atom::value, "info"));
CAF_MESSAGE("expect announce_proxy message at Mars from Earth to Jupiter"); CAF_MESSAGE("expect announce_proxy message at Mars from Earth to Jupiter");
mx.expect(mars().connection, mx.receive(mars().connection,
basp::message_type::announce_proxy, no_flags, no_payload, basp::message_type::announce_proxy, no_flags, no_payload,
no_operation_data, this_node(), jupiter().id, no_operation_data, this_node(), jupiter().id,
invalid_actor_id, jupiter().dummy_actor->id()); invalid_actor_id, jupiter().dummy_actor->id());
...@@ -742,7 +767,7 @@ CAF_TEST(indirect_connections) { ...@@ -742,7 +767,7 @@ CAF_TEST(indirect_connections) {
); );
mpx()->exec_runnable(); // process forwarded message in basp_broker mpx()->exec_runnable(); // process forwarded message in basp_broker
mock() mock()
.expect(mars().connection, .receive(mars().connection,
basp::message_type::dispatch_message, no_flags, any_vals, basp::message_type::dispatch_message, no_flags, any_vals,
no_operation_data, this_node(), jupiter().id, no_operation_data, this_node(), jupiter().id,
self()->id(), jupiter().dummy_actor->id(), self()->id(), jupiter().dummy_actor->id(),
...@@ -767,7 +792,7 @@ CAF_TEST(automatic_connection) { ...@@ -767,7 +792,7 @@ CAF_TEST(automatic_connection) {
CAF_MESSAGE("self: " << to_string(self()->address())); CAF_MESSAGE("self: " << to_string(self()->address()));
auto ax = accept_handle::from_int(4242); auto ax = accept_handle::from_int(4242);
mpx()->provide_acceptor(4242, ax); mpx()->provide_acceptor(4242, ax);
system.middleman().publish(self(), 4242); publish(self(), 4242);
mpx()->flush_runnables(); // process publish message in basp_broker mpx()->flush_runnables(); // process publish message in basp_broker
CAF_MESSAGE("connect to mars"); CAF_MESSAGE("connect to mars");
connect_node(mars(), ax, self()->id()); connect_node(mars(), ax, self()->id());
...@@ -780,14 +805,14 @@ CAF_TEST(automatic_connection) { ...@@ -780,14 +805,14 @@ CAF_TEST(automatic_connection) {
jupiter().dummy_actor->id(), self()->id()}, jupiter().dummy_actor->id(), self()->id()},
std::vector<actor_id>{}, std::vector<actor_id>{},
make_message("hello from jupiter!")) make_message("hello from jupiter!"))
.expect(mars().connection, .receive(mars().connection,
basp::message_type::dispatch_message, basp::message_type::dispatch_message,
basp::header::named_receiver_flag, any_vals, no_operation_data, basp::header::named_receiver_flag, any_vals, no_operation_data,
this_node(), jupiter().id, any_vals, invalid_actor_id, this_node(), jupiter().id, any_vals, invalid_actor_id,
spawn_serv_atom, spawn_serv_atom,
std::vector<actor_id>{}, std::vector<actor_id>{},
make_message(sys_atom::value, get_atom::value, "info")) make_message(sys_atom::value, get_atom::value, "info"))
.expect(mars().connection, .receive(mars().connection,
basp::message_type::dispatch_message, basp::message_type::dispatch_message,
basp::header::named_receiver_flag, any_vals, basp::header::named_receiver_flag, any_vals,
no_operation_data, this_node(), jupiter().id, no_operation_data, this_node(), jupiter().id,
...@@ -796,14 +821,14 @@ CAF_TEST(automatic_connection) { ...@@ -796,14 +821,14 @@ CAF_TEST(automatic_connection) {
config_serv_atom, config_serv_atom,
std::vector<actor_id>{}, std::vector<actor_id>{},
make_message(get_atom::value, "basp.default-connectivity")) make_message(get_atom::value, "basp.default-connectivity"))
.expect(mars().connection, .receive(mars().connection,
basp::message_type::announce_proxy, no_flags, no_payload, basp::message_type::announce_proxy, no_flags, no_payload,
no_operation_data, this_node(), jupiter().id, no_operation_data, this_node(), jupiter().id,
invalid_actor_id, jupiter().dummy_actor->id()); invalid_actor_id, jupiter().dummy_actor->id());
CAF_CHECK_EQUAL(mpx()->output_buffer(mars().connection).size(), 0u); CAF_CHECK_EQUAL(mpx()->output_buffer(mars().connection).size(), 0u);
CAF_CHECK_EQUAL(tbl().lookup_indirect(jupiter().id), mars().id); CAF_CHECK_EQUAL(tbl().lookup_indirect(jupiter().id), mars().id);
CAF_CHECK_EQUAL(tbl().lookup_indirect(mars().id), none); CAF_CHECK_EQUAL(tbl().lookup_indirect(mars().id), none);
auto connection_helper = system.latest_actor_id(); auto connection_helper = sys.latest_actor_id();
CAF_CHECK_EQUAL(mpx()->output_buffer(mars().connection).size(), 0u); CAF_CHECK_EQUAL(mpx()->output_buffer(mars().connection).size(), 0u);
// create a dummy config server and respond to the name lookup // create a dummy config server and respond to the name lookup
CAF_MESSAGE("receive ConfigServ of jupiter"); CAF_MESSAGE("receive ConfigServ of jupiter");
...@@ -829,13 +854,14 @@ CAF_TEST(automatic_connection) { ...@@ -829,13 +854,14 @@ CAF_TEST(automatic_connection) {
std::string{}, std::string{},
jupiter().dummy_actor->id(), jupiter().dummy_actor->id(),
uint32_t{0}) uint32_t{0})
.expect(jupiter().connection, .receive(jupiter().connection,
basp::message_type::client_handshake, no_flags, 1u, basp::message_type::client_handshake, no_flags, 1u,
no_operation_data, this_node(), jupiter().id, no_operation_data, this_node(), jupiter().id,
invalid_actor_id, invalid_actor_id, std::string{}); invalid_actor_id, invalid_actor_id, std::string{});
CAF_CHECK_EQUAL(tbl().lookup_indirect(jupiter().id), none); CAF_CHECK_EQUAL(tbl().lookup_indirect(jupiter().id), none);
CAF_CHECK_EQUAL(tbl().lookup_indirect(mars().id), none); CAF_CHECK_EQUAL(tbl().lookup_indirect(mars().id), none);
CAF_CHECK_EQUAL(tbl().lookup_direct(jupiter().id).id(), jupiter().connection.id()); CAF_CHECK_EQUAL(tbl().lookup_direct(jupiter().id).id(),
jupiter().connection.id());
CAF_CHECK_EQUAL(tbl().lookup_direct(mars().id).id(), mars().connection.id()); CAF_CHECK_EQUAL(tbl().lookup_direct(mars().id).id(), mars().connection.id());
CAF_MESSAGE("receive message from jupiter"); CAF_MESSAGE("receive message from jupiter");
self()->receive( self()->receive(
...@@ -847,7 +873,7 @@ CAF_TEST(automatic_connection) { ...@@ -847,7 +873,7 @@ CAF_TEST(automatic_connection) {
mpx()->exec_runnable(); // process forwarded message in basp_broker mpx()->exec_runnable(); // process forwarded message in basp_broker
CAF_MESSAGE("response message must take direct route now"); CAF_MESSAGE("response message must take direct route now");
mock() mock()
.expect(jupiter().connection, .receive(jupiter().connection,
basp::message_type::dispatch_message, no_flags, any_vals, basp::message_type::dispatch_message, no_flags, any_vals,
no_operation_data, this_node(), jupiter().id, no_operation_data, this_node(), jupiter().id,
self()->id(), jupiter().dummy_actor->id(), self()->id(), jupiter().dummy_actor->id(),
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment