01: package com.sun.facelets;
02:
03: import javax.faces.component.UIViewRoot;
04: import javax.faces.context.FacesContext;
05:
06: import com.sun.facelets.mock.MockResponseWriter;
07: import com.sun.facelets.util.FastWriter;
08:
09: public class TemplateClientTestCase extends FaceletTestCase {
10:
11: public void testClientClient() throws Exception {
12: FaceletFactory ff = FaceletFactory.getInstance();
13: FacesContext faces = FacesContext.getCurrentInstance();
14:
15: Facelet f = ff.getFacelet("template-client-client.xhtml");
16:
17: this .servletRequest.setAttribute("name", "Mr. Hookom");
18:
19: UIViewRoot root = faces.getViewRoot();
20: f.apply(faces, root);
21:
22: FastWriter fw = new FastWriter();
23: MockResponseWriter mrw = new MockResponseWriter(fw);
24: faces.setResponseWriter(mrw);
25: root.encodeAll(faces);
26: System.out.println(fw);
27: }
28:
29: /*
30: public void testLayoutClient() throws Exception {
31: FaceletFactory ff = FaceletFactory.getInstance();
32: FacesContext faces = FacesContext.getCurrentInstance();
33:
34: Facelet f = ff.getFacelet("layout-client.xhtml");
35:
36: this.servletRequest.setAttribute("name", "Mr. Hookom");
37:
38: UIViewRoot root = faces.getViewRoot();
39: f.apply(faces, root);
40:
41: FastWriter fw = new FastWriter();
42: MockResponseWriter mrw = new MockResponseWriter(fw);
43: faces.setResponseWriter(mrw);
44: root.encodeAll(faces);
45: System.out.println(fw);
46: }
47: */
48:
49: }
|