summaryrefslogtreecommitdiffstats
path: root/branches/sca-java-2.0-M4/itest/service-reference/src
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--branches/sca-java-2.0-M4/itest/service-reference/src/main/java/org/apache/tuscany/sca/itest/serviceref/AComponent.java39
-rw-r--r--branches/sca-java-2.0-M4/itest/service-reference/src/main/java/org/apache/tuscany/sca/itest/serviceref/AComponentImpl.java112
-rw-r--r--branches/sca-java-2.0-M4/itest/service-reference/src/main/java/org/apache/tuscany/sca/itest/serviceref/BComponent.java31
-rw-r--r--branches/sca-java-2.0-M4/itest/service-reference/src/main/java/org/apache/tuscany/sca/itest/serviceref/BComponentImpl.java38
-rw-r--r--branches/sca-java-2.0-M4/itest/service-reference/src/main/java/org/apache/tuscany/sca/itest/serviceref/Base64Binary.java297
-rw-r--r--branches/sca-java-2.0-M4/itest/service-reference/src/main/java/org/apache/tuscany/sca/itest/serviceref/CComponent.java27
-rw-r--r--branches/sca-java-2.0-M4/itest/service-reference/src/main/java/org/apache/tuscany/sca/itest/serviceref/CComponentImpl.java30
-rw-r--r--branches/sca-java-2.0-M4/itest/service-reference/src/main/java/org/apache/tuscany/sca/itest/serviceref/DComponent.java30
-rw-r--r--branches/sca-java-2.0-M4/itest/service-reference/src/main/java/org/apache/tuscany/sca/itest/serviceref/DComponentImpl.java64
-rw-r--r--branches/sca-java-2.0-M4/itest/service-reference/src/main/resources/nodeA/CompositeA.composite44
-rw-r--r--branches/sca-java-2.0-M4/itest/service-reference/src/main/resources/nodeB/CompositeB.composite46
-rw-r--r--branches/sca-java-2.0-M4/itest/service-reference/src/main/resources/servicereference/ServiceReferenceTest.composite48
-rw-r--r--branches/sca-java-2.0-M4/itest/service-reference/src/test/java/org/apache/tuscany/sca/itest/serviceref/CallableReferenceRemoteTestCase.java139
-rw-r--r--branches/sca-java-2.0-M4/itest/service-reference/src/test/java/org/apache/tuscany/sca/itest/serviceref/ServiceReferenceTestCase.java88
14 files changed, 0 insertions, 1033 deletions
diff --git a/branches/sca-java-2.0-M4/itest/service-reference/src/main/java/org/apache/tuscany/sca/itest/serviceref/AComponent.java b/branches/sca-java-2.0-M4/itest/service-reference/src/main/java/org/apache/tuscany/sca/itest/serviceref/AComponent.java
deleted file mode 100644
index 8b5cf4d29a..0000000000
--- a/branches/sca-java-2.0-M4/itest/service-reference/src/main/java/org/apache/tuscany/sca/itest/serviceref/AComponent.java
+++ /dev/null
@@ -1,39 +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.sca.itest.serviceref;
-
-import org.oasisopen.sca.annotation.Remotable;
-
-@Remotable
-public interface AComponent {
- String foo();
-
- String fooB();
- String fooB1();
-
- String fooC();
- String fooC1();
-
- String fooStringD();
- String fooD();
-
- String fooBC();
-
- String invokeDReference();
-}
diff --git a/branches/sca-java-2.0-M4/itest/service-reference/src/main/java/org/apache/tuscany/sca/itest/serviceref/AComponentImpl.java b/branches/sca-java-2.0-M4/itest/service-reference/src/main/java/org/apache/tuscany/sca/itest/serviceref/AComponentImpl.java
deleted file mode 100644
index 3f68ac828a..0000000000
--- a/branches/sca-java-2.0-M4/itest/service-reference/src/main/java/org/apache/tuscany/sca/itest/serviceref/AComponentImpl.java
+++ /dev/null
@@ -1,112 +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.sca.itest.serviceref;
-
-import java.io.ByteArrayOutputStream;
-import java.io.ObjectOutputStream;
-
-import org.oasisopen.sca.ComponentContext;
-import org.oasisopen.sca.ServiceReference;
-import org.oasisopen.sca.annotation.Context;
-import org.oasisopen.sca.annotation.Reference;
-import org.oasisopen.sca.annotation.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() {
- ServiceReference<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() {
- ServiceReference<CComponent> cReference = componentContext.getServiceReference(CComponent.class, "cReference");
- return b.fooC(cReference);
- }
-
- public String fooD() {
- ServiceReference<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
- * CallableReference across the wire. Left here for interest in case anyone
- * is looking for how to get at the innards of CallableReferences
- */
- public String fooStringD() {
- ServiceReference<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 String invokeDReference() {
- return dReference.foo(null);
- }
-
-}
diff --git a/branches/sca-java-2.0-M4/itest/service-reference/src/main/java/org/apache/tuscany/sca/itest/serviceref/BComponent.java b/branches/sca-java-2.0-M4/itest/service-reference/src/main/java/org/apache/tuscany/sca/itest/serviceref/BComponent.java
deleted file mode 100644
index 18242cd594..0000000000
--- a/branches/sca-java-2.0-M4/itest/service-reference/src/main/java/org/apache/tuscany/sca/itest/serviceref/BComponent.java
+++ /dev/null
@@ -1,31 +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.sca.itest.serviceref;
-
-import org.oasisopen.sca.ServiceReference;
-import org.oasisopen.sca.annotation.Remotable;
-
-
-@Remotable
-public interface BComponent {
-
- String foo();
-
- String fooC(ServiceReference<CComponent> cComponent);
-}
diff --git a/branches/sca-java-2.0-M4/itest/service-reference/src/main/java/org/apache/tuscany/sca/itest/serviceref/BComponentImpl.java b/branches/sca-java-2.0-M4/itest/service-reference/src/main/java/org/apache/tuscany/sca/itest/serviceref/BComponentImpl.java
deleted file mode 100644
index dd143df036..0000000000
--- a/branches/sca-java-2.0-M4/itest/service-reference/src/main/java/org/apache/tuscany/sca/itest/serviceref/BComponentImpl.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.sca.itest.serviceref;
-
-import org.oasisopen.sca.ServiceReference;
-import org.oasisopen.sca.annotation.Service;
-
-@Service(BComponent.class)
-public class BComponentImpl implements BComponent {
-
- public BComponentImpl() {
- }
-
- public String foo() {
- return "BComponent";
- }
-
- public String fooC(ServiceReference<CComponent> cReference) {
- return "B" + cReference.getService().foo();
- }
-
-}
diff --git a/branches/sca-java-2.0-M4/itest/service-reference/src/main/java/org/apache/tuscany/sca/itest/serviceref/Base64Binary.java b/branches/sca-java-2.0-M4/itest/service-reference/src/main/java/org/apache/tuscany/sca/itest/serviceref/Base64Binary.java
deleted file mode 100644
index fb436ae10c..0000000000
--- a/branches/sca-java-2.0-M4/itest/service-reference/src/main/java/org/apache/tuscany/sca/itest/serviceref/Base64Binary.java
+++ /dev/null
@@ -1,297 +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.sca.itest.serviceref;
-
-import java.io.IOException;
-import java.io.OutputStream;
-import java.io.Writer;
-
-/**
- *
- */
-
-public final class Base64Binary {
- private static final char[] S_BASE64CHAR =
- {'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V',
- 'W', 'X', 'Y', 'Z', 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r',
- 's', 't', 'u', 'v', 'w', 'x', 'y', 'z', '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', '+', '/'};
-
- private static final char S_BASE64PAD = '=';
-
- private static final byte[] S_DECODETABLE = new byte[128];
-
- static {
- for (int i = 0; i < S_DECODETABLE.length; i++) {
- S_DECODETABLE[i] = Byte.MAX_VALUE; // 127
- }
- for (int i = 0; i < S_BASE64CHAR.length; i++) {
- // 0 to 63
- S_DECODETABLE[S_BASE64CHAR[i]] = (byte)i;
- }
- }
-
- private Base64Binary() {
- }
-
- /**
- *
- */
- public static byte[] decode(char[] data, int off, int len) {
- char[] ibuf = new char[4];
- int ibufcount = 0;
- byte[] obuf = new byte[len / 4 * 3 + 3];
- int obufcount = 0;
- for (int i = off; i < off + len; i++) {
- char ch = data[i];
- if (ch == S_BASE64PAD || ch < S_DECODETABLE.length && S_DECODETABLE[ch] != Byte.MAX_VALUE) {
- ibuf[ibufcount++] = ch;
- if (ibufcount == ibuf.length) {
- ibufcount = 0;
- obufcount += decode0(ibuf, obuf, obufcount);
- }
- }
- }
- if (obufcount == obuf.length) {
- return obuf;
- }
- byte[] ret = new byte[obufcount];
- System.arraycopy(obuf, 0, ret, 0, obufcount);
- return ret;
- }
-
- /**
- *
- */
- public static void decode(char[] data, int off, int len, OutputStream ostream) throws IOException {
- char[] ibuf = new char[4];
- int ibufcount = 0;
- byte[] obuf = new byte[3];
- for (int i = off; i < off + len; i++) {
- char ch = data[i];
- if (ch == S_BASE64PAD || ch < S_DECODETABLE.length && S_DECODETABLE[ch] != Byte.MAX_VALUE) {
- ibuf[ibufcount++] = ch;
- if (ibufcount == ibuf.length) {
- ibufcount = 0;
- int obufcount = decode0(ibuf, obuf, 0);
- ostream.write(obuf, 0, obufcount);
- }
- }
- }
- }
-
- /**
- *
- */
- public static byte[] decode(String data) {
- char[] ibuf = new char[4];
- int ibufcount = 0;
- byte[] obuf = new byte[data.length() / 4 * 3 + 3];
- int obufcount = 0;
- for (int i = 0; i < data.length(); i++) {
- char ch = data.charAt(i);
- if (ch == S_BASE64PAD || ch < S_DECODETABLE.length && S_DECODETABLE[ch] != Byte.MAX_VALUE) {
- ibuf[ibufcount++] = ch;
- if (ibufcount == ibuf.length) {
- ibufcount = 0;
- obufcount += decode0(ibuf, obuf, obufcount);
- }
- }
- }
- if (obufcount == obuf.length) {
- return obuf;
- }
- byte[] ret = new byte[obufcount];
- System.arraycopy(obuf, 0, ret, 0, obufcount);
- return ret;
- }
-
- /**
- *
- */
- public static void decode(String data, OutputStream ostream) throws IOException {
- char[] ibuf = new char[4];
- int ibufcount = 0;
- byte[] obuf = new byte[3];
- for (int i = 0; i < data.length(); i++) {
- char ch = data.charAt(i);
- if (ch == S_BASE64PAD || ch < S_DECODETABLE.length && S_DECODETABLE[ch] != Byte.MAX_VALUE) {
- ibuf[ibufcount++] = ch;
- if (ibufcount == ibuf.length) {
- ibufcount = 0;
- int obufcount = decode0(ibuf, obuf, 0);
- ostream.write(obuf, 0, obufcount);
- }
- }
- }
- }
-
- private static int decode0(char[] ibuf, byte[] obuf, int index) {
- int wp = index;
- int outlen = 3;
- if (ibuf[3] == S_BASE64PAD) {
- outlen = 2;
- }
- if (ibuf[2] == S_BASE64PAD) {
- outlen = 1;
- }
- int b0 = S_DECODETABLE[ibuf[0]];
- int b1 = S_DECODETABLE[ibuf[1]];
- int b2 = S_DECODETABLE[ibuf[2]];
- int b3 = S_DECODETABLE[ibuf[3]];
- switch (outlen) {
- case 1:
- obuf[wp] = (byte)(b0 << 2 & 0xfc | b1 >> 4 & 0x3);
- return 1;
- case 2:
- obuf[wp++] = (byte)(b0 << 2 & 0xfc | b1 >> 4 & 0x3);
- obuf[wp] = (byte)(b1 << 4 & 0xf0 | b2 >> 2 & 0xf);
- return 2;
- case 3:
- obuf[wp++] = (byte)(b0 << 2 & 0xfc | b1 >> 4 & 0x3);
- obuf[wp++] = (byte)(b1 << 4 & 0xf0 | b2 >> 2 & 0xf);
- obuf[wp] = (byte)(b2 << 6 & 0xc0 | b3 & 0x3f);
- return 3;
- default:
- throw new IllegalArgumentException("The character sequence is not base64 encoded.");
- }
- }
-
- /**
- * Returns base64 representation of specified byte array.
- */
- public static String encode(byte[] data) {
- return encode(data, 0, data.length);
- }
-
- /**
- * Returns base64 representation of specified byte array.
- */
- public static String encode(byte[] data, int off, int len) {
- if (len <= 0) {
- return "";
- }
- char[] out = new char[len / 3 * 4 + 4];
- int rindex = off;
- int windex = 0;
- int rest = len - off;
- while (rest >= 3) {
- int i = ((data[rindex] & 0xff) << 16) + ((data[rindex + 1] & 0xff) << 8) + (data[rindex + 2] & 0xff);
- out[windex++] = S_BASE64CHAR[i >> 18];
- out[windex++] = S_BASE64CHAR[(i >> 12) & 0x3f];
- out[windex++] = S_BASE64CHAR[(i >> 6) & 0x3f];
- out[windex++] = S_BASE64CHAR[i & 0x3f];
- rindex += 3;
- rest -= 3;
- }
- if (rest == 1) {
- int i = data[rindex] & 0xff;
- out[windex++] = S_BASE64CHAR[i >> 2];
- out[windex++] = S_BASE64CHAR[(i << 4) & 0x3f];
- out[windex++] = S_BASE64PAD;
- out[windex++] = S_BASE64PAD;
- } else if (rest == 2) {
- int i = ((data[rindex] & 0xff) << 8) + (data[rindex + 1] & 0xff);
- out[windex++] = S_BASE64CHAR[i >> 10];
- out[windex++] = S_BASE64CHAR[(i >> 4) & 0x3f];
- out[windex++] = S_BASE64CHAR[(i << 2) & 0x3f];
- out[windex++] = S_BASE64PAD;
- }
- return new String(out, 0, windex);
- }
-
- /**
- * Outputs base64 representation of the specified byte array to a byte stream.
- */
- public static void encode(byte[] data, int off, int len, OutputStream ostream) throws IOException {
- if (len <= 0) {
- return;
- }
- byte[] out = new byte[4];
- int rindex = off;
- int rest = len - off;
- while (rest >= 3) {
- int i = ((data[rindex] & 0xff) << 16) + ((data[rindex + 1] & 0xff) << 8) + (data[rindex + 2] & 0xff);
- out[0] = (byte)S_BASE64CHAR[i >> 18];
- out[1] = (byte)S_BASE64CHAR[(i >> 12) & 0x3f];
- out[2] = (byte)S_BASE64CHAR[(i >> 6) & 0x3f];
- out[3] = (byte)S_BASE64CHAR[i & 0x3f];
- ostream.write(out, 0, 4);
- rindex += 3;
- rest -= 3;
- }
- if (rest == 1) {
- int i = data[rindex] & 0xff;
- out[0] = (byte)S_BASE64CHAR[i >> 2];
- out[1] = (byte)S_BASE64CHAR[(i << 4) & 0x3f];
- out[2] = (byte)S_BASE64PAD;
- out[3] = (byte)S_BASE64PAD;
- ostream.write(out, 0, 4);
- } else if (rest == 2) {
- int i = ((data[rindex] & 0xff) << 8) + (data[rindex + 1] & 0xff);
- out[0] = (byte)S_BASE64CHAR[i >> 10];
- out[1] = (byte)S_BASE64CHAR[(i >> 4) & 0x3f];
- out[2] = (byte)S_BASE64CHAR[(i << 2) & 0x3f];
- out[3] = (byte)S_BASE64PAD;
- ostream.write(out, 0, 4);
- }
- }
-
- /**
- * Outputs base64 representation of the specified byte array to a character stream.
- */
- public static void encode(byte[] data, int off, int len, Writer writer) throws IOException {
- if (len <= 0) {
- return;
- }
- char[] out = new char[4];
- int rindex = off;
- int rest = len - off;
- int output = 0;
- while (rest >= 3) {
- int i = ((data[rindex] & 0xff) << 16) + ((data[rindex + 1] & 0xff) << 8) + (data[rindex + 2] & 0xff);
- out[0] = S_BASE64CHAR[i >> 18];
- out[1] = S_BASE64CHAR[(i >> 12) & 0x3f];
- out[2] = S_BASE64CHAR[(i >> 6) & 0x3f];
- out[3] = S_BASE64CHAR[i & 0x3f];
- writer.write(out, 0, 4);
- rindex += 3;
- rest -= 3;
- output += 4;
- if (output % 76 == 0) {
- writer.write("\n");
- }
- }
- if (rest == 1) {
- int i = data[rindex] & 0xff;
- out[0] = S_BASE64CHAR[i >> 2];
- out[1] = S_BASE64CHAR[(i << 4) & 0x3f];
- out[2] = S_BASE64PAD;
- out[3] = S_BASE64PAD;
- writer.write(out, 0, 4);
- } else if (rest == 2) {
- int i = ((data[rindex] & 0xff) << 8) + (data[rindex + 1] & 0xff);
- out[0] = S_BASE64CHAR[i >> 10];
- out[1] = S_BASE64CHAR[(i >> 4) & 0x3f];
- out[2] = S_BASE64CHAR[(i << 2) & 0x3f];
- out[3] = S_BASE64PAD;
- writer.write(out, 0, 4);
- }
- }
-}
diff --git a/branches/sca-java-2.0-M4/itest/service-reference/src/main/java/org/apache/tuscany/sca/itest/serviceref/CComponent.java b/branches/sca-java-2.0-M4/itest/service-reference/src/main/java/org/apache/tuscany/sca/itest/serviceref/CComponent.java
deleted file mode 100644
index fc15b632d2..0000000000
--- a/branches/sca-java-2.0-M4/itest/service-reference/src/main/java/org/apache/tuscany/sca/itest/serviceref/CComponent.java
+++ /dev/null
@@ -1,27 +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.sca.itest.serviceref;
-
-import org.oasisopen.sca.annotation.Remotable;
-
-@Remotable
-public interface CComponent {
-
- String foo();
-}
diff --git a/branches/sca-java-2.0-M4/itest/service-reference/src/main/java/org/apache/tuscany/sca/itest/serviceref/CComponentImpl.java b/branches/sca-java-2.0-M4/itest/service-reference/src/main/java/org/apache/tuscany/sca/itest/serviceref/CComponentImpl.java
deleted file mode 100644
index 276093b69f..0000000000
--- a/branches/sca-java-2.0-M4/itest/service-reference/src/main/java/org/apache/tuscany/sca/itest/serviceref/CComponentImpl.java
+++ /dev/null
@@ -1,30 +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.sca.itest.serviceref;
-
-import org.oasisopen.sca.annotation.Service;
-
-@Service(CComponent.class)
-public class CComponentImpl implements CComponent {
-
- public String foo() {
- return "CComponent";
- }
-
-}
diff --git a/branches/sca-java-2.0-M4/itest/service-reference/src/main/java/org/apache/tuscany/sca/itest/serviceref/DComponent.java b/branches/sca-java-2.0-M4/itest/service-reference/src/main/java/org/apache/tuscany/sca/itest/serviceref/DComponent.java
deleted file mode 100644
index 84e15b5eb2..0000000000
--- a/branches/sca-java-2.0-M4/itest/service-reference/src/main/java/org/apache/tuscany/sca/itest/serviceref/DComponent.java
+++ /dev/null
@@ -1,30 +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.sca.itest.serviceref;
-
-import org.oasisopen.sca.ServiceReference;
-import org.oasisopen.sca.annotation.Remotable;
-
-@Remotable
-public interface DComponent {
-
- String foo(ServiceReference<AComponent> aReference);
-
- String fooString(String aReferenceString);
-}
diff --git a/branches/sca-java-2.0-M4/itest/service-reference/src/main/java/org/apache/tuscany/sca/itest/serviceref/DComponentImpl.java b/branches/sca-java-2.0-M4/itest/service-reference/src/main/java/org/apache/tuscany/sca/itest/serviceref/DComponentImpl.java
deleted file mode 100644
index db99472385..0000000000
--- a/branches/sca-java-2.0-M4/itest/service-reference/src/main/java/org/apache/tuscany/sca/itest/serviceref/DComponentImpl.java
+++ /dev/null
@@ -1,64 +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.sca.itest.serviceref;
-
-import java.io.ByteArrayInputStream;
-import java.io.ByteArrayOutputStream;
-import java.io.ObjectInputStream;
-import java.io.ObjectOutputStream;
-
-import org.oasisopen.sca.RequestContext;
-import org.oasisopen.sca.ServiceReference;
-import org.oasisopen.sca.annotation.Context;
-import org.oasisopen.sca.annotation.Service;
-
-@Service(DComponent.class)
-public class DComponentImpl implements DComponent {
-
- @Context
- protected RequestContext requestContext;
-
- public String foo(ServiceReference<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 = (ServiceReference<AComponent>) obj;
- } catch (Exception e) {
- e.printStackTrace();
- }
- System.out.println("Invoking service: " + requestContext.getServiceName());
- return "D" + aReference.getService().foo();
- }
-
- public String fooString(String aReferenceString) {
- ServiceReference<AComponent> aReference = null;
- try {
- ObjectInputStream ois = new ObjectInputStream(new ByteArrayInputStream(Base64Binary.decode(aReferenceString)));
- Object obj = ois.readObject();
- aReference = (ServiceReference<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-2.0-M4/itest/service-reference/src/main/resources/nodeA/CompositeA.composite b/branches/sca-java-2.0-M4/itest/service-reference/src/main/resources/nodeA/CompositeA.composite
deleted file mode 100644
index fb88cd8bea..0000000000
--- a/branches/sca-java-2.0-M4/itest/service-reference/src/main/resources/nodeA/CompositeA.composite
+++ /dev/null
@@ -1,44 +0,0 @@
-<?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://docs.oasis-open.org/ns/opencsa/sca/200903"
- xmlns:foo="http://foo"
- targetNamespace="http://foo"
- name="CompositeA"
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
-
- <component name="AComponent">
- <implementation.java class="org.apache.tuscany.sca.itest.serviceref.AComponentImpl" />
- <service name="AComponent">
- <binding.ws uri="http://localhost:8084/AComponent"/>
- </service>
- <reference name="bReference">
- <binding.ws uri="http://localhost:8085/BComponent" />
- </reference>
- <reference name="cReference">
- <binding.ws uri="http://localhost:8085/CComponent" />
- </reference>
- <reference name="cServiceReference">
- <binding.ws uri="http://localhost:8085/CComponent" />
- </reference>
- <reference name="dReference1">
- <binding.ws uri="http://localhost:8085/DComponent" />
- </reference>
- </component>
-
-</composite> \ No newline at end of file
diff --git a/branches/sca-java-2.0-M4/itest/service-reference/src/main/resources/nodeB/CompositeB.composite b/branches/sca-java-2.0-M4/itest/service-reference/src/main/resources/nodeB/CompositeB.composite
deleted file mode 100644
index 06e4c63e94..0000000000
--- a/branches/sca-java-2.0-M4/itest/service-reference/src/main/resources/nodeB/CompositeB.composite
+++ /dev/null
@@ -1,46 +0,0 @@
-<?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://docs.oasis-open.org/ns/opencsa/sca/200903"
- 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.serviceref.BComponentImpl" />
- <service name="BComponent">
- <binding.ws uri="http://localhost:8085/BComponent"/>
- </service>
- </component>
-
- <component name="CComponent">
- <implementation.java class="org.apache.tuscany.sca.itest.serviceref.CComponentImpl" />
- <service name="CComponent">
- <binding.ws uri="http://localhost:8085/CComponent"/>
- </service>
- </component>
-
- <component name="DComponent">
- <implementation.java class="org.apache.tuscany.sca.itest.serviceref.DComponentImpl" />
- <service name="DComponent">
- <binding.ws uri="http://localhost:8085/DComponent"/>
- </service>
- </component>
-
-</composite> \ No newline at end of file
diff --git a/branches/sca-java-2.0-M4/itest/service-reference/src/main/resources/servicereference/ServiceReferenceTest.composite b/branches/sca-java-2.0-M4/itest/service-reference/src/main/resources/servicereference/ServiceReferenceTest.composite
deleted file mode 100644
index 63302847b5..0000000000
--- a/branches/sca-java-2.0-M4/itest/service-reference/src/main/resources/servicereference/ServiceReferenceTest.composite
+++ /dev/null
@@ -1,48 +0,0 @@
-<?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://docs.oasis-open.org/ns/opencsa/sca/200903"
- 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.serviceref.AComponent" />
- </service>
-
- <component name="AComponent">
- <implementation.java class="org.apache.tuscany.sca.itest.serviceref.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.serviceref.BComponentImpl" />
- </component>
-
- <component name="CComponent">
- <implementation.java class="org.apache.tuscany.sca.itest.serviceref.CComponentImpl" />
- </component>
-
- <component name="DComponent">
- <implementation.java class="org.apache.tuscany.sca.itest.serviceref.DComponentImpl" />
- </component>
-</composite> \ No newline at end of file
diff --git a/branches/sca-java-2.0-M4/itest/service-reference/src/test/java/org/apache/tuscany/sca/itest/serviceref/CallableReferenceRemoteTestCase.java b/branches/sca-java-2.0-M4/itest/service-reference/src/test/java/org/apache/tuscany/sca/itest/serviceref/CallableReferenceRemoteTestCase.java
deleted file mode 100644
index 843afe207c..0000000000
--- a/branches/sca-java-2.0-M4/itest/service-reference/src/test/java/org/apache/tuscany/sca/itest/serviceref/CallableReferenceRemoteTestCase.java
+++ /dev/null
@@ -1,139 +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.sca.itest.serviceref;
-
-import static junit.framework.Assert.assertEquals;
-
-import junit.framework.Assert;
-
-import org.apache.tuscany.sca.itest.serviceref.AComponent;
-import org.apache.tuscany.sca.node.Contribution;
-import org.apache.tuscany.sca.node.Node;
-import org.apache.tuscany.sca.node.NodeFactory;
-import org.junit.AfterClass;
-import org.junit.BeforeClass;
-import org.junit.Ignore;
-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 Node nodeA;
- private static Node nodeB;
-
- private static AComponent acomponent;
-
- @BeforeClass
- public static void init() throws Exception {
-
- try {
-
- System.out.println("Setting up nodes");
-
- NodeFactory nodeFactory = NodeFactory.newInstance();
-
- nodeA = nodeFactory.createNode("nodeA/CompositeA.composite", new Contribution("contrib","target/classes"));
- nodeA.start();
-
- nodeB = nodeFactory.createNode("nodeB/CompositeB.composite", new Contribution("contrib","target/classes"));
- nodeB.start();
-
- acomponent = nodeA.getService(AComponent.class, "AComponent/AComponent");
-
- } catch (Throwable ex) {
- System.out.println(ex.toString());
- // Print detailed cause information.
- ex.printStackTrace();
- StringBuffer sb = new StringBuffer();
- Throwable cause = ex.getCause();
- while ( cause != null ) {
- sb.append( " " );
- System.out.println( sb.toString() + "Cause: " + cause );
- if (cause instanceof java.lang.reflect.InvocationTargetException)
- System.out.println( sb.toString() + "Target Exception: " + ((java.lang.reflect.InvocationTargetException)cause).getTargetException() );
- cause = cause.getCause();
- }
- }
- }
-
- @AfterClass
- public static void destroy() throws Exception {
- // stop the nodes and hence the domains they contain
- nodeA.stop();
- nodeB.stop();
- }
-
- //@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
- @Ignore
- public void testDReference() {
- assertEquals("DAComponent", acomponent.fooD());
- }
-
-
- @Test
- @Ignore
- public void testBCReference() {
- assertEquals("BCComponent", acomponent.fooBC());
- }
-
- @Test
- public void testRequiredFalseReference() {
- try {
- acomponent.invokeDReference();
- } catch (Exception e) {
- Assert.assertTrue(true);
- }
- }
-
-}
diff --git a/branches/sca-java-2.0-M4/itest/service-reference/src/test/java/org/apache/tuscany/sca/itest/serviceref/ServiceReferenceTestCase.java b/branches/sca-java-2.0-M4/itest/service-reference/src/test/java/org/apache/tuscany/sca/itest/serviceref/ServiceReferenceTestCase.java
deleted file mode 100644
index 1a454c939a..0000000000
--- a/branches/sca-java-2.0-M4/itest/service-reference/src/test/java/org/apache/tuscany/sca/itest/serviceref/ServiceReferenceTestCase.java
+++ /dev/null
@@ -1,88 +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.sca.itest.serviceref;
-
-import static junit.framework.Assert.assertEquals;
-import junit.framework.Assert;
-
-import org.apache.tuscany.sca.itest.serviceref.AComponent;
-import org.apache.tuscany.sca.node.Contribution;
-import org.apache.tuscany.sca.node.Node;
-import org.apache.tuscany.sca.node.NodeFactory;
-import org.junit.AfterClass;
-import org.junit.BeforeClass;
-import org.junit.Test;
-
-public class ServiceReferenceTestCase {
- private static Node node;
- private static AComponent acomponent;
-
- @BeforeClass
- public static void init() throws Exception {
- node = NodeFactory.newInstance().createNode("ServiceReferenceTest.composite",
- new Contribution("contrib","src/main/resources/servicereference"));
- node.start();
- acomponent = node.getService(AComponent.class, "AComponent");
- }
-
- @AfterClass
- public static void destroy() throws Exception {
- node.stop();
- }
-
- @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.invokeDReference();
- } catch (Exception e) {
- Assert.assertTrue(true);
- }
- }
-
-}