Changeset 1599


Ignore:
Timestamp:
07/11/14 11:58:34 (10 years ago)
Author:
pharms
Message:
  • equals check for SOAP events
Location:
trunk
Files:
2 added
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/autoquest-plugin-http-test/pom.xml

    r1541 r1599  
    2121        <tested-artifactId>autoquest-plugin-http</tested-artifactId> 
    2222    </properties> 
     23    <dependencies> 
     24        <dependency> 
     25            <groupId>nl.jqno.equalsverifier</groupId> 
     26            <artifactId>equalsverifier</artifactId> 
     27            <version>1.1.3</version> 
     28        </dependency> 
     29    </dependencies> 
    2330</project> 
  • trunk/autoquest-plugin-http/src/main/java/de/ugoe/cs/autoquest/plugin/http/HTTPLogParser.java

    r1565 r1599  
    104104         
    105105        try { 
    106                         parseFile(new FileInputStream(file)); 
    107                 } catch (FileNotFoundException e) { 
    108                         Console.printerr("Error parsing file + " + file.getName()); 
     106            parseFile(new FileInputStream(file)); 
     107        } 
     108        catch (FileNotFoundException e) { 
     109            Console.printerr("Error parsing file + " + file.getName()); 
    109110            Console.logException(e); 
    110111            return; 
    111                 } 
     112        } 
    112113    } 
    113114     
  • trunk/autoquest-plugin-http/src/main/java/de/ugoe/cs/autoquest/plugin/http/commands/CMDparseDirHTTP.java

    r1383 r1599  
    7171 
    7272        Collection<List<Event>> sequences = parser.getSequences(); 
    73  
     73         
    7474        if (GlobalDataContainer.getInstance().addData(sequencesName, sequences)) { 
    7575            CommandHelpers.dataOverwritten(sequencesName); 
     
    104104            } 
    105105            catch (Exception e) { 
    106                 Console.printerrln("Could not parse " + source + ": " + e.getMessage()); 
     106                Console.printerrln("Could not parse " + source + ": " + e); 
    107107            } 
    108108        } 
  • trunk/autoquest-plugin-http/src/main/java/de/ugoe/cs/autoquest/plugin/http/eventcore/HTTPEventType.java

    r1561 r1599  
    136136            HTTPEventType other = (HTTPEventType) obj; 
    137137             
     138            if (!other.getClass().isAssignableFrom(this.getClass())) { 
     139                return false; 
     140            } 
     141             
     142            if (exchange == null) { 
     143                return other.exchange == null; 
     144            } 
     145            else if (other.exchange == null) { 
     146                return false; 
     147            } 
     148             
    138149            HttpRequest request1 = exchange.getRequest(); 
    139150            HttpRequest request2 = other.exchange.getRequest(); 
    140151             
    141             return (HTTPUtils.equals(exchange.getSender(), other.exchange.getSender()) && 
    142                     HTTPUtils.equals(exchange.getReceiver(), other.exchange.getReceiver()) && 
     152            // do not compare the sender, as this may change 
     153            return (HTTPUtils.equals(exchange.getReceiver(), other.exchange.getReceiver()) && 
    143154                    HTTPUtils.equals(request1.getMethod(), request2.getMethod()) && 
    144155                    HTTPUtils.equals(request1.getProtocol(), request2.getProtocol()) && 
     
    155166    @Override 
    156167    public int hashCode() { 
    157         return 
    158             exchange.getRequest().getMethod().hashCode() + 
    159             exchange.getRequest().getProtocol().hashCode() + 
    160             exchange.getRequest().getUrl().hashCode(); 
     168        if (exchange != null) { 
     169            return 
     170                exchange.getRequest().getMethod().hashCode() + 
     171                exchange.getRequest().getProtocol().hashCode() + 
     172                exchange.getRequest().getUrl().hashCode(); 
     173        } 
     174        else { 
     175            return 0; 
     176        } 
    161177    } 
    162178 
  • trunk/autoquest-plugin-http/src/main/java/de/ugoe/cs/autoquest/plugin/http/eventcore/SOAPEventType.java

    r1591 r1599  
    3636 * @author Patrick Harms 
    3737 */ 
    38 public class SOAPEventType extends HTTPEventType { 
     38public final class SOAPEventType extends HTTPEventType { 
    3939 
    4040    /**  */ 
     
    190190        } 
    191191        else if (obj instanceof SOAPEventType) { 
     192            if (!obj.getClass().isAssignableFrom(this.getClass())) { 
     193                return false; 
     194            } 
     195             
    192196            return 
    193197                super.equals(obj) && 
     
    204208    @Override 
    205209    public int hashCode() { 
    206         return super.hashCode() + calledMethod.hashCode(); 
     210        if (calledMethod != null) { 
     211            return super.hashCode() + calledMethod.hashCode(); 
     212        } 
     213        else { 
     214            return super.hashCode(); 
     215        } 
    207216    } 
    208217 
Note: See TracChangeset for help on using the changeset viewer.