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            @Override
023            public String getType() {
024                    return "test";
025            }
026    
027            public Struct detail() {
028                    return new StructImpl();
029            }
030    
031            public Object execute(Config config) throws PageException {
032                    //print.out("execute:"+label+":"+fail+":"+new Date());
033                    if(fail-->0)throw new ExpressionException("no idea");
034    
035                    return null;
036            }
037    
038            public String subject() {
039                    return label;
040            }
041    
042    }