Přeskočit na hlavní obsah

Příspěvky

Zobrazují se příspěvky z září, 2014

Speed-up ApacheDS LDAP server for testing

Using the ApacheDS for unit testing can be painful if you need to restart/reconfigure the server several times. IT'S SOOO SLOOOOW.

The reason is simple. The default configuration creates a nice directory structure and unpacks all the schema files from JAR file to one of the created directories. Then it creates a file based JDBM partition for you. And it loads your LDIF data to it.

It means many, money, many I/O operations even before the LDAP starts.

Nevertheless, ApacheDS has a nice API to resolve this issue. You will need to make your hands dirty little bit, but it's worth it.

Follow these 3 simple steps and it's all:

Create schema partition class, which stores LDAP schema data in-memory only: sample InMemorySchemaPartition.javaCreate DirectoryServiceFactory implementation, which will use in-memory AvlPartitions instead of JDBM and as a schema partition it will use class from the first step: sample InMemoryDirectoryServiceFactory.javause the new DirectoryServiceFactory to…