<commit_before>package io.aeron.driver;

import io.aeron.driver.media.UdpChannel;
import org.junit.jupiter.params.ParameterizedTest;
import org.junit.jupiter.params.provider.Arguments;
import org.junit.jupiter.params.provider.MethodSource;
import org.junit.jupiter.params.provider.ValueSource;

import java.util.stream.Stream;

import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertThrows;

class TaggedMulticastFlowControlTest
{
    private static final int DEFAULT_GROUP_SIZE = 0;
    private static final long DEFAULT_RTAG = new TaggedMulticastFlowControl().getRtag();
    private static final long DEFAULT_TIMEOUT = new TaggedMulticastFlowControl().getReceiverTimeoutNs();

    private final TaggedMulticastFlowControl flowControl = new TaggedMulticastFlowControl();

    private static Stream<Arguments> validUris()
    {
        return Stream.of(
            Arguments.of(
                "aeron:udp?endpoint=172.16.58.3:54326|interface=localhost|fc=tagged",
                DEFAULT_RTAG, DEFAULT_GROUP_SIZE, DEFAULT_TIMEOUT),
            Arguments.of(
                "aeron:udp?endpoint=172.16.58.3:54326|interface=localhost|fc=tagged,t:100ms",
                DEFAULT_RTAG, DEFAULT_GROUP_SIZE, 100_000_000),
            Arguments.of(
                "aeron:udp?endpoint=172.16.58.3:54326|interface=localhost|fc=tagged,g:123",
                123, DEFAULT_GROUP_SIZE, DEFAULT_TIMEOUT),
            Arguments.of(
                "aeron:udp?endpoint=172.16.58.3:54326|interface=localhost|fc=tagged,g:3000000000",
                3_000_000_000L, DEFAULT_GROUP_SIZE, DEFAULT_TIMEOUT),
            Arguments.of(
                "aeron:udp?endpoint=172.16.58.3:54326|interface=localhost|fc=tagged,g:123,t:100ms",
                123, DEFAULT_GROUP_SIZE, 100_000_000),
            Arguments.of(
                "aeron:udp?endpoint=172.16.58.3:54326|interface=localhost|fc=tagged,g:100/10",
                100, 10, DEFAULT_TIMEOUT),
            Arguments.of(
                "aeron:udp?endpoint=172.16.58.3:54326|interface=localhost|fc=tagged,g:/10",
                DEFAULT_RTAG, 10, DEFAULT_TIMEOUT),
            Arguments.of(
                "aeron:udp?endpoint=172.16.58.3:54326|interface=localhost|fc=tagged,g:100/10,t:100ms",
                100, 10, 100_000_000));
    }

    @ParameterizedTest
    @MethodSource("validUris")
    void shouldParseValidFlowControlConfiguration(
        final String uri,
        final long rtag,
        final int groupSize,
        final long timeout)
    {
        flowControl.initialize(UdpChannel.parse(uri), 0, 0);

        assertEquals(rtag, flowControl.getRtag());
        assertEquals(groupSize, flowControl.getRequiredGroupSize());
        assertEquals(timeout, flowControl.getReceiverTimeoutNs());
    }

    @ParameterizedTest
    @ValueSource(
        strings = {
            "aeron:udp?endpoint=172.16.58.3:54326|interface=localhost|fc=tagged,g:",
            "aeron:udp?endpoint=172.16.58.3:54326|interface=localhost|fc=tagged,g:100/",
            "aeron:udp?endpoint=172.16.58.3:54326|interface=localhost|fc=tagged,g:/",
            "aeron:udp?endpoint=172.16.58.3:54326|interface=localhost|fc=tagged,t:",
            "aeron:udp?endpoint=172.16.58.3:54326|interface=localhost|fc=tagged,g:100,t:",
            "aeron:udp?endpoint=172.16.58.3:54326|interface=localhost|fc=tagged,t:100ms,g:100/",
        }
    )
    void shouldFailWithInvalidUris(final String uri)
    {
        assertThrows(Exception.class, () -> flowControl.initialize(UdpChannel.parse(uri), 0, 0));
    }
}<commit_msg>[Java] Checkstyle, indenting.<commit_after>package io.aeron.driver;

