akka.remote.transport
Class TestTransport.AssociationRegistry

java.lang.Object
  extended by akka.remote.transport.TestTransport.AssociationRegistry
Enclosing class:
TestTransport

public static class TestTransport.AssociationRegistry
extends java.lang.Object

Shared state among TestTransport instances. Coordinates the transports and the means of communication between them.


Constructor Summary
TestTransport.AssociationRegistry()
           
 
Method Summary
 void clearLog()
          Clears the activity log.
 scala.Option<scala.Tuple2<AssociationHandle.HandleEventListener,AssociationHandle.HandleEventListener>> deregisterAssociation(scala.Tuple2<Address,Address> key)
          Removes an association.
 boolean existsAssociation(Address initiatorAddress, Address remoteAddress)
          Tests if an association was registered.
 scala.Option<AssociationHandle.HandleEventListener> getRemoteReadHandlerFor(TestAssociationHandle localHandle)
          Returns the event handler corresponding to the remote endpoint of the given local handle.
 void logActivity(TestTransport.Activity activity)
          Logs a transport activity.
 scala.collection.Seq<TestTransport.Activity> logSnapshot()
          Takes a thread-safe snapshot of the current state of the activity log.
 void registerListenerPair(scala.Tuple2<Address,Address> key, scala.Tuple2<AssociationHandle.HandleEventListener,AssociationHandle.HandleEventListener> listeners)
          Registers a Future of two handle event listeners corresponding to the two endpoints of an association.
 void registerTransport(TestTransport transport, scala.concurrent.Future<Transport.AssociationEventListener> associationEventListenerFuture)
          Records a mapping between an address and the corresponding (transport, associationEventListener) pair.
 AssociationHandle.HandleEventListener remoteListenerRelativeTo(TestAssociationHandle handle, scala.Tuple2<AssociationHandle.HandleEventListener,AssociationHandle.HandleEventListener> listenerPair)
          Returns the remote endpoint for a pair of endpoints relative to the owner of the supplied handle.
 void reset()
          Resets the state of the registry.
 scala.Option<scala.Tuple2<TestTransport,scala.concurrent.Future<Transport.AssociationEventListener>>> transportFor(Address address)
          Returns the Transport bound to the given address.
 boolean transportsReady(scala.collection.Seq<Address> addresses)
          Indicates if all given transports were successfully registered.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

TestTransport.AssociationRegistry

public TestTransport.AssociationRegistry()
Method Detail

remoteListenerRelativeTo

public AssociationHandle.HandleEventListener remoteListenerRelativeTo(TestAssociationHandle handle,
                                                                      scala.Tuple2<AssociationHandle.HandleEventListener,AssociationHandle.HandleEventListener> listenerPair)
Returns the remote endpoint for a pair of endpoints relative to the owner of the supplied handle.

Parameters:
handle - the reference handle to determine the remote endpoint relative to
listenerPair - pair of listeners in initiator, receiver order.
Returns:

logActivity

public void logActivity(TestTransport.Activity activity)
Logs a transport activity.

Parameters:
activity - Activity to be logged.

logSnapshot

public scala.collection.Seq<TestTransport.Activity> logSnapshot()
Takes a thread-safe snapshot of the current state of the activity log.

Returns:
Collection containing activities ordered left-to-right according to time (first element is earliest).

clearLog

public void clearLog()
Clears the activity log.


registerTransport

public void registerTransport(TestTransport transport,
                              scala.concurrent.Future<Transport.AssociationEventListener> associationEventListenerFuture)
Records a mapping between an address and the corresponding (transport, associationEventListener) pair.

Parameters:
transport - The transport that is to be registered. The address of this transport will be used as key.
associationEventListenerFuture - The future that will be completed with the listener that will handle the events for the given transport.

transportsReady

public boolean transportsReady(scala.collection.Seq<Address> addresses)
Indicates if all given transports were successfully registered. No associations can be established between transports that are not yet registered.

Parameters:
addresses - The listen addresses of transports that participate in the test case.
Returns:
True if all transports are successfully registered.

registerListenerPair

public void registerListenerPair(scala.Tuple2<Address,Address> key,
                                 scala.Tuple2<AssociationHandle.HandleEventListener,AssociationHandle.HandleEventListener> listeners)
Registers a Future of two handle event listeners corresponding to the two endpoints of an association.

Parameters:
key - Ordered pair of addresses representing an association. First element must be the address of the initiator.
listeners - The future containing the listeners that will be responsible for handling the events of the two endpoints of the association. Elements in the pair must be in the same order as the addresses in the key parameter.

deregisterAssociation

public scala.Option<scala.Tuple2<AssociationHandle.HandleEventListener,AssociationHandle.HandleEventListener>> deregisterAssociation(scala.Tuple2<Address,Address> key)
Removes an association.

Parameters:
key - Ordered pair of addresses representing an association. First element is the address of the initiator.
Returns:
The original entries.

existsAssociation

public boolean existsAssociation(Address initiatorAddress,
                                 Address remoteAddress)
Tests if an association was registered.

Parameters:
initiatorAddress - The initiator of the association.
remoteAddress - The other address of the association.

Returns:
True if there is an association for the given addresses.

getRemoteReadHandlerFor

public scala.Option<AssociationHandle.HandleEventListener> getRemoteReadHandlerFor(TestAssociationHandle localHandle)
Returns the event handler corresponding to the remote endpoint of the given local handle. In other words it returns the listener that will receive InboundPayload events when
write()
is called on the given handle. @param localHandle The handle @return The option that contains the Future for the listener if exists.

Parameters:
localHandle - (undocumented)
Returns:
(undocumented)

transportFor

public scala.Option<scala.Tuple2<TestTransport,scala.concurrent.Future<Transport.AssociationEventListener>>> transportFor(Address address)
Returns the Transport bound to the given address.

Parameters:
address - The address bound to the transport.
Returns:
The transport if exists.

reset

public void reset()
Resets the state of the registry. ''Warning!'' This method is not atomic.