Search in sources :

Example 1 with ConfigOption

use of io.aeron.agent.ConfigOption in project Aeron by real-logic.

the class AgentTests method agentmainShouldUseSystemPropertiesWhenAgentsArgsIsEmpty.

@ParameterizedTest
@NullAndEmptySource
void agentmainShouldUseSystemPropertiesWhenAgentsArgsIsEmpty(final String agentArgs) {
    System.setProperty(ENABLED_DRIVER_EVENT_CODES.propertyName(), "admin");
    System.setProperty(ENABLED_ARCHIVE_EVENT_CODES.propertyName(), "CMD_IN_EXTEND_RECORDING,REPLICATION_SESSION_STATE_CHANGE,CATALOG_RESIZE");
    System.setProperty(DISABLED_ARCHIVE_EVENT_CODES.propertyName(), "REPLICATION_SESSION_STATE_CHANGE");
    System.setProperty(ENABLED_CLUSTER_EVENT_CODES.propertyName(), "all");
    System.setProperty(DISABLED_CLUSTER_EVENT_CODES.propertyName(), "ROLE_CHANGE");
    System.setProperty(READER_CLASSNAME.propertyName(), TestLoggingAgent.class.getName());
    final int instanceCount = TestLoggingAgent.INSTANCE_COUNT.get();
    try {
        EventLogAgent.agentmain(agentArgs, ByteBuddyAgent.install());
        assertEquals(instanceCount + 1, TestLoggingAgent.INSTANCE_COUNT.get());
        assertEquals(EnumSet.complementOf(EnumSet.of(FRAME_IN, FRAME_OUT, NAME_RESOLUTION_NEIGHBOR_ADDED, NAME_RESOLUTION_NEIGHBOR_REMOVED)), DRIVER_EVENT_CODES);
        assertEquals(EnumSet.of(CMD_IN_EXTEND_RECORDING, CATALOG_RESIZE), ARCHIVE_EVENT_CODES);
        assertEquals(EnumSet.complementOf(EnumSet.of(ROLE_CHANGE)), CLUSTER_EVENT_CODES);
    } finally {
        for (final ConfigOption option : ConfigOption.values()) {
            System.clearProperty(option.propertyName());
        }
    }
}
Also used : ConfigOption(io.aeron.agent.ConfigOption) NullAndEmptySource(org.junit.jupiter.params.provider.NullAndEmptySource) ParameterizedTest(org.junit.jupiter.params.ParameterizedTest)

Example 2 with ConfigOption

use of io.aeron.agent.ConfigOption in project aeron by real-logic.

the class AgentTests method agentmainShouldUseSystemPropertiesWhenAgentsArgsIsEmpty.

@ParameterizedTest
@NullAndEmptySource
void agentmainShouldUseSystemPropertiesWhenAgentsArgsIsEmpty(final String agentArgs) {
    System.setProperty(ENABLED_DRIVER_EVENT_CODES.propertyName(), "admin");
    System.setProperty(ENABLED_ARCHIVE_EVENT_CODES.propertyName(), "CMD_IN_EXTEND_RECORDING,REPLICATION_SESSION_STATE_CHANGE,CATALOG_RESIZE");
    System.setProperty(DISABLED_ARCHIVE_EVENT_CODES.propertyName(), "REPLICATION_SESSION_STATE_CHANGE");
    System.setProperty(ENABLED_CLUSTER_EVENT_CODES.propertyName(), "all");
    System.setProperty(DISABLED_CLUSTER_EVENT_CODES.propertyName(), "ROLE_CHANGE");
    System.setProperty(READER_CLASSNAME.propertyName(), TestLoggingAgent.class.getName());
    final int instanceCount = TestLoggingAgent.INSTANCE_COUNT.get();
    try {
        EventLogAgent.agentmain(agentArgs, ByteBuddyAgent.install());
        assertEquals(instanceCount + 1, TestLoggingAgent.INSTANCE_COUNT.get());
        assertEquals(EnumSet.complementOf(EnumSet.of(FRAME_IN, FRAME_OUT, NAME_RESOLUTION_NEIGHBOR_ADDED, NAME_RESOLUTION_NEIGHBOR_REMOVED)), DRIVER_EVENT_CODES);
        assertEquals(EnumSet.of(CMD_IN_EXTEND_RECORDING, CATALOG_RESIZE), ARCHIVE_EVENT_CODES);
        assertEquals(EnumSet.complementOf(EnumSet.of(ROLE_CHANGE)), CLUSTER_EVENT_CODES);
    } finally {
        for (final ConfigOption option : ConfigOption.values()) {
            System.clearProperty(option.propertyName());
        }
    }
}
Also used : ConfigOption(io.aeron.agent.ConfigOption) NullAndEmptySource(org.junit.jupiter.params.provider.NullAndEmptySource) ParameterizedTest(org.junit.jupiter.params.ParameterizedTest)

Aggregations

ConfigOption (io.aeron.agent.ConfigOption)2 ParameterizedTest (org.junit.jupiter.params.ParameterizedTest)2 NullAndEmptySource (org.junit.jupiter.params.provider.NullAndEmptySource)2