Package fi.meliora.testlab.ext.crest
Class CrestEndpointFactory
java.lang.Object
fi.meliora.testlab.ext.crest.CrestEndpointFactory
A helper class to provide crest endpoints for calling external rest endpoints.
- Author:
- Marko Kanala
-
Method Summary
Modifier and TypeMethodDescription<T> TgetEndpoint(String url, String username, String password, Class<T> endpointClass) Constructs a new CRest endpoint, caches it and returns it for use.static CrestEndpointFactory<T> TgetTestlabEndpoint(String companyId, String onpremiseUrl, String apiKey, Class<T> endpointClass) Returns an endpoint to Testlab.
-
Method Details
-
getInstance
-
getEndpoint
Constructs a new CRest endpoint, caches it and returns it for use.- Type Parameters:
T- type- Parameters:
url- urlusername- user namepassword- passwordendpointClass- 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 idonpremiseUrl- onpremise urlapiKey- api keyendpointClass- endpoint class- Returns:
- endpoint
-