Class CrestEndpointFactory

java.lang.Object
fi.meliora.testlab.ext.crest.CrestEndpointFactory

public class CrestEndpointFactory extends Object
A helper class to provide crest endpoints for calling external rest endpoints.
Author:
Marko Kanala
  • Method Details

    • getInstance

      public static CrestEndpointFactory getInstance()
    • getEndpoint

      public <T> T getEndpoint(String url, String username, String password, Class<T> endpointClass)
      Constructs a new CRest endpoint, caches it and returns it for use.
      Type Parameters:
      T - type
      Parameters:
      url - url
      username - user name
      password - password
      endpointClass - endpoint class
      Returns:
      endpoint
    • getTestlabEndpoint

      public <T> T getTestlabEndpoint(String companyId, String onpremiseUrl, String apiKey, Class<T> endpointClass)
      Returns an endpoint to Testlab. If onpremiseUrl is set it used as a base url. It not, this methods peeks for TESTLAB_<companyid in upper case> system environment variable for testlab api address. If none is set a default of https://companyid.melioratestlab.com/api is used.
      Type Parameters:
      T - type
      Parameters:
      companyId - company id
      onpremiseUrl - onpremise url
      apiKey - api key
      endpointClass - endpoint class
      Returns:
      endpoint