public void testInitialize_ExistsInOtherGroup() throws Throwable { User self = createSelf(); myUserModel.addUser(self); myUserModel.addGroup(PROJECT_NAME); self.setGroup("A group", myUserModel); initializeProject(PROJECT_NAME); User[] users = myUserModel.getAllUsers(); assertEquals("Group should be kept", "A group", users[0].getGroup()); }
private User addJabberUserToUserModelOrUpdateInfo(RosterEntry rosterEntry) { // System.out.println("rosterEntry.getName() = " + rosterEntry.getName()); // System.out.println("rosterEntry.getUser() = " + rosterEntry.getUser()); User user = myUserModel.createUser(getSimpleId(rosterEntry.getUser()), getName()); String newGroup = getUserGroup(rosterEntry); if (newGroup != null) { user.setGroup(newGroup, myUserModel); } user.setDisplayName(rosterEntry.getName(), myUserModel); myUserModel.addUser(user); String jabberId = getCurrentJabberID(user, rosterEntry); updateIsIDEtalkClient(jabberId, user); return user; }
public void testCanAddUsers() throws Throwable { myUserModel.addGroup("Fabrique"); assertFalse("No users", myTransport.canAddUsers("project", new HashSet<User>())); assertTrue( "Group already exists - can add new users", myTransport.canAddUsers("Fabrique", Arrays.asList(user("foo"), user("bar")))); assertTrue( "Group not exists - new users to new project", myTransport.canAddUsers("IDEA", Arrays.asList(user("foo"), user("bar")))); User user = user("foo"); myUserModel.addUser(user); user.setGroup(UserModel.DEFAULT_GROUP, myUserModel); assertFalse( "Already has added user", myTransport.canAddUsers("IDEA", Arrays.asList(user("foo"), user("bar")))); }
public User setGroup(User user, String group) { user.setGroup(group); log.fine(String.format("adding user %s to group %s", user.getName(), group)); return user; }
public boolean removeUser(User user) { user.setGroup(null); return users.remove(user); }
public boolean addUser(User user) { user.setGroup(this); return users.add(user); }
public User addUser(User user) { getUsers().add(user); user.setGroup(this); return user; }
public User removeUser(User user) { getUsers().remove(user); user.setGroup(null); return user; }