use of com.enonic.xp.index.PatternIndexConfigDocument in project xp by enonic.
the class PageConfigProcessorTest method test_config_with_data.
@Test
public void test_config_with_data() throws Exception {
final PatternIndexConfigDocument result = processForm(Form.create().addFormItem(FormItemSet.create().name("items").addFormItem(Input.create().name("input").label("input").inputType(InputTypeName.TEXT_LINE).occurrences(0, 5).build()).build()).build());
assertEquals(5, result.getPathIndexConfigs().size());
assertTrue(result.getPathIndexConfigs().contains(PathIndexConfig.create().path(PropertyPath.from(COMPONENTS)).indexConfig(IndexConfig.NONE).build()));
assertTrue(result.getPathIndexConfigs().contains(PathIndexConfig.create().path(PropertyPath.from(COMPONENTS, PAGE, DESCRIPTOR)).indexConfig(IndexConfig.MINIMAL).build()));
assertTrue(result.getPathIndexConfigs().contains(PathIndexConfig.create().path(PropertyPath.from(COMPONENTS, PAGE, CUSTOMIZED)).indexConfig(IndexConfig.MINIMAL).build()));
assertTrue(result.getPathIndexConfigs().contains(PathIndexConfig.create().path(PropertyPath.from(COMPONENTS, PAGE, TEMPLATE)).indexConfig(IndexConfig.MINIMAL).build()));
assertEquals(IndexConfig.BY_TYPE, result.getConfigForPath(PropertyPath.from(COMPONENTS, PAGE, CONFIG, "appKey", "descriptorName")));
}
use of com.enonic.xp.index.PatternIndexConfigDocument in project xp by enonic.
the class PageRegionsConfigProcessorTest method test_text_component.
@Test
public void test_text_component() throws Exception {
final PatternIndexConfigDocument result = processPage(Page.create().regions(PageRegions.create().build()).build(), null, null);
assertEquals(TEXT_COMPONENT_INDEX_CONFIG, result.getConfigForPath(PropertyPath.from(COMPONENTS, TextComponentType.INSTANCE.toString(), VALUE)));
assertEquals("htmlStripper", result.getConfigForPath(PropertyPath.from(COMPONENTS, TextComponentType.INSTANCE.toString(), VALUE)).getIndexValueProcessors().get(0).getName());
}
use of com.enonic.xp.index.PatternIndexConfigDocument in project xp by enonic.
the class PageRegionsConfigProcessorTest method test_part_inside_layout_component.
@Test
public void test_part_inside_layout_component() throws Exception {
final String appKeyLayout = "layoutAppKey";
final String appKeyPart = "partAppKey";
final String htmlarea = "htmlarea";
final Page page = Page.create().regions(PageRegions.create().add(Region.create().name("region1").add(LayoutComponent.create().descriptor(DescriptorKey.from(appKeyLayout)).regions(LayoutRegions.create().add(Region.create().name("layoutRegion1").add(PartComponent.create().descriptor(DescriptorKey.from(appKeyPart)).build()).build()).build()).build()).build()).build()).build();
final PatternIndexConfigDocument result = processPage(page, Arrays.asList(configFormWithHtmlArea).listIterator(), Arrays.asList(configFormWithHtmlArea).listIterator());
assertEquals("htmlStripper", result.getConfigForPath(PropertyPath.from(COMPONENTS, LayoutComponentType.INSTANCE.toString(), CONFIG, appKeyLayout, htmlarea)).getIndexValueProcessors().get(0).getName());
assertEquals("htmlStripper", result.getConfigForPath(PropertyPath.from(COMPONENTS, PartComponentType.INSTANCE.toString(), CONFIG, appKeyPart, htmlarea)).getIndexValueProcessors().get(0).getName());
}
use of com.enonic.xp.index.PatternIndexConfigDocument in project xp by enonic.
the class PageRegionsConfigProcessorTest method test_complex_component_config.
@Test
public void test_complex_component_config() throws Exception {
final PropertyTree config = new PropertyTree();
final PropertySet items = config.addSet("items");
items.addStrings("input", "a", "b", "c");
final Page page = Page.create().regions(PageRegions.create().add(Region.create().name("region1").add(PartComponent.create().descriptor(DescriptorKey.from("appKey1:partName1")).config(new PropertyTree()).build()).add(LayoutComponent.create().descriptor(DescriptorKey.from("appKey2:layoutName")).config(new PropertyTree()).regions(LayoutRegions.create().add(Region.create().name("region").add(PartComponent.create().descriptor(DescriptorKey.from("appKey3:partName2")).config(new PropertyTree()).build()).build()).build()).build()).build()).build()).build();
final Form form = Form.create().addFormItem(FormItemSet.create().name("items").addFormItem(Input.create().name("input").label("input").inputType(InputTypeName.TEXT_LINE).occurrences(0, 5).build()).build()).build();
final PatternIndexConfigDocument result = processPage(page, Arrays.asList(form, form).listIterator(), singletonList(form).listIterator());
assertEquals(8, result.getPathIndexConfigs().size());
assertEquals(IndexConfig.BY_TYPE, result.getConfigForPath(PropertyPath.from("components.part.config.appKey1.partName1")));
assertEquals(IndexConfig.BY_TYPE, result.getConfigForPath(PropertyPath.from("components.part.config.appKey2.layoutName")));
assertEquals(IndexConfig.BY_TYPE, result.getConfigForPath(PropertyPath.from("components.part.config.appkey3.partname2")));
}
use of com.enonic.xp.index.PatternIndexConfigDocument in project xp by enonic.
the class SiteConfigProcessorTest method test_empty_site_config.
@Test
public void test_empty_site_config() throws Exception {
final PatternIndexConfigDocument result = processConfigs(SiteConfigs.create().build(), Form.create().build(), null);
assertEquals(0, result.getPathIndexConfigs().size());
}
Aggregations