Testing complex callbacks invocation; fixing subtle bugs
[iot2.git] / iotjava / iotrmi / Java / basics / TestClassAdvanced_Stub.java
index 826122532569e53dfcb8a120247f10c85d29897c..46143fa160f499d16b98e7bd04825305b7eb7bd1 100644 (file)
@@ -17,8 +17,8 @@ public class TestClassAdvanced_Stub {
                int rev = 0;
 
                TestClassComplete_Stub tcstub = new TestClassComplete_Stub(port, address, rev, ports);
-               System.out.println("==== ENUM ====");
-/*             Enum en = Enum.APPLE;
+/*             System.out.println("==== ENUM ====");
+               Enum en = Enum.APPLE;
                Enum res = tcstub.handleEnum(en);
                System.out.println("Enum member: " + res);
                Enum resComp = tcstub.handleEnumComplex(en, 23, 'c');
@@ -34,25 +34,25 @@ public class TestClassAdvanced_Stub {
                System.out.println("Enum members: " + Arrays.toString(resArr3));*/
                
 
-               System.out.println("==== STRUCT ====");
+/*             System.out.println("==== STRUCT ====");
                Struct str = new Struct();
                str.name = "Rahmadi";
                str.value = 0.123f;
                str.year = 2016;
-/*             Struct strRes = tcstub.handleStruct(str);
+               Struct strRes = tcstub.handleStruct(str);
                System.out.println("Name: " + strRes.name);
                System.out.println("Value: " + strRes.value);
                System.out.println("Year: " + strRes.year);
                Struct strRes2 = tcstub.handleStructComplex(23, 'c', str);
                System.out.println("Name: " + strRes2.name);
                System.out.println("Value: " + strRes2.value);
-               System.out.println("Year: " + strRes2.year);*/
+               System.out.println("Year: " + strRes2.year);
                Struct str2 = new Struct();
                str2.name = "Trimananda";
                str2.value = 0.124f;
                str2.year = 2017;
                Struct[] arrStr = { str, str2 };
-/*             Struct[] arrRet = tcstub.handleStructArray(arrStr);
+               Struct[] arrRet = tcstub.handleStructArray(arrStr);
                for(Struct st : arrRet) {
                        System.out.println("Name: " + st.name);
                        System.out.println("Value: " + st.value);
@@ -64,16 +64,16 @@ public class TestClassAdvanced_Stub {
                        System.out.println("Name: " + st.name);
                        System.out.println("Value: " + st.value);
                        System.out.println("Year: " + st.year);
-               }*/
+               }
                List<Struct> stRetList2 = tcstub.handleStructComplex2(23, 'c', arrStr);
                for(Struct st : stRetList2) {
                        System.out.println("Name: " + st.name);
                        System.out.println("Value: " + st.value);
                        System.out.println("Year: " + st.year);
-               }
+               }*/
 
-               /*System.out.println("==== CALLBACKS ====");
-               CallBackInterface cbSingle = new CallBack(2354);
+               System.out.println("==== CALLBACKS ====");
+/*             CallBackInterface cbSingle = new CallBack(2354);
                tcstub.registerCallback(cbSingle);
                System.out.println("Return value from callback: " + tcstub.callBack());
                CallBackInterface cb1 = new CallBack(23);
@@ -81,13 +81,16 @@ public class TestClassAdvanced_Stub {
                CallBackInterface cb3 = new CallBack(43);
                CallBackInterface[] cb = { cb1, cb2, cb3 };
                tcstub.registerCallbackArray(cb);
-               System.out.println("Return value from callback: " + tcstub.callBack());
+               System.out.println("Return value from callback: " + tcstub.callBack());*/
                List<CallBackInterface> cblist = new ArrayList<CallBackInterface>();
                CallBackInterface cb4 = new CallBack(53); cblist.add(cb4);
                CallBackInterface cb5 = new CallBack(63); cblist.add(cb5);
                CallBackInterface cb6 = new CallBack(73); cblist.add(cb6);
-               tcstub.registerCallbackList(cblist);
-               System.out.println("Return value from callback: " + tcstub.callBack());*/
+//             tcstub.registerCallbackList(cblist);
+//             System.out.println("Return value from callback: " + tcstub.callBack());
+
+               tcstub.registerCallbackComplex(23, cblist, 0.1234);
+               System.out.println("Return value from callback: " + tcstub.callBack());
 
        }
 }