Class TestPortProvider

java.lang.Object
org.jboss.resteasy.test.TestPortProvider

public class TestPortProvider extends Object
Test utility class
Version:
$Revision$
Author:
Justin Edelson
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    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 url)
    Create a Resteasy client proxy.
    Creates a ResteasyWebTarget using base request path.
    static URI
    Create a URI for the provided path, using the configured port
    static URL
    Create a URL for the provided path, using the configured port
    static String
    Generate a base URL incorporating the configured port.
    static String
    Generate a URL incorporating the configured port.
    static String
    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
    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).

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • TestPortProvider

      public TestPortProvider()
  • Method Details

    • createTarget

      public static ResteasyWebTarget createTarget(String path)
      Creates a ResteasyWebTarget using base request path.
      Parameters:
      path - the path
      Returns:
      web resource target
    • createProxy

      public static <T> T createProxy(Class<T> clazz)
      Create a Resteasy client proxy with an empty base request path.
      Type Parameters:
      T - type
      Parameters:
      clazz - the client interface class
      Returns:
      the proxy object
    • createProxy

      public static <T> T createProxy(Class<T> clazz, String url)
      Create a Resteasy client proxy.
      Type Parameters:
      T - type
      Parameters:
      clazz - the client interface class
      url - request url
      Returns:
      the proxy object
    • createURI

      public static URI createURI(String path)
      Create a URI for the provided path, using the configured port
      Parameters:
      path - the request path
      Returns:
      a full URI
    • createURL

      public static URL createURL(String path) throws MalformedURLException
      Create a URL for the provided path, using the configured port
      Parameters:
      path - the request path
      Returns:
      a full URL
      Throws:
      MalformedURLException - if no protocol is specified or an unknown protocol is found
    • generateBaseUrl

      public static String generateBaseUrl()
      Generate a base URL incorporating the configured port.
      Returns:
      a full URL
    • generateURL

      public static String generateURL(String path)
      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

      public 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).
      Returns:
      the host specified in either the environment or system properties