Search in sources :

Example 31 with ExperienceFragment

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

the class ExperienceFragmentImplTest method testValidXFInPageWithLocalizationWithSameCountrySiteLanguage.

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

Example 32 with ExperienceFragment

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

the class ExperienceFragmentImplTest method testValidXFInPageWithLocalizationWithDifferentLanguage.

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

Example 33 with ExperienceFragment

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

the class ExperienceFragmentImplTest method testValidXFInTemplateWithLocalizationWithSameLanguage.

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

Example 34 with ExperienceFragment

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

the class ExperienceFragmentImplTest method testEmptyXFInTemplateWithLocalization.

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

Example 35 with ExperienceFragment

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

the class ExperienceFragmentImplTest method testValidXFInPageWithLocalizationWithDifferentCountryLanguage.

/**
 * Site with country-language localization
 * XF component is defined in the page
 * XF component points to a different country-language branch as the page
 */
@Test
void testValidXFInPageWithLocalizationWithDifferentCountryLanguage() {
    ExperienceFragment experienceFragment = getExperienceFragmentUnderTest(US_EN_PAGE + "/jcr:content/root/xf-component-21");
    assertEquals(XF_NAME, experienceFragment.getName());
    Utils.testJSONExport(experienceFragment, Utils.getTestExporterJSONPath(TEST_BASE, "xf21"));
}
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