Format API Test

Test support for format handler implementations

License

License

Categories

Categories

Maven Build Tools ORM Data
GroupId

GroupId

com.btmatthews.maven.plugins.ldap
ArtifactId

ArtifactId

format-api-test
Last Version

Last Version

1.3.2
Release Date

Release Date

Type

Type

jar
Description

Description

Format API Test
Test support for format handler implementations
Project Organization

Project Organization

Brian Matthews

Download format-api-test

How to add to project

<!-- https://jarcasting.com/artifacts/com.btmatthews.maven.plugins.ldap/format-api-test/ -->
<dependency>
    <groupId>com.btmatthews.maven.plugins.ldap</groupId>
    <artifactId>format-api-test</artifactId>
    <version>1.3.2</version>
</dependency>
// https://jarcasting.com/artifacts/com.btmatthews.maven.plugins.ldap/format-api-test/
implementation 'com.btmatthews.maven.plugins.ldap:format-api-test:1.3.2'
// https://jarcasting.com/artifacts/com.btmatthews.maven.plugins.ldap/format-api-test/
implementation ("com.btmatthews.maven.plugins.ldap:format-api-test:1.3.2")
'com.btmatthews.maven.plugins.ldap:format-api-test:jar:1.3.2'
<dependency org="com.btmatthews.maven.plugins.ldap" name="format-api-test" rev="1.3.2">
  <artifact name="format-api-test" type="jar" />
</dependency>
@Grapes(
@Grab(group='com.btmatthews.maven.plugins.ldap', module='format-api-test', version='1.3.2')
)
libraryDependencies += "com.btmatthews.maven.plugins.ldap" % "format-api-test" % "1.3.2"
[com.btmatthews.maven.plugins.ldap/format-api-test "1.3.2"]

Dependencies

compile (2)

Group / Artifact Type Version
com.unboundid : unboundid-ldapsdk jar 3.1.1
junit : junit jar 4.12

Project Modules

There are no modules declared in this project.

LDAP Maven Plugin

Build Status Maven Central License

The LDAP Maven Plugin is a Maven plugin that can:

  • Import/export data to/from an LDAP directory server. Both the: LDIF and DSML formats are supported.

  • Launch and shutdown a LDAP directory server in the Maven build life-cycle. The plugin supports the following LDAP directory servers:

Importing or exporting data

The plugin provides the following goals to import or export content from a LDAP directory server:

  • load is used to load content from a file into a LDAP directory server.

  • dump is used to dump content to a file from a LDAP directory sever.

The following file formats are supported

  • LDIF - LDAP Directory Interchange Format

  • DSML - Directory Services Markup Language

LDAP Data Interchange Format (LDIF)

Import

The following POM fragment demonstrates how to load content into a LDAP directory server from a LDIF formatted file using the load goal of the LDAP Maven Plugin.

<plugin>
    <groupId>com.btmatthews.maven.plugins</groupId>
    <artifactId>ldap-maven-plugin</artifactId>
    <version>1.3.2</version>
    <executions>
        <execution>
            <id>load</id>
            <goals>
                <goal>load</goal>
            </goals>
            <configuration>
                <host>localhost</host>
                <port>10389</port>
                <authDn>uid=admin,ou=system</authDn>
                <passwd>secret</passwd>
                <sources>
                    <ldif>load.ldif</ldif>
                </sources>
            </configuration>
        </execution>
    </executions>
</plugin>

Export

The following POM fragment demonstrates how to export content from a LDAP directory server to a LDIF formatted file using the dump goal of the LDAP Maven Plugin.

<plugin>
    <groupId>com.btmatthews.maven.plugins</groupId>
    <artifactId>ldap-maven-plugin</artifactId>
    <version>1.3.2</version>
    <executions>
        <execution>
            <id>dump</id>
            <goals>
                <goal>dump</goal>
            </goals>
            <configuration>
                <host>localhost</host>
                <port>10389</port>
                <authDn>uid=admin,ou=system</authDn>
                <passwd>secret</passwd>
                <searchBase>dc=btmatthews,dc=com</searchBase>
                <filename>dump.ldif</filename>
                <format>ldif</format>
            </configuration>
        </execution>
    </executions>
