在每次启动 ApacheDS 时导入架构 LDIF 和内容 LDIF?
我希望我的嵌入式 ApacheDS 在运行测试时以新的架构/内容启动。我尝试使用以下几行导入 LDIF:
LdifFileLoader ldifLoader = new LdifFileLoader(service.getAdminSession(), "path/to/my/export.ldif");
ldifLoader.execute();
但现在 ApacheDS 将信息存储在当前工作目录的 server-work 目录中。我每次都必须手动删除目录server-work,我想知道这是否是正确的方法...
我也将架构导出为 LDIF,我想先导入它。我也可以使用LdifFileLoader导入它吗?或者我根本就以错误的方式做这件事?
I want my embedded ApacheDS to start up with a fresh schema/content when I run my tests. I tried to import a LDIF with this lines:
LdifFileLoader ldifLoader = new LdifFileLoader(service.getAdminSession(), "path/to/my/export.ldif");
ldifLoader.execute();
But now ApacheDS stores the information in a directory server-work in the current working directory. I had to manually delete the directory server-work every time and I wonder if that is the right way...
I exported the schema as LDIF too and I want to import it first. Can I import it with LdifFileLoader too? Or am I doing it in a wrong way at all?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
使用 DirectoryService#setWorkingDirectory(File) 更改工作目录。
在 setUp() 或tearDown() 方法中,您可以删除该目录。
Use DirectoryService#setWorkingDirectory(File) to change the working directory.
In your setUp() or tearDown() methods, you can then delete this directory.
Spring LDAP 可以为您动态构建一个服务器,并在启动时使用 LDIF 加载它。它构建的服务器是 ApacheDS 服务器。
Spring LDAP can be build a server on the fly for you and load it with an LDIF on startup. The server it builds is an ApacheDS server.