From 04dcd09976ecc5aa2948993b9a9a2d90d239ee44 Mon Sep 17 00:00:00 2001 From: antelder Date: Thu, 28 Jul 2011 10:58:07 +0000 Subject: Delete old beta3 branch as its going to be recreated from the current trunk git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@1151789 13f79535-47bb-0310-9956-ffa450edef68 --- .../testing/itest/service-reference/pom.xml | 51 ---- .../tuscany/sca/itest/serviceref/AComponent.java | 39 --- .../sca/itest/serviceref/AComponentImpl.java | 112 -------- .../tuscany/sca/itest/serviceref/BComponent.java | 31 --- .../sca/itest/serviceref/BComponentImpl.java | 38 --- .../tuscany/sca/itest/serviceref/Base64Binary.java | 297 --------------------- .../tuscany/sca/itest/serviceref/CComponent.java | 27 -- .../sca/itest/serviceref/CComponentImpl.java | 30 --- .../tuscany/sca/itest/serviceref/DComponent.java | 30 --- .../sca/itest/serviceref/DComponentImpl.java | 64 ----- .../src/main/resources/nodeA/CompositeA.composite | 44 --- .../src/main/resources/nodeB/CompositeB.composite | 46 ---- .../ServiceReferenceTest.composite | 48 ---- .../CallableReferenceRemoteTestCase.java | 139 ---------- .../itest/serviceref/ServiceReferenceTestCase.java | 88 ------ 15 files changed, 1084 deletions(-) delete mode 100644 sca-java-2.x/branches/2.0-Beta3/testing/itest/service-reference/pom.xml delete mode 100644 sca-java-2.x/branches/2.0-Beta3/testing/itest/service-reference/src/main/java/org/apache/tuscany/sca/itest/serviceref/AComponent.java delete mode 100644 sca-java-2.x/branches/2.0-Beta3/testing/itest/service-reference/src/main/java/org/apache/tuscany/sca/itest/serviceref/AComponentImpl.java delete mode 100644 sca-java-2.x/branches/2.0-Beta3/testing/itest/service-reference/src/main/java/org/apache/tuscany/sca/itest/serviceref/BComponent.java delete mode 100644 sca-java-2.x/branches/2.0-Beta3/testing/itest/service-reference/src/main/java/org/apache/tuscany/sca/itest/serviceref/BComponentImpl.java delete mode 100644 sca-java-2.x/branches/2.0-Beta3/testing/itest/service-reference/src/main/java/org/apache/tuscany/sca/itest/serviceref/Base64Binary.java delete mode 100644 sca-java-2.x/branches/2.0-Beta3/testing/itest/service-reference/src/main/java/org/apache/tuscany/sca/itest/serviceref/CComponent.java delete mode 100644 sca-java-2.x/branches/2.0-Beta3/testing/itest/service-reference/src/main/java/org/apache/tuscany/sca/itest/serviceref/CComponentImpl.java delete mode 100644 sca-java-2.x/branches/2.0-Beta3/testing/itest/service-reference/src/main/java/org/apache/tuscany/sca/itest/serviceref/DComponent.java delete mode 100644 sca-java-2.x/branches/2.0-Beta3/testing/itest/service-reference/src/main/java/org/apache/tuscany/sca/itest/serviceref/DComponentImpl.java delete mode 100644 sca-java-2.x/branches/2.0-Beta3/testing/itest/service-reference/src/main/resources/nodeA/CompositeA.composite delete mode 100644 sca-java-2.x/branches/2.0-Beta3/testing/itest/service-reference/src/main/resources/nodeB/CompositeB.composite delete mode 100644 sca-java-2.x/branches/2.0-Beta3/testing/itest/service-reference/src/main/resources/servicereference/ServiceReferenceTest.composite delete mode 100644 sca-java-2.x/branches/2.0-Beta3/testing/itest/service-reference/src/test/java/org/apache/tuscany/sca/itest/serviceref/CallableReferenceRemoteTestCase.java delete mode 100644 sca-java-2.x/branches/2.0-Beta3/testing/itest/service-reference/src/test/java/org/apache/tuscany/sca/itest/serviceref/ServiceReferenceTestCase.java (limited to 'sca-java-2.x/branches/2.0-Beta3/testing/itest/service-reference') diff --git a/sca-java-2.x/branches/2.0-Beta3/testing/itest/service-reference/pom.xml b/sca-java-2.x/branches/2.0-Beta3/testing/itest/service-reference/pom.xml deleted file mode 100644 index 2f2dbf1f19..0000000000 --- a/sca-java-2.x/branches/2.0-Beta3/testing/itest/service-reference/pom.xml +++ /dev/null @@ -1,51 +0,0 @@ - - - - 4.0.0 - - org.apache.tuscany.sca - tuscany-itest - 2.0-Beta3-SNAPSHOT - ../pom.xml - - itest-service-reference - Apache Tuscany SCA iTest ServiceReference - - - - org.apache.tuscany.sca - tuscany-base-runtime-pom - pom - 2.0-Beta3-SNAPSHOT - - - - org.apache.tuscany.sca - tuscany-binding-ws-runtime-axis2 - 2.0-Beta3-SNAPSHOT - - - - org.mortbay.jetty - jetty - 6.1.19 - - - diff --git a/sca-java-2.x/branches/2.0-Beta3/testing/itest/service-reference/src/main/java/org/apache/tuscany/sca/itest/serviceref/AComponent.java b/sca-java-2.x/branches/2.0-Beta3/testing/itest/service-reference/src/main/java/org/apache/tuscany/sca/itest/serviceref/AComponent.java deleted file mode 100644 index 8b5cf4d29a..0000000000 --- a/sca-java-2.x/branches/2.0-Beta3/testing/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/sca-java-2.x/branches/2.0-Beta3/testing/itest/service-reference/src/main/java/org/apache/tuscany/sca/itest/serviceref/AComponentImpl.java b/sca-java-2.x/branches/2.0-Beta3/testing/itest/service-reference/src/main/java/org/apache/tuscany/sca/itest/serviceref/AComponentImpl.java deleted file mode 100644 index 3f68ac828a..0000000000 --- a/sca-java-2.x/branches/2.0-Beta3/testing/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 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 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 cReference = componentContext.getServiceReference(CComponent.class, "cReference"); - return b.fooC(cReference); - } - - public String fooD() { - ServiceReference 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 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/sca-java-2.x/branches/2.0-Beta3/testing/itest/service-reference/src/main/java/org/apache/tuscany/sca/itest/serviceref/BComponent.java b/sca-java-2.x/branches/2.0-Beta3/testing/itest/service-reference/src/main/java/org/apache/tuscany/sca/itest/serviceref/BComponent.java deleted file mode 100644 index 18242cd594..0000000000 --- a/sca-java-2.x/branches/2.0-Beta3/testing/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); -} diff --git a/sca-java-2.x/branches/2.0-Beta3/testing/itest/service-reference/src/main/java/org/apache/tuscany/sca/itest/serviceref/BComponentImpl.java b/sca-java-2.x/branches/2.0-Beta3/testing/itest/service-reference/src/main/java/org/apache/tuscany/sca/itest/serviceref/BComponentImpl.java deleted file mode 100644 index dd143df036..0000000000 --- a/sca-java-2.x/branches/2.0-Beta3/testing/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 cReference) { - return "B" + cReference.getService().foo(); - } - -} diff --git a/sca-java-2.x/branches/2.0-Beta3/testing/itest/service-reference/src/main/java/org/apache/tuscany/sca/itest/serviceref/Base64Binary.java b/sca-java-2.x/branches/2.0-Beta3/testing/itest/service-reference/src/main/java/org/apache/tuscany/sca/itest/serviceref/Base64Binary.java deleted file mode 100644 index fb436ae10c..0000000000 --- a/sca-java-2.x/branches/2.0-Beta3/testing/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/sca-java-2.x/branches/2.0-Beta3/testing/itest/service-reference/src/main/java/org/apache/tuscany/sca/itest/serviceref/CComponent.java b/sca-java-2.x/branches/2.0-Beta3/testing/itest/service-reference/src/main/java/org/apache/tuscany/sca/itest/serviceref/CComponent.java deleted file mode 100644 index fc15b632d2..0000000000 --- a/sca-java-2.x/branches/2.0-Beta3/testing/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/sca-java-2.x/branches/2.0-Beta3/testing/itest/service-reference/src/main/java/org/apache/tuscany/sca/itest/serviceref/CComponentImpl.java b/sca-java-2.x/branches/2.0-Beta3/testing/itest/service-reference/src/main/java/org/apache/tuscany/sca/itest/serviceref/CComponentImpl.java deleted file mode 100644 index 276093b69f..0000000000 --- a/sca-java-2.x/branches/2.0-Beta3/testing/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/sca-java-2.x/branches/2.0-Beta3/testing/itest/service-reference/src/main/java/org/apache/tuscany/sca/itest/serviceref/DComponent.java b/sca-java-2.x/branches/2.0-Beta3/testing/itest/service-reference/src/main/java/org/apache/tuscany/sca/itest/serviceref/DComponent.java deleted file mode 100644 index 84e15b5eb2..0000000000 --- a/sca-java-2.x/branches/2.0-Beta3/testing/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 aReference); - - String fooString(String aReferenceString); -} diff --git a/sca-java-2.x/branches/2.0-Beta3/testing/itest/service-reference/src/main/java/org/apache/tuscany/sca/itest/serviceref/DComponentImpl.java b/sca-java-2.x/branches/2.0-Beta3/testing/itest/service-reference/src/main/java/org/apache/tuscany/sca/itest/serviceref/DComponentImpl.java deleted file mode 100644 index db99472385..0000000000 --- a/sca-java-2.x/branches/2.0-Beta3/testing/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 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) obj; - } catch (Exception e) { - e.printStackTrace(); - } - System.out.println("Invoking service: " + requestContext.getServiceName()); - return "D" + aReference.getService().foo(); - } - - public String fooString(String aReferenceString) { - ServiceReference aReference = null; - try { - ObjectInputStream ois = new ObjectInputStream(new ByteArrayInputStream(Base64Binary.decode(aReferenceString))); - Object obj = ois.readObject(); - aReference = (ServiceReference) obj; - } catch (Exception e) { - e.printStackTrace(); - } - System.out.println("Invoking service: " + requestContext.getServiceName()); - return "D" + aReference.getService().foo(); - } -} diff --git a/sca-java-2.x/branches/2.0-Beta3/testing/itest/service-reference/src/main/resources/nodeA/CompositeA.composite b/sca-java-2.x/branches/2.0-Beta3/testing/itest/service-reference/src/main/resources/nodeA/CompositeA.composite deleted file mode 100644 index 9a1fa0a7f7..0000000000 --- a/sca-java-2.x/branches/2.0-Beta3/testing/itest/service-reference/src/main/resources/nodeA/CompositeA.composite +++ /dev/null @@ -1,44 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/sca-java-2.x/branches/2.0-Beta3/testing/itest/service-reference/src/main/resources/nodeB/CompositeB.composite b/sca-java-2.x/branches/2.0-Beta3/testing/itest/service-reference/src/main/resources/nodeB/CompositeB.composite deleted file mode 100644 index a72f5949ed..0000000000 --- a/sca-java-2.x/branches/2.0-Beta3/testing/itest/service-reference/src/main/resources/nodeB/CompositeB.composite +++ /dev/null @@ -1,46 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/sca-java-2.x/branches/2.0-Beta3/testing/itest/service-reference/src/main/resources/servicereference/ServiceReferenceTest.composite b/sca-java-2.x/branches/2.0-Beta3/testing/itest/service-reference/src/main/resources/servicereference/ServiceReferenceTest.composite deleted file mode 100644 index bc5ede7605..0000000000 --- a/sca-java-2.x/branches/2.0-Beta3/testing/itest/service-reference/src/main/resources/servicereference/ServiceReferenceTest.composite +++ /dev/null @@ -1,48 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/sca-java-2.x/branches/2.0-Beta3/testing/itest/service-reference/src/test/java/org/apache/tuscany/sca/itest/serviceref/CallableReferenceRemoteTestCase.java b/sca-java-2.x/branches/2.0-Beta3/testing/itest/service-reference/src/test/java/org/apache/tuscany/sca/itest/serviceref/CallableReferenceRemoteTestCase.java deleted file mode 100644 index 843afe207c..0000000000 --- a/sca-java-2.x/branches/2.0-Beta3/testing/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/sca-java-2.x/branches/2.0-Beta3/testing/itest/service-reference/src/test/java/org/apache/tuscany/sca/itest/serviceref/ServiceReferenceTestCase.java b/sca-java-2.x/branches/2.0-Beta3/testing/itest/service-reference/src/test/java/org/apache/tuscany/sca/itest/serviceref/ServiceReferenceTestCase.java deleted file mode 100644 index 1a454c939a..0000000000 --- a/sca-java-2.x/branches/2.0-Beta3/testing/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); - } - } - -} -- cgit v1.2.3