1 15 package org.apache.tapestry.test; 16 17 import java.util.ArrayList ; 18 import java.util.Collection ; 19 import java.util.HashMap ; 20 import java.util.Iterator ; 21 import java.util.List ; 22 import java.util.Map ; 23 24 import org.apache.hivemind.impl.BaseLocatable; 25 26 32 public class RequestDescriptor extends BaseLocatable 33 { 34 private String _servletName; 35 private String _servletPath; 36 37 38 private Map _parameters = new HashMap (); 39 40 41 private List _assertions = new ArrayList (); 42 43 public void addAssertion(ResponseAssertion assertion) 44 { 45 _assertions.add(assertion); 46 } 47 48 51 52 public void executeAssertions(ScriptedTestSession session) 53 { 54 Iterator i = _assertions.iterator(); 55 while (i.hasNext()) 56 { 57 ResponseAssertion a = (ResponseAssertion) i.next(); 58 59 a.execute(session); 60 } 61 } 62 63 public void addParameter(String name, String value) 64 { 65 ParameterList pl = (ParameterList) _parameters.get(name); 66 if (pl == null) 67 { 68 pl = new ParameterList(); 69 _parameters.put(name, pl); 70 } 71 72 pl.add(value); 73 } 74 75 81 public String [] getParameterValues(String name) 82 { 83 ParameterList pl = (ParameterList) _parameters.get(name); 84 85 if (pl == null) 86 return null; 87 88 return pl.getValues(); 89 } 90 91 public String getServletName() 92 { 93 return _servletName; 94 } 95 96 public void setServletName(String string) 97 { 98 _servletName = string; 99 } 100 101 public String getServletPath() 102 { 103 return _servletPath; 104 } 105 106 public void setServletPath(String string) 107 { 108 _servletPath = string; 109 } 110 111 114 public String [] getParameterNames() 115 { 116 Collection c = _parameters.keySet(); 117 118 return (String []) c.toArray(new String [c.size()]); 119 } 120 121 } 122 | Popular Tags |