From: rtrimana <rtrimana@uci.edu>
Date: Wed, 7 Dec 2016 19:04:34 +0000 (-0800)
Subject: Testing more complex struct and enum declarations; fixing subtle bugs
X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=03f1eb47b4b938ab05001122a0010bf8c07de338;p=iot2.git

Testing more complex struct and enum declarations; fixing subtle bugs
---

diff --git a/config/iotpolicy/testclasspolicy.pol b/config/iotpolicy/testclasspolicy.pol
index e562cfa..e7cdc3b 100644
--- a/config/iotpolicy/testclasspolicy.pol
+++ b/config/iotpolicy/testclasspolicy.pol
@@ -27,6 +27,7 @@ public interface TestClassInterface {
 	public Enum handleEnum(Enum en);
 	public Enum[] handleEnumArray(Enum en[]);
 	public List<Enum> handleEnumList(List<Enum> en);
+	public Enum handleEnumComplex(Enum en, int i, char c);
 
 	public Struct handleStruct(Struct str);
 	public Struct[] handleStructArray(Struct str[]);
@@ -72,6 +73,7 @@ public interface TestClassInterface {
 		method = "handleEnum(Enum en)";
 		method = "handleEnumArray(Enum en[])";
 		method = "handleEnumList(List<Enum> en)";
+		method = "handleEnumComplex(Enum en, int i, char c)";
 
 		method = "handleStruct(Struct str)";
 		method = "handleStructArray(Struct str[])";
diff --git a/config/iotpolicy/testclasspolicy_advanced.pol b/config/iotpolicy/testclasspolicy_advanced.pol
new file mode 100644
index 0000000..c5fcfd2
--- /dev/null
+++ b/config/iotpolicy/testclasspolicy_advanced.pol
@@ -0,0 +1,60 @@
+public interface TestClassInterface {
+
+	public Enum handleEnum(Enum en);
+	public Enum[] handleEnumArray(Enum en[]);
+	public List<Enum> handleEnumList(List<Enum> en);
+	public Enum handleEnumComplex(Enum en, int i, char c);
+	public Enum[] handleEnumComplex2(Enum en[], int in, char c);
+
+	public Struct handleStruct(Struct str);
+	public Struct[] handleStructArray(Struct str[]);
+	public List<Struct> handleStructList(List<Struct> str);
+	public Struct handleStructComplex(int in, char c, Struct str);
+	public List<Struct> handleStructComplex2(int in, char c, Struct str[]);
+
+	public void registerCallback(CallBackInterface _cb);
+	public void registerCallbackArray(CallBackInterface _cb[]);
+	public void registerCallbackList(List<CallBackInterface> _cb);
+	public int callBack();
+
+	capability EnumsStructs {
+		description = "All the set methods";
+
+		method = "handleEnum(Enum en)";
+		method = "handleEnumArray(Enum en[])";
+		method = "handleEnumList(List<Enum> en)";
+		method = "handleEnumComplex(Enum en, int i, char c)";
+		method = "handleEnumComplex2(Enum en[], int in, char c)";
+
+		method = "handleStruct(Struct str)";
+		method = "handleStructArray(Struct str[])";
+		method = "handleStructList(List<Struct> str)";
+		method = "handleStructComplex(int in, char c, Struct str)";
+		method = "handleStructComplex2(int in, char c, Struct str[])";
+	}
+
+	capability Callbacks {
+		description = "All the set-and-get methods";
+
+		method = "registerCallback(CallBackInterface _cb)";
+		method = "registerCallbackArray(CallBackInterface _cb[])";
+		method = "registerCallbackList(List<CallBackInterface> _cb)";
+		method = "callBack()";
+	}
+
+	enum Enum {
+
+		APPLE,
+		ORANGE,
+		GRAPE
+	}
+
+	struct Struct {
+
+		string 	name;
+		float	value;
+		int	year;
+	}
+}
+
+
diff --git a/config/iotpolicy/testclassrequires_advanced.pol b/config/iotpolicy/testclassrequires_advanced.pol
new file mode 100644
index 0000000..b00b4cf
--- /dev/null
+++ b/config/iotpolicy/testclassrequires_advanced.pol
@@ -0,0 +1,3 @@
+
+requires TestClassInterface with EnumsStructs, Callbacks as interface TestClassComplete;
+
diff --git a/iotjava/Makefile b/iotjava/Makefile
index e1cd731..00fac5b 100644
--- a/iotjava/Makefile
+++ b/iotjava/Makefile
@@ -22,7 +22,7 @@ PHONY += run-compiler
 run-compiler:
 	#cd $(BIN_DIR)/iotpolicy; $(JAVA) -cp .:..:../$(PARSERJARS):../$(BIN_DIR) iotpolicy.IoTCompiler camerapolicy.pol camerarequires.pol lightbulbpolicy.pol lightbulbrequires.pol -cplus Cplus -java Java
 	#cd $(BIN_DIR)/iotpolicy; $(JAVA) -cp .:..:../$(PARSERJARS):../$(BIN_DIR) iotpolicy.IoTCompiler testclasspolicy.pol testclassrequires.pol callbackpolicy.pol callbackrequires.pol -cplus Cplus -java Java
-	cd $(BIN_DIR)/iotpolicy; $(JAVA) -cp .:..:../$(PARSERJARS):../$(BIN_DIR) iotpolicy.IoTCompiler callbackpolicy.pol callbackrequires.pol testclasspolicy.pol testclassrequires.pol -cplus Cplus -java Java
+	cd $(BIN_DIR)/iotpolicy; $(JAVA) -cp .:..:../$(PARSERJARS):../$(BIN_DIR) iotpolicy.IoTCompiler callbackpolicy.pol callbackrequires.pol testclasspolicy_advanced.pol testclassrequires_advanced.pol -cplus Cplus -java Java
 
 # Runtime system compilation
 PHONY += runtime
@@ -36,10 +36,10 @@ compile:
 	cp ./iotrmi/C++/basics/* $(BIN_DIR)/iotpolicy/output_files/Cplus
 	cd $(BIN_DIR)/iotpolicy/output_files; cp *.java ./Java
 	cd $(BIN_DIR)/iotpolicy/output_files; cp *.hpp ./Cplus
-	cd $(BIN_DIR)/iotpolicy/output_files/Java; $(JAVAC) -cp .:..:../../../$(BIN_DIR) *.java
-#	cd $(BIN_DIR)/iotpolicy/output_files/Cplus; $(G++) ./*.hpp --std=c++11 -pthread -pg -I../../../../iotjava/iotrmi/C++/
+	cd $(BIN_DIR)/iotpolicy/output_files/Java; $(JAVAC) -cp .:..:../../../$(BIN_DIR) TestClass_Skeleton.java
+	cd $(BIN_DIR)/iotpolicy/output_files/Java; $(JAVAC) -cp .:..:../../../$(BIN_DIR) TestClassAdvanced_Stub.java
 	cd $(BIN_DIR)/iotpolicy/output_files/Cplus; $(G++) ./TestClass_Skeleton.cpp -o ./TestClass_Skeleton.out --std=c++11 -pthread -pg -I../../../../iotjava/iotrmi/C++/
-	cd $(BIN_DIR)/iotpolicy/output_files/Cplus; $(G++) ./TestClass_Stub.cpp -o ./TestClass_Stub.out --std=c++11 -pthread -pg -I../../../../iotjava/iotrmi/C++/
+	cd $(BIN_DIR)/iotpolicy/output_files/Cplus; $(G++) ./TestClassAdvanced_Stub.cpp -o ./TestClassAdvanced_Stub.out --std=c++11 -pthread -pg -I../../../../iotjava/iotrmi/C++/
 
 PHONY += run-java-skeleton
 run-java-skeleton:
@@ -47,7 +47,8 @@ run-java-skeleton:
 
 PHONY += run-java-stub
 run-java-stub:
-	cd ../bin/iotpolicy/output_files/Java; $(JAVA) -cp .:../../../$(BIN_DIR) TestClass_Stub
+#	cd ../bin/iotpolicy/output_files/Java; $(JAVA) -cp .:../../../$(BIN_DIR) TestClass_Stub
+	cd ../bin/iotpolicy/output_files/Java; $(JAVA) -cp .:../../../$(BIN_DIR) TestClassAdvanced_Stub
 
 PHONY += run-cplus-skeleton
 run-cplus-skeleton:
@@ -55,7 +56,8 @@ run-cplus-skeleton:
 
 PHONY += run-cplus-stub
 run-cplus-stub:
-	../bin/iotpolicy/output_files/Cplus/TestClass_Stub.out
+#	../bin/iotpolicy/output_files/Cplus/TestClass_Stub.out
+	../bin/iotpolicy/output_files/Cplus/TestClassAdvanced_Stub.out
 
 PHONY += folderclean
 folderclean:
diff --git a/iotjava/iotpolicy/IoTCompiler.java b/iotjava/iotpolicy/IoTCompiler.java
index 04bf089..9eafffb 100644
--- a/iotjava/iotpolicy/IoTCompiler.java
+++ b/iotjava/iotpolicy/IoTCompiler.java
@@ -1526,7 +1526,6 @@ public class IoTCompiler {
 		StructDecl structDecl = getStructDecl(simpleType);
 		List<String> memTypes = structDecl.getMemberTypes(simpleType);
 		List<String> members = structDecl.getMembers(simpleType);
-		println("int pos = 0;");
 		if (isArrayOrList(paramType, param)) {	// An array or list
 			int methodNumId = intDecl.getMethodNumId(method);
 			String counter = "struct" + methodNumId + "Size" + iVar;
@@ -1555,6 +1554,7 @@ public class IoTCompiler {
 	private void writeStructMembersInitJavaSkeleton(InterfaceDecl intDecl, List<String> methParams,
 			List<String> methPrmTypes, String method) {
 
+		println("int objPos = 0;");
 		for (int i = 0; i < methParams.size(); i++) {
 			String paramType = methPrmTypes.get(i);
 			String param = methParams.get(i);
@@ -1572,7 +1572,6 @@ public class IoTCompiler {
 					println("List<" + simpleType + "> paramStruct" + i + " = new ArrayList<" + simpleType + ">();");
 				} else
 					println(simpleType + " paramStruct" + i + " = new " + simpleType + "();");
-				println("int objPos = 0;");
 				// Initialize members
 				StructDecl structDecl = getStructDecl(simpleType);
 				List<String> members = structDecl.getMembers(simpleType);
@@ -1605,7 +1604,7 @@ public class IoTCompiler {
 				}
 			} else {
 				// Take offsets of parameters
-				println("int offset" + i +" = objPos;");
+				println("int offset" + i +" = objPos++;");
 			}
 		}
 	}
@@ -1741,6 +1740,7 @@ public class IoTCompiler {
 		println(";");
 		println("Class<?>[] paramCls = new Class<?>[paramLen];");
 		println("Class<?>[] paramClsGen = new Class<?>[paramLen];");
+		println("int pos = 0;");
 		// Iterate again over the parameters
 		for (int i = 0; i < methParams.size(); i++) {
 			String paramType = methPrmTypes.get(i);
@@ -3837,7 +3837,6 @@ public class IoTCompiler {
 		List<String> members = structDecl.getMembers(simpleType);
 		int methodNumId = intDecl.getMethodNumId(method);
 		String counter = "struct" + methodNumId + "Size" + iVar;
-		println("int pos = 0;");
 		// Set up variables
 		if (isArrayOrList(paramType, param)) {	// An array or list
 			for (int i = 0; i < members.size(); i++) {
@@ -3970,6 +3969,7 @@ public class IoTCompiler {
 		println(";");
 		println("string paramCls[numParam];");
 		println("void* paramObj[numParam];");
+		println("int pos = 0;");
 		// Iterate again over the parameters
 		for (int i = 0; i < methParams.size(); i++) {
 			String paramType = methPrmTypes.get(i);
diff --git a/iotjava/iotrmi/C++/basics/TestClass.hpp b/iotjava/iotrmi/C++/basics/TestClass.hpp
index f2951ba..9c46644 100644
--- a/iotjava/iotrmi/C++/basics/TestClass.hpp
+++ b/iotjava/iotrmi/C++/basics/TestClass.hpp
@@ -48,11 +48,15 @@ class TestClass : public TestClassInterface {
 		Enum 				handleEnum(Enum en);
 		vector<Enum>		handleEnumArray(vector<Enum> vecEn);
 		vector<Enum>		handleEnumList(vector<Enum> vecEn);
+		Enum				handleEnumComplex(Enum en, int i, char c);
+		vector<Enum>		handleEnumComplex2(vector<Enum> en, int i, char c);
 
 		// Struct
 		Struct				handleStruct(Struct str);
 		vector<Struct>		handleStructArray(vector<Struct> vecStr);
 		vector<Struct>		handleStructList(vector<Struct> vecStr);
+		Struct				handleStructComplex(int in, char c, Struct str);
+		vector<Struct>		handleStructComplex2(int in, char c, vector<Struct> vecStr);
 
 		int					getA();
 		void				setA(int _int);
@@ -305,6 +309,29 @@ vector<Enum> TestClass::handleEnumList(vector<Enum> vecEn) {
 }
 
 
+Enum TestClass::handleEnumComplex(Enum en, int i, char c) {
+
+	cout << "Enum: " << en << endl;
+	cout << "Integer: " << i << endl;
+	cout << "Char: " << c << endl;
+	
+	return en;
+}
+
+
+vector<Enum> TestClass::handleEnumComplex2(vector<Enum> vecEn, int in, char c) {
+
+	for (Enum en : vecEn) {
+		cout << "Enum: " << en << endl;
+	}
+	cout << "Integer: " << in << endl;
+	cout << "Char: " << c << endl;
+	
+	return vecEn;
+}
+
+
+
 // Struct
 Struct TestClass::handleStruct(Struct str) {
 
@@ -358,6 +385,40 @@ vector<Struct> TestClass::handleStructList(vector<Struct> vecStr) {
 }
 
 
+Struct TestClass::handleStructComplex(int in, char c, Struct str) {
+
+	cout << "Name: " << str.name << endl;
+	cout << "Value: " << str.value << endl;
+	cout << "Year: " << str.year << endl;
+
+	cout << "Integer: " << in << endl;
+	cout << "Char: " << c << endl;
+
+	Struct test;
+	test.name = "Anonymous";
+	test.value = 1.33;
+	test.year = 2016;
+	str = test;
+
+	return str;
+}
+
+
+vector<Struct> TestClass::handleStructComplex2(int in, char c, vector<Struct> vecStr) {
+
+	for (Struct str : vecStr) {
+		cout << "Name: " << str.name << endl;
+		cout << "Value: " << str.value << endl;
+		cout << "Year: " << str.year << endl;
+	}
+
+	cout << "Integer: " << in << endl;
+	cout << "Char: " << c << endl;
+
+	return vecStr;
+}
+
+
 string TestClass::sumArray(vector<string> newA) {
 
 	string sum = "";
diff --git a/iotjava/iotrmi/C++/basics/TestClassAdvanced_Stub.cpp b/iotjava/iotrmi/C++/basics/TestClassAdvanced_Stub.cpp
new file mode 100644
index 0000000..f70573e
--- /dev/null
+++ b/iotjava/iotrmi/C++/basics/TestClassAdvanced_Stub.cpp
@@ -0,0 +1,120 @@
+#include <iostream>
+#include <string>
+#include "TestClassComplete_Stub.hpp"
+#include "CallBack.hpp"
+
+using namespace std;
+
+int main(int argc, char *argv[])
+{
+
+	int port = 5010;
+	const char* address = "localhost";
+	//const char* address = "128.195.136.170";	// dc-9.calit2.uci.edu
+	int rev = 0;
+	bool bResult = false;
+	vector<int> ports;
+	ports.push_back(12345);
+
+	TestClassComplete *tcStub = new TestClassComplete_Stub(port, address, rev, &bResult, ports);
+	cout << "==== ENUM ====" << endl;
+/*	Enum en;
+	en = APPLE;
+	Enum res = tcStub->handleEnum(en);
+	cout << "Return value: " << res << endl;
+	Enum resComp = tcStub->handleEnumComplex(en, 23, 'c');
+	cout << "Return value: " << resComp << endl;
+	vector<Enum> vecEn;
+	vecEn.push_back(APPLE);
+	vecEn.push_back(ORANGE);
+	vecEn.push_back(APPLE);
+	vecEn.push_back(GRAPE);
+	vector<Enum> vecRes = tcStub->handleEnumArray(vecEn);
+	for (Enum en : vecRes) {
+		cout << "Enum value: " << en << endl;
+	}
+	vector<Enum> vecRes2 = tcStub->handleEnumList(vecEn);
+	for (Enum en : vecRes2) {
+		cout << "Enum value: " << en << endl;
+	}
+	vector<Enum> vecRes3 = tcStub->handleEnumComplex2(vecEn, 23, 'c');
+	for (Enum en : vecRes3) {
+		cout << "Enum value: " << en << endl;
+	}*/
+
+
+	cout << "==== STRUCT ====" << endl;
+	Struct str;
+	str.name = "Rahmadi";
+	str.value = 0.123;
+	str.year = 2016;
+	Struct resStr = tcStub->handleStruct(str);
+	cout << "Name: " << resStr.name << endl;
+	cout << "Value:" << resStr.value << endl;
+	cout << "Year" << resStr.year << endl;
+	Struct resStr2 = tcStub->handleStructComplex(23, 'c', str);
+	cout << "Name: " << resStr2.name << endl;
+	cout << "Value:" << resStr2.value << endl;
+	cout << "Year" << resStr2.year << endl;
+	Struct str2;
+	str2.name = "Trimananda";
+	str2.value = 0.124;
+	str2.year = 2017;
+	vector<Struct> vecStr;
+	vecStr.push_back(str);
+	vecStr.push_back(str2);
+/*	vector<Struct> vecRetStr = tcStub->handleStructArray(vecStr);
+	for (Struct st : vecRetStr) {
+		cout << "Name: " << st.name << endl;
+		cout << "Value:" << st.value << endl;
+		cout << "Year" << st.year << endl;
+	}
+	vector<Struct> vecRetStr2 = tcStub->handleStructList(vecStr);
+	for (Struct st : vecRetStr2) {
+		cout << "Name: " << st.name << endl;
+		cout << "Value:" << st.value << endl;
+		cout << "Year" << st.year << endl;
+	}*/
+	vector<Struct> vecRetStr3 = tcStub->handleStructComplex2(23, 'c', vecStr);
+	for (Struct st : vecRetStr3) {
+		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(53);
+	CallBackInterface *cb5 = new CallBack(63);
+	CallBackInterface *cb6 = new CallBack(73);
+	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;
+	cout << "Return value: " << tcStub->setAndGetA(123) << endl;
+	cout << "Return value: " << tcStub->setACAndGetA("string", 123) << endl;
+	vector<string> input;
+	input.push_back("123");
+	input.push_back("456");
+	input.push_back("987");
+
+	cout << "Return value: " << tcStub->sumArray(input) << endl;
+*/	
+	return 0;
+}
diff --git a/iotjava/iotrmi/Java/basics/TestClass.java b/iotjava/iotrmi/Java/basics/TestClass.java
index 7031dc2..42e53c2 100644
--- a/iotjava/iotrmi/Java/basics/TestClass.java
+++ b/iotjava/iotrmi/Java/basics/TestClass.java
@@ -1,6 +1,7 @@
 import java.util.Set;
 import java.util.List;
 import java.util.ArrayList;
+import java.util.Arrays;
 
 public class TestClass implements TestClassInterface {
 
@@ -253,6 +254,28 @@ public class TestClass implements TestClassInterface {
 	}
 
 
+	public Enum handleEnumComplex(Enum en, int i, char c) {
+
+		System.out.println("Enum: " + en);
+		System.out.println("Integer: " + i);
+		System.out.println("Char: " + c);
+		
+		return en;
+	}
+
+
+	public Enum[] handleEnumComplex2(Enum[] en, int in, char c) {
+
+		for (Enum e : en) {
+			System.out.println("Enum: " + e);
+		}
+		System.out.println("Integer: " + in);
+		System.out.println("Char: " + c);
+		
+		return en;
+	}
+
+
 	// Struct
 	public Struct handleStruct(Struct str) {
 
@@ -310,6 +333,41 @@ public class TestClass implements TestClassInterface {
 	}
 
 
+	public Struct handleStructComplex(int in, char c, Struct str) {
+
+		System.out.println("Name: " + str.name);
+		System.out.println("Value: " + str.value);
+		System.out.println("Year: " + str.year);
+
+		System.out.println("Integer: " + in);
+		System.out.println("Char: " + c);
+
+		Struct test = new Struct();
+		test.name = "Anonymous";
+		test.value = 1.33f;
+		test.year = 2016;
+
+		str = test;
+
+		return str;
+	}
+
+
+	public List<Struct> handleStructComplex2(int in, char c, Struct str[]) {
+
+		for (Struct st : str) {
+			System.out.println("Name: " + st.name);
+			System.out.println("Value: " + st.value);
+			System.out.println("Year: " + st.year);
+		}
+
+		System.out.println("Integer: " + in);
+		System.out.println("Char: " + c);
+
+		return new ArrayList<Struct>(Arrays.asList(str));
+	}
+
+
 	// Getters
 	public String sumArray(String[] newA) {
 
diff --git a/iotjava/iotrmi/Java/basics/TestClassAdvanced_Stub.java b/iotjava/iotrmi/Java/basics/TestClassAdvanced_Stub.java
new file mode 100644
index 0000000..8261225
--- /dev/null
+++ b/iotjava/iotrmi/Java/basics/TestClassAdvanced_Stub.java
@@ -0,0 +1,93 @@
+import java.util.Arrays;
+import java.util.List;
+import java.util.ArrayList;
+import iotruntime.master.CommunicationHandler;
+
+public class TestClassAdvanced_Stub {
+
+	public static void main(String[] args) throws Exception {
+
+		CommunicationHandler comHan = new CommunicationHandler(true);
+		int numOfPorts = 1;
+		int[] ports = comHan.getCallbackPorts(numOfPorts);
+
+		int port = 5010;
+		String address = "localhost";
+		//String address = "128.195.136.170";	// dc-9.calit2.uci.edu
+		int rev = 0;
+
+		TestClassComplete_Stub tcstub = new TestClassComplete_Stub(port, address, rev, ports);
+		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');
+		System.out.println("Enum member: " + resComp);
+
+		Enum[] enArr = { Enum.APPLE, Enum.ORANGE, Enum.APPLE, Enum.GRAPE };
+		Enum[] resArr = tcstub.handleEnumArray(enArr);
+		System.out.println("Enum members: " + Arrays.toString(resArr));
+		List<Enum> enArr2 = new ArrayList(Arrays.asList(enArr));
+		List<Enum> resArr2 = tcstub.handleEnumList(enArr2);
+		System.out.println("Enum members: " + resArr2.toString());
+		Enum[] resArr3 = tcstub.handleEnumComplex2(enArr, 23, 'c');
+		System.out.println("Enum members: " + Arrays.toString(resArr3));*/
+		
+
+		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 strRes2 = tcstub.handleStructComplex(23, 'c', str);
+		System.out.println("Name: " + strRes2.name);
+		System.out.println("Value: " + strRes2.value);
+		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);
+		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);
+		}*/
+		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);
+		tcstub.registerCallback(cbSingle);
+		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());*/
+
+	}
+}