class TestDataInPort(unittest.TestCase):
	def setUp(self):
		self._orb = CORBA.ORB_init()
		self._poa = self._orb.resolve_initial_references("RootPOA")
		inport = OpenRTM_aist.InPort("in", RTC.TimedLong(RTC.Time(0,0),0),
								OpenRTM_aist.RingBuffer(8))
		self._dip = DataInPort("in", inport, None)
		
	def test_case(self):
		nvlist = [OpenRTM_aist.NVUtil.newNV("dataport.interface_type","CORBA_Any"),
				  OpenRTM_aist.NVUtil.newNV("dataport.dataflow_type","Push"),
				  OpenRTM_aist.NVUtil.newNV("dataport.subscription_type","Flush")]

		prof = RTC.ConnectorProfile("connector0","",[TestObj(),TestObj()],nvlist)

		self.assertEqual(self._dip.publishInterfaces(prof), RTC.RTC_OK)
		self.assertEqual(self._dip.subscribeInterfaces(prof), RTC.RTC_OK)	
		self._dip.unsubscribeInterfaces(prof)
class TestDataInPort(unittest.TestCase):
    def setUp(self):
        self._orb = CORBA.ORB_init()
        self._poa = self._orb.resolve_initial_references("RootPOA")
        inport = OpenRTM_aist.InPort("in", RTC.TimedLong(RTC.Time(0, 0), 0),
                                     OpenRTM_aist.RingBuffer(8))
        self._dip = DataInPort("in", inport, None)

    def test_case(self):
        nvlist = [
            OpenRTM_aist.NVUtil.newNV("dataport.interface_type", "CORBA_Any"),
            OpenRTM_aist.NVUtil.newNV("dataport.dataflow_type", "Push"),
            OpenRTM_aist.NVUtil.newNV("dataport.subscription_type", "Flush")
        ]

        prof = RTC.ConnectorProfile("connector0", "",
                                    [TestObj(), TestObj()], nvlist)

        self.assertEqual(self._dip.publishInterfaces(prof), RTC.RTC_OK)
        self.assertEqual(self._dip.subscribeInterfaces(prof), RTC.RTC_OK)
        self._dip.unsubscribeInterfaces(prof)