public static class TestTransport.AssociationRegistry
extends java.lang.Object
TestTransport
instances. Coordinates the transports and the means
of communication between them.Constructor and Description |
---|
AssociationRegistry() |
Modifier and Type | Method and Description |
---|---|
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.
|
public AssociationHandle.HandleEventListener remoteListenerRelativeTo(TestAssociationHandle handle, scala.Tuple2<AssociationHandle.HandleEventListener,AssociationHandle.HandleEventListener> listenerPair)
handle
- the reference handle to determine the remote endpoint relative tolistenerPair
- pair of listeners in initiator, receiver order.public void logActivity(TestTransport.Activity activity)
activity
- Activity to be logged.public scala.collection.Seq<TestTransport.Activity> logSnapshot()
public void clearLog()
public void registerTransport(TestTransport transport, scala.concurrent.Future<Transport.AssociationEventListener> associationEventListenerFuture)
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.public boolean transportsReady(scala.collection.Seq<Address> addresses)
addresses
- The listen addresses of transports that participate in the test case.public void registerListenerPair(scala.Tuple2<Address,Address> key, scala.Tuple2<AssociationHandle.HandleEventListener,AssociationHandle.HandleEventListener> listeners)
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.public scala.Option<scala.Tuple2<AssociationHandle.HandleEventListener,AssociationHandle.HandleEventListener>> deregisterAssociation(scala.Tuple2<Address,Address> key)
key
- Ordered pair of addresses representing an association. First element is the address of the initiator.public boolean existsAssociation(Address initiatorAddress, Address remoteAddress)
initiatorAddress
- The initiator of the association.remoteAddress
- The other address of the association.
public scala.Option<AssociationHandle.HandleEventListener> getRemoteReadHandlerFor(TestAssociationHandle localHandle)
write()
is called on the given handle.
@param localHandle The handle
@return The option that contains the Future for the listener if exists.localHandle
- (undocumented)public scala.Option<scala.Tuple2<TestTransport,scala.concurrent.Future<Transport.AssociationEventListener>>> transportFor(Address address)
address
- The address bound to the transport.public void reset()