Package org.apache.myfaces.flow.builder

Examples of org.apache.myfaces.flow.builder.FlowBuilderImpl


   
    @Produces
    @FlowBuilderParameter
    public FlowBuilder createFlowBuilderInstance()
    {
        return new FlowBuilderImpl();
    }
View Full Code Here


{
   
    @Test
    public void testFlowBuilderSimple()
    {
        FlowBuilder flowBuilder = new FlowBuilderImpl();
        flowBuilder.id("faces-flow1.xhtml", "flow1").
            initializer("#{bean.init}").finalizer("#{bean.destroy}");
       
        Flow flow = flowBuilder.getFlow();
        Assert.assertNotNull(flow);
        Assert.assertEquals("flow1", flow.getId());
        Assert.assertEquals("faces-flow1.xhtml", flow.getDefiningDocumentId());
        Assert.assertEquals("#{bean.init}", flow.getInitializer().getExpressionString());
        Assert.assertEquals("#{bean.destroy}", flow.getFinalizer().getExpressionString());
View Full Code Here

    }
   
    @Test
    public void testFlowBuilderReturn()
    {
        FlowBuilder flowBuilder = new FlowBuilderImpl();
        flowBuilder.id("faces-flow1.xhtml", "flow1");
        flowBuilder.returnNode("returnNode").markAsStartNode().fromOutcome("mynode");
       
        Flow flow = flowBuilder.getFlow();
        Assert.assertNotNull(flow);
        Assert.assertEquals("returnNode", flow.getStartNodeId());
       
        ReturnNode returnNode = flow.getReturns().get("returnNode");
        Assert.assertNotNull(returnNode);
View Full Code Here

    @Test
    public void testFlowBuilderSwitch()
    {
        externalContext.getRequestMap().put("bean", new SimpleBean());
        FlowBuilder flowBuilder = new FlowBuilderImpl();
        flowBuilder.id("faces-flow1.xhtml", "flow1");
        SwitchCaseBuilder switchCaseBuilder = flowBuilder.switchNode("switch1")
            .markAsStartNode().defaultOutcome("#{bean.outcome1}");
        switchCaseBuilder
            .switchCase().condition("true").fromOutcome("case1");
        switchCaseBuilder
            .switchCase().condition("#{bean.checkCond}").fromOutcome("caseB");
        switchCaseBuilder
            .switchCase().condition(
                application.getExpressionFactory().createValueExpression(Boolean.TRUE, Boolean.class))
                    .fromOutcome("caseC");
       
        Flow flow = flowBuilder.getFlow();
        Assert.assertNotNull(flow);
        Assert.assertEquals("switch1", flow.getStartNodeId());
       
        SwitchNode switchNode = flow.getSwitches().get("switch1");
        Assert.assertNotNull(switchNode);
View Full Code Here

    }
   
    @Test
    public void testFlowBuilderView()
    {
        FlowBuilder flowBuilder = new FlowBuilderImpl();
        flowBuilder.id("faces-flow1.xhtml", "flow1");
        flowBuilder.viewNode("x", "x.xhtml");
        flowBuilder.viewNode("y", "y.xhtml").markAsStartNode();
       
        Flow flow = flowBuilder.getFlow();
        Assert.assertNotNull(flow);
        Assert.assertEquals("y", flow.getStartNodeId());
       
        ViewNode viewNode = flow.getViews().get(0);
        Assert.assertEquals("x", viewNode.getId());
View Full Code Here

   
    @Test
    public void testFlowBuilderInboundParameter()
    {
        externalContext.getRequestMap().put("bean", new SimpleBean());
        FlowBuilder flowBuilder = new FlowBuilderImpl();
        flowBuilder.id("faces-flow1.xhtml", "flow1");
        flowBuilder.inboundParameter("name1", "value1");
        flowBuilder.inboundParameter("name2", "#{bean.value}");
        flowBuilder.inboundParameter("name3",
            application.getExpressionFactory().createValueExpression("value3", String.class));
       
        Flow flow = flowBuilder.getFlow();
        Assert.assertNotNull(flow);

        Parameter param = flow.getInboundParameters().get("name1");
        Assert.assertEquals("name1", param.getName());
        Assert.assertEquals("value1", param.getValue().getValue(facesContext.getELContext()));
View Full Code Here

    }

    @Test
    public void testFlowBuilderMethodCall()
    {
        FlowBuilder flowBuilder = new FlowBuilderImpl();
        flowBuilder.id("faces-flow1.xhtml", "flow1");
        flowBuilder.methodCallNode("method1").expression("#{bean.check}").defaultOutcome("case1").markAsStartNode();
        flowBuilder.methodCallNode("method2").expression("#{bean.checkTo}",
            new Class[]{FacesContext.class}).defaultOutcome("case2");
       
        Flow flow = flowBuilder.getFlow();
        Assert.assertNotNull(flow);
        Assert.assertEquals("method1", flow.getStartNodeId());
       
        MethodCallNode mcn = flow.getMethodCalls().get(0);
        Assert.assertEquals("method1", mcn.getId());
View Full Code Here

    }
   
    @Test
    public void testFlowBuilderFlowCall()
    {
        FlowBuilder flowBuilder = new FlowBuilderImpl();
        flowBuilder.id("faces-flow1.xhtml", "flow1");

        flowBuilder.flowCallNode("goToFlow2").outboundParameter("name1", "value1").
            flowReference("faces-flow2.xhtml", "flow2").markAsStartNode();
       
        Flow flow = flowBuilder.getFlow();
        Assert.assertNotNull(flow);
        Assert.assertEquals("goToFlow2", flow.getStartNodeId());
       
        FlowCallNode flowCallNode = flow.getFlowCalls().get("goToFlow2");
        Assert.assertNotNull(flowCallNode);
View Full Code Here

TOP

Related Classes of org.apache.myfaces.flow.builder.FlowBuilderImpl

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.