membrane/soa-model — pull request #164 by ithena (2013-11-15 09:32:53+00:00)
Title: Possible fix for #162: incomplete schema compare when using Element refs

When using ref constructs for elements the name of the element is always null. In the compare algorithm a.name != b.name is regularly used to find differences, but when using ref's no change is found (since null == null).

This fix overwrites the Element getName() method to return the ref (as String) when no name has been set. This way the compare algorithm does find differences where a.name != b.name is used.

Overwriting the getName() method is probably a shortcut that causes other inconsistencies (although only one existing test fails, details below). In this case a correcter approach would be to extend the compare algorithm to add a.ref != b.ref statements wherever applicable. **Could you advise on this?**

After this change one assertion in one test case failed:

```
OperationUsageAnalyzer4OTATest.testAnalyzeOperationUsage() {
assert 150 == OperationUsageAnalyzer.analyzeOperationUsage(wsdl).elementsInfo.size()
}
```

after the update 155 usages were found instead of the expected ~~150~~. These 5 extra usages found are Elements that use ref instead of name+type. **Could you validate if this result (the 5 extra usages) is correct or incorrect?**

```
Println of the toString() for the extra 5 elements:**

element[name={http://www.opentravel.org/OTA/2003/05}TPA_Extensions,type=null,ref={http://www.opentravel.org/OTA/2003/05}TPA_Extensions,embeddedType=null]=[PortType: hotelPortType, Operation: otaHotelResNotif (input: true, output: false, fault: false)]
element[name={http://www.opentravel.org/OTA/2003/05}RateAmountMessages,type=null,ref={http://www.opentravel.org/OTA/2003/05}RateAmountMessages,embeddedType=null]=[PortType: hotelPortType, Operation: otaHotelRateAmountNotif (input: true, output: false, fault: false)]
element[name={http://www.opentravel.org/OTA/2003/05}TPA_Extensions,type=null,ref={http://www.opentravel.org/OTA/2003/05}TPA_Extensions,embeddedType=null]=[PortType: hotelPortType, Operation: otaCancel (input: true, output: false, fault: false)]
element[name={http://www.opentravel.org/OTA/2003/05}TPA_Extensions,type=null,ref={http://www.opentravel.org/OTA/2003/05}TPA_Extensions,embeddedType=null]=[PortType: hotelPortType, Operation: otaCancel (input: true, output: false, fault: false)]
element[name={http://www.opentravel.org/OTA/2003/05}TPA_Extensions,type=null,ref={http://www.opentravel.org/OTA/2003/05}TPA_Extensions,embeddedType=null]=[PortType: hotelPortType, Operation: otaCancel (input: false, output: true, fault: false)]
```