Back to index

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

List of all members.

Public Member Functions

def test_implicit_connect
def test_default_user
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 6 of file connect_options.py.


Member Function Documentation

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()

Default user connection 

Definition at line 28 of file connect_options.py.

00028 
00029     def test_default_user(self):
00030         ''' Default user connection '''
00031         self.conn.disconnect()
00032         test_util.enable_default_user()
00033         listener = base.WaitableListener()
00034         new_conn = stomp.Connection()
00035         new_conn.set_listener('', listener)
00036         new_conn.start()
00037         new_conn.connect()
00038         try:
00039             self.assertFalse(listener.await(3)) # no error back
00040             self.assertTrue(new_conn.is_connected())
00041         finally:
00042             new_conn.disconnect()
00043             test_util.disable_default_user()

Here is the call graph for this function:

Implicit connect with receipt on first command 

Definition at line 8 of file connect_options.py.

00008 
00009     def test_implicit_connect(self):
00010         ''' Implicit connect with receipt on first command '''
00011         self.conn.disconnect()
00012         test_util.enable_implicit_connect()
00013         listener = base.WaitableListener()
00014         new_conn = stomp.Connection()
00015         new_conn.set_listener('', listener)
00016 
00017         new_conn.start() # not going to issue connect
00018         new_conn.subscribe(destination="/topic/implicit", id='sub_implicit', receipt='implicit')
00019 
00020         try:
00021             self.assertTrue(listener.await(5))
00022             self.assertEquals(1, len(listener.receipts),
00023                               'Missing receipt. Likely not connected')
00024             self.assertEquals('implicit', listener.receipts[0]['headers']['receipt-id'])
00025         finally:
00026             new_conn.disconnect()
00027             test_util.disable_implicit_connect()

Here is the call graph for this function:


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: