use of com.example.helloworld.dto.PersonDTO in project liftwizard by motlin.
the class PeopleResource method createPerson.
@POST
@UnitOfWork
public PersonDTO createPerson(PersonDTO personDTO) {
Person person = new Person();
person.setFullName(personDTO.getFullName());
person.setJobTitle(personDTO.getJobTitle());
Person result = this.peopleDAO.create(person);
return new PersonDTO(result.getId(), result.getFullName(), result.getJobTitle());
}
use of com.example.helloworld.dto.PersonDTO in project liftwizard by motlin.
the class PersonResource method getPerson.
@GET
@UnitOfWork
public PersonDTO getPerson(@PathParam("personId") LongParam personId) {
Person person = this.findSafely(personId.get());
PersonDTO personDTO = new PersonDTO(personId.get(), person.getFullName(), person.getJobTitle());
personDTO.setId(person.getId());
return personDTO;
}
use of com.example.helloworld.dto.PersonDTO in project liftwizard by motlin.
the class IntegrationTest method testPostPerson.
@Test
public void testPostPerson() throws Exception {
final PersonDTO person = new PersonDTO("Dr. IntegrationTest", "Chief Wizard");
final PersonDTO newPerson = this.postPerson(person);
assertThat(newPerson.getId()).isNotNull();
assertThat(newPerson.getFullName()).isEqualTo(person.getFullName());
assertThat(newPerson.getJobTitle()).isEqualTo(person.getJobTitle());
}
use of com.example.helloworld.dto.PersonDTO in project liftwizard by motlin.
the class IntegrationTest method testRenderingPerson.
private void testRenderingPerson(String viewName) throws Exception {
final PersonDTO person = new PersonDTO("Dr. IntegrationTest", "Chief Wizard");
final PersonDTO newPerson = this.postPerson(person);
final String url = "http://localhost:" + dropwizardAppRule.getLocalPort() + "/people/" + newPerson.getId() + "/" + viewName;
Response response = dropwizardAppRule.client().target(url).request().get();
assertThat(response.getStatus()).isEqualTo(HttpStatus.OK_200);
}