<commit_before>package org.apache.mesos.logstash.systemtest;

import com.github.dockerjava.api.DockerClient;
import com.github.dockerjava.api.command.CreateContainerCmd;
import org.apache.mesos.mini.container.AbstractContainer;

import java.security.SecureRandom;
import java.util.stream.IntStream;

/**
 * Container for the Logstash scheduler
 */
public class LogstashSchedulerContainer extends AbstractContainer {

    public static final String SCHEDULER_IMAGE = "mesos/logstash-scheduler";

    public static final String SCHEDULER_NAME = "logstash-scheduler";

    private String ipAddress;

    public LogstashSchedulerContainer(DockerClient dockerClient, String ipAddress) {
        super(dockerClient);
        this.ipAddress = ipAddress;
    }

    @Override
    protected void pullImage() {
        dockerClient.pullImageCmd(SCHEDULER_IMAGE);
    }

    @Override
    protected CreateContainerCmd dockerCommand() {
        return dockerClient
                .createContainerCmd(SCHEDULER_IMAGE)
                .withName(SCHEDULER_NAME + "_" + new SecureRandom().nextInt())
                .withEnv("JAVA_OPTS=-Xmx256m -Dmesos.zk=zk://" + ipAddress + ":2181/mesos -Dmesos.logstash.framework.name=logstash")
                .withExtraHosts(IntStream.rangeClosed(1, 3).mapToObj(value -> "slave" + value + ":" + ipAddress).toArray(String[]::new));
    }
}<commit_msg>Main runner now correctly deploys Logstash framework.<commit_after>package org.apache.mesos.logstash.systemtest;

import com.github.dockerjava.api.DockerClient;
import com.github.dockerjava.api.command.CreateContainerCmd;
import org.apache.mesos.mini.container.AbstractContainer;
import org.springframework.util.StringUtils;

import java.security.SecureRandom;
import java.util.List;
import java.util.stream.IntStream;

import static java.util.Arrays.asList;

/**
 * Container for the Logstash scheduler
 */
public class LogstashSchedulerContainer extends AbstractContainer {

    public static final String SCHEDULER_IMAGE = "mesos/logstash-scheduler";

    public static final String SCHEDULER_NAME = "logstash-scheduler";

    private List<String> javaOpts;

    private String ipAddress;

    public LogstashSchedulerContainer(DockerClient dockerClient, String ipAddress) {
        super(dockerClient);
        this.ipAddress = ipAddress;
        this.javaOpts = asList(
                "-Xmx256m",
                "-Dmesos.logstash.web.port=9092",
                "-Dmesos.logstash.framework.name=logstash",
                "-Dmesos.logstash.logstash.heap.size=512",
                "-Dmesos.logstash.executor.heap.size=256",
                "-Dmesos.logstash.volumes=/var/log/mesos",
                "-Dmesos.zk=zk://" + ipAddress + ":2181/mesos"
        );
    }

    @Override
    protected void pullImage() {
        dockerClient.pullImageCmd(SCHEDULER_IMAGE);
    }

    @Override
    protected CreateContainerCmd dockerCommand() {
        return dockerClient
                .createContainerCmd(SCHEDULER_IMAGE)
                .withName(SCHEDULER_NAME + "_" + new SecureRandom().nextInt())
                .withEnv("JAVA_OPTS=" + StringUtils.collectionToDelimitedString(javaOpts, " "))
                .withExtraHosts(IntStream.rangeClosed(1, 3).mapToObj(value -> "slave" + value + ":" + ipAddress).toArray(String[]::new));
    }
}
{'fraction_non_alphanumeric': 0.10819770946353224, 'fraction_numerical': 0.008438818565400843, 'mean_word_length': 3.2496798975672214, 'pattern_counts': {'":': 4, '<': 4, '<?xml version=': 0, '>': 6, 'https://': 0, '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': '4635800', 'n_tokens_mistral': 1047, 'n_tokens_neox': 981, 'n_words': 164}