Package org.jboss.resteasy.test
Class TestPortProvider
java.lang.Object
org.jboss.resteasy.test.TestPortProvider
Test utility class
- Version:
- $Revision$
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic ClientRequest
createClientRequest
(String path) Create a Resteasy ClientRequest object using the configured port.static ClientRequest
createClientRequest
(ClientRequestFactory factory, String path) static <T> T
createProxy
(Class<T> clazz) Create a Resteasy client proxy with an empty base request path.static <T> T
createProxy
(Class<T> clazz, String path) Create a Resteasy client proxy.static URI
Create a URI for the provided path, using the configured portstatic URL
Create a URL for the provided path, using the configured portstatic String
Generate a base URL incorporating the configured port.static String
generateURL
(String path) Generate a URL incorporating the configured port.static String
getHost()
Look up the configured hostname, first checking an environment variable (RESTEASY_HOST), then a system property (org.jboss.resteasy.host), and finally the default hostname (localhost).static int
getPort()
Look up the configured port number, first checking an environment variable (RESTEASY_PORT), then a system property (org.jboss.resteasy.port), and finally the default port (8081).
-
Constructor Details
-
TestPortProvider
public TestPortProvider()
-
-
Method Details
-
createClientRequest
Create a Resteasy ClientRequest object using the configured port.- Parameters:
path
- the request path- Returns:
- the ClientRequest object
-
createClientRequest
-
createProxy
Create a Resteasy client proxy with an empty base request path.- Parameters:
clazz
- the client interface class- Returns:
- the proxy object
-
createProxy
Create a Resteasy client proxy.- Parameters:
clazz
- the client interface class- Returns:
- the proxy object
-
createURI
Create a URI for the provided path, using the configured port- Parameters:
path
- the request path- Returns:
- a full URI
-
createURL
Create a URL for the provided path, using the configured port- Parameters:
path
- the request path- Returns:
- a full URL
- Throws:
MalformedURLException
-
generateBaseUrl
Generate a base URL incorporating the configured port.- Returns:
- a full URL
-
generateURL
Generate a URL incorporating the configured port.- Parameters:
path
- the path- Returns:
- a full URL
-
getPort
public static int getPort()Look up the configured port number, first checking an environment variable (RESTEASY_PORT), then a system property (org.jboss.resteasy.port), and finally the default port (8081).- Returns:
- the port number specified in either the environment or system properties
-
getHost
Look up the configured hostname, first checking an environment variable (RESTEASY_HOST), then a system property (org.jboss.resteasy.host), and finally the default hostname (localhost).- Returns:
- the host specified in either the environment or system properties
-