@Test public void render_component_within_page() throws IOException { String nestedId = "foo.bar.baz"; String pageName = "Biff"; RequestPageCache cache = mockRequestPageCache(); Page page = mockPage(); ComponentResources resources = mockComponentResources(); Component component = mockComponent(); Component pageComponent = mockComponent(); ComponentPageElement element = mockComponentPageElement(); ComponentEventResultProcessor master = mockComponentEventResultProcessor(); train_getComponentResources(component, resources); train_getPage(resources, pageComponent); train_getPageName(resources, pageName); train_get(cache, pageName, page); train_getNestedId(resources, nestedId); train_getComponentElementByNestedId(page, nestedId, element); master.processResultValue(element); replay(); ComponentEventResultProcessor<Component> processor = new AjaxComponentInstanceEventResultProcessor( cache, master); processor.processResultValue(component); verify(); }
public void processResultValue(Component value) throws IOException { ComponentResources resources = value.getComponentResources(); boolean isPage = value == resources.getPage(); String pageName = resources.getPageName(); if (isPage) { masterProcessor.processResultValue(pageName); return; } Page page = cache.get(pageName); String nestedId = resources.getNestedId(); RenderCommand command = page.getComponentElementByNestedId(nestedId); masterProcessor.processResultValue(command); }
AjaxComponentInstanceEventResultProcessor implements ComponentEventResultProcessor<Component> { public void processResultValue(Component value) throws IOException { ComponentResources resources = value.getComponentResources(); boolean isPage = value == resources.getPage(); String pageName = resources.getPageName(); if (isPage) { masterProcessor.processResultValue(pageName); return; } Page page = cache.get(pageName); String nestedId = resources.getNestedId(); RenderCommand command = page.getComponentElementByNestedId(nestedId); masterProcessor.processResultValue(command); } }
AjaxComponentInstanceEventResultProcessor implements ComponentEventResultProcessor<Component> { public void processResultValue(Component value) throws IOException { ComponentResources resources = value.getComponentResources(); boolean isPage = value == resources.getPage(); String pageName = resources.getPageName(); if (isPage) { masterProcessor.processResultValue(pageName); return; } Page page = cache.get(pageName); String nestedId = resources.getNestedId(); RenderCommand command = page.getComponentElementByNestedId(nestedId); masterProcessor.processResultValue(command); } AjaxComponentInstanceEventResultProcessor(RequestPageCache cache, @Ajax
    ComponentEventResultProcessor masterProcessor); }
AjaxComponentInstanceEventResultProcessor implements ComponentEventResultProcessor<Component> { public void processResultValue(Component value) throws IOException { ComponentResources resources = value.getComponentResources(); boolean isPage = value == resources.getPage(); String pageName = resources.getPageName(); if (isPage) { masterProcessor.processResultValue(pageName); return; } Page page = cache.get(pageName); String nestedId = resources.getNestedId(); RenderCommand command = page.getComponentElementByNestedId(nestedId); masterProcessor.processResultValue(command); } AjaxComponentInstanceEventResultProcessor(RequestPageCache cache, @Ajax
    ComponentEventResultProcessor masterProcessor); void processResultValue(Component value); }
AjaxComponentInstanceEventResultProcessor implements ComponentEventResultProcessor<Component> { public void processResultValue(Component value) throws IOException { ComponentResources resources = value.getComponentResources(); boolean isPage = value == resources.getPage(); String pageName = resources.getPageName(); if (isPage) { masterProcessor.processResultValue(pageName); return; } Page page = cache.get(pageName); String nestedId = resources.getNestedId(); RenderCommand command = page.getComponentElementByNestedId(nestedId); masterProcessor.processResultValue(command); } AjaxComponentInstanceEventResultProcessor(RequestPageCache cache, @Ajax
    ComponentEventResultProcessor masterProcessor); void processResultValue(Component value);  }