directory-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Gianmaria Clerici" <gcler...@bridgestream.com>
Subject startup and shutdown of apache 0.9.2 programmatically
Date Wed, 28 Sep 2005 17:06:05 GMT
I am trying to start and stop apache 0.9.2 from my JUnit tests.

This is the code I have.

 

It starts just fine, and it seems to stop just fine.

But then I start it again, even if there are no errors, it doesn't seem
to work properly.

I get some weird LDAP error 80.

 

Can you suggest a better way to shut it down ?

Am I missing something ?

 

private void startApacheDS() throws NamingException {

        Properties env;

 

        ApplicationContext factory = new
FileSystemXmlApplicationContext("config/server.bridgestream.xml");

        ServerStartupConfiguration cfg = (ServerStartupConfiguration)
factory.getBean("configuration");

        env = (Properties) factory.getBean("environment");

        env.setProperty(Context.PROVIDER_URL, "ou=system");

        env.setProperty(Context.INITIAL_CONTEXT_FACTORY,
ServerContextFactory.class.getName());

        env.putAll(cfg.toJndiEnvironment());

 

        new InitialDirContext(env);

    }

 

    private void stopApacheDs() throws NamingException {

        Properties env;

 

        ApplicationContext factory = new
FileSystemXmlApplicationContext("config/server.bridgestream.xml");

        ShutdownConfiguration cfg = (ShutdownConfiguration)
factory.getBean("shutdownConfiguration");

        env = (Properties) factory.getBean("environment");

        env.setProperty(Context.PROVIDER_URL, "ou=system");

        env.setProperty(Context.INITIAL_CONTEXT_FACTORY,
ServerContextFactory.class.getName());

        env.putAll(cfg.toJndiEnvironment());

 

        new InitialDirContext(env);

    }

 

Of course I added the bean for the shutdownConfiguration to the XML
file:

 

    <bean id="shutdownConfiguration"
class="org.apache.ldap.server.configuration.ShutdownConfiguration">

        <constructor-arg value="default"/>

    </bean>


Mime
View raw message