|
| 1 | +#------------------------------------------------------------------------------ |
| 2 | +# Copyright 2017, Oracle and/or its affiliates. All rights reserved. |
| 3 | +#------------------------------------------------------------------------------ |
| 4 | + |
| 5 | +"""Module for testing AQ objects.""" |
| 6 | + |
| 7 | +import cx_Oracle |
| 8 | + |
| 9 | +class TestAQ(BaseTestCase): |
| 10 | + |
| 11 | + def __verifyAttribute(self, obj, attrName, value): |
| 12 | + setattr(obj, attrName, value) |
| 13 | + self.assertEqual(getattr(obj, attrName), value) |
| 14 | + |
| 15 | + def testDeqOptions(self): |
| 16 | + "test getting/setting dequeue options attributes" |
| 17 | + options = self.connection.deqoptions() |
| 18 | + self.__verifyAttribute(options, "condition", "TEST_CONDITION") |
| 19 | + self.__verifyAttribute(options, "consumername", "TEST_CONSUMERNAME") |
| 20 | + self.__verifyAttribute(options, "correlation", "TEST_CORRELATION") |
| 21 | + self.__verifyAttribute(options, "mode", cx_Oracle.DEQ_LOCKED) |
| 22 | + self.__verifyAttribute(options, "navigation", |
| 23 | + cx_Oracle.DEQ_NEXT_TRANSACTION) |
| 24 | + self.__verifyAttribute(options, "transformation", |
| 25 | + "TEST_TRANSFORMATION") |
| 26 | + self.__verifyAttribute(options, "visibility", cx_Oracle.ENQ_IMMEDIATE) |
| 27 | + self.__verifyAttribute(options, "wait", 1287) |
| 28 | + |
| 29 | + def testEnqOptions(self): |
| 30 | + "test getting/setting enqueue options attributes" |
| 31 | + options = self.connection.enqoptions() |
| 32 | + self.__verifyAttribute(options, "visibility", cx_Oracle.ENQ_IMMEDIATE) |
| 33 | + |
| 34 | + def testMsgProps(self): |
| 35 | + "test getting/setting message properties attributes" |
| 36 | + props = self.connection.msgproperties() |
| 37 | + self.__verifyAttribute(props, "correlation", "TEST_CORRELATION") |
| 38 | + self.__verifyAttribute(props, "delay", 60) |
| 39 | + self.__verifyAttribute(props, "exceptionq", "TEST_EXCEPTIONQ") |
| 40 | + self.__verifyAttribute(props, "expiration", 30) |
| 41 | + self.assertEqual(props.attempts, 0) |
| 42 | + self.__verifyAttribute(props, "priority", 1) |
| 43 | + self.assertEqual(props.state, cx_Oracle.MSG_READY) |
| 44 | + |
0 commit comments