CMS-3562 Make portal module work in OSGi. Fixed some test failures.