diff options
Diffstat (limited to 'sandbox/rfeng/minicore/src/test/java/org/apache/tuscany/core/wire')
11 files changed, 0 insertions, 1143 deletions
diff --git a/sandbox/rfeng/minicore/src/test/java/org/apache/tuscany/core/wire/CallbackInterfaceInterceptorTestCase.java b/sandbox/rfeng/minicore/src/test/java/org/apache/tuscany/core/wire/CallbackInterfaceInterceptorTestCase.java deleted file mode 100644 index 6c50cb406f..0000000000 --- a/sandbox/rfeng/minicore/src/test/java/org/apache/tuscany/core/wire/CallbackInterfaceInterceptorTestCase.java +++ /dev/null @@ -1,60 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.tuscany.core.wire; - -import org.osoa.sca.NoRegisteredCallbackException; - -import org.apache.tuscany.spi.wire.Interceptor; -import org.apache.tuscany.spi.wire.Message; -import org.apache.tuscany.spi.wire.MessageImpl; - -import junit.framework.TestCase; -import org.easymock.EasyMock; - -/** - * @version $Rev$ $Date$ - */ -public class CallbackInterfaceInterceptorTestCase extends TestCase { - - public void testOptimize() throws Exception { - CallbackInterfaceInterceptor interceptor = new CallbackInterfaceInterceptor(true); - assertFalse(interceptor.isOptimizable()); - } - - public void testImplements() { - CallbackInterfaceInterceptor interceptor = new CallbackInterfaceInterceptor(true); - Interceptor next = EasyMock.createMock(Interceptor.class); - EasyMock.expect(next.invoke(EasyMock.isA(Message.class))).andReturn(null); - EasyMock.replay(next); - interceptor.setNext(next); - interceptor.invoke(new MessageImpl()); - EasyMock.verify(next); - } - - public void testDoesNotImplement() { - CallbackInterfaceInterceptor interceptor = new CallbackInterfaceInterceptor(false); - try { - interceptor.invoke(new MessageImpl()); - fail(); - } catch (NoRegisteredCallbackException e) { - // expected - } - } - -} diff --git a/sandbox/rfeng/minicore/src/test/java/org/apache/tuscany/core/wire/ContractCompatibilityTestCase.java b/sandbox/rfeng/minicore/src/test/java/org/apache/tuscany/core/wire/ContractCompatibilityTestCase.java deleted file mode 100644 index c955faf7b1..0000000000 --- a/sandbox/rfeng/minicore/src/test/java/org/apache/tuscany/core/wire/ContractCompatibilityTestCase.java +++ /dev/null @@ -1,390 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.tuscany.core.wire; - -import java.lang.reflect.Method; -import java.lang.reflect.Type; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -import org.apache.tuscany.spi.QualifiedName; -import org.apache.tuscany.spi.component.ReferenceBinding; -import org.apache.tuscany.spi.model.DataType; -import org.apache.tuscany.spi.model.Operation; -import static org.apache.tuscany.spi.model.Operation.NO_CONVERSATION; -import org.apache.tuscany.spi.model.ServiceContract; -import org.apache.tuscany.spi.wire.ChainHolder; -import org.apache.tuscany.spi.wire.IncompatibleServiceContractException; -import org.apache.tuscany.spi.wire.ProxyCreationException; -import org.apache.tuscany.spi.wire.Wire; -import org.apache.tuscany.spi.wire.ProxyService; -import org.apache.tuscany.spi.wire.InvocationChain; - -import junit.framework.TestCase; -import org.osoa.sca.CallableReference; - -/** - * TODO some tests commented out due to DataType.equals() needing to be strict - * - * @version $Rev$ $Date$ - */ -public class ContractCompatibilityTestCase extends TestCase { - - private ProxyService proxyService = new MockProxyService(); - - public void testNoOperation() throws Exception { - ServiceContract source = new MockContract<Type>("FooContract"); - ServiceContract target = new MockContract<Type>("FooContract"); - proxyService.checkCompatibility(source, target, false, false); - } - - public void testBasic() throws Exception { - ServiceContract<Type> source = new MockContract<Type>("FooContract"); - Operation<Type> opSource1 = new Operation<Type>("op1", null, null, null, false, null, NO_CONVERSATION); - Map<String, Operation<Type>> sourceOperations = new HashMap<String, Operation<Type>>(); - sourceOperations.put("op1", opSource1); - source.setOperations(sourceOperations); - ServiceContract<Type> target = new MockContract<Type>("FooContract"); - Operation<Type> opSource2 = new Operation<Type>("op1", null, null, null, false, null, NO_CONVERSATION); - Map<String, Operation<Type>> targetOperations = new HashMap<String, Operation<Type>>(); - targetOperations.put("op1", opSource2); - target.setOperations(targetOperations); - proxyService.checkCompatibility(source, target, false, false); - } - - public void testBasicIncompatibleOperationNames() throws Exception { - ServiceContract<Type> source = new MockContract<Type>("FooContract"); - Operation<Type> opSource1 = new Operation<Type>("op1", null, null, null, false, null, NO_CONVERSATION); - Map<String, Operation<Type>> sourceOperations = new HashMap<String, Operation<Type>>(); - sourceOperations.put("op1", opSource1); - source.setOperations(sourceOperations); - ServiceContract<Type> target = new MockContract<Type>("FooContract"); - Operation<Type> opSource2 = new Operation<Type>("op2", null, null, null, false, null, NO_CONVERSATION); - Map<String, Operation<Type>> targetOperations = new HashMap<String, Operation<Type>>(); - targetOperations.put("op2", opSource2); - target.setOperations(targetOperations); - try { - proxyService.checkCompatibility(source, target, false, false); - fail(); - } catch (IncompatibleServiceContractException e) { - //expected - } - } - - public void testInputTypes() throws Exception { - ServiceContract<Type> source = new MockContract<Type>("FooContract"); - List<DataType<Type>> sourceInputTypes = new ArrayList<DataType<Type>>(); - sourceInputTypes.add(new DataType<Type>(Object.class, Object.class)); - DataType<List<DataType<Type>>> inputType = new DataType<List<DataType<Type>>>(String.class, sourceInputTypes); - Operation<Type> opSource1 = new Operation<Type>("op1", inputType, null, null, false, null, NO_CONVERSATION); - Map<String, Operation<Type>> sourceOperations = new HashMap<String, Operation<Type>>(); - sourceOperations.put("op1", opSource1); - source.setOperations(sourceOperations); - - ServiceContract<Type> target = new MockContract<Type>("FooContract"); - List<DataType<Type>> targetInputTypes = new ArrayList<DataType<Type>>(); - targetInputTypes.add(new DataType<Type>(Object.class, Object.class)); - DataType<List<DataType<Type>>> targetInputType = - new DataType<List<DataType<Type>>>(String.class, targetInputTypes); - - Operation<Type> opTarget = - new Operation<Type>("op1", targetInputType, null, null, false, null, NO_CONVERSATION); - Map<String, Operation<Type>> targetOperations = new HashMap<String, Operation<Type>>(); - targetOperations.put("op1", opTarget); - target.setOperations(targetOperations); - proxyService.checkCompatibility(source, target, false, false); - } - - - public void testIncompatibleInputTypes() throws Exception { - ServiceContract<Type> source = new MockContract<Type>("FooContract"); - List<DataType<Type>> sourceInputTypes = new ArrayList<DataType<Type>>(); - sourceInputTypes.add(new DataType<Type>(Integer.class, Integer.class)); - DataType<List<DataType<Type>>> inputType = new DataType<List<DataType<Type>>>(String.class, sourceInputTypes); - Operation<Type> opSource1 = new Operation<Type>("op1", inputType, null, null, false, null, NO_CONVERSATION); - Map<String, Operation<Type>> sourceOperations = new HashMap<String, Operation<Type>>(); - sourceOperations.put("op1", opSource1); - source.setOperations(sourceOperations); - - ServiceContract<Type> target = new MockContract<Type>("FooContract"); - List<DataType<Type>> targetInputTypes = new ArrayList<DataType<Type>>(); - targetInputTypes.add(new DataType<Type>(String.class, String.class)); - DataType<List<DataType<Type>>> targetInputType = - new DataType<List<DataType<Type>>>(String.class, targetInputTypes); - - Operation<Type> opTarget = - new Operation<Type>("op1", targetInputType, null, null, false, null, NO_CONVERSATION); - Map<String, Operation<Type>> targetOperations = new HashMap<String, Operation<Type>>(); - targetOperations.put("op1", opTarget); - target.setOperations(targetOperations); - try { - proxyService.checkCompatibility(source, target, false, false); - fail(); - } catch (IncompatibleServiceContractException e) { - //expected - } - } - - /** - * Verfies source input types can be super types of the target - */ - public void testSourceSuperTypeInputCompatibility() throws Exception { -// ServiceContract<Type> source = new MockContract<Type>("FooContract"); -// List<DataType<Type>> sourceInputTypes = new ArrayList<DataType<Type>>(); -// sourceInputTypes.add(new DataType<Type>(Object.class, Object.class)); -// DataType<List<DataType<Type>>> inputType = new DataType<List<DataType<Type>>>(String.class, sourceInputTypes); -// Operation<Type> opSource1 = new Operation<Type>("op1", inputType, null, null, false, null); -// Map<String, Operation<Type>> sourceOperations = new HashMap<String, Operation<Type>>(); -// sourceOperations.put("op1", opSource1); -// source.setOperations(sourceOperations); -// -// ServiceContract<Type> target = new MockContract<Type>("FooContract"); -// List<DataType<Type>> targetInputTypes = new ArrayList<DataType<Type>>(); -// targetInputTypes.add(new DataType<Type>(String.class, String.class)); -// DataType<List<DataType<Type>>> targetInputType = -// new DataType<List<DataType<Type>>>(String.class, targetInputTypes); -// -// Operation<Type> opTarget = new Operation<Type>("op1", targetInputType, null, null, false, null); -// Map<String, Operation<Type>> targetOperations = new HashMap<String, Operation<Type>>(); -// targetOperations.put("op1", opTarget); -// target.setOperations(targetOperations); -// wireService.checkCompatibility(source, target, false); - } - - public void testOutputTypes() throws Exception { - ServiceContract<Type> source = new MockContract<Type>("FooContract"); - DataType<Type> sourceOutputType = new DataType<Type>(String.class, String.class); - Operation<Type> opSource1 = - new Operation<Type>("op1", null, sourceOutputType, null, false, null, NO_CONVERSATION); - Map<String, Operation<Type>> sourceOperations = new HashMap<String, Operation<Type>>(); - sourceOperations.put("op1", opSource1); - source.setOperations(sourceOperations); - - ServiceContract<Type> target = new MockContract<Type>("FooContract"); - DataType<Type> targetOutputType = new DataType<Type>(String.class, String.class); - Operation<Type> opTarget = - new Operation<Type>("op1", null, targetOutputType, null, false, null, NO_CONVERSATION); - Map<String, Operation<Type>> targetOperations = new HashMap<String, Operation<Type>>(); - targetOperations.put("op1", opTarget); - target.setOperations(targetOperations); - proxyService.checkCompatibility(source, target, false, false); - } - - /** - * Verfies a return type that is a supertype of of the target is compatible - */ - public void testSupertypeOutputTypes() throws Exception { -// ServiceContract<Type> source = new MockContract<Type>("FooContract"); -// DataType<Type> sourceOutputType = new DataType<Type>(Object.class, Object.class); -// Operation<Type> opSource1 = new Operation<Type>("op1", null, sourceOutputType, null, false, null); -// Map<String, Operation<Type>> sourceOperations = new HashMap<String, Operation<Type>>(); -// sourceOperations.put("op1", opSource1); -// source.setOperations(sourceOperations); -// -// ServiceContract<Type> target = new MockContract<Type>("FooContract"); -// DataType<Type> targetOutputType = new DataType<Type>(String.class, String.class); -// Operation<Type> opTarget = new Operation<Type>("op1", null, targetOutputType, null, false, null); -// Map<String, Operation<Type>> targetOperations = new HashMap<String, Operation<Type>>(); -// targetOperations.put("op1", opTarget); -// target.setOperations(targetOperations); -// wireService.checkCompatibility(source, target, false); - } - - public void testIncompatibleOutputTypes() throws Exception { - ServiceContract<Type> source = new MockContract<Type>("FooContract"); - DataType<Type> sourceOutputType = new DataType<Type>(String.class, String.class); - Operation<Type> opSource1 = - new Operation<Type>("op1", null, sourceOutputType, null, false, null, NO_CONVERSATION); - Map<String, Operation<Type>> sourceOperations = new HashMap<String, Operation<Type>>(); - sourceOperations.put("op1", opSource1); - source.setOperations(sourceOperations); - - ServiceContract<Type> target = new MockContract<Type>("FooContract"); - DataType<Type> targetOutputType = new DataType<Type>(Integer.class, Integer.class); - Operation<Type> opTarget = - new Operation<Type>("op1", null, targetOutputType, null, false, null, NO_CONVERSATION); - Map<String, Operation<Type>> targetOperations = new HashMap<String, Operation<Type>>(); - targetOperations.put("op1", opTarget); - target.setOperations(targetOperations); - try { - proxyService.checkCompatibility(source, target, false, false); - fail(); - } catch (IncompatibleServiceContractException e) { - //expected - } - } - - public void testFaultTypes() throws Exception { - ServiceContract<Type> source = new MockContract<Type>("FooContract"); - DataType<Type> sourceFaultType = new DataType<Type>(String.class, String.class); - List<DataType<Type>> sourceFaultTypes = new ArrayList<DataType<Type>>(); - sourceFaultTypes.add(0, sourceFaultType); - Operation<Type> opSource1 = - new Operation<Type>("op1", null, null, sourceFaultTypes, false, null, NO_CONVERSATION); - Map<String, Operation<Type>> sourceOperations = new HashMap<String, Operation<Type>>(); - sourceOperations.put("op1", opSource1); - source.setOperations(sourceOperations); - - ServiceContract<Type> target = new MockContract<Type>("FooContract"); - DataType<Type> targetFaultType = new DataType<Type>(String.class, String.class); - List<DataType<Type>> targetFaultTypes = new ArrayList<DataType<Type>>(); - targetFaultTypes.add(0, targetFaultType); - - Operation<Type> opTarget = - new Operation<Type>("op1", null, null, targetFaultTypes, false, null, NO_CONVERSATION); - Map<String, Operation<Type>> targetOperations = new HashMap<String, Operation<Type>>(); - targetOperations.put("op1", opTarget); - target.setOperations(targetOperations); - proxyService.checkCompatibility(source, target, false, false); - } - - public void testSourceFaultTargetNoFaultCompatibility() throws Exception { - ServiceContract<Type> source = new MockContract<Type>("FooContract"); - DataType<Type> sourceFaultType = new DataType<Type>(String.class, String.class); - List<DataType<Type>> sourceFaultTypes = new ArrayList<DataType<Type>>(); - sourceFaultTypes.add(0, sourceFaultType); - Operation<Type> opSource1 = - new Operation<Type>("op1", null, null, sourceFaultTypes, false, null, NO_CONVERSATION); - Map<String, Operation<Type>> sourceOperations = new HashMap<String, Operation<Type>>(); - sourceOperations.put("op1", opSource1); - source.setOperations(sourceOperations); - - ServiceContract<Type> target = new MockContract<Type>("FooContract"); - Operation<Type> opTarget = new Operation<Type>("op1", null, null, null, false, null, NO_CONVERSATION); - Map<String, Operation<Type>> targetOperations = new HashMap<String, Operation<Type>>(); - targetOperations.put("op1", opTarget); - target.setOperations(targetOperations); - proxyService.checkCompatibility(source, target, false, false); - } - - /** - * Verifies a source's fault which is a supertype of the target's fault are compatibile - * - * @throws Exception - */ - public void testFaultSuperTypes() throws Exception { -// ServiceContract<Type> source = new MockContract<Type>("FooContract"); -// DataType<Type> sourceFaultType = new DataType<Type>(Exception.class, Exception.class); -// List<DataType<Type>> sourceFaultTypes = new ArrayList<DataType<Type>>(); -// sourceFaultTypes.add(0, sourceFaultType); -// Operation<Type> opSource1 = new Operation<Type>("op1", null, null, sourceFaultTypes, false, null); -// Map<String, Operation<Type>> sourceOperations = new HashMap<String, Operation<Type>>(); -// sourceOperations.put("op1", opSource1); -// source.setOperations(sourceOperations); -// -// ServiceContract<Type> target = new MockContract<Type>("FooContract"); -// DataType<Type> targetFaultType = new DataType<Type>(TuscanyException.class, TuscanyException.class); -// List<DataType<Type>> targetFaultTypes = new ArrayList<DataType<Type>>(); -// targetFaultTypes.add(0, targetFaultType); -// -// Operation<Type> opTarget = new Operation<Type>("op1", null, null, targetFaultTypes, false, null); -// Map<String, Operation<Type>> targetOperations = new HashMap<String, Operation<Type>>(); -// targetOperations.put("op1", opTarget); -// target.setOperations(targetOperations); -// wireService.checkCompatibility(source, target, false); - } - - /** - * Verifies a source's faults which are supertypes and a superset of the target's faults are compatibile - */ - public void testFaultSuperTypesAndSuperset() throws Exception { -// ServiceContract<Type> source = new MockContract<Type>("FooContract"); -// DataType<Type> sourceFaultType = new DataType<Type>(Exception.class, Exception.class); -// DataType<Type> sourceFaultType2 = new DataType<Type>(RuntimeException.class, RuntimeException.class); -// List<DataType<Type>> sourceFaultTypes = new ArrayList<DataType<Type>>(); -// sourceFaultTypes.add(0, sourceFaultType); -// sourceFaultTypes.add(1, sourceFaultType2); -// Operation<Type> opSource1 = new Operation<Type>("op1", null, null, sourceFaultTypes, false, null); -// Map<String, Operation<Type>> sourceOperations = new HashMap<String, Operation<Type>>(); -// sourceOperations.put("op1", opSource1); -// source.setOperations(sourceOperations); -// -// ServiceContract<Type> target = new MockContract<Type>("FooContract"); -// DataType<Type> targetFaultType = new DataType<Type>(TuscanyException.class, TuscanyException.class); -// List<DataType<Type>> targetFaultTypes = new ArrayList<DataType<Type>>(); -// targetFaultTypes.add(0, targetFaultType); -// -// Operation<Type> opTarget = new Operation<Type>("op1", null, null, targetFaultTypes, false, null); -// Map<String, Operation<Type>> targetOperations = new HashMap<String, Operation<Type>>(); -// targetOperations.put("op1", opTarget); -// target.setOperations(targetOperations); -// wireService.checkCompatibility(source, target, false); - } - - private class MockContract<T> extends ServiceContract<T> { - public MockContract() { - } - - public MockContract(Class interfaceClass) { - super(interfaceClass); - } - - public MockContract(String interfaceName) { - super(interfaceName); - } - } - - private class MockProxyService extends ProxyServiceExtension { - public MockProxyService() { - super(null); - } - - public <T> T createProxy(Class<T> interfaze, Wire wire) throws ProxyCreationException { - throw new UnsupportedOperationException(); - } - - public <T> T createProxy2(Class<T> interfaze, boolean conversational, Wire wire) throws ProxyCreationException { - throw new UnsupportedOperationException(); - } - - public <T> T createProxy2(Class<T> interfaze, Wire wire) throws ProxyCreationException { - throw new UnsupportedOperationException(); - } - - public <T> T createProxy(Class<T> interfaze, Wire wire, Map<Method, ChainHolder> mapping) - throws ProxyCreationException { - throw new UnsupportedOperationException(); - } - - public <T> T createProxy2(Class<T> interfaze, Wire wire, Map<Method, InvocationChain> mapping) - throws ProxyCreationException { - throw new UnsupportedOperationException(); - } - - public Object createCallbackProxy(Class<?> interfaze, List<Wire> wires) throws ProxyCreationException { - throw new UnsupportedOperationException(); - } - - public Object createCallbackProxy(Class<?> interfaze) throws ProxyCreationException { - throw new UnsupportedOperationException(); - } - - public void createWires(ReferenceBinding referenceBinding, ServiceContract<?> contract, - QualifiedName targetName) { - throw new UnsupportedOperationException(); - } - - public <B, R extends CallableReference<B>> R cast(B target) throws IllegalArgumentException { - throw new UnsupportedOperationException(); - } - } - -} diff --git a/sandbox/rfeng/minicore/src/test/java/org/apache/tuscany/core/wire/IncompatibleServiceContractExceptionFormatterTestCase.java b/sandbox/rfeng/minicore/src/test/java/org/apache/tuscany/core/wire/IncompatibleServiceContractExceptionFormatterTestCase.java deleted file mode 100644 index a9f455bc62..0000000000 --- a/sandbox/rfeng/minicore/src/test/java/org/apache/tuscany/core/wire/IncompatibleServiceContractExceptionFormatterTestCase.java +++ /dev/null @@ -1,82 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.tuscany.core.wire; - -import java.io.PrintWriter; -import java.io.StringWriter; - -import org.apache.tuscany.spi.model.Operation; -import org.apache.tuscany.spi.model.ServiceContract; -import org.apache.tuscany.spi.wire.IncompatibleServiceContractException; - -import junit.framework.TestCase; -import org.apache.tuscany.host.monitor.FormatterRegistry; -import org.easymock.EasyMock; - -/** - * @version $Rev$ $Date$ - */ -public class IncompatibleServiceContractExceptionFormatterTestCase extends TestCase { - FormatterRegistry registry = EasyMock.createNiceMock(FormatterRegistry.class); - IncompatibleServiceContractExceptionFormatter formatter = - new IncompatibleServiceContractExceptionFormatter(registry); - - public void testFormat() throws Exception { - ServiceContract<Object> source = new ServiceContract<Object>() { - }; - source.setInterfaceName("sourceInterface"); - ServiceContract<Object> target = new ServiceContract<Object>() { - }; - target.setInterfaceName("targetInterface"); - Operation<Object> sourceOp = new Operation<Object>("sourceOp", null, null, null); - Operation<Object> targetOp = new Operation<Object>("targetOp", null, null, null); - - IncompatibleServiceContractException e = - new IncompatibleServiceContractException("message", source, target, sourceOp, targetOp); - StringWriter writer = new StringWriter(); - PrintWriter pw = new PrintWriter(writer); - formatter.write(pw, e); - String buffer = writer.toString(); - assertTrue(buffer.indexOf("message") >= 0); - assertTrue(buffer.indexOf("sourceInterface") >= 0); - assertTrue(buffer.indexOf("targetInterface") >= 0); - assertTrue(buffer.indexOf("sourceOp") >= 0); - assertTrue(buffer.indexOf("targetOp") >= 0); - } - - - public void testFormatNulls() throws Exception { - ServiceContract<Object> source = new ServiceContract<Object>() { - }; - source.setInterfaceName("sourceInterface"); - ServiceContract<Object> target = new ServiceContract<Object>() { - }; - target.setInterfaceName("targetInterface"); - - IncompatibleServiceContractException e = - new IncompatibleServiceContractException("message", source, target); - StringWriter writer = new StringWriter(); - PrintWriter pw = new PrintWriter(writer); - formatter.write(pw, e); - String buffer = writer.toString(); - assertTrue(buffer.indexOf("message") >= 0); - assertTrue(buffer.indexOf("sourceInterface") >= 0); - assertTrue(buffer.indexOf("targetInterface") >= 0); - } -} diff --git a/sandbox/rfeng/minicore/src/test/java/org/apache/tuscany/core/wire/InvocationChainImplTestCase.java b/sandbox/rfeng/minicore/src/test/java/org/apache/tuscany/core/wire/InvocationChainImplTestCase.java deleted file mode 100644 index 9875058abb..0000000000 --- a/sandbox/rfeng/minicore/src/test/java/org/apache/tuscany/core/wire/InvocationChainImplTestCase.java +++ /dev/null @@ -1,84 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.tuscany.core.wire; - -import java.lang.reflect.Type; - -import org.apache.tuscany.spi.model.Operation; -import org.apache.tuscany.spi.wire.Interceptor; -import org.apache.tuscany.spi.wire.Message; -import org.apache.tuscany.spi.wire.InvocationChain; - -import junit.framework.TestCase; - -/** - * @version $Rev$ $Date$ - */ -public class InvocationChainImplTestCase extends TestCase { - - public void testInsertAtPos() throws Exception { - InvocationChain chain = new InvocationChainImpl(new Operation<Type>("foo", null, null, null)); - Interceptor inter3 = new MockInterceptor(); - Interceptor inter2 = new MockInterceptor(); - Interceptor inter1 = new MockInterceptor(); - chain.addInterceptor(inter3); - chain.addInterceptor(0, inter1); - chain.addInterceptor(1, inter2); - Interceptor head = chain.getHeadInterceptor(); - assertEquals(inter1, head); - assertEquals(inter2, head.getNext()); - assertEquals(inter3, head.getNext().getNext()); - } - - public void testInsertAtEnd() throws Exception { - InvocationChain chain = new InvocationChainImpl(new Operation<Type>("foo", null, null, null)); - Interceptor inter2 = new MockInterceptor(); - Interceptor inter1 = new MockInterceptor(); - chain.addInterceptor(0, inter1); - chain.addInterceptor(1, inter2); - Interceptor head = chain.getHeadInterceptor(); - assertEquals(inter1, head); - assertEquals(inter2, head.getNext()); - assertEquals(inter2, chain.getTailInterceptor()); - - } - - private class MockInterceptor implements Interceptor { - - private Interceptor next; - - public Message invoke(Message msg) { - return null; - } - - public void setNext(Interceptor next) { - this.next = next; - } - - public Interceptor getNext() { - return next; - } - - public boolean isOptimizable() { - return false; - } - } - - -} diff --git a/sandbox/rfeng/minicore/src/test/java/org/apache/tuscany/core/wire/NonBlockingInterceptorBuilderTestCase.java b/sandbox/rfeng/minicore/src/test/java/org/apache/tuscany/core/wire/NonBlockingInterceptorBuilderTestCase.java deleted file mode 100644 index c563217306..0000000000 --- a/sandbox/rfeng/minicore/src/test/java/org/apache/tuscany/core/wire/NonBlockingInterceptorBuilderTestCase.java +++ /dev/null @@ -1,38 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.tuscany.core.wire; - -import static org.apache.tuscany.core.wire.NonBlockingInterceptorBuilder.QNAME; - -import org.apache.tuscany.spi.model.physical.PhysicalInterceptorDefinition; - -import junit.framework.TestCase; - -/** - * @version $Rev$ $Date$ - */ -public class NonBlockingInterceptorBuilderTestCase extends TestCase { - - public void testBuild() throws Exception { - NonBlockingInterceptorBuilder builder = new NonBlockingInterceptorBuilder(null, null); - PhysicalInterceptorDefinition definition = new PhysicalInterceptorDefinition(QNAME); - definition.setBuilder(QNAME); - assertTrue(builder.build(definition) instanceof NonBlockingInterceptor); - } -} diff --git a/sandbox/rfeng/minicore/src/test/java/org/apache/tuscany/core/wire/NonBlockingInterceptorTestCase.java b/sandbox/rfeng/minicore/src/test/java/org/apache/tuscany/core/wire/NonBlockingInterceptorTestCase.java deleted file mode 100644 index c08d1453db..0000000000 --- a/sandbox/rfeng/minicore/src/test/java/org/apache/tuscany/core/wire/NonBlockingInterceptorTestCase.java +++ /dev/null @@ -1,75 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.tuscany.core.wire; - -import org.apache.tuscany.spi.component.WorkContext; -import org.apache.tuscany.spi.model.Scope; -import org.apache.tuscany.spi.services.work.WorkScheduler; -import org.apache.tuscany.spi.wire.Interceptor; -import org.apache.tuscany.spi.wire.Message; -import org.apache.tuscany.spi.wire.MessageImpl; - -import junit.framework.TestCase; -import org.easymock.EasyMock; -import static org.easymock.EasyMock.createMock; -import static org.easymock.EasyMock.expectLastCall; -import static org.easymock.EasyMock.getCurrentArguments; -import static org.easymock.EasyMock.isA; -import static org.easymock.EasyMock.replay; -import static org.easymock.EasyMock.verify; -import org.easymock.IAnswer; - -/** - * @version $Rev$ $Date$ - */ -public class NonBlockingInterceptorTestCase extends TestCase { - - public void testInvoke() throws Exception { - WorkScheduler scheduler = createMock(WorkScheduler.class); - scheduler.scheduleWork(isA(Runnable.class)); - expectLastCall().andStubAnswer(new IAnswer<Object>() { - public Object answer() throws Throwable { - Runnable runnable = (Runnable) getCurrentArguments()[0]; - runnable.run(); - return null; - } - }); - replay(scheduler); - WorkContext context = createMock(WorkContext.class); - String convID = "convID"; - EasyMock.expect(context.getIdentifier(Scope.CONVERSATION)).andReturn(convID); - context.setCorrelationId(null); - context.setIdentifier(Scope.CONVERSATION, convID); - EasyMock.replay(context); - Message msg = new MessageImpl(); - Interceptor next = EasyMock.createMock(Interceptor.class); - EasyMock.expect(next.invoke(EasyMock.eq(msg))).andReturn(msg); - EasyMock.replay(next); - Interceptor interceptor = new NonBlockingInterceptor(scheduler, context, next); - interceptor.invoke(msg); - verify(context); - verify(next); - } - - public void testOptimizable() { - NonBlockingInterceptor interceptor = new NonBlockingInterceptor(null, null); - assertFalse(interceptor.isOptimizable()); - } - -} diff --git a/sandbox/rfeng/minicore/src/test/java/org/apache/tuscany/core/wire/OptimizedWireObjectFactoryTestCase.java b/sandbox/rfeng/minicore/src/test/java/org/apache/tuscany/core/wire/OptimizedWireObjectFactoryTestCase.java deleted file mode 100644 index 5293678d12..0000000000 --- a/sandbox/rfeng/minicore/src/test/java/org/apache/tuscany/core/wire/OptimizedWireObjectFactoryTestCase.java +++ /dev/null @@ -1,44 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.tuscany.core.wire; - -import org.apache.tuscany.spi.wire.Wire; - -import junit.framework.TestCase; -import org.easymock.EasyMock; - -/** - * @version $Rev$ $Date$ - */ -public class OptimizedWireObjectFactoryTestCase extends TestCase { - - public void testGetInstance() throws Exception { - Foo foo = new Foo(); - Wire wire = EasyMock.createMock(Wire.class); - EasyMock.expect(wire.getTargetInstance()).andReturn(foo); - EasyMock.replay(wire); - OptimizedWireObjectFactory<Foo> factory = new OptimizedWireObjectFactory<Foo>(Foo.class, wire); - assertEquals(foo, factory.getInstance()); - EasyMock.verify(wire); - } - - private class Foo { - - } -} diff --git a/sandbox/rfeng/minicore/src/test/java/org/apache/tuscany/core/wire/WireImplTestCase.java b/sandbox/rfeng/minicore/src/test/java/org/apache/tuscany/core/wire/WireImplTestCase.java deleted file mode 100644 index e337133523..0000000000 --- a/sandbox/rfeng/minicore/src/test/java/org/apache/tuscany/core/wire/WireImplTestCase.java +++ /dev/null @@ -1,50 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.tuscany.core.wire; - -import org.apache.tuscany.spi.component.AtomicComponent; -import org.apache.tuscany.spi.wire.Wire; - -import junit.framework.TestCase; -import org.easymock.EasyMock; - -/** - * @version $Rev$ $Date$ - */ -public class WireImplTestCase extends TestCase { - - /** - * Tests that the target wire returns null if there is no connected wire. This behavior is needed for optional - * autowires. - */ - public void testGetNonExistentTarget() throws Exception { - Wire wire = new WireImpl(); - assertNull(wire.getTargetInstance()); - } - - public void testTargetInstance() throws Exception { - Wire wire = new WireImpl(); - AtomicComponent component = EasyMock.createMock(AtomicComponent.class); - EasyMock.expect(component.getTargetInstance()).andReturn(new Object()); - EasyMock.replay(component); - wire.setTarget(component); - assertNotNull(wire.getTargetInstance()); - } - -} diff --git a/sandbox/rfeng/minicore/src/test/java/org/apache/tuscany/core/wire/WireObjectFactoryTestCase.java b/sandbox/rfeng/minicore/src/test/java/org/apache/tuscany/core/wire/WireObjectFactoryTestCase.java deleted file mode 100644 index 9f21b9efdb..0000000000 --- a/sandbox/rfeng/minicore/src/test/java/org/apache/tuscany/core/wire/WireObjectFactoryTestCase.java +++ /dev/null @@ -1,138 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.tuscany.core.wire; - -import java.lang.reflect.Type; -import java.util.Collections; -import java.util.HashMap; -import java.util.Map; - -import org.apache.tuscany.spi.idl.java.JavaServiceContract; -import org.apache.tuscany.spi.model.Operation; -import org.apache.tuscany.spi.model.ServiceContract; -import org.apache.tuscany.spi.wire.ProxyService; -import org.apache.tuscany.spi.wire.InvocationChain; -import org.apache.tuscany.spi.wire.Wire; - -import junit.framework.TestCase; -import org.easymock.EasyMock; - -/** - * @version $Rev$ $Date$ - */ -public class WireObjectFactoryTestCase extends TestCase { - - @SuppressWarnings({"unchecked"}) - public void testCreateInstance() throws Exception { - Operation<Type> op = new Operation<Type>("hello", null, null, null); - InvocationChain chain = new InvocationChainImpl(op); - Wire wire = EasyMock.createMock(Wire.class); - Map<Operation<?>, InvocationChain> chains = new HashMap<Operation<?>, InvocationChain>(); - chains.put(op, chain); - EasyMock.expect(wire.getInvocationChains()).andReturn(chains); - EasyMock.expect(wire.isOptimizable()).andReturn(false); - EasyMock.replay(wire); - ProxyService service = EasyMock.createMock(ProxyService.class); - service.createProxy(EasyMock.eq(Foo.class), EasyMock.eq(wire), EasyMock.isA(Map.class)); - EasyMock.expectLastCall().andReturn(new Foo() { - public void hello() { - - } - }); - EasyMock.replay(service); - - WireObjectFactory<Foo> factory = new WireObjectFactory<Foo>(Foo.class, wire, service); - factory.getInstance(); - EasyMock.verify(service); - EasyMock.verify(wire); - } - - @SuppressWarnings("unchecked") - public void testOptimizedCreateInstance() throws Exception { - ServiceContract<?> contract = new JavaServiceContract(Foo.class); - Wire wire = EasyMock.createMock(Wire.class); - EasyMock.expect(wire.isOptimizable()).andReturn(true); - EasyMock.expect(wire.getSourceContract()).andReturn(contract).atLeastOnce(); - EasyMock.expect(wire.getInvocationChains()).andReturn((Map) Collections.emptyMap()); - EasyMock.expect(wire.getTargetInstance()).andReturn(new Foo() { - public void hello() { - } - }); - EasyMock.replay(wire); - WireObjectFactory<Foo> factory = new WireObjectFactory<Foo>(Foo.class, wire, null); - factory.getInstance(); - EasyMock.verify(wire); - - } - - /** - * Verifies that a proxy is created when the required client contract is different than the wire contract - */ - @SuppressWarnings("unchecked") - public void testCannotOptimizeDifferentContractsCreateInstance() throws Exception { - ServiceContract<?> contract = new JavaServiceContract(Object.class); - Wire wire = EasyMock.createMock(Wire.class); - EasyMock.expect(wire.isOptimizable()).andReturn(true); - EasyMock.expect(wire.getSourceContract()).andReturn(contract).atLeastOnce(); - EasyMock.expect(wire.getInvocationChains()).andReturn((Map) Collections.emptyMap()); - EasyMock.replay(wire); - ProxyService service = EasyMock.createMock(ProxyService.class); - service.createProxy(EasyMock.eq(Foo.class), EasyMock.eq(wire), EasyMock.isA(Map.class)); - EasyMock.expectLastCall().andReturn(new Foo() { - public void hello() { - - } - }); - EasyMock.replay(service); - - WireObjectFactory<Foo> factory = new WireObjectFactory<Foo>(Foo.class, wire, service); - factory.getInstance(); - EasyMock.verify(service); - EasyMock.verify(wire); - } - - @SuppressWarnings("unchecked") - public void testNoJavaInterfaceCreateInstance() throws Exception { - ServiceContract<?> contract = new JavaServiceContract(); - Wire wire = EasyMock.createMock(Wire.class); - EasyMock.expect(wire.isOptimizable()).andReturn(true); - EasyMock.expect(wire.getSourceContract()).andReturn(contract).atLeastOnce(); - EasyMock.expect(wire.getInvocationChains()).andReturn((Map) Collections.emptyMap()); - EasyMock.replay(wire); - ProxyService service = EasyMock.createMock(ProxyService.class); - service.createProxy(EasyMock.eq(Foo.class), EasyMock.eq(wire), EasyMock.isA(Map.class)); - EasyMock.expectLastCall().andReturn(new Foo() { - public void hello() { - - } - }); - EasyMock.replay(service); - - WireObjectFactory<Foo> factory = new WireObjectFactory<Foo>(Foo.class, wire, service); - factory.getInstance(); - EasyMock.verify(service); - EasyMock.verify(wire); - } - - private interface Foo { - void hello(); - } - - -} diff --git a/sandbox/rfeng/minicore/src/test/java/org/apache/tuscany/core/wire/WireOptimizationTestCase.java b/sandbox/rfeng/minicore/src/test/java/org/apache/tuscany/core/wire/WireOptimizationTestCase.java deleted file mode 100644 index 1db3892471..0000000000 --- a/sandbox/rfeng/minicore/src/test/java/org/apache/tuscany/core/wire/WireOptimizationTestCase.java +++ /dev/null @@ -1,113 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.tuscany.core.wire; - -import java.lang.reflect.Type; - -import org.apache.tuscany.spi.component.AtomicComponent; -import org.apache.tuscany.spi.model.Operation; -import static org.apache.tuscany.spi.model.Operation.NO_CONVERSATION; -import org.apache.tuscany.spi.wire.Interceptor; -import org.apache.tuscany.spi.wire.InvocationChain; -import org.apache.tuscany.spi.wire.Message; -import org.apache.tuscany.spi.wire.Wire; - -import junit.framework.TestCase; -import org.easymock.EasyMock; - -/** - * Verifies wire optimization analysis - * - * @version $$Rev$$ $$Date$$ - */ -public class WireOptimizationTestCase extends TestCase { - private Operation operation; - - public void foo() { - } - - public void testWireInterceptorOptimization() throws Exception { - AtomicComponent component = EasyMock.createNiceMock(AtomicComponent.class); - EasyMock.replay(component); - Wire wire = new WireImpl(); - InvocationChain chain = new InvocationChainImpl(operation); - chain.addInterceptor(new OptimizableInterceptor()); - wire.addInvocationChain(operation, chain); - assertTrue(WireUtils.isOptimizable(wire)); - } - - public void testWireNonInterceptorOptimization() throws Exception { - AtomicComponent component = EasyMock.createNiceMock(AtomicComponent.class); - EasyMock.replay(component); - Wire wire = new WireImpl(); - InvocationChain chain = new InvocationChainImpl(operation); - chain.addInterceptor(new NonOptimizableInterceptor()); - wire.addInvocationChain(operation, chain); - assertFalse(WireUtils.isOptimizable(wire)); - } - - protected void tearDown() throws Exception { - super.tearDown(); - } - - protected void setUp() throws Exception { - super.setUp(); - operation = new Operation<Type>("foo", null, null, null, false, null, NO_CONVERSATION); - - } - - private class OptimizableInterceptor implements Interceptor { - - public Message invoke(Message msg) { - return null; - } - - public void setNext(Interceptor next) { - - } - - public Interceptor getNext() { - return null; - } - - public boolean isOptimizable() { - return true; - } - } - - private class NonOptimizableInterceptor implements Interceptor { - - public Message invoke(Message msg) { - return null; - } - - public void setNext(Interceptor next) { - - } - - public Interceptor getNext() { - return null; - } - - public boolean isOptimizable() { - return false; - } - } - -} diff --git a/sandbox/rfeng/minicore/src/test/java/org/apache/tuscany/core/wire/WireUtilsTestCase.java b/sandbox/rfeng/minicore/src/test/java/org/apache/tuscany/core/wire/WireUtilsTestCase.java deleted file mode 100644 index a9da65e0ba..0000000000 --- a/sandbox/rfeng/minicore/src/test/java/org/apache/tuscany/core/wire/WireUtilsTestCase.java +++ /dev/null @@ -1,69 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.tuscany.core.wire; - -import java.lang.reflect.Method; -import java.lang.reflect.Type; -import java.util.Map; - -import org.apache.tuscany.spi.model.Operation; -import org.apache.tuscany.spi.wire.ChainHolder; -import org.apache.tuscany.spi.wire.InvocationChain; -import org.apache.tuscany.spi.wire.Wire; - -import junit.framework.TestCase; - -/** - * @version $Rev$ $Date$ - */ -public class WireUtilsTestCase extends TestCase { - private Method m; - - public void testCreateInterfaceToWireMapping() throws Exception { - Wire wire = new WireImpl(); - Operation<Type> op = new Operation<Type>("hello", null, null, null); - InvocationChain chain = new InvocationChainImpl(op); - wire.addInvocationChain(op, chain); - Map<Method, ChainHolder> chains = WireUtils.createInterfaceToWireMapping(Foo.class, wire); - assertEquals(1, chains.size()); - assertNotNull(chains.get(m)); - } - - public void testCreateInterfaceToWireMappingNoOperation() throws Exception { - Wire wire = new WireImpl(); - Operation<Type> op = new Operation<Type>("goodbye", null, null, null); - InvocationChain chain = new InvocationChainImpl(op); - wire.addInvocationChain(op, chain); - try { - WireUtils.createInterfaceToWireMapping(Foo.class, wire); - fail(); - } catch (NoMethodForOperationException e) { - // expected - } - } - - protected void setUp() throws Exception { - super.setUp(); - m = Foo.class.getMethod("hello"); - } - - private interface Foo { - void hello(); - } -} |