Use mock's call assert methods over call_args_list

The way we're checking the value of call_args_list on a mock method is
essentially what assert_called_once_with() since we also know the
method is only called once. In other cases, we can use
assert_has_calls().

I'm slightly nervous of using call_args_list because it's the kind of
thing you could imagine changing in future, even though it's not
marked private.

Change-Id: I7eb3d095f7a1ff9a4abc9e027193d4918d0cda6c
Fixed the issue for pop exception

Fixed the issue so that two
threads do not pop the list at the same time
Closes-Bug: #1283926
Change-Id: I693407495c18c3e4a0ca2d8d94c4f4ed179371bf
Ensure routing key is specified in the address for a direct producer

This then matches the address used a direct consumer.

Change-Id: If71f78e50f8a9b3acfd1e9d02c8271f17c4ebee7
Closes-Bug: #1300318
Oslo-messaging-zmq-receiver cannot recive any messages

In Icehouse b3 and rc1, when we use impl_zmq as
rpc_backend in nova, nova cannot send any messages
throught impl_zmq to oslo-messaging-zmq-receiver.
The reason is we send two params to serialize_msg
method but it only can recive one.To fix this
problem, I removed the second param which not
used when we call the method serialize_msg.

Change-Id: I2e7546147affd9493f425fd879169932ef206d48
Closes-bug: #1301132
Trival:Fix assertEqual arguments order

assertEqual method's arguments should be in ('expected', 'actual')
order.

Change-Id: I35f045a9d3a6e7f083fb137c751eeab52c77000b
Closes-bug: 1277104
zmq: switch back to not using message envelopes

In oslo-incubator, we default to not serializing messages using a
message envelope:

  def _cast(.., envelope=False, ...)

except using the v2 notifyer which explicitly passes envelope=True.

However, in oslo.messaging, we accidentally switched to using a
message envelope:

     def _send(self, ..., envelope=True):

This was not intentional and may be disruptive to users.

This issue was identified because the envelope=True path just doesn't
work! We don't have any zmq tests in oslo.messaging, but even in
oslo-incubator the code path isn't tested and has been broken since
I73aad7697cf83ad4aabb3c2058b7cc4f53f783c2

Partial-Bug: #1301132
Change-Id: I6aa2e2ac3cebf443719d64ebcd9eaadc0a9328b8
Remove rendundant parentheses of cfg help strings

There is a hacking review https://review.openstack.org/#/c/74493/.
That makes me be aware we maybe have rendunant parentheses.
We'd better clean the parentheses, Python will handle that well.

Change-Id: Ib29f995feed45d71000f333a2cc7d14b0efcb0d5
Import run_cross_tests.sh from oslo-incubator

Change-Id: I7d96e52ced336379117591d032ba9886900ccd2a
Remove old drivers dead code

This patch removes some common helper method/class.
Because they are not used anymore by current amqpdriver.

Change-Id: I183750e158e05cf1d0b5e37725676d4882e0c043
Merge "Fixed the issue for pop exception"
Merge "Oslo-messaging-zmq-receiver cannot recive any messages"
Merge "Trival:Fix assertEqual arguments order"
Merge "Remove old drivers dead code"
Update ensure()/reconnect() to catch MessagingError

The error handling code that gets connections reset if necessary
caught ConnectionError.  It really needs to catch MessagingError,
which ConnectionError inherits from.  There are other types of
MessagingErrors that may occur, such as InternalError, and they need
to cause the connection to reset, as well.

Closes-bug: #1303890
Change-Id: Ic5082b74a362ded8b35cbc75cf178fe6e0db62d0
Merge "Update ensure()/reconnect() to catch MessagingError"
Use a for loop to set the defaults for __call__ params

Instead of setting the default kwargs based on a repeated
setdefault() call, just use a for loop to set the defaults.

Change-Id: I5c7fd22856912545bf5f95fd07568375dbecbe5b
Select AMQP message broker at random

The rule of choosing AMQP message broker is that chose first
available one in order now. The order depends on what we set in
configuration file. That means all the connections will flock
to same message broker and that may lead out performance issue.
This patch randomizes the order of choosing message broker for
each connection to leverage broker cluster.

Change-Id: Ib5098e574d4ef81428065885e2295d0f87aba715
Partial-Bug: #1261631
Logical error in blockless fanout of zmq

The blockless fanout doesn't take effect and it
only processes the FIRST one by returning after the first loop.

Change-Id: Iad071ab455e36be7b26637b286ca9f83fea4a019
Closes-Bug: #1300539
Merge "Remove rendundant parentheses of cfg help strings"
Merge "Ensure routing key is specified in the address for a direct producer"