Package org.jboss.test.faces.FacesEnvironment

Examples of org.jboss.test.faces.FacesEnvironment.FacesRequest


        // TODO fail("Not yet implemented");
    }

    @Test
    public final void testFilteringWithoutClean() throws IOException {
        FacesRequest facesRequest = startFacesRequest();
        FacesContext facesContext = FacesContext.getCurrentInstance();
        AbstractExtendedDataTable component = (AbstractExtendedDataTable) facesContext.getViewRoot().findComponent("table");
        ExtendedDataTableRenderer renderer = (ExtendedDataTableRenderer) FacesContext.getCurrentInstance().getRenderKit()
            .getRenderer(component.getFamily(), component.getRendererType());
        Map<String, Object> column1Attributes = component.findComponent("column1").getAttributes();
        Map<String, Object> column2Attributes = component.findComponent("column2").getAttributes();
        String clientId = component.getClientId(facesContext);
        assertNull(column1Attributes.get("filterValue"));
        assertEquals("filterValue2", column2Attributes.get("filterValue"));
        facesRequest.withParameter(clientId, clientId);
        facesRequest.withParameter(clientId + "rich:filtering", "column1:filterValue1:null");
        renderer.doDecode(facesContext, component);
        assertEquals("filterValue1", column1Attributes.get("filterValue"));
        assertEquals("filterValue2", column2Attributes.get("filterValue"));
        assertTrue(facesContext.getPartialViewContext().getRenderIds().contains(clientId));
        facesRequest.release();
    }
View Full Code Here


        facesRequest.release();
    }

    @Test
    public final void testFilteringWithClean() throws IOException {
        FacesRequest facesRequest = startFacesRequest();
        FacesContext facesContext = FacesContext.getCurrentInstance();
        AbstractExtendedDataTable component = (AbstractExtendedDataTable) facesContext.getViewRoot().findComponent("table");
        ExtendedDataTableRenderer renderer = (ExtendedDataTableRenderer) FacesContext.getCurrentInstance().getRenderKit()
            .getRenderer(component.getFamily(), component.getRendererType());
        Map<String, Object> column1Attributes = component.findComponent("column1").getAttributes();
        Map<String, Object> column2Attributes = component.findComponent("column2").getAttributes();
        String clientId = component.getClientId(facesContext);
        assertNull(column1Attributes.get("filterValue"));
        assertEquals("filterValue2", column2Attributes.get("filterValue"));
        facesRequest.withParameter(clientId, clientId);
        facesRequest.withParameter(clientId + "rich:filtering", "column1:filterValue1:true");
        renderer.doDecode(facesContext, component);
        assertEquals("filterValue1", column1Attributes.get("filterValue"));
        assertNull(column2Attributes.get("filterValue"));
        assertTrue(facesContext.getPartialViewContext().getRenderIds().contains(clientId));
        facesRequest.release();
    }
View Full Code Here

        facesRequest.release();
    }

    @Test
    public final void testColumnResizing() throws IOException {
        FacesRequest facesRequest = startFacesRequest();
        FacesContext facesContext = FacesContext.getCurrentInstance();
        AbstractExtendedDataTable component = (AbstractExtendedDataTable) facesContext.getViewRoot().findComponent("table");
        ExtendedDataTableRenderer renderer = (ExtendedDataTableRenderer) FacesContext.getCurrentInstance().getRenderKit()
            .getRenderer(component.getFamily(), component.getRendererType());
        Map<String, Object> column1Attributes = component.findComponent("column1").getAttributes();
        assertNull(column1Attributes.get("width"));
        facesRequest.withParameter(component.getClientId(facesContext) + ":wi", "column1:200px");
        renderer.doDecode(facesContext, component);
        assertEquals("200px", column1Attributes.get("width"));
        facesRequest.release();
    }
View Full Code Here

        facesRequest.release();
    }

    @Test
    public final void testColumnReordering() throws IOException {
        FacesRequest facesRequest = startFacesRequest();
        FacesContext facesContext = FacesContext.getCurrentInstance();
        AbstractExtendedDataTable component = (AbstractExtendedDataTable) facesContext.getViewRoot().findComponent("table");
        ExtendedDataTableRenderer renderer = (ExtendedDataTableRenderer) FacesContext.getCurrentInstance().getRenderKit()
            .getRenderer(component.getFamily(), component.getRendererType());
        Map<String, Object> componentAttributes = component.getAttributes();
        String clientId = component.getClientId(facesContext);
        assertNull(componentAttributes.get("columnsOrder"));
        facesRequest.withParameter(clientId, clientId);
        facesRequest.withParameter("rich:columnsOrder", "column2,column1");
        renderer.doDecode(facesContext, component);
        assertTrue(facesContext.getPartialViewContext().getRenderIds().contains(clientId));
        assertTrue(Arrays.equals(new String[] { "column2", "column1" }, (String[]) componentAttributes.get("columnsOrder")));
        facesRequest.release();
    }
