Back to index

rabbitmq-server  2.8.4
Public Member Functions | Public Attributes
base.BaseTest Class Reference
Inheritance diagram for base.BaseTest:
Inheritance graph
[legend]

List of all members.

Public Member Functions

def create_connection
def create_subscriber_connection
def setUp
def tearDown
def simple_test_send_rec
def assertListener
def assertListenerAfter

Public Attributes

 conn
 listener

Detailed Description

Definition at line 7 of file base.py.


Member Function Documentation

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

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 
)

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 
)

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 
)

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)

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 
)

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)

Definition at line 31 of file base.py.

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


Member Data Documentation

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: