Package org.candlepin.model

Examples of org.candlepin.model.User


        assertEquals((Integer) 0, info.getConsumerCountByStatus("Unknown Status"));
    }

    private User setupOnlyMyConsumersPrincipal() {
        Set<Permission> perms = new HashSet<Permission>();
        User u = new User("MySystemsAdmin", "passwd");
        perms.add(new UsernameConsumersPermission(u, owner));
        Principal p = new UserPrincipal(u.getUsername(), perms, false);
        setupPrincipal(p);
        return u;
    }
View Full Code Here


    private Owner owner;
    private final String username = "bill";

    @Before
    public void init() {
        User u = new User(username, "dontcare");
        owner = new Owner("ownerkey", "My Org");
        perm = new UsernameConsumersPermission(u, owner);
    }
View Full Code Here

        this.service = new DefaultUserServiceAdapter(curator, roleCurator);
    }

    @Test
    public void validationPass() {
        User user = new User("test_user", "mypassword");
        this.service.createUser(user);
        Assert.assertTrue(this.service.validateUser("test_user",
                           "mypassword"));
    }
View Full Code Here

                           "mypassword"));
    }

    @Test
    public void testFindAllUsers() {
        User user = new User("test_user", "mypassword");
        this.service.createUser(user);
        List<User> users = this.service.listUsers();
        assertTrue("The size of the list should be 1", users.size() == 1);
        assertEquals("test_user", users.get(0).getUsername());
    }
View Full Code Here

        assertEquals("test_user", users.get(0).getUsername());
    }

    @Test
    public void validationBadPassword() {
        User user = new User("dude", "password");
        this.service.createUser(user);

        Assert.assertFalse(this.service.validateUser("dude", "invalid"));
    }
View Full Code Here

    }

    @Test
    @Ignore("Find a way to do this with permissions")
    public void findOwner() {
        User user = new User("test_name", "password");

        this.service.createUser(user);

        Role adminRole = createAdminRole(owner);
        adminRole.addUser(user);
View Full Code Here

    }

    @Test
    @Ignore("Find a way to do this with permissions")
    public void ownerAdminRole() {
        User user = new User("regular_user", "password");
        this.service.createUser(user);

        Assert.assertTrue(
            this.service.findByLogin("regular_user").getRoles().contains(Access.ALL));
    }
View Full Code Here

    @Test
    @Ignore("Find a way to do this with permissions")
    public void superAdminRole() {
        Set<Owner> owners = new HashSet<Owner>();
        owners.add(owner);
        User user = new User("super_admin", "password", true);
        this.service.createUser(user);

        Assert.assertTrue(
            this.service.findByLogin("super_admin").getRoles().contains(Access.ALL));
    }
View Full Code Here

            this.service.findByLogin("super_admin").getRoles().contains(Access.ALL));
    }

    @Test
    public void deletionValidationFail() {
        User user = new User("guy", "pass");
        user = this.service.createUser(user);
        this.service.deleteUser(user);

        Assert.assertFalse(this.service.validateUser("guy", "pass"));
    }
View Full Code Here

        Assert.assertFalse(this.service.validateUser("guy", "pass"));
    }

    @Test
    public void findByLogin() {
        User u = mock(User.class);
        UserCurator curator = mock(UserCurator.class);
        RoleCurator roleCurator = mock(RoleCurator.class);
        UserServiceAdapter dusa = new DefaultUserServiceAdapter(curator,
                roleCurator);
        when(curator.findByLogin(anyString())).thenReturn(u);

        User foo = dusa.findByLogin("foo");
        assertNotNull(foo);
        assertEquals(foo, u);
    }
View Full Code Here

TOP

Related Classes of org.candlepin.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.