Examples of ModelMap


Examples of com.googlecode.richrest.server.map.ModelMap

  }

  protected void serialize(Serializable obj, HttpServletResponse response, String page) throws IOException {
    try {
      Template template = velocityEngine.getTemplate(page);
      Context context = new VelocityContext(new ModelMap(obj));
      template.merge(context, response.getWriter());
    } catch (RuntimeException e) {
      throw e;
    } catch (IOException e) {
      throw e;
View Full Code Here

Examples of org.commontemplate.tools.web.ModelMap

  protected void serialize(Serializable obj, HttpServletResponse response, String page)
      throws IOException {
    Template template = engine.getTemplate(page);
    Context context = engine.createContext(response.getWriter());
    try {
      context.pushLocalContext(new ModelMap(obj));
      context.setLocale(getLocale());
      template.render(context);
    } finally {
      context.clear();
    }
View Full Code Here

Examples of org.jrest4guice.client.ModelMap

      return;
    }

    Exception exception = null;

    ModelMap modelMap = RestContextManager.getModelMap();
    if (method != null) {
      try {
        Object[] args = null;
        // 构造参数集合
        if (!isRpc) {
          List params = constructParams(method, modelMap);
          args = params.size() > 0 ? params.toArray() : null;
        } else {
          byte[] bytes = (byte[]) modelMap.get(ModelMap.RPC_ARGS_KEY);
          ObjectInputStream obj_in = new ObjectInputStream(
              new ByteArrayInputStream(bytes));
          args = (Object[]) obj_in.readObject();
        }
View Full Code Here

Examples of org.springframework.ui.ModelMap

    }

    @Test
    public void showForm() throws Exception {
        controller.setServletContext(new MockServletContext());
        assertEquals("No jsp in WEB-INF", "crud/template", controller.showForm("stubs.TrivialDomainEntity", null, null, new ModelMap(), new MockHttpSession()));
        controller.setServletContext(new MockServletContext("web", new FileSystemResourceLoader()));
        assertEquals("JSP in WEB-INF", "crud/demoapp/domain/book", controller.showForm("demoapp.domain.Book", null, null, new ModelMap(), new MockHttpSession()));
    }
View Full Code Here

Examples of org.springframework.ui.ModelMap

    newAccountController = new NewAccountController(newAccountService, newAccountValidator, captchaService);
  }

  @Test
  public void setUpForm_ShouldAddAttributeForUser() {
    final ModelMap model = new ModelMap();
    String User = ModelKeys.NEW_USER;
    newAccountController.setUpForm(model, request);

    //assert that the model is not null
    assertThat(model, CoreMatchers.notNullValue());

    //assert that the model size is two
    assertThat(model.size(), CoreMatchers.equalTo(2));

    //assert that the model does contain an attribute associated with User after setUpForm() is called
    assertThat(model.containsAttribute(User), CoreMatchers.equalTo(true));

    //assert that the model does not contain new user as null
    assertThat(model.get(User), CoreMatchers.notNullValue());
  }
View Full Code Here

Examples of org.springframework.ui.ModelMap

    }


    @Test
    public void updateUserDetail_success() {
        ModelMap modelMap = new ExtendedModelMap();
        String userid = "123";
        final String email = "john.doe.sr@example.net";
        UserImpl user = new UserImpl(userid, "john.doe.sr");
        user.setPassword("secrect");
        user.setConfirmPassword("secrect");
View Full Code Here

Examples of org.springframework.ui.ModelMap

    }

    @Test
    public void updateUserDetail_withErrors() {
        ModelMap modelMap = new ExtendedModelMap();
        String userid = "123";
        UserImpl user = new UserImpl(userid, "john.doe.sr");
        final BindingResult errors = new BeanPropertyBindingResult(user, "user");

        SessionStatus sessionStatus = createMock(SessionStatus.class);
View Full Code Here

Examples of org.springframework.ui.ModelMap

        assertEquals(ViewNames.ADMIN_USERDETAIL, view);
    }

    @Test(expected = SecurityException.class)
    public void updateUserDetail_wrongToken() {
        ModelMap modelMap = new ExtendedModelMap();
        UserImpl user = new UserImpl("123", "john.doe.sr");
        final BindingResult errors = new BeanPropertyBindingResult(user, "user");
        SessionStatus sessionStatus = createMock(SessionStatus.class);
        sessionStatus.setComplete();
View Full Code Here

Examples of org.springframework.ui.ModelMap

        assertFalse("SecurityException", true);

    }
    @Test
    public void deleteUserDetail_success() {
        ModelMap modelMap = new ExtendedModelMap();
        String userid = "123";
        final String email = "john.doe.sr@example.net";
        User user = new UserImpl(userid, "john.doe.sr");
        user.setPassword("secrect");
        user.setConfirmPassword(user.getConfirmPassword());
View Full Code Here

Examples of org.springframework.ui.ModelMap

    }

    @Test
    public void deleteUserDetail_noConfirmChecked() {
        ModelMap modelMap = new ExtendedModelMap();
        String userid = "123";
        User user = new UserImpl(userid, "john.doe.sr");

        SessionStatus sessionStatus = createMock(SessionStatus.class);
        replay(sessionStatus);
        final String view = controller.deleteUserDetail(user, validToken, validToken, null,REFERRER_ID, modelMap, sessionStatus);
        verify(sessionStatus);

        assertEquals(ViewNames.ADMIN_USERDETAIL, view);
        assertThat((String) modelMap.get(ModelKeys.REFERRING_PAGE_ID), is(equalTo(REFERRER_ID)));
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.