Search in sources :

Example 26 with PatternIndexConfigDocument

use of com.enonic.xp.index.PatternIndexConfigDocument in project xp by enonic.

the class PageRegionsConfigProcessorTest method test_layout_component.

@Test
public void test_layout_component() throws Exception {
    final DescriptorKey layoutDescriptorKey = DescriptorKey.from("layoutAppKey:name");
    final String htmlarea = "htmlarea";
    final Page page = Page.create().regions(PageRegions.create().add(Region.create().name("region1").add(LayoutComponent.create().descriptor(layoutDescriptorKey).regions(LayoutRegions.create().build()).build()).build()).build()).build();
    final PatternIndexConfigDocument result = processPage(page, null, Arrays.asList(configFormWithHtmlArea).listIterator());
    assertEquals("htmlStripper", result.getConfigForPath(PropertyPath.from(COMPONENTS, LayoutComponentType.INSTANCE.toString(), CONFIG, layoutDescriptorKey.getApplicationKey().toString(), layoutDescriptorKey.getName(), htmlarea)).getIndexValueProcessors().get(0).getName());
}
Also used : DescriptorKey(com.enonic.xp.page.DescriptorKey) Page(com.enonic.xp.page.Page) PatternIndexConfigDocument(com.enonic.xp.index.PatternIndexConfigDocument) Test(org.junit.jupiter.api.Test)

Example 27 with PatternIndexConfigDocument

use of com.enonic.xp.index.PatternIndexConfigDocument in project xp by enonic.

the class SiteConfigProcessorTest method test_multiple_site_configs_with_html_areas.

@Test
public void test_multiple_site_configs_with_html_areas() throws Exception {
    final Form form1 = Form.create().addFormItem(Input.create().name("text1").label("text1").inputType(InputTypeName.HTML_AREA).build()).build();
    final Form form2 = Form.create().addFormItem(Input.create().name("text2").label("text2").inputType(InputTypeName.HTML_AREA).build()).build();
    final SiteConfigs siteConfigs = SiteConfigs.create().add(SiteConfig.create().application(applicationKey1).config(new PropertyTree()).build()).add(SiteConfig.create().application(applicationKey2).config(new PropertyTree()).build()).build();
    final PatternIndexConfigDocument result = processConfigs(siteConfigs, form1, form2);
    assertEquals(2, result.getPathIndexConfigs().size());
    assertEquals("htmlStripper", result.getConfigForPath(PropertyPath.from(ContentPropertyNames.DATA, SITECONFIG, "config", "text1")).getIndexValueProcessors().get(0).getName());
    assertEquals("htmlStripper", result.getConfigForPath(PropertyPath.from(ContentPropertyNames.DATA, SITECONFIG, "config", "text2")).getIndexValueProcessors().get(0).getName());
}
Also used : Form(com.enonic.xp.form.Form) PropertyTree(com.enonic.xp.data.PropertyTree) PatternIndexConfigDocument(com.enonic.xp.index.PatternIndexConfigDocument) SiteConfigs(com.enonic.xp.site.SiteConfigs) Test(org.junit.jupiter.api.Test)

Example 28 with PatternIndexConfigDocument

use of com.enonic.xp.index.PatternIndexConfigDocument in project xp by enonic.

the class SiteConfigProcessorTest method test_site_config_with_html_area.

@Test
public void test_site_config_with_html_area() throws Exception {
    final Form form = Form.create().addFormItem(Input.create().name("text1").label("text1").inputType(InputTypeName.HTML_AREA).build()).build();
    final SiteConfigs siteConfigs = SiteConfigs.create().add(SiteConfig.create().application(applicationKey1).config(new PropertyTree()).build()).build();
    final PatternIndexConfigDocument result = processConfigs(siteConfigs, form);
    assertEquals(1, result.getPathIndexConfigs().size());
    assertEquals("htmlStripper", result.getConfigForPath(PropertyPath.from(ContentPropertyNames.DATA, SITECONFIG, "config", "text1")).getIndexValueProcessors().get(0).getName());
}
Also used : Form(com.enonic.xp.form.Form) PropertyTree(com.enonic.xp.data.PropertyTree) PatternIndexConfigDocument(com.enonic.xp.index.PatternIndexConfigDocument) SiteConfigs(com.enonic.xp.site.SiteConfigs) Test(org.junit.jupiter.api.Test)

