Package com.attivio.sdk.connector
Class MockBasicAuthenticationProvider
- java.lang.Object
-
- com.attivio.sdk.connector.MockBasicAuthenticationProvider
-
- All Implemented Interfaces:
HttpClientProvider
,java.io.Closeable
,java.lang.AutoCloseable
public class MockBasicAuthenticationProvider extends java.lang.Object implements HttpClientProvider, java.io.Closeable
-
-
Field Summary
Fields Modifier and Type Field Description protected org.apache.http.impl.client.HttpClientBuilder
clientBuilder
-
Constructor Summary
Constructors Constructor Description MockBasicAuthenticationProvider()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description void
close()
void
configureHttpClientProvider(HttpDataSourceScanner scanner)
protected static org.apache.http.auth.AuthScope
getAuthScope(java.lang.String host, int port, java.lang.String realm, java.lang.String scheme)
org.apache.http.impl.client.CloseableHttpClient
prepareHttpClient(java.lang.String url)
This method should be called by the scanner before every execution of an Http command.protected void
setCredentials(HttpDataSourceScanner scanner, org.apache.http.client.CredentialsProvider credentialsProvider)
-
-
-
Method Detail
-
prepareHttpClient
public org.apache.http.impl.client.CloseableHttpClient prepareHttpClient(java.lang.String url)
Description copied from interface:HttpClientProvider
This method should be called by the scanner before every execution of an Http command. It is typically a lightweight call since the provider returns the same client object if it is still valid. The provider will create a new client when needed, for example when the client has timed out. The url that the scanner is going to execute should be passed toHttpClientProvider.prepareHttpClient(String url)
for cases where different Http clients are provided for different Urls. For example when different authentication is required.- Specified by:
prepareHttpClient
in interfaceHttpClientProvider
- Parameters:
url
- The url the returned Http client will be used for.- Returns:
- Http client to be used by the scanner
-
configureHttpClientProvider
public void configureHttpClientProvider(HttpDataSourceScanner scanner)
-
setCredentials
protected void setCredentials(HttpDataSourceScanner scanner, org.apache.http.client.CredentialsProvider credentialsProvider)
-
getAuthScope
protected static org.apache.http.auth.AuthScope getAuthScope(java.lang.String host, int port, java.lang.String realm, java.lang.String scheme)
-
close
public void close() throws java.io.IOException
- Specified by:
close
in interfacejava.lang.AutoCloseable
- Specified by:
close
in interfacejava.io.Closeable
- Throws:
java.io.IOException
-
-