<commit_before>package com.github.jrh3k5.flume.rest;

import static org.fest.assertions.Assertions.assertThat;

import java.util.Collections;
import java.util.List;
import java.util.UUID;

import org.apache.flume.Context;
import org.apache.flume.Event;
import org.apache.flume.Transaction;
import org.apache.flume.channel.MemoryChannel;
import org.apache.flume.event.SimpleEvent;
import org.junit.After;
import org.junit.Before;
import org.junit.Test;

/**
 * Integration tests for {@link ServerSink}.
 * 
 * @author <NAME>
 */

public class ServerSinkITest {
    private final MemoryChannel channel = new MemoryChannel();
    private final ServerSink serverSink = new ServerSink();
    private final Context context = new Context();
    private final ServerSinkClient sinkClient = new ServerSinkClient(1337);

    /**
     * Start the sink.
     * 
     * @throws Exception
     *             If any errors occur during the startup.
     */
    @Before
    public void startSink() throws Exception {
        channel.configure(context);
        channel.start();

        serverSink.configure(context);
        serverSink.setChannel(channel);
        serverSink.start();
    }

    /**
     * Close and clean up the sink after each test.
     * 
     * @throws Exception
     *             If any errors occur during the cleanup.
     */
    @After
    public void closeSink() throws Exception {
        sinkClient.close();

        serverSink.stop();
        channel.stop();<commit_msg>Use configuration to wire in the port for the server.<commit_after>package com.github.jrh3k5.flume.rest;

import static org.fest.assertions.Assertions.assertThat;

import java.util.Collections;
import java.util.List;
import java.util.UUID;

import org.apache.flume.Context;
import org.apache.flume.Event;
import org.apache.flume.Transaction;
import org.apache.flume.channel.MemoryChannel;
import org.apache.flume.event.SimpleEvent;
import org.junit.After;
import org.junit.Before;
import org.junit.Test;

/**
 * Integration tests for {@link ServerSink}.
 * 
 * @author <NAME>
 */

public class ServerSinkITest {
    private final int serverPort = 7890;
    private final MemoryChannel channel = new MemoryChannel();
    private final ServerSink serverSink = new ServerSink();
    private final Context context = new Context();
    private final ServerSinkClient sinkClient = new ServerSinkClient(serverPort);

    /**
     * Start the sink.
     * 
     * @throws Exception
     *             If any errors occur during the startup.
     */
    @Before
    public void startSink() throws Exception {
        context.put("server.http.port", Integer.toString(serverPort));

        channel.configure(context);
        channel.start();

        serverSink.configure(context);
        serverSink.setChannel(channel);
        serverSink.start();
    }

    /**
     * Close and clean up the sink after each test.
     * 
     * @throws Exception
     *             If any errors occur during the cleanup.
     */
    @After
    public void closeSink() throws Exception {
        sinkClient.close();

        serverSink.stop();
        channel.stop();
{'fraction_non_alphanumeric': 0.10060683487703609, 'fraction_numerical': 0.0038326413286489938, 'mean_word_length': 2.847665847665848, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, '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': '4938618', 'n_tokens_mistral': 870, 'n_tokens_neox': 875, 'n_words': 237}