summaryrefslogtreecommitdiffstats
path: root/sca-java-2.x/tags/2.0.1-RC1/modules/binding-corba-runtime/src/test/java/org/apache/tuscany/sca/binding/corba/testing/service/mocks/TestRuntimeWire.java
diff options
context:
space:
mode:
Diffstat (limited to 'sca-java-2.x/tags/2.0.1-RC1/modules/binding-corba-runtime/src/test/java/org/apache/tuscany/sca/binding/corba/testing/service/mocks/TestRuntimeWire.java')
-rw-r--r--sca-java-2.x/tags/2.0.1-RC1/modules/binding-corba-runtime/src/test/java/org/apache/tuscany/sca/binding/corba/testing/service/mocks/TestRuntimeWire.java380
1 files changed, 380 insertions, 0 deletions
diff --git a/sca-java-2.x/tags/2.0.1-RC1/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.1-RC1/modules/binding-corba-runtime/src/test/java/org/apache/tuscany/sca/binding/corba/testing/service/mocks/TestRuntimeWire.java
new file mode 100644
index 0000000000..39a13dcef5
--- /dev/null
+++ b/sca-java-2.x/tags/2.0.1-RC1/modules/binding-corba-runtime/src/test/java/org/apache/tuscany/sca/binding/corba/testing/service/mocks/TestRuntimeWire.java
@@ -0,0 +1,380 @@
+/*
+ * 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.DomainRegistry;
+import org.apache.tuscany.sca.runtime.RuntimeEndpoint;
+import org.apache.tuscany.sca.runtime.RuntimeEndpointReference;
+
+/**
+ * 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, DomainRegistry domainRegistry) {
+ // 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 invokeAsync(Operation operation, Message msg) {
+ }
+
+ public void invokeAsyncResponse(Message msg) {
+ }
+
+ 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
+
+ }
+
+ public void setGeneratedWSDLContract(InterfaceContract wsdlContract){
+
+ }
+
+ public InterfaceContract getGeneratedWSDLContract(){
+ return null;
+ }
+
+ public void validateServiceInterfaceCompatibility() {
+ // TODO Auto-generated method stub
+
+ }
+
+ public InterfaceContract getGeneratedWSDLContract(
+ InterfaceContract interfaceContract) {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ public boolean isAsyncInvocation() {
+ // TODO Auto-generated method stub
+ return false;
+ }
+
+
+ @Override
+ public void invokeAsync(Message msg) {
+ // TODO Auto-generated method stub
+
+ }
+
+
+ @Override
+ public void createAsyncServerCallback() {
+ // TODO Auto-generated method stub
+
+ }
+
+
+ @Override
+ public RuntimeEndpointReference getAsyncServerCallback() {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+
+ @Override
+ public String getDeployedURI() {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+
+ @Override
+ public void setDeployedURI(String deployedURI) {
+ // TODO Auto-generated method stub
+
+ }
+
+ @Override
+ public RuntimeEndpoint getDelegateEndpoint() {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public void setDelegateEndpoint(RuntimeEndpoint delegateEndpoint) {
+ // TODO Auto-generated method stub
+
+ }
+
+ @Override
+ public String getSpecVersion() {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public void setSpecVersion(String specVersion) {
+ // TODO Auto-generated method stub
+
+ }
+}