Esempio n. 1
0
 def testPutTimesout(self, eData="hello world!", noCheck=False, block=True):
     namespace = self._createInterface()
     try:
         iface = PyRQIface(namespace=namespace, ref="testPutTimesout-put", quiet=self.quiet, loggingModule=testLoggingModule)
         iface.put(eData, block=block, timeout=0.1)
     except Full, _e:
         assert True
Esempio n. 2
0
 def testPostCloseDifferentIface(self, eData="hello.world!", block=True, timeout=None):
     self.testCreate()
     self.iface.close(timeout=100000)
     #    Now attempt a PUT:
     iface = PyRQIface(ref="testPostCloseDifferentIface.0", namespace=self.namespace, quiet=self.quiet, loggingModule=testLoggingModule)
     try:
         iface.put(eData, block=block, timeout=timeout)
     except ClosedError, _e:
         assert True
Esempio n. 3
0
 def testPutOnFullQueueWithTimeout(self, maxsize=1):
     #    Put 2 items, second one should block forever, then we close the q.
     iface = PyRQIface(quiet=self.quiet, ref="creator-testDelayedWithTimeoutPutThenClosed")
     namespace = iface.create(maxsize=maxsize)
     iface = PyRQIface(namespace=namespace, quiet=self.quiet, ref="testDelayedWithTimeoutPutThenClosed")
     iface.put("hello.world.1", block=True, timeout=None)
     #    Queue should now be full.
     try:
         iface.put("hello.world.2", block=True, timeout=2)
     except Full, _e:
         assert True
Esempio n. 4
0
 def doPut(initialDelay, ref, putTimeout, data):
     time.sleep(initialDelay)
     iface = PyRQIface(ref="put.%(R)s"%{"R":ref}, namespace=namespace, quiet=self.quiet, loggingModule=testLoggingModule)
     while self.timerTerminate==0 and len(data)>0:
         (delay, eData) = data.pop(0)
         time.sleep(delay)
         try:
             iface.put(data=eData, timeout=putTimeout)
         except Full, eData:
             pass
         with l:
             ePuts.append(eData)
Esempio n. 5
0
 def testDelayedWithTimeoutPutThenClosed(self, maxsize=1):
     #    Put 2 items, second one should block forever, then we close the q.
     iface = PyRQIface(quiet=self.quiet, ref="creator-testDelayedWithTimeoutPutThenClosed")
     namespace = iface.create(maxsize=maxsize)
     iface = PyRQIface(namespace=namespace, quiet=self.quiet, ref="testDelayedWithTimeoutPutThenClosed")
     iface.put("hello.world.1", block=True, timeout=None)
     #    Queue should now be full.
     self._closeQueue(namespace, delay=2, name="closer-testDelayedWithTimeoutPutThenClosed")
     try:
         iface.put("hello.world.2", block=True, timeout=5)
     except (ClosedError, Full):
         assert True
     else:
         assert False