</plugin>

Directory Service Markup Language (DSML)

Import

The following POM fragment demonstrates how to load content into a LDAP directory server from a DSML formatted file using the load goal of the LDAP Maven Plugin.

<plugin>
    <groupId>com.btmatthews.maven.plugins</groupId>
    <artifactId>ldap-maven-plugin</artifactId>
    <version>1.3.2</version>
    <executions>
        <execution>
            <id>load</id>
            <goals>
                <goal>load</goal>
            </goals>
            <configuration>
                <host>localhost</host>
                <port>10389</port>
                <authDn>uid=admin,ou=system</authDn>
                <passwd>secret</passwd>
                <sources>
                    <dsml>${basedir}/load.dsml</dsml>
                </sources>
            </configuration>
        </execution>
    </executions>
</plugin>

Export

The following POM fragment demonstrates how to export content from a LDAP directory server to a DSML formatted file using the dump goal of the LDAP Maven Plugin.

<plugin>
    <groupId>com.btmatthews.maven.plugins</groupId>
    <artifactId>ldap-maven-plugin</artifactId>
    <version>1.3.2</version>
    <executions>
        <execution>
            <id>dump</id>
            <goals>
                <goal>dump</goal>
            </goals>
            <configuration>
                <host>localhost</host>
                <port>10389</port>
                <authDn>uid=admin,ou=system</authDn>
                <passwd>secret</passwd>
                <searchBase>dc=btmatthews,dc=com</searchBase>
                <filename>dump.dsml</filename>
                <format>dsml</format>
            </configuration>
        </execution>
    </executions>
</plugin>

Running an LDAP Server in the build life-cycle

pom.xml

The following POM fragment uses the run goal to launch an embedded LDAP directory server prior to the execution of the integration tests and then uses the stop goal to shutdown the embedded LDAP directory server upon completion of the integration tests.

<?xml version="1.0" encoding="UTF-8"?>
<project
  xmlns="http://maven.apache.org/POM/4.0.0"
  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  xsi:schemaLocation="
    http://maven.apache.org/POM/4.0.0
    http://maven.apache.org/xsd/maven-4.0.0.xsd">
  <build>
    <pluginManagement>
      <plugins>
        <plugin>
          <groupId>com.btmatthews.maven.plugins</groupId>
          <artifactId>ldap-maven-plugin</artifactId>
          <version>1.3.2</version>
        </plugin>
      </plugins>
    </pluginManagement>
    <plugins>
      <plugin>
        <groupId>com.btmatthews.maven.plugins</groupId>
        <artifactId>ldap-maven-plugin</artifactId>
        <configuration>
          <monitorPort>11389</monitorPort>
          <monitorKey>ldap</monitorKey>
          <daemon>true</daemon>
        </configuration>
        <executions>
          <execution>
            <id>start-ldap</id>
            <goals>
              <goal>run</goal>
            </goals>
            <phase>pre-integration-test</phase>
          </execution>
          <execution>
            <id>stop-ldap</id>
            <goals>
              <goal>stop</goal>
            </goals>
            <phase>post-integration-test</phase>
          </execution>
        </executions>
      </plugin>
    </plugins>
  </build>
</project>

Connecting in Java

The following LDAP client libraries can be used to connect to the embedded LDAP server:

The LDAPUnit library provides an assortment of assertion and verification methods for use in unit and integration test cases.

Maven Central Coordinates

The LDAP Maven Plugin has been published in Maven Central at the following coordinates:

<plugin>
    <groupId>com.btmatthews.maven.plugins</groupId>
    <artifactId>ldap-maven-plugin</artifactId>
    <version>1.3.2</version>
</plugin>

Note: If you want to use OpenDJ you will also need to add the following repository to your pom.xml or settings.xml file since the ForgeRock dependencies are not available from Maven Central.

<repository>
    <id>maven.forgerock.org</id>
    <name>maven.forgerock.org-releases</name>
    <url>http://maven.forgerock.org/repo/releases</url>
</repository>

License & Source Code

The LDAP Maven Plugin is made available under the Apache License and the source code is hosted on GitHub at https://github.com/bmatthews68/ldap-maven-plugin.

Versions

Version
1.3.2