use of de.trustable.ca3s.core.domain.RDN in project ca3sCore by kuehne-trustable-de.
the class RDNResourceIT method updateRDN.
@Test
@Transactional
public void updateRDN() throws Exception {
// Initialize the database
rDNService.save(rDN);
int databaseSizeBeforeUpdate = rDNRepository.findAll().size();
// Update the rDN
RDN updatedRDN = rDNRepository.findById(rDN.getId()).get();
// Disconnect from session so that the updates on updatedRDN are not directly saved in db
em.detach(updatedRDN);
restRDNMockMvc.perform(put("/api/rdns").contentType(TestUtil.APPLICATION_JSON_UTF8).content(TestUtil.convertObjectToJsonBytes(updatedRDN))).andExpect(status().isOk());
// Validate the RDN in the database
List<RDN> rDNList = rDNRepository.findAll();
assertThat(rDNList).hasSize(databaseSizeBeforeUpdate);
RDN testRDN = rDNList.get(rDNList.size() - 1);
}
use of de.trustable.ca3s.core.domain.RDN in project ca3sCore by kuehne-trustable-de.
the class RDNResource method updateRDN.
/**
* {@code PUT /rdns} : Updates an existing rDN.
*
* @param rDN the rDN to update.
* @return the {@link ResponseEntity} with status {@code 200 (OK)} and with body the updated rDN,
* or with status {@code 400 (Bad Request)} if the rDN is not valid,
* or with status {@code 500 (Internal Server Error)} if the rDN couldn't be updated.
* @throws URISyntaxException if the Location URI syntax is incorrect.
*/
@PutMapping("/rdns")
public ResponseEntity<RDN> updateRDN(@RequestBody RDN rDN) throws URISyntaxException {
log.debug("REST request to update RDN : {}", rDN);
if (rDN.getId() == null) {
throw new BadRequestAlertException("Invalid id", ENTITY_NAME, "idnull");
}
RDN result = rDNService.save(rDN);
return ResponseEntity.ok().headers(HeaderUtil.createEntityUpdateAlert(applicationName, true, ENTITY_NAME, rDN.getId().toString())).body(result);
}
use of de.trustable.ca3s.core.domain.RDN in project ca3sCore by kuehne-trustable-de.
the class RDNResource method createRDN.
/**
* {@code POST /rdns} : Create a new rDN.
*
* @param rDN the rDN to create.
* @return the {@link ResponseEntity} with status {@code 201 (Created)} and with body the new rDN, or with status {@code 400 (Bad Request)} if the rDN has already an ID.
* @throws URISyntaxException if the Location URI syntax is incorrect.
*/
@PostMapping("/rdns")
public ResponseEntity<RDN> createRDN(@RequestBody RDN rDN) throws URISyntaxException {
log.debug("REST request to save RDN : {}", rDN);
if (rDN.getId() != null) {
throw new BadRequestAlertException("A new rDN cannot already have an ID", ENTITY_NAME, "idexists");
}
RDN result = rDNService.save(rDN);
return ResponseEntity.created(new URI("/api/rdns/" + result.getId())).headers(HeaderUtil.createEntityCreationAlert(applicationName, true, ENTITY_NAME, result.getId().toString())).body(result);
}
use of de.trustable.ca3s.core.domain.RDN in project ca3sCore by kuehne-trustable-de.
the class RDNResourceIT method createRDN.
@Test
@Transactional
public void createRDN() throws Exception {
int databaseSizeBeforeCreate = rDNRepository.findAll().size();
// Create the RDN
restRDNMockMvc.perform(post("/api/rdns").contentType(TestUtil.APPLICATION_JSON_UTF8).content(TestUtil.convertObjectToJsonBytes(rDN))).andExpect(status().isCreated());
// Validate the RDN in the database
List<RDN> rDNList = rDNRepository.findAll();
assertThat(rDNList).hasSize(databaseSizeBeforeCreate + 1);
RDN testRDN = rDNList.get(rDNList.size() - 1);
}
Aggregations