mirror of
https://github.com/FairRootGroup/FairMQ.git
synced 2025-10-15 09:31:45 +00:00
Add FairMQ tests (PUB-SUB, PUSH-PULL, REQ-REP).
This commit is contained in:
committed by
Mohammad Al-Turany
parent
fbf7dbf2ba
commit
f13bb5995d
65
fairmq/test/pub-sub/runTestPub.cxx
Normal file
65
fairmq/test/pub-sub/runTestPub.cxx
Normal file
@@ -0,0 +1,65 @@
|
||||
/********************************************************************************
|
||||
* Copyright (C) 2014 GSI Helmholtzzentrum fuer Schwerionenforschung GmbH *
|
||||
* *
|
||||
* This software is distributed under the terms of the *
|
||||
* GNU Lesser General Public Licence version 3 (LGPL) version 3, *
|
||||
* copied verbatim in the file "LICENSE" *
|
||||
********************************************************************************/
|
||||
/**
|
||||
* runTestPub.cxx
|
||||
*
|
||||
* @since 2015-09-05
|
||||
* @author A. Rybalchenko
|
||||
*/
|
||||
|
||||
|
||||
|
||||
#include "FairMQLogger.h"
|
||||
#include "FairMQTestPub.h"
|
||||
|
||||
#ifdef NANOMSG
|
||||
#include "FairMQTransportFactoryNN.h"
|
||||
#else
|
||||
#include "FairMQTransportFactoryZMQ.h"
|
||||
#endif
|
||||
|
||||
int main(int argc, char** argv)
|
||||
{
|
||||
FairMQTestPub testPub;
|
||||
testPub.CatchSignals();
|
||||
|
||||
#ifdef NANOMSG
|
||||
testPub.SetTransport(new FairMQTransportFactoryNN());
|
||||
#else
|
||||
testPub.SetTransport(new FairMQTransportFactoryZMQ());
|
||||
#endif
|
||||
|
||||
testPub.SetProperty(FairMQTestPub::Id, "testPub");
|
||||
|
||||
FairMQChannel controlChannel("pull", "bind", "tcp://127.0.0.1:5555");
|
||||
controlChannel.UpdateRateLogging(0);
|
||||
testPub.fChannels["control"].push_back(controlChannel);
|
||||
|
||||
FairMQChannel pubChannel("pub", "bind", "tcp://127.0.0.1:5556");
|
||||
pubChannel.UpdateRateLogging(0);
|
||||
testPub.fChannels["data"].push_back(pubChannel);
|
||||
|
||||
testPub.ChangeState("INIT_DEVICE");
|
||||
testPub.WaitForEndOfState("INIT_DEVICE");
|
||||
|
||||
testPub.ChangeState("INIT_TASK");
|
||||
testPub.WaitForEndOfState("INIT_TASK");
|
||||
|
||||
testPub.ChangeState("RUN");
|
||||
testPub.WaitForEndOfState("RUN");
|
||||
|
||||
testPub.ChangeState("RESET_TASK");
|
||||
testPub.WaitForEndOfState("RESET_TASK");
|
||||
|
||||
testPub.ChangeState("RESET_DEVICE");
|
||||
testPub.WaitForEndOfState("RESET_DEVICE");
|
||||
|
||||
testPub.ChangeState("END");
|
||||
|
||||
return 0;
|
||||
}
|
Reference in New Issue
Block a user