/*-
* ============LICENSE_START=======================================================
- * Copyright (C) 2019-2020 AT&T Intellectual Property. All rights reserved.
+ * Copyright (C) 2019-2021 AT&T Intellectual Property. All rights reserved.
* Modifications Copyright (C) 2021 Nordix Foundation.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
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.common.endpoints.parameters.RestServerParameters;
import org.onap.policy.models.tosca.authorative.concepts.ToscaConceptIdentifier;
import org.onap.policy.models.tosca.authorative.concepts.ToscaServiceTemplate;
import org.slf4j.Logger;
* @param params target specification
* @throws PolicyApiException if an error occurs
*/
- public PolicyApiCaller(RestServerParameters params) throws PolicyApiException {
- BusTopicParams busParams = new BusTopicParams();
- busParams.setClientName("policy-api");
- busParams.setHostname(params.getHost());
- busParams.setManaged(false);
- busParams.setPassword(params.getPassword());
- busParams.setPort(params.getPort());
- busParams.setUseHttps(params.isHttps());
- busParams.setUserName(params.getUserName());
-
+ public PolicyApiCaller(BusTopicParams params) throws PolicyApiException {
try {
- httpClient = makeClient(busParams);
+ params.setClientName("policy-api");
+ httpClient = makeClient(params);
} catch (HttpClientConfigException e) {
- throw new PolicyApiException("connection to host: " + busParams.getHostname(), e);
+ throw new PolicyApiException("connection to host: " + params.getHostname(), e);
}
}
}
} catch (RuntimeException e) {
- logger.warn("policy-api connection error");
+ logger.warn("policy-api connection error, client info: {} ", httpClient);
throw new PolicyApiException(type.toString(), e);
}
}