Package com.taskadapter.redmineapi.bean

Examples of com.taskadapter.redmineapi.bean.Group


    return result;
  }
 
  public static Group parseGroup(JSONObject content) throws JSONException {
    final Group result = GroupFactory.create(JsonInput.getIntOrNull(content, "id"));
    result.setName(JsonInput.getStringOrNull(content, "name"));
    return result;
  }
View Full Code Here


    /**
     * Requires Redmine 2.1
     */
    @Test
    public void testAddUserToGroup() throws RedmineException {
        final Group template = GroupFactory.create();
        template.setName("testAddUserToGroup " + System.currentTimeMillis());
        final Group group = userManager.createGroup(template);
        try {
            final User newUser = userManager.createUser(UserGenerator.generateRandomUser());
            try {
                userManager.addUserToGroup(newUser, group);
                final Collection<Group> userGroups = userManager.getUserById(newUser.getId()).getGroups();
                assertTrue(userGroups.size() == 1);
                assertTrue(group.getName().equals(userGroups.iterator().next().getName()));
            } finally {
                userManager.deleteUser(newUser.getId());
            }
        } finally {
            userManager.deleteGroup(group);
View Full Code Here

    /**
     * Requires Redmine 2.1
     */
    @Test
    public void addingUserToGroupTwiceDoesNotGiveErrors() throws RedmineException {
        final Group template = GroupFactory.create();
        template.setName("some test " + System.currentTimeMillis());
        final Group group = userManager.createGroup(template);
        try {
            final User newUser = userManager.createUser(UserGenerator.generateRandomUser());
            try {
                userManager.addUserToGroup(newUser, group);
                userManager.addUserToGroup(newUser, group);
View Full Code Here

        }
    }

    @Test
    public void testGroupCRUD() throws RedmineException {
        final Group template = GroupFactory.create();
        template.setName("Template group " + System.currentTimeMillis());
        final Group created = userManager.createGroup(template);

        try {
            assertEquals(template.getName(), created.getName());
            final Group loaded = userManager.getGroupById(created.getId());
            assertEquals(template.getName(), loaded.getName());

            final Group update = GroupFactory.create(loaded.getId());
            update.setName("Group update " + System.currentTimeMillis());

            userManager.update(update);

            final Group loaded2 = userManager.getGroupById(created.getId());
            assertEquals(update.getName(), loaded2.getName());
        } finally {
            userManager.deleteGroup(created);
        }

        try {
View Full Code Here

    @Test
    public void membershipCanBeSetForGroups() throws RedmineException {
        final List<Role> roles = userManager.getRoles();
        Collection<Role> rolesToSet = Arrays.asList(roles.get(0));

        Group group = GroupFactory.create();
        group.setName("group" + new Random().nextDouble());
        Group createdGroup = null;
        try {
            createdGroup = mgr.getUserManager().createGroup(group);

            membershipManager.createMembershipForGroup(project.getId(), createdGroup.getId(), rolesToSet);
            // TODO add assert here
            List<Membership> memberships = membershipManager.getMemberships(project.getIdentifier());
            System.out.println(memberships);
        } finally {
            mgr.getUserManager().deleteGroup(createdGroup);
View Full Code Here

TOP

Related Classes of com.taskadapter.redmineapi.bean.Group

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.