Uploaded image for project: 'PUBLIC - Liferay Portal Community Edition'
  1. PUBLIC - Liferay Portal Community Edition
  2. LPS-89497

ConfigurationPersistenceManager "exists" does not handle factory configs: ConfigurationUpgradeStepFactor can't be used to upgrade such configurations

    Details

    • Fix Priority:
      4

      Description

      ConfigurationPersistenceManager.exists does not handle factory configs (so config admin interfaces with factory = true). This prevents from using ConfigurationUpgradeStepFactory for upgrading factory configs.

      Steps to reproduce

      1. Start 7.0.x or 7.1.x
      2. Create a new instance for an arbitrary factory config, for example AnonymousUserConfiguration, OpenIdConnectProviderConfiguration, DestinationWorkerConfiguration etc.
        This creates a config instance like com.xxx.OpenIdConnectProviderConfiguration-bab76645-06b9-44d0-8a5d-7b49802b1d43.config
      3. Stop portal
      4. Write a new upgrade step for the affected module like this on 7.1.x or master:
        package com.your.package;
        
        import com.liferay.portal.configuration.persistence.upgrade.ConfigurationUpgradeStepFactory;
        import com.liferay.portal.upgrade.registry.UpgradeStepRegistrator;
        
        import org.osgi.service.component.annotations.Component;
        import org.osgi.service.component.annotations.Reference;
        
        @Component(immediate = true, service = UpgradeStepRegistrator.class)
        public class TestUpgrade implements UpgradeStepRegistrator {
        
        	@Override
        	public void register(Registry registry) {
        		registry.register(
        			"a.b.c", "x.y.z",
        			_configurationUpgradeStepFactory.createUpgradeStep(
        				"com.old.factory.config.ClassName",
        				"com.new.factory.config.ClassName"));
        	}
        
        	@Reference
        	private ConfigurationUpgradeStepFactory _configurationUpgradeStepFactory;
        
        }
        
      5. Build and deploy the updated module
      6. Run the upgrade tool: java -jar LIFERAY_HOME/tools/portal-tools-db-upgrade-client/com.liferay.portal.tools.db.upgrade.client.jar
      7. Wait until it finishes the upgrade

      Expected Result: The Configuration_ table contains the renamed factory and instance.
      Actual Result: The record in the Configuration_ table is untouched, no renamed configs created

      It's the same if you are using a .cfg or .config file.

        Attachments

          Issue Links

            Activity

              People

              • Votes:
                0 Vote for this issue
                Watchers:
                0 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Days since last comment:
                  38 weeks, 1 day ago

                  Packages

                  Version Package