separate ChannelProviderRegistry for client/server

This commit is contained in:
Michael Davidsaver
2017-06-21 14:41:24 +02:00
parent 2e7d28b87d
commit 35d2c610bf
14 changed files with 161 additions and 112 deletions

View File

@@ -50,17 +50,6 @@ std::string ChannelAccessIFTest::TEST_ARRAY_CHANNEL_NAME = "testArray1";
#define EXTRA_STRESS_TESTS 0
#endif
namespace {
struct ScopedClientFactory {
ScopedClientFactory() {
ClientFactory::start();
}
~ScopedClientFactory() {
ClientFactory::stop();
}
};
}
int ChannelAccessIFTest::runAllTest() {
testPlan(152+EXTRA_STRESS_TESTS);
@@ -87,7 +76,9 @@ int ChannelAccessIFTest::runAllTest() {
.add("EPICS_PVA_BROADCAST_PORT", tstserv->getBroadcastPort())
.push_map()
.build());
ScopedClientFactory SCF;
epics::pvAccess::ClientFactory::start();
m_provider = ChannelProviderRegistry::clients()->getProvider("pva");
test_implementation();
test_providerName();
@@ -2403,31 +2394,15 @@ PVStructure::shared_pointer ChannelAccessIFTest::createArrayPvRequest() {
return pvRequest;
}
class ChannelAccessIFRemoteTest: public ChannelAccessIFTest {
public:
virtual ChannelProvider::shared_pointer getChannelProvider() {
return getChannelProviderRegistry()->getProvider(
"pva");
}
virtual long getTimeoutSec() {
return 3;
}
virtual bool isLocal() {
return false;
}
};
MAIN(testChannelAccess)
{
SET_LOG_LEVEL(logLevelError);
ChannelAccessIFRemoteTest caRemoteTest;
return caRemoteTest.runAllTest();
try{
SET_LOG_LEVEL(logLevelError);
ChannelAccessIFTest caRemoteTest;
return caRemoteTest.runAllTest();
}catch(std::exception& e){
PRINT_EXCEPTION(e);
std::cerr<<"Unhandled exception: "<<e.what()<<"\n";
return 1;
}
}

View File

@@ -7,6 +7,7 @@
class ChannelAccessIFTest {
ChannelProvider::shared_pointer m_provider;
public:
int runAllTest();
@@ -23,9 +24,9 @@ protected:
static std::string TEST_ARRAY_CHANNEL_NAME;
virtual ChannelProvider::shared_pointer getChannelProvider() = 0;
virtual long getTimeoutSec() = 0;
virtual bool isLocal() = 0;
ChannelProvider::shared_pointer getChannelProvider() { return m_provider; }
long getTimeoutSec() {return 3;}
bool isLocal() {return false;}
Channel::shared_pointer createChannel(std::string channelName, bool debug = false );