Package org.springframework.test.web

Examples of org.springframework.test.web.Person


  @Test
  public void testDeferredResultWithSetValue() throws Exception {
    MvcResult mvcResult = this.mockMvc.perform(get("/1").param("deferredResultWithSetValue", "true"))
        .andExpect(request().asyncStarted())
        .andExpect(request().asyncResult(new Person("Joe")))
        .andReturn();

    this.mockMvc.perform(asyncDispatch(mvcResult))
        .andExpect(status().isOk())
        .andExpect(content().contentType(MediaType.APPLICATION_JSON))
View Full Code Here


    @ResponseBody
    public Callable<Person> getCallable(final Model model) {
      return new Callable<Person>() {
        @Override
        public Person call() throws Exception {
          return new Person("Joe");
        }
      };
    }
View Full Code Here

    @RequestMapping(value="/{id}", params="deferredResultWithSetValue", produces="application/json")
    @ResponseBody
    public DeferredResult<Person> getDeferredResultWithSetValue() {
      DeferredResult<Person> deferredResult = new DeferredResult<Person>();
      deferredResult.setResult(new Person("Joe"));
      return deferredResult;
    }
View Full Code Here

    @ResponseBody
    public ListenableFuture<Person> getListenableFuture() {
      ListenableFutureTask<Person> futureTask = new ListenableFutureTask<Person>(new Callable<Person>() {
        @Override
        public Person call() throws Exception {
          return new Person("Joe");
        }
      });
      this.futureTasks.add(futureTask);
      return futureTask;
    }
View Full Code Here

      return futureTask;
    }

    public void onMessage(String name) {
      for (DeferredResult<Person> deferredResult : this.deferredResults) {
        deferredResult.setResult(new Person(name));
        this.deferredResults.remove(deferredResult);
      }
      for (ListenableFutureTask<Person> futureTask : this.futureTasks) {
        futureTask.run();
        this.futureTasks.remove(futureTask);
View Full Code Here

  private class PersonController {

    @RequestMapping(value="/person/{name}")
    @ResponseBody
    public Person get(@PathVariable String name) {
      Person person = new Person(name);
      return person;
    }
View Full Code Here

  public void getPerson() throws Exception {
    this.mockMvc.perform(get("/persons/Joe").flashAttr("message", "success!"))
      .andExpect(status().isOk())
      .andExpect(forwardedUrl("persons/index"))
      .andExpect(model().size(2))
      .andExpect(model().attribute("person", new Person("Joe")))
      .andExpect(model().attribute("message", "success!"))
      .andExpect(flash().attributeCount(0));
  }
View Full Code Here

  @Controller
  private static class PersonController {

    @RequestMapping(value="/persons/{name}", method=RequestMethod.GET)
    public String getPerson(@PathVariable String name, Model model) {
      model.addAttribute(new Person(name));
      return "persons/index";
    }
View Full Code Here

  private class PersonController {

    @RequestMapping(value="/search")
    @ResponseBody
    public Person get(@RequestParam String name) {
      Person person = new Person(name);
      return person;
    }
View Full Code Here

    @ResponseBody
    public Person showEntity(@PathVariable long id, WebRequest request) {
      if (request.checkNotModified(calculateLastModified(id))) {
        return null;
      }
      return new Person("Jason");
    }
View Full Code Here

TOP

Related Classes of org.springframework.test.web.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.