diff --git a/.github/workflows/maven-deploy.yml b/.github/workflows/maven-deploy.yml index c12c483642..11c221b385 100644 --- a/.github/workflows/maven-deploy.yml +++ b/.github/workflows/maven-deploy.yml @@ -30,7 +30,7 @@ jobs: - name: Set up JDK uses: actions/setup-java@v1 with: - java-version: 8 + java-version: 11 # Set up dependency cache - name: Cache local Maven repository diff --git a/.github/workflows/maven-release.yml b/.github/workflows/maven-release.yml index 9e9552fe54..e253e4dfc1 100644 --- a/.github/workflows/maven-release.yml +++ b/.github/workflows/maven-release.yml @@ -41,7 +41,7 @@ jobs: - name: Set up JDK uses: actions/setup-java@v1 with: - java-version: 8 + java-version: 11 # Set up dependency cache - name: Cache local Maven repository diff --git a/.github/workflows/maven-test.yml b/.github/workflows/maven-test.yml index 975afea260..387f30799d 100644 --- a/.github/workflows/maven-test.yml +++ b/.github/workflows/maven-test.yml @@ -26,7 +26,7 @@ jobs: strategy: matrix: os: [ ubuntu-latest ] - java: [8, 11] + java: [11] profile: [ '', '-Pcloud,adobe-public'] steps: diff --git a/bundles/core/src/main/java/com/adobe/cq/wcm/core/components/util/LocalizationUtils.java b/bundles/core/src/main/java/com/adobe/cq/wcm/core/components/util/LocalizationUtils.java index 07066c62bb..e5c3b8b85d 100644 --- a/bundles/core/src/main/java/com/adobe/cq/wcm/core/components/util/LocalizationUtils.java +++ b/bundles/core/src/main/java/com/adobe/cq/wcm/core/components/util/LocalizationUtils.java @@ -79,7 +79,7 @@ public static String getLocalizationRoot(@NotNull Resource resource, @NotNull Re */ @Nullable public static String getLanguageRoot(@NotNull Resource resource, @NotNull LanguageManager languageManager) { - return Optional.ofNullable(languageManager.getLanguageRoot(resource)) + return Optional.ofNullable(languageManager.getLanguageRoot(resource, true)) .map(Page::getPath) .orElse(null); } diff --git a/bundles/core/src/test/java/com/adobe/cq/wcm/core/components/context/CoreComponentTestContext.java b/bundles/core/src/test/java/com/adobe/cq/wcm/core/components/context/CoreComponentTestContext.java index 579e51f554..6772b81828 100644 --- a/bundles/core/src/test/java/com/adobe/cq/wcm/core/components/context/CoreComponentTestContext.java +++ b/bundles/core/src/test/java/com/adobe/cq/wcm/core/components/context/CoreComponentTestContext.java @@ -72,9 +72,6 @@ public static AemContext newAemContext() { .resourceResolverType(ResourceResolverType.JCR_MOCK) .resourceResolverFactoryActivatorProps(PROPERTIES) .afterSetUp(context -> { - context.addModelsForClasses(MockResponsiveGrid.class); - context.addModelsForPackage("com.adobe.cq.wcm.core.components.models"); - context.addModelsForPackage("com.adobe.cq.wcm.core.components.internal.link"); context.registerService(SlingModelFilter.class, new MockSlingModelFilter() { private final Set IGNORED_NODE_NAMES = new HashSet() {{ add(NameConstants.NN_RESPONSIVE_CONFIG); diff --git a/bundles/core/src/test/java/com/adobe/cq/wcm/core/components/internal/models/v1/ExperienceFragmentImplTest.java b/bundles/core/src/test/java/com/adobe/cq/wcm/core/components/internal/models/v1/ExperienceFragmentImplTest.java index 3095adcb09..669445482c 100644 --- a/bundles/core/src/test/java/com/adobe/cq/wcm/core/components/internal/models/v1/ExperienceFragmentImplTest.java +++ b/bundles/core/src/test/java/com/adobe/cq/wcm/core/components/internal/models/v1/ExperienceFragmentImplTest.java @@ -59,6 +59,7 @@ class ExperienceFragmentImplTest { private static final String US_EN_PAGE = SITE_ROOT + "/us/en/page"; private static final String CH_MYSITE_FR_PAGE = SITE_ROOT + "/ch/mysite/fr/page"; private static final String CH_FR_PAGE = SITE_ROOT + "/ch_fr/page"; + private static final String EU_FR_PAGE = SITE_ROOT + "/eu/fr/page"; private static final String BLUEPRINT_ROOT = "/content/mysite/blueprint"; private static final String BLUEPRINT_PAGE = BLUEPRINT_ROOT + "/page"; private static final String LIVECOPY_ROOT = "/content/mysite/livecopy"; @@ -555,6 +556,23 @@ void testValidXFInPageWithLocalizationWithDifferentCountry_Language() { Utils.testJSONExport(experienceFragment, Utils.getTestExporterJSONPath(TEST_BASE, "xf41")); } + /** + * Site with region/language localization + * XF component is defined in the template + * XF component points to a different region/language branch as the page + * and system cannot infer correctly the language root unless page is marked with + * "cq:isLanguageRoot": true + * and + * "jcr:language": "fr" + */ + @Test + void testValidXFInPageWithLocalizationWithDifferentCountry_Language_withLanguageRootMarking() { + + ExperienceFragment experienceFragment = getExperienceFragmentUnderTest(PRODUCT_PAGE_TEMPLATE + "/structure/jcr:content/xf-component-23", EU_FR_PAGE); + assertEquals(XF_NAME, experienceFragment.getName()); + Utils.testJSONExport(experienceFragment, Utils.getTestExporterJSONPath(TEST_BASE, "xf23")); + } + /** * Site with country_language localization * XF component is defined in the template diff --git a/bundles/core/src/test/resources/experiencefragment/exporter-xf23.json b/bundles/core/src/test/resources/experiencefragment/exporter-xf23.json new file mode 100644 index 0000000000..8837e1f3b3 --- /dev/null +++ b/bundles/core/src/test/resources/experiencefragment/exporter-xf23.json @@ -0,0 +1,9 @@ +{ + "id": "experiencefragment-8920b315ce", + "localizedFragmentVariationPath": "/content/experience-fragments/mysite/eu/fr/footer/master/jcr:content", + "configured": false, + "classNames": "aem-xf empty", + ":items": {}, + ":type": "core/wcm/components/experiencefragment/v1/experiencefragment", + ":itemsOrder": [] +} diff --git a/bundles/core/src/test/resources/experiencefragment/test-conf.json b/bundles/core/src/test/resources/experiencefragment/test-conf.json index 970c695cbd..3c2fe4c84e 100644 --- a/bundles/core/src/test/resources/experiencefragment/test-conf.json +++ b/bundles/core/src/test/resources/experiencefragment/test-conf.json @@ -82,6 +82,11 @@ "sling:resourceType": "core/wcm/components/experiencefragment/v1/experiencefragment", "fragmentVariationPath": "/content/experience-fragments/mysite/us/en/footer/master/undefined" }, + "xf-component-23": { + "jcr:primaryType": "nt:unstructured", + "sling:resourceType": "core/wcm/components/experiencefragment/v1/experiencefragment", + "fragmentVariationPath": "/content/experience-fragments/mysite/language-masters/en/footer/master" + }, "xf-component-30a": { "jcr:primaryType": "nt:unstructured", "sling:resourceType": "core/wcm/components/experiencefragment/v1/experiencefragment", @@ -147,4 +152,4 @@ } } } -} \ No newline at end of file +} diff --git a/bundles/core/src/test/resources/experiencefragment/test-content.json b/bundles/core/src/test/resources/experiencefragment/test-content.json index 42b6354524..59ddbd6cc8 100644 --- a/bundles/core/src/test/resources/experiencefragment/test-content.json +++ b/bundles/core/src/test/resources/experiencefragment/test-content.json @@ -143,6 +143,36 @@ } } }, + "eu": { + "jcr:primaryType": "cq:Page", + "jcr:content": { + "jcr:primaryType": "cq:PageContent", + "jcr:title": "Europe", + "jcr:created": "Mon APR 08 2019 20:21:55 GMT+0200" + }, + "fr": { + "jcr:primaryType": "cq:Page", + "jcr:content": { + "jcr:primaryType": "cq:PageContent", + "jcr:title": "Français", + "jcr:created": "Mon APR 08 2019 20:21:55 GMT+0200", + "cq:isLanguageRoot": true, + "jcr:language": "fr" + }, + "page": { + "jcr:primaryType": "cq:Page", + "jcr:content": { + "jcr:primaryType": "cq:PageContent", + "jcr:title": "Test page", + "jcr:created": "Mon APR 08 2019 20:21:55 GMT+0200", + "cq:template": "/conf/coretest/settings/wcm/templates/product-page", + "root": { + "jcr:primaryType": "nt:unstructured" + } + } + } + } + }, "ch": { "jcr:primaryType": "cq:Page", "jcr:content": { @@ -303,6 +333,53 @@ "sling:resourceType": "cq/experience-fragments/components/experiencefragment" } }, + "language-masters": { + "en": { + "jcr:primaryType": "sling:Folder", + "footer": { + "jcr:primaryType": "cq:Page", + "jcr:content": { + "jcr:primaryType": "cq:PageContent", + "jcr:title": "English Test Footer", + "jcr:created": "Mon APR 08 2019 20:21:55 GMT+0200", + "sling:resourceType": "cq/experience-fragments/components/experiencefragment" + }, + "master": { + "jcr:primaryType": "cq:Page", + "jcr:content": { + "jcr:primaryType": "cq:PageContent", + "jcr:title": "English Test Footer Master", + "cq:xfVariantType": "web", + "cq:xfMasterVariation": "true" + } + } + } + } + }, + "eu": { + "jcr:primaryType": "sling:Folder", + "fr": { + "jcr:primaryType": "sling:Folder", + "footer": { + "jcr:primaryType": "cq:Page", + "jcr:content": { + "jcr:primaryType": "cq:PageContent", + "jcr:title": "English Test Footer", + "jcr:created": "Mon APR 08 2019 20:21:55 GMT+0200", + "sling:resourceType": "cq/experience-fragments/components/experiencefragment" + }, + "master": { + "jcr:primaryType": "cq:Page", + "jcr:content": { + "jcr:primaryType": "cq:PageContent", + "jcr:title": "English Test Footer Master", + "cq:xfVariantType": "web", + "cq:xfMasterVariation": "true" + } + } + } + } + }, "us": { "jcr:primaryType": "sling:Folder", "en": { @@ -703,4 +780,4 @@ } } } -} \ No newline at end of file +} diff --git a/extensions/amp/bundle/src/test/java/com/adobe/cq/wcm/core/extensions/amp/AmpTestContext.java b/extensions/amp/bundle/src/test/java/com/adobe/cq/wcm/core/extensions/amp/AmpTestContext.java index d1cca05293..78bc19f1c9 100644 --- a/extensions/amp/bundle/src/test/java/com/adobe/cq/wcm/core/extensions/amp/AmpTestContext.java +++ b/extensions/amp/bundle/src/test/java/com/adobe/cq/wcm/core/extensions/amp/AmpTestContext.java @@ -49,7 +49,6 @@ private AmpTestContext() { public static io.wcm.testing.mock.aem.junit5.AemContext newAemContext() { return new AemContextBuilder().resourceResolverType(ResourceResolverType.JCR_MOCK) .afterSetUp(context -> { - context.addModelsForClasses(MockResponsiveGrid.class); context.registerService(SlingModelFilter.class, new MockSlingModelFilter() { private final Set IGNORED_NODE_NAMES = new HashSet() {{ add(NameConstants.NN_RESPONSIVE_CONFIG); diff --git a/parent/pom.xml b/parent/pom.xml index 5585871bed..085db35de3 100644 --- a/parent/pom.xml +++ b/parent/pom.xml @@ -56,7 +56,7 @@ admin admin 1.7.25 - 8 + 11 0.8.8 1.11.3 v16.13.1 @@ -336,7 +336,7 @@ Project must be compiled with Java ${aem.java.version} or higher - 1.${aem.java.version} + ${aem.java.version} @@ -799,7 +799,7 @@ io.wcm io.wcm.testing.aem-mock.junit5 - 5.1.0 + 5.5.2 test diff --git a/testing/it/e2e-selenium/pom.xml b/testing/it/e2e-selenium/pom.xml index e0f58c025d..60c54984c2 100755 --- a/testing/it/e2e-selenium/pom.xml +++ b/testing/it/e2e-selenium/pom.xml @@ -140,7 +140,7 @@ - 8 + 11 failing,nested http://localhost:4502 http://localhost:4503 diff --git a/testing/it/http/pom.xml b/testing/it/http/pom.xml index 2194aef716..d764561a6a 100644 --- a/testing/it/http/pom.xml +++ b/testing/it/http/pom.xml @@ -45,8 +45,8 @@ maven-compiler-plugin 3.0 - 1.${cq.java.version} - 1.${cq.java.version} + ${cq.java.version} + ${cq.java.version} ${project.build.sourceEncoding} @@ -148,7 +148,7 @@ http://localhost:4503 1.0.28 1.0.8 - 8 + 11 30