View Full Code Here

        facesRequest.release();
    }

    @Test
    public final void testSortingWithoutClean() throws IOException {
        FacesRequest facesRequest = startFacesRequest();
        FacesContext facesContext = FacesContext.getCurrentInstance();
        AbstractExtendedDataTable component = (AbstractExtendedDataTable) facesContext.getViewRoot().findComponent("table");
        ExtendedDataTableRenderer renderer = (ExtendedDataTableRenderer) FacesContext.getCurrentInstance().getRenderKit()
            .getRenderer(component.getFamily(), component.getRendererType());
        Map<String, Object> column1Attributes = component.findComponent("column1").getAttributes();
        Map<String, Object> column2Attributes = component.findComponent("column2").getAttributes();
        String clientId = component.getClientId(facesContext);
        assertNull(column1Attributes.get("sortOrder"));
        assertEquals(SortOrder.ascending, column2Attributes.get("sortOrder"));
        facesRequest.withParameter(clientId, clientId);
        facesRequest.withParameter(clientId + "rich:sorting", "column1:null:null");
        renderer.doDecode(facesContext, component);
        assertEquals(SortOrder.ascending, column1Attributes.get("sortOrder"));
        assertEquals(SortOrder.ascending, column2Attributes.get("sortOrder"));
        assertTrue(facesContext.getPartialViewContext().getRenderIds().contains(clientId));
        facesRequest.release();
    }
View Full Code Here

        facesRequest.release();
    }

    @Test
    public final void testSortingWithClean() throws IOException {
        FacesRequest facesRequest = startFacesRequest();
        FacesContext facesContext = FacesContext.getCurrentInstance();
        AbstractExtendedDataTable component = (AbstractExtendedDataTable) facesContext.getViewRoot().findComponent("table");
        ExtendedDataTableRenderer renderer = (ExtendedDataTableRenderer) FacesContext.getCurrentInstance().getRenderKit()
            .getRenderer(component.getFamily(), component.getRendererType());
        Map<String, Object> column1Attributes = component.findComponent("column1").getAttributes();
        Map<String, Object> column2Attributes = component.findComponent("column2").getAttributes();
        String clientId = component.getClientId(facesContext);
        assertNull(column1Attributes.get("sortOrder"));
        assertEquals(SortOrder.ascending, column2Attributes.get("sortOrder"));
        facesRequest.withParameter(clientId, clientId);
        facesRequest.withParameter(clientId + "rich:sorting", "column1:descending:true");
        renderer.doDecode(facesContext, component);
        assertEquals(SortOrder.descending, column1Attributes.get("sortOrder"));
        assertEquals(SortOrder.unsorted, column2Attributes.get("sortOrder"));
        assertTrue(facesContext.getPartialViewContext().getRenderIds().contains(clientId));
        facesRequest.release();
    }
View Full Code Here

        facesRequest.release();
    }

    @Test
    public final void testScrolling() throws IOException {
        FacesRequest facesRequest = startFacesRequest();
        FacesContext facesContext = FacesContext.getCurrentInstance();
        AbstractExtendedDataTable component = (AbstractExtendedDataTable) facesContext.getViewRoot().findComponent("table");
        ExtendedDataTableRenderer renderer = (ExtendedDataTableRenderer) FacesContext.getCurrentInstance().getRenderKit()
            .getRenderer(component.getFamily(), component.getRendererType());
        Map<String, Object> componentAttributes = component.getAttributes();
        String clientId = component.getClientId(facesContext);
        assertNull(componentAttributes.get(AbstractExtendedDataTable.SUBMITTED_CLIENT_FIRST));
        facesRequest.withParameter(clientId, clientId);
        facesRequest.withParameter("rich:clientFirst", "28");
        renderer.doDecode(facesContext, component);
        assertEquals(28, componentAttributes.get(AbstractExtendedDataTable.SUBMITTED_CLIENT_FIRST));
        assertTrue(facesContext.getPartialViewContext().getRenderIds()
            .contains(clientId + "@" + AbstractExtendedDataTable.SCROLL));
        facesRequest.release();
    }
View Full Code Here

        environment.release();
        environment = null;
    }

    private FacesRequest startFacesRequest() throws IOException {
        FacesRequest facesRequest = environment.createFacesRequest("http://localhost/panelTest.jsf");
        facesRequest.withViewId("/panelTest.jsf");
        facesRequest.start();
        FacesContext facesContext = FacesContext.getCurrentInstance();
        ViewHandler vh = facesContext.getApplication().getViewHandler();
        ViewDeclarationLanguage vdl = vh.getViewDeclarationLanguage(facesContext, facesContext.getViewRoot().getViewId());
        vdl.buildView(facesContext, facesContext.getViewRoot());
        return facesRequest;
View Full Code Here

     *
     * @throws IOException
     */
    @Test
    public final void testGetComponentClass() throws IOException {
        FacesRequest facesRequest = startFacesRequest();
        FacesContext facesContext = FacesContext.getCurrentInstance();
        AbstractPanel component = (AbstractPanel) facesContext.getViewRoot().findComponent("panelWithFacet");
        PanelRenderer renderer = (PanelRenderer) FacesContext.getCurrentInstance().getRenderKit()
            .getRenderer(component.getFamily(), component.getRendererType());
        assertEquals(AbstractPanel.class, renderer.getComponentClass());
        facesRequest.release();
    }
View Full Code Here

        environment.release();
        environment = null;
    }

    private FacesRequest startFacesRequest() throws IOException {
        FacesRequest facesRequest = environment.createFacesRequest("http://localhost/popupPanelTest.jsf");
        facesRequest.withViewId("/panelTest.jsf");
        facesRequest.start();
        FacesContext facesContext = FacesContext.getCurrentInstance();
        ViewHandler vh = facesContext.getApplication().getViewHandler();
        ViewDeclarationLanguage vdl = vh.getViewDeclarationLanguage(facesContext, facesContext.getViewRoot().getViewId());
        vdl.buildView(facesContext, facesContext.getViewRoot());
        return facesRequest;
View Full Code Here

TOP

Related Classes of org.jboss.test.faces.FacesEnvironment.FacesRequest

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.