测试 Alfresco Java 服务

发布于 2024-12-17 13:43:28 字数 834 浏览 2 评论 0原文

我正在寻找一种无需部署到 Tomcat 服务器即可测试 Alfresco 存储库 Java 服务的方法。

我的想法是启动从 JUnit 测试类嵌入的 Alfresco,将我想要测试的类注入到 Alfresco Spring 配置中,并使用 JUnit 测试方法测试这些类。

Alfresco 示例应用程序“FirstFoundationClient”是实现上述工作的一个很好的切入点,但是当我尝试在 MySQL 模式下使用 H2 内存数据库启动示例时,它会输出以下错误:

SqlMapException: The <sqlMap> resource is missing: /alfresco/ibatis/#resource.dialect#/qname-insert-SQLMap.xml

示例中的 My alfresco-global.properties 配置项目:

dir.root=./alf_data
db.driver=org.h2.Driver
db.url=jdbc:h2:alf_data/h2_data/alfresco;MODE=MySQL
db.username=alfresco
db.password=alfresco

任何人都可以帮助我:

  • 如何使用 H2 数据库运行 FirstFoundationClient(来自 Alfresco Enterprise SDK 3.4.0)

  • 如何注入被测试的类,以便我可以从 Spring 应用程序上下文访问它们(就像在 FirstFoundationClient 示例中访问标准 Alfresco 服务一样)

I am looking for a method for testing Alfresco repository Java services without the need for deploying to a Tomcat server.

My idea is to start Alfresco embedded from a JUnit testclass, inject the classes I want to test into the Alfresco Spring configuration and test the classes using JUnit test methods.

The Alfresco sample application "FirstFoundationClient" is a good entry point for getting the above working but when I try to start the sample with a H2 memory database in MySQL-mode it outputs the following error:

SqlMapException: The <sqlMap> resource is missing: /alfresco/ibatis/#resource.dialect#/qname-insert-SQLMap.xml

My alfresco-global.properties configuration in the sample project:

dir.root=./alf_data
db.driver=org.h2.Driver
db.url=jdbc:h2:alf_data/h2_data/alfresco;MODE=MySQL
db.username=alfresco
db.password=alfresco

Can anyone help me with:

  • how to get FirstFoundationClient (from Alfresco Enterprise SDK 3.4.0) running using a H2 database

  • how to inject the classes under test so I can access them from the Spring application context (like standard Alfresco services are accessed in the FirstFoundationClient sample)

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

自由范儿 2024-12-24 13:43:28

如果您愿意尝试 Maven 方式,我发布了 关于如何在 Alfresco 中使用 H2 的小教程。这是一个项目,我在其中利用了您可以用作模板的方法。

注意:Alfresco v4.x 可能与 H2 - PostgreSQL 模式不兼容


编辑:新的 h2-support v1.2 支持 Alfresco4


编辑:h2-support 现在支持最多露天4.0.2

If you're willing to give the maven way a try, I published a little tutorial about how to use H2 with Alfresco. Here's a project where I'm leveraging that approach that you might use as a template.

NOTE: Alfresco v4.x might not be compatible with H2 - PostgreSQL mode


EDIT: the new h2-support v1.2 supports Alfresco4


EDIT: h2-support now supports up to Alfresco 4.0.2

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文