public class TestContainer extends Object
Modifier and Type | Class and Description |
---|---|
static class |
TestContainer.MyServiceClientEndpoint |
Modifier and Type | Field and Description |
---|---|
protected static String |
NEGATIVE |
protected static String |
POSITIVE |
Constructor and Description |
---|
TestContainer() |
Modifier and Type | Method and Description |
---|---|
protected ClientManager |
createClient()
Get the
ClientManager instance. |
protected String |
getHost() |
protected int |
getPort()
Get port used for creating remote endpoint
URI . |
Map<String,Object> |
getServerProperties()
Get server properties.
|
protected URI |
getURI(Class<?> serverClass)
Get the
URI for the ServerEndpoint annotated class. |
protected URI |
getURI(Class<?> serverClass,
String scheme)
Get the
URI for the ServerEndpoint annotated class. |
protected URI |
getURI(String endpointPath)
|
protected URI |
getURI(String endpointPath,
String scheme)
|
void |
setContextPath(String contextPath)
Sets the context path.
|
void |
setDefaultHost(String defaultHost)
Sets the default host.
|
void |
setDefaultPort(int defaultPort)
Sets the default port.
|
void |
setServerProperties(Map<String,Object> properties)
Set properties.
|
protected Server |
startServer(Class<?>... endpointClasses)
Start embedded server unless "tyrus.test.host" system property is specified.
|
protected void |
stopServer(Server server)
Stop the server.
|
protected void |
testViaServiceEndpoint(ClientManager client,
Class<?> serviceEndpoint,
String expectedResult,
String message)
Send message to the service endpoint and compare the received result with the specified one.
|
protected static final String POSITIVE
protected static final String NEGATIVE
protected Server startServer(Class<?>... endpointClasses) throws javax.websocket.DeploymentException
Server
instance or null
if "tyrus.test.host" system property is set.javax.websocket.DeploymentException
protected void stopServer(Server server)
server
- to be stopped.protected String getHost()
protected int getPort()
URI
.
Can be overridden by TestContainer
descendants.URI
.protected URI getURI(Class<?> serverClass)
URI
for the ServerEndpoint
annotated class.protected URI getURI(Class<?> serverClass, String scheme)
URI
for the ServerEndpoint
annotated class.protected ClientManager createClient()
ClientManager
instance.ClientManager
which can be used to connect to a serverpublic Map<String,Object> getServerProperties()
public void setServerProperties(Map<String,Object> properties)
properties
- server properties.protected void testViaServiceEndpoint(ClientManager client, Class<?> serviceEndpoint, String expectedResult, String message) throws javax.websocket.DeploymentException, IOException, InterruptedException
client
- client used to send the message.serviceEndpoint
- endpoint to which the message will be sent.expectedResult
- expected reply.message
- message to be sent.javax.websocket.DeploymentException
IOException
InterruptedException
public void setContextPath(String contextPath)
contextPath
- the path to be set.public void setDefaultHost(String defaultHost)
defaultHost
- the host to be set.public void setDefaultPort(int defaultPort)
defaultPort
- default port number.Copyright © 2012-2015, Oracle and/or its affiliates. All Rights Reserved. Use is subject to license terms.