1   /*
2    *   Licensed to the Apache Software Foundation (ASF) under one
3    *   or more contributor license agreements.  See the NOTICE file
4    *   distributed with this work for additional information
5    *   regarding copyright ownership.  The ASF licenses this file
6    *   to you under the Apache License, Version 2.0 (the
7    *   "License"); you may not use this file except in compliance
8    *   with the License.  You may obtain a copy of the License at
9    *
10   *     http://www.apache.org/licenses/LICENSE-2.0
11   *
12   *   Unless required by applicable law or agreed to in writing,
13   *   software distributed under the License is distributed on an
14   *   "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15   *   KIND, either express or implied.  See the License for the
16   *   specific language governing permissions and limitations
17   *   under the License.
18   *
19   */
20  package org.apache.directory.server.configuration;
21  
22  
23  import org.slf4j.Logger;
24  import org.slf4j.LoggerFactory;
25  
26  import junit.framework.TestCase;
27  
28  
29  /**
30   * TODO ApacheDSTest.
31   *
32   * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
33   * @version $Rev$, $Date$
34   */
35  public class ApacheDSTest extends TestCase
36  {
37      private static final Logger LOG = LoggerFactory.getLogger( ApacheDSTest.class );
38  
39     
40      public void testBogus()
41      {
42          System.out.println( "TODO: Fix this the real test case and delete me!" );
43      }
44  
45      
46      /* 
47      public void testLdifLoading() throws Exception
48      {
49          DirectoryService directoryService = new DefaultDirectoryService();
50          directoryService.setDenormalizeOpAttrsEnabled( true );
51          directoryService.setAllowAnonymousAccess( false );
52          directoryService.setExitVmOnShutdown( false );
53  
54          JdbmPartition example = new JdbmPartition();
55          example.setId( "example" );
56          example.setSuffix( "dc=example,dc=com" );
57          LdapDN contextDn = new LdapDN( "dc=example,dc=com" );
58          contextDn.normalize( directoryService.getRegistries().getAttributeTypeRegistry().getNormalizerMapping() );
59          ServerEntry contextEntry = new DefaultServerEntry( directoryService.getRegistries(), contextDn );
60          contextEntry.add( "objectClass", "top", "domain" );
61          contextEntry.add( "dc", "example" );
62          example.setContextEntry( contextEntry );
63          directoryService.addPartition( example );
64          directoryService.startup();
65          
66          LdapService ldapService = new LdapService();
67          ldapService.setDirectoryService( directoryService );
68          ldapService.setAllowAnonymousAccess( false );
69          ldapService.setSocketAcceptor( new SocketAcceptor( null ) );
70          ldapService.setEnabled( true );
71          ldapService.setIpPort( 20389 );
72  
73          ApacheDS ads = new ApacheDS( directoryService, ldapService, null );
74          File f = new File( System.getProperty( "ldifFile" ) );
75          ads.setLdifDirectory( f );
76          
77          try
78          {
79              ads.startup();
80          }
81          catch ( Throwable t )
82          {
83              LOG.error( "Failed to start up ApacheDS!", t );
84          }
85          
86          LdapDN dn = new LdapDN( "uid=aeinstein,ou=Users,dc=example,dc=com" );
87          assertNotNull( directoryService.getAdminSession().lookup( dn ) );
88      }
89      */
90  }