summaryrefslogtreecommitdiffstats
path: root/branches/sca-java-1.2/itest/callablereferences
diff options
context:
space:
mode:
authordims <dims@13f79535-47bb-0310-9956-ffa450edef68>2008-06-17 00:23:01 +0000
committerdims <dims@13f79535-47bb-0310-9956-ffa450edef68>2008-06-17 00:23:01 +0000
commitbdd0a41aed7edf21ec2a65cfa17a86af2ef8c48a (patch)
tree38a92061c0793434c4be189f1d70c3458b6bc41d /branches/sca-java-1.2/itest/callablereferences
Move Tuscany from Incubator to top level.
git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@668359 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'branches/sca-java-1.2/itest/callablereferences')
-rw-r--r--branches/sca-java-1.2/itest/callablereferences/pom.xml81
-rw-r--r--branches/sca-java-1.2/itest/callablereferences/src/main/java/org/apache/tuscany/sca/itest/callableref/AComponent.java39
-rw-r--r--branches/sca-java-1.2/itest/callablereferences/src/main/java/org/apache/tuscany/sca/itest/callableref/AComponentImpl.java116
-rw-r--r--branches/sca-java-1.2/itest/callablereferences/src/main/java/org/apache/tuscany/sca/itest/callableref/BComponent.java30
-rw-r--r--branches/sca-java-1.2/itest/callablereferences/src/main/java/org/apache/tuscany/sca/itest/callableref/BComponentImpl.java38
-rw-r--r--branches/sca-java-1.2/itest/callablereferences/src/main/java/org/apache/tuscany/sca/itest/callableref/CComponent.java27
-rw-r--r--branches/sca-java-1.2/itest/callablereferences/src/main/java/org/apache/tuscany/sca/itest/callableref/CComponentImpl.java30
-rw-r--r--branches/sca-java-1.2/itest/callablereferences/src/main/java/org/apache/tuscany/sca/itest/callableref/DComponent.java35
-rw-r--r--branches/sca-java-1.2/itest/callablereferences/src/main/java/org/apache/tuscany/sca/itest/callableref/DComponentImpl.java67
-rw-r--r--branches/sca-java-1.2/itest/callablereferences/src/main/java/org/apache/tuscany/sca/itest/callablerefreturn/Alpha.java27
-rw-r--r--branches/sca-java-1.2/itest/callablereferences/src/main/java/org/apache/tuscany/sca/itest/callablerefreturn/AlphaImpl.java86
-rw-r--r--branches/sca-java-1.2/itest/callablereferences/src/main/java/org/apache/tuscany/sca/itest/callablerefreturn/Beta.java28
-rw-r--r--branches/sca-java-1.2/itest/callablereferences/src/main/java/org/apache/tuscany/sca/itest/callablerefreturn/BetaImpl.java44
-rw-r--r--branches/sca-java-1.2/itest/callablereferences/src/main/java/org/apache/tuscany/sca/itest/callablerefreturn/Gamma.java35
-rw-r--r--branches/sca-java-1.2/itest/callablereferences/src/main/java/org/apache/tuscany/sca/itest/callablerefreturn/GammaImpl.java47
-rw-r--r--branches/sca-java-1.2/itest/callablereferences/src/main/resources/CallableReferenceReturnTest.composite39
-rw-r--r--branches/sca-java-1.2/itest/callablereferences/src/main/resources/CallableReferenceTest.composite45
-rw-r--r--branches/sca-java-1.2/itest/callablereferences/src/main/resources/nodeA/CompositeA.composite47
-rw-r--r--branches/sca-java-1.2/itest/callablereferences/src/main/resources/nodeA/META-INF/sca-contribution.xml22
-rw-r--r--branches/sca-java-1.2/itest/callablereferences/src/main/resources/nodeB/CompositeB.composite34
-rw-r--r--branches/sca-java-1.2/itest/callablereferences/src/main/resources/nodeB/META-INF/sca-contribution.xml22
-rw-r--r--branches/sca-java-1.2/itest/callablereferences/src/test/java/org/apache/tuscany/sca/itest/callableref/CallableReferenceRemoteTestCase.java142
-rw-r--r--branches/sca-java-1.2/itest/callablereferences/src/test/java/org/apache/tuscany/sca/itest/callableref/CallableReferenceReturnTestCase.java48
-rw-r--r--branches/sca-java-1.2/itest/callablereferences/src/test/java/org/apache/tuscany/sca/itest/callableref/CallableReferenceTestCase.java83
24 files changed, 1212 insertions, 0 deletions
diff --git a/branches/sca-java-1.2/itest/callablereferences/pom.xml b/branches/sca-java-1.2/itest/callablereferences/pom.xml
new file mode 100644
index 0000000000..68b42d7b2f
--- /dev/null
+++ b/branches/sca-java-1.2/itest/callablereferences/pom.xml
@@ -0,0 +1,81 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * 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.
+-->
+<project>
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-itest</artifactId>
+ <version>1.2-incubating-SNAPSHOT</version>
+ <relativePath>../pom.xml</relativePath>
+ </parent>
+ <artifactId>itest-callablereferences</artifactId>
+ <name>Apache Tuscany SCA Callable References Integration Tests</name>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-host-embedded</artifactId>
+ <version>1.2-incubating-SNAPSHOT</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-implementation-java-runtime</artifactId>
+ <version>1.2-incubating-SNAPSHOT</version>
+ <scope>runtime</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-node-impl</artifactId>
+ <version>1.2-incubating-SNAPSHOT</version>
+ <scope>test</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-domain-impl</artifactId>
+ <version>1.2-incubating-SNAPSHOT</version>
+ <scope>test</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-host-tomcat</artifactId>
+ <version>1.2-incubating-SNAPSHOT</version>
+ <scope>test</scope>
+ </dependency>
+
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-binding-ws-axis2</artifactId>
+ <version>1.2-incubating-SNAPSHOT</version>
+ <scope>test</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-binding-sca-axis2</artifactId>
+ <version>1.2-incubating-SNAPSHOT</version>
+ <scope>test</scope>
+ </dependency>
+ </dependencies>
+</project>
diff --git a/branches/sca-java-1.2/itest/callablereferences/src/main/java/org/apache/tuscany/sca/itest/callableref/AComponent.java b/branches/sca-java-1.2/itest/callablereferences/src/main/java/org/apache/tuscany/sca/itest/callableref/AComponent.java
new file mode 100644
index 0000000000..d6b3807d31
--- /dev/null
+++ b/branches/sca-java-1.2/itest/callablereferences/src/main/java/org/apache/tuscany/sca/itest/callableref/AComponent.java
@@ -0,0 +1,39 @@
+/*
+ * 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.itest.callableref;
+
+import org.osoa.sca.annotations.Remotable;
+
+@Remotable
+public interface AComponent {
+ String foo();
+
+ String fooB();
+ String fooB1();
+
+ String fooC();
+ String fooC1();
+
+ String fooStringD();
+ String fooD();
+
+ String fooBC();
+
+ DComponent getDReference();
+}
diff --git a/branches/sca-java-1.2/itest/callablereferences/src/main/java/org/apache/tuscany/sca/itest/callableref/AComponentImpl.java b/branches/sca-java-1.2/itest/callablereferences/src/main/java/org/apache/tuscany/sca/itest/callableref/AComponentImpl.java
new file mode 100644
index 0000000000..65c9bdad35
--- /dev/null
+++ b/branches/sca-java-1.2/itest/callablereferences/src/main/java/org/apache/tuscany/sca/itest/callableref/AComponentImpl.java
@@ -0,0 +1,116 @@
+/*
+ * 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.itest.callableref;
+
+import java.io.ByteArrayOutputStream;
+import java.io.Externalizable;
+import java.io.ObjectOutputStream;
+
+import org.apache.tuscany.sca.core.context.CallableReferenceImpl;
+import org.apache.tuscany.sca.databinding.impl.XSDDataTypeConverter.Base64Binary;
+import org.osoa.sca.CallableReference;
+import org.osoa.sca.ComponentContext;
+import org.osoa.sca.ServiceReference;
+import org.osoa.sca.annotations.Context;
+import org.osoa.sca.annotations.Reference;
+import org.osoa.sca.annotations.Service;
+
+@Service(AComponent.class)
+public class AComponentImpl implements AComponent {
+
+ @Context
+ protected ComponentContext componentContext;
+
+ @Reference(name = "bReference")
+ protected BComponent b;
+
+ @Reference
+ protected CComponent cReference;
+
+ @Reference
+ protected ServiceReference<CComponent> cServiceReference;
+
+ @Reference(required=false)
+ protected DComponent dReference;
+
+ protected DComponent dReference1;
+
+ @Reference(name = "dReference1")
+ public void setDReference(DComponent dReference) {
+ this.dReference1 = dReference;
+ }
+
+ public String foo() {
+ return "AComponent";
+ }
+
+ public String fooB() {
+ return b.foo();
+ }
+
+ public String fooB1() {
+ CallableReference<BComponent> bRef = componentContext.cast(b);
+ return bRef.getService().foo();
+ }
+
+ public String fooC() {
+ return cReference.foo();
+ }
+
+ public String fooC1() {
+ return cServiceReference.getService().foo();
+ }
+
+ public String fooBC() {
+ CallableReference<CComponent> cReference = componentContext.getServiceReference(CComponent.class, "cReference");
+ return b.fooC(cReference);
+ }
+
+ public String fooD() {
+ CallableReference<AComponent> aReference = componentContext.createSelfReference(AComponent.class);
+ return dReference1.foo(aReference);
+ }
+
+ /**
+ * A test case to work out what needs to be done in a transformer to get the
+ * callable reference across the wire. Let here for interest in case anyone
+ * is looking for how to get at the innards of callable references
+ */
+ public String fooStringD() {
+ CallableReference<AComponent> aReference = componentContext.createSelfReference(AComponent.class);
+ ByteArrayOutputStream bos = null;
+
+ try {
+ bos = new ByteArrayOutputStream();
+ ObjectOutputStream oos = new ObjectOutputStream(bos);
+ oos.writeObject(aReference);
+ } catch (Exception ex) {
+ System.out.println(ex.toString());
+ return null;
+ }
+
+ String aReferenceString = Base64Binary.encode(bos.toByteArray());
+ return dReference1.fooString(aReferenceString);
+ }
+
+ public DComponent getDReference() {
+ return dReference;
+ }
+
+}
diff --git a/branches/sca-java-1.2/itest/callablereferences/src/main/java/org/apache/tuscany/sca/itest/callableref/BComponent.java b/branches/sca-java-1.2/itest/callablereferences/src/main/java/org/apache/tuscany/sca/itest/callableref/BComponent.java
new file mode 100644
index 0000000000..ade672b0ab
--- /dev/null
+++ b/branches/sca-java-1.2/itest/callablereferences/src/main/java/org/apache/tuscany/sca/itest/callableref/BComponent.java
@@ -0,0 +1,30 @@
+/*
+ * 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.itest.callableref;
+
+import org.osoa.sca.CallableReference;
+import org.osoa.sca.annotations.Remotable;
+
+@Remotable
+public interface BComponent {
+
+ String foo();
+
+ String fooC(CallableReference<CComponent> cComponent);
+}
diff --git a/branches/sca-java-1.2/itest/callablereferences/src/main/java/org/apache/tuscany/sca/itest/callableref/BComponentImpl.java b/branches/sca-java-1.2/itest/callablereferences/src/main/java/org/apache/tuscany/sca/itest/callableref/BComponentImpl.java
new file mode 100644
index 0000000000..518e77d3a8
--- /dev/null
+++ b/branches/sca-java-1.2/itest/callablereferences/src/main/java/org/apache/tuscany/sca/itest/callableref/BComponentImpl.java
@@ -0,0 +1,38 @@
+/*
+ * 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.itest.callableref;
+
+import org.osoa.sca.CallableReference;
+import org.osoa.sca.annotations.Service;
+
+@Service(BComponent.class)
+public class BComponentImpl implements BComponent {
+
+ public BComponentImpl() {
+ }
+
+ public String foo() {
+ return "BComponent";
+ }
+
+ public String fooC(CallableReference<CComponent> cReference) {
+ return "B" + cReference.getService().foo();
+ }
+
+}
diff --git a/branches/sca-java-1.2/itest/callablereferences/src/main/java/org/apache/tuscany/sca/itest/callableref/CComponent.java b/branches/sca-java-1.2/itest/callablereferences/src/main/java/org/apache/tuscany/sca/itest/callableref/CComponent.java
new file mode 100644
index 0000000000..fdf80cc1c8
--- /dev/null
+++ b/branches/sca-java-1.2/itest/callablereferences/src/main/java/org/apache/tuscany/sca/itest/callableref/CComponent.java
@@ -0,0 +1,27 @@
+/*
+ * 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.itest.callableref;
+
+import org.osoa.sca.annotations.Remotable;
+
+@Remotable
+public interface CComponent {
+
+ String foo();
+}
diff --git a/branches/sca-java-1.2/itest/callablereferences/src/main/java/org/apache/tuscany/sca/itest/callableref/CComponentImpl.java b/branches/sca-java-1.2/itest/callablereferences/src/main/java/org/apache/tuscany/sca/itest/callableref/CComponentImpl.java
new file mode 100644
index 0000000000..cc8ec8f000
--- /dev/null
+++ b/branches/sca-java-1.2/itest/callablereferences/src/main/java/org/apache/tuscany/sca/itest/callableref/CComponentImpl.java
@@ -0,0 +1,30 @@
+/*
+ * 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.itest.callableref;
+
+import org.osoa.sca.annotations.Service;
+
+@Service(CComponent.class)
+public class CComponentImpl implements CComponent {
+
+ public String foo() {
+ return "CComponent";
+ }
+
+}
diff --git a/branches/sca-java-1.2/itest/callablereferences/src/main/java/org/apache/tuscany/sca/itest/callableref/DComponent.java b/branches/sca-java-1.2/itest/callablereferences/src/main/java/org/apache/tuscany/sca/itest/callableref/DComponent.java
new file mode 100644
index 0000000000..eb8cbbf280
--- /dev/null
+++ b/branches/sca-java-1.2/itest/callablereferences/src/main/java/org/apache/tuscany/sca/itest/callableref/DComponent.java
@@ -0,0 +1,35 @@
+/*
+ * 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.itest.callableref;
+
+import java.io.Externalizable;
+
+import javax.xml.stream.XMLStreamReader;
+
+import org.apache.tuscany.sca.core.context.CallableReferenceImpl;
+import org.osoa.sca.CallableReference;
+import org.osoa.sca.annotations.Remotable;
+
+@Remotable
+public interface DComponent {
+
+ String foo(CallableReference<AComponent> aReference);
+
+ String fooString(String aReferenceString);
+}
diff --git a/branches/sca-java-1.2/itest/callablereferences/src/main/java/org/apache/tuscany/sca/itest/callableref/DComponentImpl.java b/branches/sca-java-1.2/itest/callablereferences/src/main/java/org/apache/tuscany/sca/itest/callableref/DComponentImpl.java
new file mode 100644
index 0000000000..8117ed9235
--- /dev/null
+++ b/branches/sca-java-1.2/itest/callablereferences/src/main/java/org/apache/tuscany/sca/itest/callableref/DComponentImpl.java
@@ -0,0 +1,67 @@
+/*
+ * 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.itest.callableref;
+
+import java.io.ByteArrayInputStream;
+import java.io.ByteArrayOutputStream;
+import java.io.Externalizable;
+import java.io.ObjectInputStream;
+import java.io.ObjectOutputStream;
+
+import org.apache.tuscany.sca.core.context.CallableReferenceImpl;
+import org.apache.tuscany.sca.databinding.impl.XSDDataTypeConverter.Base64Binary;
+import org.osoa.sca.CallableReference;
+import org.osoa.sca.RequestContext;
+import org.osoa.sca.annotations.Context;
+import org.osoa.sca.annotations.Service;
+
+@Service(DComponent.class)
+public class DComponentImpl implements DComponent {
+
+ @Context
+ protected RequestContext requestContext;
+
+ public String foo(CallableReference<AComponent> aReference) {
+ try {
+ ByteArrayOutputStream bos = new ByteArrayOutputStream();
+ ObjectOutputStream oos = new ObjectOutputStream(bos);
+ oos.writeObject(aReference);
+ ObjectInputStream ois = new ObjectInputStream(new ByteArrayInputStream(bos.toByteArray()));
+ Object obj = ois.readObject();
+ aReference = (CallableReference<AComponent>) obj;
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+ System.out.println("Invoking service: " + requestContext.getServiceName());
+ return "D" + aReference.getService().foo();
+ }
+
+ public String fooString(String aReferenceString) {
+ CallableReference<AComponent> aReference = null;
+ try {
+ ObjectInputStream ois = new ObjectInputStream(new ByteArrayInputStream(Base64Binary.decode(aReferenceString)));
+ Object obj = ois.readObject();
+ aReference = (CallableReference<AComponent>) obj;
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+ System.out.println("Invoking service: " + requestContext.getServiceName());
+ return "D" + aReference.getService().foo();
+ }
+}
diff --git a/branches/sca-java-1.2/itest/callablereferences/src/main/java/org/apache/tuscany/sca/itest/callablerefreturn/Alpha.java b/branches/sca-java-1.2/itest/callablereferences/src/main/java/org/apache/tuscany/sca/itest/callablerefreturn/Alpha.java
new file mode 100644
index 0000000000..ab21421c4d
--- /dev/null
+++ b/branches/sca-java-1.2/itest/callablereferences/src/main/java/org/apache/tuscany/sca/itest/callablerefreturn/Alpha.java
@@ -0,0 +1,27 @@
+/*
+ * 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.itest.callablerefreturn;
+
+import org.osoa.sca.annotations.Remotable;
+
+@Remotable
+public interface Alpha
+{
+ boolean run();
+}
diff --git a/branches/sca-java-1.2/itest/callablereferences/src/main/java/org/apache/tuscany/sca/itest/callablerefreturn/AlphaImpl.java b/branches/sca-java-1.2/itest/callablereferences/src/main/java/org/apache/tuscany/sca/itest/callablerefreturn/AlphaImpl.java
new file mode 100644
index 0000000000..5b5984b164
--- /dev/null
+++ b/branches/sca-java-1.2/itest/callablereferences/src/main/java/org/apache/tuscany/sca/itest/callablerefreturn/AlphaImpl.java
@@ -0,0 +1,86 @@
+/*
+ * 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.itest.callablerefreturn;
+
+import org.osoa.sca.CallableReference;
+import org.osoa.sca.ComponentContext;
+import org.osoa.sca.Conversation;
+import org.osoa.sca.annotations.Context;
+import org.osoa.sca.annotations.Reference;
+import org.osoa.sca.annotations.Scope;
+
+@Scope("COMPOSITE")
+public class AlphaImpl implements Alpha {
+ @Reference
+ public Beta beta;
+
+ @Context
+ protected ComponentContext componentContext;
+
+ public boolean run() {
+ CallableReference<Gamma> gammaRef = null;
+ try {
+ Object conversationId1 = null;
+ Object conversationId2 = null;
+
+ // it is expected that this call returns a reference to Gamma that
+ // reuses the established Conversation
+ gammaRef = beta.getRef();
+
+ // no Conversation exists
+ Conversation con = gammaRef.getConversation();
+ if (con == null) {
+ System.out.println("Alpha: Conversation to gamma is null");
+ } else {
+ System.out
+ .println("Alpha: Conversation to gamma exists. conversationId="
+ + con.getConversationID());
+ conversationId1 = con.getConversationID();
+ }
+
+ // this call should reuse a Conversation, but as none exists it
+ // creates a new conversation
+ gammaRef.getService().doSomething();
+ con = gammaRef.getConversation();
+ if (con == null) {
+ System.out.println("Alpha: Conversation to gamma is null");
+ } else {
+ System.out
+ .println("Alpha: Conversation to gamma exists. conversationId="
+ + con.getConversationID());
+ conversationId2 = con.getConversationID();
+ }
+
+ if ((conversationId1 == null) || (conversationId2 == null)) {
+ return false;
+ }
+
+ boolean testPassed = conversationId1.equals(conversationId2);
+ return testPassed;
+ } catch (Exception e) {
+ e.printStackTrace();
+ return false;
+ } finally {
+ if (gammaRef != null) {
+ gammaRef.getService().stop();
+ }
+ }
+ }
+
+}
diff --git a/branches/sca-java-1.2/itest/callablereferences/src/main/java/org/apache/tuscany/sca/itest/callablerefreturn/Beta.java b/branches/sca-java-1.2/itest/callablereferences/src/main/java/org/apache/tuscany/sca/itest/callablerefreturn/Beta.java
new file mode 100644
index 0000000000..223c467f47
--- /dev/null
+++ b/branches/sca-java-1.2/itest/callablereferences/src/main/java/org/apache/tuscany/sca/itest/callablerefreturn/Beta.java
@@ -0,0 +1,28 @@
+/*
+ * 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.itest.callablerefreturn;
+
+import org.osoa.sca.CallableReference;
+import org.osoa.sca.annotations.Remotable;
+
+@Remotable
+public interface Beta
+{
+ CallableReference<Gamma> getRef();
+}
diff --git a/branches/sca-java-1.2/itest/callablereferences/src/main/java/org/apache/tuscany/sca/itest/callablerefreturn/BetaImpl.java b/branches/sca-java-1.2/itest/callablereferences/src/main/java/org/apache/tuscany/sca/itest/callablerefreturn/BetaImpl.java
new file mode 100644
index 0000000000..ed4e66bec3
--- /dev/null
+++ b/branches/sca-java-1.2/itest/callablereferences/src/main/java/org/apache/tuscany/sca/itest/callablerefreturn/BetaImpl.java
@@ -0,0 +1,44 @@
+/*
+ * 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.itest.callablerefreturn;
+
+import org.osoa.sca.CallableReference;
+import org.osoa.sca.ComponentContext;
+import org.osoa.sca.ServiceReference;
+import org.osoa.sca.annotations.Context;
+import org.osoa.sca.annotations.Reference;
+import org.osoa.sca.annotations.Scope;
+
+@Scope("COMPOSITE")
+public class BetaImpl implements Beta
+{
+ @Context
+ protected ComponentContext componentContext;
+
+ @Reference
+ public Gamma gamma;
+
+ public CallableReference<Gamma> getRef()
+ {
+ ServiceReference<Gamma> gammaRef = componentContext.getServiceReference(Gamma.class, "gamma");
+ gammaRef.getService().start();
+ return gammaRef;
+ }
+
+}
diff --git a/branches/sca-java-1.2/itest/callablereferences/src/main/java/org/apache/tuscany/sca/itest/callablerefreturn/Gamma.java b/branches/sca-java-1.2/itest/callablereferences/src/main/java/org/apache/tuscany/sca/itest/callablerefreturn/Gamma.java
new file mode 100644
index 0000000000..e32051373f
--- /dev/null
+++ b/branches/sca-java-1.2/itest/callablereferences/src/main/java/org/apache/tuscany/sca/itest/callablerefreturn/Gamma.java
@@ -0,0 +1,35 @@
+/*
+ * 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.itest.callablerefreturn;
+
+import org.osoa.sca.annotations.Conversational;
+import org.osoa.sca.annotations.EndsConversation;
+import org.osoa.sca.annotations.Remotable;
+
+@Remotable
+@Conversational
+public interface Gamma
+{
+ void start();
+
+ void doSomething();
+
+ @EndsConversation
+ void stop();
+}
diff --git a/branches/sca-java-1.2/itest/callablereferences/src/main/java/org/apache/tuscany/sca/itest/callablerefreturn/GammaImpl.java b/branches/sca-java-1.2/itest/callablereferences/src/main/java/org/apache/tuscany/sca/itest/callablerefreturn/GammaImpl.java
new file mode 100644
index 0000000000..adf5a1c1ce
--- /dev/null
+++ b/branches/sca-java-1.2/itest/callablereferences/src/main/java/org/apache/tuscany/sca/itest/callablerefreturn/GammaImpl.java
@@ -0,0 +1,47 @@
+/*
+ * 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.itest.callablerefreturn;
+
+import org.osoa.sca.annotations.ConversationID;
+import org.osoa.sca.annotations.Scope;
+
+@Scope("CONVERSATION")
+public class GammaImpl implements Gamma
+{
+ @ConversationID
+ protected String conversationId;
+
+
+ public void start()
+ {
+ System.out.println("Gamma:start(), conversationId=" + conversationId);
+ }
+
+
+ public void doSomething()
+ {
+ System.out.println("Gamma:doSomething(), conversationId=" + conversationId);
+ }
+
+
+ public void stop()
+ {
+ System.out.println("Gamma:stop(), conversationId=" + conversationId);
+ }
+}
diff --git a/branches/sca-java-1.2/itest/callablereferences/src/main/resources/CallableReferenceReturnTest.composite b/branches/sca-java-1.2/itest/callablereferences/src/main/resources/CallableReferenceReturnTest.composite
new file mode 100644
index 0000000000..5b3add1e61
--- /dev/null
+++ b/branches/sca-java-1.2/itest/callablereferences/src/main/resources/CallableReferenceReturnTest.composite
@@ -0,0 +1,39 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * 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
+ * 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.
+-->
+
+<composite xmlns="http://www.osoa.org/xmlns/sca/1.0"
+ xmlns:t="http://tuscany.apache.org/xmlns/sca/1.0"
+ xmlns:s="http://test"
+ name="test">
+
+ <component name="Alpha">
+ <implementation.java class="org.apache.tuscany.sca.itest.callablerefreturn.AlphaImpl"/>
+ <reference name="beta" target="Beta"/>
+ </component>
+
+ <component name="Beta">
+ <implementation.java class="org.apache.tuscany.sca.itest.callablerefreturn.BetaImpl"/>
+ <reference name="gamma" target="Gamma"/>
+ </component>
+
+ <component name="Gamma">
+ <implementation.java class="org.apache.tuscany.sca.itest.callablerefreturn.GammaImpl"/>
+ </component>
+
+</composite>
diff --git a/branches/sca-java-1.2/itest/callablereferences/src/main/resources/CallableReferenceTest.composite b/branches/sca-java-1.2/itest/callablereferences/src/main/resources/CallableReferenceTest.composite
new file mode 100644
index 0000000000..49b75f56e4
--- /dev/null
+++ b/branches/sca-java-1.2/itest/callablereferences/src/main/resources/CallableReferenceTest.composite
@@ -0,0 +1,45 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * 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
+ * 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.
+-->
+<composite xmlns="http://www.osoa.org/xmlns/sca/1.0" xmlns:foo="http://foo" targetNamespace="http://foo"
+ name="InnerReferencesTest" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
+
+ <service name="AComponent" promote="AComponent">
+ <interface.java interface="org.apache.tuscany.sca.itest.callableref.AComponent" />
+ </service>
+
+ <component name="AComponent">
+ <implementation.java class="org.apache.tuscany.sca.itest.callableref.AComponentImpl" />
+ <reference name="bReference" target="BComponent" />
+ <reference name="cReference" target="CComponent" />
+ <reference name="cServiceReference" target="CComponent" />
+ <reference name="dReference1" target="DComponent" />
+ </component>
+
+ <component name="BComponent">
+ <implementation.java class="org.apache.tuscany.sca.itest.callableref.BComponentImpl" />
+ </component>
+
+ <component name="CComponent">
+ <implementation.java class="org.apache.tuscany.sca.itest.callableref.CComponentImpl" />
+ </component>
+
+ <component name="DComponent">
+ <implementation.java class="org.apache.tuscany.sca.itest.callableref.DComponentImpl" />
+ </component>
+</composite> \ No newline at end of file
diff --git a/branches/sca-java-1.2/itest/callablereferences/src/main/resources/nodeA/CompositeA.composite b/branches/sca-java-1.2/itest/callablereferences/src/main/resources/nodeA/CompositeA.composite
new file mode 100644
index 0000000000..facbe45f50
--- /dev/null
+++ b/branches/sca-java-1.2/itest/callablereferences/src/main/resources/nodeA/CompositeA.composite
@@ -0,0 +1,47 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * 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
+ * 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.
+-->
+<composite xmlns="http://www.osoa.org/xmlns/sca/1.0" xmlns:foo="http://foo" targetNamespace="http://foo"
+ name="CompositeA" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
+
+ <service name="AComponentService" promote="AComponent">
+ <interface.java interface="org.apache.tuscany.sca.itest.callableref.AComponent" />
+ </service>
+
+ <component name="AComponent">
+ <implementation.java class="org.apache.tuscany.sca.itest.callableref.AComponentImpl" />
+ <reference name="bReference" target="BComponent" />
+ <reference name="cReference" target="CComponent" />
+ <reference name="cServiceReference" target="CComponent" />
+ <reference name="dReference1" target="DComponent" />
+ </component>
+
+ <!--
+ <component name="BComponent">
+ <implementation.java class="org.apache.tuscany.sca.itest.callableref.BComponentImpl" />
+ </component>
+
+ <component name="CComponent">
+ <implementation.java class="org.apache.tuscany.sca.itest.callableref.CComponentImpl" />
+ </component>
+
+ <component name="DComponent">
+ <implementation.java class="org.apache.tuscany.sca.itest.callableref.DComponentImpl" />
+ </component>
+ -->
+</composite> \ No newline at end of file
diff --git a/branches/sca-java-1.2/itest/callablereferences/src/main/resources/nodeA/META-INF/sca-contribution.xml b/branches/sca-java-1.2/itest/callablereferences/src/main/resources/nodeA/META-INF/sca-contribution.xml
new file mode 100644
index 0000000000..95021f72a4
--- /dev/null
+++ b/branches/sca-java-1.2/itest/callablereferences/src/main/resources/nodeA/META-INF/sca-contribution.xml
@@ -0,0 +1,22 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * 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.
+-->
+<contribution xmlns="http://www.osoa.org/xmlns/sca/1.0" xmlns:foo="http://foo">
+ <deployable composite="foo:CompositeA" />
+</contribution> \ No newline at end of file
diff --git a/branches/sca-java-1.2/itest/callablereferences/src/main/resources/nodeB/CompositeB.composite b/branches/sca-java-1.2/itest/callablereferences/src/main/resources/nodeB/CompositeB.composite
new file mode 100644
index 0000000000..2849400be4
--- /dev/null
+++ b/branches/sca-java-1.2/itest/callablereferences/src/main/resources/nodeB/CompositeB.composite
@@ -0,0 +1,34 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * 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
+ * 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.
+-->
+<composite xmlns="http://www.osoa.org/xmlns/sca/1.0" xmlns:foo="http://foo" targetNamespace="http://foo"
+ name="CompositeB" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
+
+ <component name="BComponent">
+ <implementation.java class="org.apache.tuscany.sca.itest.callableref.BComponentImpl" />
+ </component>
+
+ <component name="CComponent">
+ <implementation.java class="org.apache.tuscany.sca.itest.callableref.CComponentImpl" />
+ </component>
+
+ <component name="DComponent">
+ <implementation.java class="org.apache.tuscany.sca.itest.callableref.DComponentImpl" />
+ </component>
+
+</composite> \ No newline at end of file
diff --git a/branches/sca-java-1.2/itest/callablereferences/src/main/resources/nodeB/META-INF/sca-contribution.xml b/branches/sca-java-1.2/itest/callablereferences/src/main/resources/nodeB/META-INF/sca-contribution.xml
new file mode 100644
index 0000000000..2edda61601
--- /dev/null
+++ b/branches/sca-java-1.2/itest/callablereferences/src/main/resources/nodeB/META-INF/sca-contribution.xml
@@ -0,0 +1,22 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * 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.
+-->
+<contribution xmlns="http://www.osoa.org/xmlns/sca/1.0" xmlns:foo="http://foo">
+ <deployable composite="foo:CompositeB" />
+</contribution> \ No newline at end of file
diff --git a/branches/sca-java-1.2/itest/callablereferences/src/test/java/org/apache/tuscany/sca/itest/callableref/CallableReferenceRemoteTestCase.java b/branches/sca-java-1.2/itest/callablereferences/src/test/java/org/apache/tuscany/sca/itest/callableref/CallableReferenceRemoteTestCase.java
new file mode 100644
index 0000000000..3277c57616
--- /dev/null
+++ b/branches/sca-java-1.2/itest/callablereferences/src/test/java/org/apache/tuscany/sca/itest/callableref/CallableReferenceRemoteTestCase.java
@@ -0,0 +1,142 @@
+/*
+ * 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.itest.callableref;
+
+
+import static junit.framework.Assert.assertEquals;
+
+import javax.xml.namespace.QName;
+
+
+import junit.framework.Assert;
+
+
+import org.apache.tuscany.sca.domain.SCADomain;
+import org.apache.tuscany.sca.domain.SCADomainFactory;
+import org.apache.tuscany.sca.node.SCANode;
+import org.apache.tuscany.sca.node.SCANodeFactory;
+import org.junit.AfterClass;
+import org.junit.BeforeClass;
+import org.junit.Test;
+
+
+/**
+ * Runs a distributed domain in a single VM by using and in memory
+ * implementation of the distributed domain
+ */
+public class CallableReferenceRemoteTestCase {
+
+ private static SCADomain domain;
+ private static SCANode nodeA;
+ private static SCANode nodeB;
+
+ private static AComponent acomponent;
+
+ @BeforeClass
+ public static void init() throws Exception {
+
+ try {
+ System.out.println("Setting up domain");
+ SCADomainFactory domainFactory = SCADomainFactory.newInstance();
+ domain= domainFactory.createSCADomain("http://localhost:9999");
+
+ System.out.println("Setting up nodes");
+
+ ClassLoader cl = CallableReferenceRemoteTestCase.class.getClassLoader();
+
+ SCANodeFactory nodeFactory = SCANodeFactory.newInstance();
+
+ nodeA = nodeFactory.createSCANode("http://localhost:8100/nodeA", "http://localhost:9999");
+ nodeA.addContribution("nodeA", cl.getResource("nodeA/"));
+ nodeA.addToDomainLevelComposite(new QName("http://foo", "CompositeA"));
+
+
+ nodeB = nodeFactory.createSCANode("http://localhost:8200/nodeB", "http://localhost:9999");
+ nodeB.addContribution("nodeB", cl.getResource("nodeB/"));
+ nodeB.addToDomainLevelComposite(new QName("http://foo", "CompositeB"));
+
+ domain.start();
+
+ // get a reference to the calculator service from domainA
+ // which will be running this component
+ acomponent = nodeA.getDomain().getService(AComponent.class, "AComponent/AComponent");
+ } catch (Exception ex) {
+ System.out.println(ex.toString());
+ }
+ }
+
+ @AfterClass
+ public static void destroy() throws Exception {
+ // stop the nodes and hence the domains they contain
+ nodeA.destroy();
+ nodeB.destroy();
+ }
+
+ //@Test
+ public void testKeepServerRunning1() throws Exception {
+ System.out.println("press enter to continue");
+ System.in.read();
+ }
+
+ @Test
+ public void testBReference() {
+ assertEquals("BComponent", acomponent.fooB());
+ }
+
+ @Test
+ public void testBCast() {
+ assertEquals("BComponent", acomponent.fooB1());
+ }
+
+ @Test
+ public void testCReference() {
+ assertEquals("CComponent", acomponent.fooC());
+ }
+
+ @Test
+ public void testCServiceReference() {
+ assertEquals("CComponent", acomponent.fooC1());
+ }
+
+ @Test
+ public void testDReferenceString() {
+ assertEquals("DAComponent", acomponent.fooStringD());
+ }
+
+ @Test
+ public void testDReference() {
+ assertEquals("DAComponent", acomponent.fooD());
+ }
+
+
+ @Test
+ public void testBCReference() {
+ assertEquals("BCComponent", acomponent.fooBC());
+ }
+
+ @Test
+ public void testRequiredFalseReference() {
+ try {
+ acomponent.getDReference().foo(null);
+ } catch (Exception e) {
+ Assert.assertTrue(true);
+ }
+ }
+
+}
diff --git a/branches/sca-java-1.2/itest/callablereferences/src/test/java/org/apache/tuscany/sca/itest/callableref/CallableReferenceReturnTestCase.java b/branches/sca-java-1.2/itest/callablereferences/src/test/java/org/apache/tuscany/sca/itest/callableref/CallableReferenceReturnTestCase.java
new file mode 100644
index 0000000000..f2d8fe5d64
--- /dev/null
+++ b/branches/sca-java-1.2/itest/callablereferences/src/test/java/org/apache/tuscany/sca/itest/callableref/CallableReferenceReturnTestCase.java
@@ -0,0 +1,48 @@
+/*
+ * 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.itest.callableref;
+
+import org.apache.tuscany.sca.host.embedded.SCADomain;
+import org.apache.tuscany.sca.itest.callablerefreturn.Alpha;
+import org.junit.AfterClass;
+import org.junit.Assert;
+import org.junit.BeforeClass;
+import org.junit.Test;
+
+public class CallableReferenceReturnTestCase {
+ private static SCADomain domain;
+ private static Alpha alpha;
+
+ @BeforeClass
+ public static void init() throws Exception {
+ domain = SCADomain.newInstance("CallableReferenceReturnTest.composite");
+ alpha = domain.getService(Alpha.class, "Alpha");
+ }
+
+ @AfterClass
+ public static void destroy() throws Exception {
+ domain.close();
+ }
+
+ @Test
+ public void testCallableReferenceReturn() {
+ Assert.assertTrue(alpha.run());
+ }
+
+}
diff --git a/branches/sca-java-1.2/itest/callablereferences/src/test/java/org/apache/tuscany/sca/itest/callableref/CallableReferenceTestCase.java b/branches/sca-java-1.2/itest/callablereferences/src/test/java/org/apache/tuscany/sca/itest/callableref/CallableReferenceTestCase.java
new file mode 100644
index 0000000000..2b7750b443
--- /dev/null
+++ b/branches/sca-java-1.2/itest/callablereferences/src/test/java/org/apache/tuscany/sca/itest/callableref/CallableReferenceTestCase.java
@@ -0,0 +1,83 @@
+/*
+ * 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.itest.callableref;
+
+import static junit.framework.Assert.assertEquals;
+import junit.framework.Assert;
+
+import org.apache.tuscany.sca.host.embedded.SCADomain;
+import org.junit.AfterClass;
+import org.junit.BeforeClass;
+import org.junit.Test;
+
+public class CallableReferenceTestCase {
+ private static SCADomain domain;
+ private static AComponent acomponent;
+
+ @BeforeClass
+ public static void init() throws Exception {
+ domain = SCADomain.newInstance("CallableReferenceTest.composite");
+ acomponent = domain.getService(AComponent.class, "AComponent");
+ }
+
+ @AfterClass
+ public static void destroy() throws Exception {
+ domain.close();
+ }
+
+ @Test
+ public void testBReference() {
+ assertEquals("BComponent", acomponent.fooB());
+ }
+
+ @Test
+ public void testBCast() {
+ assertEquals("BComponent", acomponent.fooB1());
+ }
+
+ @Test
+ public void testCReference() {
+ assertEquals("CComponent", acomponent.fooC());
+ }
+
+ @Test
+ public void testCServiceReference() {
+ assertEquals("CComponent", acomponent.fooC1());
+ }
+
+ @Test
+ public void testDReference() {
+ assertEquals("DAComponent", acomponent.fooD());
+ }
+
+ @Test
+ public void testBCReference() {
+ assertEquals("BCComponent", acomponent.fooBC());
+ }
+
+ @Test
+ public void testRequiredFalseReference() {
+ try {
+ acomponent.getDReference().foo(null);
+ } catch (Exception e) {
+ Assert.assertTrue(true);
+ }
+ }
+
+}