Examples of LDAPConnection


Examples of org.apache.directory.ldap.client.api.LdapConnection

        @Test
        public void testDelegatedSSLAuthentication() throws Exception
    {
        assertTrue( getService().isStarted() );
        assertEquals( "DelegatedAuthIT-method", getService().getInstanceId() );
        LdapConnection ldapConnection = new LdapNetworkConnection( "localhost", 10200 );

        ldapConnection.setTimeOut( 0L );
        ldapConnection.bind( "uid=antoine,ou=users,ou=system", "secret" );

        assertTrue( ldapConnection.isAuthenticated() );

        ldapConnection.unBind();

        try
        {
            ldapConnection.bind( "uid=antoine,ou=users,ou=system", "sesame" );
            fail();
        }
        catch ( LdapAuthenticationException lae )
        {
            assertTrue( true );
        }

        ldapConnection.unBind();
        ldapConnection.close();
    }
View Full Code Here

Examples of org.apache.directory.ldap.client.api.LdapConnection

     */
    @Test
    @Ignore
    public void testConcurrentSearch() throws Exception
    {
        LdapConnection connection = IntegrationUtils.getAdminConnection( getService() );
        AddThread addThread = new AddThread();

        addThread.start();

        // Now that we have started the add thread, let's do some searches

        for ( int i = 0; i < 100; i++ )
        {
            try
            {
                EntryCursor results = connection.search( "dc=example,dc=com", "(cn=*)", SearchScope.SUBTREE, "*" );

                int nbFound = 0;

                while ( results.next() && ( nbFound < 1000 ) )
                {
                    Entry result = results.get();
                    nbFound++;
                }

                System.out.println( "Running " + i + "th search, getting back " + nbFound
                    + " entries, nb added entries : " + nbAdded );

                results.close();

                if ( nbAdded >= 10000 )
                {
                    break;
                }

                Thread.sleep( 1000 );
            }
            catch ( Exception e )
            {
                System.out.println( "-------------> Exception occured on " + i + "th search : " + e.getMessage() );
                e.printStackTrace();
            }
        }

        connection.close();
    }
View Full Code Here

Examples of org.apache.directory.ldap.client.api.LdapConnection

    {
        public void run()
        {
            try
            {
                LdapConnection connection = IntegrationUtils.getAdminConnection( getService() );

                try
                {
                    for ( int i = 0; i < 10000; i++ )
                    {
                        Dn dn = new Dn( "cn=test" + i + ",dc=example,dc=com" );
                        Entry entry = new DefaultEntry( getService().getSchemaManager(), dn,
                            "ObjectClass: top",
                            "ObjectClass: person",
                            "sn: TEST",
                            "cn", "test" + i );

                        connection.add( entry );
                        nbAdded++;
                    }
                }
                finally
                {
                    connection.close();
                }
            }
            catch ( LdapException le )
            {
                System.out.println( "-------------> LdapException occured on" + nbAdded + " addition : "
View Full Code Here

Examples of org.apache.directory.ldap.client.api.LdapConnection

     * Add a child
     */
    @Test
    public void testAddChild() throws Exception
    {
        LdapConnection connection = IntegrationUtils.getAdminConnection( getService() );
       
        Map<String, Entry> results = getAllEntries( connection, "dc=test,dc=example,dc=com" );

//        System.out.println( "Entries found :");
//        System.out.println( "--------------");
//       
//        for ( String dn : results.keySet() )
//        {
//            System.out.println( dn );
//        }
//
//        connection.close();

//        System.out.println( "Stopping the service---------------------------------");
//        System.out.println();
       
        // Shutdown the DirectoryService
        getService().shutdown();
        assertFalse( getService().isStarted() );

//        System.out.println( "Starting the service---------------------------------");

        // And restart it
        getService().startup();
        assertTrue( getService().isStarted() );

        connection = IntegrationUtils.getAdminConnection( getService() );

        // Add the child
        Entry child2 = new DefaultEntry(
            "cn=child2,cn=imadmin,ou=groups,dc=test,dc=example,dc=com",
            "objectClass: top",
            "objectClass: groupOfUniqueNames",
            "cn: child2",
            "uniqueMember: uid=dummy2",
            "description: child2" );

//        SchemaManager schemaManager = getService().getSchemaManager();
//        Dn contextDn = new Dn( schemaManager, "dc=example,dc=com" );
//        MavibotPartition partition = ( MavibotPartition ) getService().getPartitionNexus().getPartition( contextDn );
//        partition.dumpRdnIdx( Partition.ROOT_ID, "" );
       
//        System.out.println( "Adding child2 : " + child2.getDn() );
        connection.add( child2 );

//        partition.dumpRdnIdx( Partition.ROOT_ID, "" );
       
//        Entry found = connection.lookup( "cn=child2,cn=imadmin,ou=groups,dc=test,dc=example,dc=com" );
//        System.out.println( "Child2 exists :\n" + found);
       
        assertTrue( connection.exists( "cn=child2,cn=imadmin,ou=groups,dc=test,dc=example,dc=com" ) );
        results = getAllEntries( connection, "dc=test,dc=example,dc=com" );

//        System.out.println( "Entries found :");
//        System.out.println( "--------------");
//       
//        for ( String dn : results.keySet() )
//        {
//            System.out.println( dn );
//        }
       
        // --------------------------------------------------------------------
        // Make sure entries not selected by subentryA do not have the mark
        // --------------------------------------------------------------------
        connection.close();
       
//        System.out.println( "Stopping the service---------------------------------");
        System.out.println();

        // Now shutdown the DirectoryService
        getService().shutdown();
        assertFalse( getService().isStarted() );

//        System.out.println( "Starting the service---------------------------------");

        // And restart it
        getService().startup();
        assertTrue( getService().isStarted() );

        // Fetch the entries again
        connection = IntegrationUtils.getAdminConnection( getService() );

        Entry found = connection.lookup( "cn=child2,cn=imadmin,ou=groups,dc=test,dc=example,dc=com" );
//        System.out.println( "Child2 STILL exists :\n" + found);
       

        // Check the resulting modifications
        results = getAllEntries( connection, "dc=test,dc=example,dc=com" );

        System.out.println();

//        System.out.println( "Entries found :");
//        System.out.println( "--------------");
       
        int count = 0;
       
        for ( String dn : results.keySet() )
        {
            count++;
//            System.out.println( dn );
        }

        connection.close();
       
        assertEquals( 4, count );
    }
View Full Code Here

Examples of org.ietf.ldap.LDAPConnection

    // ------------
    public LDAPSession() {
        // Explicitly call the superclass constructor to prevent the implicit
        // call
        super();
        this.connection = new LDAPConnection();
    }
View Full Code Here

Examples of org.nasutekds.server.admin.client.ldap.LDAPConnection

      String bindPassword = ci.getBindPassword();
      TrustManager trustManager = ci.getTrustManager();
      KeyManager keyManager = ci.getKeyManager();

      // Do we have a secure connection ?
      LDAPConnection conn ;
      if (ci.useSSL())
      {
        InitialLdapContext ctx;
        String ldapsUrl = "ldaps://" + hostName + ":" + portNumber;
        while (true)
View Full Code Here

Examples of org.nasutekds.server.tools.LDAPConnection

   */
  public LDAPConnection connect(LDAPConnectionConsoleInteraction ui,
                                PrintStream out, PrintStream err)
          throws LDAPConnectionException
  {
    LDAPConnection connection = null;
    try {
      ui.run();
      LDAPConnectionOptions options = new LDAPConnectionOptions();
      options.setVersionNumber(3);
      connection = connect(
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.