Uploaded image for project: 'OpenNMS'
  1. OpenNMS
  2. NMS-7594

@JUnitTemporaryDatabase tests do not use connection pooling

    XMLWordPrintable

Details

    • Bug
    • Status: Resolved (View Workflow)
    • Major
    • Resolution: Fixed
    • 1.10.0
    • 15.0.2
    • Testing / JUnit
    • Security Level: Default (Default Security Scheme)
    • None

    Description

      When we use @JUnitTemporaryDatabase in unit tests, our temporary PostgreSQL database calls DataSourceFactory.setInstance(database) to set itself as the default javax.sql.DataSource. However, this means that there is no connection pooling using c3p0 during the unit tests. This is leading to socket exceptions during some database-intensive unit tests because hundreds of database connections are being opened and closed quickly enough to exhaust the available ephemeral client ports.

      We need to change TemporaryDatabaseExecutionListener to wrap the datasource in a c3p0 pool.

      This probably isn't an issue with atomikos since its javax.sql.DataSource is implemented using a pooled javax.sql.XADataSource resource.

      Attachments

        Activity

          People

            seth Seth Leger
            seth Seth Leger
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: