Changes and additional files for RMI profiling
[iot2.git] / iotjava / iotrmi / Java / basics / TestClass_Stub.java
index 63c3fffa50e0a9aa8098725381bcbace103a21f5..01baae66ab25baefd150c65a5cc4ed62c73d26cf 100644 (file)
@@ -71,10 +71,60 @@ public class TestClass_Stub {
                List<Enum> resArr2 = tcstub.handleEnumList(enArr2);
                System.out.println("Enum members: " + resArr2.toString());
 
+               System.out.println("==== STRUCT ====");
+               Struct str = new Struct();
+               str.name = "Rahmadi";
+               str.value = 0.123f;
+               str.year = 2016;
+               Struct strRes = tcstub.handleStruct(str);
+               System.out.println("Name: " + strRes.name);
+               System.out.println("Value: " + strRes.value);
+               System.out.println("Year: " + strRes.year);
+               Struct str2 = new Struct();
+               str2.name = "Trimananda";
+               str2.value = 0.124f;
+               str2.year = 2017;
+               Struct[] arrStr = { str, str2 };
+               Struct[] arrRet = tcstub.handleStructArray(arrStr);
+               for(Struct st : arrRet) {
+                       System.out.println("Name: " + st.name);
+                       System.out.println("Value: " + st.value);
+                       System.out.println("Year: " + st.year);
+               }
+               List<Struct> stList = new ArrayList(Arrays.asList(arrStr));
+               List<Struct> stRetList = tcstub.handleStructList(stList);
+               for(Struct st : stRetList) {
+                       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);
+               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 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());
+
                System.out.println("==== OTHERS ====");
                System.out.println("Return value: " + tcstub.getA());
                System.out.println("Return value: " + tcstub.setAndGetA(123));
                System.out.println("Return value: " + tcstub.setACAndGetA("string", 123));
                System.out.println("Return value: " + tcstub.sumArray(new String[] { "123", "456", "987" }));
+
+
        }
 }