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  package org.apache.directory.server;
20  
21  import org.apache.directory.server.configuration.ApacheDS;
22  import org.apache.xbean.spring.context.FileSystemXmlApplicationContext;
23  import org.junit.Test;
24  import org.springframework.context.ApplicationContext;
25  
26  import java.io.File;
27  import java.net.URL;
28  
29  
30  /**
31   * @version $Rev: 596086 $ $Date: 2007-11-18 15:15:50 +0100 (So, 18 Nov 2007) $
32   */
33  public class SpringServerTest
34  {
35      private String providerURL = "dc=example,dc=com";
36  
37      @Test
38      public void testSpringServerStartup() throws Exception {
39          ClassLoader classLoader = this.getClass().getClassLoader();
40          URL configURL = classLoader.getResource( "server.xml" );
41  
42          File configF = new File( configURL.toURI() );
43          ApplicationContext factory = new FileSystemXmlApplicationContext( configF.toURI().toURL().toString() );
44          ApacheDS apacheDS = ( ApacheDS ) factory.getBean( "apacheDS" );
45          File workingDirFile = new File( configF.getParentFile(), "work" );
46          apacheDS.getDirectoryService().setWorkingDirectory( workingDirFile );
47      }
48  }