fixed tests

This commit is contained in:
anhefti 2021-09-28 10:13:15 +02:00
parent 9d9b4a949c
commit 0c714df6bf
2 changed files with 9 additions and 6 deletions

View file

@ -25,6 +25,7 @@ import org.springframework.util.MultiValueMap;
import org.springframework.web.bind.WebDataBinder; import org.springframework.web.bind.WebDataBinder;
import org.springframework.web.bind.annotation.InitBinder; import org.springframework.web.bind.annotation.InitBinder;
import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod; import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.RequestParam;
@ -56,7 +57,6 @@ import ch.ethz.seb.sebserver.webservice.servicelayer.validation.BeanValidationSe
import io.swagger.v3.oas.annotations.Operation; import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.Parameter; import io.swagger.v3.oas.annotations.Parameter;
import io.swagger.v3.oas.annotations.media.Content; import io.swagger.v3.oas.annotations.media.Content;
import io.swagger.v3.oas.annotations.parameters.RequestBody;
import io.swagger.v3.oas.annotations.security.SecurityRequirement; import io.swagger.v3.oas.annotations.security.SecurityRequirement;
/** Abstract Entity-Controller that defines generic Entity rest API endpoints that are supported /** Abstract Entity-Controller that defines generic Entity rest API endpoints that are supported
@ -136,7 +136,7 @@ public abstract class EntityController<T extends Entity, M extends Entity> {
* @return Page of domain-model-entities of specified type */ * @return Page of domain-model-entities of specified type */
@Operation( @Operation(
summary = "Get a page of the specific domain entity. Sorting and filtering is applied before paging", summary = "Get a page of the specific domain entity. Sorting and filtering is applied before paging",
requestBody = @RequestBody( requestBody = @io.swagger.v3.oas.annotations.parameters.RequestBody(
content = { @Content(mediaType = MediaType.APPLICATION_FORM_URLENCODED_VALUE) }), content = { @Content(mediaType = MediaType.APPLICATION_FORM_URLENCODED_VALUE) }),
parameters = { parameters = {
@Parameter( @Parameter(
@ -217,7 +217,7 @@ public abstract class EntityController<T extends Entity, M extends Entity> {
@Operation( @Operation(
summary = "Get a filtered list of specific entity name keys.\n" + summary = "Get a filtered list of specific entity name keys.\n" +
"An entity name key is a minimal entity data object with the entity-type, modelId and the name of the entity.", "An entity name key is a minimal entity data object with the entity-type, modelId and the name of the entity.",
requestBody = @RequestBody( requestBody = @io.swagger.v3.oas.annotations.parameters.RequestBody(
content = { @Content(mediaType = MediaType.APPLICATION_FORM_URLENCODED_VALUE) }), content = { @Content(mediaType = MediaType.APPLICATION_FORM_URLENCODED_VALUE) }),
parameters = { parameters = {
@Parameter( @Parameter(
@ -345,7 +345,7 @@ public abstract class EntityController<T extends Entity, M extends Entity> {
consumes = MediaType.APPLICATION_FORM_URLENCODED_VALUE, consumes = MediaType.APPLICATION_FORM_URLENCODED_VALUE,
produces = MediaType.APPLICATION_JSON_VALUE) produces = MediaType.APPLICATION_JSON_VALUE)
public T create( public T create(
@RequestParam final MultiValueMap<String, String> formParams, @RequestParam final MultiValueMap<String, String> allRequestParams,
@RequestParam( @RequestParam(
name = API.PARAM_INSTITUTION_ID, name = API.PARAM_INSTITUTION_ID,
required = true, required = true,
@ -355,7 +355,7 @@ public abstract class EntityController<T extends Entity, M extends Entity> {
// check write privilege for requested institution and concrete entityType // check write privilege for requested institution and concrete entityType
this.checkWritePrivilege(institutionId); this.checkWritePrivilege(institutionId);
final POSTMapper postMap = new POSTMapper(formParams, request.getQueryString()) final POSTMapper postMap = new POSTMapper(allRequestParams, request.getQueryString())
.putIfAbsent(API.PARAM_INSTITUTION_ID, String.valueOf(institutionId)); .putIfAbsent(API.PARAM_INSTITUTION_ID, String.valueOf(institutionId));
final M requestModel = this.createNew(postMap); final M requestModel = this.createNew(postMap);

View file

@ -42,3 +42,6 @@ sebserver.webservice.lms.openedx.api.token.request.paths=/oauth2/access_token
sebserver.webservice.lms.moodle.api.token.request.paths sebserver.webservice.lms.moodle.api.token.request.paths
management.endpoints.web.base-path=/actuator management.endpoints.web.base-path=/actuator
springdoc.api-docs.enabled=false
springdoc.swagger-ui.enabled=false