use of com.enonic.xp.site.SiteDescriptor in project xp by enonic.
the class XmlSiteParserTest method testEmptySiteXmlDeserialization.
@Test
public void testEmptySiteXmlDeserialization() {
final String xml = loadTestXml("empty-site.xml");
final SiteDescriptor.Builder siteDescriptorBuilder = SiteDescriptor.create();
ApplicationKey applicationKey = ApplicationKey.from("myapplication");
this.parser.source(xml).currentApplication(applicationKey).siteDescriptorBuilder(siteDescriptorBuilder).parse();
SiteDescriptor siteDescriptor = siteDescriptorBuilder.build();
assertEquals(0, siteDescriptor.getForm().getFormItems().size());
assertEquals(0, siteDescriptor.getXDataMappings().getSize());
assertEquals(0, siteDescriptor.getResponseProcessors().getSize());
assertEquals(0, siteDescriptor.getMappingDescriptors().getSize());
}
use of com.enonic.xp.site.SiteDescriptor in project xp by enonic.
the class SiteConfigProcessorTest method processConfigs.
private PatternIndexConfigDocument processConfigs(final SiteConfigs siteConfigs, final Form... forms) {
for (int i = 0; i < siteConfigs.getSize(); i++) {
final SiteConfig siteConfig = siteConfigs.get(i);
final SiteDescriptor descriptor = SiteDescriptor.create().form(forms[i]).build();
Mockito.when(siteService.getDescriptor(siteConfig.getApplicationKey())).thenReturn(descriptor);
}
final SiteConfigProcessor configProcessor = new SiteConfigProcessor(getConfigForms(siteService, siteConfigs));
return configProcessor.processDocument(PatternIndexConfigDocument.create()).build();
}
use of com.enonic.xp.site.SiteDescriptor in project xp by enonic.
the class SiteServiceImpl method getDescriptor.
@Override
public SiteDescriptor getDescriptor(final ApplicationKey applicationKey) {
final ResourceProcessor<ApplicationKey, SiteDescriptor> processor = newProcessor(applicationKey);
final SiteDescriptor descriptor = this.resourceService.processResource(processor);
if (descriptor == null) {
return null;
}
final Form form = mixinService.inlineFormItems(descriptor.getForm());
return SiteDescriptor.copyOf(descriptor).form(form).build();
}
use of com.enonic.xp.site.SiteDescriptor in project xp by enonic.
the class SiteServiceImplTest method get_descriptor_for_unknown_application.
@Test
public void get_descriptor_for_unknown_application() {
final ApplicationKey applicationKey = ApplicationKey.from("unknown");
final SiteDescriptor siteDescriptor = this.service.getDescriptor(applicationKey);
assertEquals(null, siteDescriptor);
}
use of com.enonic.xp.site.SiteDescriptor in project xp by enonic.
the class SiteServiceImplTest method get_descriptor.
@Test
public void get_descriptor() throws Exception {
final ApplicationKey applicationKey = ApplicationKey.from("myapp");
final SiteDescriptor siteDescriptor = this.service.getDescriptor(applicationKey);
assertEquals(1, siteDescriptor.getForm().getFormItems().size());
assertEquals(2, siteDescriptor.getXDataMappings().getSize());
assertEquals(2, siteDescriptor.getResponseProcessors().getSize());
assertEquals("filter1", siteDescriptor.getResponseProcessors().get(0).getName());
assertEquals(20, siteDescriptor.getResponseProcessors().get(1).getOrder());
}
Aggregations