Search in sources :

Example 6 with SubSystemLoggerConfigurationType

use of com.evolveum.midpoint.xml.ns._public.common.common_3.SubSystemLoggerConfigurationType in project midpoint by Evolveum.

the class TestLoggingConfiguration method test002InitialConfiguration.

@Test
public void test002InitialConfiguration() throws Exception {
    final String TEST_NAME = "test002InitialConfiguration";
    TestUtil.displayTestTile(TEST_NAME);
    // GIVEN
    LogfileTestTailer tailer = new LogfileTestTailer(LoggingConfigurationManager.AUDIT_LOGGER_NAME);
    Task task = taskManager.createTaskInstance(TestLoggingConfiguration.class.getName() + "." + TEST_NAME);
    OperationResult result = task.getResult();
    PrismObject<SystemConfigurationType> systemConfiguration = PrismTestUtil.parseObject(SYSTEM_CONFIGURATION_FILE);
    LoggingConfigurationType logging = systemConfiguration.asObjectable().getLogging();
    applyTestLoggingConfig(logging);
    SubSystemLoggerConfigurationType modelSubSystemLogger = new SubSystemLoggerConfigurationType();
    modelSubSystemLogger.setComponent(LoggingComponentType.PROVISIONING);
    modelSubSystemLogger.setLevel(LoggingLevelType.TRACE);
    logging.getSubSystemLogger().add(modelSubSystemLogger);
    PrismObjectDefinition<SystemConfigurationType> systemConfigurationTypeDefinition = prismContext.getSchemaRegistry().findObjectDefinitionByCompileTimeClass(SystemConfigurationType.class);
    Collection<? extends ItemDelta> modifications = PropertyDelta.createModificationReplacePropertyCollection(SystemConfigurationType.F_LOGGING, systemConfigurationTypeDefinition, logging);
    // Modify directly in repository, so the logging code in model will not notice the change
    repositoryService.modifyObject(SystemConfigurationType.class, AbstractInitializedModelIntegrationTest.SYSTEM_CONFIGURATION_OID, modifications, result);
    // precondition
    tailer.logAndTail();
    assertBasicLogging(tailer);
    tailer.assertMarkerNotLogged(LogfileTestTailer.LEVEL_TRACE, ProfilingDataManager.Subsystem.PROVISIONING.name());
    // WHEN
    repositoryService.postInit(result);
    modelService.postInit(result);
    // THEN
    tailer.logAndTail();
    assertBasicLogging(tailer);
    tailer.assertMarkerLogged(LogfileTestTailer.LEVEL_TRACE, ProfilingDataManager.Subsystem.PROVISIONING.name());
    tailer.close();
}
Also used : LogfileTestTailer(com.evolveum.midpoint.test.util.LogfileTestTailer) Task(com.evolveum.midpoint.task.api.Task) LoggingConfigurationType(com.evolveum.midpoint.xml.ns._public.common.common_3.LoggingConfigurationType) OperationResult(com.evolveum.midpoint.schema.result.OperationResult) SystemConfigurationType(com.evolveum.midpoint.xml.ns._public.common.common_3.SystemConfigurationType) SubSystemLoggerConfigurationType(com.evolveum.midpoint.xml.ns._public.common.common_3.SubSystemLoggerConfigurationType) Test(org.testng.annotations.Test)

Aggregations

SubSystemLoggerConfigurationType (com.evolveum.midpoint.xml.ns._public.common.common_3.SubSystemLoggerConfigurationType)6 ClassLoggerConfigurationType (com.evolveum.midpoint.xml.ns._public.common.common_3.ClassLoggerConfigurationType)3 LoggingConfigurationType (com.evolveum.midpoint.xml.ns._public.common.common_3.LoggingConfigurationType)3 OperationResult (com.evolveum.midpoint.schema.result.OperationResult)2 Task (com.evolveum.midpoint.task.api.Task)2 LogfileTestTailer (com.evolveum.midpoint.test.util.LogfileTestTailer)2 AuditingConfigurationType (com.evolveum.midpoint.xml.ns._public.common.common_3.AuditingConfigurationType)2 SystemConfigurationType (com.evolveum.midpoint.xml.ns._public.common.common_3.SystemConfigurationType)2 Test (org.testng.annotations.Test)2 ObjectDelta (com.evolveum.midpoint.prism.delta.ObjectDelta)1 AppenderConfigurationType (com.evolveum.midpoint.xml.ns._public.common.common_3.AppenderConfigurationType)1 FileAppenderConfigurationType (com.evolveum.midpoint.xml.ns._public.common.common_3.FileAppenderConfigurationType)1 ObjectType (com.evolveum.midpoint.xml.ns._public.common.common_3.ObjectType)1 SyslogAppenderConfigurationType (com.evolveum.midpoint.xml.ns._public.common.common_3.SyslogAppenderConfigurationType)1