Package com.changestuffs.server.persistence.beans

Examples of com.changestuffs.server.persistence.beans.User


    when(req.getParameterMap()).thenReturn(new HashMap<String,String[]>());
    when(req.getRequestURL()).thenReturn(new StringBuffer("changestuffs/anyuri"));
    when(req.getRequestURI()).thenReturn("anyuri");
   
    register.manage(req, mock(HttpServletResponse.class));
    User fromDb = appEntity.find(User.class, user.getEmail());
    assertEquals(authDomain, fromDb.getAuthDomain());
    assertEquals(true, fromDb.isReceiveEmails());
    assertNotSame(user.getUserId(), fromDb.getUserId());
    assertEquals(1, fromDb.getPendingFriends().size());
    assertEquals(true, fromDb.getPendingFriends().contains(ravenWasInvitedBy));
    assertEquals(2, fromDb.getLogins().size());
    assertEquals(0, fromDb.getFriends().size());
  }
View Full Code Here


    assertEquals(thirdDate, user.getLogins().get(2).getLoginDate());
  }
 
  private User getUser(){
    entity.getTransaction().begin();
    User user = entity.find(User.class, this.user.getEmail());
    assertNotNull(user);
    assertNotNull(user.getLogins());
    log.info("Number of logins "+user.getLogins().size());
    entity.getTransaction().commit();
    return user;
  }
View Full Code Here

  public void inviteRegisteredNotifyNoActivated() throws ActionException {
    registeredUserChecks(false);
  }
 
  private void registeredUserChecks(boolean receiveEmails) throws ActionException{
    User registered = persistUser(receiveEmails);
    SendInvitationActionHandler handler = injector.getInstance(SendInvitationActionHandler.class);
    SendInvitationResult result = handler.execute(new SendInvitation(registered.getEmail()), mock(ExecutionContext.class));
    assertEquals(true, result.isSent());
    User fromDb = appEntity.find(User.class, registered.getEmail());
    assertNotNull(fromDb);
    assertEquals(registered.getUserId(), fromDb.getUserId());
    assertEquals(registered.getAuthDomain(), fromDb.getAuthDomain());
    assertEquals(receiveEmails, fromDb.isReceiveEmails());
    assertEquals(1, fromDb.getPendingFriends().size());
    assertTrue("Pending friends = "+fromDb.getPendingFriends(), fromDb.getPendingFriends().contains(email));
    assertEquals(registered.getLogins().size()+1, fromDb.getLogins().size());
  }
View Full Code Here

    assertEquals(registered.getLogins().size()+1, fromDb.getLogins().size());
  }
 
  private User persistUser(boolean receiveEmails){
    final String alreadyRegistered = "im@registered.com";
    User registeredUser = new User();
    registeredUser.setAuthDomain("registered.com");
    registeredUser.setEmail(alreadyRegistered);
    registeredUser.setUserId("userId");
    registeredUser.setReceiveEmails(receiveEmails);
    registeredUser.setPendingFriends(new HashSet<String>());
    registeredUser.setFriends(new HashSet<String>());
    registeredUser.setLogins(Arrays.asList(new Login()));
    appEntity.getTransaction().begin();
    appEntity.persist(registeredUser);
    appEntity.getTransaction().commit();
    return registeredUser;
  }
View Full Code Here

TOP

Related Classes of com.changestuffs.server.persistence.beans.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.