forked from openaire/iis
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'master' of https://github.com/openaire/iis
- Loading branch information
Showing
34 changed files
with
816 additions
and
292 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
9 changes: 9 additions & 0 deletions
9
iis-wf/iis-wf-affmatching/src/test/resources/log4j.properties
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
# Set everything to be logged to the console | ||
log4j.rootCategory=WARN, console | ||
|
||
log4j.appender.console=org.apache.log4j.ConsoleAppender | ||
log4j.appender.console.target=System.out | ||
log4j.appender.console.layout=org.apache.log4j.PatternLayout | ||
log4j.appender.console.layout.ConversionPattern=%d{yy/MM/dd HH:mm:ss} %p %c{1}: %m%n | ||
|
||
log4j.logger.eu.dnetlib.iis=DEBUG |
27 changes: 27 additions & 0 deletions
27
iis-wf/iis-wf-import/src/main/java/eu/dnetlib/iis/wf/importer/HttpClientUtils.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
package eu.dnetlib.iis.wf.importer; | ||
|
||
import java.io.Closeable; | ||
|
||
import org.apache.http.client.config.RequestConfig; | ||
import org.apache.http.impl.client.CloseableHttpClient; | ||
import org.apache.http.impl.client.HttpClientBuilder; | ||
|
||
/** | ||
* HTTP client utility class. | ||
* | ||
* @author mhorst | ||
* | ||
*/ | ||
public class HttpClientUtils { | ||
|
||
/** | ||
* Builds {@link Closeable} HTTP client issuing requests to remote endpoint. | ||
*/ | ||
public static CloseableHttpClient buildHttpClient(int connectionTimeout, int readTimeout) { | ||
HttpClientBuilder httpClientBuilder = HttpClientBuilder.create(); | ||
httpClientBuilder.setDefaultRequestConfig(RequestConfig.custom().setConnectTimeout(connectionTimeout) | ||
.setConnectionRequestTimeout(connectionTimeout).setSocketTimeout(readTimeout).build()); | ||
return httpClientBuilder.build(); | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
23 changes: 23 additions & 0 deletions
23
iis-wf/iis-wf-import/src/test/java/eu/dnetlib/iis/wf/importer/HttpClientUtilsTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
package eu.dnetlib.iis.wf.importer; | ||
|
||
import static org.junit.Assert.assertNotNull; | ||
|
||
import org.apache.http.impl.client.CloseableHttpClient; | ||
import org.junit.Test; | ||
|
||
public class HttpClientUtilsTest { | ||
|
||
|
||
@Test | ||
public void testBuildHttpClient() throws Exception { | ||
// given | ||
int connectionTimeout = 1; | ||
int readTimeout = 2; | ||
|
||
// execute | ||
CloseableHttpClient client = HttpClientUtils.buildHttpClient(connectionTimeout, readTimeout); | ||
|
||
// assert | ||
assertNotNull(client); | ||
} | ||
} |
Oops, something went wrong.