コード例 #1
0
void ConfigTest::testAdapter()
{
  istringstream str("Devices = ../samples/test_config.xml\n"
                    "Adapters { LinuxCNC { \n"
                    "Port = 23\n"
                    "Host = 10.211.55.1\n"
                    "FilterDuplicates = true\n"
                    "AutoAvailable = true\n"
                    "IgnoreTimestamps = true\n"
                    "PreserveUUID = true\n"
                    "LegacyTimeout = 2000\n"
                    "} }\n");
  mConfig->loadConfig(str);
  
  Agent *agent = mConfig->getAgent();
  CPPUNIT_ASSERT(agent);
  Device *device = agent->getDevices()[0];
  Adapter *adapter = device->mAdapters[0];

  CPPUNIT_ASSERT_EQUAL(23, (int) adapter->getPort());
  CPPUNIT_ASSERT_EQUAL((string) "10.211.55.1", adapter->getServer());
  CPPUNIT_ASSERT(adapter->isDupChecking());
  CPPUNIT_ASSERT(adapter->isAutoAvailable());
  CPPUNIT_ASSERT(adapter->isIgnoringTimestamps());
  CPPUNIT_ASSERT_EQUAL(2000, adapter->getLegacyTimeout());
  CPPUNIT_ASSERT(device->mPreserveUuid);
}
コード例 #2
0
/* ComponentTest protected methods */
void ConfigTest::testBlankConfig()
{
  istringstream str("");
  mConfig->loadConfig(str);
  
  Agent *agent = mConfig->getAgent();
  CPPUNIT_ASSERT(agent);
  CPPUNIT_ASSERT_EQUAL(1, (int) agent->getDevices().size());
}
コード例 #3
0
void ConfigTest::testDefaultPreserveUUID()
{
  istringstream str("Devices = ../samples/test_config.xml\n"
                    "PreserveUUID = true\n");
  mConfig->loadConfig(str);
  
  Agent *agent = mConfig->getAgent();
  CPPUNIT_ASSERT(agent);
  Device *device = agent->getDevices()[0];

  CPPUNIT_ASSERT(device->mPreserveUuid);
}
コード例 #4
0
void ConfigTest::testLegacyTimeout()
{
  istringstream str("Devices = ../samples/test_config.xml\n"
                    "LegacyTimeout = 2000\n");
  mConfig->loadConfig(str);
  
  Agent *agent = mConfig->getAgent();
  CPPUNIT_ASSERT(agent);
  Device *device = agent->getDevices()[0];
  Adapter *adapter = device->mAdapters[0];
  
  CPPUNIT_ASSERT_EQUAL(2000, adapter->getLegacyTimeout());
}
コード例 #5
0
void ConfigTest::testIgnoreTimestamps()
{
  istringstream str("Devices = ../samples/test_config.xml\n"
                    "IgnoreTimestamps = true\n");
  mConfig->loadConfig(str);
  
  Agent *agent = mConfig->getAgent();
  CPPUNIT_ASSERT(agent);
  Device *device = agent->getDevices()[0];
  Adapter *adapter = device->mAdapters[0];
  
  CPPUNIT_ASSERT(adapter->isIgnoringTimestamps());

}
コード例 #6
0
void ConfigTest::testDefaultPreserveOverride()
{
  istringstream str("Devices = ../samples/test_config.xml\n"
                    "PreserveUUID = true\n"
                    "Adapters { LinuxCNC { \n"
                    "PreserveUUID = false\n"
                    "} }\n");
  mConfig->loadConfig(str);
  
  Agent *agent = mConfig->getAgent();
  CPPUNIT_ASSERT(agent);
  Device *device = agent->getDevices()[0];

  CPPUNIT_ASSERT(!device->mPreserveUuid);
}
コード例 #7
0
void ConfigTest::testDevice()
{
  istringstream str("Devices = ../samples/test_config.xml\n");
  mConfig->loadConfig(str);
  
  Agent *agent = mConfig->getAgent();
  CPPUNIT_ASSERT(agent);
  Device *device = agent->getDevices()[0];
  Adapter *adapter = device->mAdapters[0];

  CPPUNIT_ASSERT_EQUAL((string) "LinuxCNC", device->getName());
  CPPUNIT_ASSERT(!adapter->isDupChecking());
  CPPUNIT_ASSERT(!adapter->isAutoAvailable());
  CPPUNIT_ASSERT(!adapter->isIgnoringTimestamps());
  CPPUNIT_ASSERT(device->mPreserveUuid);
}