Package demo.model

Examples of demo.model.User


        assertNull(response.getLocation());
    }

    @Test
    public void testUpdateUser() {
        final User user1 = new User(),
                user2 = new User();

        when(usersService.update(user1)).thenReturn(true);
        when(usersService.update(user2)).thenReturn(false);

        Response response =  this.usersWS.updateUser(ID, user1);
View Full Code Here


        assertNotNull(result);

        final int initialSize = result.size();

        // alta de usuario
        User user = new User();
        user.setName("Maria");
        user.setEmail("maria@fakemail.com");
        user.setActive(true);

        URI uri = restTemplate.postForLocation(usersURL, user);
        user = restTemplate.getForObject(uri, User.class);

        assertNotNull(user.getID());

        result = restTemplate.getForObject(usersURL, List.class);
        assertEquals(initialSize + 1, result.size());

        // modificación de usuario
        user.setName("Netolica");
        restTemplate.put(usersURL + "/{id}", user, user.getID());
        user = restTemplate.getForObject(usersURL + "/{id}", User.class, user.getID());

        assertEquals("Netolica", user.getName());

        // borrado de usuario
        restTemplate.delete(usersURL + "/{id}", user.getID());
        result = restTemplate.getForObject(usersURL, List.class);
        assertEquals(initialSize, result.size());
    }
View Full Code Here

                                                                                   IOException {
        // TODO Auto-generated method stub
        String username = request.getParameter("username");
        String password = request.getParameter("password");
        if( username!=null && !"".equals(username) && password!=null && !"".equals(password) ){
            User user = UserDAO.getInstance().getUser(username);
            if (user != null) {
                if (password.equals(user.getPassword())) {
                    //用户名和密码验证通过,将用户身份信息保存在会话中
                    request.getSession().setAttribute("user", user);
                    //已登录,跳转到个人主页
                    response.sendRedirect("profile");
                    return;
View Full Code Here

                if (currentUser != null) {
                    String name = (String) currentUser.get("name");
                    String headurl = (String) currentUser.get("headurl");
                    //判断帐号关联表里有没有现成的关联
                    String username = RenrenUserMappingDAO.getInstance().getUsername(rrUid);
                    User user;
                    if (username == null) {
                        //在帐号关联表里没有记录,用户是第一次来;为这个用户创建一个User对象
                        User newUser = new User();
                        newUser.setName(name);
                        newUser.setHeadurl(headurl);
                        //是人人网用户
                        newUser.setFlag(true);
                        //自动拼装一个username并随即生成一个password;实际实现时,这里应该保证
                        //拼装出来的username不与其它帐号冲突
                        username = "renren-" + rrUid;
                        String password = UUID.randomUUID().toString();
                        newUser.setUsername(username);
                        newUser.setPassword(password);
                        //保存到用户表
                        UserDAO.getInstance().addUser(newUser);
                        //保存到帐号关联表
                        RenrenUserMappingDAO.getInstance().addMapping(rrUid, username);
                        user = newUser;
View Full Code Here

  /**
   * @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse response)
   */
  protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
    // TODO Auto-generated method stub
      User user = (User) request.getSession().getAttribute("user");
        if (user == null) {
            //未登录,跳转到登录页面去
            response.sendRedirect("login");
            return;
        }
View Full Code Here

   * 使用SDK发布人人网新鲜事
   */
  protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
    // TODO Auto-generated method stub
      request.setCharacterEncoding("UTF-8");
      User user = (User) request.getSession().getAttribute("user");
        if (user == null) {
            //未登录,跳转到登录页面去
            response.sendRedirect("login");
            return;
        }
View Full Code Here

    protected void doGet(HttpServletRequest request, HttpServletResponse response)
                                                                                  throws ServletException,
                                                                                  IOException {
        // TODO Auto-generated method stub
        //验证会话是否是登录状态,如果是没有登录,则跳转到登录页面去;否则,取出用户信息进行展示
        User user = (User) request.getSession().getAttribute("user");
        if (user == null) {
            //未登录,跳转到登录页面去
            response.sendRedirect("login");
            return;
        }
View Full Code Here

  /**
   * @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse response)
   */
  protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
    // TODO Auto-generated method stub
      User user = (User) request.getSession().getAttribute("user");
        if (user == null) {
            //未登录,跳转到登录页面去
            response.sendRedirect("login");
            return;
        }
View Full Code Here

   * @see HttpServlet#doPost(HttpServletRequest request, HttpServletResponse response)
   */
  protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
    // TODO Auto-generated method stub
      request.setCharacterEncoding("UTF-8");
      User user = (User) request.getSession().getAttribute("user");
        if (user == null) {
            //未登录,跳转到登录页面去
            response.sendRedirect("login");
            return;
        }
View Full Code Here

TOP

Related Classes of demo.model.User

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.