Class TestServer


  • public class TestServer
    extends java.lang.Object
    A simple test server implementation.
    Author:
    Haavard Pettersen
    • Constructor Detail

      • TestServer

        public TestServer​(java.lang.String name,
                          RoutingTableSpec table,
                          com.yahoo.jrt.slobrok.server.Slobrok slobrok,
                          Protocol protocol)
        Create a new test server.
        Parameters:
        name - The service name prefix for this server.
        table - The routing table spec to be used, may be null for no routing.
        slobrok - The slobrok to register with (local).
        protocol - The protocol that this server should support in addition to SimpleProtocol.
      • TestServer

        public TestServer​(MessageBusParams mbusParams,
                          RPCNetworkParams netParams)
        Create a new test server.
        Parameters:
        mbusParams - The parameters for mesasge bus.
        netParams - The parameters for the rpc network.
    • Method Detail

      • destroy

        public boolean destroy()
        Sets the destroyed flag to true. The very first time this method is called, it cleans up all its dependencies. Even if you retain a reference to this object, all of its content is allowed to be garbage collected.
        Returns:
        True if content existed and was destroyed.
      • getSlobrokConfig

        public static java.lang.String getSlobrokConfig​(com.yahoo.jrt.slobrok.server.Slobrok slobrok)
        Returns the raw config needed to connect to the given slobrok.
        Parameters:
        slobrok - The slobrok whose connection spec to include.
        Returns:
        The raw config string.
      • waitSlobrok

        public boolean waitSlobrok​(java.lang.String pattern,
                                   int cnt)
        Wait for some pattern to resolve to some number of services.
        Parameters:
        pattern - Pattern to lookup in slobrok.
        cnt - Number of services it must resolve to.
        Returns:
        Whether or not the required state was reached.
      • waitState

        public boolean waitState​(SlobrokState slobrokState)
        Wait for a required slobrok state.
        Parameters:
        slobrokState - The state to wait for.
        Returns:
        Whether or not the required state was reached.