Class TestTransport.AssociationRegistry

  • Enclosing class:
    TestTransport

    public static class TestTransport.AssociationRegistry
    extends java.lang.Object
    • Constructor Detail

      • AssociationRegistry

        public AssociationRegistry()
    • Method Detail

      • clearLog

        public void clearLog()
        Clears the activity log.
      • 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)
      • logActivity

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

        Parameters:
        activity - Activity to be logged.
      • logSnapshot

        public scala.collection.immutable.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).
      • 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.
      • 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.
      • reset

        public void reset()
        Resets the state of the registry. ''Warning!'' This method is not atomic.
      • 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.
      • transportsReady

        public boolean transportsReady​(scala.collection.immutable.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.