Search in sources :

Example 11 with ConsoleSettingsEntity

use of io.gravitee.rest.api.model.settings.ConsoleSettingsEntity 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));
}
Also used : Response(javax.ws.rs.core.Response) ConsoleSettingsEntity(io.gravitee.rest.api.model.settings.ConsoleSettingsEntity) Maintenance(io.gravitee.rest.api.model.settings.Maintenance) Test(org.junit.Test)

Example 12 with ConsoleSettingsEntity

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

the class ConfigurationResourceTest method shouldGetConfiguration.

@Test
public void shouldGetConfiguration() {
    resetAllMocks();
    PortalSettingsEntity portalConfigEntity = new PortalSettingsEntity();
    ConsoleSettingsEntity consoleSettingsEntity = new ConsoleSettingsEntity();
    doReturn(portalConfigEntity).when(configService).getPortalSettings();
    doReturn(consoleSettingsEntity).when(configService).getConsoleSettings();
    final Response response = target().request().get();
    assertEquals(HttpStatusCode.OK_200, response.getStatus());
    Mockito.verify(configMapper).convert(portalConfigEntity, consoleSettingsEntity);
    Mockito.verify(configService).getPortalSettings();
    Mockito.verify(configService).getConsoleSettings();
}
Also used : PortalSettingsEntity(io.gravitee.rest.api.model.settings.PortalSettingsEntity) Response(javax.ws.rs.core.Response) ConsoleSettingsEntity(io.gravitee.rest.api.model.settings.ConsoleSettingsEntity) Test(org.junit.Test)

Aggregations

ConsoleSettingsEntity (io.gravitee.rest.api.model.settings.ConsoleSettingsEntity)12 Test (org.junit.Test)12 Response (javax.ws.rs.core.Response)8 UpdateUserEntity (io.gravitee.rest.api.model.UpdateUserEntity)3 UserEntity (io.gravitee.rest.api.model.UserEntity)3 Maintenance (io.gravitee.rest.api.model.settings.Maintenance)3 User (io.gravitee.rest.api.portal.rest.model.User)3 PortalSettingsEntity (io.gravitee.rest.api.model.settings.PortalSettingsEntity)2 Collections.singletonList (java.util.Collections.singletonList)2 HashMap (java.util.HashMap)2 List (java.util.List)2 Function (java.util.function.Function)2 ObjectMapper (com.fasterxml.jackson.databind.ObjectMapper)1 Parameter (io.gravitee.repository.management.model.Parameter)1 Logging (io.gravitee.rest.api.model.settings.Logging)1 Management (io.gravitee.rest.api.model.settings.Management)1 ConfigurationResponse (io.gravitee.rest.api.portal.rest.model.ConfigurationResponse)1 UserConfig (io.gravitee.rest.api.portal.rest.model.UserConfig)1