Uploaded image for project: 'OpenMRS Core'
  1. OpenMRS Core
  2. TRUNK-5486

CacheException thrown with application context locations set on subclasses of BaseContextSensitiveTest

    Details

    • Type: Bug
    • Status: Needs Assessment
    • Priority: Could
    • Resolution: Unresolved
    • Affects Version/s: Core 2.3.0
    • Fix Version/s: None
    • Component/s: None
    • Labels:
      None
    • Complexity:
      High

      Description

      Steps to reproduce
      1. Add the following class in the test package org.openmrs:
        @ContextConfiguration(locations = { "classpath*:SubclassTestingApplicationContext.xml" })
        public class SubclassContextSensitiveTest extends BaseContextSensitiveTest {
          @Test
          public void shouldPass() {
            assert(true);
          }
        }
        
      1. Add the following empty application context config at api/src/test/resources/SubclassTestingApplicationContext.xml:
        <?xml version="1.0" encoding="UTF-8"?>
        
        <beans xmlns="http://www.springframework.org/schema/beans" xmlns:util="http://www.springframework.org/schema/util" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd   http://www.springframework.org/schema/util http://www.springframework.org/schema/util/spring-util.xsd">
        </beans>
        
      1. Launch the full build:
        mvn clean package
        
      1. Observe the following error:
        Another CacheManager with same name 'hibernateCache' already exists in the same VM. Please provide unique names for each CacheManager in the config or do one of following:
        1. Use one of the CacheManager.create() static factory methods to reuse same CacheManager with same name or create one if necessary
        2. Shutdown the earlier cacheManager before creating new one with same name.
        The source of the existing CacheManager is: DefaultConfigurationSource [ ehcache.xml or ehcache-failsafe.xml ]
        

      The full stack trace is provided as an attachment.

      Additional notes

      The test will pass in isolation, this will work fine:

      mvn test -Dtest=SubclassContextSensitiveTest -pl api/
      

        Gliffy Diagrams

          Attachments

            Issue Links

              Attachments-Category-Modification

                Activity

                  People

                  • Assignee:
                    Unassigned
                    Reporter:
                    mksd Dimitri R
                  • Votes:
                    0 Vote for this issue
                    Watchers:
                    3 Start watching this issue

                    Dates

                    • Created:
                      Updated: