1 16 package org.apache.cocoon.components.flow.java.test; 17 18 import org.apache.cocoon.components.flow.java.*; 19 import org.apache.cocoon.forms.FormContext; 20 import java.util.Locale ; 21 22 public class SimpleFlow extends AbstractSimpleFlow { 23 24 public SimpleFlow() { 25 if (Continuation.currentContinuation() != null) 26 throw new RuntimeException ("Conitnuation should not exist"); 27 } 29 30 public boolean run() { 31 System.out.println("start of flow"); 32 float a = 1; 33 sendPageAndWait("getNumberA"); 34 a = Float.parseFloat(getRequest().getParameter("a")); 35 System.out.println("a=" + a); 36 sendPage("result", new VarMap().add("result", a + 1)); 37 System.out.println("end of flow"); 38 return true; 39 } 40 41 public void testNew(Locale locale) { 42 FormContext formContext = new FormContext(getRequest(), locale); 43 } 44 45 public void testCatch() { 46 try { 47 sendPageAndWait("getNumberA"); 48 float a = Float.parseFloat(getRequest().getParameter("a")); 49 } catch (NumberFormatException nfe) { 50 sendPageAndWait("error"); 51 } 52 sendPage("result"); 53 } 54 55 public void testFinally() { 56 try { 57 sendPageAndWait("getNumberA"); 58 float a = Float.parseFloat(getRequest().getParameter("a")); 59 } finally { 60 sendPageAndWait("result"); 61 } 62 } 63 64 public void testEmpty() { 65 } 67 68 public void testAbstract() { 69 super.parent(); 70 } 71 72 public void testDelegate() { 73 CalculatorFlow flow = new CalculatorFlow(); 74 flow.run(); 75 } 76 } 77 | Popular Tags |