Search in sources :

Example 6 with ApplicationTypeEntity

use of io.gravitee.rest.api.model.configuration.application.ApplicationTypeEntity in project gravitee-management-rest-api by gravitee-io.

the class ApplicationResource method getApplicationType.

@GET
@Path("configuration")
@Produces(MediaType.APPLICATION_JSON)
@ApiOperation(value = "Get application type definition of an application", notes = "User must have the READ permission to use this service")
@ApiResponses({ @ApiResponse(code = 200, message = "ApplicationType", response = ApplicationType.class), @ApiResponse(code = 500, message = "Internal server error") })
@Permissions({ @Permission(value = RolePermission.APPLICATION_DEFINITION, acls = RolePermissionAction.READ) })
public Response getApplicationType() {
    ApplicationEntity applicationEntity = applicationService.findById(application);
    ApplicationTypeEntity applicationType = applicationTypeService.getApplicationType(applicationEntity.getType());
    return Response.ok(applicationType).build();
}
Also used : ApplicationTypeEntity(io.gravitee.rest.api.model.configuration.application.ApplicationTypeEntity) Permissions(io.gravitee.rest.api.management.rest.security.Permissions)

Example 7 with ApplicationTypeEntity

use of io.gravitee.rest.api.model.configuration.application.ApplicationTypeEntity in project gravitee-management-rest-api by gravitee-io.

the class ApplicationService_CreateTest method shouldNotCreateBecauseGrantTypesIsNotAllowed.

@Test(expected = ApplicationGrantTypesNotAllowedException.class)
public void shouldNotCreateBecauseGrantTypesIsNotAllowed() {
    ApplicationSettings settings = new ApplicationSettings();
    OAuthClientSettings clientSettings = new OAuthClientSettings();
    clientSettings.setApplicationType("web");
    clientSettings.setGrantTypes(Arrays.asList("foobar"));
    settings.setoAuthClient(clientSettings);
    ApplicationTypeEntity applicationType = mock(ApplicationTypeEntity.class);
    when(applicationTypeService.getApplicationType(any())).thenReturn(applicationType);
    when(newApplication.getSettings()).thenReturn(settings);
    when(parameterService.findAsBoolean(Key.APPLICATION_REGISTRATION_ENABLED, "DEFAULT", ParameterReferenceType.ENVIRONMENT)).thenReturn(Boolean.TRUE);
    when(parameterService.findAsBoolean(Key.APPLICATION_TYPE_WEB_ENABLED, "DEFAULT", ParameterReferenceType.ENVIRONMENT)).thenReturn(Boolean.TRUE);
    applicationService.create(newApplication, USER_NAME);
}
Also used : ApplicationSettings(io.gravitee.rest.api.model.application.ApplicationSettings) SimpleApplicationSettings(io.gravitee.rest.api.model.application.SimpleApplicationSettings) OAuthClientSettings(io.gravitee.rest.api.model.application.OAuthClientSettings) ApplicationTypeEntity(io.gravitee.rest.api.model.configuration.application.ApplicationTypeEntity) Test(org.junit.Test)

Aggregations

ApplicationTypeEntity (io.gravitee.rest.api.model.configuration.application.ApplicationTypeEntity)7 ApplicationSettings (io.gravitee.rest.api.model.application.ApplicationSettings)3 OAuthClientSettings (io.gravitee.rest.api.model.application.OAuthClientSettings)3 SimpleApplicationSettings (io.gravitee.rest.api.model.application.SimpleApplicationSettings)3 Test (org.junit.Test)3 ObjectMapper (com.fasterxml.jackson.databind.ObjectMapper)2 ApplicationGrantTypeEntity (io.gravitee.rest.api.model.configuration.application.ApplicationGrantTypeEntity)2 ApplicationTypesEntity (io.gravitee.rest.api.model.configuration.application.ApplicationTypesEntity)2 ApplicationTypeService (io.gravitee.rest.api.service.configuration.application.ApplicationTypeService)2 IOException (java.io.IOException)2 Autowired (org.springframework.beans.factory.annotation.Autowired)2 Component (org.springframework.stereotype.Component)2 JsonProcessingException (com.fasterxml.jackson.core.JsonProcessingException)1 JsonNode (com.fasterxml.jackson.databind.JsonNode)1 Page (io.gravitee.common.data.domain.Page)1 TechnicalException (io.gravitee.repository.exceptions.TechnicalException)1 ApplicationRepository (io.gravitee.repository.management.api.ApplicationRepository)1 MembershipRepository (io.gravitee.repository.management.api.MembershipRepository)1 ApplicationCriteria (io.gravitee.repository.management.api.search.ApplicationCriteria)1 io.gravitee.repository.management.model (io.gravitee.repository.management.model)1