1 18 19 package org.apache.beehive.netui.tools.testrecorder.shared; 20 21 import java.util.List ; 22 import java.util.ArrayList ; 23 import java.util.Collections ; 24 25 27 public class RecordSessionBean extends SessionBean { 28 29 private List requestData; 30 private List responseData; 31 protected boolean error = false; 33 34 public RecordSessionBean( String sessionName ) { 35 this.sessionName = sessionName; 36 requestData = new ArrayList (); 37 responseData = new ArrayList (); 38 } 39 40 public void setError() { 41 error = true; 42 } 43 44 public void setError( boolean error ) { 45 this.error = error; 46 } 47 48 public boolean isError() { 49 return error; 50 } 51 52 53 public List getRequestData() { 54 return Collections.unmodifiableList( requestData ); 55 } 56 57 63 public RequestData getRequestData( int index ) { 64 return (RequestData) requestData.get( index ); 65 } 66 67 public List getResponseData() { 68 return Collections.unmodifiableList( responseData ); 69 } 70 71 76 public ResponseData getResponseData( int index ) { 77 return (ResponseData) responseData.get( index ); 78 } 79 80 public void addRequestResponseData( RequestData request, ResponseData response ) { 81 requestData.add( request ); 82 responseData.add( response ); 83 } 84 85 90 public void updateRequestResponseData( RequestData request, ResponseData response ) { 91 if ( requestData.size() == 0 || responseData.size() == 0 ) { 92 throw new IllegalStateException ( "data size is zero, unable to update"); 93 } 94 requestData.set( requestData.size() -1, request ); 95 responseData.add( responseData.size() -1, response ); 96 } 97 98 public int getTestCount() { 99 return requestData.size(); 100 } 101 102 public String toString() { 103 StringBuffer sb = new StringBuffer ( 256 ); 104 sb.append( "[ " ); 105 sb.append( "sessionName( " + getSessionName() + " )" ); 106 sb.append( ", tester( " + getTester() + " )" ); 107 sb.append( ", startDate( " + getStartDateString() + " )" ); 108 sb.append( ", endDate( " + getEndDateString() + " )" ); 109 sb.append( ", testCount( " + getTestCount() + " )" ); 110 sb.append( ", description( " + getDescription() + " )" ); 111 sb.append( " ]" ); 112 return sb.toString(); 113 } 114 115 } 116 | Popular Tags |