<commit_before>package com.microsoft.applicationinsights;

import com.microsoft.applicationinsights.agent.ApplicationInsightsSender;
import com.microsoft.applicationinsights.contracts.ContainerStatsMetric;
import com.microsoft.applicationinsights.python.MetricCollectionPythonBoostrapper;
import org.junit.Assert;
import org.junit.BeforeClass;
import org.junit.Test;

import java.net.URL;

import static org.mockito.Matchers.any;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.times;
import static org.mockito.Mockito.verify;

/**
 * Created by yonisha on 8/3/2015.
 */
public class AgentBootstrapperTests {
    private static final String PYTHON_TEST_SCRIPT_FILENAME = "test_metric.py";
    private static MetricCollectionPythonBoostrapper metricCollectionPythonBoostrapper;
    private AgentBootstrapper agentBootstrapperUnderTest = new AgentBootstrapper();
    private ApplicationInsightsSender aiSenderMock = mock(ApplicationInsightsSender.class);

    @BeforeClass
    public static void initClass() {
        ClassLoader classLoader = AgentBootstrapperTests.class.getClassLoader();
        URL resource = classLoader.getResource(PYTHON_TEST_SCRIPT_FILENAME);

        Assert.assertNotNull(resource);

        String testScriptPath = resource.getPath().replaceFirst("/", "");

        metricCollectionPythonBoostrapper = new MetricCollectionPythonBoostrapper("custom", "--script", testScriptPath);
    }

    @Test
    public void testAgentBootrapperStartsMetricCollectionSuccessfully() throws InterruptedException {
        Thread thread = agentBootstrapperUnderTest.executeMetricCollectionProcess(aiSenderMock, metricCollectionPythonBoostrapper);

        thread.join(2000);

        verify(aiSenderMock, times(1)).sentMetric(any(ContainerStatsMetric.class));
    }
}<commit_msg>[Test] Increasing timeout for AgentBoostrapper test<commit_after>package com.microsoft.applicationinsights;

import com.microsoft.applicationinsights.agent.ApplicationInsightsSender;
import com.microsoft.applicationinsights.contracts.ContainerStatsMetric;
import com.microsoft.applicationinsights.python.MetricCollectionPythonBoostrapper;
import org.junit.Assert;
import org.junit.BeforeClass;
import org.junit.Test;

import java.net.URL;

import static org.mockito.Matchers.any;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.times;
import static org.mockito.Mockito.verify;

/**
 * Created by yonisha on 8/3/2015.
 */
public class AgentBootstrapperTests {
    private static final String PYTHON_TEST_SCRIPT_FILENAME = "test_metric.py";
    private static MetricCollectionPythonBoostrapper metricCollectionPythonBoostrapper;
    private AgentBootstrapper agentBootstrapperUnderTest = new AgentBootstrapper();
    private ApplicationInsightsSender aiSenderMock = mock(ApplicationInsightsSender.class);

    @BeforeClass
    public static void initClass() {
        ClassLoader classLoader = AgentBootstrapperTests.class.getClassLoader();
        URL resource = classLoader.getResource(PYTHON_TEST_SCRIPT_FILENAME);

        Assert.assertNotNull(resource);

        String testScriptPath = resource.getPath().replaceFirst("/", "");
        System.out.println("Found python test script at: " + testScriptPath);

        metricCollectionPythonBoostrapper = new MetricCollectionPythonBoostrapper("custom", "--script", testScriptPath);
    }

    @Test
    public void testAgentBootrapperStartsMetricCollectionSuccessfully() throws InterruptedException {
        Thread thread = agentBootstrapperUnderTest.executeMetricCollectionProcess(aiSenderMock, metricCollectionPythonBoostrapper);

        thread.join(5000);

        verify(aiSenderMock, times(1)).sentMetric(any(ContainerStatsMetric.class));
    }
}
{'fraction_non_alphanumeric': 0.08204168893639764, 'fraction_numerical': 0.005879208979155532, 'mean_word_length': 5.498263888888889, 'pattern_counts': {'":': 0, '<': 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': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4047193', 'n_tokens_mistral': 1026, 'n_tokens_neox': 970, 'n_words': 187}