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();
}
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);
}
Aggregations