001    package railo.runtime.spooler.test;
002    
003    import railo.runtime.config.Config;
004    import railo.runtime.exp.ExpressionException;
005    import railo.runtime.exp.PageException;
006    import railo.runtime.spooler.ExecutionPlan;
007    import railo.runtime.spooler.SpoolerTaskSupport;
008    import railo.runtime.type.Struct;
009    import railo.runtime.type.StructImpl;
010    
011    public class TestTask extends SpoolerTaskSupport {
012    
013            private int fail;
014            private String label;
015    
016            public TestTask(ExecutionPlan[] plans,String label, int fail) {
017                    super(plans);
018                    this.label=label;
019                    this.fail=fail;
020            }
021    
022            /**
023             * @see railo.runtime.spooler.SpoolerTask#getType()
024             */
025            public String getType() {
026                    return "test";
027            }
028    
029            public Struct detail() {
030                    return new StructImpl();
031            }
032    
033            public Object execute(Config config) throws PageException {
034                    //print.out("execute:"+label+":"+fail+":"+new Date());
035                    if(fail-->0)throw new ExpressionException("no idea");
036    
037                    return null;
038            }
039    
040            public String subject() {
041                    return label;
042            }
043    
044    }