Testing callbacks for Java and C++; fixing a few bugs; more bugs to tackle: 1) Need...
authorrtrimana <rtrimana@uci.edu>
Mon, 5 Dec 2016 22:53:39 +0000 (14:53 -0800)
committerrtrimana <rtrimana@uci.edu>
Mon, 5 Dec 2016 22:53:39 +0000 (14:53 -0800)
config/iotpolicy/testclasspolicy.pol
iotjava/iotpolicy/IoTCompiler.java
iotjava/iotrmi/C++/basics/TestClass.hpp
iotjava/iotrmi/C++/basics/TestClass_Stub.cpp
iotjava/iotrmi/Java/basics/TestClass.java
iotjava/iotrmi/Java/basics/TestClass_Stub.java

index 1d9d47a5dd92f3ad5095dfa14deb7adba5234a9a..e562cfa6bebb5da25715d0fa25e4d9bcb3f17bd1 100644 (file)
@@ -32,6 +32,11 @@ public interface TestClassInterface {
        public Struct[] handleStructArray(Struct str[]);
        public List<Struct> handleStructList(List<Struct> str);
 
+       public void registerCallback(CallBackInterface _cb);
+       public void registerCallbackArray(CallBackInterface _cb[]);
+       public void registerCallbackList(List<CallBackInterface> _cb);
+       public int callBack();
+
        public int getA();
        public void setA(int _int);
        public void setB(float _float);
@@ -72,6 +77,11 @@ public interface TestClassInterface {
                method = "handleStructArray(Struct str[])";
                method = "handleStructList(List<Struct> str)";
 
+               method = "registerCallback(CallBackInterface _cb)";
+               method = "registerCallbackArray(CallBackInterface _cb[])";
+               method = "registerCallbackList(List<CallBackInterface> _cb)";
+               method = "callBack()";
+
                method = "getA()";
                method = "setA(int _int)";
                method = "setB(float _float)";
index c23896f3e016fa55e74f052c4bc01c5c4fbdcbf0..e461706c1757ce42a11b8d3660be9792477bce6c 100644 (file)
@@ -924,7 +924,7 @@ public class IoTCompiler {
        private String returnGenericCallbackType(String paramType) {
 
                if (getParamCategory(paramType) == ParamCategory.NONPRIMITIVES)
-                       return getTypeOfGeneric(paramType)[0];
+                       return getGenericType(paramType);
                else
                        return paramType;
        }
@@ -953,12 +953,12 @@ public class IoTCompiler {
                        if (checkCallbackType(paramType, callbackType)) { // Check if this has callback object
                                String param = methParams.get(i);
                                if (isArrayOrList(paramType, param)) {  // Generate loop
-                                       println("for (" + paramType + " cb : " + getSimpleIdentifier(param) + ") {");
-                                       println(callbackType + "_CallbackSkeleton skel = new " + callbackType + "_CallbackSkeleton(cb, objIdCnt++);");
+                                       println("for (" + getGenericType(paramType) + " cb : " + getSimpleIdentifier(param) + ") {");
+                                       println(callbackType + "_CallbackSkeleton skel" + i + " = new " + callbackType + "_CallbackSkeleton(cb, objIdCnt++);");
                                } else
-                                       println(callbackType + "_CallbackSkeleton skel = new " + callbackType + "_CallbackSkeleton(" +
+                                       println(callbackType + "_CallbackSkeleton skel" + i + " = new " + callbackType + "_CallbackSkeleton(" +
                                                getSimpleIdentifier(param) + ", objIdCnt++);");
-                               println("listCallbackObj.add(skel);");
+                               println("listCallbackObj.add(skel" + i + ");");
                                if (isArrayOrList(paramType, param))
                                        println("}");
                        }
@@ -1026,6 +1026,7 @@ public class IoTCompiler {
         */
        private void writeMethodJavaStub(Collection<String> methods, InterfaceDecl intDecl, Set<String> callbackClasses) {
 
+               boolean isDefined = false;
                for (String method : methods) {
 
                        List<String> methParams = intDecl.getMethodParams(method);
@@ -1057,8 +1058,10 @@ public class IoTCompiler {
                                writeStdMethodBodyJavaStub(intDecl, methParams, methPrmTypes, method);
                        println("}\n");
                        // Write the init callback helper method
-                       if (isCallbackMethod)
+                       if (isCallbackMethod && !isDefined) {
                                writeInitCallbackJavaStub(callbackType, intDecl);
+                               isDefined = true;
+                       }
                }
        }
 
@@ -1301,8 +1304,8 @@ public class IoTCompiler {
                        println("public void ___regCB(IoTRMIObject rmiObj) throws IOException {");
                else
                        println("public void ___regCB() throws IOException {");
-               println("Object[] paramObj = rmiObj.getMethodParams(new Class<?>[] { int.class, String.class, int.class },");
-               println("\tnew Class<?>[] { null, null, null });");
+               print("Object[] paramObj = rmiObj.getMethodParams(new Class<?>[] { int.class, String.class, int.class },");
+               println("new Class<?>[] { null, null, null });");
                println("rmiCall = new IoTRMICall((int) paramObj[0], (String) paramObj[1], (int) paramObj[2]);");
                println("}\n");
        }
@@ -1314,6 +1317,7 @@ public class IoTCompiler {
        private void writeMethodJavaSkeleton(Collection<String> methods, InterfaceDecl intDecl, Set<String> callbackClasses, 
                        boolean callbackSkeleton) {
 
+               boolean isDefined = false;
                for (String method : methods) {
 
                        List<String> methParams = intDecl.getMethodParams(method);
@@ -1340,8 +1344,10 @@ public class IoTCompiler {
                        // Now, write the body of skeleton!
                        writeStdMethodBodyJavaSkeleton(methParams, methodId, intDecl.getMethodType(method));
                        println("}\n");
-                       if (isCallbackMethod)
+                       if (isCallbackMethod && !isDefined) {   // Make sure that this function is only defined once!
                                writeInitCallbackJavaSkeleton(callbackSkeleton);
+                               isDefined = true;
+                       }
                }
        }
 
@@ -1360,7 +1366,7 @@ public class IoTCompiler {
                        //if (callbackType.equals(paramType)) {
                        if (checkCallbackType(paramType, callbackType)) { // Check if this has callback object
                                println("try {");
-                               String exchParamType = checkAndGetParamClass(paramType);
+                               String exchParamType = checkAndGetParamClass(getGenericType(paramType));
                                // Print array if this is array or list if this is a list of callback objects
                                if (isArray(param)) {
                                        println("int numStubs" + i + " = (int) paramObj[" + i + "];");
@@ -1375,7 +1381,7 @@ public class IoTCompiler {
                        }
                        // Generate a loop if needed
                        if (checkCallbackType(paramType, callbackType)) { // Check if this has callback object
-                               String exchParamType = checkAndGetParamClass(paramType);
+                               String exchParamType = checkAndGetParamClass(getGenericType(paramType));
                                if (isArray(param)) {
                                        println("for (int objId = 0; objId < numStubs" + i + "; objId++) {");
                                        println("stub" + i + "[objId] = new " + exchParamType + "_CallbackStub(rmiCall, objIdCnt);");
@@ -1798,7 +1804,8 @@ public class IoTCompiler {
                for (int i = 0; i < methParams.size(); i++) {
                        String prmType = methPrmTypes.get(i);
                        if ((getParamCategory(prmType) == ParamCategory.NONPRIMITIVES) &&
-                               !isEnumClass(getGenericType(prmType)))
+                               !isEnumClass(getGenericType(prmType)) &&
+                               !callbackClasses.contains(getGenericType(prmType)))
                                        print(getGenericType(prmType) + ".class");
                        else
                                print("null");
@@ -2568,6 +2575,7 @@ public class IoTCompiler {
         */
        private void writeMethodCplusStub(Collection<String> methods, InterfaceDecl intDecl, Set<String> callbackClasses) {
 
+               boolean isDefined = false;
                for (String method : methods) {
 
                        List<String> methParams = intDecl.getMethodParams(method);
@@ -2578,7 +2586,7 @@ public class IoTCompiler {
                        String callbackType = null;
                        for (int i = 0; i < methParams.size(); i++) {
 
-                               String paramType = methPrmTypes.get(i);
+                               String paramType = returnGenericCallbackType(methPrmTypes.get(i));
                                // Check if this has callback object
                                if (callbackClasses.contains(paramType)) {
                                        isCallbackMethod = true;
@@ -2597,12 +2605,13 @@ public class IoTCompiler {
                        if (isCallbackMethod)
                                writeCallbackMethodBodyCplusStub(intDecl, methParams, methPrmTypes, method, callbackType);
                        else
-                               writeStdMethodBodyCplusStub(intDecl, methParams, methPrmTypes, method);
+                               writeStdMethodBodyCplusStub(intDecl, methParams, methPrmTypes, method, callbackClasses);
                        println("}\n");
                        // Write the init callback helper method
-                       if (isCallbackMethod) {
+                       if (isCallbackMethod && !isDefined) {
                                writeInitCallbackCplusStub(callbackType, intDecl);
                                writeInitCallbackSendInfoCplusStub(intDecl);
+                               isDefined = true;
                        }
                }
        }
@@ -2623,7 +2632,7 @@ public class IoTCompiler {
                        if (checkCallbackType(paramType, callbackType)) { // Check if this has callback object
                                String param = methParams.get(i);
                                if (isArrayOrList(paramType, param)) {  // Generate loop
-                                       println("for (" + paramType + "* cb : " + getSimpleIdentifier(param) + ") {");
+                                       println("for (" + getGenericType(paramType) + "* cb : " + getSimpleIdentifier(param) + ") {");
                                        println(callbackType + "_CallbackSkeleton* skel = new " + callbackType + "_CallbackSkeleton(cb, objIdCnt++);");
                                        isArrayOrList = true;
                                        callbackParam = getSimpleIdentifier(param);
@@ -2631,7 +2640,7 @@ public class IoTCompiler {
                                        println(callbackType + "_CallbackSkeleton* skel = new " + callbackType + "_CallbackSkeleton(" +
                                                getSimpleIdentifier(param) + ", objIdCnt++);");
                                println("vecCallbackObj.push_back(skel);");
-                               if (isArrayOrList(paramType, param))
+                               if (isArrayOrList)
                                        println("}");
                        }
                }
@@ -2958,7 +2967,7 @@ public class IoTCompiler {
         * HELPER: writeStdMethodBodyCplusStub() writes the standard method body in the stub class
         */
        private void writeStdMethodBodyCplusStub(InterfaceDecl intDecl, List<String> methParams,
-                       List<String> methPrmTypes, String method) {
+                       List<String> methPrmTypes, String method, Set<String> callbackClasses) {
 
                checkAndWriteStructSetupCplusStub(methParams, methPrmTypes, intDecl, method);
                println("int methodId = " + intDecl.getMethodNumId(method) + ";");
@@ -2971,8 +2980,13 @@ public class IoTCompiler {
                        println("int numParam = " + methParams.size() + ";");
                        print("string paramCls[] = { ");
                        for (int i = 0; i < methParams.size(); i++) {
-                               String paramTypeC = checkAndGetCplusArgClsType(methPrmTypes.get(i), methParams.get(i));
-                               print("\"" + paramTypeC + "\"");
+                               String paramType = returnGenericCallbackType(methPrmTypes.get(i));
+                               if (callbackClasses.contains(paramType)) {
+                                       print("\"int\"");
+                               } else {
+                                       String paramTypeC = checkAndGetCplusArgClsType(methPrmTypes.get(i), methParams.get(i));
+                                       print("\"" + paramTypeC + "\"");
+                               }
                                // Check if this is the last element (don't print a comma)
                                if (i != methParams.size() - 1) {
                                        print(", ");
@@ -3188,7 +3202,7 @@ public class IoTCompiler {
                println("int methodId = " + methodNumId + ";");
                //writeCplusCallbackPermission(intface, methodNumId);
                println("string retType = \"void\";");
-               println("string paramCls[] = { \"int\", \"string\", \"int\" };");
+               println("string paramCls[] = { \"int\", \"String\", \"int\" };");
                println("int rev = 0;");
                println("void* paramObj[] = { &ports[0], &address, &rev };");
                println("void* retObj = NULL;");
@@ -3238,8 +3252,14 @@ public class IoTCompiler {
                                // Write methods
                                writeMethodCplusStub(methods, intDecl, callbackClasses);
                                print("}"); println(";");
-                               if (callbackExist)
-                                       writePermissionInitializationCplus(intface, newStubClass, intDecl);
+                               if (callbackExist) {
+                                       Iterator it = callbackClasses.iterator();
+                                       String callbackType = (String) it.next();
+                                       // Generate permission stuff for callback stubs
+                                       DeclarationHandler decHandlerCallback = mapIntDeclHand.get(callbackType);
+                                       InterfaceDecl intDeclCallback = (InterfaceDecl) decHandlerCallback.getInterfaceDecl(callbackType);
+                                       writePermissionInitializationCplus(callbackType, newStubClass, intDeclCallback);
+                               }
                                writeObjectIdCountInitializationCplus(newStubClass, callbackExist);
                                println("#endif");
                                pw.close();
@@ -3334,8 +3354,14 @@ public class IoTCompiler {
                                // Write methods
                                writeMethodCplusStub(methods, intDecl, callbackClasses);
                                println("};");
-                               if (callbackExist)
-                                       writePermissionInitializationCplus(intface, newStubClass, intDecl);
+                               if (callbackExist) {
+                                       Iterator it = callbackClasses.iterator();
+                                       String callbackType = (String) it.next();
+                                       // Generate permission stuff for callback stubs
+                                       DeclarationHandler decHandlerCallback = mapIntDeclHand.get(callbackType);
+                                       InterfaceDecl intDeclCallback = (InterfaceDecl) decHandlerCallback.getInterfaceDecl(callbackType);
+                                       writePermissionInitializationCplus(callbackType, newStubClass, intDeclCallback);
+                               }
                                writeObjectIdCountInitializationCplus(newStubClass, callbackExist);
                                println("#endif");
                                pw.close();
@@ -3388,7 +3414,7 @@ public class IoTCompiler {
                for (Map.Entry<String,Set<String>> intMeth : mapNewIntMethods.entrySet()) {
                        String newIntface = intMeth.getKey();
                        int newObjectId = getNewIntfaceObjectId(newIntface);
-                       print("set<int> " + newSkelClass + "::set" + newObjectId + "Allowed {");
+                       print("set<int> " + newSkelClass + "::set" + newObjectId + "Allowed { ");
                        Set<String> methodIds = intMeth.getValue();
                        int i = 0;
                        for (String methodId : methodIds) {
@@ -3516,7 +3542,7 @@ public class IoTCompiler {
                println("int param1 = 0;");
                println("string param2 = \"\";");
                println("int param3 = 0;");
-               println("string paramCls[] = { \"int\", \"string\", \"int\" };");
+               println("string paramCls[] = { \"int\", \"String\", \"int\" };");
                println("void* paramObj[] = { &param1, &param2, &param3 };");
                println("rmiObj->getMethodParams(paramCls, numParam, paramObj);");
                println("bool bResult = false;");
@@ -3531,6 +3557,7 @@ public class IoTCompiler {
        private void writeMethodCplusSkeleton(Collection<String> methods, InterfaceDecl intDecl, 
                        Set<String> callbackClasses, boolean callbackSkeleton) {
 
+               boolean isDefined = false;
                for (String method : methods) {
 
                        List<String> methParams = intDecl.getMethodParams(method);
@@ -3560,8 +3587,10 @@ public class IoTCompiler {
                        // Now, write the body of skeleton!
                        writeStdMethodBodyCplusSkeleton(methParams, methodId, intDecl.getMethodType(method));
                        println("}\n");
-                       if (isCallbackMethod)
+                       if (isCallbackMethod && !isDefined) {
                                writeInitCallbackCplusSkeleton(callbackSkeleton);
+                               isDefined = true;
+                       }
                }
        }
 
@@ -3575,11 +3604,8 @@ public class IoTCompiler {
                        String paramType = methPrmTypes.get(i);
                        String param = methParams.get(i);
                        //if (callbackType.equals(paramType)) {
-                       if (checkCallbackType(paramType, callbackType)) { // Check if this has callback object
-                               String exchParamType = checkAndGetParamClass(paramType);
-                               // Print array if this is array or list if this is a list of callback objects
+                       if (checkCallbackType(paramType, callbackType)) // Check if this has callback object
                                println("int numStubs" + i + " = 0;");
-                       }
                }
        }
 
@@ -3595,13 +3621,13 @@ public class IoTCompiler {
                        String param = methParams.get(i);
                        // Generate a loop if needed
                        if (checkCallbackType(paramType, callbackType)) { // Check if this has callback object
-                               String exchParamType = checkAndGetParamClass(paramType);
+                               String exchParamType = checkAndGetParamClass(getGenericType(paramType));
                                if (isArrayOrList(paramType, param)) {
-                                       println("vector<" + exchParamType + "> stub;");
+                                       println("vector<" + exchParamType + "*> stub" + i + ";");
                                        println("for (int objId = 0; objId < numStubs" + i + "; objId++) {");
                                        println(exchParamType + "* cb" + i + " = new " + exchParamType + "_CallbackStub(rmiCall, objIdCnt);");
-                                       println("stub" + i + ".push_back(cb);");
-                                       println("vecCallbackObj.push_back(cb);");
+                                       println("stub" + i + ".push_back(cb" + i + ");");
+                                       println("vecCallbackObj.push_back(cb" + i + ");");
                                        println("objIdCnt++;");
                                        println("}");
                                } else {
@@ -5058,14 +5084,14 @@ public class IoTCompiler {
                        if (paramType.contains("<") && paramType.contains(">")) {
 
                                String genericClass = getSimpleType(paramType);
-                               String[] genericType = getTypeOfGeneric(paramType);
+                               String genericType = getGenericType(paramType);
                                String cplusTemplate = null;
-                               if (genericType.length == 1) // Generic/template with one type
-                                       cplusTemplate = getNonPrimitiveCplusClass(genericClass) + 
-                                               "<" + convertType(genericType[0]) + ">";
-                               else // Generic/template with two types
-                                       cplusTemplate = getNonPrimitiveCplusClass(genericClass) + 
-                                               "<" + convertType(genericType[0]) + "," + convertType(genericType[1]) + ">";
+                               cplusTemplate = getNonPrimitiveCplusClass(genericClass);
+                               if(getParamCategory(getGenericType(paramType)) == ParamCategory.USERDEFINED) {
+                                       cplusTemplate = cplusTemplate + "<" + genericType + "*>";
+                               } else {
+                                       cplusTemplate = cplusTemplate + "<" + convertType(genericType) + ">";
+                               }
                                return cplusTemplate;
                        } else
                                return getNonPrimitiveCplusClass(paramType);
@@ -5077,7 +5103,6 @@ public class IoTCompiler {
                } else
                        // Just return it as is if it's not non-primitives
                        return paramType;
-                       //return checkAndGetParamClass(paramType, true);
        }
 
 
@@ -5242,6 +5267,9 @@ public class IoTCompiler {
                // Check if this is generics
                if(getParamCategory(paramType) == ParamCategory.USERDEFINED) {
                        return exchangeParamType(paramType);
+               } else if (isList(paramType) &&
+                               (getParamCategory(getGenericType(paramType)) == ParamCategory.USERDEFINED)) {
+                       return "List<" + exchangeParamType(getGenericType(paramType)) + ">";
                } else
                        return paramType;
        }
index 58a6d2a176cb8fa303090689d06cb4fba227fccc..f2951ba653a1baf5dc442a2f1d5341e7108436bc 100644 (file)
@@ -40,7 +40,8 @@ class TestClass : public TestClassInterface {
 
                // Callbacks
                void                            registerCallback(CallBackInterfaceWithCallBack* _cb);
-               //void                          registerCallback(vector<CallBackInterfaceWithCallBack*> _cb);
+               void                            registerCallbackArray(vector<CallBackInterfaceWithCallBack*> _cb);
+               void                            registerCallbackList(vector<CallBackInterfaceWithCallBack*> _cb);
                int                                     callBack();
 
                // Enum
@@ -94,13 +95,22 @@ void TestClass::registerCallback(CallBackInterfaceWithCallBack* _cb) {
 }
 
 
-/*void TestClass::registerCallback(vector<CallBackInterfaceWithCallBack*> _cb) {
+void TestClass::registerCallbackArray(vector<CallBackInterfaceWithCallBack*> _cb) {
 
-       for (CallBackInterface* cb : _cb) {
+       for (CallBackInterfaceWithCallBack* cb : _cb) {
                cbvec.push_back(cb);
-               cout << "Registering callback object!" << endl;
+               cout << "Registering callback object in array!" << endl;
        }
-}*/
+}
+
+
+void TestClass::registerCallbackList(vector<CallBackInterfaceWithCallBack*> _cb) {
+
+       for (CallBackInterfaceWithCallBack* cb : _cb) {
+               cbvec.push_back(cb);
+               cout << "Registering callback object in list!" << endl;
+       }
+}
 
 
 int TestClass::callBack() {
index 96011d19f6f3e3b07fa156a28f5567e19642e15c..207eb8b2654ed7866ce789e3b2fa3a0d1c378037 100644 (file)
@@ -1,6 +1,7 @@
 #include <iostream>
 #include <string>
 #include "TestClassComplete_Stub.hpp"
+#include "CallBack.hpp"
 
 using namespace std;
 
@@ -24,7 +25,7 @@ int main(int argc, char *argv[])
        cout << "Return value: " << tcStub->getDouble(12345.678) << endl;
        cout << "Return value: " << tcStub->getBoolean(true) << endl;
        cout << "Return value: " << tcStub->getChar('c') << endl;
-       cout << "==== ARRAY ====" << endl;
+/*     cout << "==== ARRAY ====" << endl;
        vector<char> in1;
        in1.push_back(68);
        in1.push_back(69);
@@ -127,7 +128,29 @@ int main(int argc, char *argv[])
                cout << "Name: " << st.name << endl;
                cout << "Value:" << st.value << endl;
                cout << "Year" << st.year << endl;
-       }
+       }*/
+       cout << "==== CALLBACK ====" << endl;
+       CallBackInterface *cbSingle = new CallBack(2354);
+       tcStub->registerCallback(cbSingle);
+       cout << "Return value from callback: " << tcStub->callBack() << endl;
+       CallBackInterface *cb1 = new CallBack(23);
+       CallBackInterface *cb2 = new CallBack(33);
+       CallBackInterface *cb3 = new CallBack(43);
+       vector<CallBackInterface*> cb;
+       cb.push_back(cb1);
+       cb.push_back(cb2);
+       cb.push_back(cb3);
+       tcStub->registerCallbackArray(cb);
+       cout << "Return value from callback: " << tcStub->callBack() << endl;
+       CallBackInterface *cb4 = new CallBack(23);
+       CallBackInterface *cb5 = new CallBack(33);
+       CallBackInterface *cb6 = new CallBack(43);
+       vector<CallBackInterface*> cblist;
+       cblist.push_back(cb4);
+       cblist.push_back(cb5);
+       cblist.push_back(cb6);
+       tcStub->registerCallbackList(cblist);
+       cout << "Return value from callback: " << tcStub->callBack() << endl;
 
        cout << "==== OTHERS ====" << endl;
        cout << "Return value: " << tcStub->getA() << endl;
index a5c0c1136741b7388af085066173cca6acb61ef7..7031dc295681b66e4e3ee9b37f517b0a70692799 100644 (file)
@@ -20,6 +20,7 @@ public class TestClass implements TestClassInterface {
                intA = 1;
                floatB = 2;
                stringC = "345";
+               cblist = new ArrayList<CallBackInterfaceWithCallBack>();
        }
 
 
@@ -28,6 +29,7 @@ public class TestClass implements TestClassInterface {
                intA = _int;
                floatB = _float;
                stringC = _string;
+               cblist = new ArrayList<CallBackInterfaceWithCallBack>();
        }
 
 
@@ -40,13 +42,22 @@ public class TestClass implements TestClassInterface {
        }
 
 
-       /*public void registerCallback(CallBackInterfaceWithCallBack[] _cb) {
+       public void registerCallbackArray(CallBackInterfaceWithCallBack _cb[]) {
 
                for (CallBackInterfaceWithCallBack cb : _cb) {
                        cblist.add(cb);
-                       System.out.println("Registering callback object!");
+                       System.out.println("Registering callback objects in array!");
                }
-       }*/
+       }
+
+
+       public void registerCallbackList(List<CallBackInterfaceWithCallBack> _cb) {
+
+               for (CallBackInterfaceWithCallBack cb : _cb) {
+                       cblist.add(cb);
+                       System.out.println("Registering callback objects in list!");
+               }
+       }
 
 
        public int callBack() {
index 01daf3075d08ec97f27c2835945a43affcba7bb2..d82c905a2f9d8a97b7badbeaf398e0daa8bcd845 100644 (file)
@@ -28,7 +28,7 @@ public class TestClass_Stub {
                System.out.println("Return value: " + tcstub.getBoolean(true));
                System.out.println("Return value: " + tcstub.getChar('c'));
 
-               System.out.println("==== ARRAY ====");
+/*             System.out.println("==== ARRAY ====");
                byte[] in1 = { 68, 69 };
                System.out.println("Return value: " + Arrays.toString(tcstub.getByteArray(in1)));
                short[] in2 = { (short)1234, (short)1235 };
@@ -98,6 +98,26 @@ public class TestClass_Stub {
                        System.out.println("Value: " + st.value);
                        System.out.println("Year: " + st.year);
                }
+*/
+               System.out.println("==== CALLBACKS ====");
+               CallBackInterface cbSingle = new CallBack(2354);
+               tcstub.registerCallback(cbSingle);
+               System.out.println("Return value from callback: " + tcstub.callBack());
+               //CallBackInterface cbSingle2 = new CallBack(2355);
+               //tcstub.registerCallback(cbSingle2);
+               //System.out.println("Return value from callback: " + tcstub.callBack());
+               /*CallBackInterface cb1 = new CallBack(23);
+               CallBackInterface cb2 = new CallBack(33);
+               CallBackInterface cb3 = new CallBack(43);
+               CallBackInterface[] cb = { cb1, cb2, cb3 };
+               tcstub.registerCallbackArray(cb);
+               System.out.println("Return value from callback: " + tcstub.callBack());*/
+               List<CallBackInterface> cblist = new ArrayList<CallBackInterface>();
+               CallBackInterface cb1 = new CallBack(23); cblist.add(cb1);
+               CallBackInterface cb2 = new CallBack(33); cblist.add(cb2);
+               CallBackInterface cb3 = new CallBack(43); cblist.add(cb3);
+               tcstub.registerCallbackList(cblist);
+               System.out.println("Return value from callback: " + tcstub.callBack());
 
                System.out.println("==== OTHERS ====");
                System.out.println("Return value: " + tcstub.getA());