Example 29 with PatternIndexConfigDocument

use of com.enonic.xp.index.PatternIndexConfigDocument in project xp by enonic.

the class SiteConfigProcessorTest method test_multiple_site_configs_with_same_path.

@Test
public void test_multiple_site_configs_with_same_path() throws Exception {
    final Form form1 = Form.create().addFormItem(Input.create().name("text1").label("text1").inputType(InputTypeName.HTML_AREA).build()).build();
    final Form form2 = Form.create().addFormItem(Input.create().name("text1").label("text1").inputType(InputTypeName.HTML_AREA).build()).build();
    final SiteConfigs siteConfigs = SiteConfigs.create().add(SiteConfig.create().application(applicationKey1).config(new PropertyTree()).build()).add(SiteConfig.create().application(applicationKey2).config(new PropertyTree()).build()).build();
    final PatternIndexConfigDocument result = processConfigs(siteConfigs, form1, form2);
    assertEquals(1, result.getPathIndexConfigs().size());
    assertEquals("htmlStripper", result.getConfigForPath(PropertyPath.from(ContentPropertyNames.DATA, SITECONFIG, "config", "text1")).getIndexValueProcessors().get(0).getName());
}
Also used : Form(com.enonic.xp.form.Form) PropertyTree(com.enonic.xp.data.PropertyTree) PatternIndexConfigDocument(com.enonic.xp.index.PatternIndexConfigDocument) SiteConfigs(com.enonic.xp.site.SiteConfigs) Test(org.junit.jupiter.api.Test)

Example 30 with PatternIndexConfigDocument

use of com.enonic.xp.index.PatternIndexConfigDocument in project xp by enonic.

the class XDataConfigProcessorTest method test_data.

@Test
public void test_data() throws Exception {
    final PatternIndexConfigDocument result = processForms(Form.create().build());
    assertEquals(1, result.getPathIndexConfigs().size());
    assertEquals(IndexConfig.BY_TYPE, result.getConfigForPath(PropertyPath.from(EXTRA_DATA)));
}
Also used : PatternIndexConfigDocument(com.enonic.xp.index.PatternIndexConfigDocument) Test(org.junit.jupiter.api.Test)

Aggregations

PatternIndexConfigDocument (com.enonic.xp.index.PatternIndexConfigDocument)33 Test (org.junit.jupiter.api.Test)26 Form (com.enonic.xp.form.Form)10 PropertyTree (com.enonic.xp.data.PropertyTree)9 PropertySet (com.enonic.xp.data.PropertySet)5 Page (com.enonic.xp.page.Page)5 Input (com.enonic.xp.form.Input)4 PathIndexConfig (com.enonic.xp.index.PathIndexConfig)3 NodeVersion (com.enonic.xp.node.NodeVersion)3 DescriptorKey (com.enonic.xp.page.DescriptorKey)3 SiteConfigs (com.enonic.xp.site.SiteConfigs)3 DumpUpgradeStepResult (com.enonic.xp.dump.DumpUpgradeStepResult)2 IndexConfigDocument (com.enonic.xp.index.IndexConfigDocument)2 Reference (com.enonic.xp.util.Reference)2 ContentConstants (com.enonic.xp.content.ContentConstants)1 Property (com.enonic.xp.data.Property)1 PropertyPath (com.enonic.xp.data.PropertyPath)1 PropertyVisitor (com.enonic.xp.data.PropertyVisitor)1 ValueFactory (com.enonic.xp.data.ValueFactory)1 ValueTypes (com.enonic.xp.data.ValueTypes)1