クラス LdapTestUtils
java.lang.ObjectSE
org.springframework.ldap.test.LdapTestUtils
統合テストの目的で使用するインプロセス Apache Directory サーバーを起動、停止、設定するためのユーティリティ。
方法の概要
修飾子と型メソッド説明static voidcleanAndSetup(ContextSource contextSource, NameSE rootNode, org.springframework.core.io.Resource ldifFile) static voidclearSubContexts(DirContextSE ctx, NameSE name) 指定された識別名で表されるノードから始まるディレクトリサブツリーをクリアします。static voidclearSubContexts(ContextSource contextSource, NameSE name) 指定された識別名で表されるノードから始まるディレクトリサブツリーをクリアします。static voiddestroyApacheDirectoryServer(StringSE principal, StringSE credentials) 使用すべきではありません。static voidloadLdif(org.apache.directory.server.core.DefaultDirectoryService directoryService, org.springframework.core.io.Resource ldifFile) static voidloadLdif(ContextSource contextSource, org.springframework.core.io.Resource ldifFile) Ldif ファイルを LDAP サーバーにロードします。static void組み込みサーバーがある場合は、それをシャットダウンします。static DirContextSEstartApacheDirectoryServer(int port, StringSE defaultPartitionSuffix, StringSE defaultPartitionName, StringSE principal, StringSE credentials) 使用すべきではありません。代わりにstartEmbeddedServer(int, String, String)を使用してください。static DirContextSEstartApacheDirectoryServer(int port, StringSE defaultPartitionSuffix, StringSE defaultPartitionName, StringSE principal, StringSE credentials, SetSE extraSchemas) 使用すべきではありません。代わりにstartEmbeddedServer(int, String, String)を使用してください。static voidstartEmbeddedServer(int port, StringSE defaultPartitionSuffix, StringSE defaultPartitionName) 組み込み Apache Directory サーバーを起動します。
メソッドの詳細
startApacheDirectoryServer
public static DirContextSE startApacheDirectoryServer(int port, StringSE defaultPartitionSuffix, StringSE defaultPartitionName, StringSE principal, StringSE credentials, SetSE extraSchemas) throws NamingExceptionSE 使用すべきではありません。代わりにstartEmbeddedServer(int, String, String)を使用してください。インプロセス Apache Directory サーバーを起動します。- パラメーター:
port- サーバーがリッスンするポート。defaultPartitionSuffix- LDAP サーバーに使用されるデフォルトの基本サフィックス。defaultPartitionName- デフォルトの基本サフィックスのディレクトリサーバー構成で使用する名前。principal- ディレクトリサーバーの起動時に使用するプリンシパル。credentials- ディレクトリサーバーの起動時に使用する資格情報。extraSchemas- ApacheDS のブートストラップスキーマに追加する追加スキーマのセット。nullの可能性があります。- 戻り値:
- 使用できない DirContext インスタンス。
- 例外:
NamingExceptionSE- サーバーの起動時に問題が発生した場合。
startEmbeddedServer
public static void startEmbeddedServer(int port, StringSE defaultPartitionSuffix, StringSE defaultPartitionName) 組み込み Apache Directory サーバーを起動します。同じ JVM で許可される組み込みサーバーは 1 つだけです。- パラメーター:
port- サーバーがリッスンするポート。defaultPartitionSuffix- LDAP サーバーに使用されるデフォルトの基本サフィックス。defaultPartitionName- デフォルトの基本サフィックスのディレクトリサーバー構成で使用する名前。- 例外:
IllegalStateExceptionSE- 組み込みサーバーがすでに開始されている場合。- 導入:
- 1.3.2
startApacheDirectoryServer
public static DirContextSE startApacheDirectoryServer(int port, StringSE defaultPartitionSuffix, StringSE defaultPartitionName, StringSE principal, StringSE credentials) throws NamingExceptionSE 使用すべきではありません。代わりにstartEmbeddedServer(int, String, String)を使用してください。shutdownEmbeddedServer
組み込みサーバーがある場合は、それをシャットダウンします。この JVM で以前にサーバーが起動されていない場合、これは確認なしで無視されます。- 例外:
ExceptionSE- 導入:
- 1.3.2
destroyApacheDirectoryServer
public static void destroyApacheDirectoryServer(StringSE principal, StringSE credentials) throws ExceptionSE 使用すべきではありません。代わりにshutdownEmbeddedServer()を使用してください。実行中の Apache Directory サーバーをシャットダウンします。- パラメーター:
principal- 認証に使用されるプリンシパル。credentials- 認証に使用される資格情報。- 例外:
ExceptionSE- サーバーのシャットダウン時に問題が発生した場合。
clearSubContexts
public static void clearSubContexts(ContextSource contextSource, NameSE name) throws NamingExceptionSE 指定された識別名で表されるノードから始まるディレクトリサブツリーをクリアします。- パラメーター:
contextSource- DirContext を取得するために使用する ContextSource。name- ルートノードの識別名。- 例外:
NamingExceptionSE- 何か問題が発生した場合は、サブツリーを削除します。
clearSubContexts
指定された識別名で表されるノードから始まるディレクトリサブツリーをクリアします。- パラメーター:
ctx- 木の掃除に使う DirContext。name- ルートノードの識別名。- 例外:
NamingExceptionSE- 何か問題が発生した場合は、サブツリーを削除します。
loadLdif
public static void loadLdif(ContextSource contextSource, org.springframework.core.io.Resource ldifFile) throws IOExceptionSE Ldif ファイルを LDAP サーバーにロードします。- パラメーター:
contextSource- DirContext を取得して LDAP サーバーと対話するために使用する ContextSource。ldifFile- 有効な LDIF ファイルを表す Resource。- 例外:
IOExceptionSE- リソースを読み取れない場合。
cleanAndSetup
public static void cleanAndSetup(ContextSource contextSource, NameSE rootNode, org.springframework.core.io.Resource ldifFile) throws NamingExceptionSE, IOExceptionSE loadLdif
public static void loadLdif(org.apache.directory.server.core.DefaultDirectoryService directoryService, org.springframework.core.io.Resource ldifFile) throws IOExceptionSE
shutdownEmbeddedServer()を使用してください。