【问题标题】:How to provide extra datasource to JIRA plug-in during integration test如何在集成测试期间向 JIRA 插件提供额外的数据源
【发布时间】:2012-06-06 13:10:18
【问题描述】:

我正在寻找一种方法来提供额外的数据源,在使用所提供的 JIRA 插件 SDK 执行集成测试时可以使用该数据源。

目前我的插件访问我通过以下方式配置Tomcat定义的JDBC数据库:

添加到 server.xml:

<Resource auth="Container" 
  driverClassName="net.sourceforge.jtds.jdbc.Driver" 
  maxActive="20" 
  name="jdbc/myDS" 
  password="password" 
  type="javax.sql.DataSource" 
  url="jdbc:jtds:sqlserver://sqlserver:/database" 
  username="username"/>

这个到 web.xml

<resource-ref>
  <description>My Datasource</description>
  <res-ref-name>jdbc/myDS</res-ref-name>
  <res-type>javax.sql.DataSource</res-type>
  <res-auth>Container</res-auth>
</resource-ref>

然后我可以通过我的插件访问数据库,如下所示

 Context initContext = new InitialContext();     
 Context envContext = (Context)initContext.lookup("java:/comp/env");
 DataSource ds = (DataSource)envContext.lookup("jdbc/myDS");

当使用独立的 JIRA 实例时,此方法可以正常工作,但是我使用提供的 atlas-integration-test 运行的集成测试会启动 JIRA 的嵌入式版本,而正是这个嵌入式版本我无法配置使用额外的数据源。

我找到了我认为需要将资源添加到 entityengine.xml 的文件,但这似乎会在每次嵌入式服务器启动时重新生成,因此我添加到此文件的任何更改都会丢失。

我一直在关注本指南: https://developer.atlassian.com/display/JIRADEV/Plugin+Tutorial+-+Writing+Integration+Tests+for+your+JIRA+plugin

并在 Atlassian 论坛上找到了一个类似的帖子,但仍未解决:http://forums.atlassian.com/thread.jspa?messageID=257355500&tstart=0

如何配置 JIRA 的嵌入式版本来获取我的数据源?

【问题讨论】:

  • 有任何更新吗?

标签: jira jira-plugin


【解决方案1】:

好问题,但我认为在jira开发标签下的answers.atlassian.com上会更好。我知道有人将 MySQL 配置用于集成测试,或者只是更改了 JIRA SDK 的配置方式?

【讨论】:

    猜你喜欢
    • 2014-02-14
    • 1970-01-01
    • 2015-09-26
    • 2012-03-07
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多