使用 Arquillian 嵌入 glassfish 配置 - TmpDir

发布于 2024-10-20 16:22:36 字数 709 浏览 9 评论 0原文

项目: 我正在使用 Arquillian 1.0.0.4-ALPHA 和嵌入式 Glassfish 3.1-b28。我的项目有一个 arquillian.xml、NO domain.xml、一个用于我的数据源的 sun-resources.xml 和一个 persistence.xml。我正在尝试对 EJB3 / JPA2 应用程序进行单元测试。

我已经做了什么: 我的第一个单元测试甚至成功了。但是,当我开始使用 @Deployment 注释和返回 webArchive 的静态方法开发多个类时,就会引发异常。原因是,第一类的 war 文件未正确取消部署,因此无法部署下一个测试文件。我了解到这是一个错误,并升级到较新版本的 glassfish 来解决该错误。

问题: 现在新版本的 glassfish 导致配置问题。我可以通过在 glassfish 中设置 tmpDir 来解决此问题,如下所示:

http://java.net/ jira/browse/EMBEDDED_GLASSFISH-122

现在的问题是,我如何/在哪里设置这些设置? arquillian.xml 似乎不正确。我不想在这种情况下使用domain.xml。最好的是 sun-resources.xml,但这似乎也不合适。 asadmin 没有意义,因为它是自动运行的单元测试。谁能告诉我如何配置?

The project:
I am using Arquillian 1.0.0.4-ALPHA with Embedded Glassfish 3.1-b28. My project has an arquillian.xml, NO domain.xml, a sun-resources.xml for my datasource and a persistence.xml. I am trying to unit test an EJB3 / JPA2 application.

What i already did:
My first unit tests even worked. But as soon as I started to develop more than one class using the @Deployment annotation and the static method that returns the webArchive, an exception was thrown. Reason was, that the war file from the first class wasn't correctly undeployed and so the next test file couldn't get deployed. I read about this being a bug and upgraded to a newer version of glassfish to solve the bug.

The problem:
Now the newer version of glassfish leads to a configuration problem. I could fix this by setting the tmpDir in glassfish like mentioned in here:

http://java.net/jira/browse/EMBEDDED_GLASSFISH-122

The question is now, HOW / WHERE can i set those settings? arquillian.xml doesn't seem to be right. And I don't want to use a domain.xml for that case. Best would be sun-resources.xml, but that doesn't seem to fit, too. asadmin doesn't make sense because its a unit test that runs automatically. Can anyone tell me how to configure that?

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

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

发布评论

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

评论(1

热风软妹 2024-10-27 16:22:36

arquillian.xml 中的正确条目是:

<?xml version="1.0" encoding="UTF-8"?>
<arquillian xmlns="http://jboss.com/arquillian"
   xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
   xmlns:gfembed="urn:arq:org.jboss.arquillian.container.glassfish.embedded_3">
    <gfembed:container>
        ...
        <gfembed:instanceRoot>\tmp</gfembed:instanceRoot>
    </gfembed:container>
</arquillian>

The correct entry in arquillian.xml is:

<?xml version="1.0" encoding="UTF-8"?>
<arquillian xmlns="http://jboss.com/arquillian"
   xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
   xmlns:gfembed="urn:arq:org.jboss.arquillian.container.glassfish.embedded_3">
    <gfembed:container>
        ...
        <gfembed:instanceRoot>\tmp</gfembed:instanceRoot>
    </gfembed:container>
</arquillian>
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文