liferay-portal icon indicating copy to clipboard operation
liferay-portal copied to clipboard

LPD-30614 Enable class rules

Open liferay-continuous-integration opened this issue 7 months ago • 3 comments

Forwarded from: https://github.com/liferay-content-management/liferay-portal/pull/5703 (Took 1 ci:forward attempt in 1 hour 3 minutes) Console

@adolfopa @liferay-content-management

Original pull request comment:

What is this trying to solve?

https://liferay.atlassian.net/browse/LPD-30614

The feature flag for LPS-203351 is not at system level, but there are some places in the code where the company ID cannot be passed explicitly. As the FF checks need to rely on the thread local company, we need to set it in the tests to avoid the log from being polluted (which will make some other tests fail).

This will enable the CompanyProviderClassTestRule, that sets the company thread local.

Note that there's no other way to fix this than setting the thread local. There's code that relies on it, as the API doesn't accept a company id. E.g.:

public class JournalArticleAssetDisplayPageFriendlyURLResolver
	extends BaseAssetDisplayPageFriendlyURLResolver {

	@Override
	public String getDefaultURLSeparator() {
		return FriendlyURLResolverConstants.URL_SEPARATOR_JOURNAL_ARTICLE;
	}

	@Override
	public String getKey() {
		return JournalArticle.class.getName();
	}

	@Override
	public boolean isURLSeparatorConfigurable() {
		return FeatureFlagManagerUtil.isEnabled("LPS-203351");
	}

}

How can you verify that it works?

Run JournalArticleContentDashboardItemTest and verify that not error messages related to feature flags are displayed in the logs.