Пример #1
0
  def test_pushNew(self):
    _pn = PublisherNew()
    prop = OpenRTM_aist.Properties()
    cinfo = OpenRTM_aist.ConnectorInfo("",
                                       "",
                                       [],
                                       prop)
    self.assertEqual(_pn.setListener(cinfo,OpenRTM_aist.ConnectorListeners()),
                     OpenRTM_aist.DataPortStatus.PORT_OK)
    prop = OpenRTM_aist.Properties()
    prop.setProperty("publisher.push_policy","new")
    prop.setProperty("publisher.skip_count","0")
    prop.setProperty("thread_type","default")
    prop.setProperty("measurement.exec_time","enable")
    prop.setProperty("measurement.exec_count","0")
    prop.setProperty("measurement.period_time","enable")
    prop.setProperty("measurement.period_count","0")
    retcode = _pn.init(prop)
    cons = ConsumerMock()
    self.assertEqual(_pn.setConsumer(cons),OpenRTM_aist.DataPortStatus.PORT_OK)
    _pn.setBuffer(OpenRTM_aist.CdrRingBuffer())
    _pn.activate()

    self.assertEqual(_pn.write(123,0,0),OpenRTM_aist.DataPortStatus.PORT_OK)
    self.assertEqual(_pn.write(123,0,0),OpenRTM_aist.DataPortStatus.PORT_OK)
    self.assertEqual(_pn.write(123,0,0),OpenRTM_aist.DataPortStatus.PORT_OK)
    self.assertEqual(_pn.write(123,0,0),OpenRTM_aist.DataPortStatus.PORT_OK)
    self.assertEqual(_pn.write(123,0,0),OpenRTM_aist.DataPortStatus.PORT_OK)
    self.assertEqual(_pn.write(123,0,0),OpenRTM_aist.DataPortStatus.PORT_OK)
    self.assertEqual(_pn.write(123,0,0),OpenRTM_aist.DataPortStatus.PORT_OK)
    self.assertEqual(_pn.write(123,0,0),OpenRTM_aist.DataPortStatus.PORT_OK)
    _pn.deactivate()
    _pn.__del__()
    return
 def test_activate_deactivate_isActive(self):
   _pn = PublisherNew()
   self.assertEqual(_pn.isActive(),False)
   self.assertEqual(_pn.activate(),OpenRTM_aist.DataPortStatus.PORT_OK)
   self.assertEqual(_pn.isActive(),True)
   self.assertEqual(_pn.deactivate(),OpenRTM_aist.DataPortStatus.PORT_OK)
   self.assertEqual(_pn.isActive(),False)
   return
Пример #3
0
 def test_activate_deactivate_isActive(self):
   _pn = PublisherNew()
   self.assertEqual(_pn.isActive(),False)
   self.assertEqual(_pn.activate(),OpenRTM_aist.DataPortStatus.PORT_OK)
   self.assertEqual(_pn.isActive(),True)
   self.assertEqual(_pn.deactivate(),OpenRTM_aist.DataPortStatus.PORT_OK)
   self.assertEqual(_pn.isActive(),False)
   _pn.__del__()
   return