Changeset 225
- Timestamp:
- 09/30/11 17:36:08 (13 years ago)
- Location:
- trunk/EventBenchConsole/src/de/ugoe/cs/eventbench/web
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/EventBenchConsole/src/de/ugoe/cs/eventbench/web/WeblogParser.java
r224 r225 37 37 /** 38 38 * <p> 39 * Minimal length of a session. All shorter sessions will be pruned. 39 * Minimal length of a session. All shorter sessions will be pruned.<br> 40 40 * Default: 2 41 41 * </p> … … 45 45 /** 46 46 * <p> 47 * Maximal length of a session. All longer sessions will be prun de. Default:48 * 10047 * Maximal length of a session. All longer sessions will be pruned.<br> 48 * Default: 100 49 49 * </p> 50 50 */ 51 51 private int maxLength = 100; 52 53 /** 54 * <p> 55 * URL of the server that generated the log that is currently parser; null 56 * of URL is not available.<br> 57 * Default: null 58 * </p> 59 */ 60 private String url = null; 52 61 53 62 /** … … 142 151 public void setMaxLength(int maxLength) { 143 152 this.maxLength = maxLength; 153 } 154 155 /** 156 * <p> 157 * Sets the URL of the server from which this log was generated. Often 158 * required for replay generation 159 * </p> 160 * 161 * @param url 162 * URL of the server 163 */ 164 public void setUrl(String url) { 165 this.url = url; 144 166 } 145 167 … … 203 225 List<String> getVars = extractGetVarsFromUri(uri); 204 226 205 WebEvent event = new WebEvent( path, timestamp, postedVars,206 getVars);227 WebEvent event = new WebEvent(url, path, timestamp, 228 postedVars, getVars); 207 229 208 230 // find session and add event -
trunk/EventBenchConsole/src/de/ugoe/cs/eventbench/web/commands/CMDloadSessionsFromClickstream.java
r224 r225 34 34 String source = (String) parameters.get(0); 35 35 String sequencesName = (String) parameters.get(1); 36 String serverUrl = ""; 36 37 int timeout = -1; 37 38 int minLength = -1; 38 39 int maxLength = -1; 39 if (parameters.size() >= 4) { 40 timeout = Integer.parseInt((String) parameters.get(2)); 41 minLength = Integer.parseInt((String) parameters.get(3)); 42 maxLength = Integer.parseInt((String) parameters.get(4)); 40 if( parameters.size()>=3 ) { 41 serverUrl = (String) parameters.get(2); 42 } 43 if (parameters.size() >= 5) { 44 timeout = Integer.parseInt((String) parameters.get(3)); 45 minLength = Integer.parseInt((String) parameters.get(4)); 46 maxLength = Integer.parseInt((String) parameters.get(5)); 43 47 } 44 48 45 49 WeblogParser parser = new WeblogParser(); 50 if( serverUrl!="" ) { 51 parser.setUrl(serverUrl); 52 } 46 53 if (timeout != -1) { 47 54 parser.setTimeout(timeout); … … 73 80 @Override 74 81 public void help() { 75 Console.println("Usage: loadSessionsFromClickstream <filename> <sequencesName> {< timeout> <minSessionLength> <maxSessionLength>}");82 Console.println("Usage: loadSessionsFromClickstream <filename> <sequencesName> {<serverUrl>} {<timeout> <minSessionLength> <maxSessionLength>}"); 76 83 } 77 84 -
trunk/EventBenchConsole/src/de/ugoe/cs/eventbench/web/data/WebEvent.java
r171 r225 59 59 * </p> 60 60 * 61 * @param url 62 * URL of the server that received the event 61 63 * @param path 62 64 * path of the URI … … 68 70 * GET variables send with the event 69 71 */ 70 public WebEvent(String path, long timestamp, List<String> postVars,71 List<String> getVars) {72 public WebEvent(String url, String path, long timestamp, 73 List<String> postVars, List<String> getVars) { 72 74 super(makeType(path, postVars, getVars)); 73 75 this.timestamp = timestamp; 74 addReplayEvent(new WebRequest( path, postVars, getVars));76 addReplayEvent(new WebRequest(url, path, postVars, getVars)); 75 77 } 76 78 -
trunk/EventBenchConsole/src/de/ugoe/cs/eventbench/web/data/WebRequest.java
r171 r225 9 9 * <p> 10 10 * Contains all information related to a web request, i.e., the path, the POST 11 * variables and the GET variables. 11 * variables and the GET variables. The generated replay are for the command 12 * line tool {@code curl}. The requests do not contain correct values for the 13 * POST and GET request. Instead, only the parameters that are part of the 14 * requests are added and the values of the parameters are 15 * DATA_$PARAMNAME$_DATA, where $PARAMNAME$ is the upper case string of the 16 * parameter name. This allows test data generators to insert concrete values, 17 * as EventBench does not include a test data generator for web software. 12 18 * </p> 13 19 * … … 47 53 /** 48 54 * <p> 55 * URL of the server. 56 * </p> 57 */ 58 String serverUrl; 59 60 /** 61 * <p> 49 62 * Constructor. Creates a new WebRequest. 50 63 * </p> … … 57 70 * GET variables of the request 58 71 */ 59 public WebRequest(String uri, List<String> postVars, List<String> getVars) { 72 public WebRequest(String url, String uri, List<String> postVars, 73 List<String> getVars) { 74 serverUrl = url; 60 75 targetUri = uri; 61 76 this.postVars = new ArrayList<String>(postVars); // defensive copy … … 70 85 @Override 71 86 public String getReplay() { 72 // TODO implement method 73 return null; 87 StringBuilder builder = new StringBuilder(); 88 builder.append("curl"); 89 if (!postVars.isEmpty()) { 90 boolean isFirstPost = true; 91 for (String postVar : postVars) { 92 if (isFirstPost) { 93 builder.append(" --data \""); 94 isFirstPost = false; 95 } else { 96 builder.append("&"); 97 } 98 builder.append(postVar + "=DATA_" + postVar.toUpperCase() 99 + "_DATA"); 100 } 101 builder.append("\""); 102 } 103 builder.append(" "); 104 if (serverUrl != null) { 105 builder.append(serverUrl); 106 } 107 builder.append(targetUri); 108 if (!getVars.isEmpty()) { 109 boolean isFirstGet = true; 110 for (String getVar : getVars) { 111 if (isFirstGet) { 112 builder.append("?"); 113 isFirstGet = false; 114 } else { 115 builder.append("&"); 116 } 117 builder.append(getVar + "=DATA_" + getVar.toUpperCase() 118 + "_DATA"); 119 } 120 } 121 return builder.toString(); 74 122 } 75 123 … … 81 129 @Override 82 130 public String getTarget() { 83 // TODO implement method 84 return null; 131 return targetUri; 85 132 } 86 133
Note: See TracChangeset
for help on using the changeset viewer.