Examples of DefaultClientEntry


Examples of org.apache.directory.shared.ldap.entry.client.DefaultClientEntry

   
    @Test
    public void testAdd() throws Exception
    {
        DN dn = new DN( "cn=testadd,ou=system" );
        Entry entry = new DefaultClientEntry( dn );
        entry.add( SchemaConstants.OBJECT_CLASS_AT, SchemaConstants.PERSON_OC );
        entry.add( SchemaConstants.CN_AT, "testadd_cn" );
        entry.add( SchemaConstants.SN_AT, "testadd_sn" );
       
        assertFalse( session.exists( dn ) );
       
        AddResponse response = connection.add( entry );
        assertNotNull( response );
View Full Code Here

Examples of org.apache.directory.shared.ldap.entry.client.DefaultClientEntry

   
    @Test
    public void testAddAsync() throws Exception
    {
        DN dn = new DN( "cn=testAsyncAdd,ou=system" );
        Entry entry = new DefaultClientEntry( dn );
        entry.add( SchemaConstants.OBJECT_CLASS_AT, SchemaConstants.PERSON_OC );
        entry.add( SchemaConstants.CN_AT, "testAsyncAdd_cn" );
        entry.add( SchemaConstants.SN_AT, "testAsyncAdd_sn" );
       
        assertFalse( session.exists( dn ) );

        AddFuture addFuture = connection.addAsync( new AddRequest( entry ));
View Full Code Here

Examples of org.apache.directory.shared.ldap.entry.client.DefaultClientEntry

    @Test
    public void testModifyWithEntry() throws Exception
    {
        DN dn = new DN( "uid=admin,ou=system" );
       
        Entry entry = new DefaultClientEntry( dn );
       
        String expectedSn = String.valueOf( System.currentTimeMillis() );
        String expectedCn = String.valueOf( System.currentTimeMillis() );
       
        entry.add( SchemaConstants.SN_AT, expectedSn );
       
        entry.add( SchemaConstants.CN_AT, expectedCn );
       
        connection.modify( entry, ModificationOperation.REPLACE_ATTRIBUTE );
       
        ServerEntry lookupEntry = session.lookup( dn );
View Full Code Here

Examples of org.apache.directory.shared.ldap.entry.client.DefaultClientEntry

       
        for ( int i = 0; i < numEntries; i++ )
        {
            String s = String.valueOf( i );
            DN dn = new DN( "cn=" + s + ",ou=system" );
            Entry entry = new DefaultClientEntry( dn );
            entry.add( SchemaConstants.OBJECT_CLASS_AT, SchemaConstants.PERSON_OC );
            entry.add( SchemaConstants.CN_AT, s );
            entry.add( SchemaConstants.SN_AT, s );

            connection.add( entry );
        }
       
        SearchRequest sr = new SearchRequest();
View Full Code Here

Examples of org.apache.directory.shared.ldap.entry.client.DefaultClientEntry

    private AddResponse createSubContext( DN parent, String type, String value ) throws Exception
    {
        DN dn = ( DN ) parent.clone();
        dn.add( "ou=" + value );
        Entry entry = new DefaultClientEntry( dn );
        entry.add( SchemaConstants.OBJECT_CLASS_AT, "person" );
        entry.add( SchemaConstants.OBJECT_CLASS_AT, "OrganizationalPerson" );
        entry.add( SchemaConstants.CN_AT, value );
        entry.add( SchemaConstants.SN_AT, value );
       
        AddResponse resp = getAdminConnection( ldapServer ).add( entry );
       
        return resp;
    }
View Full Code Here

Examples of org.apache.directory.shared.ldap.entry.client.DefaultClientEntry

    @Test
    public void testFailMoveEntryAlreadyExists() throws Exception
    {
        LdapConnection connection = getAdminConnection( ldapServer );

        Entry entry = new DefaultClientEntry( new DN( "ou=users,ou=groups,ou=system" ) );
        entry.add( SchemaConstants.OBJECT_CLASS_AT, "OrganizationalUnit" );
        entry.add( SchemaConstants.OU_AT, "users" );
       
        connection.add( entry );
        ModifyDnResponse resp = connection.rename( entry.getDn(), new RDN( "ou=users" ) );
        assertEquals( ResultCodeEnum.ENTRY_ALREADY_EXISTS, resp.getLdapResult().getResultCode() );

        Entry userzEntry = new DefaultClientEntry( new DN( "ou=userz,ou=groups,ou=system" ) );
        userzEntry.add( SchemaConstants.OBJECT_CLASS_AT, "OrganizationalUnit" );
        userzEntry.add( SchemaConstants.OU_AT, "userz" );
       
        connection.add( userzEntry );
       
        ModifyDnResponse modResp = connection.rename( "ou=userz,ou=groups,ou=system", "ou=users", true );
        assertEquals( ResultCodeEnum.ENTRY_ALREADY_EXISTS, modResp.getLdapResult().getResultCode() );
View Full Code Here

Examples of org.apache.directory.shared.ldap.entry.client.DefaultClientEntry

    @Test
    public void testFailAddOnAlias() throws Exception
    {
        LdapConnection connection = getAdminConnection( ldapServer );

        Entry entry = new DefaultClientEntry( new DN( "cn=toanother,ou=system" ) );
        entry.add( SchemaConstants.OBJECT_CLASS_AT, "alias", SchemaConstants.EXTENSIBLE_OBJECT_OC );
        entry.add( "aliasedObjectName", "ou=users,ou=system" );

        connection.add( entry );

        Entry aliasChild = new DefaultClientEntry( new DN( "ou=blah,cn=toanother,ou=system" ) );
        aliasChild.add( SchemaConstants.OBJECT_CLASS_AT, "organizationalUnit" );
        aliasChild.add( SchemaConstants.OU_AT, "blah" );

        AddResponse resp = connection.add( aliasChild );
        assertEquals( ResultCodeEnum.ALIAS_PROBLEM, resp.getLdapResult().getResultCode() );
    }
View Full Code Here

Examples of org.apache.directory.shared.ldap.entry.client.DefaultClientEntry

     * it exists already
     */
    public static DN createGroup( String cn, String firstMemberDn ) throws Exception
    {
        DN groupDN = new DN( "cn=" + cn + ",ou=groups,ou=system" );
        Entry entry = new DefaultClientEntry( groupDN );
        entry.add( SchemaConstants.OBJECT_CLASS_AT, "groupOfUniqueNames" );
        entry.add( SchemaConstants.UNIQUE_MEMBER_AT, firstMemberDn );
        entry.add( SchemaConstants.CN_AT, cn );

        getAdminConnection().add( entry );
        return groupDN;
    }
View Full Code Here

Examples of org.apache.directory.shared.ldap.entry.client.DefaultClientEntry

     */
    public static DN createUser( String uid, String password ) throws Exception
    {
        LdapConnection connection = getAdminConnection();

        Entry entry = new DefaultClientEntry( new DN( "uid=" + uid + ",ou=users,ou=system" ) );
        entry.add( SchemaConstants.UID_AT, uid );
        entry.add( SchemaConstants.OBJECT_CLASS_AT, "person", "organizationalPerson", "inetOrgPerson" );
        entry.add( SchemaConstants.SN_AT, uid );
        entry.add( SchemaConstants.CN_AT, uid );
        entry.add( SchemaConstants.USER_PASSWORD_AT, password );

        connection.add( entry );

        return entry.getDn();
    }
View Full Code Here

Examples of org.apache.directory.shared.ldap.entry.client.DefaultClientEntry

     */
    public static DN createGroup( String groupName ) throws Exception
    {
        DN groupDN = new DN( "cn=" + groupName + ",ou=groups,ou=system" );

        Entry entry = new DefaultClientEntry( groupDN );
        entry.add( SchemaConstants.OBJECT_CLASS_AT, "groupOfUniqueNames" );
        // TODO might be ServerDNConstants.ADMIN_SYSTEM_DN_NORMALIZED
        entry.add( SchemaConstants.UNIQUE_MEMBER_AT, "uid=admin, ou=system" );
        entry.add( SchemaConstants.CN_AT, groupName );

        getAdminConnection().add( entry );

        return groupDN;
    }
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.