directory-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Paul Edwards <>
Subject RE: Need to control what port is used with unit testing setup
Date Wed, 16 Sep 2009 22:04:59 GMT

I'm using apacheDS for unit testing. I do the following to control what port the service is
started on:

TcpTransport transport = new TcpTransport(port, numberOfThreads);
        LdapServer serv = new LdapServer();
        log.debug("Server is ssl enabled: " + transport.isSSLEnabled());
        log.debug("Server enabled: " + serv.isEnabled());

Hope that helps.

Paul Edwards
Solutions Engineer
Identity Solutions Practice

From: Gary Horton []
Sent: Thursday, 17 September 2009 7:31 a.m.
Subject: Need to control what port is used with unit testing setup

Hi Apache DS team -

    As per your invitation to ask for help at the bottom of,
I do have a question for you.

    I've succeeded starting up and connecting to the standalone server,
and in setting up the embedded server. Next I started looking at the
unit testing instructions on your website, but have come to a dilemma.
In the section "Creating a Blank Test", it is stated that "...let's
declare the framework for a simple unit test, using a server which will
be used through socket (the first free port above 1023 will be used)..."
- and I see from looking at the LdapServerFactory source that indeed
this is how it is done. I wonder however if there are any hidden hooks
you might have that would allow us to control what port is used - or to
at least find out at runtime what port has been selected.

    We'd need this information because we are using iBatis, connecting
to a JDBC-LDAP bridge driver (
To make the iBatis connection, we need a database URL, something like
jdbc:ldap://localhost:10389/ou=system (which works out of the box with
the standalone service for Apache DS). So one way or the other, we'd
need to at a minimum know what port is in use, or better yet be able to
set that port explicitly.

    Any ideas? Thanks mucho for any help here -

Gary Horton

View raw message