Package org.zanata.service

Examples of org.zanata.service.UserAccountService


        return newAcc;
    }

    @Test
    public void assignedRule() {
        UserAccountService userAccountService =
                seam.autowire(UserAccountServiceImpl.class);
        // Non admin account
        HAccount account = em.find(HAccount.class, 3L);
        assertThat(new ArrayList<HAccountRole>(account.getRoles()),
                not(Matchers.<HAccountRole> hasItem(hasProperty("name",
                        Matchers.is("admin")))));

        account =
                userAccountService.runRoleAssignmentRules(account, null,
                        "zanata");
        // Now it's admin
        assertThat(
                new ArrayList<HAccountRole>(account.getRoles()),
                Matchers.<HAccountRole> hasItem(hasProperty("name",
View Full Code Here


                        Matchers.is("admin"))));
    }

    @Test
    public void assignedFedoraRule() {
        UserAccountService userAccountService =
                seam.autowire(UserAccountServiceImpl.class);
        // Non Fedora account
        HAccount account = createFedoraAccount();
        assertThat(new ArrayList<HAccountRole>(account.getRoles()),
                not(Matchers.<HAccountRole> hasItem(hasProperty("name",
                        Matchers.is("Fedora")))));

        account =
                userAccountService.runRoleAssignmentRules(account, account
                        .getCredentials().iterator().next(), "fedora");
        // Now it's fedora
        assertThat(
                new ArrayList<HAccountRole>(account.getRoles()),
                Matchers.<HAccountRole> hasItem(hasProperty("name",
View Full Code Here

                        Matchers.is("Fedora"))));
    }

    @Test
    public void notAssignedFedoraRule() {
        UserAccountService userAccountService =
                seam.autowire(UserAccountServiceImpl.class);
        // Non Fedora account
        HAccount account = em.find(HAccount.class, 3L);
        assertThat(new ArrayList<HAccountRole>(account.getRoles()),
                not(Matchers.<HAccountRole> hasItem(hasProperty("name",
                        Matchers.is("Fedora")))));

        account =
                userAccountService.runRoleAssignmentRules(account, null,
                        "fedora");
        // It's still not Fedora
        assertThat(new ArrayList<HAccountRole>(account.getRoles()),
                not(Matchers.<HAccountRole> hasItem(hasProperty("name",
                        Matchers.is("Fedora")))));
View Full Code Here

TOP

Related Classes of org.zanata.service.UserAccountService

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.