Search in sources :

Example 56 with ExperienceFragment

use of com.adobe.cq.wcm.core.components.models.ExperienceFragment in project aem-core-wcm-components by adobe.

the class ExperienceFragmentImplTest method testUndefinedXFInPageWithoutLocalization.

/**
 * No localization structure
 * XF component is defined in the page
 * fragmentVariationPath is undefined
 */
@Test
void testUndefinedXFInPageWithoutLocalization() {
    ExperienceFragment experienceFragment = getExperienceFragmentUnderTest(NO_LOC_PAGE + "/jcr:content/root/xf-component-2");
    Utils.testJSONExport(experienceFragment, Utils.getTestExporterJSONPath(TEST_BASE, "xf2"));
}
Also used : ExperienceFragment(com.adobe.cq.wcm.core.components.models.ExperienceFragment) Test(org.junit.jupiter.api.Test)

Example 57 with ExperienceFragment

use of com.adobe.cq.wcm.core.components.models.ExperienceFragment in project aem-core-wcm-components by adobe.

the class ExperienceFragmentImplTest method testValidXFInTemplateWithLocalizationWithDifferentCountry_Language.

/**
 * Site with country_language localization
 * XF component is defined in the template
 * XF component points to a different country_language branch as the page
 */
@Test
void testValidXFInTemplateWithLocalizationWithDifferentCountry_Language() {
    ExperienceFragment experienceFragment = getExperienceFragmentUnderTest(PRODUCT_PAGE_TEMPLATE + "/structure/jcr:content/xf-component-41a", CH_FR_PAGE);
    assertEquals(XF_NAME, experienceFragment.getName());
    Utils.testJSONExport(experienceFragment, Utils.getTestExporterJSONPath(TEST_BASE, "xf41a"));
}
Also used : ExperienceFragment(com.adobe.cq.wcm.core.components.models.ExperienceFragment) Test(org.junit.jupiter.api.Test)

Example 58 with ExperienceFragment

use of com.adobe.cq.wcm.core.components.models.ExperienceFragment in project aem-core-wcm-components by adobe.

the class ExperienceFragmentImplTest method testUndefinedXFInTemplateWithLocalizationWithDifferentCountry_Language.

/**
 * Site with country_language localization
 * XF component is defined in the template
 * fragmentVariationPath is undefined
 */
@Test
void testUndefinedXFInTemplateWithLocalizationWithDifferentCountry_Language() {
    ExperienceFragment experienceFragment = getExperienceFragmentUnderTest(PRODUCT_PAGE_TEMPLATE + "/structure/jcr:content/xf-component-42a", CH_FR_PAGE);
    Utils.testJSONExport(experienceFragment, Utils.getTestExporterJSONPath(TEST_BASE, "xf42a"));
}
Also used : ExperienceFragment(com.adobe.cq.wcm.core.components.models.ExperienceFragment) Test(org.junit.jupiter.api.Test)

Example 59 with ExperienceFragment

use of com.adobe.cq.wcm.core.components.models.ExperienceFragment in project aem-core-wcm-components by adobe.

the class ExperienceFragmentImplTest method testNestedXFs.

/**
 * Nested XFs
 */
@Test
void testNestedXFs() {
    ExperienceFragment experienceFragment = getExperienceFragmentUnderTest(PRODUCT_PAGE_TEMPLATE + "/structure/jcr:content/xf-component-72", LIVECOPY_PAGE);
    assertEquals("parent", experienceFragment.getName());
    Utils.testJSONExport(experienceFragment, Utils.getTestExporterJSONPath(TEST_BASE, "xf72"));
}
Also used : ExperienceFragment(com.adobe.cq.wcm.core.components.models.ExperienceFragment) Test(org.junit.jupiter.api.Test)

Example 60 with ExperienceFragment

use of com.adobe.cq.wcm.core.components.models.ExperienceFragment in project aem-core-wcm-components by adobe.

the class ExperienceFragmentImplTest method testValidXFInTemplateWithLocalizationWithDifferentCountrySiteLanguage.

/**
 * Site with country-language localization (optional): eu/mysite/en
 * XF component is defined in the template
 * XF component points to a different country-language branch as the page
 */
@Test
void testValidXFInTemplateWithLocalizationWithDifferentCountrySiteLanguage() {
    ExperienceFragment experienceFragment = getExperienceFragmentUnderTest(PRODUCT_PAGE_TEMPLATE + "/structure/jcr:content/xf-component-31a", CH_MYSITE_FR_PAGE);
    assertEquals(XF_NAME, experienceFragment.getName());
    Utils.testJSONExport(experienceFragment, Utils.getTestExporterJSONPath(TEST_BASE, "xf31a"));
}
Also used : ExperienceFragment(com.adobe.cq.wcm.core.components.models.ExperienceFragment) Test(org.junit.jupiter.api.Test)

Aggregations

ExperienceFragment (com.adobe.cq.wcm.core.components.models.ExperienceFragment)90 Test (org.junit.jupiter.api.Test)88 SlingHttpServletRequest (org.apache.sling.api.SlingHttpServletRequest)4 Resource (org.apache.sling.api.resource.Resource)4 LocalizationUtils (com.adobe.cq.wcm.core.components.util.LocalizationUtils)2 ExperienceFragmentsConstants (com.adobe.cq.xf.ExperienceFragmentsConstants)2 LanguageManager (com.day.cq.wcm.api.LanguageManager)2 NN_CONTENT (com.day.cq.wcm.api.NameConstants.NN_CONTENT)2 Page (com.day.cq.wcm.api.Page)2 PageManager (com.day.cq.wcm.api.PageManager)2 Template (com.day.cq.wcm.api.Template)2 LiveRelationshipManager (com.day.cq.wcm.msm.api.LiveRelationshipManager)2 Text (com.day.text.Text)2 HashSet (java.util.HashSet)2 Optional (java.util.Optional)2 PostConstruct (javax.annotation.PostConstruct)2 StringUtils (org.apache.commons.lang3.StringUtils)2 ResourceResolver (org.apache.sling.api.resource.ResourceResolver)2 Model (org.apache.sling.models.annotations.Model)2 InjectionStrategy (org.apache.sling.models.annotations.injectorspecific.InjectionStrategy)2