You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tuscany.apache.org by rf...@apache.org on 2008/06/23 21:07:33 UTC

svn commit: r670714 [3/3] - in /tuscany/java/sca/modules/binding-corba-runtime/src: main/java/org/apache/tuscany/sca/binding/corba/impl/reference/ main/java/org/apache/tuscany/sca/binding/corba/impl/service/ main/java/org/apache/tuscany/sca/binding/cor...

Added: tuscany/java/sca/modules/binding-corba-runtime/src/test/java/org/apache/tuscany/sca/binding/corba/testing/service/mocks/TestRuntimeComponentService.java
URL: http://svn.apache.org/viewvc/tuscany/java/sca/modules/binding-corba-runtime/src/test/java/org/apache/tuscany/sca/binding/corba/testing/service/mocks/TestRuntimeComponentService.java?rev=670714&view=auto
==============================================================================
--- tuscany/java/sca/modules/binding-corba-runtime/src/test/java/org/apache/tuscany/sca/binding/corba/testing/service/mocks/TestRuntimeComponentService.java (added)
+++ tuscany/java/sca/modules/binding-corba-runtime/src/test/java/org/apache/tuscany/sca/binding/corba/testing/service/mocks/TestRuntimeComponentService.java Mon Jun 23 12:07:31 2008
@@ -0,0 +1,235 @@
+/*
+ * 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.Method;
+import java.lang.reflect.Modifier;
+import java.util.ArrayList;
+import java.util.List;
+
+import org.apache.tuscany.sca.assembly.Binding;
+import org.apache.tuscany.sca.assembly.Callback;
+import org.apache.tuscany.sca.assembly.ComponentReference;
+import org.apache.tuscany.sca.assembly.ConfiguredOperation;
+import org.apache.tuscany.sca.assembly.Service;
+import org.apache.tuscany.sca.interfacedef.DataType;
+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.Invoker;
+import org.apache.tuscany.sca.policy.Intent;
+import org.apache.tuscany.sca.policy.IntentAttachPointType;
+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.RuntimeComponentService;
+import org.apache.tuscany.sca.runtime.RuntimeWire;
+
+/**
+ * Mock RuntimeComponentService implementation. Only few methods needs to be
+ * implemented.
+ */
+public class TestRuntimeComponentService implements RuntimeComponentService {
+
+	private InterfaceContract interfaceContract;
+	private RuntimeWire runtimeWire;
+
+	public TestRuntimeComponentService(Object invocationTarget) {
+		runtimeWire = new TestRuntimeWire(invocationTarget);
+		List<Operation> operations = new ArrayList<Operation>();
+		Method[] methods = invocationTarget.getClass().getMethods();
+		for (int i = 0; i < methods.length; i++) {
+			int mod = methods[i].getModifiers();
+			if (Modifier.isPublic(mod)) {
+				Operation operation = new TestOperation();
+				DataType returnType = new TestDataType(methods[i]
+						.getReturnType());
+				operation.setOutputType(returnType);
+				Class<?>[] argTypes = methods[i].getParameterTypes();
+				List<DataType> argDataTypes = new ArrayList<DataType>();
+				for (int j = 0; j < argTypes.length; j++) {
+					argDataTypes.add(new TestDataType(argTypes[j]));
+				}
+				TestDataType<List<DataType>> inputDataType = new TestDataType<List<DataType>>(
+						null, argDataTypes);
+				operation.setInputType(inputDataType);
+				operations.add(operation);
+				operation.setName(methods[i].getName());
+			}
+		}
+		TestInterface iface = new TestInterface(operations);
+		interfaceContract = new TestInterfaceContract();
+		interfaceContract.setInterface(iface);
+	}
+
+	public void addPolicyProvider(Binding binding, PolicyProvider policyProvider) {
+
+	}
+
+	public ServiceBindingProvider getBindingProvider(Binding binding) {
+		return null;
+	}
+
+	public List<RuntimeWire> getCallbackWires() {
+		return null;
+	}
+
+	public InvocationChain getInvocationChain(Binding binding,
+			Operation operation) {
+		return null;
+	}
+
+	public InvocationChain getInvocationChain(Binding binding,
+			InterfaceContract interfaceContract, Operation operation) {
+		return null;
+	}
+
+	public Invoker getInvoker(Binding binding, Operation operation) {
+		return null;
+	}
+
+	public Invoker getInvoker(Binding binding,
+			InterfaceContract interfaceContract, Operation operation) {
+		return null;
+	}
+
+	public List<PolicyProvider> getPolicyProviders(Binding binding) {
+		return null;
+	}
+
+	public RuntimeWire getRuntimeWire(Binding binding) {
+		return runtimeWire;
+	}
+
+	public RuntimeWire getRuntimeWire(Binding binding,
+			InterfaceContract interfaceContract) {
+		return null;
+	}
+
+	public List<RuntimeWire> getRuntimeWires() {
+		return null;
+	}
+
+	public void setBindingProvider(Binding binding,
+			ServiceBindingProvider bindingProvider) {
+
+	}
+
+	public ComponentReference getCallbackReference() {
+		return null;
+	}
+
+	public Service getService() {
+		return null;
+	}
+
+	public void setCallbackReference(ComponentReference callbackReference) {
+
+	}
+
+	public void setService(Service service) {
+
+	}
+
+	public InterfaceContract getInterfaceContract() {
+		return interfaceContract;
+	}
+
+	public String getName() {
+		return null;
+	}
+
+	public boolean isCallback() {
+		return false;
+	}
+
+	public void setInterfaceContract(InterfaceContract interfaceContract) {
+		this.interfaceContract = interfaceContract;
+	}
+
+	public void setIsCallback(boolean isCallback) {
+
+	}
+
+	public void setName(String name) {
+
+	}
+
+	public boolean isUnresolved() {
+		return false;
+	}
+
+	public void setUnresolved(boolean unresolved) {
+
+	}
+
+	public List<Object> getExtensions() {
+		return null;
+	}
+
+	public List<Intent> getRequiredIntents() {
+		return null;
+	}
+
+	public IntentAttachPointType getType() {
+		return null;
+	}
+
+	public void setType(IntentAttachPointType type) {
+
+	}
+
+	public List<ConfiguredOperation> getConfiguredOperations() {
+		return null;
+	}
+
+	public <B> B getBinding(Class<B> bindingClass) {
+		return null;
+	}
+
+	public List<Binding> getBindings() {
+		return null;
+	}
+
+	public Callback getCallback() {
+		return null;
+	}
+
+	public <B> B getCallbackBinding(Class<B> bindingClass) {
+		return null;
+	}
+
+	public void setCallback(Callback callback) {
+
+	}
+
+	public List<PolicySet> getApplicablePolicySets() {
+		return null;
+	}
+
+	public List<PolicySet> getPolicySets() {
+		return null;
+	}
+
+	public Object clone() {
+		return null;
+	}
+
+}

