use of de.tum.in.www1.artemis.domain.ModelingSubmission in project ArTEMiS by ls1intum.
the class ModelingSubmissionResourceIntTest method updateModelingSubmission.
@Test
@Transactional
public void updateModelingSubmission() throws Exception {
// Initialize the database
modelingSubmissionRepository.saveAndFlush(modelingSubmission);
int databaseSizeBeforeUpdate = modelingSubmissionRepository.findAll().size();
// Update the modelingSubmission
ModelingSubmission updatedModelingSubmission = modelingSubmissionRepository.findOne(modelingSubmission.getId());
updatedModelingSubmission.submissionPath(UPDATED_SUBMISSION_PATH);
restModelingSubmissionMockMvc.perform(put("/api/modeling-submissions").contentType(TestUtil.APPLICATION_JSON_UTF8).content(TestUtil.convertObjectToJsonBytes(updatedModelingSubmission))).andExpect(status().isOk());
// Validate the ModelingSubmission in the database
List<ModelingSubmission> modelingSubmissionList = modelingSubmissionRepository.findAll();
assertThat(modelingSubmissionList).hasSize(databaseSizeBeforeUpdate);
ModelingSubmission testModelingSubmission = modelingSubmissionList.get(modelingSubmissionList.size() - 1);
assertThat(testModelingSubmission.getSubmissionPath()).isEqualTo(UPDATED_SUBMISSION_PATH);
}
use of de.tum.in.www1.artemis.domain.ModelingSubmission in project ArTEMiS by ls1intum.
the class ModelingSubmissionResource method getModelingSubmission.
/**
* GET /modeling-submissions/:id : get the "id" modelingSubmission.
*
* @param id the id of the modelingSubmission to retrieve
* @return the ResponseEntity with status 200 (OK) and with body the modelingSubmission, or with status 404 (Not Found)
*/
@GetMapping("/modeling-submissions/{id}")
@Timed
public ResponseEntity<ModelingSubmission> getModelingSubmission(@PathVariable Long id) {
log.debug("REST request to get ModelingSubmission : {}", id);
ModelingSubmission modelingSubmission = modelingSubmissionRepository.findOne(id);
return ResponseUtil.wrapOrNotFound(Optional.ofNullable(modelingSubmission));
}
use of de.tum.in.www1.artemis.domain.ModelingSubmission in project ArTEMiS by ls1intum.
the class ModelingSubmissionResource method updateModelingSubmission.
/**
* PUT /modeling-submissions : Updates an existing modelingSubmission.
*
* @param modelingSubmission the modelingSubmission to update
* @return the ResponseEntity with status 200 (OK) and with body the updated modelingSubmission,
* or with status 400 (Bad Request) if the modelingSubmission is not valid,
* or with status 500 (Internal Server Error) if the modelingSubmission couldn't be updated
* @throws URISyntaxException if the Location URI syntax is incorrect
*/
@PutMapping("/modeling-submissions")
@Timed
public ResponseEntity<ModelingSubmission> updateModelingSubmission(@RequestBody ModelingSubmission modelingSubmission) throws URISyntaxException {
log.debug("REST request to update ModelingSubmission : {}", modelingSubmission);
if (modelingSubmission.getId() == null) {
return createModelingSubmission(modelingSubmission);
}
ModelingSubmission result = modelingSubmissionRepository.save(modelingSubmission);
return ResponseEntity.ok().headers(HeaderUtil.createEntityUpdateAlert(ENTITY_NAME, modelingSubmission.getId().toString())).body(result);
}
use of de.tum.in.www1.artemis.domain.ModelingSubmission in project ArTEMiS by ls1intum.
the class ModelingSubmissionResource method createModelingSubmission.
/**
* POST /modeling-submissions : Create a new modelingSubmission.
*
* @param modelingSubmission the modelingSubmission to create
* @return the ResponseEntity with status 201 (Created) and with body the new modelingSubmission, or with status 400 (Bad Request) if the modelingSubmission has already an ID
* @throws URISyntaxException if the Location URI syntax is incorrect
*/
@PostMapping("/modeling-submissions")
@Timed
public ResponseEntity<ModelingSubmission> createModelingSubmission(@RequestBody ModelingSubmission modelingSubmission) throws URISyntaxException {
log.debug("REST request to save ModelingSubmission : {}", modelingSubmission);
if (modelingSubmission.getId() != null) {
return ResponseEntity.badRequest().headers(HeaderUtil.createFailureAlert(ENTITY_NAME, "idexists", "A new modelingSubmission cannot already have an ID")).body(null);
}
ModelingSubmission result = modelingSubmissionRepository.save(modelingSubmission);
return ResponseEntity.created(new URI("/api/modeling-submissions/" + result.getId())).headers(HeaderUtil.createEntityCreationAlert(ENTITY_NAME, result.getId().toString())).body(result);
}
use of de.tum.in.www1.artemis.domain.ModelingSubmission in project ArTEMiS by ls1intum.
the class ModelingSubmissionResourceIntTest method equalsVerifier.
@Test
@Transactional
public void equalsVerifier() throws Exception {
TestUtil.equalsVerifier(ModelingSubmission.class);
ModelingSubmission modelingSubmission1 = new ModelingSubmission();
modelingSubmission1.setId(1L);
ModelingSubmission modelingSubmission2 = new ModelingSubmission();
modelingSubmission2.setId(modelingSubmission1.getId());
assertThat(modelingSubmission1).isEqualTo(modelingSubmission2);
modelingSubmission2.setId(2L);
assertThat(modelingSubmission1).isNotEqualTo(modelingSubmission2);
modelingSubmission1.setId(null);
assertThat(modelingSubmission1).isNotEqualTo(modelingSubmission2);
}
Aggregations