use of io.gravitee.rest.api.model.settings.Maintenance in project gravitee-management-rest-api by gravitee-io.
the class ConsoleSettingsResourceTest method shouldCallSaveMethod_EnabledMaintenance.
@Test
public void shouldCallSaveMethod_EnabledMaintenance() {
ConsoleSettingsEntity config = new ConsoleSettingsEntity();
Maintenance maintenance = new Maintenance();
maintenance.setEnabled(true);
config.setMaintenance(maintenance);
when(parameterService.findAsBoolean(Key.MAINTENANCE_MODE_ENABLED, GraviteeContext.getCurrentOrganization(), ParameterReferenceType.ORGANIZATION)).thenReturn(false);
final Response response = orgTarget().request().post(Entity.json(config));
assertEquals(response.readEntity(String.class), OK_200, response.getStatus());
verify(configService).save(any(ConsoleSettingsEntity.class));
}
use of io.gravitee.rest.api.model.settings.Maintenance in project gravitee-management-rest-api by gravitee-io.
the class ConsoleSettingsResourceTest method shouldNotCallSaveMethod_MaintenanceAlreadyEnabled.
@Test
public void shouldNotCallSaveMethod_MaintenanceAlreadyEnabled() {
ConsoleSettingsEntity config = new ConsoleSettingsEntity();
Maintenance maintenance = new Maintenance();
maintenance.setEnabled(true);
config.setMaintenance(maintenance);
when(parameterService.findAsBoolean(Key.MAINTENANCE_MODE_ENABLED, GraviteeContext.getCurrentOrganization(), ParameterReferenceType.ORGANIZATION)).thenReturn(true);
final Response response = orgTarget().request().post(Entity.json(config));
assertEquals(response.readEntity(String.class), SERVICE_UNAVAILABLE_503, response.getStatus());
verify(configService, never()).save(any(ConsoleSettingsEntity.class));
}
use of io.gravitee.rest.api.model.settings.Maintenance in project gravitee-management-rest-api by gravitee-io.
the class ConsoleSettingsResourceTest method shouldCallSaveMethod.
@Test
public void shouldCallSaveMethod() {
ConsoleSettingsEntity config = new ConsoleSettingsEntity();
config.setMaintenance(new Maintenance());
when(parameterService.findAsBoolean(Key.MAINTENANCE_MODE_ENABLED, GraviteeContext.getCurrentOrganization(), ParameterReferenceType.ORGANIZATION)).thenReturn(false);
final Response response = orgTarget().request().post(Entity.json(config));
assertEquals(response.readEntity(String.class), OK_200, response.getStatus());
verify(configService).save(any(ConsoleSettingsEntity.class));
}
Aggregations