added javadoc and made getRequestConfig protected

This commit is contained in:
Joost
2021-12-06 11:51:07 +01:00
parent 0f162d803c
commit 99ed35ceed
2 changed files with 9 additions and 7 deletions

View File

@@ -9,12 +9,9 @@ package org.dspace.statistics.export.service;
import java.io.IOException;
import java.net.HttpURLConnection;
import java.net.URL;
import java.net.URLConnection;
import java.sql.SQLException;
import java.util.Date;
import java.util.List;
import java.util.concurrent.TimeUnit;
import org.apache.commons.lang.StringUtils;
import org.apache.http.HttpResponse;
@@ -24,7 +21,6 @@ import org.apache.http.client.methods.HttpGet;
import org.apache.http.impl.client.HttpClientBuilder;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.apache.tools.ant.taskdefs.condition.Http;
import org.dspace.core.Context;
import org.dspace.statistics.export.OpenURLTracker;
import org.springframework.beans.factory.annotation.Autowired;
@@ -64,7 +60,9 @@ public class OpenUrlServiceImpl implements OpenUrlService {
}
/**
* Returns the response code from accessing the url
* Returns the response code from accessing the url. Returns a http status 408 when the external service doesn't
* reply in 10 seconds
*
* @param urlStr
* @return response code from the url
* @throws IOException
@@ -77,7 +75,7 @@ public class OpenUrlServiceImpl implements OpenUrlService {
return httpResponse.getStatusLine().getStatusCode();
}
RequestConfig.Builder getRequestConfigBuilder(){
protected RequestConfig.Builder getRequestConfigBuilder(){
return RequestConfig.custom();
}

View File

@@ -143,7 +143,11 @@ public class OpenUrlServiceImplTest {
}
@Test()
/**
* Tests whether the timeout gets set to 10 seconds when processing a url
* @throws SQLException
*/
@Test
public void testTimeout() throws SQLException {
Context context = mock(Context.class);
String URL = "http://bla.com";