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

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


        return role1;
    }
   
    private EntityImpl getDefaultJoeSmith(){
        // first assert that the sample user is equal to the corresponding user in LDAP
        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");
        return sampleUser;
    }
View Full Code Here


        return sampleUser;
    }
   
    private EntityImpl getDefaultJoeSmithOnlyMappedAttrs(){
        // first assert that the sample user is equal to the corresponding user in LDAP
        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");
        return sampleUser;
    }
View Full Code Here

   
    public void testFetchRolesForUserByRoleAttribute() throws Exception
    {
      
        Entity role1 = getInitialRole1();
        EntityImpl role3 = new EntityImpl("role", "Role3", roleAttrDefs);
        role3.setInternalId("cn=Role3, o=sevenSeas");
        role3.setAttribute(DESCRIPTION_ATTR_DEF.getName(), "Role 3");
        role3.setAttribute(CN_DEF.getName(), "Role3");
        role3.setAttribute(UNIQUEMEMBER_ATTR_DEF.getName(), Arrays.asList(new String[]{
                "cn=jsmith,ou=People,ou=OrgUnit3,o=sevenSeas"
        }));
        Collection<Entity> resultSet = new ArrayList<Entity>();
        resultSet.add(role1);
        resultSet.add(role3);
View Full Code Here

    }

    public void testUpdateSingleValuedEntityAttr() throws Exception
    {
        // first assert that the sample user is equal to the corresponding user in LDAP
        EntityImpl sampleUser = getDefaultJoeSmith();
        basicTestCases.testFetchSingleEntity(entityManager, sampleUser);
       
        // next, try some identity transformation checks to assert that updating works
        // 1. test attribute modification
        sampleUser.setAttribute(GIVEN_NAME_DEF.getName(), "Joe Smith modified");
        entityManager.updateEntity(sampleUser);
       
       
        basicTestCases.testFetchSingleEntity(entityManager, sampleUser);

        // test attribute removal
        sampleUser = new EntityImpl("user", "jsmith", userAttrDefs);
        sampleUser
                .setInternalId("cn=jsmith, ou=People, ou=OrgUnit3, o=sevenSeas");
        sampleUser.setAttribute(UID_DEF.getName(), "jsmith");
        sampleUser.setAttribute(CN_DEF.getName(), "jsmith");
        sampleUser.setAttribute(SN_DEF.getName(), "jsmith");
       
        entityManager.updateEntity(sampleUser);
       
        basicTestCases.testFetchSingleEntity(entityManager, sampleUser);

        // add "lastname" attribute value
        sampleUser = new EntityImpl("user", "jsmith", userAttrDefs);
        sampleUser
                .setInternalId("cn=jsmith, ou=People, ou=OrgUnit3, o=sevenSeas");
        sampleUser.setAttribute(UID_DEF.getName(), "jsmith");
        sampleUser.setAttribute(CN_DEF.getName(), "jsmith");
        sampleUser.setAttribute(SN_DEF.getName(), "jsmith");
        sampleUser.setAttribute(LAST_NAME_DEF.getName(), "jsmith");
       
        entityManager.updateEntity(sampleUser);
       
        basicTestCases.testFetchSingleEntity(entityManager, sampleUser);

        // test attribute removal of required attribute ("lastname") with a required default value set for it
        sampleUser = new EntityImpl("user", "jsmith", userAttrDefs);
        sampleUser
                .setInternalId("cn=jsmith, ou=People, ou=OrgUnit3, o=sevenSeas");
        sampleUser.setAttribute(CN_DEF.getName(), "jsmith");
        sampleUser.setAttribute(SN_DEF.getName(), "jsmith");
        sampleUser.setAttribute(UID_DEF.getName(), "jsmith");
       
        entityManager.updateEntity(sampleUser);
       
        basicTestCases.testFetchSingleEntity(entityManager, sampleUser);
View Full Code Here

    }
   
    public void testUpdateMultivaluedEntityAttr() throws Exception
    {
        // first assert that the sample user is equal to the corresponding user in LDAP
        EntityImpl sampleRole = getInitialRole1();
       
        basicTestCases.testFetchSingleEntity(entityManager, sampleRole);
       
        // next, try some identity transformation checks to assert that updating works
        // 1. test attribute modification
        sampleRole.setAttribute(UNIQUEMEMBER_ATTR_DEF.getName(), Arrays.asList(new String[]{"cn=jsmith,ou=People,ou=OrgUnit3,o=sevenSeas"}) );
        entityManager.updateEntity(sampleRole);
       
       
        basicTestCases.testFetchSingleEntity(entityManager, sampleRole);

        sampleRole.setAttribute(UNIQUEMEMBER_ATTR_DEF.getName(), Arrays.asList(new String[]{"cn=jsmith,ou=People,ou=OrgUnit3,o=sevenSeas","cn=OrgUnit2User1,ou=People,ou=OrgUnit2,o=sevenSeas"}) );
        entityManager.updateEntity(sampleRole);
        basicTestCases.testFetchSingleEntity(entityManager, sampleRole);

        // 2. test attribute removal
        sampleRole = new EntityImpl("role", "Role1", roleAttrDefs);
        sampleRole.setInternalId("cn=Role1, o=sevenSeas");
        sampleRole.setAttribute(DESCRIPTION_ATTR_DEF.getName(), "Role 1");
        sampleRole.setAttribute(CN_DEF.getName(), "Role1");
        sampleRole.setAttribute(UNIQUEMEMBER_ATTR_DEF.getName(), Collections.EMPTY_LIST );
       
        // note: we call the user DAO directly, because updating internal
        // attributes is only meant to be used internally, e.g. from within an EntityRelationDAO
        entityManager.updateEntity(sampleRole);
       
View Full Code Here

       
        basicTestCases.testFetchSingleEntity(entityManager, sampleRole);
    }
   
    public void testAddEntity() throws Exception {
        EntityImpl jsmithCopy = getDefaultJoeSmithOnlyMappedAttrs();
        jsmithCopy.setId("jsmithCopy");
       
        entityManager.addEntity(jsmithCopy);
       
        jsmithCopy.setAttribute(UID_DEF.getName(), "jsmithCopy");
        jsmithCopy.setAttribute(CN_DEF.getName(), "jsmithCopy");
        jsmithCopy.setAttribute(SN_DEF.getName(), "jsmithCopy");
        jsmithCopy.setInternalId("cn=jsmithCopy, o=sevenSeas");
        basicTestCases.testFetchSingleEntity(entityManager, jsmithCopy);
    }
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.