~landscape/landscape-client/trunk

Viewing all changes in revision 670.

  • Committer: Tarmac
  • Author(s): Free Ekanayaka
  • Date: 2013-05-06 18:21:09 UTC
  • mfrom: (660.8.6 amp-cleanup-8)
  • Revision ID: tarmac-20130506182109-yp73e7lo1vri0oan
Merge amp-cleanup-8 [f=1170669] [r=tealeg,ack] [a=Free Ekanayaka]
Some more cleanup around the AMP-based machinery:

- landscape.amp.ComponentConnector: the disconnect method now uses Twisted's IConnector.disconnect(), without messing with the lower-level ITransport.loseConnection(). The objects implementing IConnector are the ones returned by reactor.connectUNIX/connectTCP/connectSSH and afaiu they're what is supposed to be used for terminating a connection.

- rename RemoteComponentRegistry to ComponentRegistry, to match ComponentPublisher and ComponentConnector

- landscape.configuration: the changes here are due because we know use IConnector.disconnect() vs ITransport.loseConnection(). Unfortunately the code in this module is factored and tested in a far less than ideal way, eventually we should take time to clean it up.

- landscape.lib.amp.RemoteObject: update the constructor docstring and reduce a bit of logic duplication by adding a new _send_method_call helper method, which is now used by __getattr__ and _retry (this makes _retry flush the fake asynchronous connection used in tests, in the same way __getattr__ does).

- landscape.lib.amp.MethodCallServerFactory: rename the "reactor" init parameter to "clock", since only the IReactorTime interface is needed (in this case instances are normally called "clock" and can be mocked with a twisted.internet.task.Clock instance in tests)

- landscape.lib.tests.test_amp: Add a FakeConnector class implementing IConnector, so we can use it unit-tests. Also, I've converted a few deferred-returning (asynchronous) tests to synchronous equivalent.

- landscape.tests.test_amp: Concerted asynchronous tests to synchronous equivalent.

expand all expand all

Show diffs side-by-side

added added

removed removed

Lines of Context: