Search in sources :

Example 1 with Logging

use of io.gravitee.rest.api.model.settings.Logging in project gravitee-management-rest-api by gravitee-io.

the class ConfigServiceTest method shouldCreateConsoleSettings.

@Test
public void shouldCreateConsoleSettings() {
    ConsoleSettingsEntity consoleSettingsEntity = new ConsoleSettingsEntity();
    consoleSettingsEntity.getAlert().setEnabled(true);
    Logging logging = new Logging();
    logging.setMaxDurationMillis(3000l);
    Logging.Audit audit = new Logging.Audit();
    audit.setEnabled(true);
    Logging.Audit.AuditTrail trail = new Logging.Audit.AuditTrail();
    trail.setEnabled(true);
    audit.setTrail(trail);
    logging.setAudit(audit);
    Logging.User user = new Logging.User();
    user.setDisplayed(true);
    logging.setUser(user);
    consoleSettingsEntity.setLogging(logging);
    when(mockParameterService.save(ALERT_ENABLED, "true", "DEFAULT", ParameterReferenceType.ORGANIZATION)).thenReturn(new Parameter());
    when(mockParameterService.save(LOGGING_DEFAULT_MAX_DURATION, "3000", "DEFAULT", ParameterReferenceType.ORGANIZATION)).thenReturn(new Parameter());
    when(mockParameterService.save(LOGGING_USER_DISPLAYED, "true", "DEFAULT", ParameterReferenceType.ORGANIZATION)).thenReturn(new Parameter());
    when(mockParameterService.save(LOGGING_AUDIT_ENABLED, "true", "DEFAULT", ParameterReferenceType.ORGANIZATION)).thenReturn(new Parameter());
    when(mockParameterService.save(LOGGING_AUDIT_TRAIL_ENABLED, "true", "DEFAULT", ParameterReferenceType.ORGANIZATION)).thenReturn(new Parameter());
    configService.save(consoleSettingsEntity);
    verify(mockParameterService, times(1)).save(ALERT_ENABLED, "true", "DEFAULT", ParameterReferenceType.ORGANIZATION);
    verify(mockParameterService, times(1)).save(LOGGING_DEFAULT_MAX_DURATION, "3000", "DEFAULT", ParameterReferenceType.ORGANIZATION);
    verify(mockParameterService, times(1)).save(LOGGING_USER_DISPLAYED, "true", "DEFAULT", ParameterReferenceType.ORGANIZATION);
    verify(mockParameterService, times(1)).save(LOGGING_AUDIT_ENABLED, "true", "DEFAULT", ParameterReferenceType.ORGANIZATION);
    verify(mockParameterService, times(1)).save(LOGGING_AUDIT_TRAIL_ENABLED, "true", "DEFAULT", ParameterReferenceType.ORGANIZATION);
}
Also used : Logging(io.gravitee.rest.api.model.settings.Logging) ConsoleSettingsEntity(io.gravitee.rest.api.model.settings.ConsoleSettingsEntity) Parameter(io.gravitee.repository.management.model.Parameter) Test(org.junit.Test)

Aggregations

Parameter (io.gravitee.repository.management.model.Parameter)1 ConsoleSettingsEntity (io.gravitee.rest.api.model.settings.ConsoleSettingsEntity)1 Logging (io.gravitee.rest.api.model.settings.Logging)1 Test (org.junit.Test)1