com.zimory.ldapunit:ldapunit-parent

Set up and expect LDAP server contents

Лицензия

Лицензия

Группа

Группа

com.zimory.ldapunit
Идентификатор

Идентификатор

ldapunit-parent
Последняя версия

Последняя версия

1.0.0
Дата

Дата

Тип

Тип

pom
Описание

Описание

Set up and expect LDAP server contents
Ссылка на сайт

Ссылка на сайт

http://github.com/zimory/ldapunit
Система контроля версий

Система контроля версий

https://github.com/zimory/ldapunit

Скачать ldapunit-parent

Имя Файла Размер
ldapunit-parent-1.0.0.pom 5 KB
Обзор

Как подключить последнюю версию

<!-- https://jarcasting.com/artifacts/com.zimory.ldapunit/ldapunit-parent/ -->
<dependency>
    <groupId>com.zimory.ldapunit</groupId>
    <artifactId>ldapunit-parent</artifactId>
    <version>1.0.0</version>
    <type>pom</type>
</dependency>
// https://jarcasting.com/artifacts/com.zimory.ldapunit/ldapunit-parent/
implementation 'com.zimory.ldapunit:ldapunit-parent:1.0.0'
// https://jarcasting.com/artifacts/com.zimory.ldapunit/ldapunit-parent/
implementation ("com.zimory.ldapunit:ldapunit-parent:1.0.0")
'com.zimory.ldapunit:ldapunit-parent:pom:1.0.0'
<dependency org="com.zimory.ldapunit" name="ldapunit-parent" rev="1.0.0">
  <artifact name="ldapunit-parent" type="pom" />
</dependency>
@Grapes(
@Grab(group='com.zimory.ldapunit', module='ldapunit-parent', version='1.0.0')
)
libraryDependencies += "com.zimory.ldapunit" % "ldapunit-parent" % "1.0.0"
[com.zimory.ldapunit/ldapunit-parent "1.0.0"]

Зависимости

Библиотека не имеет зависимостей. Это самодостаточное приложение, которое не зависит ни от каких других библиотек.

Модули Проекта

  • core

LdapUnit

Set up and expect LDAP server contents.

Example usage

Test

import com.google.common.base.Supplier;
import com.unboundid.ldap.listener.InMemoryDirectoryServer;

import org.junit.Rule
import org.junit.Test;

import com.zimory.ldapunit.core.ShouldMatchLdapDataSet;
import com.zimory.ldapunit.core.UsingLdapDataSet;
import com.zimory.ldapunit.core.LdapWatcher;
import com.zimory.ldapunit.core.DirectoryServerAccess;
import com.zimory.ldapunit.core.InMemoryDirectoryServerAccess;

public class SomeIT extends AbstractIT {

    private static final String ROOT_CONTEXT_DN = "dc=example,dc=com";

    @Inject
    private InMemoryDirectoryServer ldapServer;

    @Rule
    public LdapWatcher ldapWatcher = new LdapWatcher(new Supplier<DirectoryServerAccess>() {
        @Override
        public DirectoryServerAccess get() {
            return new InMemoryDirectoryServerAccess(ldapServer, ROOT_CONTEXT_DN);
        }
    });

    @Test
    @UsingLdapDataSet
    @ShouldMatchLdapDataSet
    public void findAndAddNewEntry() throws Exception {
        ldapServer.assertEntryExists("cn=SomeUser," + ROOT_CONTEXT_DN);
        ldapServer.add(new Entry("cn=SomeOtherUser," + ROOT_CONTEXT_DN, new Attribute("objectClass", "top")));
    }

}

Datasets

/ldifs/findAndAddNewEntry.ldif

dn: cn=SomeUser,dc=example,dc=com
cn: SomeUser
objectClass: top

/ldifs/expected-findAndAddNewEntry.ldif

dn: cn=SomeUser,dc=example,dc=com
cn: SomeUser
objectClass: top

dn: cn=SomeOtherUser,dc=example,dc=com
cn: SomeOtherUser
objectClass: top

LDAP servers

Using com.unboundid.ldap.listener.InMemoryDirectoryServer

Just instantiate com.zimory.ldapunit.core.InMemoryDirectoryServerAccess as shown in the example above and pass it to the LdapWatcher rule.

Using some other LDAP server implementation

Provide an implementation of the com.zimory.ldapunit.core.DirectoryServerAccess interface yourself.

Distribution

<dependency>
    <groupId>com.zimory.ldapunit</groupId>
    <artifactId>ldapunit-core</artifactId>
    <version>1.0.0</version>
</dependency>
com.zimory.ldapunit

Zimory GmbH

Версии библиотеки

Версия
1.0.0