<commit_before>package org.testcontainers.containers;

import org.influxdb.InfluxDB;
import org.influxdb.InfluxDBFactory;
import org.testcontainers.containers.traits.LinkableContainer;
import org.testcontainers.containers.wait.strategy.Wait;
import org.testcontainers.containers.wait.strategy.WaitAllStrategy;

/**
 * @link https://store.docker.com/images/influxdb
 */
public class InfluxDBContainer<SELF extends InfluxDBContainer<SELF>> extends GenericContainer<SELF>
    implements LinkableContainer {

    public static final String VERSION = "1.4.3";
    public static final Integer INFLUXDB_PORT = 8086;

    private static final String IMAGE_NAME = "influxdb";

    private boolean authEnabled = true;
    private String admin = "admin";
    private String adminPassword = "password";

    private String database;
    private String username = "any";
    private String password = "<PASSWORD>";


    public InfluxDBContainer() {
        this(VERSION);
    }

    public InfluxDBContainer(final String version) {
        super(IMAGE_NAME + ":" + version);
        waitStrategy = new WaitAllStrategy()
            .withStrategy(Wait.forHttp("/ping").withBasicCredentials(username, password).forStatusCode(204))
            .withStrategy(Wait.forListeningPort());
    }

    @Override
    protected void configure() {
        addExposedPort(INFLUXDB_PORT);

        addEnv("INFLUXDB_ADMIN_USER", admin);
        addEnv("INFLUXDB_ADMIN_PASSWORD", adminPassword);

        addEnv("INFLUXDB_HTTP_AUTH_ENABLED", String.valueOf(authEnabled));

        addEnv("INFLUXDB_DB", database);
        addEnv("INFLUXDB_USER", username);
        addEnv("INFLUXDB_USER_PASSWORD", password);
    }

    @Override
    protected Integer getLivenessCheckPort() {
        return getMappedPort(INFLUXDB_PORT);
    }


    /**
     * Set env variable `INFLUXDB_HTTP_AUTH_ENABLED`.
     *
     * @param authEnabled Enables authentication.
     * @return a reference to this container instance
     */
    public SELF withAuthEnabled(final boolean authEnabled) {
        this.authEnabled = authEnabled;
        return self();
    }

    /**
     * Set env variable `INFLUXDB_ADMIN_USER`.
     *
     * @param admin The name of the admin user to be created. If this is unset, no admin user is created.
     * @return a reference to this container instance
     */
    public SELF withAdmin(final String admin) {
        this.admin = admin;<commit_msg>fix InfluxDBContainer's JavaDoc and remove deprecated APIs<commit_after>package org.testcontainers.containers;

import org.influxdb.InfluxDB;
import org.influxdb.InfluxDBFactory;
import org.testcontainers.containers.wait.strategy.Wait;
import org.testcontainers.containers.wait.strategy.WaitAllStrategy;

import java.util.Collections;
import java.util.Set;

/**
 * See <a href="https://store.docker.com/images/influxdb">https://store.docker.com/images/influxdb</a>
 */
public class InfluxDBContainer<SELF extends InfluxDBContainer<SELF>> extends GenericContainer<SELF> {

    public static final String VERSION = "1.4.3";
    public static final Integer INFLUXDB_PORT = 8086;

    private static final String IMAGE_NAME = "influxdb";

    private boolean authEnabled = true;
    private String admin = "admin";
    private String adminPassword = "password";

    private String database;
    private String username = "any";
    private String password = "<PASSWORD>";


    public InfluxDBContainer() {
        this(VERSION);
    }

    public InfluxDBContainer(final String version) {
        super(IMAGE_NAME + ":" + version);
        waitStrategy = new WaitAllStrategy()
            .withStrategy(Wait.forHttp("/ping").withBasicCredentials(username, password).forStatusCode(204))
            .withStrategy(Wait.forListeningPort());
    }

    @Override
    protected void configure() {
        addExposedPort(INFLUXDB_PORT);

        addEnv("INFLUXDB_ADMIN_USER", admin);
        addEnv("INFLUXDB_ADMIN_PASSWORD", <PASSWORD>);

        addEnv("INFLUXDB_HTTP_AUTH_ENABLED", String.valueOf(authEnabled));

        addEnv("INFLUXDB_DB", database);
        addEnv("INFLUXDB_USER", username);
        addEnv("INFLUXDB_USER_PASSWORD", password);
    }

    @Override
    public Set<Integer> getLivenessCheckPortNumbers() {
        return Collections.singleton(getMappedPort(INFLUXDB_PORT));
    }

    /**
     * Set env variable `INFLUXDB_HTTP_AUTH_ENABLED`.
     *
     * @param authEnabled Enables authentication.
     * @return a reference to this container instance
     */
    public SELF withAuthEnabled(final boolean authEnabled) {
        this.authEnabled = authEnabled;
        return self();
    }

    /**
     * Set env variable `INFLUXDB_ADMIN_USER`.
     *
     * @param admin The name of the admin user to be created. If this is unset, no admin user is created.
     * @return a reference to this container instance
     */
    public SELF withAdmin(final String admin) {
        this.admin = admin;
{'fraction_non_alphanumeric': 0.09811855148695124, 'fraction_numerical': 0.004046125834513453, 'mean_word_length': 3.382978723404255, 'pattern_counts': {'":': 2, '<': 15, '<?xml version=': 0, '>': 15, 'https://': 3, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '833852', 'n_tokens_mistral': 1467, 'n_tokens_neox': 1422, 'n_words': 334}