Example usage for org.apache.http.impl.client BasicCredentialsProvider getCredentials

List of usage examples for org.apache.http.impl.client BasicCredentialsProvider getCredentials

Introduction

In this page you can find the example usage for org.apache.http.impl.client BasicCredentialsProvider getCredentials.

Prototype

public Credentials getCredentials(final AuthScope authscope) 

Source Link

Usage

From source file:com.redhat.red.offliner.PomArtifactListReaderTest.java

/**
 * Checks if credentials for a repository is added to the credentials provider.
 *//*from   ww  w .  j a  va2s. co  m*/
@Test
public void readPathsAddRepositoryCredentials() throws Exception {
    BasicCredentialsProvider creds = new BasicCredentialsProvider();
    PomArtifactListReader artifactListReader = new PomArtifactListReader(getFile("settings.xml"), null, creds);

    // call to invoke processing of settings.xml, but the result is not needed
    artifactListReader.readPaths(getFile("repo.pom"));

    Credentials credentials = creds.getCredentials(new AuthScope("mirror.jboss.org", 80, null, "http"));
    assertNotNull("Credentials for http://mirror.jboss.org/ not loaded", credentials);
}