Skip to content
Snippets Groups Projects
Commit eeaba446 authored by Irene Zhang's avatar Irene Zhang
Browse files

updating tests for VR

parent d89913ff
No related branches found
No related tags found
No related merge requests found
......@@ -67,11 +67,9 @@ TestReceiver::ReceiveMessage(const TransportAddress &src,
class SimTransportTest : public testing::Test
{
protected:
std::vector<transport::ReplicaAddress> replicaAddrs =
{ { "localhost", "12345" },
{ "localhost", "12346" },
{ "localhost", "12347" }};
transport::Configuration config{3, 1, replicaAddrs};
std::vector<transport::ReplicaAddress> replicaAddrs;
transport::Configuration *config;
TestReceiver *receiver0;
TestReceiver *receiver1;
......@@ -80,14 +78,19 @@ protected:
SimulatedTransport *transport;
virtual void SetUp() {
replicaAddrs.push_back(*(new transport::ReplicaAddress("localhost", "12345")));
replicaAddrs.push_back(*(new transport::ReplicaAddress("localhost", "12346")));
replicaAddrs.push_back(*(new transport::ReplicaAddress("localhost", "12347")));
receiver0 = new TestReceiver();
receiver1 = new TestReceiver();
receiver2 = new TestReceiver();
config = new transport::Configuration(3, 1, replicaAddrs);
transport = new SimulatedTransport();
transport->Register(receiver0, config, 0);
transport->Register(receiver1, config, 1);
transport->Register(receiver2, config, 2);
transport->Register(receiver0, *config, 0);
transport->Register(receiver1, *config, 1);
transport->Register(receiver2, *config, 2);
}
virtual void TearDown() {
......
......@@ -56,7 +56,9 @@ Replica::~Replica()
void
Replica::LeaderUpcall(opnum_t opnum, const string &op, bool &replicate, string &res)
{
Debug("Making leader upcall for operation %s", op.c_str());
app->LeaderUpcall(opnum, op, replicate, res);
Debug("Upcall result: %s %s", replicate ? "yes":"no", res.c_str());
}
void
......
......@@ -61,12 +61,12 @@ class VRApp : public AppReplica {
public:
VRApp(std::vector<string> *o, std::vector<string> *u) : ops(o), unloggedOps(u) { }
void ReplicaUpcall(Replica *r, opnum_t opnum, const string &req, string &reply) {
void ReplicaUpcall(opnum_t opnum, const string &req, string &reply) {
ops->push_back(req);
reply = "reply: " + req;
}
void UnloggedUpcall(Replica *r, const string &req, string &reply) {
void UnloggedUpcall(const string &req, string &reply) {
unloggedOps->push_back(req);
reply = "unlreply: " + req;
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment