Package org.apache.jetspeed.security.mapping.model.impl

Examples of org.apache.jetspeed.security.mapping.model.impl.EntityImpl


        return searchConfiguration.getEntityType();
    }

    protected EntityImpl internalCreateEntity(String entityId, String internalId, Set<Attribute> attributes)
    {
        EntityImpl entity = new EntityImpl(searchConfiguration.getEntityType(), entityId, searchConfiguration.getAttributeDefinitionsMap());
        entity.setAttributes(attributes);
        if (internalId != null)
        {
            entity.setInternalId(internalId);
        }
        return entity;
    }
View Full Code Here


public class UserTests extends AbstractSetup2LDAPTest
{

    public void testSingleUser() throws Exception
    {
        EntityImpl sampleUser = new EntityImpl("user", "thomas", userAttrDefs);
        sampleUser
                .setInternalId("cn=Thomas, o=Peoples, o=Amsterdam, o=Jetspeed, o=sevenSeas");
        sampleUser.setAttribute(GIVEN_NAME_DEF.getName(), "Thomas");
        sampleUser.setAttribute(UID_DEF.getName(), "thomas");
        sampleUser.setAttribute(CN_DEF.getName(), "Thomas");
        basicTestCases.testFetchSingleEntity(entityManager, sampleUser);
    }
View Full Code Here

        sampleUser.setAttribute(CN_DEF.getName(), "Thomas");
        basicTestCases.testFetchSingleEntity(entityManager, sampleUser);
    }

    private EntityImpl getFinanceRole(){
        EntityImpl financeRole = new EntityImpl("role", "Finance", roleAttrDefs);
        financeRole.setInternalId("cn=Finance, ou=Roles, o=Jetspeed, o=sevenSeas");
        financeRole.setAttribute(CN_DEF.getName(), "Finance");
        Collection<String> members = new ArrayList<String>();
        members.add(DnUtils.encodeDn("cn=David,o=Peoples,o=SanFrancisco,o=Jetspeed,o=sevenSeas"));
        financeRole.setAttribute(UNIQUEMEMBER_ATTR_DEF.getName(), members);
        return financeRole;
    }
View Full Code Here

        financeRole.setAttribute(UNIQUEMEMBER_ATTR_DEF.getName(), members);
        return financeRole;
    }

    private EntityImpl getUsersRole(){
        EntityImpl usersRole = new EntityImpl("role", "Users", roleAttrDefs);
        usersRole.setInternalId("cn=Users, ou=Roles, o=Jetspeed, o=sevenSeas");
        usersRole.setAttribute(CN_DEF.getName(), "Users");
        Collection<String> members = new ArrayList<String>();
        members.add(DnUtils.encodeDn("cn=David,o=Peoples,o=SanFrancisco,o=Jetspeed,o=sevenSeas"));
        members.add(DnUtils.encodeDn("cn=Paul,o=People,o=Amsterdam,o=Jetspeed,o=sevenSeas"));
        members.add(DnUtils.encodeDn("cn=Thomas,o=Peoples,o=Amsterdam,o=Jetspeed,o=sevenSeas"));
        usersRole.setAttribute(UNIQUEMEMBER_ATTR_DEF.getName(), members);
        return usersRole;
    }
View Full Code Here

        return usersRole;
    }

    public void testFetchRolesForUserByRoleAttribute() throws Exception
    {
        EntityImpl userRole = getUsersRole();
        EntityImpl financeRole = getFinanceRole();
        Collection<Entity> resultSet = new ArrayList<Entity>();
        resultSet.add(userRole);
        resultSet.add(financeRole);
        // test fetching roles for a user
        basicTestCases.testFetchRelatedEntitiesFrom("user", "role", "hasRole",
View Full Code Here


    }
   
    private EntityImpl getGroup(String id, String description){
        EntityImpl group = new EntityImpl("group", id, groupAttrDefs);
        if (description != null){
            group.setAttribute(DESCRIPTION_ATTR_DEF.getName(), description);
        }
        group.setAttribute(CN_DEF.getName(), id);
        return group;
    }
View Full Code Here

        }
    }
   
    public Entity createEntity(String id, String entityType, String[]... attrKeyValuePairs){
       
        EntityImpl stubEntity = new EntityImpl("user", id, new HashSet<AttributeDef>(attributeDefs.values()));
        for (int i = 0; i < attrKeyValuePairs.length; i++)
        {
            AttributeDef def = attributeDefs.get(attrKeyValuePairs[i][0]);
            if (def!=null){
                stubEntity.setAttribute(def.getName(), attrKeyValuePairs[i][1]);
            }
        }
        stubEntity.setInternalId(id); // simply use the id
        return stubEntity;
    }
View Full Code Here

    public void testAddNestedEntities() throws Exception {
        Entity marketingGroup = entityManager.getEntity("group", "Marketing");
       
        assertNotNull(marketingGroup);
       
        EntityImpl nestedGroup = getGroup("nestedGroup1", "Some Nested Group");
       
        entityManager.addEntity(nestedGroup, marketingGroup);
       
        Entity liveNestedGroup = entityManager.getEntity("group", nestedGroup.getId());
        assertNotNull(liveNestedGroup);
        String newDn = DnUtils.encodeDnUsingSeparator(",", marketingGroup.getInternalId(), "cn="+liveNestedGroup.getId());
        assertEquals("cn=nestedGroup1,cn=Marketing,ou=Groups,o=Jetspeed,o=sevenSeas", newDn);
    }
View Full Code Here

        String newDn = DnUtils.encodeDnUsingSeparator(",", marketingGroup.getInternalId(), "cn="+liveNestedGroup.getId());
        assertEquals("cn=nestedGroup1,cn=Marketing,ou=Groups,o=Jetspeed,o=sevenSeas", newDn);
    }
   
    private Entity createUser(String id, String internalId, String givenName, String cn, String uid, String[] roles){
        EntityImpl user = new EntityImpl("user", id, userAttrDefs);
        user.setInternalId(internalId);
        user.setAttribute(GIVEN_NAME_DEF.getName(), givenName);
        user.setAttribute(CN_DEF.getName(), cn);
        user.setAttribute(UID_DEF.getName(), uid);
        return user;
    }
View Full Code Here

public class UserTests extends AbstractSetup1LDAPTest
{

    public void testSingleUser() throws Exception
    {
        EntityImpl sampleUser = new EntityImpl("user", "jsmith", userAttrDefs);
        sampleUser
                .setInternalId("cn=jsmith, ou=People, ou=OrgUnit3, o=sevenSeas");
        sampleUser.setAttribute(GIVEN_NAME_DEF.getName(), "Joe Smith");
        sampleUser.setAttribute(UID_DEF.getName(), "jsmith");
        sampleUser.setAttribute(CN_DEF.getName(), "jsmith");
        sampleUser.setAttribute(SN_DEF.getName(), "jsmith");
        sampleUser.setAttribute(UID_DEF.getName(), "jsmith");
        basicTestCases.testFetchSingleEntity(entityManager, sampleUser);
    }
View Full Code Here

TOP

Related Classes of org.apache.jetspeed.security.mapping.model.impl.EntityImpl

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.