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"));
}
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());
}
}
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;
}
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);
}
}
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"));
}
Aggregations