Uploaded image for project: 'HTML Form Entry Module'
  1. HTML Form Entry Module
  2. HTML-307

Unit tests fail when running 'mvn test' when not connected to the internet.

    Details

    • Complexity:
      Medium

      Description

      I get an 'unable to find applicationContext' error. This may not be a problem in htmlformentry – it may be upstream in core, or dependency on logic or whatever...

      I (Ben) am able to repeat this with both mvn test and mvn package in both the htmlformentry and the xforms module. So this might be a fix that needs applied to more than one place. There is a TestingApplicationContext in core, I don't know if these modules are copying that or referencing it.

      The error thrown is this:

      replaceConceptIdsWithUuids_shouldReplaceConceptIdsWithUuids(org.openmrs.module.htmlformentry.SubstitutionUtilsTest)  Time elapsed: 0.103 sec  <<< ERROR!
      java.lang.IllegalStateException: Failed to load ApplicationContext
      	at org.springframework.test.context.TestContext.getApplicationContext(TestContext.java:201)
      	at org.springframework.test.context.support.DependencyInjectionTestExecutionListener.injectDependencies(DependencyInjectionTestExecutionListener.java:109)
      	at org.springframework.test.context.support.DependencyInjectionTestExecutionListener.prepareTestInstance(DependencyInjectionTestExecutionListener.java:75)
      	at org.springframework.test.context.TestContextManager.prepareTestInstance(TestContextManager.java:255)
      	at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.createTest(SpringJUnit4ClassRunner.java:111)
      	at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.invokeTestMethod(SpringJUnit4ClassRunner.java:148)
      	at org.junit.internal.runners.JUnit4ClassRunner.runMethods(JUnit4ClassRunner.java:51)
      	at org.junit.internal.runners.JUnit4ClassRunner$1.run(JUnit4ClassRunner.java:44)
      	at org.junit.internal.runners.ClassRoadie.runUnprotected(ClassRoadie.java:27)
      	at org.junit.internal.runners.ClassRoadie.runProtected(ClassRoadie.java:37)
      	at org.junit.internal.runners.JUnit4ClassRunner.run(JUnit4ClassRunner.java:42)
      	at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.run(SpringJUnit4ClassRunner.java:97)
      	at org.apache.maven.surefire.junit4.JUnit4Provider.execute(JUnit4Provider.java:234)
      	at org.apache.maven.surefire.junit4.JUnit4Provider.executeTestSet(JUnit4Provider.java:133)
      	at org.apache.maven.surefire.junit4.JUnit4Provider.invoke(JUnit4Provider.java:114)
      	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
      	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
      	at java.lang.reflect.Method.invoke(Method.java:597)
      	at org.apache.maven.surefire.util.ReflectionUtils.invokeMethodWithArray(ReflectionUtils.java:188)
      	at org.apache.maven.surefire.booter.ProviderFactory$ProviderProxy.invoke(ProviderFactory.java:166)
      	at org.apache.maven.surefire.booter.ProviderFactory.invokeProvider(ProviderFactory.java:86)
      	at org.apache.maven.surefire.booter.ForkedBooter.runSuitesInProcess(ForkedBooter.java:101)
      	at org.apache.maven.surefire.booter.ForkedBooter.main(ForkedBooter.java:74)
      Caused by: org.springframework.beans.factory.xml.XmlBeanDefinitionStoreException: Line 10 in XML document from URL [file:/home/ben/workspace/htmlformentry/api/target/test-classes/TestingApplicationContext.xml] is invalid; nested exception is org.xml.sax.SAXParseException: cvc-elt.1: Cannot find the declaration of element 'beans'.
      	at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.doLoadBeanDefinitions(XmlBeanDefinitionReader.java:404)
      	at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBeanDefinitions(XmlBeanDefinitionReader.java:342)
      	at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBeanDefinitions(XmlBeanDefinitionReader.java:310)
      	at org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:143)
      	at org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:178)
      	at org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:149)
      	at org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:212)
      	at org.springframework.test.context.support.AbstractGenericContextLoader.loadContext(AbstractGenericContextLoader.java:81)
      	at org.springframework.test.context.support.AbstractGenericContextLoader.loadContext(AbstractGenericContextLoader.java:42)
      	at org.springframework.test.context.TestContext.loadApplicationContext(TestContext.java:173)
      	at org.springframework.test.context.TestContext.getApplicationContext(TestContext.java:197)
      	... 23 more
      Caused by: org.xml.sax.SAXParseException: cvc-elt.1: Cannot find the declaration of element 'beans'.
      	at org.apache.xerces.parsers.DOMParser.parse(Unknown Source)
      	at org.apache.xerces.jaxp.DocumentBuilderImpl.parse(Unknown Source)
      	at org.springframework.beans.factory.xml.DefaultDocumentLoader.loadDocument(DefaultDocumentLoader.java:75)
      	at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.doLoadBeanDefinitions(XmlBeanDefinitionReader.java:396)
      	... 33 more
      

        Attachments

          Activity

            People

            • Assignee:
              dkayiwa Daniel Kayiwa
              Reporter:
              dthomas Dave Thomas [X] (Inactive)
            • Votes:
              0 Vote for this issue
              Watchers:
              5 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: