<commit_before>package stroom.search;

import stroom.test.TestDataFieldDefinition;
import stroom.test.TestDataGenerator;

import java.time.LocalDate;
import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter;
import java.util.Arrays;

public class NetworkMonitoringDataGenerator {

    //Date, Time, EventType, Device, UserName, ID, ErrorCode, IPAddress, Server, Message
    //18/12/2007,13:21:48,authorisationFailed,device4,user5,192.168.0.2,E0567,192.168.0.3,server4,Another message that I made up 2

    public static void main(String[] args) {
        LocalDateTime startInc = LocalDateTime.of(2016, 1, 1, 0, 0, 0);
        LocalDateTime endExc = LocalDateTime.of(2018, 1, 1, 0, 0, 0);

        TestDataFieldDefinition dateField = TestDataFieldDefinition.randomDateTime(
                "Date",
                startInc,
                endExc,
                DateTimeFormatter.ofPattern("dd/MM/yyyy"));

        TestDataFieldDefinition timeField = TestDataFieldDefinition.randomDateTime(
                "Time",
                startInc,
                endExc,
                DateTimeFormatter.ofPattern("HH:mm:ss"));

        TestDataFieldDefinition eventTypeField = TestDataFieldDefinition.randomValueField(
                "EventType",
                Arrays.asList(
                        "authenticationFailed",
                        "authorisationFailed",
                        "login"));

        TestDataFieldDefinition deviceField = TestDataFieldDefinition.randomNumberedValueField(
                "Device",
                "device%s",
                100);

        TestDataFieldDefinition userNameField = TestDataFieldDefinition.randomNumberedValueField(
                "UserName",
                "user-%s",
                100);

        TestDataFieldDefinition idField = TestDataFieldDefinition.randomIpV4Field("ID");

        TestDataFieldDefinition errorCodeField = TestDataFieldDefinition.randomNumberedValueField(
                "ErrorCode",
                "E%03d",
                1000);

        TestDataFieldDefinition ipAddressField = TestDataFieldDefinition.randomIpV4Field("IPAddress");

        TestDataFieldDefinition serverField = TestDataFieldDefinition.randomNumberedValueField(
                "Server",
                "server-%s",
                100);

        TestDataFieldDefinition messageField = TestDataFieldDefinition.randomClassNames(
                "Message",
                0,
                3);

        TestDataGenerator.buildDefinition()
                .addFieldDefinition(dateField)
                .addFieldDefinition(timeField)
                .addFieldDefinition(eventTypeField)
                .addFieldDefinition(deviceField)
                .addFieldDefinition(userNameField)
                .addFieldDefinition(idField)
                .addFieldDefinition(errorCodeField)
                .addFieldDefinition(ipAddressField)
                .addFieldDefinition(serverField)
                .addFieldDefinition(messageField)<commit_msg>gh-634 Refactor NetworkMonitoringDataGenerator<commit_after>package stroom.search;

import stroom.test.TestDataFieldDefinition;
import stroom.test.TestDataGenerator;

import java.time.LocalDate;
import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter;
import java.util.Arrays;

public class NetworkMonitoringDataGenerator {

    //Date, Time, EventType, Device, UserName, ID, ErrorCode, IPAddress, Server, Message
    //18/12/2007,13:21:48,authorisationFailed,device4,user5,192.168.0.2,E0567,192.168.0.3,server4,Another message that I made up 2

    public static void main(String[] args) {
        LocalDateTime startInc = LocalDateTime.of(2016, 1, 1, 0, 0, 0);
        LocalDateTime endExc = LocalDateTime.of(2018, 1, 1, 0, 0, 0);

        TestDataGenerator.buildDefinition()
                .addFieldDefinition(TestDataFieldDefinition.randomDateTime(
                        "Date",
                        startInc,
                        endExc,
                        DateTimeFormatter.ofPattern("dd/MM/yyyy")))
                .addFieldDefinition(TestDataFieldDefinition.randomDateTime(
                        "Time",
                        startInc,
                        endExc,
                        DateTimeFormatter.ofPattern("HH:mm:ss")))
                .addFieldDefinition(TestDataFieldDefinition.randomValueField(
                        "EventType",
                        Arrays.asList(
                                "authenticationFailed",
                                "authorisationFailed",
                                "login")))
                .addFieldDefinition(TestDataFieldDefinition.randomNumberedValueField(
                        "Device",
                        "device%s",
                        100))
                .addFieldDefinition(TestDataFieldDefinition.randomNumberedValueField(
                        "UserName",
                        "user-%s",
                        100))
                .addFieldDefinition(TestDataFieldDefinition.randomIpV4Field("ID"))
                .addFieldDefinition(TestDataFieldDefinition.randomNumberedValueField(
                        "ErrorCode",
                        "E%03d",
                        1000))
                .addFieldDefinition(TestDataFieldDefinition.randomIpV4Field("IPAddress"))
                .addFieldDefinition(TestDataFieldDefinition.randomNumberedValueField(
                        "Server",
                        "server-%s",
                        100))
                .addFieldDefinition(TestDataFieldDefinition.randomClassNames(
                        "Message",
                        0,
                        3))
{'fraction_non_alphanumeric': 0.08127084430401967, 'fraction_numerical': 0.026856240126382307, 'mean_word_length': 1.8320079522862822, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 4, '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': '3145054', 'n_tokens_mistral': 1500, 'n_tokens_neox': 1314, 'n_words': 219}