Class TestServer
java.lang.Object
com.yahoo.messagebus.network.rpc.test.TestServer
A simple test server implementation.
- Author:
- havardpe
-
Nested Class Summary
-
Field Summary
-
Constructor Summary
ConstructorDescriptionTestServer
(MessageBusParams mbusParams) Creates a new test server without network setupTestServer
(MessageBusParams mbusParams, com.yahoo.jrt.slobrok.server.Slobrok slobrok) Creates a new test server.TestServer
(MessageBusParams mbusParams, RPCNetworkParams netParams) Creates a new test server.TestServer
(String name, RoutingTableSpec table, com.yahoo.jrt.slobrok.server.Slobrok slobrok, Protocol protocol) Create a new test server. -
Method Summary
Modifier and TypeMethodDescriptionboolean
destroy()
Sets the destroyed flag to true.static String
getSlobrokConfig
(com.yahoo.jrt.slobrok.server.Slobrok slobrok) Returns the raw config needed to connect to the given slobrok.void
setupRouting
(RoutingTableSpec table) Proxies theMessageBus.setupRouting(RoutingSpec)
method by encapsulating the given table specification within the requiredRoutingSpec
.boolean
waitSlobrok
(String pattern, int cnt) Wait for some pattern to resolve to some number of services.boolean
waitState
(SlobrokState slobrokState) Wait for a required slobrok state.
-
Field Details
-
net
-
mb
-
-
Constructor Details
-
TestServer
public TestServer(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 servertable
- the routing table spec to be used, may be null for no routingslobrok
- the slobrok to register with (local)protocol
- the protocol that this server should support in addition to SimpleProtocol
-
TestServer
Creates a new test server. -
TestServer
Creates a new test server. -
TestServer
Creates a new test server without network setup
-
-
Method Details
-
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
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
-
setupRouting
Proxies theMessageBus.setupRouting(RoutingSpec)
method by encapsulating the given table specification within the requiredRoutingSpec
.- Parameters:
table
- the table to configure
-
waitSlobrok
Wait for some pattern to resolve to some number of services.- Parameters:
pattern
- pattern to lookup in slobrokcnt
- number of services it must resolve to- Returns:
- Whether or not the required state was reached
-
waitState
Wait for a required slobrok state.- Parameters:
slobrokState
- the state to wait for- Returns:
- whether or not the required state was reached
-