Back to index

rabbitmq-server  2.8.4
Public Member Functions | Public Attributes | Private Member Functions
destinations.TestExchange Class Reference
Inheritance diagram for destinations.TestExchange:
Inheritance graph
[legend]
Collaboration diagram for destinations.TestExchange:
Collaboration graph
[legend]

List of all members.

Public Member Functions

def test_amq_direct
def test_amq_topic
def test_amq_fanout
def test_amq_fanout_no_route
def test_invalid_exchange
def create_connection
def create_subscriber_connection
def setUp
def tearDown
def simple_test_send_rec
def assertListener
def assertListenerAfter

Public Attributes

 conn
 listener

Private Member Functions

def __test_exchange_send_rec

Detailed Description

Definition at line 6 of file destinations.py.


Member Function Documentation

def destinations.TestExchange.__test_exchange_send_rec (   self,
  exchange,
  route = None 
) [private]

Definition at line 39 of file destinations.py.

00039 
00040     def __test_exchange_send_rec(self, exchange, route = None):
00041         if exchange != "amq.topic":
00042             dest = "/exchange/" + exchange
00043         else:
00044             dest = "/topic"
00045         if route != None:
00046             dest += "/" + route
00047 
00048         self.simple_test_send_rec(dest)

Here is the call graph for this function:

Here is the caller graph for this function:

def base.BaseTest.assertListener (   self,
  errMsg,
  numMsgs = 0,
  numErrs = 0,
  numRcts = 0,
  timeout = 1 
) [inherited]

Definition at line 52 of file base.py.

00052 
00053    def assertListener(self, errMsg, numMsgs=0, numErrs=0, numRcts=0, timeout=1):
00054         if numMsgs + numErrs + numRcts > 0:
00055             self.assertTrue(self.listener.await(timeout), errMsg + " (#awaiting)")
00056         else:
00057             self.assertFalse(self.listener.await(timeout), errMsg + " (#awaiting)")
00058         self.assertEquals(numMsgs, len(self.listener.messages), errMsg + " (#messages)")
00059         self.assertEquals(numErrs, len(self.listener.errors), errMsg + " (#errors)")
00060         self.assertEquals(numRcts, len(self.listener.receipts), errMsg + " (#receipts)")

Here is the caller graph for this function:

def base.BaseTest.assertListenerAfter (   self,
  verb,
  errMsg = "",
  numMsgs = 0,
  numErrs = 0,
  numRcts = 0,
  timeout = 1 
) [inherited]

Definition at line 61 of file base.py.

00061 
00062    def assertListenerAfter(self, verb, errMsg="", numMsgs=0, numErrs=0, numRcts=0, timeout=1):
00063         num = numMsgs + numErrs + numRcts
00064         self.listener.reset(num if num>0 else 1)
00065         verb()
00066         self.assertListener(errMsg=errMsg, numMsgs=numMsgs, numErrs=numErrs, numRcts=numRcts, timeout=timeout)

Here is the call graph for this function:

Here is the caller graph for this function:

def base.BaseTest.create_connection (   self,
  version = None,
  heartbeat = None 
) [inherited]

Definition at line 9 of file base.py.

00009 
00010    def create_connection(self, version=None, heartbeat=None):
00011        conn = stomp.Connection(user="guest", passcode="guest",
00012                                version=version, heartbeat=heartbeat)
00013        conn.start()
00014        conn.connect()
00015        return conn

Here is the caller graph for this function:

def base.BaseTest.create_subscriber_connection (   self,
  dest 
) [inherited]

Definition at line 16 of file base.py.

00016 
00017    def create_subscriber_connection(self, dest):
00018        conn = self.create_connection()
00019        listener = WaitableListener()
00020        conn.set_listener('', listener)
00021        conn.subscribe(destination=dest, receipt="sub.receipt")
00022        listener.await()
00023        self.assertEquals(1, len(listener.receipts))
00024        listener.reset()
00025        return conn, listener

Here is the call graph for this function:

Here is the caller graph for this function:

def base.BaseTest.setUp (   self) [inherited]

Definition at line 26 of file base.py.

00026 
00027    def setUp(self):
00028         self.conn = self.create_connection()
00029         self.listener = WaitableListener()
00030         self.conn.set_listener('', self.listener)

def base.BaseTest.simple_test_send_rec (   self,
  dest,
  route = None 
) [inherited]

Definition at line 35 of file base.py.

00035 
00036    def simple_test_send_rec(self, dest, route = None):
00037         self.listener.reset()
00038 
00039         self.conn.subscribe(destination=dest)
00040         self.conn.send("foo", destination=dest)
00041 
00042         self.assertTrue(self.listener.await(), "Timeout, no message received")
00043 
00044         # assert no errors
00045         if len(self.listener.errors) > 0:
00046             self.fail(self.listener.errors[0]['message'])
00047 
00048         # check header content
00049         msg = self.listener.messages[0]
00050         self.assertEquals("foo", msg['message'])
00051         self.assertEquals(dest, msg['headers']['destination'])

Here is the caller graph for this function:

def base.BaseTest.tearDown (   self) [inherited]

Definition at line 31 of file base.py.

00031 
00032    def tearDown(self):
00033         if self.conn.is_connected():
00034             self.conn.stop()

Test basic send/receive for /exchange/amq.direct 

Definition at line 9 of file destinations.py.

00009 
00010     def test_amq_direct(self):
00011         ''' Test basic send/receive for /exchange/amq.direct '''
00012         self.__test_exchange_send_rec("amq.direct", "route")

Here is the call graph for this function:

Test basic send/receive for /exchange/amq.fanout 

Definition at line 17 of file destinations.py.

00017 
00018     def test_amq_fanout(self):
00019         ''' Test basic send/receive for /exchange/amq.fanout '''
00020         self.__test_exchange_send_rec("amq.fanout", "route")

Here is the call graph for this function:

Test basic send/receive, /exchange/amq.direct, no routing key

Definition at line 21 of file destinations.py.

00021 
00022     def test_amq_fanout_no_route(self):
00023         ''' Test basic send/receive, /exchange/amq.direct, no routing key'''
00024         self.__test_exchange_send_rec("amq.fanout")

Here is the call graph for this function:

Test basic send/receive for /exchange/amq.topic 

Definition at line 13 of file destinations.py.

00013 
00014     def test_amq_topic(self):
00015         ''' Test basic send/receive for /exchange/amq.topic '''
00016         self.__test_exchange_send_rec("amq.topic", "route")

Here is the call graph for this function:

Test invalid exchange error 

Definition at line 25 of file destinations.py.

00025 
00026     def test_invalid_exchange(self):
00027         ''' Test invalid exchange error '''
00028         self.listener.reset()
00029         self.conn.subscribe(destination="/exchange/does.not.exist")
00030         self.listener.await()
00031         self.assertEquals(1, len(self.listener.errors))
00032         err = self.listener.errors[0]
00033         self.assertEquals("not_found", err['headers']['message'])
00034         self.assertEquals(
00035             "NOT_FOUND - no exchange 'does.not.exist' in vhost '/'\n",
00036             err['message'])
00037         time.sleep(1)
00038         self.assertFalse(self.conn.is_connected())


Member Data Documentation

base.BaseTest.conn [inherited]

Definition at line 27 of file base.py.

Definition at line 28 of file base.py.


The documentation for this class was generated from the following file: