Package org.openengsb.domain.userprojects.model

Examples of org.openengsb.domain.userprojects.model.User


        deleteUsersFromPersistence(users);
    }

    @Override
    public void deleteUserByName(String userName) {
        deleteUser(new User(userName));
    }
View Full Code Here


    public void deleteUsersByName(List<String> userNames) {
        List<User> users = Lists.newArrayList();

        for (String userName : userNames) {
            this.deleteUserByName(userName);
            users.add(new User(userName));
        }

        deleteUsers(users);
    }
View Full Code Here

        SecurityContext.executeWithSystemPermissions(new Callable<Object>() {
            @Override
            public Object call() throws Exception {
                authenticationContext.login("admin", new Password("password"));

                User user = new User(userName);

                Attribute attr = new Attribute();
                attr.setAttributeName(attrName);
                attr.getValues().add(attrValue);
                attr.generateUuid(user.getUsername());
                user.getAttributes().add(attr);

                impl.checkinUser(user);

                // Assert userManager-Content
                assertTrue(userManager.getUserList().contains(userName));
                assertTrue(userManager.getUserAttribute(userName, attrName).get(0).equals(attrValue));
                assertTrue(userManager.getUserCredentials(userName, credType).equals(credValue));
                List<User> result = queryService.queryByString(User.class, "username:\"" + user.getUsername() + "\"");

                // Assert DB-Result
                assertEqualUser(user, result.get(0));

                return null;
View Full Code Here

            @Override
            public Object call() throws Exception {

                authenticationContext.login("admin", new Password("password"));

                User user = new User(userName);
                Attribute attr = new Attribute();
                attr.setAttributeName(attrName);
                attr.getValues().add(attrValue);
                attr.generateUuid(user.getUsername());
                user.getAttributes().add(attr);

                impl.checkinUser(user);

                impl.checkinUser(user);

                assertTrue(userManager.getUserList().contains(userName));
                assertTrue(userManager.getUserAttribute(userName, attrName).get(0).equals(attrValue));
                assertTrue(userManager.getUserCredentials(userName, credType).equals(credValue));
                assertTrue(userManager.getUserCredentials(userName, cred2Type).equals(cred2Value));
                List<User> result = queryService.queryByString(User.class, "username:\"" + user.getUsername() + "\"");

                assertEqualUser(user, result.get(0));

                return null;
            }
View Full Code Here

    }

    private List<User> createUsers(Iterable<com.atlassian.jira.rest.client.api.domain.User> jiraUsers) {
        List<User> users = Lists.newArrayList();
        for (com.atlassian.jira.rest.client.api.domain.User jiraUser : jiraUsers) {
            User user = new User();
            user.setUsername(jiraUser.getName());
            user.setAttributes(createAttributes(createUserAttributeMap(jiraUser), jiraUser.getName()));
            users.add(user);
        }
        return users;
    }
View Full Code Here

    }

    private List<User> createUsers(List<Entry> userEntries) throws NoSuchNodeException, MissingParentException {
        List<User> users = Lists.newArrayList();
        for (Entry userEntry : userEntries) {
            User user = new User();
            user.setUsername(userEntry.getDn().getRdn().getValue().getString());
            user.setAttributes(createAttributes(ldapDao.getDirectChildren(DnFactory.userAttributes(user)),
                    user.getUsername()));
            user.setCredentials(createCredentials(ldapDao.getDirectChildren(DnFactory.userCredentials(user)),
                    user.getUsername()));
            users.add(user);
        }
        return users;
    }
View Full Code Here

    }
   
    @Test
    @Ignore
    public void testFindUsers() throws InterruptedException {
        User user = createTestUser();
        List<User> expected = Arrays.asList(user);
        ldapService.updateUsers(expected);
        assertTrue(CollectionUtils.isEqualCollection(modelManager.findUsers(), expected));
    }
View Full Code Here

    }

    @Test
    public void testUpdateUsers_shouldCreateUser() throws LdapInvalidAttributeValueException,
        NoSuchNodeException, MissingParentException {
        User user = createTestUser();
        ldapService.updateUsers(Lists.newArrayList(user));
        assertThat(ldapDao.exists(DnFactory.user(user)), is(true));
        assertCredentialsCorrectlyStored(user);
        assertAttributesCorrectlyStored(user);
    }
View Full Code Here

    }

    @Test
    public void testUpdateUsers_shouldUpdateUser() throws NoSuchNodeException, MissingParentException,
        LdapInvalidAttributeValueException {
        User user = createTestUser();
        ldapService.updateUsers(Lists.newArrayList(user));

        Credential credential = user.getCredentials().iterator().next();
        credential.setValue(credential.getValue() + "new");

        Attribute attribute1 = user.getAttributes().iterator().next();
        attribute1.getValues().add("new");

        Attribute attribute2 = createTestAttribute("attribute2", "value");
        user.getAttributes().add(attribute2);

        ldapService.updateUsers(Lists.newArrayList(user));

        assertCredentialsCorrectlyStored(user);
        assertAttributesCorrectlyStored(user);
View Full Code Here

        assertThat(ldapDao.exists(dn), is(false));
    }

    @Test
    public void testDeleteUsers_shouldDelete() {
        User user = createTestUser();
        List<User> list = Lists.newArrayList(user);
        ldapService.updateUsers(list);
        Dn dn = DnFactory.user(user);
        assertThat(ldapDao.exists(dn), is(true));
        ldapService.deleteUsers(list);
View Full Code Here

TOP

Related Classes of org.openengsb.domain.userprojects.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.