Package javax.faces.application

Examples of javax.faces.application.ConfigurableNavigationHandler


    public void testFlow1_5() throws Exception
    {
        setupRequest("/flow1_2.xhtml");
        processLifecycleExecute();
       
        ConfigurableNavigationHandler handler = (ConfigurableNavigationHandler) facesContext.getApplication().getNavigationHandler();
       
        NavigationCase navCase = handler.getNavigationCase(facesContext, null, "flow3");
       
        Assert.assertNotNull(navCase);
       
        // Check begin view node
        Assert.assertEquals("/flow1/begin.xhtml", navCase.getToViewId(facesContext));
       
        processRender();
        String clientWindowId = facesContext.getExternalContext().getClientWindow().getId();
       
        setupRequest(navCase.getToViewId(facesContext));
        request.addParameter(FlowHandler.TO_FLOW_DOCUMENT_ID_REQUEST_PARAM_NAME, navCase.getToFlowDocumentId());
        request.addParameter(FlowHandler.FLOW_ID_REQUEST_PARAM_NAME, navCase.getFromOutcome());
        request.addParameter(ResponseStateManager.CLIENT_WINDOW_URL_PARAM, clientWindowId);
      
        //Enter flow 1
        //UICommand button = (UICommand) facesContext.getViewRoot().findComponent("mainForm:startFlow1");
        //submit(button);
       
        processLifecycleExecute();
       
        Flow currentFlow = facesContext.getApplication().getFlowHandler().getCurrentFlow(facesContext);
        Assert.assertNotNull(currentFlow);
        Assert.assertEquals("flow1", currentFlow.getId());
       
        facesContext.getApplication().getFlowHandler().getCurrentFlowScope().put("flow1","value1");
       
        processRender();
       
        //UICommand button2 = (UICommand) facesContext.getViewRoot().findComponent("mainForm:call_flow2");
        //submit(button2);
        navCase = handler.getNavigationCase(facesContext, null, "call_flow2");
       
        clientWindowId = facesContext.getExternalContext().getClientWindow().getId();
       
        setupRequest(navCase.getToViewId(facesContext));
        request.addParameter(FlowHandler.TO_FLOW_DOCUMENT_ID_REQUEST_PARAM_NAME, navCase.getToFlowDocumentId());
        request.addParameter(FlowHandler.FLOW_ID_REQUEST_PARAM_NAME, navCase.getFromOutcome());
        request.addParameter(ResponseStateManager.CLIENT_WINDOW_URL_PARAM, clientWindowId);
       
        processLifecycleExecute();
       
        currentFlow = facesContext.getApplication().getFlowHandler().getCurrentFlow(facesContext);
        Assert.assertNotNull(currentFlow);
        Assert.assertEquals("flow2", currentFlow.getId());
        Assert.assertFalse(facesContext.getApplication().getFlowHandler().getCurrentFlowScope().containsKey("flow1"));
        facesContext.getApplication().getFlowHandler().getCurrentFlowScope().put("flow2","value2");
       
        processRender();
       
        //Check current view is the begin of flow2
        Assert.assertEquals("/flow2/begin.xhtml", facesContext.getViewRoot().getViewId());
       
        UICommand button3 = (UICommand) facesContext.getViewRoot().findComponent("mainForm:content");
        submit(button3);
        processLifecycleExecute();
        processRender();
       
        currentFlow = facesContext.getApplication().getFlowHandler().getCurrentFlow(facesContext);
        Assert.assertNotNull(currentFlow);
        Assert.assertEquals("flow2", currentFlow.getId());

        NavigationCase endCase = handler.getNavigationCase(facesContext, null, "back");
        Assert.assertNotNull(endCase);
        String toViewId = endCase.getToViewId(facesContext);
        String fromOutcome = endCase.getFromOutcome();
        clientWindowId = facesContext.getExternalContext().getClientWindow().getId();
       
        tearDownRequest();
        setupRequest(toViewId);
        request.addParameter(FlowHandler.TO_FLOW_DOCUMENT_ID_REQUEST_PARAM_NAME, FlowHandler.NULL_FLOW);
        request.addParameter(FlowHandler.FLOW_ID_REQUEST_PARAM_NAME, fromOutcome);
        request.addParameter(ResponseStateManager.CLIENT_WINDOW_URL_PARAM, clientWindowId);
       
        processLifecycleExecute();
       
        // Check it should go back to flow1
        currentFlow = facesContext.getApplication().getFlowHandler().getCurrentFlow(facesContext);
        Assert.assertNotNull(currentFlow);
        Assert.assertEquals("flow1", currentFlow.getId());
        Assert.assertTrue(facesContext.getApplication().getFlowHandler().getCurrentFlowScope().containsKey("flow1"));
        // Check lastDisplayedViewId (since it was GET, it should be the start viewId)
        Assert.assertEquals("/flow2/begin.xhtml", facesContext.getViewRoot().getViewId());
       
        processRender();
       
        endCase = handler.getNavigationCase(facesContext, null, "switchBack");
        Assert.assertNotNull(endCase);

        toViewId = endCase.getToViewId(facesContext);
        // Check if the dynamic outcome return hack has been correctly resolved.
        Assert.assertEquals(toViewId, "/flow3/content.xhtml");
View Full Code Here


    public void testFlow1_6() throws Exception
    {
        setupRequest("/flow_base.xhtml");
        processLifecycleExecute();
       
        ConfigurableNavigationHandler handler = (ConfigurableNavigationHandler) facesContext.getApplication().getNavigationHandler();
       
        NavigationCase navCase = handler.getNavigationCase(facesContext, null, "flow1");
       
        Assert.assertNotNull(navCase);
       
        // Check begin view node
        Assert.assertEquals("/flow1/begin.xhtml", navCase.getToViewId(facesContext));
       
        processRender();
      
        //Enter flow 1
        UICommand button = (UICommand) facesContext.getViewRoot().findComponent("mainForm:startFlow1");
        submit(button);
       
        processLifecycleExecute();
       
        Flow currentFlow = facesContext.getApplication().getFlowHandler().getCurrentFlow(facesContext);
        Assert.assertNotNull(currentFlow);
        Assert.assertEquals(currentFlow.getId(), "flow1");
       
        processRender();
       
        NavigationCase goFlowBase = handler.getNavigationCase(facesContext, null, "flow_base");
        Assert.assertNotNull(goFlowBase);
       
        UICommand button2 = (UICommand) facesContext.getViewRoot().findComponent("mainForm:go_flow_base");
        submit(button2);
       
View Full Code Here

    public void testFlow1_7() throws Exception
    {
        setupRequest("/flow_base.xhtml");
        processLifecycleExecute();
       
        ConfigurableNavigationHandler handler = (ConfigurableNavigationHandler) facesContext.getApplication().getNavigationHandler();
       
        NavigationCase navCase = handler.getNavigationCase(facesContext, null, "flow1");
       
        Assert.assertNotNull(navCase);
       
        // Check begin view node
        Assert.assertEquals("/flow1/begin.xhtml", navCase.getToViewId(facesContext));
View Full Code Here

    public void testFlow1_8() throws Exception
    {
        setupRequest("/flow_base.xhtml");
        processLifecycleExecute();
       
        ConfigurableNavigationHandler handler = (ConfigurableNavigationHandler) facesContext.getApplication().getNavigationHandler();
       
        processRender();
      
        //Enter flow 1
        UICommand button = (UICommand) facesContext.getViewRoot().findComponent("mainForm:startFlow3");
View Full Code Here

    public void testFlow1_9() throws Exception
    {
        setupRequest("/flow_base.xhtml");
        processLifecycleExecute();
       
        ConfigurableNavigationHandler handler = (ConfigurableNavigationHandler) facesContext.getApplication().getNavigationHandler();
       
        processRender();
      
        //Enter flow 1
        UICommand button = (UICommand) facesContext.getViewRoot().findComponent("mainForm:startFlow2");
        submit(button);
       
        processLifecycleExecute();
       
        Flow currentFlow = facesContext.getApplication().getFlowHandler().getCurrentFlow(facesContext);
        Assert.assertNotNull(currentFlow);
        Assert.assertEquals(currentFlow.getId(), "flow2");
       
        processRender();
       
        NavigationCase goFlowBase = handler.getNavigationCase(facesContext, null, "flow_base");
        Assert.assertNotNull(goFlowBase);
       
        UICommand button2 = (UICommand) facesContext.getViewRoot().findComponent("mainForm:go_flow_base");
        submit(button2);
       
View Full Code Here

    public void testFlow1_9_1() throws Exception
    {
        setupRequest("/flow_base.xhtml");
        processLifecycleExecute();
       
        ConfigurableNavigationHandler handler = (ConfigurableNavigationHandler) facesContext.getApplication().getNavigationHandler();
       
        processRender();
      
        //Enter flow 1
        UICommand button = (UICommand) facesContext.getViewRoot().findComponent("mainForm:startFlow2");
        submit(button);
       
        processLifecycleExecute();
       
        Flow currentFlow = facesContext.getApplication().getFlowHandler().getCurrentFlow(facesContext);
        Assert.assertNotNull(currentFlow);
        Assert.assertEquals(currentFlow.getId(), "flow2");
       
        processRender();
       
        NavigationCase goFlowBase = handler.getNavigationCase(facesContext, null, "flow_base");
        Assert.assertNotNull(goFlowBase);
       
        UICommand button2 = (UICommand) facesContext.getViewRoot().findComponent("mainForm:go_flow_base");
        submit(button2);
       
        processLifecycleExecute();
       
        Assert.assertEquals("/flow_base.xhtml", facesContext.getViewRoot().getViewId());

        processRender();
       
        UICommand button3 = (UICommand) facesContext.getViewRoot().findComponent("mainForm:startFlow3");
        submit(button3);
       
        processLifecycleExecute();
       
        Flow currentFlow2 = facesContext.getApplication().getFlowHandler().getCurrentFlow(facesContext);
        Assert.assertNotNull(currentFlow2);
        Assert.assertEquals(currentFlow2.getId(), "flow1");
       
        processRender();
       
        UICommand button4 = (UICommand) facesContext.getViewRoot().findComponent("mainForm:go_flow_base");
        submit(button4);
       
        processLifecycleExecute();
       
        Assert.assertEquals("/flow_base.xhtml", facesContext.getViewRoot().getViewId());
       
        processRender();
       
        //UICommand button5 = (UICommand) facesContext.getViewRoot().findComponent("mainForm:returnFlow1_3");
        //submit(button5);
       
        NavigationCase endCase = handler.getNavigationCase(facesContext, null, "back_flow_1_3");
        Assert.assertNotNull(endCase);

        String toViewId = endCase.getToViewId(facesContext);
        // Check if the dynamic outcome return hack has been correctly resolved.
        Assert.assertEquals(toViewId, "/flow_base.xhtml");
View Full Code Here

    public void testFlow1_10() throws Exception
    {
        setupRequest("/flow_base.xhtml");
        processLifecycleExecute();
       
        ConfigurableNavigationHandler handler = (ConfigurableNavigationHandler) facesContext.getApplication().getNavigationHandler();
       
        processRender();
      
        //Enter flow 1
        UICommand button = (UICommand) facesContext.getViewRoot().findComponent("mainForm:startFlow3");
        submit(button);
       
        processLifecycleExecute();
       
        Flow currentFlow = facesContext.getApplication().getFlowHandler().getCurrentFlow(facesContext);
        Assert.assertNotNull(currentFlow);
        Assert.assertEquals(currentFlow.getId(), "flow1");
       
        processRender();
       
        NavigationCase goFlowBase = handler.getNavigationCase(facesContext, null, "flow_base");
        Assert.assertNotNull(goFlowBase);
       
        UICommand button2 = (UICommand) facesContext.getViewRoot().findComponent("mainForm:go_flow_base");
        submit(button2);
       
View Full Code Here

    public void testFlow1_10_1() throws Exception
    {
        setupRequest("/flow_base.xhtml");
        processLifecycleExecute();
       
        ConfigurableNavigationHandler handler = (ConfigurableNavigationHandler) facesContext.getApplication().getNavigationHandler();
       
        processRender();
      
        //Enter flow 1
        UICommand button = (UICommand) facesContext.getViewRoot().findComponent("mainForm:startFlow3");
        submit(button);
       
        processLifecycleExecute();
       
        Flow currentFlow = facesContext.getApplication().getFlowHandler().getCurrentFlow(facesContext);
        Assert.assertNotNull(currentFlow);
        Assert.assertEquals(currentFlow.getId(), "flow1");
       
        processRender();
       
        NavigationCase goFlowBase = handler.getNavigationCase(facesContext, null, "flow_base");
        Assert.assertNotNull(goFlowBase);
       
        UICommand button2 = (UICommand) facesContext.getViewRoot().findComponent("mainForm:go_flow_base");
        submit(button2);
       
View Full Code Here

    public void testFlow1_10_2() throws Exception
    {
        setupRequest("/flow_base.xhtml");
        processLifecycleExecute();
       
        ConfigurableNavigationHandler handler = (ConfigurableNavigationHandler) facesContext.getApplication().getNavigationHandler();
       
        processRender();
      
        //Enter flow 1
        UICommand button = (UICommand) facesContext.getViewRoot().findComponent("mainForm:startFlow3");
        submit(button);
       
        processLifecycleExecute();
       
        Flow currentFlow = facesContext.getApplication().getFlowHandler().getCurrentFlow(facesContext);
        Assert.assertNotNull(currentFlow);
        Assert.assertEquals(currentFlow.getId(), "flow1");
       
        processRender();
       
        NavigationCase goFlowBase = handler.getNavigationCase(facesContext, null, "flow_base");
        Assert.assertNotNull(goFlowBase);
       
        UICommand button2 = (UICommand) facesContext.getViewRoot().findComponent("mainForm:go_flow_base");
        submit(button2);
       
        processLifecycleExecute();
       
        Assert.assertEquals("/flow_base.xhtml", facesContext.getViewRoot().getViewId());

        processRender();
       
        UICommand button3 = (UICommand) facesContext.getViewRoot().findComponent("mainForm:startFlow2");
        submit(button3);
       
        processLifecycleExecute();
       
        Flow currentFlow2 = facesContext.getApplication().getFlowHandler().getCurrentFlow(facesContext);
        Assert.assertNotNull(currentFlow2);
        Assert.assertEquals(currentFlow2.getId(), "flow2");
       
        processRender();
       
        UICommand button4 = (UICommand) facesContext.getViewRoot().findComponent("mainForm:go_flow_base");
        submit(button4);
       
        processLifecycleExecute();
       
        Assert.assertEquals("/flow_base.xhtml", facesContext.getViewRoot().getViewId());
       
        processRender();
       
        //UICommand button5 = (UICommand) facesContext.getViewRoot().findComponent("mainForm:returnFlow1_3");
        //submit(button5);
        NavigationCase endCase = handler.getNavigationCase(facesContext, null, "back_flow_1_3");
        Assert.assertNotNull(endCase);

        String toViewId = endCase.getToViewId(facesContext);
        // Check if the dynamic outcome return hack has been correctly resolved.
        Assert.assertEquals(toViewId, "/flow_base.xhtml");
View Full Code Here

    public void testFlow1_11() throws Exception
    {
        setupRequest("/flow_base.xhtml");
        processLifecycleExecute();
       
        ConfigurableNavigationHandler handler = (ConfigurableNavigationHandler) facesContext.getApplication().getNavigationHandler();
       
        processRender();
      
        //Enter flow 1
        UICommand button = (UICommand) facesContext.getViewRoot().findComponent("mainForm:startFlow4");
        submit(button);
       
        processLifecycleExecute();
       
        Assert.assertEquals("/flow4/flow4.xhtml", facesContext.getViewRoot().getViewId());
       
        Flow currentFlow = facesContext.getApplication().getFlowHandler().getCurrentFlow(facesContext);
        Assert.assertNotNull(currentFlow);
        Assert.assertEquals(currentFlow.getId(), "flow4");
       
        processRender();
       
        NavigationCase goFlowBase = handler.getNavigationCase(facesContext, null, "flow_base");
        Assert.assertNotNull(goFlowBase);
       
        UICommand button2 = (UICommand) facesContext.getViewRoot().findComponent("mainForm:go_flow_base");
        submit(button2);
       
View Full Code Here

TOP

Related Classes of javax.faces.application.ConfigurableNavigationHandler

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.