diff options
Diffstat (limited to 'sandbox/wjaniszewski/binding-erlang-runtime/src/test/java/org/apache/tuscany')
14 files changed, 421 insertions, 139 deletions
diff --git a/sandbox/wjaniszewski/binding-erlang-runtime/src/test/java/org/apache/tuscany/sca/binding/erlang/testing/MboxInterface.java b/sandbox/wjaniszewski/binding-erlang-runtime/src/test/java/org/apache/tuscany/sca/binding/erlang/testing/MboxInterface.java index d7ac443055..0f477fe660 100644 --- a/sandbox/wjaniszewski/binding-erlang-runtime/src/test/java/org/apache/tuscany/sca/binding/erlang/testing/MboxInterface.java +++ b/sandbox/wjaniszewski/binding-erlang-runtime/src/test/java/org/apache/tuscany/sca/binding/erlang/testing/MboxInterface.java @@ -1,30 +1,52 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + package org.apache.tuscany.sca.binding.erlang.testing; +/** + * @version $Rev$ $Date$ + */ public interface MboxInterface { - String sendArgs(String arg) throws Exception; + String sendArgs(String arg) throws Exception; + + boolean sendArgs(boolean arg) throws Exception; + + float sendArgs(float arg) throws Exception; + + double sendArgs(double arg) throws Exception; - boolean sendArgs(boolean arg) throws Exception; + long sendArgs(long arg) throws Exception; - float sendArgs(float arg) throws Exception; + int sendArgs(int arg) throws Exception; - double sendArgs(double arg) throws Exception; + char sendArgs(char arg) throws Exception; - long sendArgs(long arg) throws Exception; + short sendArgs(short arg) throws Exception; - int sendArgs(int arg) throws Exception; + byte sendArgs(byte arg) throws Exception; - char sendArgs(char arg) throws Exception; + void sendArgs(int arg1, String arg2) throws Exception; - short sendArgs(short arg) throws Exception; + StructuredTuple sendArgs(StructuredTuple arg) throws Exception; - byte sendArgs(byte arg) throws Exception; - - void sendArgs(int arg1, String arg2) throws Exception; - - StructuredTuple sendArgs(StructuredTuple arg) throws Exception; + String[] sendArgs(String[] arg) throws Exception; - String[] sendArgs(String[] arg) throws Exception; - - String[][] sendArgs(String[][] arg); + String[][] sendArgs(String[][] arg); } diff --git a/sandbox/wjaniszewski/binding-erlang-runtime/src/test/java/org/apache/tuscany/sca/binding/erlang/testing/MboxListener.java b/sandbox/wjaniszewski/binding-erlang-runtime/src/test/java/org/apache/tuscany/sca/binding/erlang/testing/MboxListener.java index b5d5e67b00..e64728b01e 100644 --- a/sandbox/wjaniszewski/binding-erlang-runtime/src/test/java/org/apache/tuscany/sca/binding/erlang/testing/MboxListener.java +++ b/sandbox/wjaniszewski/binding-erlang-runtime/src/test/java/org/apache/tuscany/sca/binding/erlang/testing/MboxListener.java @@ -25,6 +25,9 @@ import com.ericsson.otp.erlang.OtpErlangExit; import com.ericsson.otp.erlang.OtpMbox; import com.ericsson.otp.erlang.OtpMsg; +/** + * @version $Rev$ $Date$ + */ public class MboxListener implements Runnable { private OtpMbox mbox; @@ -39,7 +42,6 @@ public class MboxListener implements Runnable { public void run() { try { msg = mbox.receiveMsg(); - if (response != null) { Object[] args = new Object[1]; args[0] = response; diff --git a/sandbox/wjaniszewski/binding-erlang-runtime/src/test/java/org/apache/tuscany/sca/binding/erlang/testing/ModuleInterface.java b/sandbox/wjaniszewski/binding-erlang-runtime/src/test/java/org/apache/tuscany/sca/binding/erlang/testing/ModuleInterface.java index 7d3fc99f26..6fc95ac120 100644 --- a/sandbox/wjaniszewski/binding-erlang-runtime/src/test/java/org/apache/tuscany/sca/binding/erlang/testing/ModuleInterface.java +++ b/sandbox/wjaniszewski/binding-erlang-runtime/src/test/java/org/apache/tuscany/sca/binding/erlang/testing/ModuleInterface.java @@ -1,9 +1,31 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + package org.apache.tuscany.sca.binding.erlang.testing; +/** + * @version $Rev$ $Date$ + */ public interface ModuleInterface { - String start(String arg1, String arg2) throws Exception; - - String start() throws Exception; + String start(String arg1, String arg2) throws Exception; + + String start() throws Exception; } diff --git a/sandbox/wjaniszewski/binding-erlang-runtime/src/test/java/org/apache/tuscany/sca/binding/erlang/testing/ReferenceServiceTestCase.java b/sandbox/wjaniszewski/binding-erlang-runtime/src/test/java/org/apache/tuscany/sca/binding/erlang/testing/ReferenceServiceTestCase.java index 34efb04812..2312c5ebea 100644 --- a/sandbox/wjaniszewski/binding-erlang-runtime/src/test/java/org/apache/tuscany/sca/binding/erlang/testing/ReferenceServiceTestCase.java +++ b/sandbox/wjaniszewski/binding-erlang-runtime/src/test/java/org/apache/tuscany/sca/binding/erlang/testing/ReferenceServiceTestCase.java @@ -36,15 +36,21 @@ import org.junit.runner.RunWith; import org.osoa.sca.ServiceRuntimeException; import com.ericsson.otp.erlang.OtpErlangAtom; +import com.ericsson.otp.erlang.OtpErlangBoolean; import com.ericsson.otp.erlang.OtpErlangDouble; +import com.ericsson.otp.erlang.OtpErlangInt; import com.ericsson.otp.erlang.OtpErlangList; import com.ericsson.otp.erlang.OtpErlangLong; +import com.ericsson.otp.erlang.OtpErlangObject; import com.ericsson.otp.erlang.OtpErlangString; import com.ericsson.otp.erlang.OtpErlangTuple; import com.ericsson.otp.erlang.OtpMbox; import com.ericsson.otp.erlang.OtpNode; -//this test runner will ignore tests if epmd is not available +/** + * Test is annotated with test runner, which will ignore tests if epmd is not available + * @version $Rev$ $Date$ + */ @RunWith(IgnorableRunner.class) public class ReferenceServiceTestCase { @@ -53,8 +59,10 @@ public class ReferenceServiceTestCase { private static MboxInterface mboxReference; private static ServiceInterface moduleReference; private static ServiceInterface clonedModuleReference; - private static OtpNode node; - private static OtpMbox mbox; + private static OtpNode serNode; + private static OtpMbox serMbox; + private static OtpNode refNode; + private static OtpMbox refMbox; private static Process epmdProcess; @BeforeClass @@ -69,8 +77,10 @@ public class ReferenceServiceTestCase { mboxReference = component.getMboxReference(); moduleReference = component.getModuleReference(); clonedModuleReference = component.getClonedModuleReference(); - node = new OtpNode("MboxServer"); - mbox = node.createMbox("sendArgs"); + serNode = new OtpNode("MboxServer"); + serMbox = serNode.createMbox("sendArgs"); + refNode = new OtpNode("MboxClient"); + refMbox = refNode.createMbox("connector_to_SCA_mbox"); } catch (IOException e) { System.out.println("Problem executing " + EPMD_COMMAND + ": " + e.getLocalizedMessage() + ". Tests will be IGNORED."); @@ -100,7 +110,7 @@ public class ReferenceServiceTestCase { public void testStrings() throws Exception { String strArg = "Test message"; String strResult = "OK"; - MboxListener mboxListener = new MboxListener(mbox, strResult); + MboxListener mboxListener = new MboxListener(serMbox, strResult); Thread mboxThread = new Thread(mboxListener); mboxThread.start(); String testResult = mboxReference.sendArgs(strArg); @@ -118,7 +128,7 @@ public class ReferenceServiceTestCase { public void testBooleans() throws Exception { boolean booleanArg = true; boolean booleanResult = false; - MboxListener mboxListener = new MboxListener(mbox, booleanResult); + MboxListener mboxListener = new MboxListener(serMbox, booleanResult); Thread mboxThread = new Thread(mboxListener); mboxThread.start(); boolean testResult = mboxReference.sendArgs(booleanArg); @@ -136,7 +146,7 @@ public class ReferenceServiceTestCase { public void testFloats() throws Exception { float floatArg = 1.0f; float floatResult = 2.0f; - MboxListener mboxListener = new MboxListener(mbox, floatResult); + MboxListener mboxListener = new MboxListener(serMbox, floatResult); Thread mboxThread = new Thread(mboxListener); mboxThread.start(); float testResult = mboxReference.sendArgs(floatArg); @@ -154,7 +164,7 @@ public class ReferenceServiceTestCase { public void testDoubles() throws Exception { double doubleArg = 1.0f; double doubleResult = 2.0f; - MboxListener mboxListener = new MboxListener(mbox, doubleResult); + MboxListener mboxListener = new MboxListener(serMbox, doubleResult); Thread mboxThread = new Thread(mboxListener); mboxThread.start(); double testResult = mboxReference.sendArgs(doubleArg); @@ -172,7 +182,7 @@ public class ReferenceServiceTestCase { public void testLongs() throws Exception { long longArg = 1; long longResult = 2; - MboxListener mboxListener = new MboxListener(mbox, longResult); + MboxListener mboxListener = new MboxListener(serMbox, longResult); Thread mboxThread = new Thread(mboxListener); mboxThread.start(); long testResult = mboxReference.sendArgs(longArg); @@ -190,7 +200,7 @@ public class ReferenceServiceTestCase { public void testInts() throws Exception { int intArg = 1; int intResult = 2; - MboxListener mboxListener = new MboxListener(mbox, intResult); + MboxListener mboxListener = new MboxListener(serMbox, intResult); Thread mboxThread = new Thread(mboxListener); mboxThread.start(); int testResult = mboxReference.sendArgs(intArg); @@ -208,7 +218,7 @@ public class ReferenceServiceTestCase { public void testChars() throws Exception { char charArg = 1; char charResult = 2; - MboxListener mboxListener = new MboxListener(mbox, charResult); + MboxListener mboxListener = new MboxListener(serMbox, charResult); Thread mboxThread = new Thread(mboxListener); mboxThread.start(); char testResult = mboxReference.sendArgs(charArg); @@ -226,7 +236,7 @@ public class ReferenceServiceTestCase { public void testShorts() throws Exception { short shortArg = 1; short shortResult = 2; - MboxListener mboxListener = new MboxListener(mbox, shortResult); + MboxListener mboxListener = new MboxListener(serMbox, shortResult); Thread mboxThread = new Thread(mboxListener); mboxThread.start(); short testResult = mboxReference.sendArgs(shortArg); @@ -244,7 +254,7 @@ public class ReferenceServiceTestCase { public void testBytes() throws Exception { byte byteArg = 1; byte byteResult = 2; - MboxListener mboxListener = new MboxListener(mbox, byteResult); + MboxListener mboxListener = new MboxListener(serMbox, byteResult); Thread mboxThread = new Thread(mboxListener); mboxThread.start(); byte testResult = mboxReference.sendArgs(byteArg); @@ -260,7 +270,7 @@ public class ReferenceServiceTestCase { */ @Test(timeout = 1000) public void testMultipleArguments() throws Exception { - MboxListener mboxListener = new MboxListener(mbox, true); + MboxListener mboxListener = new MboxListener(serMbox, true); Thread mboxThread = new Thread(mboxListener); mboxThread.start(); String testString = "TupleString"; @@ -285,7 +295,7 @@ public class ReferenceServiceTestCase { tupleResult.arg1.arg2 = "Tuple inside tuple"; tupleResult.arg2 = "Tuple!"; tupleResult.arg3 = true; - MboxListener mboxListener = new MboxListener(mbox, tupleResult); + MboxListener mboxListener = new MboxListener(serMbox, tupleResult); Thread mboxThread = new Thread(mboxListener); mboxThread.start(); StructuredTuple testArg = new StructuredTuple(); @@ -317,7 +327,7 @@ public class ReferenceServiceTestCase { @Test(timeout = 1000) public void testLists() throws Exception { String[] testArg = new String[] { "One", "Two", "Three" }; - MboxListener mboxListener = new MboxListener(mbox, testArg); + MboxListener mboxListener = new MboxListener(serMbox, testArg); Thread mboxThread = new Thread(mboxListener); mboxThread.start(); String[] testResult = mboxReference.sendArgs(testArg); @@ -342,7 +352,7 @@ public class ReferenceServiceTestCase { public void testMultiDimLists() throws Exception { String[][] testArg = new String[][] { { "One", "Two" }, { "Three", "Four", "Five" }, { "Six" } }; - MboxListener mboxListener = new MboxListener(mbox, testArg); + MboxListener mboxListener = new MboxListener(serMbox, testArg); Thread mboxThread = new Thread(mboxListener); mboxThread.start(); String[][] testResult = mboxReference.sendArgs(testArg); @@ -372,7 +382,7 @@ public class ReferenceServiceTestCase { public void typeMismatch() throws Exception { try { StructuredTuple arg = new StructuredTuple(); - MboxListener mboxListener = new MboxListener(mbox, true); + MboxListener mboxListener = new MboxListener(serMbox, true); Thread mboxThread = new Thread(mboxListener); mboxThread.start(); mboxReference.sendArgs(arg); @@ -383,7 +393,7 @@ public class ReferenceServiceTestCase { try { String[] arg = new String[] { "test" }; - MboxListener mboxListener = new MboxListener(mbox, true); + MboxListener mboxListener = new MboxListener(serMbox, true); Thread mboxThread = new Thread(mboxListener); mboxThread.start(); mboxReference.sendArgs(arg); @@ -394,7 +404,7 @@ public class ReferenceServiceTestCase { try { long arg = 1; - MboxListener mboxListener = new MboxListener(mbox, true); + MboxListener mboxListener = new MboxListener(serMbox, true); Thread mboxThread = new Thread(mboxListener); mboxThread.start(); mboxReference.sendArgs(arg); @@ -405,7 +415,7 @@ public class ReferenceServiceTestCase { try { int arg = 1; - MboxListener mboxListener = new MboxListener(mbox, true); + MboxListener mboxListener = new MboxListener(serMbox, true); Thread mboxThread = new Thread(mboxListener); mboxThread.start(); mboxReference.sendArgs(arg); @@ -416,7 +426,7 @@ public class ReferenceServiceTestCase { try { short arg = 1; - MboxListener mboxListener = new MboxListener(mbox, true); + MboxListener mboxListener = new MboxListener(serMbox, true); Thread mboxThread = new Thread(mboxListener); mboxThread.start(); mboxReference.sendArgs(arg); @@ -427,7 +437,7 @@ public class ReferenceServiceTestCase { try { char arg = 1; - MboxListener mboxListener = new MboxListener(mbox, true); + MboxListener mboxListener = new MboxListener(serMbox, true); Thread mboxThread = new Thread(mboxListener); mboxThread.start(); mboxReference.sendArgs(arg); @@ -438,7 +448,7 @@ public class ReferenceServiceTestCase { try { byte arg = 1; - MboxListener mboxListener = new MboxListener(mbox, true); + MboxListener mboxListener = new MboxListener(serMbox, true); Thread mboxThread = new Thread(mboxListener); mboxThread.start(); mboxReference.sendArgs(arg); @@ -449,7 +459,7 @@ public class ReferenceServiceTestCase { try { double arg = 1; - MboxListener mboxListener = new MboxListener(mbox, true); + MboxListener mboxListener = new MboxListener(serMbox, true); Thread mboxThread = new Thread(mboxListener); mboxThread.start(); mboxReference.sendArgs(arg); @@ -460,7 +470,7 @@ public class ReferenceServiceTestCase { try { float arg = 1; - MboxListener mboxListener = new MboxListener(mbox, true); + MboxListener mboxListener = new MboxListener(serMbox, true); Thread mboxThread = new Thread(mboxListener); mboxThread.start(); mboxReference.sendArgs(arg); @@ -471,7 +481,7 @@ public class ReferenceServiceTestCase { try { String arg = "1"; - MboxListener mboxListener = new MboxListener(mbox, true); + MboxListener mboxListener = new MboxListener(serMbox, true); Thread mboxThread = new Thread(mboxListener); mboxThread.start(); mboxReference.sendArgs(arg); @@ -482,7 +492,7 @@ public class ReferenceServiceTestCase { try { boolean arg = true; - MboxListener mboxListener = new MboxListener(mbox, 1); + MboxListener mboxListener = new MboxListener(serMbox, 1); Thread mboxThread = new Thread(mboxListener); mboxThread.start(); mboxReference.sendArgs(arg); @@ -534,6 +544,16 @@ public class ReferenceServiceTestCase { } /** + * Tests RPC with no result + * + * @throws Exception + */ + @Test(timeout = 1000) + public void testRPCWithVoidResult() throws Exception { + moduleReference.doNothing(); + } + + /** * Tests handling requests pointing to unknown functions * * @throws Exception @@ -603,4 +623,65 @@ public class ReferenceServiceTestCase { } } + /** + * Tests mbox with retrieving and answering with basic arguments + * + * @throws Exception + */ + @Test(timeout = 1000) + public void testMbox() throws Exception { + OtpErlangObject[] args = new OtpErlangObject[2]; + args[0] = new OtpErlangString("world"); + args[1] = new OtpErlangString("!"); + OtpErlangTuple tuple = new OtpErlangTuple(args); + refMbox.send("sayHello", "RPCServer", tuple); + OtpErlangString result = (OtpErlangString) refMbox.receiveMsg() + .getMsg(); + assertEquals("Hello world !", result.stringValue()); + } + + /** + * Tests service mbox receiving complex message + * + * @throws Exception + */ + @Test(timeout = 1000) + public void testMboxWithComplexArgs() throws Exception { + int arg1 = 1; + String arg2 = "arg2"; + String arg3 = "arg3"; + boolean arg4 = true; + + OtpErlangObject[] smallTupleContent = new OtpErlangObject[2]; + smallTupleContent[0] = new OtpErlangInt(arg1); + smallTupleContent[1] = new OtpErlangString(arg2); + OtpErlangTuple smallTuple = new OtpErlangTuple(smallTupleContent); + OtpErlangObject[] structuredTupleContent = new OtpErlangObject[3]; + structuredTupleContent[0] = smallTuple; + structuredTupleContent[1] = new OtpErlangString(arg3); + structuredTupleContent[2] = new OtpErlangBoolean(arg4); + OtpErlangTuple structuredTuple = new OtpErlangTuple( + structuredTupleContent); + OtpErlangObject[] secondArg = new OtpErlangObject[2]; + secondArg[0] = new OtpErlangString("in"); + secondArg[1] = new OtpErlangString("array"); + OtpErlangList list = new OtpErlangList(secondArg); + OtpErlangObject[] argsContent = new OtpErlangObject[2]; + argsContent[0] = structuredTuple; + argsContent[1] = list; + OtpErlangTuple args = new OtpErlangTuple(argsContent); + refMbox.send("passComplexArgs", "RPCServer", args); + OtpErlangObject result = refMbox.receiveMsg().getMsg(); + assertEquals(arg1, + ((OtpErlangLong) ((OtpErlangTuple) ((OtpErlangTuple) result) + .elementAt(0)).elementAt(0)).intValue()); + assertEquals(arg2, + ((OtpErlangString) ((OtpErlangTuple) ((OtpErlangTuple) result) + .elementAt(0)).elementAt(1)).stringValue()); + assertEquals(arg3, ((OtpErlangString) ((OtpErlangTuple) result) + .elementAt(1)).stringValue()); + assertEquals(arg4, ((OtpErlangAtom) ((OtpErlangTuple) result) + .elementAt(2)).booleanValue()); + } + } diff --git a/sandbox/wjaniszewski/binding-erlang-runtime/src/test/java/org/apache/tuscany/sca/binding/erlang/testing/ReferenceTestComponent.java b/sandbox/wjaniszewski/binding-erlang-runtime/src/test/java/org/apache/tuscany/sca/binding/erlang/testing/ReferenceTestComponent.java index 0d11b294dc..be43820b0b 100644 --- a/sandbox/wjaniszewski/binding-erlang-runtime/src/test/java/org/apache/tuscany/sca/binding/erlang/testing/ReferenceTestComponent.java +++ b/sandbox/wjaniszewski/binding-erlang-runtime/src/test/java/org/apache/tuscany/sca/binding/erlang/testing/ReferenceTestComponent.java @@ -1,5 +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.binding.erlang.testing; +/** + * @version $Rev$ $Date$ + */ public interface ReferenceTestComponent { } diff --git a/sandbox/wjaniszewski/binding-erlang-runtime/src/test/java/org/apache/tuscany/sca/binding/erlang/testing/ReferenceTestComponentImpl.java b/sandbox/wjaniszewski/binding-erlang-runtime/src/test/java/org/apache/tuscany/sca/binding/erlang/testing/ReferenceTestComponentImpl.java index 919ca64568..71041a2be2 100644 --- a/sandbox/wjaniszewski/binding-erlang-runtime/src/test/java/org/apache/tuscany/sca/binding/erlang/testing/ReferenceTestComponentImpl.java +++ b/sandbox/wjaniszewski/binding-erlang-runtime/src/test/java/org/apache/tuscany/sca/binding/erlang/testing/ReferenceTestComponentImpl.java @@ -1,38 +1,60 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + package org.apache.tuscany.sca.binding.erlang.testing; import org.osoa.sca.annotations.Reference; +/** + * @version $Rev$ $Date$ + */ public class ReferenceTestComponentImpl implements ReferenceTestComponent { - private MboxInterface mboxReference; - private ServiceInterface moduleReference; - private ServiceInterface clonedModuleReference; - - @Reference - public void setMboxReference(MboxInterface mboxReference) { - this.mboxReference = mboxReference; - } - - @Reference - public void setModuleReference(ServiceInterface moduleReference) { - this.moduleReference = moduleReference; - } - - @Reference - public void setClonedModuleReference(ServiceInterface clonedModuleReference) { - this.clonedModuleReference = clonedModuleReference; - } - - public MboxInterface getMboxReference() { - return mboxReference; - } - - public ServiceInterface getModuleReference() { - return moduleReference; - } - - public ServiceInterface getClonedModuleReference() { - return clonedModuleReference; - } + private MboxInterface mboxReference; + private ServiceInterface moduleReference; + private ServiceInterface clonedModuleReference; + + @Reference + public void setMboxReference(MboxInterface mboxReference) { + this.mboxReference = mboxReference; + } + + @Reference + public void setModuleReference(ServiceInterface moduleReference) { + this.moduleReference = moduleReference; + } + + @Reference + public void setClonedModuleReference(ServiceInterface clonedModuleReference) { + this.clonedModuleReference = clonedModuleReference; + } + + public MboxInterface getMboxReference() { + return mboxReference; + } + + public ServiceInterface getModuleReference() { + return moduleReference; + } + + public ServiceInterface getClonedModuleReference() { + return clonedModuleReference; + } } diff --git a/sandbox/wjaniszewski/binding-erlang-runtime/src/test/java/org/apache/tuscany/sca/binding/erlang/testing/ServiceInterface.java b/sandbox/wjaniszewski/binding-erlang-runtime/src/test/java/org/apache/tuscany/sca/binding/erlang/testing/ServiceInterface.java index 33afcfb53d..95c0ea06f6 100644 --- a/sandbox/wjaniszewski/binding-erlang-runtime/src/test/java/org/apache/tuscany/sca/binding/erlang/testing/ServiceInterface.java +++ b/sandbox/wjaniszewski/binding-erlang-runtime/src/test/java/org/apache/tuscany/sca/binding/erlang/testing/ServiceInterface.java @@ -1,20 +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.binding.erlang.testing; +/** + * @version $Rev$ $Date$ + */ public interface ServiceInterface { - String sayHello(String arg1, String arg2); - - String[] sayHellos() throws Exception; - - StructuredTuple passComplexArgs(StructuredTuple arg1, String[] arg2); - - String sayHello() throws Exception; - - String sayHello(String arg) throws Exception; - - String sayHello(int arg1, int arg2); - - void notExistWithException() throws Exception; - - void notExist(); + void doNothing(); + + String sayHello(String arg1, String arg2); + + String[] sayHellos() throws Exception; + + StructuredTuple passComplexArgs(StructuredTuple arg1, String[] arg2); + + String sayHello() throws Exception; + + String sayHello(String arg) throws Exception; + + String sayHello(int arg1, int arg2); + + void notExistWithException() throws Exception; + + void notExist(); } diff --git a/sandbox/wjaniszewski/binding-erlang-runtime/src/test/java/org/apache/tuscany/sca/binding/erlang/testing/ServiceTestComponent.java b/sandbox/wjaniszewski/binding-erlang-runtime/src/test/java/org/apache/tuscany/sca/binding/erlang/testing/ServiceTestComponent.java index f5c03ef281..60650188bc 100644 --- a/sandbox/wjaniszewski/binding-erlang-runtime/src/test/java/org/apache/tuscany/sca/binding/erlang/testing/ServiceTestComponent.java +++ b/sandbox/wjaniszewski/binding-erlang-runtime/src/test/java/org/apache/tuscany/sca/binding/erlang/testing/ServiceTestComponent.java @@ -1,11 +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.binding.erlang.testing; +/** + * @version $Rev$ $Date$ + */ public interface ServiceTestComponent { - String sayHello(String arg1, String arg2); - - String[] sayHellos() throws Exception; - - StructuredTuple passComplexArgs(StructuredTuple arg1, String[] arg2); - + String sayHello(String arg1, String arg2); + + String[] sayHellos() throws Exception; + + StructuredTuple passComplexArgs(StructuredTuple arg1, String[] arg2); + + void doNothing(); + } diff --git a/sandbox/wjaniszewski/binding-erlang-runtime/src/test/java/org/apache/tuscany/sca/binding/erlang/testing/ServiceTestComponentImpl.java b/sandbox/wjaniszewski/binding-erlang-runtime/src/test/java/org/apache/tuscany/sca/binding/erlang/testing/ServiceTestComponentImpl.java index 4d79005938..551ad3d063 100644 --- a/sandbox/wjaniszewski/binding-erlang-runtime/src/test/java/org/apache/tuscany/sca/binding/erlang/testing/ServiceTestComponentImpl.java +++ b/sandbox/wjaniszewski/binding-erlang-runtime/src/test/java/org/apache/tuscany/sca/binding/erlang/testing/ServiceTestComponentImpl.java @@ -1,19 +1,44 @@ -package org.apache.tuscany.sca.binding.erlang.testing; +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.tuscany.sca.binding.erlang.testing; +/** + * @version $Rev$ $Date$ + */ public class ServiceTestComponentImpl implements ServiceTestComponent { - public String sayHello(String arg1, String arg2) { - return "Hello " + arg1 + " " + arg2; - } + public String sayHello(String arg1, String arg2) { + return "Hello " + arg1 + " " + arg2; + } + + public String[] sayHellos() { + String[] result = new String[] { "1", "2" }; + return result; + } - public String[] sayHellos() { - String[] result = new String[] {"1", "2"}; - return result; - } + public StructuredTuple passComplexArgs(StructuredTuple arg1, String[] arg2) { + return arg1; + } - public StructuredTuple passComplexArgs(StructuredTuple arg1, String[] arg2) { - return arg1; - } + public void doNothing() { + // doing nothing + } } diff --git a/sandbox/wjaniszewski/binding-erlang-runtime/src/test/java/org/apache/tuscany/sca/binding/erlang/testing/ServiceTestComponentImplClone.java b/sandbox/wjaniszewski/binding-erlang-runtime/src/test/java/org/apache/tuscany/sca/binding/erlang/testing/ServiceTestComponentImplClone.java index 98921bd24d..b59662551c 100644 --- a/sandbox/wjaniszewski/binding-erlang-runtime/src/test/java/org/apache/tuscany/sca/binding/erlang/testing/ServiceTestComponentImplClone.java +++ b/sandbox/wjaniszewski/binding-erlang-runtime/src/test/java/org/apache/tuscany/sca/binding/erlang/testing/ServiceTestComponentImplClone.java @@ -1,19 +1,44 @@ -package org.apache.tuscany.sca.binding.erlang.testing; +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.tuscany.sca.binding.erlang.testing; +/** + * @version $Rev$ $Date$ + */ public class ServiceTestComponentImplClone implements ServiceTestComponent { - public String sayHello(String arg1, String arg2) { - return "Bye " + arg1 + " " + arg2; - } + public String sayHello(String arg1, String arg2) { + return "Bye " + arg1 + " " + arg2; + } + + public String[] sayHellos() { + String[] result = new String[] { "-1", "-2" }; + return result; + } + + public StructuredTuple passComplexArgs(StructuredTuple arg1, String[] arg2) { + return arg1; + } - public String[] sayHellos() { - String[] result = new String[] {"-1", "-2"}; - return result; - } + public void doNothing() { - public StructuredTuple passComplexArgs(StructuredTuple arg1, String[] arg2) { - return arg1; - } + } } diff --git a/sandbox/wjaniszewski/binding-erlang-runtime/src/test/java/org/apache/tuscany/sca/binding/erlang/testing/SmallTuple.java b/sandbox/wjaniszewski/binding-erlang-runtime/src/test/java/org/apache/tuscany/sca/binding/erlang/testing/SmallTuple.java index 4b318e4a61..ac8b9e426a 100644 --- a/sandbox/wjaniszewski/binding-erlang-runtime/src/test/java/org/apache/tuscany/sca/binding/erlang/testing/SmallTuple.java +++ b/sandbox/wjaniszewski/binding-erlang-runtime/src/test/java/org/apache/tuscany/sca/binding/erlang/testing/SmallTuple.java @@ -19,14 +19,17 @@ package org.apache.tuscany.sca.binding.erlang.testing; +/** + * @version $Rev$ $Date$ + */ public class SmallTuple { - public int arg1; - public String arg2 = ""; - - public boolean equals(Object o) { - SmallTuple comp = (SmallTuple)o; - return arg1 == comp.arg1 && arg2.equals(arg2); - } - + public int arg1; + public String arg2 = ""; + + public boolean equals(Object o) { + SmallTuple comp = (SmallTuple) o; + return arg1 == comp.arg1 && arg2.equals(arg2); + } + } diff --git a/sandbox/wjaniszewski/binding-erlang-runtime/src/test/java/org/apache/tuscany/sca/binding/erlang/testing/StructuredTuple.java b/sandbox/wjaniszewski/binding-erlang-runtime/src/test/java/org/apache/tuscany/sca/binding/erlang/testing/StructuredTuple.java index 736cc2046d..193654172f 100644 --- a/sandbox/wjaniszewski/binding-erlang-runtime/src/test/java/org/apache/tuscany/sca/binding/erlang/testing/StructuredTuple.java +++ b/sandbox/wjaniszewski/binding-erlang-runtime/src/test/java/org/apache/tuscany/sca/binding/erlang/testing/StructuredTuple.java @@ -19,15 +19,19 @@ package org.apache.tuscany.sca.binding.erlang.testing; +/** + * @version $Rev$ $Date$ + */ public class StructuredTuple { - public SmallTuple arg1 = new SmallTuple(); - public String arg2 = ""; - public boolean arg3; - - public boolean equals(Object o) { - StructuredTuple comp = (StructuredTuple)o; - return arg2.equals(comp.arg2) && arg3 == comp.arg3 && arg1.equals(comp.arg1); - } - + public SmallTuple arg1 = new SmallTuple(); + public String arg2 = ""; + public boolean arg3; + + public boolean equals(Object o) { + StructuredTuple comp = (StructuredTuple) o; + return arg2.equals(comp.arg2) && arg3 == comp.arg3 + && arg1.equals(comp.arg1); + } + } diff --git a/sandbox/wjaniszewski/binding-erlang-runtime/src/test/java/org/apache/tuscany/sca/binding/erlang/testing/dynaignore/IgnorableRunner.java b/sandbox/wjaniszewski/binding-erlang-runtime/src/test/java/org/apache/tuscany/sca/binding/erlang/testing/dynaignore/IgnorableRunner.java index 81a17ff9dd..33e6d4862b 100644 --- a/sandbox/wjaniszewski/binding-erlang-runtime/src/test/java/org/apache/tuscany/sca/binding/erlang/testing/dynaignore/IgnorableRunner.java +++ b/sandbox/wjaniszewski/binding-erlang-runtime/src/test/java/org/apache/tuscany/sca/binding/erlang/testing/dynaignore/IgnorableRunner.java @@ -29,6 +29,9 @@ import org.junit.runner.notification.StoppedByUserException; import org.junit.runners.BlockJUnit4ClassRunner; import org.junit.runners.model.InitializationError; +/** + * @version $Rev$ $Date$ + */ public class IgnorableRunner extends Runner { private static final class Notifier extends RunNotifier { diff --git a/sandbox/wjaniszewski/binding-erlang-runtime/src/test/java/org/apache/tuscany/sca/binding/erlang/testing/dynaignore/IgnoreTest.java b/sandbox/wjaniszewski/binding-erlang-runtime/src/test/java/org/apache/tuscany/sca/binding/erlang/testing/dynaignore/IgnoreTest.java index 9a8372051c..3d736da19d 100644 --- a/sandbox/wjaniszewski/binding-erlang-runtime/src/test/java/org/apache/tuscany/sca/binding/erlang/testing/dynaignore/IgnoreTest.java +++ b/sandbox/wjaniszewski/binding-erlang-runtime/src/test/java/org/apache/tuscany/sca/binding/erlang/testing/dynaignore/IgnoreTest.java @@ -19,6 +19,9 @@ package org.apache.tuscany.sca.binding.erlang.testing.dynaignore; +/** + * @version $Rev$ $Date$ + */ public final class IgnoreTest extends Error { private static final long serialVersionUID = 1L; |