Changeset 1635 for trunk/autoquest-plugin-http/src/main/java/de
- Timestamp:
- 07/31/14 16:44:36 (10 years ago)
- Location:
- trunk/autoquest-plugin-http/src/main/java/de/ugoe/cs/autoquest/plugin/http
- Files:
-
- 1 added
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/autoquest-plugin-http/src/main/java/de/ugoe/cs/autoquest/plugin/http/HTTPUtils.java
r1561 r1635 15 15 package de.ugoe.cs.autoquest.plugin.http; 16 16 17 import java.util.LinkedList; 18 import java.util.List; 19 20 import de.ugoe.cs.autoquest.eventcore.Event; 21 import de.ugoe.cs.autoquest.plugin.http.eventcore.SOAPEventType; 22 import de.ugoe.cs.autoquest.plugin.http.eventcore.SimpleSOAPEventType; 17 23 import de.ugoe.cs.autoquest.plugin.http.logdata.Address; 18 24 … … 28 34 /** 29 35 * <p> 30 * converts an address to a simple string containing either host or ip and the port number 31 * ifany.36 * converts an address to a simple string containing either host or ip and the port number if 37 * any. 32 38 * </p> 33 39 * 34 * @param address the address to convert 40 * @param address 41 * the address to convert 35 42 * 36 43 * @return either "host:port" or "ip:port" or "host" or "ip" or "port" or null … … 65 72 /** 66 73 * <p> 67 * compares two addresses and returns true, if they are equal and false else. The addresses 68 * are equal, if either the ip-addresses and the ports match or the host names and the 69 * ports match. 74 * compares two addresses and returns true, if they are equal and false else. The addresses are 75 * equal, if either the ip-addresses and the ports match or the host names and the ports match. 70 76 * </p> 71 * 72 * @param address1 the first address to compare 73 * @param address2 the second address to compare 77 * 78 * @param address1 79 * the first address to compare 80 * @param address2 81 * the second address to compare 74 82 * 75 83 * @return as described … … 82 90 return false; 83 91 } 84 92 85 93 if (!equals(address1.getPort(), address2.getPort())) { 86 94 return false; 87 95 } 88 96 89 97 if (address1.getIp() != null) { 90 98 return equals(address1.getIp(), address2.getIp()); … … 94 102 } 95 103 } 96 104 97 105 /** 98 106 * <p> 99 * convenience method to compare to objects. They are considered equal if they both are null, 100 * orif their equals method returns true.107 * convenience method to compare to objects. They are considered equal if they both are null, or 108 * if their equals method returns true. 101 109 * </p> 102 * 103 * @param object1 the first object to compare 104 * @param object2 the second object to compare 110 * 111 * @param object1 112 * the first object to compare 113 * @param object2 114 * the second object to compare 105 115 * 106 116 * @return as described 107 117 */ 108 118 public static <T> boolean equals(T object1, T object2) { 109 if (object1 == null) 119 if (object1 == null) { 110 120 return object2 == null; 111 121 } … … 117 127 /** 118 128 * <p> 129 * Replaces events with a {@link SOAPEventType} with new events of {@link SimpleSOAPEventType} 130 * and no target. 131 * </p> 132 * 133 * @param sequence 134 * sequence where the events are replaced 135 * @return sequence with {@link SimpleSOAPEventType}s instead of {@link SOAPEventType}s 136 */ 137 public static List<Event> convertToSimpleSOAPEvent(List<Event> sequence) { 138 List<Event> newSequence = null; 139 if (sequence != null) { 140 newSequence = new LinkedList<>(); 141 for (Event event : sequence) { 142 if (event.getType() instanceof SOAPEventType) { 143 SOAPEventType eventType = (SOAPEventType) event.getType(); 144 newSequence.add(new Event(new SimpleSOAPEventType(eventType.getCalledMethod(), 145 eventType.getServiceName()))); 146 } 147 else { 148 newSequence.add(event); 149 } 150 } 151 } 152 return newSequence; 153 } 154 155 /** 156 * <p> 119 157 * prevent instantiation 120 158 * </p> 121 159 */ 122 private HTTPUtils() { 123 160 private HTTPUtils() {} 161 124 162 } -
trunk/autoquest-plugin-http/src/main/java/de/ugoe/cs/autoquest/plugin/http/eventcore/SOAPEventType.java
r1622 r1635 47 47 * </p> 48 48 */ 49 transient private SOAPMessage soapRequest;49 transient private final SOAPMessage soapRequest; 50 50 51 51 /** … … 54 54 * </p> 55 55 */ 56 transient private SOAPMessage soapResponse;56 transient private final SOAPMessage soapResponse; 57 57 58 58 /** … … 61 61 * </p> 62 62 */ 63 private String calledMethod;63 private final String calledMethod; 64 64 65 65 /** 66 66 * <p> 67 67 * the name of the service; this is either the path or, if a path map is available 68 */ 69 private String serviceName; 68 * </p> 69 */ 70 private final String serviceName; 70 71 71 72 /** … … 74 75 * </p> 75 76 */ 76 private String name;77 private final String name; 77 78 78 79 /** … … 227 228 return 228 229 super.equals(obj) && 229 HTTPUtils.equals(calledMethod, ((SOAPEventType) obj).calledMethod); 230 HTTPUtils.equals(calledMethod, ((SOAPEventType) obj).calledMethod) && 231 HTTPUtils.equals(serviceName, ((SOAPEventType) obj).serviceName); 230 232 } 231 233 else { … … 239 241 @Override 240 242 public int hashCode() { 243 int hashCode = super.hashCode(); 241 244 if (calledMethod != null) { 242 return super.hashCode() + calledMethod.hashCode(); 243 } 244 else { 245 return super.hashCode(); 246 } 245 hashCode += calledMethod.hashCode(); 246 } 247 if( serviceName != null ) { 248 hashCode += serviceName.hashCode(); 249 } 250 return hashCode; 247 251 } 248 252
Note: See TracChangeset
for help on using the changeset viewer.