summaryrefslogtreecommitdiffstats
path: root/branches
diff options
context:
space:
mode:
Diffstat (limited to 'branches')
-rw-r--r--branches/sca-java-1.x/modules/interface-java/src/main/java/org/apache/tuscany/sca/interfacedef/java/impl/JavaInterfaceImpl.java50
-rw-r--r--branches/sca-java-1.x/modules/interface-wsdl/src/main/java/org/apache/tuscany/sca/interfacedef/wsdl/impl/WSDLInterfaceImpl.java54
-rw-r--r--branches/sca-java-1.x/modules/interface/src/main/java/org/apache/tuscany/sca/interfacedef/impl/InterfaceImpl.java40
-rw-r--r--branches/sca-java-1.x/modules/interface/src/main/java/org/apache/tuscany/sca/interfacedef/impl/OperationImpl.java66
-rw-r--r--branches/sca-java-1.x/modules/interface/src/test/java/org/apache/tuscany/sca/interfacedef/impl/InterfaceContractTestCase.java4
5 files changed, 74 insertions, 140 deletions
diff --git a/branches/sca-java-1.x/modules/interface-java/src/main/java/org/apache/tuscany/sca/interfacedef/java/impl/JavaInterfaceImpl.java b/branches/sca-java-1.x/modules/interface-java/src/main/java/org/apache/tuscany/sca/interfacedef/java/impl/JavaInterfaceImpl.java
index 42e45317b7..194a4a9175 100644
--- a/branches/sca-java-1.x/modules/interface-java/src/main/java/org/apache/tuscany/sca/interfacedef/java/impl/JavaInterfaceImpl.java
+++ b/branches/sca-java-1.x/modules/interface-java/src/main/java/org/apache/tuscany/sca/interfacedef/java/impl/JavaInterfaceImpl.java
@@ -68,6 +68,9 @@ public class JavaInterfaceImpl extends InterfaceImpl implements JavaInterface {
public void setJavaClass(Class<?> javaClass) {
this.javaClass = javaClass;
+ if (javaClass != null) {
+ this.className = javaClass.getName();
+ }
}
public Class<?> getCallbackClass() {
@@ -84,28 +87,47 @@ public class JavaInterfaceImpl extends InterfaceImpl implements JavaInterface {
}
@Override
+ public Object clone() throws CloneNotSupportedException {
+ return super.clone();
+ }
+
+ @Override
public int hashCode() {
- return String.valueOf(getName()).hashCode();
+ final int prime = 31;
+ int result = 1;
+ result = prime * result + ((className == null) ? 0 : className.hashCode());
+ return result;
}
-
+
@Override
public boolean equals(Object obj) {
- if (obj == this) {
+ if (this == obj)
return true;
- } else if (obj instanceof JavaInterface) {
- if (getName() != null) {
- return getName().equals(((JavaInterface)obj).getName());
- } else {
- return ((JavaInterface)obj).getName() == null;
- }
- } else {
+ if (obj == null)
+ return false;
+ if (getClass() != obj.getClass())
return false;
+ JavaInterfaceImpl other = (JavaInterfaceImpl)obj;
+ if (isUnresolved() || other.isUnresolved()) {
+ if (className == null) {
+ if (other.className != null)
+ return false;
+ } else if (!className.equals(other.className))
+ return false;
+ } else {
+ if (javaClass == null) {
+ if (other.javaClass != null)
+ return false;
+ } else if (!javaClass.equals(other.javaClass))
+ return false;
+ if (callbackClass == null) {
+ if (other.callbackClass != null)
+ return false;
+ } else if (!callbackClass.equals(other.callbackClass))
+ return false;
}
- }
- @Override
- public Object clone() throws CloneNotSupportedException {
- return super.clone();
+ return true;
}
}
diff --git a/branches/sca-java-1.x/modules/interface-wsdl/src/main/java/org/apache/tuscany/sca/interfacedef/wsdl/impl/WSDLInterfaceImpl.java b/branches/sca-java-1.x/modules/interface-wsdl/src/main/java/org/apache/tuscany/sca/interfacedef/wsdl/impl/WSDLInterfaceImpl.java
index 3719bbd79a..e8379ee56b 100644
--- a/branches/sca-java-1.x/modules/interface-wsdl/src/main/java/org/apache/tuscany/sca/interfacedef/wsdl/impl/WSDLInterfaceImpl.java
+++ b/branches/sca-java-1.x/modules/interface-wsdl/src/main/java/org/apache/tuscany/sca/interfacedef/wsdl/impl/WSDLInterfaceImpl.java
@@ -61,25 +61,8 @@ public class WSDLInterfaceImpl extends InterfaceImpl implements WSDLInterface {
public void setPortType(PortType portType) {
this.portType = portType;
- }
-
- @Override
- public int hashCode() {
- return String.valueOf(getName()).hashCode();
- }
-
- @Override
- public boolean equals(Object obj) {
- if (obj == this) {
- return true;
- } else if (obj instanceof WSDLInterface) {
- if (getName() != null) {
- return getName().equals(((WSDLInterface)obj).getName());
- } else {
- return ((WSDLInterface)obj).getName() == null;
- }
- } else {
- return false;
+ if (portType != null) {
+ this.name = portType.getQName();
}
}
@@ -96,4 +79,37 @@ public class WSDLInterfaceImpl extends InterfaceImpl implements WSDLInterface {
return (WSDLInterfaceImpl) super.clone();
}
+ @Override
+ public int hashCode() {
+ final int prime = 31;
+ int result = 1;
+ result = prime * result + ((name == null) ? 0 : name.hashCode());
+ return result;
+ }
+
+ @Override
+ public boolean equals(Object obj) {
+ if (this == obj)
+ return true;
+ if (obj == null)
+ return false;
+ if (getClass() != obj.getClass())
+ return false;
+ WSDLInterfaceImpl other = (WSDLInterfaceImpl)obj;
+ if (isUnresolved() || other.isUnresolved()) {
+ if (name == null) {
+ if (other.name != null)
+ return false;
+ } else if (!name.equals(other.name))
+ return false;
+ } else {
+ if (portType == null) {
+ if (other.portType != null)
+ return false;
+ } else if (!portType.equals(other.portType))
+ return false;
+ }
+ return true;
+ }
+
}
diff --git a/branches/sca-java-1.x/modules/interface/src/main/java/org/apache/tuscany/sca/interfacedef/impl/InterfaceImpl.java b/branches/sca-java-1.x/modules/interface/src/main/java/org/apache/tuscany/sca/interfacedef/impl/InterfaceImpl.java
index f287c3cb5a..449ca5af9e 100644
--- a/branches/sca-java-1.x/modules/interface/src/main/java/org/apache/tuscany/sca/interfacedef/impl/InterfaceImpl.java
+++ b/branches/sca-java-1.x/modules/interface/src/main/java/org/apache/tuscany/sca/interfacedef/impl/InterfaceImpl.java
@@ -328,44 +328,4 @@ public class InterfaceImpl implements Interface {
return copy;
}
- /**
- * @see java.lang.Object#hashCode()
- */
- @Override
- public int hashCode() {
- final int prime = 31;
- int result = 1;
- result = prime * result + (conversational ? 1231 : 1237);
- result = prime * result + ((operations == null) ? 0 : operations.hashCode());
- result = prime * result + (remotable ? 1231 : 1237);
- result = prime * result + (unresolved ? 1231 : 1237);
- return result;
- }
-
- /**
- * @see java.lang.Object#equals(java.lang.Object)
- */
- @Override
- public boolean equals(Object obj) {
- if (this == obj)
- return true;
- if (obj == null)
- return false;
- if (getClass() != obj.getClass())
- return false;
- final InterfaceImpl other = (InterfaceImpl)obj;
- if (conversational != other.conversational)
- return false;
- if (operations == null) {
- if (other.operations != null)
- return false;
- } else if (!operations.equals(other.operations))
- return false;
- if (remotable != other.remotable)
- return false;
- if (unresolved != other.unresolved)
- return false;
- return true;
- }
-
}
diff --git a/branches/sca-java-1.x/modules/interface/src/main/java/org/apache/tuscany/sca/interfacedef/impl/OperationImpl.java b/branches/sca-java-1.x/modules/interface/src/main/java/org/apache/tuscany/sca/interfacedef/impl/OperationImpl.java
index de4514c168..5d75db1281 100644
--- a/branches/sca-java-1.x/modules/interface/src/main/java/org/apache/tuscany/sca/interfacedef/impl/OperationImpl.java
+++ b/branches/sca-java-1.x/modules/interface/src/main/java/org/apache/tuscany/sca/interfacedef/impl/OperationImpl.java
@@ -175,72 +175,6 @@ public class OperationImpl implements Operation {
this.nonBlocking = nonBlocking;
}
- @Override
- public int hashCode() {
- final int PRIME = 31;
- int result = 1;
- result = PRIME * result + ((conversationSequence == null) ? 0 : conversationSequence.hashCode());
- // result = PRIME * result + ((faultTypes == null) ? 0 :
- // faultTypes.hashCode());
- result = PRIME * result + ((inputType == null) ? 0 : inputType.hashCode());
- result = PRIME * result + ((name == null) ? 0 : name.hashCode());
- result = PRIME * result + (nonBlocking ? 1231 : 1237);
- result = PRIME * result + ((outputType == null) ? 0 : outputType.hashCode());
- return result;
- }
-
- @Override
- public boolean equals(Object obj) {
- if (this == obj) {
- return true;
- }
- if (obj == null) {
- return false;
- }
- if (getClass() != obj.getClass()) {
- return false;
- }
- final OperationImpl other = (OperationImpl)obj;
- if (conversationSequence == null) {
- if (other.conversationSequence != null) {
- return false;
- }
- } else if (!conversationSequence.equals(other.conversationSequence)) {
- return false;
- }
- /*
- * if (faultTypes == null) { if (other.faultTypes != null) { return
- * false; } } else if (!faultTypes.equals(other.faultTypes)) { return
- * false; }
- */
-
- if (inputType == null) {
- if (other.inputType != null) {
- return false;
- }
- } else if (!inputType.equals(other.inputType)) {
- return false;
- }
- if (name == null) {
- if (other.name != null) {
- return false;
- }
- } else if (!name.equals(other.name)) {
- return false;
- }
- if (nonBlocking != other.nonBlocking) {
- return false;
- }
- if (outputType == null) {
- if (other.outputType != null) {
- return false;
- }
- } else if (!outputType.equals(other.outputType)) {
- return false;
- }
- return true;
- }
-
/**
* @return the wrapperInfo
*/
diff --git a/branches/sca-java-1.x/modules/interface/src/test/java/org/apache/tuscany/sca/interfacedef/impl/InterfaceContractTestCase.java b/branches/sca-java-1.x/modules/interface/src/test/java/org/apache/tuscany/sca/interfacedef/impl/InterfaceContractTestCase.java
index 338170da52..12bb09eb95 100644
--- a/branches/sca-java-1.x/modules/interface/src/test/java/org/apache/tuscany/sca/interfacedef/impl/InterfaceContractTestCase.java
+++ b/branches/sca-java-1.x/modules/interface/src/test/java/org/apache/tuscany/sca/interfacedef/impl/InterfaceContractTestCase.java
@@ -52,7 +52,9 @@ public class InterfaceContractTestCase {
@Test
public void testClone() throws Exception {
InterfaceContract copy = (InterfaceContract) contract.clone();
- Assert.assertEquals(contract, copy);
+ Assert.assertNotNull(copy);
+ Assert.assertNotSame(copy.getCallbackInterface(), contract.getCallbackInterface());
+ Assert.assertNotSame(copy.getInterface(), contract.getInterface());
}
private static class MockInterfaceContract extends InterfaceContractImpl implements InterfaceContract {