Search in sources :

Example 1 with AlarmTestComponent

use of alma.alarmContainerTest.AlarmTestComponent in project ACS by ACS-Community.

the class ContainerLoggingAlarmTest method testLogOverflowNoThrottle.

/**
	 */
@Test
public void testLogOverflowNoThrottle() throws Exception {
    String compName = "TestcompJavaUnthrottled";
    int numLogs = 10000;
    // The level must be INFO or higher so that it gets dropped only when the queue is 100% full.
    // DEBUG and below levels get dropped already at 70% full.
    AcsLogLevelDefinition level = AcsLogLevelDefinition.INFO;
    AlarmTestComponent comp = AlarmTestComponentHelper.narrow(getContainerServices().getComponent(compName));
    StopWatch sw = new StopWatch(m_logger);
    comp.logBurst((short) level.value, numLogs);
    sw.logLapTime("send " + numLogs + " " + level.name() + " logs from component " + compName, AcsLogLevel.INFO);
    // now send Debug logs at max speed, to check how they get dropped in the log queue
    numLogs = 1000;
    level = AcsLogLevelDefinition.DEBUG;
    comp.logBurst((short) level.value, numLogs);
    sw.logLapTime("send " + numLogs + " " + level.name() + " logs from component " + compName, AcsLogLevel.INFO);
    // sleep a bit so that the log queue can drain. This gives a chance to see the "no longer dropping" kind of message
    Thread.sleep(2000);
    comp.logBurst((short) level.value, numLogs);
    sw.logLapTime("send " + numLogs + " " + level.name() + " logs from component " + compName, AcsLogLevel.INFO);
    getContainerServices().releaseComponent(compName);
}
Also used : AcsLogLevelDefinition(alma.acs.logging.level.AcsLogLevelDefinition) AlarmTestComponent(alma.alarmContainerTest.AlarmTestComponent) StopWatch(alma.acs.util.StopWatch) Test(org.junit.Test)

Example 2 with AlarmTestComponent

use of alma.alarmContainerTest.AlarmTestComponent in project ACS by ACS-Community.

the class ContainerLoggingAlarmTest method testLogThrottleAlarm.

@Test
public void testLogThrottleAlarm() throws Exception {
    int numLogs = 1000;
    AcsLogLevelDefinition level = AcsLogLevelDefinition.DEBUG;
    String compName = "TestcompJavaThrottled";
    AlarmTestComponent comp = AlarmTestComponentHelper.narrow(getContainerServices().getComponent(compName));
    StopWatch sw = new StopWatch(m_logger);
    comp.logBurst((short) level.value, numLogs);
    sw.logLapTime("send " + numLogs + " " + level.name() + " logs from component " + compName, AcsLogLevel.INFO);
    getContainerServices().releaseComponent(compName);
}
Also used : AcsLogLevelDefinition(alma.acs.logging.level.AcsLogLevelDefinition) AlarmTestComponent(alma.alarmContainerTest.AlarmTestComponent) StopWatch(alma.acs.util.StopWatch) Test(org.junit.Test)

Aggregations

AcsLogLevelDefinition (alma.acs.logging.level.AcsLogLevelDefinition)2 StopWatch (alma.acs.util.StopWatch)2 AlarmTestComponent (alma.alarmContainerTest.AlarmTestComponent)2 Test (org.junit.Test)2