Commit 409c850d authored by Muskan Srivastava's avatar Muskan Srivastava
Browse files

resolved checkstyle issues

parent adcf2fe9
Pipeline #45080 passed with stages
in 5 minutes and 3 seconds
......@@ -25,7 +25,7 @@ import org.springframework.stereotype.Component;
@Data
@Component
@ConfigurationProperties(prefix = "azure.service.retry.config")
public class HttpConfiguration {
public class RetryAndTimeoutConfiguration {
private int maxRetry = 3;
private int connectTimeout = 60000;
......
......@@ -28,9 +28,9 @@ import org.springframework.stereotype.Component;
@ConfigurationProperties
public class EntilementsAPIConfigBean extends AbstractFactoryBean<EntitlementsAPIConfig> {
private String AUTHORIZE_API;
private String authorizeAPI;
private String AUTHORIZE_API_KEY;
private String authorizeAPIKey;
/**
* Abstract method of AbstractBeanFactory<T>.
......@@ -52,8 +52,8 @@ public class EntilementsAPIConfigBean extends AbstractFactoryBean<EntitlementsAP
protected EntitlementsAPIConfig createInstance() throws Exception {
return EntitlementsAPIConfig
.builder()
.rootUrl(AUTHORIZE_API)
.apiKey(AUTHORIZE_API_KEY)
.rootUrl(authorizeAPI)
.apiKey(authorizeAPIKey)
.build();
}
}
......@@ -43,15 +43,15 @@ public class EntitlementsFactoryAzure implements IEntitlementsFactory {
/**
* Constructor Injection for above 3 fields.
*
* @param config EntitlementsAPIConfig
* @param mapper HttpResponseBodyMapper
* @param client IHttpClient
* @param entitlementsConfig EntitlementsAPIConfig
* @param httpMapper HttpResponseBodyMapper
* @param httpClient IHttpClient
*/
@Autowired
public EntitlementsFactoryAzure(EntitlementsAPIConfig config, HttpResponseBodyMapper mapper, IHttpClient client) {
this.config = config;
this.mapper = mapper;
this.client = client;
public EntitlementsFactoryAzure(final EntitlementsAPIConfig entitlementsConfig, final HttpResponseBodyMapper httpMapper, final IHttpClient httpClient) {
this.config = entitlementsConfig;
this.mapper = httpMapper;
this.client = httpClient;
}
/**
......@@ -61,7 +61,7 @@ public class EntitlementsFactoryAzure implements IEntitlementsFactory {
* @return IEntitlementsService
*/
@Override
public IEntitlementsService create(DpsHeaders headers) {
public IEntitlementsService create(final DpsHeaders headers) {
Objects.requireNonNull(headers, "headers cannot be null");
return new EntitlementsService(this.config,
......
......@@ -40,7 +40,7 @@ public class HttpClientAzure extends UrlFetchServiceImpl implements IHttpClient
* @return HttpResponse
*/
@Override
public HttpResponse send(HttpRequest httpRequest) {
public HttpResponse send(final HttpRequest httpRequest) {
org.opengroup.osdu.core.common.model.http.HttpResponse response = null;
try {
response = super.sendRequest(FetchServiceHttpRequest.builder()
......@@ -51,7 +51,7 @@ public class HttpClientAzure extends UrlFetchServiceImpl implements IHttpClient
.headers(httpRequest.getHeaders())
.build());
} catch (URISyntaxException e) {
throw new AppException(HttpStatus.SC_INTERNAL_SERVER_ERROR, e.getReason(), "URI Syntax is not correct",e);
throw new AppException(HttpStatus.SC_INTERNAL_SERVER_ERROR, e.getReason(), "URI Syntax is not correct", e);
}
HttpResponse httpResponse = new HttpResponse();
httpResponse.setBody(response.getBody());
......
......@@ -15,7 +15,7 @@
package org.opengroup.osdu.azure.httpconfig;
import org.apache.http.client.config.RequestConfig;
import org.opengroup.osdu.azure.di.HttpConfiguration;
import org.opengroup.osdu.azure.di.RetryAndTimeoutConfiguration;
import org.opengroup.osdu.core.common.http.HttpClientHandler;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Primary;
......@@ -28,16 +28,16 @@ import org.springframework.stereotype.Component;
@Component
public class HttpClientHandlerAzure extends HttpClientHandler {
private HttpConfiguration configuration;
private RetryAndTimeoutConfiguration configuration;
/**
* Constuctor injection for HttpConfiguration.
* Constuctor injection for RetryAndTimeoutConfiguration.
*
* @param configuration of type HttpConfiguration
* @param retryAndTimeoutConfiguration of type RetryAndTimeoutConfiguration
*/
@Autowired
public HttpClientHandlerAzure(HttpConfiguration configuration) {
this.configuration = configuration;
public HttpClientHandlerAzure(final RetryAndTimeoutConfiguration retryAndTimeoutConfiguration) {
this.configuration = retryAndTimeoutConfiguration;
super.REQUEST_CONFIG = RequestConfig.custom()
.setConnectTimeout(configuration.getConnectTimeout())
.setConnectionRequestTimeout(configuration.getRequestTimeout())
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment