<commit_before>/**
 * Logspace
 * Copyright (c) 2015 Indoqa Software Design und Beratung GmbH. All rights reserved.
 * This program and the accompanying materials are made available under the terms of
 * the Eclipse Public License Version 1.0, which accompanies this distribution and
 * is available at http://www.eclipse.org/legal/epl-v10.html.
 */
package io.logspace.agent.os;

import static org.junit.Assert.assertEquals;
import io.logspace.agent.impl.AgentControllerProvider;
import io.logspace.agent.impl.TestAgentController;

import org.junit.Test;

public class OsAgentTest {

    @Test
    public void test() {
        TestAgentController.installIfRequired("./target/test-events.json");
        TestAgentController agentController = (TestAgentController) AgentControllerProvider.getAgentController();

        assertEquals(0, agentController.getCollectedEvents().size());

        new CpuAgent("cpu-agent").execute(null);
        new DiskAgent("disk-agent").execute(null);
        new MemoryAgent("memory-agent").execute(null);
        new SwapAgent("swap-agent").execute(null);
        new SystemLoadAgent("system-load-agent").execute(null);

        assertEquals(5, agentController.getCollectedEvents().size());

        AgentControllerProvider.shutdown();
    }
}<commit_msg>Changed test expectation to work on systems with more root directories<commit_after>/**
 * Logspace
 * Copyright (c) 2015 Indoqa Software Design und Beratung GmbH. All rights reserved.
 * This program and the accompanying materials are made available under the terms of
 * the Eclipse Public License Version 1.0, which accompanies this distribution and
 * is available at http://www.eclipse.org/legal/epl-v10.html.
 */
package io.logspace.agent.os;

import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertTrue;
import io.logspace.agent.impl.AgentControllerProvider;
import io.logspace.agent.impl.TestAgentController;

import org.junit.Test;

public class OsAgentTest {

    @Test
    public void test() {
        TestAgentController.installIfRequired("./target/test-events.json");
        TestAgentController agentController = (TestAgentController) AgentControllerProvider.getAgentController();

        assertEquals(0, agentController.getCollectedEvents().size());

        new CpuAgent("cpu-agent").execute(null);
        new DiskAgent("disk-agent").execute(null);
        new MemoryAgent("memory-agent").execute(null);
        new SwapAgent("swap-agent").execute(null);
        new SystemLoadAgent("system-load-agent").execute(null);

        assertTrue("Expected at least 5 events.", agentController.getCollectedEvents().size() >= 5);

        AgentControllerProvider.shutdown();
    }
}
{'fraction_non_alphanumeric': 0.11053604436229206, 'fraction_numerical': 0.007763401109057301, 'mean_word_length': 4.183908045977011, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 4, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, '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': '679712', 'n_tokens_mistral': 730, 'n_tokens_neox': 695, 'n_words': 178}