diff options
author | lresende <lresende@13f79535-47bb-0310-9956-ffa450edef68> | 2010-10-18 02:24:55 +0000 |
---|---|---|
committer | lresende <lresende@13f79535-47bb-0310-9956-ffa450edef68> | 2010-10-18 02:24:55 +0000 |
commit | 4f9328953ea16c7a42eb1910f1e809bf1c537d3b (patch) | |
tree | 2f989a5045456d2057540563a483465a1d490dc0 /sca-java-2.x/tags/2.0-M5.1/modules/binding-corba-runtime/src/test/java/org/apache/tuscany/sca/binding/corba/testing/service/mocks/TestRuntimeWire.java | |
parent | 41c3e83fe3990eff86b40f775c5d02c5177ae005 (diff) |
Copy 2.0-M5.1-RC2 tag as 2.0-M5.1 official release tag
git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@1023626 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to '')
-rw-r--r-- | sca-java-2.x/tags/2.0-M5.1/modules/binding-corba-runtime/src/test/java/org/apache/tuscany/sca/binding/corba/testing/service/mocks/TestRuntimeWire.java | 292 |
1 files changed, 292 insertions, 0 deletions
diff --git a/sca-java-2.x/tags/2.0-M5.1/modules/binding-corba-runtime/src/test/java/org/apache/tuscany/sca/binding/corba/testing/service/mocks/TestRuntimeWire.java b/sca-java-2.x/tags/2.0-M5.1/modules/binding-corba-runtime/src/test/java/org/apache/tuscany/sca/binding/corba/testing/service/mocks/TestRuntimeWire.java new file mode 100644 index 0000000000..e68f4dee72 --- /dev/null +++ b/sca-java-2.x/tags/2.0-M5.1/modules/binding-corba-runtime/src/test/java/org/apache/tuscany/sca/binding/corba/testing/service/mocks/TestRuntimeWire.java @@ -0,0 +1,292 @@ +/* + * 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.sca.binding.corba.testing.service.mocks; + +import java.lang.reflect.InvocationTargetException; +import java.lang.reflect.Method; +import java.util.List; + +import org.apache.tuscany.sca.assembly.Binding; +import org.apache.tuscany.sca.assembly.Component; +import org.apache.tuscany.sca.assembly.ComponentService; +import org.apache.tuscany.sca.assembly.Contract; +import org.apache.tuscany.sca.assembly.EndpointReference; +import org.apache.tuscany.sca.context.CompositeContext; +import org.apache.tuscany.sca.core.ExtensionPointRegistry; +import org.apache.tuscany.sca.interfacedef.InterfaceContract; +import org.apache.tuscany.sca.interfacedef.Operation; +import org.apache.tuscany.sca.invocation.InvocationChain; +import org.apache.tuscany.sca.invocation.Message; +import org.apache.tuscany.sca.policy.ExtensionType; +import org.apache.tuscany.sca.policy.Intent; +import org.apache.tuscany.sca.policy.PolicySet; +import org.apache.tuscany.sca.provider.PolicyProvider; +import org.apache.tuscany.sca.provider.ServiceBindingProvider; +import org.apache.tuscany.sca.runtime.EndpointRegistry; +import org.apache.tuscany.sca.runtime.RuntimeEndpoint; + +/** + * Mock RuntimeWire implementation. Only few methods needs to be implemented. + */ +public class TestRuntimeWire implements RuntimeEndpoint { + private Object invocationTarget; + private InterfaceContract interfaceContract; + + public TestRuntimeWire(InterfaceContract interfaceContract, Object invocationTarget) { + this.interfaceContract = interfaceContract; + this.invocationTarget = invocationTarget; + } + + + public Object invoke(Operation operation, Object[] args) throws InvocationTargetException { + Class<?>[] types = new Class<?>[args.length]; + for (int i = 0; i < args.length; i++) { + types[i] = args[i].getClass(); + } + Object result = null; + try { + Method[] methods = invocationTarget.getClass().getMethods(); + for (int i = 0; i < methods.length; i++) { + if (methods[i].getName().equals(operation.getName())) { + result = methods[i].invoke(invocationTarget, args); + break; + } + } + } catch (InvocationTargetException e) { + throw e; + } catch (IllegalAccessException e) { + e.printStackTrace(); + } + + return result; + } + + + @Override + public Object clone() throws CloneNotSupportedException { + // TODO Auto-generated method stub + return super.clone(); + } + + + public InterfaceContract getBindingInterfaceContract() { + // TODO Auto-generated method stub + return interfaceContract; + } + + + public ServiceBindingProvider getBindingProvider() { + // TODO Auto-generated method stub + return null; + } + + + public InterfaceContract getComponentTypeServiceInterfaceContract() { + // TODO Auto-generated method stub + return interfaceContract; + } + + + public void setBindingProvider(ServiceBindingProvider provider) { + // TODO Auto-generated method stub + + } + + + public boolean isUnresolved() { + // TODO Auto-generated method stub + return false; + } + + + public void setUnresolved(boolean unresolved) { + // TODO Auto-generated method stub + + } + + + public ExtensionType getExtensionType() { + // TODO Auto-generated method stub + return null; + } + + + public List<PolicySet> getPolicySets() { + // TODO Auto-generated method stub + return null; + } + + + public List<Intent> getRequiredIntents() { + // TODO Auto-generated method stub + return null; + } + + + public void setExtensionType(ExtensionType type) { + // TODO Auto-generated method stub + + } + + + public void bind(CompositeContext context) { + // TODO Auto-generated method stub + + } + + + public void bind(ExtensionPointRegistry registry, EndpointRegistry endpointRegistry) { + // TODO Auto-generated method stub + + } + + + public InvocationChain getBindingInvocationChain() { + // TODO Auto-generated method stub + return null; + } + + + public CompositeContext getCompositeContext() { + // TODO Auto-generated method stub + return null; + } + + + public Contract getContract() { + // TODO Auto-generated method stub + return null; + } + + + public InvocationChain getInvocationChain(Operation operation) { + // TODO Auto-generated method stub + return null; + } + + + public List<InvocationChain> getInvocationChains() { + // TODO Auto-generated method stub + return null; + } + + + public List<PolicyProvider> getPolicyProviders() { + // TODO Auto-generated method stub + return null; + } + + + public Message invoke(Message msg) { + // TODO Auto-generated method stub + return null; + } + + + public Message invoke(Operation operation, Message msg) { + // TODO Auto-generated method stub + return null; + } + + + public void unbind() { + // TODO Auto-generated method stub + + } + + + public Binding getBinding() { + // TODO Auto-generated method stub + return null; + } + + + public List<EndpointReference> getCallbackEndpointReferences() { + // TODO Auto-generated method stub + return null; + } + + + public Component getComponent() { + // TODO Auto-generated method stub + return null; + } + + + public InterfaceContract getComponentServiceInterfaceContract() { + // TODO Auto-generated method stub + return interfaceContract; + } + + + public ComponentService getService() { + // TODO Auto-generated method stub + return null; + } + + + public String getURI() { + // TODO Auto-generated method stub + return null; + } + + + public boolean isRemote() { + // TODO Auto-generated method stub + return false; + } + + + public boolean matches(String serviceURI) { + // TODO Auto-generated method stub + return false; + } + + + public void setBinding(Binding binding) { + // TODO Auto-generated method stub + + } + + + public void setComponent(Component component) { + // TODO Auto-generated method stub + + } + + + public void setRemote(boolean remote) { + // TODO Auto-generated method stub + + } + + + public void setService(ComponentService service) { + // TODO Auto-generated method stub + + } + + + public void setURI(String uri) { + // TODO Auto-generated method stub + + } + +} |