import io.aeron.driver.media.UdpChannel;
import org.junit.jupiter.params.ParameterizedTest;
import org.junit.jupiter.params.provider.Arguments;
import org.junit.jupiter.params.provider.MethodSource;
import org.junit.jupiter.params.provider.ValueSource;

import java.util.stream.Stream;

import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertThrows;

class TaggedMulticastFlowControlTest
{
    private static final int DEFAULT_GROUP_SIZE = 0;
    private static final long DEFAULT_RTAG = new TaggedMulticastFlowControl().getRtag();
    private static final long DEFAULT_TIMEOUT = new TaggedMulticastFlowControl().getReceiverTimeoutNs();

    private final TaggedMulticastFlowControl flowControl = new TaggedMulticastFlowControl();

    private static Stream<Arguments> validUris()
    {
        return Stream.of(
            Arguments.of(
                "aeron:udp?endpoint=172.16.58.3:54326|interface=localhost|fc=tagged",
                DEFAULT_RTAG, DEFAULT_GROUP_SIZE, DEFAULT_TIMEOUT),
            Arguments.of(
                "aeron:udp?endpoint=172.16.58.3:54326|interface=localhost|fc=tagged,t:100ms",
                DEFAULT_RTAG, DEFAULT_GROUP_SIZE, 100_000_000),
            Arguments.of(
                "aeron:udp?endpoint=172.16.58.3:54326|interface=localhost|fc=tagged,g:123",
                123, DEFAULT_GROUP_SIZE, DEFAULT_TIMEOUT),
            Arguments.of(
                "aeron:udp?endpoint=172.16.58.3:54326|interface=localhost|fc=tagged,g:3000000000",
                3_000_000_000L, DEFAULT_GROUP_SIZE, DEFAULT_TIMEOUT),
            Arguments.of(
                "aeron:udp?endpoint=172.16.58.3:54326|interface=localhost|fc=tagged,g:123,t:100ms",
                123, DEFAULT_GROUP_SIZE, 100_000_000),
            Arguments.of(
                "aeron:udp?endpoint=172.16.58.3:54326|interface=localhost|fc=tagged,g:100/10",
                100, 10, DEFAULT_TIMEOUT),
            Arguments.of(
                "aeron:udp?endpoint=172.16.58.3:54326|interface=localhost|fc=tagged,g:/10",
                DEFAULT_RTAG, 10, DEFAULT_TIMEOUT),
            Arguments.of(
                "aeron:udp?endpoint=172.16.58.3:54326|interface=localhost|fc=tagged,g:100/10,t:100ms",
                100, 10, 100_000_000));
    }

    @ParameterizedTest
    @MethodSource("validUris")
    void shouldParseValidFlowControlConfiguration(
        final String uri,
        final long rtag,
        final int groupSize,
        final long timeout)
    {
        flowControl.initialize(UdpChannel.parse(uri), 0, 0);

        assertEquals(rtag, flowControl.getRtag());
        assertEquals(groupSize, flowControl.getRequiredGroupSize());
        assertEquals(timeout, flowControl.getReceiverTimeoutNs());
    }

    @ParameterizedTest
    @ValueSource(strings = {
        "aeron:udp?endpoint=172.16.58.3:54326|interface=localhost|fc=tagged,g:",
        "aeron:udp?endpoint=172.16.58.3:54326|interface=localhost|fc=tagged,g:100/",
        "aeron:udp?endpoint=172.16.58.3:54326|interface=localhost|fc=tagged,g:/",
        "aeron:udp?endpoint=172.16.58.3:54326|interface=localhost|fc=tagged,t:",
        "aeron:udp?endpoint=172.16.58.3:54326|interface=localhost|fc=tagged,g:100,t:",
        "aeron:udp?endpoint=172.16.58.3:54326|interface=localhost|fc=tagged,t:100ms,g:100/",
    })
    void shouldFailWithInvalidUris(final String uri)
    {
        assertThrows(Exception.class, () -> flowControl.initialize(UdpChannel.parse(uri), 0, 0));
    }
}
{'fraction_non_alphanumeric': 0.12207357859531773, 'fraction_numerical': 0.08110367892976589, 'mean_word_length': 3.2669441141498217, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 7, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 28, 'substrings_counts': 2, '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': '832736', 'n_tokens_mistral': 2679, 'n_tokens_neox': 2256, 'n_words': 273}