Here are the examples of the java api org.springframework.http.HttpStatus.CONFLICT taken from open source projects. By voting up you can indicate which examples are most useful and appropriate.
171 Examples
19
View Source File : AlreadyExistsException.java
License : MIT License
Project Creator : wuyc
License : MIT License
Project Creator : wuyc
@Override
public HttpStatus getStatus() {
return HttpStatus.CONFLICT;
}
19
View Source File : HesperidesScenario.java
License : GNU General Public License v3.0
Project Creator : voyages-sncf-technologies
License : GNU General Public License v3.0
Project Creator : voyages-sncf-technologies
protected void replacedertConflict() {
replacedertEquals(HttpStatus.CONFLICT, testContext.getResponseStatusCode());
}
19
View Source File : StatusResultMatchers.java
License : MIT License
Project Creator : Vip-Augus
License : MIT License
Project Creator : Vip-Augus
/**
* replacedert the response status code is {@code HttpStatus.CONFLICT} (409).
*/
public ResultMatcher isConflict() {
return matcher(HttpStatus.CONFLICT);
}
19
View Source File : RebalanceInProgressException.java
License : Apache License 2.0
Project Creator : provectus
License : Apache License 2.0
Project Creator : provectus
@Override
public HttpStatus getResponseStatusCode() {
return HttpStatus.CONFLICT;
}
19
View Source File : OwnedEntityService.java
License : MIT License
Project Creator : lealceldeiro
License : MIT License
Project Creator : lealceldeiro
// endregion
/**
* Creates and return an {@link EOwnedEnreplacedy}.
*
* @param e {@link EOwnedEnreplacedy} data.
* @return The created {@link EOwnedEnreplacedy}
* @throws GmsGeneralException if the server configuration is no set in order to create new Owned Enreplacedies
*/
public EOwnedEnreplacedy create(final EOwnedEnreplacedy e) throws GmsGeneralException {
if (configService.isMultiEnreplacedy()) {
return enreplacedyRepository.save(e);
}
throw GmsGeneralException.builder().messageI18N("enreplacedy.add.not_allowed").finishedOK(true).httpStatus(HttpStatus.CONFLICT).build();
}
19
View Source File : IdentitiesEndpoint_Creating_IT.java
License : MIT License
Project Creator : InnovateUKGitHub
License : MIT License
Project Creator : InnovateUKGitHub
// 409
@Test
public void onCreationDuplicateEmail() throws IOException {
withValidAuthentication().and().contentType(ContentType.JSON).body(convertToJson(new NewIdenreplacedy(duplicateEmailForCreate, preplacedwordForCreate))).post(getBaseUrl() + "/idenreplacedies").then().replacedertThat().statusCode(is(equalTo(HttpStatus.CONFLICT.value()))).body("[0].key", is(equalTo("DUPLICATE_EMAIL_ADDRESS"))).body("[0].arguments", is(empty()));
}
19
View Source File : UserExeceptionHandler.java
License : GNU General Public License v3.0
Project Creator : hantsy
License : GNU General Public License v3.0
Project Creator : hantsy
@ExceptionHandler(value = { UsernameWasTakenException.clreplaced, EmailWasTakenException.clreplaced })
public ResponseEnreplacedy signupFailed(Exception ex, WebRequest req) {
Map<String, String> errorMsg = new HashMap<>();
errorMsg.put("code", "conflict");
errorMsg.put("message", ex.getMessage());
return status(HttpStatus.CONFLICT).body(errorMsg);
}
19
View Source File : EmailAlreadyVerifiedException.java
License : GNU Affero General Public License v3.0
Project Creator : ClimbAssist
License : GNU Affero General Public License v3.0
Project Creator : ClimbAssist
@Override
public HttpStatus getHttpStatus() {
return HttpStatus.CONFLICT;
}
19
View Source File : SlackControllerTests.java
License : Apache License 2.0
Project Creator : BBVA
License : Apache License 2.0
Project Creator : BBVA
@Test
public void setSlackTokenSlackErrorTest() throws Exception {
final DashboardDTO dashboard = TestObjectFactory.createDashboard();
final SlackDTO error_notification = TestObjectFactory.createSlackErrorDTO();
when(dashboardService.getDashboard(dashboard.getName())).thenReturn(dashboard);
when(slackService.getToken(dashboard.getSlackTeam(), SLACK_DUMMY, SLACK_DUMMY, SLACK_CODE)).thenReturn(error_notification);
this.mockMvc.perform(get("/slack/token-generator").param("code", SLACK_CODE).param("clientId", SLACK_DUMMY).param("clientSecret", SLACK_DUMMY).param("team", dashboard.getSlackTeam())).andExpect(status().is(HttpStatus.CONFLICT.value()));
}
19
View Source File : RestExceptionHandler.java
License : GNU Affero General Public License v3.0
Project Creator : Alovoa
License : GNU Affero General Public License v3.0
Project Creator : Alovoa
@ExceptionHandler
protected ResponseEnreplacedy<Object> handleConflict(Exception ex, WebRequest request) {
ex.printStackTrace();
return handleExceptionInternal(ex, ex.getMessage(), new HttpHeaders(), HttpStatus.CONFLICT, request);
}
19
View Source File : SB409ErrorMapper.java
License : Apache License 2.0
Project Creator : adorsys
License : Apache License 2.0
Project Creator : adorsys
@Override
public HttpStatus getErrorStatus() {
return HttpStatus.CONFLICT;
}
18
View Source File : StatusAssertionTests.java
License : MIT License
Project Creator : Vip-Augus
License : MIT License
Project Creator : Vip-Augus
@Test
public void reasonEquals() {
Statusreplacedertions replacedertions = statusreplacedertions(HttpStatus.CONFLICT);
// Success
replacedertions.reasonEquals("Conflict");
try {
replacedertions.reasonEquals("Request Timeout");
fail("Wrong reason expected");
} catch (replacedertionError error) {
// Expected
}
}
18
View Source File : StatusAssertionTests.java
License : MIT License
Project Creator : Vip-Augus
License : MIT License
Project Creator : Vip-Augus
@Test
public void matches() {
Statusreplacedertions replacedertions = statusreplacedertions(HttpStatus.CONFLICT);
// Success
replacedertions.value(equalTo(409));
replacedertions.value(greaterThan(400));
try {
replacedertions.value(equalTo(200));
fail("Wrong status expected");
} catch (replacedertionError error) {
// Expected
}
}
18
View Source File : TaskanaRestExceptionHandler.java
License : Apache License 2.0
Project Creator : Taskana
License : Apache License 2.0
Project Creator : Taskana
@ExceptionHandler(ClreplacedificationAlreadyExistException.clreplaced)
protected ResponseEnreplacedy<TaskanaErrorData> handleClreplacedificationAlreadyExist(ClreplacedificationAlreadyExistException ex, WebRequest req) {
return buildResponse(ex, req, HttpStatus.CONFLICT);
}
18
View Source File : StatusAssertionTests.java
License : Apache License 2.0
Project Creator : SourceHot
License : Apache License 2.0
Project Creator : SourceHot
@Test
public void matches() {
Statusreplacedertions replacedertions = statusreplacedertions(HttpStatus.CONFLICT);
// Success
replacedertions.value(equalTo(409));
replacedertions.value(greaterThan(400));
// Wrong status
replacedertThatExceptionOfType(replacedertionError.clreplaced).isThrownBy(() -> replacedertions.value(equalTo(200)));
}
18
View Source File : StatusAssertionTests.java
License : Apache License 2.0
Project Creator : SourceHot
License : Apache License 2.0
Project Creator : SourceHot
@Test
public void reasonEquals() {
Statusreplacedertions replacedertions = statusreplacedertions(HttpStatus.CONFLICT);
// Success
replacedertions.reasonEquals("Conflict");
// Wrong reason
replacedertThatExceptionOfType(replacedertionError.clreplaced).isThrownBy(() -> replacedertions.reasonEquals("Request Timeout"));
}
18
View Source File : CatalogServiceV3.java
License : Apache License 2.0
Project Creator : PaaS-TA
License : Apache License 2.0
Project Creator : PaaS-TA
/**
* 카탈로그 앱 이름 생성여부를 조회한다.
*
* @param name name(앱 이름)
* @param token HttpServletRequest(자바클래스)
* @param res HttpServletResponse(자바클래스)
* @return Map(자바클래스)
* @throws Exception Exception(자바클래스)
*/
public Map<String, Object> getCheckCatalogApplicationNameExists(String name, String orgid, String spaceid, String token, HttpServletResponse res) throws Exception {
ListApplicationsResponse listApplicationsResponse = cloudFoundryClient(tokenProvider(token)).applicationsV2().list(ListApplicationsRequest.builder().organizationId(orgid).spaceId(spaceid).build()).block();
for (ApplicationResource applicationResource : listApplicationsResponse.getResources()) {
if (applicationResource.getEnreplacedy().getName().equals(name)) {
commonService.getCustomSendError(res, HttpStatus.CONFLICT, "common.info.result.fail.duplicated");
}
}
return new HashMap<String, Object>() {
{
put("RESULT", Constants.RESULT_STATUS_SUCCESS);
}
};
}
18
View Source File : AuthorityController.java
License : Apache License 2.0
Project Creator : PaaS-TA
License : Apache License 2.0
Project Creator : PaaS-TA
/**
* @apiVersion 0.1.0
* @api {POST} /authorities Regist Authority
* @apiDescription 권한을 등록한다.
* @apiGroup Authorities
* @apiExample {curl} Example usage:
* curl 'http://localhost/authorities' -i -X POST \
* -H 'Authorization: Basic YWRtaW46Y2xvdWR==' \
* -H 'Content-Type: application/json' \
* -d '{ "displayName": "dashboard.user",
* "description": "dashboard user"
* }'
* @apiHeader {String} Authorization API 인증 토큰 (Basic)
* @apiHeader {String} Content-Type Body 데이터 타입.
* @apiParam {String} displayName 권한의 보여질 이름
* @apiParam {String} [description] 권한 설명
*/
@RequestMapping(value = "", method = RequestMethod.POST)
public Authority add(HttpServletResponse response, @RequestBody Authority newAuthority) throws IOException {
LOGGER.info("Add Authority: {}", newAuthority);
Authority result = null;
Authority authority = authorityService.getAuthorityByName(newAuthority.getDisplayName());
if (authority != null) {
LOGGER.info("Failed Add Authority: '{}' is already exist.", authority.getDisplayName());
response.sendError(HttpStatus.CONFLICT.value(), "Authority '" + authority.getDisplayName() + "' is already exist.");
} else {
newAuthority.setId(UUID.randomUUID().toString());
result = authorityService.createAuthority(newAuthority);
}
return result;
}
18
View Source File : ResponseUtil.java
License : MIT License
Project Creator : ls1intum
License : MIT License
Project Creator : ls1intum
public static <X> ResponseEnreplacedy<X> conflict(String enreplacedyName, String errorKey, String message) {
return ResponseEnreplacedy.status(HttpStatus.CONFLICT).headers(HeaderUtil.createFailureAlert(applicationName, true, enreplacedyName, errorKey, message)).build();
}
18
View Source File : ResponseUtil.java
License : MIT License
Project Creator : ls1intum
License : MIT License
Project Creator : ls1intum
public static <X> ResponseEnreplacedy<X> conflict() {
return ResponseEnreplacedy.status(HttpStatus.CONFLICT).build();
}
18
View Source File : WaveformsItemJsonController.java
License : Apache License 2.0
Project Creator : LLNL
License : Apache License 2.0
Project Creator : LLNL
/**
* @param storedWaveform
* @param waveform
* @param result
* @return ResponseEnreplacedy
*/
@PostMapping(name = "update")
public ResponseEnreplacedy<?> update(@Valid @RequestBody Waveform waveform, BindingResult result) {
if (result.hasErrors()) {
return ResponseEnreplacedy.status(HttpStatus.CONFLICT).body(result);
}
Waveform wave = getWaveformService().update(waveform);
return ResponseEnreplacedy.ok(wave);
}
18
View Source File : ValidationEventsJsonController.java
License : Apache License 2.0
Project Creator : LLNL
License : Apache License 2.0
Project Creator : LLNL
@PostMapping(value = "/delete/batch-by-evids", name = "deleteBatchByEvids")
public ResponseEnreplacedy<?> deleteBatchByEvids(@Valid @RequestBody Collection<String> eventIds, BindingResult result) {
if (result.hasErrors()) {
return ResponseEnreplacedy.status(HttpStatus.CONFLICT).body(result);
}
service.deleteAllByEventIds(eventIds);
return ResponseEnreplacedy.ok().build();
}
18
View Source File : ReferenceEventsJsonController.java
License : Apache License 2.0
Project Creator : LLNL
License : Apache License 2.0
Project Creator : LLNL
@PostMapping(value = "/batch", name = "createBatch")
public ResponseEnreplacedy<?> createBatch(@Valid @RequestBody Collection<ReferenceMwParameters> referenceEvents, BindingResult result) {
if (result.hasErrors()) {
return ResponseEnreplacedy.status(HttpStatus.CONFLICT).body(result);
}
service.save(referenceEvents);
return ResponseEnreplacedy.ok().build();
}
18
View Source File : CalibrationJsonController.java
License : Apache License 2.0
Project Creator : LLNL
License : Apache License 2.0
Project Creator : LLNL
// TODO: A little gross API wise to cram this here but will do for now. Revisit in V2
@PostMapping(value = "/toggle-validation/batch-by-evids", name = "toggleValidationByEvids")
public ResponseEnreplacedy<?> deleteBatchByEvids(@Valid @RequestBody List<String> eventIds, BindingResult result) {
if (result.hasErrors()) {
return ResponseEnreplacedy.status(HttpStatus.CONFLICT).body(result);
}
return ResponseEnreplacedy.ok(service.toggleAllByEventIds(eventIds));
}
18
View Source File : ExceptionsHandlerTest.java
License : Apache License 2.0
Project Creator : kiegroup
License : Apache License 2.0
Project Creator : kiegroup
@Test
void testConflict() {
ResponseEnreplacedy responseEnreplacedy = tested.conflict(body);
replacedertResponse(responseEnreplacedy, HttpStatus.CONFLICT);
}
18
View Source File : RestResponseEntityExceptionHandler.java
License : Apache License 2.0
Project Creator : ivans-innovation-lab
License : Apache License 2.0
Project Creator : ivans-innovation-lab
@ExceptionHandler({ InvalidDataAccessApiUsageException.clreplaced, DataAccessException.clreplaced })
protected ResponseEnreplacedy<Object> handleConflict(final RuntimeException ex, final WebRequest request) {
final String bodyOfResponse = "DataAccessException";
LOG.error(bodyOfResponse, ex);
return handleExceptionInternal(ex, bodyOfResponse, new HttpHeaders(), HttpStatus.CONFLICT, request);
}
18
View Source File : IdentitiesEndpoint_Updating_IT.java
License : MIT License
Project Creator : InnovateUKGitHub
License : MIT License
Project Creator : InnovateUKGitHub
// 409
@Test
public void onUpdateEmailWithDuplicateEmail() throws IOException {
withValidAuthentication().and().contentType(ContentType.JSON).body(convertToJson(new ChangeEmail(duplicateEmailForUpdate))).put(getBaseUrl() + "/idenreplacedies/" + uuidForUpdatingEmail + "/email").then().replacedertThat().statusCode(is(equalTo(HttpStatus.CONFLICT.value()))).body("[0].key", is(equalTo("DUPLICATE_EMAIL_ADDRESS"))).body("[0].arguments", is(empty()));
}
18
View Source File : RestResponseEntityExceptionHandler.java
License : The Unlicense
Project Creator : diegopacheco
License : The Unlicense
Project Creator : diegopacheco
@ExceptionHandler(value = { ConstraintViolationException.clreplaced })
protected ResponseEnreplacedy<Object> handleConflict(RuntimeException ex, WebRequest request) {
String bodyOfResponse = "{ \"error\": \"" + ex.getMessage() + "\"}";
return handleExceptionInternal(ex, bodyOfResponse, new HttpHeaders(), HttpStatus.CONFLICT, request);
}
18
View Source File : JobConfigurationController.java
License : BSD 3-Clause "New" or "Revised" License
Project Creator : dhis2
License : BSD 3-Clause "New" or "Revised" License
Project Creator : dhis2
@Override
protected void preUpdateEnreplacedy(JobConfiguration before, JobConfiguration after) throws WebMessageException {
checkConfigurable(before, HttpStatus.UNPROCESSABLE_ENreplacedY, "Job %s is a system job that cannot be modified.");
checkConfigurable(after, HttpStatus.CONFLICT, "Job %s can not be changed into a system job.");
}
18
View Source File : WebMessageUtils.java
License : BSD 3-Clause "New" or "Revised" License
Project Creator : dhis2
License : BSD 3-Clause "New" or "Revised" License
Project Creator : dhis2
public static WebMessage conflict(String message, String devMessage) {
return createWebMessage(message, devMessage, Status.ERROR, HttpStatus.CONFLICT);
}
18
View Source File : WebMessageUtils.java
License : BSD 3-Clause "New" or "Revised" License
Project Creator : dhis2
License : BSD 3-Clause "New" or "Revised" License
Project Creator : dhis2
public static WebMessage conflict(String message) {
return createWebMessage(message, Status.ERROR, HttpStatus.CONFLICT);
}
18
View Source File : JobExecutionControllerTest.java
License : Apache License 2.0
Project Creator : chrisgleissner
License : Apache License 2.0
Project Creator : chrisgleissner
@Test
public void jobFailsWithDuplicateJobException() throws Exception {
replacedertJobExecutionExceptionToStatusMapping(new DuplicateJobException("causeMsg"), HttpStatus.CONFLICT);
}
18
View Source File : JobExecutionControllerTest.java
License : Apache License 2.0
Project Creator : chrisgleissner
License : Apache License 2.0
Project Creator : chrisgleissner
@Test
public void jobFailsWithJobExecutionAlreadyRunningException() throws Exception {
replacedertJobExecutionExceptionToStatusMapping(new JobExecutionAlreadyRunningException("causeMsg"), HttpStatus.CONFLICT);
}
18
View Source File : JobExecutionControllerTest.java
License : Apache License 2.0
Project Creator : chrisgleissner
License : Apache License 2.0
Project Creator : chrisgleissner
@Test
public void jobFailsWithJobInstanceAlreadyCompleteException() throws Exception {
replacedertJobExecutionExceptionToStatusMapping(new JobInstanceAlreadyCompleteException("causeMsg"), HttpStatus.CONFLICT);
}
18
View Source File : CourseController.java
License : MIT License
Project Creator : anton-liauchuk
License : MIT License
Project Creator : anton-liauchuk
@ExceptionHandler(CourseCannotBePublishedException.clreplaced)
public ResponseEnreplacedy<ErrorResponse> onConflictException(Exception e) {
final ErrorResponse response = new ErrorResponse(e.getMessage());
return ResponseEnreplacedy.status(HttpStatus.CONFLICT).body(response);
}
18
View Source File : CourseProposalController.java
License : MIT License
Project Creator : anton-liauchuk
License : MIT License
Project Creator : anton-liauchuk
@ExceptionHandler({ CourseProposalAlreadyDeclinedException.clreplaced, CourseProposalAlreadyApprovedException.clreplaced })
public ResponseEnreplacedy<ErrorResponse> onConflictException(Exception e) {
final ErrorResponse response = new ErrorResponse(e.getMessage());
return ResponseEnreplacedy.status(HttpStatus.CONFLICT).body(response);
}
17
View Source File : GlobalExceptionHandler.java
License : GNU General Public License v3.0
Project Creator : voyages-sncf-technologies
License : GNU General Public License v3.0
Project Creator : voyages-sncf-technologies
// 409: La requête ne peut être traitée en l’état actuel
@ExceptionHandler({ DuplicateException.clreplaced, OutOfDateException.clreplaced, UndeletableTechnoInUseException.clreplaced, ModuleUsedByPlatformsException.clreplaced, ModuleHasWorkingcopyTechnoException.clreplaced })
public ResponseEnreplacedy handleConflict(Exception exception) {
beforeHandling(exception);
return ResponseEnreplacedy.status(HttpStatus.CONFLICT).body(exception.getMessage());
}
17
View Source File : StatusAssertionTests.java
License : MIT License
Project Creator : Vip-Augus
License : MIT License
Project Creator : Vip-Augus
@Test
public void isEqualTo() {
Statusreplacedertions replacedertions = statusreplacedertions(HttpStatus.CONFLICT);
// Success
replacedertions.isEqualTo(HttpStatus.CONFLICT);
replacedertions.isEqualTo(409);
try {
replacedertions.isEqualTo(HttpStatus.REQUEST_TIMEOUT);
fail("Wrong status expected");
} catch (replacedertionError error) {
// Expected
}
try {
replacedertions.isEqualTo(408);
fail("Wrong status value expected");
} catch (replacedertionError error) {
// Expected
}
}
17
View Source File : TaskanaRestExceptionHandler.java
License : Apache License 2.0
Project Creator : Taskana
License : Apache License 2.0
Project Creator : Taskana
@ExceptionHandler(InvalidOwnerException.clreplaced)
protected ResponseEnreplacedy<TaskanaErrorData> handleInvalidOwner(InvalidOwnerException ex, WebRequest req) {
return buildResponse(ex, req, HttpStatus.CONFLICT);
}
17
View Source File : TaskanaRestExceptionHandler.java
License : Apache License 2.0
Project Creator : Taskana
License : Apache License 2.0
Project Creator : Taskana
@ExceptionHandler(ConcurrencyException.clreplaced)
protected ResponseEnreplacedy<TaskanaErrorData> handleConcurrencyException(ConcurrencyException ex, WebRequest req) {
return buildResponse(ex, req, HttpStatus.CONFLICT);
}
17
View Source File : AbstractRestController.java
License : GNU Affero General Public License v3.0
Project Creator : spacious-team
License : GNU Affero General Public License v3.0
Project Creator : spacious-team
/**
* Create a new enreplacedy.
* In create case method returns CREATE http status, Location header and enreplacedy in body.
* If enreplacedy already exists CONFLICT http status and Location header was returned.
* @param object new enreplacedy (ID may not be provided if it AUTOINCREMENT)
*/
protected ResponseEnreplacedy<Void> post(Pojo object) {
try {
ID id = getId(object);
if (id == null) {
return createEnreplacedy(object);
}
Optional<Enreplacedy> result = getById(id);
if (result.isPresent()) {
return ResponseEnreplacedy.status(HttpStatus.CONFLICT).location(getLocationURI(object)).build();
} else {
return createEnreplacedy(object);
}
} catch (Exception e) {
throw new InternalServerErrorException("Не могу создать объект", e);
}
}
17
View Source File : StatusAssertionTests.java
License : Apache License 2.0
Project Creator : SourceHot
License : Apache License 2.0
Project Creator : SourceHot
@Test
public void isEqualTo() {
Statusreplacedertions replacedertions = statusreplacedertions(HttpStatus.CONFLICT);
// Success
replacedertions.isEqualTo(HttpStatus.CONFLICT);
replacedertions.isEqualTo(409);
// Wrong status
replacedertThatExceptionOfType(replacedertionError.clreplaced).isThrownBy(() -> replacedertions.isEqualTo(HttpStatus.REQUEST_TIMEOUT));
// Wrong status value
replacedertThatExceptionOfType(replacedertionError.clreplaced).isThrownBy(() -> replacedertions.isEqualTo(408));
}
17
View Source File : ExceptionHandlerController.java
License : Apache License 2.0
Project Creator : matthewgallina
License : Apache License 2.0
Project Creator : matthewgallina
// NOTE Removed the use of the @ResponseStatus annotation and explicitly returning a ResponseEnreplacedy, as a workaround
// to a problem with the the Jetty container, which seems to automatically wrap exceptions where no response is present.
@ExceptionHandler(DataIntegrityViolationException.clreplaced)
public ResponseEnreplacedy<String> handleDataIntegrityViolationException() {
return ResponseEnreplacedy.status(HttpStatus.CONFLICT).contentType(MediaType.APPLICATION_JSON).build();
}
17
View Source File : StaticCodeAnalysisIntegrationTest.java
License : MIT License
Project Creator : ls1intum
License : MIT License
Project Creator : ls1intum
@Test
@WithMockUser(value = "instructor1", roles = "INSTRUCTOR")
void testUpdateStaticCodereplacedysisCategories_exerciseIdsDoNotMatch_conflict() throws Exception {
var endpoint = parameterizeEndpoint("/api" + StaticCodereplacedysisResource.Endpoints.CATEGORIES, programmingExerciseSCAEnabled);
programmingExerciseSCAEnabled.getStaticCodereplacedysisCategories().iterator().next().getExercise().setId(1234L);
request.patch(endpoint, programmingExerciseSCAEnabled.getStaticCodereplacedysisCategories(), HttpStatus.CONFLICT);
}
17
View Source File : LectureUnitIntegrationTest.java
License : MIT License
Project Creator : ls1intum
License : MIT License
Project Creator : ls1intum
@Test
@WithMockUser(username = "instructor1", roles = "INSTRUCTOR")
public void updateLectureUnitOrder_asInstructorNewTextUnitInOrderedList_shouldReturnConflict() throws Exception {
TextUnitList newlyOrderedList = new TextUnitList();
newlyOrderedList.add(textUnit);
newlyOrderedList.add(textUnit2);
newlyOrderedList.add(textUnit3);
for (TextUnit textUnit : newlyOrderedList) {
textUnit.setLecture(null);
}
request.put("/api/lectures/" + lecture1.getId() + "/lecture-units-order", List.of(), HttpStatus.CONFLICT);
}
17
View Source File : EnvelopeParamsJsonController.java
License : Apache License 2.0
Project Creator : LLNL
License : Apache License 2.0
Project Creator : LLNL
@PostMapping(value = "/update", name = "update")
public ResponseEnreplacedy<?> update(@Valid @RequestBody EnvelopeJobConfiguration jobConf, BindingResult result) {
if (result.hasErrors()) {
return ResponseEnreplacedy.status(HttpStatus.CONFLICT).body(result);
}
service.setConfiguration(jobConf);
return ResponseEnreplacedy.ok().build();
}
17
View Source File : ValidationEventsJsonController.java
License : Apache License 2.0
Project Creator : LLNL
License : Apache License 2.0
Project Creator : LLNL
@PostMapping(value = "/batch", name = "createBatch")
public ResponseEnreplacedy<?> createBatch(@Valid @RequestBody Collection<ValidationMwParameters> referenceEvents, BindingResult result) {
if (result.hasErrors()) {
return ResponseEnreplacedy.status(HttpStatus.CONFLICT).body(result);
}
service.save(referenceEvents);
return ResponseEnreplacedy.ok().build();
}
17
View Source File : FileUploadExceptionAdvice.java
License : Apache License 2.0
Project Creator : jmprathab
License : Apache License 2.0
Project Creator : jmprathab
@ExceptionHandler(IOException.clreplaced)
public ResponseEnreplacedy handleIOException(MaxUploadSizeExceededException exc) {
return ResponseEnreplacedy.status(HttpStatus.CONFLICT).body(new HashMap<String, String>() {
{
put("message", "Something go wrong with doreplacedent saving!");
}
});
}
17
View Source File : RestResponseEntityExceptionHandler.java
License : Apache License 2.0
Project Creator : ivans-innovation-lab
License : Apache License 2.0
Project Creator : ivans-innovation-lab
// ########## CommandExecution exceptions ##########
@ExceptionHandler({ CommandExecutionException.clreplaced })
protected ResponseEnreplacedy<Object> handleCommandExecution(final RuntimeException cex, final WebRequest request) {
final String bodyOfResponse = "CommandExecutionException";
if (null != cex.getCause()) {
LOG.error("CAUSED BY: {} {}", cex.getCause().getClreplaced().getName(), cex.getCause().getMessage());
if (cex.getCause() instanceof ConcurrencyException) {
return handleExceptionInternal(cex, bodyOfResponse + " - Concurrency issue", new HttpHeaders(), HttpStatus.CONFLICT, request);
}
}
return handleExceptionInternal(cex, bodyOfResponse, new HttpHeaders(), HttpStatus.BAD_REQUEST, request);
}
17
View Source File : AuthExeceptionHandler.java
License : GNU General Public License v3.0
Project Creator : hantsy
License : GNU General Public License v3.0
Project Creator : hantsy
@ExceptionHandler(value = { SignupConflictException.clreplaced })
public ResponseEnreplacedy signupFailed(Exception ex, WebRequest req) {
Map<String, String> errorMsg = new HashMap<>();
errorMsg.put("code", "conflict");
errorMsg.put("message", ex.getMessage());
return ResponseEnreplacedy.status(HttpStatus.CONFLICT).body(ex.getMessage());
}
See More Examples