Commits

Jean-François Roche  committed dbbbeee

fix command line test if present argv & more doc

  • Participants
  • Parent commits 037d84b

Comments (0)

Files changed (5)

-Introduction
-============
+This package defines basic components of a Messaging Gateway integrated inside Zope using AMQP.
 
-
+  * Documentation: http://docs.affinitic.be/affinitic.zamqp
+  * Code Repository: http://bitbucket.org/jfroche/affinitic.zamqp
+  * Buildbot: http://buildbot.affinitic.be/builders/affinitic.zamqp%20linux_debian/
+  * Test Coverage: http://coverage.affinitic.be/affinitic.zamqp

File src/affinitic/zamqp/interfaces.py

     A Publisher send message to a queue via an exchange
     """
 
-    connectionId = Attribute('')
+    connection_id = Attribute('The BrokerConnection id where the queue is/will be registered')

File src/affinitic/zamqp/publisher.py

 
 
 class Publisher(grok.GlobalUtility, CarrotPublisher, VTM):
+    __doc__ = CarrotPublisher.__doc__
     grok.baseclass()
     grok.implements(IPublisher)
+    connection_id = None
 
-    def __init__(self):
-        self._connection = None
+    def __init__(self, connection=None, exchange=None, routing_key=None, **kwargs):
+        self._connection = connection
+        self.exchange = exchange or self.exchange
+        self.routing_key = routing_key or self.routing_key
+        self.delivery_mode = kwargs.get("delivery_mode", self.delivery_mode)
+        self.delivery_mode = self.DELIVERY_MODES.get(self.delivery_mode,
+                                                     self.delivery_mode)
+        self.exchange_type = kwargs.get("exchange_type", self.exchange_type)
+        self.durable = kwargs.get("durable", self.durable)
+        self.auto_delete = kwargs.get("auto_delete", self.auto_delete)
+        self.serializer = kwargs.get("serializer", self.serializer)
+        self.auto_declare = kwargs.get("auto_declare", self.auto_declare)
+        self._closed = False
         self._backend = None
         self._closed = False
         self._queueOfPendingMessage = None

File src/affinitic/zamqp/tests/interfaces.txt

-Interface conformance
----------------------
-
-Using ``zope.interface`` to check wheter our implementation does what it promise to implement.
-
-    >>> from zope.interface.verify import verifyObject
-
-For BrokerConnection::
-
-    >>> from affinitic.zamqp.interfaces import IBrokerConnection
-    >>> from affinitic.zamqp.connection import BrokerConnection
-    >>> verifyObject(IBrokerConnection, BrokerConnection())
-    True
-
-For BrokerConnectionFactory::
-
-    >>> from affinitic.zamqp.interfaces import IBrokerConnectionFactory
-    >>> from affinitic.zamqp.connection import BrokerConnectionFactory
-    >>> verifyObject(IBrokerConnectionFactory, BrokerConnectionFactory())
-    True

File src/affinitic/zamqp/tests/publisher.txt

     >>> def exit(level=0):
     ...     print '--Exit with level %s--' % level
     >>> sys.exit = exit
+    >>> argvOriginal = sys.argv
+    >>> sys.argv = []
 
 If you don't provide enough argument, it will print you the usage and exit::
 
     ...                    '--message', 'Superb Message']
     >>> getCommandLineConfig()
     ('localhost', '20', 'john', 'secret', 'virtual1', 'exchange1', 'routing1', 'Superb Message')
+    >>> sys.argv = argvOriginal
+
+Interface conformance
+=====================
+
+Using ``zope.interface`` to check wheter our implementation does what it promise to implement.
+
+    >>> from zope.interface.verify import verifyObject
+
+Check the Consumer::
+
+    >>> from affinitic.zamqp.interfaces import IPublisher
+    >>> from affinitic.zamqp.publisher import Publisher
+    >>> verifyObject(IPublisher, Publisher())
+    True