Package org.osgi.service.useradmin

Examples of org.osgi.service.useradmin.User


            public void valueChange(ValueChangeEvent event) {
                UserDTO user = (UserDTO) m_userTable.getValue();
                if (user == null) {
                    return;
                }
                User result = m_userUtil.getUser(user.getUsername());
                if (result == null) {
                    return;
                }
                Group group = m_userUtil.getGroup(result);
                String groupName = (String) m_groupSelect.getValue();
View Full Code Here


        cleanUp();
    }

    public void testAutoApprove() throws Exception {
        User user = new MockUser();

        startRepositoryService();

        addRepository("storeInstance", "apache", "store", true);
        addRepository("targetInstance", "apache", "target", true);
View Full Code Here

        cleanUp();
    }

    public void testLoginLogoutAndLoginOnceAgainWhileCreatingAnAssociation() throws IOException, InterruptedException,
        InvalidSyntaxException {
        User user1 = new MockUser();

        startRepositoryService();

        addRepository("storeInstance", "apache", "store", true);
        addRepository("targetInstance", "apache", "target", true);
View Full Code Here

    /**
     * Tests read only repository access: marking a repository as readonly for a login should
     * mean that it does not get committed, but local changes will stay around between logins.
     */
    public void testReadOnlyRepositoryAccess() throws Exception {
        User user1 = new MockUser();

        startRepositoryService();

        addRepository("storeInstance", "apache", "store", true);
        addRepository("targetInstance", "apache", "target", true);
View Full Code Here

     * with the server.
     *
     * @throws Exception
     */
    public void testRepositoryAdmin() throws Exception {
        final User user1 = new MockUser();
        final User user2 = new MockUser();

        startRepositoryService();

        addRepository("storeInstance", "apache", "store", true);
        addRepository("targetInstance", "apache", "target", true);
View Full Code Here

     */
    @Test(groups = { UNIT })
    public void testAuthenticateSucceedsWithMultipleAuthProcessors() {
        Date now = new Date();
       
        User user1 = mock(User.class);
        User user2 = mock(User.class);

        AuthenticationProcessor authProc1 = mock(AuthenticationProcessor.class);
        when(authProc1.canHandle(any())).thenAnswer(new Answer<Boolean>() {
            public Boolean answer(InvocationOnMock invocation) throws Throwable {
                Object[] args = invocation.getArguments();
                return (args.length == 1 && args[0] instanceof Date);
            }
        });
        when(authProc1.authenticate(Mockito.<UserAdmin>any(), eq(now))).thenReturn(user1);

        AuthenticationProcessor authProc2 = mock(AuthenticationProcessor.class);
        when(authProc2.canHandle(anyString())).thenAnswer(new Answer<Boolean>() {
            public Boolean answer(InvocationOnMock invocation) throws Throwable {
                Object[] args = invocation.getArguments();
                return (args.length == 1 && args[0] instanceof String);
            }
        });
        when(authProc2.authenticate(Mockito.<UserAdmin>any(), eq("foo"))).thenReturn(user2);

        AuthenticationServiceImpl authService = createAuthenticationService();

        registerAuthProcessor(authService, authProc1);
        registerAuthProcessor(authService, authProc2);

        User result = authService.authenticate("foo");
        assert result != null;
        assert user2 == result;
       
        result = authService.authenticate(now);
        assert result != null;
View Full Code Here

     */
    @Test(groups = { UNIT })
    public void testAuthenticateSucceedsWithSingleAuthProcessorAndCorrectContext() {
        AuthenticationServiceImpl authService = createAuthenticationService();

        User user = mock(User.class);

        AuthenticationProcessor authProc = mock(AuthenticationProcessor.class);
        when(authProc.canHandle(anyString())).thenReturn(Boolean.TRUE);
        when(authProc.authenticate(Mockito.<UserAdmin>any(), eq("foo"))).thenReturn(user);

View Full Code Here

     */
    @Test(groups = { UNIT })
    public void testGetProcessorsSelectsCorrectProcessorsBasedOnContext() {
        Date now = new Date();
       
        User user1 = mock(User.class);
        User user2 = mock(User.class);

        AuthenticationProcessor authProc1 = mock(AuthenticationProcessor.class);
        when(authProc1.canHandle(any())).thenAnswer(new Answer<Boolean>() {
            public Boolean answer(InvocationOnMock invocation) throws Throwable {
                Object[] args = invocation.getArguments();
View Full Code Here

                "        <memberof>TestGroup</memberof>" +
                "    </user>" +
                "</roles>").getBytes());

        assertTrue("Committing test user data failed.", m_userRepository.commit(bis, m_userRepository.getRange().getHigh()));
        User user = (User) m_userAdmin.getRole("TestUser");
        int count = 0;
        while ((user == null) && (count < 60)) {
            Thread.sleep(100);
            user = (User) m_userAdmin.getRole("TestUser");
            count++;
View Full Code Here

    public void testGetUsers() {
        assertEquals(1, m_userEditor.getData().size());
    }

    public void testGetGroupByUser() {
        User newUser = null;
        Role newRole = m_userAdmin.createRole((String) "Testuser", Role.USER);
        Group group = (Group) m_userAdmin.getRole("TestGroup");
        if (newRole != null && group != null) {
            newUser = (User) newRole;
            newUser.getProperties().put("username", "u");
            newUser.getCredentials().put("password", "p");
            group.addMember(newUser);
        }
        assertEquals(group, m_userEditor.getGroup(newUser));
        m_userAdmin.removeRole("u");
    }
View Full Code Here

TOP

Related Classes of org.osgi.service.useradmin.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.