You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tuscany.apache.org by sv...@apache.org on 2007/03/08 18:24:28 UTC

svn commit: r516109 - /incubator/tuscany/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/databinding/impl/PassByValueWirePostProcessorTestCase.java

Author: svkrish
Date: Thu Mar  8 09:24:27 2007
New Revision: 516109

URL: http://svn.apache.org/viewvc?view=rev&rev=516109
Log:
added testcase to test skip adding the passbyvalue interceptor if one end of wire is servicebinding or reference binding

Modified:
    incubator/tuscany/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/databinding/impl/PassByValueWirePostProcessorTestCase.java

Modified: incubator/tuscany/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/databinding/impl/PassByValueWirePostProcessorTestCase.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/databinding/impl/PassByValueWirePostProcessorTestCase.java?view=diff&rev=516109&r1=516108&r2=516109
==============================================================================
--- incubator/tuscany/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/databinding/impl/PassByValueWirePostProcessorTestCase.java (original)
+++ incubator/tuscany/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/databinding/impl/PassByValueWirePostProcessorTestCase.java Thu Mar  8 09:24:27 2007
@@ -25,6 +25,7 @@
 import java.util.Map;
 
 import org.apache.tuscany.spi.ObjectCreationException;
+import org.apache.tuscany.spi.component.ServiceBinding;
 import org.apache.tuscany.spi.component.TargetResolutionException;
 import org.apache.tuscany.spi.databinding.DataBindingRegistry;
 import org.apache.tuscany.spi.extension.AtomicComponentExtension;
@@ -190,6 +191,44 @@
         expect(inboundWire.getInvocationChains()).andReturn(inChainsMap);
         expect(outboundWire.getServiceContract()).andReturn(serviceContract).anyTimes();
         expect(outboundWire.getInvocationChains()).andReturn(outChainsMap).times(2);
+
+        Interceptor inInterceptor = createMock(Interceptor.class);
+        Interceptor outInterceptor = createMock(Interceptor.class);
+        inChain.addInterceptor(0, inInterceptor);
+        outChain.addInterceptor(0, outInterceptor);
+        outChain.addInterceptor(new SynchronousBridgingInterceptor(inChain.getHeadInterceptor()));
+
+        EasyMock.replay(inboundWire, outboundWire);
+        processor.process(outboundWire, inboundWire);
+
+        assertEquals(false, inChain.getHeadInterceptor() instanceof PassByValueInterceptor);
+        assertEquals(false,
+            outChain.getTailInterceptor().getNext() instanceof PassByValueInterceptor);
+        assertEquals(true, outChain.getTailInterceptor().getNext().equals(
+            inChain.getHeadInterceptor()));
+    }
+    
+    public void testProcessExclusionOfInterceptorForBinding() {
+        InboundWire inboundWire = createMock(InboundWire.class);
+        OutboundWire outboundWire = createMock(OutboundWire.class);
+        
+        ServiceBinding serviceBinding = createMock(ServiceBinding.class);
+        expect(outboundWire.getContainer()).andReturn(serviceBinding).anyTimes();
+        expect(inboundWire.getContainer()).andReturn(null).anyTimes();
+
+        ServiceContract<Type> serviceContract = new JavaServiceContract(null);
+        serviceContract.setRemotable(true);
+        Map<Operation<?>, InboundInvocationChain> inChainsMap =
+            new Hashtable<Operation<?>, InboundInvocationChain>();
+
+        Operation<?> operation1 = new Operation<Type>("testMethod", null, null, null);
+        InboundInvocationChainImpl inChain = new InboundInvocationChainImpl(operation1);
+        inChainsMap.put(operation1, inChain);
+
+        Map<Operation<?>, OutboundInvocationChain> outChainsMap =
+            new Hashtable<Operation<?>, OutboundInvocationChain>();
+        OutboundInvocationChainImpl outChain = new OutboundInvocationChainImpl(operation1);
+        outChainsMap.put(operation1, outChain);
 
         Interceptor inInterceptor = createMock(Interceptor.class);
         Interceptor outInterceptor = createMock(Interceptor.class);



---------------------------------------------------------------------
To unsubscribe, e-mail: tuscany-commits-unsubscribe@ws.apache.org
For additional commands, e-mail: tuscany-commits-help@ws.apache.org