Propchange: tuscany/java/sca/modules/binding-corba-runtime/src/test/java/org/apache/tuscany/sca/binding/corba/testing/service/mocks/TestRuntimeComponentService.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: tuscany/java/sca/modules/binding-corba-runtime/src/test/java/org/apache/tuscany/sca/binding/corba/testing/service/mocks/TestRuntimeComponentService.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Added: tuscany/java/sca/modules/binding-corba-runtime/src/test/java/org/apache/tuscany/sca/binding/corba/testing/service/mocks/TestRuntimeWire.java
URL: http://svn.apache.org/viewvc/tuscany/java/sca/modules/binding-corba-runtime/src/test/java/org/apache/tuscany/sca/binding/corba/testing/service/mocks/TestRuntimeWire.java?rev=670714&view=auto
==============================================================================
--- tuscany/java/sca/modules/binding-corba-runtime/src/test/java/org/apache/tuscany/sca/binding/corba/testing/service/mocks/TestRuntimeWire.java (added)
+++ tuscany/java/sca/modules/binding-corba-runtime/src/test/java/org/apache/tuscany/sca/binding/corba/testing/service/mocks/TestRuntimeWire.java Mon Jun 23 12:07:31 2008
@@ -0,0 +1,101 @@
+/*
+ * 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.interfacedef.Operation;
+import org.apache.tuscany.sca.invocation.InvocationChain;
+import org.apache.tuscany.sca.invocation.Message;
+import org.apache.tuscany.sca.runtime.EndpointReference;
+import org.apache.tuscany.sca.runtime.RuntimeWire;
+
+/**
+ * Mock RuntimeWire implementation. Only few methods needs to be implemented.
+ */
+public class TestRuntimeWire implements RuntimeWire {
+
+	private Object invocationTarget;
+
+	public TestRuntimeWire(Object invocationTarget) {
+		this.invocationTarget = invocationTarget;
+	}
+
+	public InvocationChain getInvocationChain(Operation arg0) {
+		return null;
+	}
+
+	public List<InvocationChain> getInvocationChains() {
+		return null;
+	}
+
+	public EndpointReference getSource() {
+		return null;
+	}
+
+	public EndpointReference getTarget() {
+		return null;
+	}
+
+	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;
+	}
+
+	public Object invoke(Operation operation, Message arg1)
+			throws InvocationTargetException {
+
+		return null;
+	}
+
+	public void rebuild() {
+
+	}
+
+	public void setTarget(EndpointReference arg0) {
+
+	}
+
+	public Object clone() {
+		return null;
+	}
+
+}

Propchange: tuscany/java/sca/modules/binding-corba-runtime/src/test/java/org/apache/tuscany/sca/binding/corba/testing/service/mocks/TestRuntimeWire.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: tuscany/java/sca/modules/binding-corba-runtime/src/test/java/org/apache/tuscany/sca/binding/corba/testing/service/mocks/TestRuntimeWire.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Modified: tuscany/java/sca/modules/binding-corba-runtime/src/test/resources/general_tests.idl
URL: http://svn.apache.org/viewvc/tuscany/java/sca/modules/binding-corba-runtime/src/test/resources/general_tests.idl?rev=670714&r1=670713&r2=670714&view=diff
==============================================================================
--- tuscany/java/sca/modules/binding-corba-runtime/src/test/resources/general_tests.idl (original)
+++ tuscany/java/sca/modules/binding-corba-runtime/src/test/resources/general_tests.idl Mon Jun 23 12:07:31 2008
@@ -29,7 +29,6 @@
 				module binding {
 					module corba {
 						module testing {
-							module references {
 								module generated {
 
 									interface RemoteObject {
@@ -107,8 +106,8 @@
 									};
 								
 									interface TestObject {
-										SomeStruct pickStructFromArgs(inout SomeStruct arg1, inout SomeStruct arg2, inout SomeStruct arg3, in long structNumber);
-										SomeStruct setStruct(inout SomeStruct arg);
+										SomeStruct pickStructFromArgs(in SomeStruct arg1, in SomeStruct arg2, in SomeStruct arg3, in long structNumber);
+										SomeStruct setStruct(in SomeStruct arg);
 										SimpleStruct setSimpleStruct(inout SimpleStruct arg);
 										long_seq1 setLongSeq1(inout long_seq1 arg);
 										long_seq2 setLongSeq2(inout long_seq2 arg);
@@ -116,7 +115,6 @@
 									};
 								
 								};
-							};
 						};
 					};
 				};