From e3dda746338a080bc89ded6e782e9e374a64bf90 Mon Sep 17 00:00:00 2001 From: slaws Date: Thu, 25 Aug 2011 11:45:53 +0000 Subject: Add auditing to callback compatibility testing git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@1161519 13f79535-47bb-0310-9956-ffa450edef68 --- .../sca/interfacedef/impl/InterfaceContractMapperImpl.java | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) (limited to 'sca-java-2.x/trunk/modules/assembly/src/main/java/org/apache/tuscany/sca/interfacedef/impl/InterfaceContractMapperImpl.java') diff --git a/sca-java-2.x/trunk/modules/assembly/src/main/java/org/apache/tuscany/sca/interfacedef/impl/InterfaceContractMapperImpl.java b/sca-java-2.x/trunk/modules/assembly/src/main/java/org/apache/tuscany/sca/interfacedef/impl/InterfaceContractMapperImpl.java index 17b41c30a2..7e51e38aaf 100644 --- a/sca-java-2.x/trunk/modules/assembly/src/main/java/org/apache/tuscany/sca/interfacedef/impl/InterfaceContractMapperImpl.java +++ b/sca-java-2.x/trunk/modules/assembly/src/main/java/org/apache/tuscany/sca/interfacedef/impl/InterfaceContractMapperImpl.java @@ -388,7 +388,7 @@ public class InterfaceContractMapperImpl implements InterfaceContractMapper { if (source.getInterface() == target.getInterface()) { return ignoreCallback - || isCallbackCompatible(source, target, silent); + || isCallbackCompatible(source, target, silent, audit); } if (source.getInterface() == null || target.getInterface() == null) { @@ -398,7 +398,7 @@ public class InterfaceContractMapperImpl implements InterfaceContractMapper { if (source.getInterface().isDynamic() || target.getInterface().isDynamic()) { return ignoreCallback - || isCallbackCompatible(source, target, silent); + || isCallbackCompatible(source, target, silent, audit); } if (source.getInterface().isRemotable() != target.getInterface() @@ -448,7 +448,7 @@ public class InterfaceContractMapperImpl implements InterfaceContractMapper { } } - return ignoreCallback || isCallbackCompatible(source, target, silent); + return ignoreCallback || isCallbackCompatible(source, target, silent, audit); } /* @@ -476,13 +476,15 @@ public class InterfaceContractMapperImpl implements InterfaceContractMapper { - protected boolean isCallbackCompatible(InterfaceContract source, InterfaceContract target, boolean silent) + protected boolean isCallbackCompatible(InterfaceContract source, InterfaceContract target, boolean silent, Audit audit) throws IncompatibleInterfaceContractException { if (source.getCallbackInterface() == null && target.getCallbackInterface() == null) { return true; } if (source.getCallbackInterface() == null || target.getCallbackInterface() == null) { if (!silent) { + audit.append("Callback interface doesn't match as one of the callback interfaces is null"); + audit.appendSeperator(); throw new IncompatibleInterfaceContractException("Callback interface doesn't match as one of the callback interfaces is null", source, target); } else { return false; @@ -494,6 +496,8 @@ public class InterfaceContractMapperImpl implements InterfaceContractMapper { getOperation(target.getCallbackInterface().getOperations(), operation.getName()); if (targetOperation == null) { if (!silent) { + audit.append("Callback operation not found on target " + operation.getName()); + audit.appendSeperator(); throw new IncompatibleInterfaceContractException("Callback operation not found on target", source, target, null, targetOperation); } else { @@ -504,6 +508,8 @@ public class InterfaceContractMapperImpl implements InterfaceContractMapper { // FIXME: for remotable operation, only compare name for now if (!operation.equals(targetOperation)) { if (!silent) { + audit.append("Target callback operation is not compatible " + operation.getName()); + audit.appendSeperator(); throw new IncompatibleInterfaceContractException("Target callback operation is not compatible", source, target, operation, targetOperation); } else { -- cgit v1.2.3