<commit_before>package org.carlspring.strongbox.client;

import javax.ws.rs.ServerErrorException;
import javax.ws.rs.client.*;
import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.Response;
import java.io.Closeable;
import java.io.IOException;
import java.io.InputStream;
import java.util.Map;

import org.apache.http.HttpStatus;
import org.glassfish.jersey.apache.connector.ApacheConnectorProvider;
import org.glassfish.jersey.client.ClientConfig;
import org.glassfish.jersey.client.authentication.HttpAuthenticationFeature;
import org.springframework.security.authentication.AuthenticationServiceException;
import static org.apache.http.HttpStatus.SC_FORBIDDEN;
import static org.apache.http.HttpStatus.SC_UNAUTHORIZED;

/**
 * @author mtodorov
 */
public class ArtifactClient
        extends BaseArtifactClient
        implements Closeable
{

    private static final String HEADER_VALUE_MAVEN = "Maven/*";

    private static final String HEADER_NAME_USER_AGENT = "user-agent";

    protected String username;

    protected String password;

    private String protocol = "http";

    private String host = System.getProperty("strongbox.host") != null ?
                          System.getProperty("strongbox.host") : "localhost";

    private int port = System.getProperty("strongbox.port") != null ?
                       Integer.parseInt(System.getProperty("strongbox.port")) : 48080;

    private String contextBaseUrl;

    private Client client;


    public ArtifactClient()
    {
    }

    public static ArtifactClient getTestInstanceLoggedInAsAdmin()
    {
        return getTestInstance("admin", "password");
    }

    public static ArtifactClient getTestInstance(String username,
                                                 String password)
    {
        String host = System.getProperty("strongbox.host") != null ?
                      System.getProperty("strongbox.host") :
                      "localhost";

        int port = System.getProperty("strongbox.port") != null ?
                   Integer.parseInt(System.getProperty("strongbox.port")) :
                   48080;

        ArtifactClient client = new ArtifactClient();
        client.setUsername(username != null ? username : "deployer");
        client.setPassword(password != null ? password : "password");
        client.setPort(port);
        client.setContextBaseUrl("http://" + host + ":" + client.getPort());

        return client;
    }

    public Client getClientInstance()
    {
        if (client == null)<commit_msg>Issue 1138: Drop the default test users<commit_after>package org.carlspring.strongbox.client;

import javax.ws.rs.ServerErrorException;
import javax.ws.rs.client.*;
import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.Response;
import java.io.Closeable;
import java.io.IOException;
import java.io.InputStream;
import java.util.Map;

import org.apache.http.HttpStatus;
import org.glassfish.jersey.apache.connector.ApacheConnectorProvider;
import org.glassfish.jersey.client.ClientConfig;
import org.glassfish.jersey.client.authentication.HttpAuthenticationFeature;
import org.springframework.security.authentication.AuthenticationServiceException;
import static org.apache.http.HttpStatus.SC_FORBIDDEN;
import static org.apache.http.HttpStatus.SC_UNAUTHORIZED;

/**
 * @author mtodorov
 */
public class ArtifactClient
        extends BaseArtifactClient
        implements Closeable
{

    private static final String HEADER_VALUE_MAVEN = "Maven/*";

    private static final String HEADER_NAME_USER_AGENT = "user-agent";

    protected String username;

    protected String password;

    private String protocol = "http";

    private String host = System.getProperty("strongbox.host") != null ?
                          System.getProperty("strongbox.host") : "localhost";

    private int port = System.getProperty("strongbox.port") != null ?
                       Integer.parseInt(System.getProperty("strongbox.port")) : 48080;

    private String contextBaseUrl;

    private Client client;


    public ArtifactClient()
    {
    }

    public static ArtifactClient getTestInstance()
    {
        return getTestInstance("deployer", "password");
    }

    public static ArtifactClient getTestInstanceLoggedInAsAdmin()
    {
        return getTestInstance("admin", "password");
    }

    public static ArtifactClient getTestInstance(String username,
                                                 String password)
    {
        String host = System.getProperty("strongbox.host") != null ?
                      System.getProperty("strongbox.host") :
                      "localhost";

        int port = System.getProperty("strongbox.port") != null ?
                   Integer.parseInt(System.getProperty("strongbox.port")) :
                   48080;

        ArtifactClient client = new ArtifactClient();
        client.setUsername(username != null ? username : "deployer");
        client.setPassword(password != null ? password : "password");
        client.setPort(port);
        client.setContextBaseUrl("http://" + host + ":" + client.getPort());

        return client;
    }

    public Client getClientInstance()
    {
        if (client == null)
{'fraction_non_alphanumeric': 0.10207612456747404, 'fraction_numerical': 0.00461361014994233, 'mean_word_length': 2.950645406226272, 'pattern_counts': {'":': 2, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 4, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5455347', 'n_tokens_mistral': 1395, 'n_tokens_neox': 1349, 'n_words': 286}