Author: jmarino
Date: Thu Jan 4 02:13:01 2007
New Revision: 492499
URL: http://svn.apache.org/viewvc?view=rev&rev=492499
Log:
unit testing for incompatible interfaces
Modified:
incubator/tuscany/java/sca/kernel/core/src/main/java/org/apache/tuscany/core/builder/IncompatibleInterfacesException.java
incubator/tuscany/java/sca/kernel/core/src/test/java/org/apache/tuscany/core/builder/ConnectorImplTestCase.java
Modified:
incubator/tuscany/java/sca/kernel/core/src/main/java/org/apache/tuscany/core/builder/IncompatibleInterfacesException.java
URL:
http://svn.apache.org/viewvc/incubator/tuscany/java/sca/kernel/core/src/main/java/org/apache/tuscany/core/builder/IncompatibleInterfacesException.java?view=diff&rev=492499&r1=492498&r2=492499
==============================================================================
---
incubator/tuscany/java/sca/kernel/core/src/main/java/org/apache/tuscany/core/builder/IncompatibleInterfacesException.java
(original)
+++
incubator/tuscany/java/sca/kernel/core/src/main/java/org/apache/tuscany/core/builder/IncompatibleInterfacesException.java
Thu Jan 4 02:13:01 2007
@@ -57,25 +57,37 @@
public IncompatibleInterfacesException(InboundWire source, OutboundWire
target) {
super("Incompatible source and target interfaces");
setTargetServiceName(source.getServiceName());
- setSourceName(source.getContainer().getName());
+ if (source.getContainer() != null) {
+ setSourceName(source.getContainer().getName());
+ }
setReferenceName(target.getReferenceName());
- setTargetName(target.getContainer().getName());
+ if (target.getContainer() != null) {
+ setTargetName(target.getContainer().getName());
+ }
}
public IncompatibleInterfacesException(OutboundWire source, InboundWire
target) {
super("Incompatible source and target interfaces");
setTargetServiceName(target.getServiceName());
- setSourceName(source.getContainer().getName());
+ if (source.getContainer() != null) {
+ setSourceName(source.getContainer().getName());
+ }
setReferenceName(source.getReferenceName());
- setTargetName(target.getContainer().getName());
+ if (target.getContainer() != null) {
+ setTargetName(target.getContainer().getName());
+ }
}
public IncompatibleInterfacesException(OutboundWire source, InboundWire
target, Throwable throwable) {
super("Incompatible source and target interfaces", throwable);
setTargetServiceName(target.getServiceName());
- setSourceName(source.getContainer().getName());
+ if (source.getContainer() != null) {
+ setSourceName(source.getContainer().getName());
+ }
setReferenceName(source.getReferenceName());
- setTargetName(target.getContainer().getName());
+ if (target.getContainer() != null) {
+ setTargetName(target.getContainer().getName());
+ }
}
}
Modified:
incubator/tuscany/java/sca/kernel/core/src/test/java/org/apache/tuscany/core/builder/ConnectorImplTestCase.java
URL:
http://svn.apache.org/viewvc/incubator/tuscany/java/sca/kernel/core/src/test/java/org/apache/tuscany/core/builder/ConnectorImplTestCase.java?view=diff&rev=492499&r1=492498&r2=492499
==============================================================================
---
incubator/tuscany/java/sca/kernel/core/src/test/java/org/apache/tuscany/core/builder/ConnectorImplTestCase.java
(original)
+++
incubator/tuscany/java/sca/kernel/core/src/test/java/org/apache/tuscany/core/builder/ConnectorImplTestCase.java
Thu Jan 4 02:13:01 2007
@@ -18,9 +18,12 @@
*/
package org.apache.tuscany.core.builder;
+import java.lang.reflect.Type;
+
import org.apache.tuscany.spi.component.AtomicComponent;
import org.apache.tuscany.spi.component.CompositeComponent;
import org.apache.tuscany.spi.component.SCAObject;
+import org.apache.tuscany.spi.model.Operation;
import org.apache.tuscany.spi.wire.InboundInvocationChain;
import org.apache.tuscany.spi.wire.InboundWire;
import org.apache.tuscany.spi.wire.Interceptor;
@@ -34,8 +37,8 @@
import org.apache.tuscany.core.wire.InboundWireImpl;
import org.apache.tuscany.core.wire.InvokerInterceptor;
import org.apache.tuscany.core.wire.OutboundInvocationChainImpl;
-import org.apache.tuscany.core.wire.SynchronousBridgingInterceptor;
import org.apache.tuscany.core.wire.OutboundWireImpl;
+import org.apache.tuscany.core.wire.SynchronousBridgingInterceptor;
import org.easymock.EasyMock;
/**
@@ -151,6 +154,39 @@
connector.connect(outboundWire, inboundWire, true);
EasyMock.verify(outboundWire);
EasyMock.verify(container);
+ }
+
+ public void testIncompatibleInboundOutboundWiresConnect() throws Exception
{
+ Operation<Type> operation = new Operation<Type>("bar", null, null,
null);
+ InboundWire inboundWire = new InboundWireImpl();
+ inboundWire.addInvocationChain(operation, new
InboundInvocationChainImpl(operation));
+ OutboundWire outboundWire = new OutboundWireImpl();
+ try {
+ connector.connect(inboundWire, outboundWire, false);
+ fail();
+ } catch (IncompatibleInterfacesException e) {
+ // expected
+ }
+
+ }
+
+ public void testIncompatibleOutboundInboundWiresConnect() throws Exception
{
+ SCAObject container = EasyMock.createNiceMock(SCAObject.class);
+ EasyMock.expect(container.isSystem()).andReturn(false);
+ EasyMock.replay(container);
+ Operation<Type> operation = new Operation<Type>("bar", null, null,
null);
+ InboundWire inboundWire = new InboundWireImpl();
+ inboundWire.setContainer(container);
+ OutboundWire outboundWire = new OutboundWireImpl();
+ outboundWire.setContainer(container);
+ outboundWire.addInvocationChain(operation, new
OutboundInvocationChainImpl(operation));
+ try {
+ connector.connect(outboundWire, inboundWire, false);
+ fail();
+ } catch (IncompatibleInterfacesException e) {
+ // expected
+ }
+
}
public void testInvalidConnectObject() throws Exception {
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]