import java.net.HttpURLConnection;
import javax.ws.rs.core.Response;
-import org.onap.policy.common.endpoints.event.comm.bus.internal.BusTopicParams;
import org.onap.policy.common.endpoints.http.client.HttpClient;
-import org.onap.policy.common.endpoints.http.client.HttpClientConfigException;
-import org.onap.policy.common.endpoints.http.client.HttpClientFactoryInstance;
import org.onap.policy.models.tosca.authorative.concepts.ToscaConceptIdentifier;
import org.onap.policy.models.tosca.authorative.concepts.ToscaServiceTemplate;
import org.slf4j.Logger;
/**
* Constructs the object.
*
- * @param params target specification
- * @throws PolicyApiException if an error occurs
+ * @param httpClient API REST client
*/
- public PolicyApiCaller(BusTopicParams params) throws PolicyApiException {
- try {
- params.setClientName("policy-api");
- httpClient = makeClient(params);
- } catch (HttpClientConfigException e) {
- throw new PolicyApiException("connection to host: " + params.getHostname(), e);
- }
+ public PolicyApiCaller(HttpClient httpClient) {
+ this.httpClient = httpClient;
}
/**
throw new PolicyApiException(type.toString(), e);
}
}
-
- // these methods may be overridden by junit tests
-
- protected HttpClient makeClient(BusTopicParams busParams) throws HttpClientConfigException {
- return HttpClientFactoryInstance.getClientFactory().build(busParams);
- }
}