Issue Type: Bug Bug
Assignee: Unassigned
Components: testing
Created: 09/Jul/13 3:46 PM
Description:

info.magnolia.objectfactory.configuration.LegacyComponentsConfigurer#addComponent registers a component twice - as a component, and as a type mapping.
Consequently, info.magnolia.test.mock.AbstractComponentProvider#configure calls registerImplementation twice (one from the loop of configuration.getComponents() and once from the loop of configuration.getTypeMapping()). The second call fails.

I experienced this while testing a ModuleVersionHandler, where the imaging module was involved (at the time of writing, the imaging module still has a component declared in <properties>.

Workarounds:

  • Remove the <property> (replace it by the appropriate <component> or <type-mapping>)
  • Add ComponentsTestUtil.setImplementation(SystemContext.class, MockContext.class); in the test's setUp (no idea why this "works")

Some more "interesting" observations that may or may not be related, but are probably due to other bugs in MgnlTestCase, RepositoryTestCase etc:

  • In my test, only the 2nd test method would fail, from the setUp, due to the imaging component being registered twice. Consequently, the tearDown would also fail, claiming a SystemContext impl isn't registered (which is what led me to the 2nd workaround)
  • When adding the following in my test class, both test methods would fail the same way, which leads me to believe there are other bugs in the setup/teardown of our abstract test classes.
        @Override
        @Before
        public void setUp() throws Exception {
            SystemProperty.clear();
            ComponentsTestUtil.clear();
            super.setUp();
        }
    

    
Fix Versions: 5.0.x
Project: Magnolia
Priority: Neutral Neutral
Reporter: Grégory Joseph
Security Level: Public
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira



----------------------------------------------------------------
For list details, see: http://www.magnolia-cms.com/community/mailing-lists.html
Alternatively, use our forums: http://forum.magnolia-cms.com/
To unsubscribe, E-mail to: <dev-list-unsubscr...@magnolia-cms.com>
----------------------------------------------------------------

Reply via email to