Package org.apache.directory.ldap.client.api

Examples of org.apache.directory.ldap.client.api.LdapConnection.lookup()


        ModifyResponse resp = con.modify( modReq );
        assertEquals( ResultCodeEnum.INVALID_ATTRIBUTE_SYNTAX, resp.getLdapResult().getResultCode() );

        // Check whether entry is unmodified, i.e. no description
        Entry entry = con.lookup( DN );
        assertEquals( "description exists?", null, entry.get( "description" ) );
        con.close();
    }

View Full Code Here


        addRequest.addControl( PP_REQ_CTRL );

        AddResponse addResp = adminConnection.add( addRequest );
        assertEquals( ResultCodeEnum.SUCCESS, addResp.getLdapResult().getResultCode() );

        userEntry = adminConnection.lookup( userDn, "*", "+" );
        assertEquals( userDn.getName(), userEntry.get( "pwdPolicySubEntry" ).getString() );

        ModifyRequest modReq = new ModifyRequestImpl();
        modReq.setName( userDn );
        String modSubEntryDn = "cn=policy,ou=system";
View Full Code Here

        String modSubEntryDn = "cn=policy,ou=system";
        modReq.replace( "pwdPolicySubEntry", modSubEntryDn );
        ModifyResponse modResp = adminConnection.modify( modReq );
        assertEquals( ResultCodeEnum.SUCCESS, modResp.getLdapResult().getResultCode() );

        userEntry = adminConnection.lookup( userDn, "*", "+" );
        assertEquals( modSubEntryDn, userEntry.get( "pwdPolicySubEntry" ).getString() );

        // try to modify the subentry as a non-admin
        adminConnection = new LdapNetworkConnection( "localhost", getLdapServer().getPort() );
        adminConnection.bind( userDn.getName(), password );
View Full Code Here

    public void testLookupExistingEntryAPI() throws Exception
    {
        LdapConnection connection = ServerIntegrationUtils.getAdminConnection( getLdapServer() );
        connection.setTimeOut( 0L );

        Entry entry = connection.lookup( "uid=admin,ou=system", "name" );
        assertNotNull( entry );

        assertEquals( 2, entry.size() );
        assertTrue( entry.containsAttribute( "cn", "sn" ) );
        assertTrue( entry.contains( "cn", "system administrator" ) );
View Full Code Here

    public void testLookupRootDSE() throws Exception
    {
        LdapConnection connection = ServerIntegrationUtils.getAdminConnection( getLdapServer() );
        connection.setTimeOut( 0L );

        Entry entry = connection.lookup( "" );
        assertNotNull( entry );

        connection.close();
    }
View Full Code Here

    @Test
    public void testLookupNonExistingEntryAPI() throws Exception
    {
        LdapConnection connection = ServerIntegrationUtils.getAdminConnection( getLdapServer() );

        Entry entry = connection.lookup( "uid=absent,ou=system", "name" );
        assertNull( entry );

        connection.close();
    }
}
View Full Code Here

        ModifyResponse resp = con.modify( modReq );
        assertEquals( ResultCodeEnum.INVALID_ATTRIBUTE_SYNTAX, resp.getLdapResult().getResultCode() );

        // Check whether entry is unmodified, i.e. no description
        Entry entry = con.lookup( DN );
        assertEquals( "description exists?", null, entry.get( "description" ) );
        con.close();
    }

View Full Code Here

        {
            // expected
        }

        // Check whether entry is unmodified, i.e. no displayName
        Entry entry = con.lookup( DN );
        assertEquals( "displayName exists?", null, entry.get( "displayName" ) );
    }
}
View Full Code Here

        addUser( adminConnection, "userPwdHist", "12345" );

        checkBindSuccess( userDn, "12345" );

        Entry entry = adminConnection.lookup( userDn, "*", "+" );

        Attribute pwdHistAt = entry.get( PasswordPolicySchemaConstants.PWD_HISTORY_AT );
        assertNotNull( pwdHistAt );
        assertEquals( 1, pwdHistAt.size() );

View Full Code Here

            "67891" );

        adminConnection.modify( userDn, modification );
        checkBindSuccess( userDn, "67891" );

        entry = adminConnection.lookup( userDn, "*", "+" );

        pwdHistAt = entry.get( PasswordPolicySchemaConstants.PWD_HISTORY_AT );
        assertNotNull( pwdHistAt );
        assertEquals( 2, pwdHistAt.size() );

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.