Package org.springbyexample.schema.beans.person

Examples of org.springbyexample.schema.beans.person.Person


    private ContactService service;
       
    @Test
    public void testFindById() {
        PersonResponse response = service.findById(FIRST_ID);
        Person person = response.getResults();

        testPersonOne(person);
    }
View Full Code Here


        int expectedCount = 1;

        assertNotNull("Person list is null.", results);
        assertEquals("Number of persons should be " + expectedCount + ".", expectedCount, results.size());
       
        Person person = response.getResults().get(0);
       
        testPersonOne(person);
    }
View Full Code Here

        String lastName = "Johnson";
       
        PersonResponse response = createPerson(firstName, lastName);
        assertNotNull("Person response is null.", response);
       
        Person person = response.getResults();
       
        // test saved person
        testPerson(person,
                   firstName, lastName);
View Full Code Here

    @Test
    public void testUpdate() {
        PersonResponse response = service.findById(FIRST_ID);
        assertNotNull("Person response is null.", response);
       
        Person person = response.getResults();
       
        testPersonOne(person);
       
        String lastName = "Jones";
        person.setLastName(lastName);

        service.update(person);

        response = service.findById(FIRST_ID);
        assertNotNull("Person response is null.", response);
View Full Code Here

        testPersonOne(person, lastName);
    }

    @Test
    public void testDelete() {
        service.delete(new Person().withId(FIRST_ID));

        // person should be null after delete
        PersonResponse response = service.findById(FIRST_ID);
        assertNotNull("Person response is null.", response);
       
        Person person = response.getResults();

        assertNull("Person is not null.", person);
    }
View Full Code Here

    /**
     * Create person.
     */
    private PersonResponse createPerson(String firstName, String lastName) {
        Person person = new Person();

        person.setFirstName(firstName);
        person.setLastName(lastName);
       
        PersonResponse response = service.create(person);
       
        return response;
    }
View Full Code Here

    @Override
    @RequestMapping(value = DELETE_PK_REQUEST, method = RequestMethod.DELETE)
    public PersonResponse delete(@PathVariable(ID_VAR) Integer id) {
        logger.info("Delete person.  id={}", id);

        return service.delete(new Person().withId(id));
    }
View Full Code Here

     * For every request for this controller, this will
     * create a person instance for the form.
     */
    @ModelAttribute
    public Person newRequest(@RequestParam(required=false) Integer id) {
        return ((id == null || id == 0) ? new Person() : service.findById(id).getResults());
    }
View Full Code Here

     *
     * <p>Expected HTTP POST and request '/person/form'.</p>
     */
    @RequestMapping(value="/person/form", method=RequestMethod.POST)
    public Person form(Person person, Model model) {
        Person result = save(person).getResults();
       
        model.addAttribute("statusMessageKey", "person.form.msg.success");
       
        return result;
    }
View Full Code Here

     */
    @RequestMapping(value=DELETE_PATH_KEY, method=RequestMethod.POST)
    public String delete(@RequestParam("id") Integer id) {
        logger.info("'{}'  id={}", DELETE_PATH_KEY, id);
       
        service.delete(new Person().withId(id));

        return SEARCH_VIEW_KEY;
    }
View Full Code Here

TOP

Related Classes of org.springbyexample.schema.beans.person.Person

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.