Search in sources :

Example 1 with PageTemplateXMLReader

use of com.yahoo.search.pagetemplates.config.PageTemplateXMLReader in project vespa by vespa-engine.

the class PageTemplateXMLReadingTestCase method testExamples.

public void testExamples() {
    PageTemplateRegistry registry = new PageTemplateXMLReader().read(root + "examples");
    assertCorrectSerp(registry.getComponent("serp"));
    assertCorrectSlottingSerp(registry.getComponent("slottingSerp"));
    assertCorrectRichSerp(registry.getComponent("richSerp"));
    assertCorrectRicherSerp(registry.getComponent("richerSerp"));
    assertCorrectIncluder(registry.getComponent("includer"));
    assertCorrectGeneric(registry.getComponent("generic"));
}
Also used : PageTemplateRegistry(com.yahoo.search.pagetemplates.PageTemplateRegistry) PageTemplateXMLReader(com.yahoo.search.pagetemplates.config.PageTemplateXMLReader)

Example 2 with PageTemplateXMLReader

use of com.yahoo.search.pagetemplates.config.PageTemplateXMLReader in project vespa by vespa-engine.

the class PageTemplateXMLReadingTestCase method testInvalidFilename.

public void testInvalidFilename() {
    try {
        PageTemplateRegistry registry = new PageTemplateXMLReader().read(root + "examples/invalidfilename");
        assertEquals(0, registry.allComponents().size());
        fail("Should have caused an exception");
    } catch (IllegalArgumentException e) {
        assertEquals("The file name of page template 'notinvalid' must be 'notinvalid.xml' but was 'invalid.xml'", e.getMessage());
    }
}
Also used : PageTemplateRegistry(com.yahoo.search.pagetemplates.PageTemplateRegistry) PageTemplateXMLReader(com.yahoo.search.pagetemplates.config.PageTemplateXMLReader)

Example 3 with PageTemplateXMLReader

use of com.yahoo.search.pagetemplates.config.PageTemplateXMLReader in project vespa by vespa-engine.

the class ExecutionAbstractTestCase method importPage.

protected PageTemplate importPage(String name) {
    PageTemplate template = new PageTemplateXMLReader().readFile(root + name);
    assertNotNull("Could look up page template '" + name + "'", template);
    return template;
}
Also used : PageTemplate(com.yahoo.search.pagetemplates.PageTemplate) PageTemplateXMLReader(com.yahoo.search.pagetemplates.config.PageTemplateXMLReader)

Example 4 with PageTemplateXMLReader

use of com.yahoo.search.pagetemplates.config.PageTemplateXMLReader in project vespa by vespa-engine.

the class PageTemplates method validate.

/**
 * The number of pages in this, for reporting
 */
// private int pages=0;
/**
 * Validates page templates in an application package. The passed readers will be closed.
 */
public static void validate(ApplicationPackage applicationPackage) {
    List<NamedReader> pageTemplateFiles = null;
    try {
        pageTemplateFiles = applicationPackage.getPageTemplateFiles();
        // Parse XML for validation only
        new PageTemplateXMLReader().read(pageTemplateFiles, true);
    } finally {
        NamedReader.closeAll(pageTemplateFiles);
    }
}
Also used : NamedReader(com.yahoo.io.reader.NamedReader) PageTemplateXMLReader(com.yahoo.search.pagetemplates.config.PageTemplateXMLReader)

Example 5 with PageTemplateXMLReader

use of com.yahoo.search.pagetemplates.config.PageTemplateXMLReader in project vespa by vespa-engine.

the class MapPageTemplateXMLReadingTestCase method testMap1.

public void testMap1() {
    PageTemplateRegistry registry = new PageTemplateXMLReader().read(root);
    assertCorrectMap1(registry.getComponent("map1"));
}
Also used : PageTemplateRegistry(com.yahoo.search.pagetemplates.PageTemplateRegistry) PageTemplateXMLReader(com.yahoo.search.pagetemplates.config.PageTemplateXMLReader)

Aggregations

PageTemplateXMLReader (com.yahoo.search.pagetemplates.config.PageTemplateXMLReader)6 PageTemplateRegistry (com.yahoo.search.pagetemplates.PageTemplateRegistry)3 PageTemplate (com.yahoo.search.pagetemplates.PageTemplate)2 NamedReader (com.yahoo.io.reader.NamedReader)1