Search in sources :

Example 1 with PageTemplateSet

use of com.yahoo.prelude.templates.PageTemplateSet in project vespa by vespa-engine.

the class PageWithBlendingTestCase method testExecution.

@Test
public void testExecution() {
    // Create the page template
    Choice page = Choice.createSingleton(importPage("PageWithBlending.xml"));
    // Create a federated result
    Query query = new Query();
    Result result = new Result(query);
    result.hits().add(createHits("news", 2));
    result.hits().add(createHits("htmlSource", 1));
    // Resolve (noop here)
    Resolver resolver = new DeterministicResolver();
    Resolution resolution = resolver.resolve(page, query, result);
    // Execute
    Organizer organizer = new Organizer();
    organizer.organize(page, resolution, result);
    // Check rendering
    assertRendered(result, "PageWithBlendingResult.xml", new PageTemplateSet());
}
Also used : Choice(com.yahoo.search.pagetemplates.model.Choice) Query(com.yahoo.search.Query) Resolver(com.yahoo.search.pagetemplates.engine.Resolver) DeterministicResolver(com.yahoo.search.pagetemplates.engine.resolvers.DeterministicResolver) Organizer(com.yahoo.search.pagetemplates.engine.Organizer) DeterministicResolver(com.yahoo.search.pagetemplates.engine.resolvers.DeterministicResolver) PageTemplateSet(com.yahoo.prelude.templates.PageTemplateSet) Result(com.yahoo.search.Result) Resolution(com.yahoo.search.pagetemplates.engine.Resolution) Test(org.junit.Test)

Example 2 with PageTemplateSet

use of com.yahoo.prelude.templates.PageTemplateSet in project vespa by vespa-engine.

the class SourceChoiceTestCase method testExecution.

@Test
public void testExecution() {
    // Create the page template
    Choice page = Choice.createSingleton(importPage("SourceChoice.xml"));
    // Create a federated result
    Query query = new Query();
    Result result = new Result(query);
    result.hits().add(createHits("web", 3));
    result.hits().add(createHits("news", 3));
    result.hits().add(createHits("blog", 3));
    // Resolve (noop here)
    Resolver resolver = new DeterministicResolver();
    Resolution resolution = resolver.resolve(page, query, result);
    // Execute
    Organizer organizer = new Organizer();
    organizer.organize(page, resolution, result);
    // Check rendering
    assertRendered(result, "SourceChoiceResult.xml", new PageTemplateSet(), true);
}
Also used : Choice(com.yahoo.search.pagetemplates.model.Choice) Query(com.yahoo.search.Query) Resolver(com.yahoo.search.pagetemplates.engine.Resolver) DeterministicResolver(com.yahoo.search.pagetemplates.engine.resolvers.DeterministicResolver) Organizer(com.yahoo.search.pagetemplates.engine.Organizer) DeterministicResolver(com.yahoo.search.pagetemplates.engine.resolvers.DeterministicResolver) PageTemplateSet(com.yahoo.prelude.templates.PageTemplateSet) Result(com.yahoo.search.Result) Resolution(com.yahoo.search.pagetemplates.engine.Resolution) Test(org.junit.Test)

Example 3 with PageTemplateSet

use of com.yahoo.prelude.templates.PageTemplateSet in project vespa by vespa-engine.

the class PageTestCase method testExecution.

@Test
public void testExecution() {
    // Create the page template
    Choice page = Choice.createSingleton(importPage("Page.xml"));
    // Create a federated result
    Query query = new Query();
    Result result = new Result(query);
    result.hits().add(createHits("news", 2));
    result.hits().add(createHits("htmlSource", 1));
    // Resolve (noop here)
    Resolver resolver = new DeterministicResolver();
    Resolution resolution = resolver.resolve(page, query, result);
    // Execute
    Organizer organizer = new Organizer();
    organizer.organize(page, resolution, result);
    // Check rendering
    assertRendered(result, "PageResult.xml", new PageTemplateSet());
}
Also used : Choice(com.yahoo.search.pagetemplates.model.Choice) Query(com.yahoo.search.Query) Resolver(com.yahoo.search.pagetemplates.engine.Resolver) DeterministicResolver(com.yahoo.search.pagetemplates.engine.resolvers.DeterministicResolver) Organizer(com.yahoo.search.pagetemplates.engine.Organizer) DeterministicResolver(com.yahoo.search.pagetemplates.engine.resolvers.DeterministicResolver) PageTemplateSet(com.yahoo.prelude.templates.PageTemplateSet) Result(com.yahoo.search.Result) Resolution(com.yahoo.search.pagetemplates.engine.Resolution) Test(org.junit.Test)

Example 4 with PageTemplateSet

use of com.yahoo.prelude.templates.PageTemplateSet in project vespa by vespa-engine.

the class PageWithSourceRendererTestCase method testExecution.

@Test
public void testExecution() {
    // Create the page template
    Choice page = Choice.createSingleton(importPage("PageWithSourceRenderer.xml"));
    // Create a federated result
    Query query = new Query();
    Result result = new Result(query);
    result.hits().add(createHits("news", 2));
    result.hits().add(createHits("htmlSource", 1));
    // Resolve
    Resolver resolver = new DeterministicResolver();
    Resolution resolution = resolver.resolve(page, query, result);
    // Execute
    Organizer organizer = new Organizer();
    organizer.organize(page, resolution, result);
    // Check rendering
    assertRendered(result, "PageWithSourceRendererResult.xml", new PageTemplateSet());
}
Also used : Choice(com.yahoo.search.pagetemplates.model.Choice) Query(com.yahoo.search.Query) Resolver(com.yahoo.search.pagetemplates.engine.Resolver) DeterministicResolver(com.yahoo.search.pagetemplates.engine.resolvers.DeterministicResolver) Organizer(com.yahoo.search.pagetemplates.engine.Organizer) DeterministicResolver(com.yahoo.search.pagetemplates.engine.resolvers.DeterministicResolver) PageTemplateSet(com.yahoo.prelude.templates.PageTemplateSet) Result(com.yahoo.search.Result) Resolution(com.yahoo.search.pagetemplates.engine.Resolution) Test(org.junit.Test)

Aggregations

PageTemplateSet (com.yahoo.prelude.templates.PageTemplateSet)4 Query (com.yahoo.search.Query)4 Result (com.yahoo.search.Result)4 Organizer (com.yahoo.search.pagetemplates.engine.Organizer)4 Resolution (com.yahoo.search.pagetemplates.engine.Resolution)4 Resolver (com.yahoo.search.pagetemplates.engine.Resolver)4 DeterministicResolver (com.yahoo.search.pagetemplates.engine.resolvers.DeterministicResolver)4 Choice (com.yahoo.search.pagetemplates.model.Choice)4 Test (org.junit.Test)4