<commit_before>package dk.statsbiblioteket.medieplatform.autonomous;

import com.netflix.curator.framework.CuratorFramework;
import com.netflix.curator.framework.CuratorFrameworkFactory;
import com.netflix.curator.retry.ExponentialBackoffRetry;
import com.netflix.curator.test.TestingServer;
import junit.framework.Assert;
import org.testng.annotations.BeforeMethod;
import org.testng.annotations.Test;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.Date;
import java.util.List;

public class AutonomousComponentTest {
    private static final String BATCHID = "40005";
    private static final long DEFAULT_TIMEOUT = 3600000;
    private static final int ROUNDTRIPNUMBER = 1;
    TestingServer testingServer;
    AutonomousComponent autonoumous;
    private TestingComponent component;

    @BeforeMethod
    public void setUp() throws Exception {
        testingServer = new TestingServer();
        component = new TestingComponent();

        Batch testBatch = new Batch(BATCHID);
        testBatch.setRoundTripNumber(ROUNDTRIPNUMBER);
        Event testEvent = new Event();
        testEvent.setEventID("Data_Received");
        testEvent.setSuccess(true);
        testEvent.setDate(new Date());
        testEvent.setDetails("");

        testBatch.setEventList(new ArrayList<>(Arrays.asList(testEvent)));

        component.setBatches(new ArrayList<>(Arrays.asList(testBatch)));

        CuratorFramework lockClient = CuratorFrameworkFactory.newClient(
                testingServer.getConnectString(), new ExponentialBackoffRetry(1000, 3));
        lockClient.start();

        autonoumous = new AutonomousComponent(component,
                lockClient, 1,
                Arrays.asList("Data_Received"),
                null,
                null,
                DEFAULT_TIMEOUT,
                DEFAULT_TIMEOUT,
                DEFAULT_TIMEOUT,
                component.getEventTrigger(),
                component.getEventStorer());<commit_msg>Close the zookeeper connection after test<commit_after>package dk.statsbiblioteket.medieplatform.autonomous;

import com.netflix.curator.framework.CuratorFramework;
import com.netflix.curator.framework.CuratorFrameworkFactory;
import com.netflix.curator.retry.ExponentialBackoffRetry;
import com.netflix.curator.test.TestingServer;
import junit.framework.Assert;
import org.testng.annotations.AfterMethod;
import org.testng.annotations.BeforeMethod;
import org.testng.annotations.Test;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.Date;
import java.util.List;

public class AutonomousComponentTest {
    private static final String BATCHID = "40005";
    private static final long DEFAULT_TIMEOUT = 3600000;
    private static final int ROUNDTRIPNUMBER = 1;
    TestingServer testingServer;
    AutonomousComponent autonoumous;
    private TestingComponent component;
    private CuratorFramework lockClient;

    @BeforeMethod
    public void setUp() throws Exception {
        testingServer = new TestingServer();
        component = new TestingComponent();

        Batch testBatch = new Batch(BATCHID);
        testBatch.setRoundTripNumber(ROUNDTRIPNUMBER);
        Event testEvent = new Event();
        testEvent.setEventID("Data_Received");
        testEvent.setSuccess(true);
        testEvent.setDate(new Date());
        testEvent.setDetails("");

        testBatch.setEventList(new ArrayList<>(Arrays.asList(testEvent)));

        component.setBatches(new ArrayList<>(Arrays.asList(testBatch)));

        lockClient = CuratorFrameworkFactory.newClient(
                testingServer.getConnectString(), new ExponentialBackoffRetry(1000, 3));
        lockClient.start();

        autonoumous = new AutonomousComponent(component,
                lockClient, 1,
                Arrays.asList("Data_Received"),
                null,
                null,
                DEFAULT_TIMEOUT,
                DEFAULT_TIMEOUT,
                DEFAULT_TIMEOUT,
                component.getEventTrigger(),
                component.getEventStorer());
    }

    @AfterMethod
    public void tearDown() throws Exception {
        lockClient.close();
{'fraction_non_alphanumeric': 0.08567990373044525, 'fraction_numerical': 0.00914560770156438, 'mean_word_length': 3.156, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 7, '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': '7493491', 'n_tokens_mistral': 1146, 'n_tokens_neox': 1088, 'n_words': 221}