Examples of LdifEntry


Examples of org.apache.directory.shared.ldap.ldif.LdifEntry

     * @throws NamingException if there are problems
     */
    @Test
    public void testNoRdnChangesOnAdminByNonAdmin() throws Exception
    {
        LdifEntry akarasulu = getUserAddLdif();

        service.getAdminSession().add(
            new DefaultServerEntry( service.getSchemaManager(), akarasulu.getEntry() ) );

        try
        {
            service.getAdminSession().rename(
                new DN( "uid=admin,ou=system" ),
View Full Code Here

Examples of org.apache.directory.shared.ldap.ldif.LdifEntry

     * @throws NamingException on error
     */
    @Test
    public void testModifyOnAdminByNonAdmin() throws Exception
    {
        LdifEntry akarasulu = getUserAddLdif();
       
        service.getAdminSession().add(
            new DefaultServerEntry( service.getSchemaManager(), akarasulu.getEntry() ) );
       
        // Read the entry we just created using the akarasuluSession
        Entry readEntry = service.getAdminSession().lookup( akarasulu.getDn(), new String[]{ "userPassword"} );
       
        assertTrue( Arrays.equals( akarasulu.get( "userPassword" ).getBytes(), readEntry.get( "userPassword" ).getBytes() ) );

        EntryAttribute attribute = new DefaultClientAttribute( "userPassword", "replaced" );

        List<Modification> mods = new ArrayList<Modification>();
       
View Full Code Here

Examples of org.apache.directory.shared.ldap.ldif.LdifEntry

     * @throws NamingException if there are problems
     */
    @Test
    public void testNoSearchByNonAdmin() throws Exception
    {
        LdifEntry akarasulu = getUserAddLdif();
       
        service.getAdminSession().add(
            new DefaultServerEntry( service.getSchemaManager(), akarasulu.getEntry() ) );

        try
        {
            ExprNode filter = FilterParser.parse( "(objectClass=*)" );
            service.getAdminSession().search( new DN( "ou=system" ), SearchScope.SUBTREE, filter , AliasDerefMode.DEREF_ALWAYS, null );
View Full Code Here

Examples of org.apache.directory.shared.ldap.ldif.LdifEntry

{

    @Test
    public void testObjectFactory() throws Exception
    {
        LdifEntry akarasulu = getUserAddLdif();
        service.getAdminSession().add(
            new DefaultServerEntry( service.getSchemaManager(), akarasulu.getEntry() ) );


        LdapContext sysRoot = getSystemContext( service );
        sysRoot.addToEnvironment( Context.OBJECT_FACTORIES, PersonObjectFactory.class.getName() );
        Object obj = sysRoot.lookup( "uid=akarasulu, ou=users" );
View Full Code Here

Examples of org.apache.directory.shared.ldap.ldif.LdifEntry

     *
     * @throws NamingException on error
     */
    protected void createData() throws Exception
    {
        LdifEntry akarasulu = getUserAddLdif();
        service.getAdminSession().add(
            new DefaultServerEntry( service.getSchemaManager(), akarasulu.getEntry() ) );

        LdapContext sysRoot = getSystemContext( service );

        /*
         * create ou=testing00,ou=system
View Full Code Here

Examples of org.apache.directory.shared.ldap.ldif.LdifEntry

{

    @Test
    public void testListSystemAsNonAdmin() throws Exception
    {
        LdifEntry akarasulu = getUserAddLdif();
        service.getAdminSession().add(
            new DefaultServerEntry( service.getSchemaManager(), akarasulu.getEntry() ) );

        LdapContext sysRoot = getContext( akarasulu.getDn().getName(), service, "ou=system" );
        HashSet<String> set = new HashSet<String>();
        NamingEnumeration<NameClassPair> list = sysRoot.list( "" );

        while ( list.hasMore() )
        {
View Full Code Here

Examples of org.apache.directory.shared.ldap.ldif.LdifEntry


    @Test
    public void testListUsersAsNonAdmin() throws Exception
    {
        LdifEntry akarasulu = getUserAddLdif();
        service.getAdminSession().add(
            new DefaultServerEntry( service.getSchemaManager(), akarasulu.getEntry() ) );

        LdapContext sysRoot = getContext( akarasulu.getDn().getName(), service, "ou=system" );
        HashSet<String> set = new HashSet<String>();
        NamingEnumeration<NameClassPair> list = sysRoot.list( "ou=users" );

        while ( list.hasMore() )
        {
View Full Code Here

Examples of org.apache.directory.shared.ldap.ldif.LdifEntry

    @Test
    public void testListUsersAsAdmin() throws Exception
    {
        LdapContext sysRoot = getSystemContext( service );
        HashSet<String> set = new HashSet<String>();
        LdifEntry akarasulu = getUserAddLdif();
        service.getAdminSession().add(
            new DefaultServerEntry( service.getSchemaManager(), akarasulu.getEntry() ) );
               

        NamingEnumeration<NameClassPair> list = sysRoot.list( "ou=users" );
       
        while ( list.hasMore() )
View Full Code Here

Examples of org.apache.directory.shared.ldap.ldif.LdifEntry

    public static LdifEntry getUserAddLdif( String dnstr, byte[] password, String cn, String sn )
            throws InvalidNameException, NamingException
    {
        DN dn = new DN( dnstr );
        LdifEntry ldif = new LdifEntry();
        ldif.setDn( dnstr );
        ldif.setChangeType( ChangeType.Add );

        EntryAttribute attr = new DefaultClientAttribute( "objectClass",
            "top", "person", "organizationalPerson", "inetOrgPerson" );
        ldif.addAttribute( attr );

        attr = new DefaultClientAttribute( "ou", "Engineering", "People" );
        ldif.addAttribute( attr );

        String uid = ( String ) dn.getRdn().getNormValue();
        ldif.putAttribute( "uid", uid );

        ldif.putAttribute( "l", "Bogusville" );
        ldif.putAttribute( "cn", cn );
        ldif.putAttribute( "sn", sn );
        ldif.putAttribute( "mail", uid + "@apache.org" );
        ldif.putAttribute( "telephoneNumber", "+1 408 555 4798" );
        ldif.putAttribute( "facsimileTelephoneNumber", "+1 408 555 9751" );
        ldif.putAttribute( "roomnumber", "4612" );
        ldif.putAttribute( "userPassword", password );

        String givenName = cn.split( " " )[0];
        ldif.putAttribute( "givenName", givenName );
        return ldif;
    }
View Full Code Here

Examples of org.apache.directory.shared.ldap.ldif.LdifEntry

    {
        for ( LdifEntry testEntry : testEntries )
        {
            try
            {
                LdifEntry ldifEntry = testEntry.clone();
                Entry entry = ldifEntry.getEntry();
                String dn = ldifEntry.getDn().getName();

                try
                {
                    getAdminSession().add( new DefaultServerEntry( schemaManager, entry ) );
                }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.