Skip to content

Commit

Permalink
connection
Browse files Browse the repository at this point in the history
  • Loading branch information
Ye-Yu-Mo committed Oct 12, 2024
1 parent fb65ae5 commit 94eecd1
Show file tree
Hide file tree
Showing 6 changed files with 23 additions and 7 deletions.
7 changes: 5 additions & 2 deletions test/Makefile
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
.PHONY:mqchannel
.PHONY:mqconnection
mqconnection:mqconnectiontest.cpp ../common/msg.pb.cc ../common/protocol.pb.cc
g++ $^ -o $@ -std=c++17 -lgtest -lsqlite3 -lprotobuf -I../third/muduo/include

mqchannel:mqchanneltest.cpp ../common/msg.pb.cc ../common/protocol.pb.cc
g++ $^ -o $@ -std=c++17 -lgtest -lsqlite3 -lprotobuf -I../third/muduo/include

Expand Down Expand Up @@ -27,4 +30,4 @@ mqfiletest:mqfiletest.cpp
g++ $^ -o $@ -std=c++17
.PHONY:clean
clean:
rm mqfiletest dir mqroute mqconsumer mqexchangetest mqmessagetest data mqhosttest -rf
rm mqfiletest dir mqroute mqconsumer mqexchangetest mqmessagetest data mqhosttest mqchannel -rf
Binary file removed test/mqchannel
Binary file not shown.
10 changes: 5 additions & 5 deletions test/mqchanneltest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@ int main()
{
XuMQ::ChannelManager::ptr cmp = std::make_shared<XuMQ::ChannelManager>();
cmp->openChannel("c1",
std::make_shared<XuMQ::VirtualHost>("host1", "./data/host1/message/", "./data/host1/host1.db"),
std::make_shared<XuMQ::ConsumerManager>(),
XuMQ::ProtobufCodecPtr(),
muduo::net::TcpConnectionPtr(),
XuMQ::threadpool::ptr());
std::make_shared<XuMQ::VirtualHost>("host1", "./data/host1/message/", "./data/host1/host1.db"),
std::make_shared<XuMQ::ConsumerManager>(),
XuMQ::ProtobufCodecPtr(),
muduo::net::TcpConnectionPtr(),
XuMQ::threadpool::ptr());
return 0;
}
Binary file added test/mqconnection
Binary file not shown.
13 changes: 13 additions & 0 deletions test/mqconnectiontest.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
#include "../server/connection.hpp"

int main()
{
XuMQ::ConnectionManager::ptr cmp = std::make_shared<XuMQ::ConnectionManager>();
cmp->newConnection(std::make_shared<XuMQ::VirtualHost>("host1", "./data/host1/message/", "./data/host1/host1.db"),
std::make_shared<XuMQ::ConsumerManager>(),
XuMQ::ProtobufCodecPtr(),
muduo::net::TcpConnectionPtr(),
XuMQ::threadpool::ptr());

return 0;
}
Binary file removed test/mqconsumer
Binary file not shown.

0 comments on commit 94eecd1

Please sign in to comment.